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.247 by root, Tue Sep 4 05:43:21 2007 UTC vs.
Revision 1.253 by root, Mon Sep 10 17:24:36 2007 UTC

97 *stash_cf_living_wrap; 97 *stash_cf_living_wrap;
98 98
99static inline SV * 99static inline SV *
100newSVpv_utf8 (const char *s) 100newSVpv_utf8 (const char *s)
101{ 101{
102 if (!s)
103 return newSV (0);
104
102 SV *sv = newSVpv (s, 0); 105 SV *sv = newSVpv (s, 0);
103 SvUTF8_on (sv); 106 SvUTF8_on (sv);
104 return sv; 107 return sv;
105} 108}
106 109
107static inline SV * 110static inline SV *
108newSVpvn_utf8 (const char *s, STRLEN l) 111newSVpvn_utf8 (const char *s, STRLEN l)
109{ 112{
113 if (!s)
114 return newSV (0);
115
110 SV *sv = newSVpvn (s, l); 116 SV *sv = newSVpvn (s, l);
111 SvUTF8_on (sv); 117 SvUTF8_on (sv);
112 return sv; 118 return sv;
113} 119}
114 120
321newSVptr (void *ptr, HV *stash, HV *hv = newHV ()) 327newSVptr (void *ptr, HV *stash, HV *hv = newHV ())
322{ 328{
323 SV *sv; 329 SV *sv;
324 330
325 if (!ptr) 331 if (!ptr)
326 return &PL_sv_undef; 332 return newSV (0);
327 333
328 sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0); 334 sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0);
329 return sv_bless (newRV_noinc ((SV *)hv), stash); 335 return sv_bless (newRV_noinc ((SV *)hv), stash);
330} 336}
331 337
350 356
351static SV * 357static SV *
352newSVattachable (attachable *obj, HV *stash) 358newSVattachable (attachable *obj, HV *stash)
353{ 359{
354 if (!obj) 360 if (!obj)
355 return &PL_sv_undef; 361 return newSV (0);
356 362
357 if (!obj->self) 363 if (!obj->self)
358 obj->self = newHV (); 364 obj->self = newHV ();
359 365
360 if (!SvOBJECT (obj->self)) 366 if (!SvOBJECT (obj->self))
407 return SvPTR (sv, klass); 413 return SvPTR (sv, klass);
408 else 414 else
409 return 0; 415 return 0;
410} 416}
411 417
412inline SV *to_sv (const shstr & v) { return v ? newSVpvn_utf8 ((const char *)v, v.length ()) : &PL_sv_undef; } 418inline SV *to_sv (const shstr & v) { return newSVpvn_utf8 ((const char *)v, v.length ()); }
413inline SV *to_sv (const char * v) { return newSVpv (v, 0); } 419inline SV *to_sv (const char * v) { return v ? newSVpv (v, 0) : newSV (0); }
414inline SV *to_sv (bool v) { return newSViv (v); } 420inline SV *to_sv (bool v) { return newSViv (v); }
415inline SV *to_sv ( signed char v) { return newSViv (v); } 421inline SV *to_sv ( signed char v) { return newSViv (v); }
416inline SV *to_sv (unsigned char v) { return newSViv (v); } 422inline SV *to_sv (unsigned char v) { return newSViv (v); }
417inline SV *to_sv ( signed short v) { return newSViv (v); } 423inline SV *to_sv ( signed short v) { return newSViv (v); }
418inline SV *to_sv (unsigned short v) { return newSVuv (v); } 424inline SV *to_sv (unsigned short v) { return newSVuv (v); }
524 break; 530 break;
525 531
526 case DT_STRING: 532 case DT_STRING:
527 { 533 {
528 char *str = (char *)va_arg (ap, const char *); 534 char *str = (char *)va_arg (ap, const char *);
529 sv = str ? newSVpv (str, 0) : &PL_sv_undef; 535 sv = str ? newSVpv (str, 0) : newSV (0);
530 } 536 }
531 break; 537 break;
532 538
533 case DT_DATA: 539 case DT_DATA:
534 { 540 {
535 char *str = (char *)va_arg (ap, const void *); 541 char *str = (char *)va_arg (ap, const void *);
536 int len = va_arg (ap, int); 542 int len = va_arg (ap, int);
537 sv = str ? newSVpv (str, len) : &PL_sv_undef; 543 sv = str ? newSVpv (str, len) : newSV (0);
538 } 544 }
539 break; 545 break;
540 546
541 case DT_OBJECT: 547 case DT_OBJECT:
542 sv = to_sv (va_arg (ap, object *)); 548 sv = to_sv (va_arg (ap, object *));
1144} 1150}
1145 1151
1146object * 1152object *
1147object::deref (const char *ref) 1153object::deref (const char *ref)
1148{ 1154{
1149 object *retval; 1155 object *retval = 0;
1150 1156
1157 if (ref)
1158 {
1151 CALL_BEGIN (1); 1159 CALL_BEGIN (1);
1152 CALL_ARG (ref); 1160 CALL_ARG (ref);
1153 CALL_CALL ("cf::object::deref", G_SCALAR); 1161 CALL_CALL ("cf::object::deref", G_SCALAR);
1154 1162
1155 if (count) 1163 if (count)
1156 sv_to (POPs, retval); 1164 sv_to (POPs, retval);
1157 else
1158 retval = 0;
1159 1165
1160 CALL_END; 1166 CALL_END;
1167 }
1161 1168
1162 return retval; 1169 return retval;
1163} 1170}
1164 1171
1165void 1172void
1431 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) 1438 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED)
1432 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN) 1439 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN)
1433 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD) 1440 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD)
1434 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE) 1441 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE)
1435 const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK) 1442 const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK)
1436 const_iv (NDI_NOCREATE) 1443 const_iv (NDI_NOCREATE) const_iv (NDI_CLEAR)
1437 1444
1438 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1445 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE)
1439 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) 1446 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1440 1447
1441 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1448 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
1548 const_iv (MAP_IN_MEMORY) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING) 1555 const_iv (MAP_IN_MEMORY) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING)
1549 1556
1550 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) 1557 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT)
1551 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) 1558 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP)
1552 1559
1560 const_iv (VERSION_CS) const_iv (VERSION_SC)
1561
1553 const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) 1562 const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT)
1554 1563
1555 const_iv (ST_DEAD) const_iv (ST_SETUP) const_iv (ST_PLAYING) const_iv (ST_CUSTOM) 1564 const_iv (ST_DEAD) const_iv (ST_SETUP) const_iv (ST_PLAYING) const_iv (ST_CUSTOM)
1556 1565
1557 const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES) 1566 const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES)
2863 CODE: 2872 CODE:
2864 object_thawer *self; 2873 object_thawer *self;
2865 sv_to (sv, self); 2874 sv_to (sv, self);
2866 delete self; 2875 delete self;
2867 2876
2877void
2878extract_tags (object_thawer *self)
2879 CODE:
2880 while (self->kw != KW_EOF)
2881 {
2882 coroapi::cede_to_tick_every (5000);
2883
2884 if (self->kw == KW_tag)
2885 XPUSHs (sv_2mortal (to_sv (self->get_str ())));
2886
2887 self->skip ();
2888 }
2889

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines