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.23 by root, Mon Sep 4 13:55:54 2006 UTC vs.
Revision 1.27 by root, Sun Sep 17 18:19:19 2006 UTC

52#define ARG_INT(v) DT_INT , static_cast<int> (v) 52#define ARG_INT(v) DT_INT , static_cast<int> (v)
53#define ARG_INT64(v) DT_INT64 , static_cast<sint64> (v) 53#define ARG_INT64(v) DT_INT64 , static_cast<sint64> (v)
54#define ARG_DOUBLE(v) DT_DOUBLE, static_cast<double> (v) 54#define ARG_DOUBLE(v) DT_DOUBLE, static_cast<double> (v)
55#define ARG_STRING(v) DT_STRING, static_cast<const char *> (v) 55#define ARG_STRING(v) DT_STRING, static_cast<const char *> (v)
56#define ARG_DATA(s,l) DT_DATA , static_cast<const void *> (s), (l) 56#define ARG_DATA(s,l) DT_DATA , static_cast<const void *> (s), (l)
57#define ARG_OBJECT(o) DT_OBJECT, (void *)static_cast<struct object *> (o) 57#define ARG_OBJECT(o) DT_OBJECT, (void *)static_cast<object *> (o)
58#define ARG_MAP(o) DT_MAP , (void *)static_cast<struct mapstruct *> (o) 58#define ARG_MAP(o) DT_MAP , (void *)static_cast<maptile *> (o)
59#define ARG_PLAYER(o) DT_PLAYER, (void *)static_cast<struct pl *> (o) 59#define ARG_PLAYER(o) DT_PLAYER, (void *)static_cast<player *> (o)
60#define ARG_ARCH(o) DT_ARCH , (void *)static_cast<struct archetype *> (o) 60#define ARG_ARCH(o) DT_ARCH , (void *)static_cast<archetype *> (o)
61#define ARG_PARTY(o) DT_PARTY , (void *)static_cast<struct party *> (o) 61#define ARG_PARTY(o) DT_PARTY , (void *)static_cast<party *> (o)
62#define ARG_REGION(o) DT_REGION, (void *)static_cast<struct region *> (o) 62#define ARG_REGION(o) DT_REGION, (void *)static_cast<region *> (o)
63 63
64// the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension 64// the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension
65 65
66// all these return true when the normal event processing should be skipped (if any) 66// all these return true when the normal event processing should be skipped (if any)
67#define INVOKE_(event, ...) cfperl_invoke (event, ## __VA_ARGS__, DT_END) 67#define INVOKE_(event, ...) cfperl_invoke (event, ## __VA_ARGS__, DT_END)
73#define INVOKE_MAP(event, map, ...) INVOKE_(EVENT_ ## MAP ## _ ## event, ARG_MAP (map) , ## __VA_ARGS__) 73#define INVOKE_MAP(event, map, ...) INVOKE_(EVENT_ ## MAP ## _ ## event, ARG_MAP (map) , ## __VA_ARGS__)
74 74
75//TODO should index into @result 75//TODO should index into @result
76#define RESULT(idx,type) cfperl_result_ ## type (idx) 76#define RESULT(idx,type) cfperl_result_ ## type (idx)
77#define RESULT_INT(idx) RESULT(idx, INT) 77#define RESULT_INT(idx) RESULT(idx, INT)
78#define RESULT_MAP(idx) RESULT(idx, MAP)
78 79
79bool cfperl_invoke (event_type event, ...); 80bool cfperl_invoke (event_type event, ...);
80int cfperl_result_INT (int idx); 81int cfperl_result_INT (int idx);
82int cfperl_result_MAP (int idx);
81 83
82struct attachable_base 84struct attachable_base
83{ 85{
84 SV *self; 86 SV *self;
85 AV *cb; // CF+ perl self and callback 87 AV *cb; // CF+ perl self and callback
99 attachable_base () 101 attachable_base ()
100 { 102 {
101 attachable_clear (); 103 attachable_clear ();
102 } 104 }
103 105
106 ~attachable_base ()
107 {
108 clear ();
109 }
110
104 attachable_base (const attachable_base &src) 111 attachable_base (const attachable_base &src)
105 : self (0), cb (0), attach (src.attach) 112 : self (0), cb (0), attach (src.attach)
106 { 113 {
114 }
115
116 attachable_base &operator = (const attachable_base &src)
117 {
118 clear ();
119 attach = src.attach;
120 return *this;
107 } 121 }
108}; 122};
109 123
110// objects attachable from perl (or any other extension) should include or 124// objects attachable from perl (or any other extension) should include or
111// derive using the curiously recurring template pattern, to avoid 125// derive using the curiously recurring template pattern, to avoid

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines