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

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.70 by elmex, Mon Dec 4 15:15:34 2006 UTC vs.
Revision 1.71 by root, Mon Dec 11 21:37:29 2006 UTC

43extern sint64 *levels; // the experience table 43extern sint64 *levels; // the experience table
44 44
45typedef object object_ornull; 45typedef object object_ornull;
46typedef maptile maptile_ornull; 46typedef maptile maptile_ornull;
47 47
48#if IVSIZE >= 8
49 typedef IV val64;
50# define newSVval64 newSViv
51# define SvVAL64 SvIV
52#else
48typedef double val64; 53 typedef double val64;
49#define newSVval64 newSVnv 54# define newSVval64 newSVnv
50#define SvVAL64 SvNV 55# define SvVAL64 SvNV
56#endif
51 57
52static f_plug_api gethook = cfapi_get_hooks; 58static f_plug_api gethook = cfapi_get_hooks;
53static f_plug_api object_set_property = cfapi_object_set_property; 59static f_plug_api object_set_property = cfapi_object_set_property;
54static f_plug_api object_insert = cfapi_object_insert; 60static f_plug_api object_insert = cfapi_object_insert;
55 61
148inline SV *to_sv (treasurelist * v) { return to_sv (v->name); } 154inline SV *to_sv (treasurelist * v) { return to_sv (v->name); }
149 155
150inline SV *to_sv (UUID v) 156inline SV *to_sv (UUID v)
151{ 157{
152 char buf[128]; 158 char buf[128];
153 snprintf (buf, 128, "<1,%llx>", (unsigned long long)v.seq); 159 snprintf (buf, 128, "<1,%" PRIx64 ">", v.seq);
154 return newSVpv (buf, 0); 160 return newSVpv (buf, 0);
155} 161}
156 162
157inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } 163inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; }
158inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } //TODO: verify that all simple pointers are strdup-managed 164inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } //TODO: verify that all simple pointers are strdup-managed
187inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } 193inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); }
188 194
189inline void sv_to (SV *sv, UUID &v) 195inline void sv_to (SV *sv, UUID &v)
190{ 196{
191 unsigned int version; 197 unsigned int version;
192 unsigned long long seq;
193 198
194 if (2 != sscanf (SvPV_nolen (sv), "<%d.%llx>", &version, &seq) || 1 != version) 199 if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version)
195 croak ("unparsable uuid: %s", SvPV_nolen (sv)); 200 croak ("unparsable uuid: %s", SvPV_nolen (sv));
196
197 v.seq = seq;
198} 201}
199 202
200static SV * 203static SV *
201newSVdt_va (va_list &ap, data_type type) 204newSVdt_va (va_list &ap, data_type type)
202{ 205{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines