… | |
… | |
87 | |
87 | |
88 | #define CALL_BEGIN(args) dSP; ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, args) |
88 | #define CALL_BEGIN(args) dSP; ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, args) |
89 | #define CALL_ARG_SV(sv) PUSHs (sv_2mortal (sv)) // separate because no refcount inc |
89 | #define CALL_ARG_SV(sv) PUSHs (sv_2mortal (sv)) // separate because no refcount inc |
90 | #define CALL_ARG(expr) PUSHs (sv_2mortal (to_sv (expr))) |
90 | #define CALL_ARG(expr) PUSHs (sv_2mortal (to_sv (expr))) |
91 | #define CALL_CALL(name, flags) PUTBACK; int count = call_pv (name, (flags) | G_EVAL); SPAGAIN; |
91 | #define CALL_CALL(name, flags) PUTBACK; int count = call_pv (name, (flags) | G_EVAL); SPAGAIN; |
92 | #define CALL_END CHECK_ERROR; FREETMPS; LEAVE |
92 | #define CALL_END PUTBACK; CHECK_ERROR; FREETMPS; LEAVE |
93 | |
93 | |
94 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
94 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
95 | |
95 | |
96 | void cfperl_init (); |
96 | void cfperl_init (); |
97 | void cfperl_main (); |
97 | void cfperl_main (); |
… | |
… | |
99 | void cfperl_emergency_save (); |
99 | void cfperl_emergency_save (); |
100 | void cfperl_cleanup (int make_core); |
100 | void cfperl_cleanup (int make_core); |
101 | void cfperl_make_book (object *book, int level); |
101 | void cfperl_make_book (object *book, int level); |
102 | void cfperl_send_msg (client *ns, int color, const char *type, const char *msg); |
102 | void cfperl_send_msg (client *ns, int color, const char *type, const char *msg); |
103 | int cfperl_can_merge (object *ob1, object *ob2); |
103 | int cfperl_can_merge (object *ob1, object *ob2); |
|
|
104 | void cfperl_mapscript_activate (object *ob, int state, object *activator, object *originator = 0); |
|
|
105 | |
|
|
106 | bool is_match_expr (const char *expr); |
|
|
107 | /* applies the match expression and returns true if it matches */ |
|
|
108 | bool match (const char *expr, object *ob, object *self = 0, object *source = 0, object *originator = 0); |
104 | |
109 | |
105 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
110 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
106 | |
111 | |
107 | #if IVSIZE >= 8 |
112 | #if IVSIZE >= 8 |
108 | typedef IV val64; |
113 | typedef IV val64; |
… | |
… | |
183 | INTERFACE_CLASS (attachable) |
188 | INTERFACE_CLASS (attachable) |
184 | struct attachable : refcnt_base |
189 | struct attachable : refcnt_base |
185 | { |
190 | { |
186 | static MGVTBL vtbl; |
191 | static MGVTBL vtbl; |
187 | |
192 | |
188 | static unordered_vector<attachable *> mortals; |
|
|
189 | MTH static void check_mortals (); |
|
|
190 | |
|
|
191 | enum { |
193 | enum { |
192 | F_DESTROYED = 0x01, |
194 | F_DESTROYED = 0x01, |
193 | F_DEBUG_TRACE = 0x02, |
195 | F_DEBUG_TRACE = 0x02, |
194 | }; |
196 | }; |
195 | int ACC (RW, flags); |
197 | uint8 ACC (RW, flags); |
|
|
198 | |
|
|
199 | static unordered_vector<attachable *> mortals; |
|
|
200 | MTH static void check_mortals (); |
196 | |
201 | |
197 | // object is delete'd after the refcount reaches 0 |
202 | // object is delete'd after the refcount reaches 0 |
198 | MTH int refcnt_cnt () const; |
203 | MTH int refcnt_cnt () const; |
199 | // check wether the object has died and destroy |
204 | // check wether the object has died and destroy |
200 | MTH void refcnt_chk () { if (expect_false (refcnt <= 0)) do_check (); } |
205 | MTH void refcnt_chk () { if (expect_false (refcnt <= 0)) do_check (); } |
… | |
… | |
288 | ~object_freezer (); |
293 | ~object_freezer (); |
289 | |
294 | |
290 | void put (attachable *ext); |
295 | void put (attachable *ext); |
291 | |
296 | |
292 | // used only for user-defined key-value pairs |
297 | // used only for user-defined key-value pairs |
293 | void put (const shstr &k, const shstr &v) |
298 | void put (shstr_tmp k, shstr_tmp v) |
294 | { |
299 | { |
295 | add (k); |
300 | add (k); |
296 | |
301 | |
297 | if (expect_true (v)) |
302 | if (expect_true (v)) |
298 | add (' '), add (v); |
303 | add (' '), add (v); |
… | |
… | |
322 | void put (keyword k, const char *v = 0) |
327 | void put (keyword k, const char *v = 0) |
323 | { |
328 | { |
324 | put_kw_string (k, v); |
329 | put_kw_string (k, v); |
325 | } |
330 | } |
326 | |
331 | |
327 | void put (keyword k, const shstr &v) |
332 | void put (keyword k, shstr_tmp v) |
328 | { |
333 | { |
329 | put_kw_string (k, v); |
334 | put_kw_string (k, v); |
330 | } |
335 | } |
331 | |
336 | |
332 | void put (keyword k, double v) |
337 | void put (keyword k, double v) |
… | |
… | |
366 | void put (keyword k, signed long v) { put_(k, (sint64)v); } |
371 | void put (keyword k, signed long v) { put_(k, (sint64)v); } |
367 | void put (keyword k, unsigned long v) { put_(k, (sint64)v); } |
372 | void put (keyword k, unsigned long v) { put_(k, (sint64)v); } |
368 | void put (keyword k, signed long long v) { put_(k, (sint64)v); } |
373 | void put (keyword k, signed long long v) { put_(k, (sint64)v); } |
369 | void put (keyword k, unsigned long long v) { put_(k, (sint64)v); } |
374 | void put (keyword k, unsigned long long v) { put_(k, (sint64)v); } |
370 | |
375 | |
371 | void put (keyword kbeg, keyword kend, const shstr &v) |
376 | void put (keyword kbeg, keyword kend, shstr_tmp v) |
372 | { |
377 | { |
373 | force (MAX_KEYWORD_LEN + 1); |
378 | force (MAX_KEYWORD_LEN + 1); |
374 | fadd (keyword_str [kbeg], keyword_len [kbeg]); fadd ('\n'); |
379 | fadd (keyword_str [kbeg], keyword_len [kbeg]); fadd ('\n'); |
375 | |
380 | |
376 | if (expect_true (v)) |
381 | if (expect_true (v)) |