--- deliantra/server/include/cfperl.h 2006/08/30 11:02:15 1.15 +++ deliantra/server/include/cfperl.h 2006/08/30 16:30:37 1.16 @@ -4,11 +4,35 @@ #ifndef CFPERL_H__ #define CFPERL_H__ +#include + +using namespace std; + +#include +#include + +// optimisations/workaround for functions requiring my_perl in scope (anti-bloat) +#undef localtime +#undef srand48 +#undef drand48 +#undef srandom +#undef readdir +#undef getprotobyname +#undef gethostbyname +#undef ctime +#undef strerror + +// perl bug #40256: perl does overwrite those with reentrant versions +// but does not initialise their state structures. +#undef random +#undef crypt + struct pl; struct object; struct mapstruct; void cfperl_init (); +void cfperl_boot (); void cfperl_main (); // could have used templates, but a more traditional C api @@ -82,7 +106,8 @@ struct attachable_base { - void *self, *cb; // CF+ perl self and callback + struct sv *self; + struct av *cb; // CF+ perl self and callback const char *attach; // generic extension attachment information void clear (); // called when free'ing objects @@ -91,7 +116,8 @@ void attachable_init () { - self = cb = 0; + self = 0; + cb = 0; attach = 0; } }; @@ -116,12 +142,12 @@ struct object_freezethaw { - void *av; - FILE *fp; + struct av *av; }; struct object_freezer : object_freezethaw { + struct sv *text; void *filename; object_freezer (const char *filename); @@ -135,11 +161,13 @@ put ((attachable_base *)obj); } - operator bool () { return !!fp; } + operator bool () { return !!av; } }; struct object_thawer : object_freezethaw { + FILE *fp; + object_thawer (const char *filename = 0); ~object_thawer (); @@ -155,6 +183,7 @@ operator FILE *() { return fp; } }; +// compatibility support, should be removed when no longer needed int fprintf (object_freezer &freezer, const char *format, ...); int fputs (const char *s, object_freezer &freezer);