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.42 by root, Sat Dec 30 10:16:10 2006 UTC vs.
Revision 1.46 by root, Mon Jan 1 00:41:03 2007 UTC

35 35
36// same here, massive symbol spamming 36// same here, massive symbol spamming
37#undef do_open 37#undef do_open
38#undef do_close 38#undef do_close
39#undef ref 39#undef ref
40#undef seed
40 41
41// perl bug #40256: perl does overwrite those with reentrant versions 42// perl bug #40256: perl does overwrite those with reentrant versions
42// but does not initialise their state structures. 43// but does not initialise their state structures.
43#undef random 44#undef random
44#undef crypt 45#undef crypt
45 46
46////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 47//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
47 48
48// some macros to simplify perl in-calls 49// some macros to simplify perl in-calls
49 50
50// FUNCTION is, afaik, a gnu extension
51#define CHECK_ERROR \ 51#define CHECK_ERROR \
52 if (SvTRUE (ERRSV)) \ 52 if (SvTRUE (ERRSV)) \
53 LOG (llevError, "runtime error in %s: %s\n", __func__, SvPVutf8_nolen (ERRSV)); 53 LOG (llevError, "runtime error in %s: %s\n", __func__, SvPVutf8_nolen (ERRSV));
54 54
55#define CALL_BEGIN(args) dSP; ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, args) 55#define CALL_BEGIN(args) dSP; ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, args)
248 } 248 }
249 249
250 *p = '\n'; 250 *p = '\n';
251 } 251 }
252 252
253 void put (keyword k, const char *v) 253 void put (keyword k, const char *v = 0)
254 { 254 {
255 put_string (k, v); 255 put_string (k, v);
256 } 256 }
257 257
258 void put (keyword k, const shstr &v) 258 void put (keyword k, const shstr &v)
384struct coroapi { 384struct coroapi {
385 static struct CoroAPI *GCoroAPI; 385 static struct CoroAPI *GCoroAPI;
386 386
387 static int nready () { return CORO_NREADY; } 387 static int nready () { return CORO_NREADY; }
388 static int cede () { return CORO_CEDE ; } 388 static int cede () { return CORO_CEDE ; }
389
390 static int cede_counter;
391
392 static void cede_every (int count)
393 {
394 if (++cede_counter >= count)
395 {
396 cede_counter = 0;
397
398 if (coroapi::nready ())
399 coroapi::cede ();
400 }
401 }
389}; 402};
390 403
391struct watcher_base 404struct watcher_base
392{ 405{
393 static struct EventAPI *GEventAPI; 406 static struct EventAPI *GEventAPI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines