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.274 by root, Thu Apr 10 15:35:16 2008 UTC vs.
Revision 1.276 by root, Tue Apr 15 14:21:04 2008 UTC

58 58
59typedef object_thawer &object_thawer_ref; 59typedef object_thawer &object_thawer_ref;
60typedef object_freezer &object_freezer_ref; 60typedef object_freezer &object_freezer_ref;
61 61
62typedef std::string std__string; 62typedef std::string std__string;
63
64#if IVSIZE >= 8
65 typedef IV val64;
66# define newSVval64 newSViv
67# define SvVAL64 SvIV
68#else
69 typedef double val64;
70# define newSVval64 newSVnv
71# define SvVAL64 SvNV
72#endif
73 63
74static PerlInterpreter *perl; 64static PerlInterpreter *perl;
75 65
76tstamp NOW, runtime; 66tstamp NOW, runtime;
77 67
444inline SV *to_sv (living & v) { return to_sv (&v); } 434inline SV *to_sv (living & v) { return to_sv (&v); }
445 435
446inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } 436inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); }
447inline SV *to_sv (const treasurelist *v) { return to_sv (v->name); } 437inline SV *to_sv (const treasurelist *v) { return to_sv (v->name); }
448 438
449inline SV *to_sv (UUID v) 439inline SV *to_sv (UUID v) { return newSVpv (v.c_str (), 0); }
450{
451 char buf[128];
452 snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq);
453 return newSVpv (buf, 0);
454}
455 440
456inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; } 441inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; }
457inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } 442inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; }
458inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } 443inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); }
459inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } 444inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); }
501 v.assign (data, len); 486 v.assign (data, len);
502} 487}
503 488
504inline void sv_to (SV *sv, UUID &v) 489inline void sv_to (SV *sv, UUID &v)
505{ 490{
506 unsigned int version; 491 if (!v.parse (SvPV_nolen (sv)))
507
508 if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version)
509 croak ("unparsable uuid: %s", SvPV_nolen (sv)); 492 croak ("unparsable uuid: %s", SvPV_nolen (sv));
510} 493}
511 494
512inline void sv_to (SV *sv, object::flags_t::reference v) { v = SvTRUE (sv); } 495inline void sv_to (SV *sv, object::flags_t::reference v) { v = SvTRUE (sv); }
513 496
1419 const_iv (ATNR_PARALYZE) const_iv (ATNR_TURN_UNDEAD) const_iv (ATNR_FEAR) const_iv (ATNR_CANCELLATION) 1402 const_iv (ATNR_PARALYZE) const_iv (ATNR_TURN_UNDEAD) const_iv (ATNR_FEAR) const_iv (ATNR_CANCELLATION)
1420 const_iv (ATNR_DEPLETE) const_iv (ATNR_DEATH) const_iv (ATNR_CHAOS) const_iv (ATNR_COUNTERSPELL) 1403 const_iv (ATNR_DEPLETE) const_iv (ATNR_DEATH) const_iv (ATNR_CHAOS) const_iv (ATNR_COUNTERSPELL)
1421 const_iv (ATNR_GODPOWER) const_iv (ATNR_HOLYWORD) const_iv (ATNR_BLIND) const_iv (ATNR_INTERNAL) 1404 const_iv (ATNR_GODPOWER) const_iv (ATNR_HOLYWORD) const_iv (ATNR_BLIND) const_iv (ATNR_INTERNAL)
1422 const_iv (ATNR_LIFE_STEALING) const_iv (ATNR_DISEASE) 1405 const_iv (ATNR_LIFE_STEALING) const_iv (ATNR_DISEASE)
1423 1406
1424 const_iv (MAP_IN_MEMORY) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING) 1407 const_iv (MAP_ACTIVE) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING)
1408 const_iv (MAP_INACTIVE)
1425 1409
1426 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) 1410 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT)
1427 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) 1411 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP)
1428 1412
1429 const_iv (VERSION_CS) const_iv (VERSION_SC) 1413 const_iv (VERSION_CS) const_iv (VERSION_SC)
1749 RETVAL = newSVpv (resist_plus[atnr], 0); 1733 RETVAL = newSVpv (resist_plus[atnr], 0);
1750 else 1734 else
1751 XSRETURN_UNDEF; 1735 XSRETURN_UNDEF;
1752 OUTPUT: RETVAL 1736 OUTPUT: RETVAL
1753 1737
1754SV * 1738UUID
1755uuid_cur () 1739uuid_cur ()
1756 CODE: 1740 CODE:
1757 RETVAL = to_sv (UUID::cur); 1741 RETVAL = UUID::cur;
1758 OUTPUT: 1742 OUTPUT:
1759 RETVAL 1743 RETVAL
1760 1744
1761SV * 1745UUID
1762uuid_gen () 1746uuid_gen ()
1763 CODE: 1747 CODE:
1764 RETVAL = to_sv (UUID::gen ()); 1748 RETVAL = UUID::gen ();
1749 OUTPUT:
1750 RETVAL
1751
1752val64
1753uuid_seq (UUID uuid)
1754 CODE:
1755 RETVAL = uuid.seq;
1756 OUTPUT:
1757 RETVAL
1758
1759UUID
1760uuid_str (val64 seq)
1761 CODE:
1762 RETVAL.seq = seq;
1765 OUTPUT: 1763 OUTPUT:
1766 RETVAL 1764 RETVAL
1767 1765
1768void 1766void
1769coin_names () 1767coin_names ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines