ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/cfperl.h
(Generate patch)

Comparing deliantra/server/include/cfperl.h (file contents):
Revision 1.47 by root, Sun Jan 7 02:39:14 2007 UTC vs.
Revision 1.53 by root, Thu Feb 1 19:15:39 2007 UTC

60 60
61////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 61//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
62 62
63void cfperl_init (); 63void cfperl_init ();
64void cfperl_main (); 64void cfperl_main ();
65void cfperl_emergency_save ();
65 66
66////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 67//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
67 68
68// virtual server time, excluding time jumps and lag 69// virtual server time, excluding time jumps and lag
69extern double runtime; 70extern double runtime;
130 static unordered_vector<attachable *> mortals; 131 static unordered_vector<attachable *> mortals;
131 MTH static void check_mortals (); 132 MTH static void check_mortals ();
132 133
133 enum { 134 enum {
134 F_DESTROYED = 0x01, 135 F_DESTROYED = 0x01,
135 F_BORROWED = 0x02,
136 }; 136 };
137 137
138 // object is delete'd after the refcount reaches 0 138 // object is delete'd after the refcount reaches 0
139 mutable int ACC (RW, refcnt); 139 mutable int ACC (RW, refcnt);
140 int ACC (RW, flags); 140 int ACC (RW, flags);
141 141
142 MTH void refcnt_inc () const { ++refcnt; } 142 MTH void refcnt_inc () const { ++refcnt; }
143 MTH void refcnt_dec () const { --refcnt; } 143 MTH void refcnt_dec () const { --refcnt; }
144 144
145 MTH int refcnt_cnt () const;
145 // check wether the object has died and destroy 146 // check wether the object has died and destroy
146 MTH void refcnt_chk () { if (refcnt <= 0) do_check (); } 147 MTH void refcnt_chk () { if (refcnt <= 0) do_check (); }
147 148
148 // destroy the object unless it was already destroyed 149 // destroy the object unless it was already destroyed
149 // this politely asks everybody interested the reduce 150 // this politely asks everybody interested the reduce
163 164
164 HV *self; // CF+ perl self 165 HV *self; // CF+ perl self
165 AV *cb; // CF+ callbacks 166 AV *cb; // CF+ callbacks
166 shstr attach; // generic extension attachment information 167 shstr attach; // generic extension attachment information
167 168
169 void sever_self (); // sever this object from its self, if it has one.
168 void optimise (); // possibly save some memory by destroying unneeded data 170 void optimise (); // possibly save some memory by destroying unneeded data
169 171
170 attachable () 172 attachable ()
171 : flags (0), refcnt (0), self (0), cb (0), attach (0) 173 : flags (0), refcnt (0), self (0), cb (0), attach (0)
172 { 174 {
173 } 175 }
180 virtual ~attachable (); 182 virtual ~attachable ();
181 183
182 attachable &operator =(const attachable &src); 184 attachable &operator =(const attachable &src);
183 185
184 bool invoke (event_type event, ...); 186 bool invoke (event_type event, ...);
185 void instantiate (); 187 MTH void instantiate ();
186 void reattach (); 188 void reattach ();
187 189
188protected: 190protected:
189 // do the real refcount checking work 191 // do the real refcount checking work
190 void do_check (); 192 void do_check ();
338 340
339struct object_thawer 341struct object_thawer
340{ 342{
341 SV *text; // text part 343 SV *text; // text part
342 AV *av; // perl part 344 AV *av; // perl part
345 int linenum;
343 char *line; // current beginning of line 346 char *line; // current beginning of line
344 char *last_keyword, *last_value; 347 char *last_keyword, *last_value;
345 const char *name; 348 const char *name;
346 349
347 operator bool () { return !!text; } 350 operator bool () { return !!text; }
375 void get (uint16 &i) { i = get_sint32 (); } 378 void get (uint16 &i) { i = get_sint32 (); }
376 void get (sint32 &i) { i = get_sint32 (); } 379 void get (sint32 &i) { i = get_sint32 (); }
377 380
378 void get (uint32 &i) { i = get_sint64 (); } 381 void get (uint32 &i) { i = get_sint64 (); }
379 void get (sint64 &i) { i = get_sint64 (); } 382 void get (sint64 &i) { i = get_sint64 (); }
380};
381 383
384 bool parse_error (keyword kw, const char *type = 0, const char *name = 0, bool skip = true);
385};
386
387//TODO: remove
382char *fgets (char *s, int n, object_thawer &thawer); 388char *fgets (char *s, int n, object_thawer &thawer);
383 389
384////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 390//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
385 391
386struct coroapi { 392struct coroapi {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines