… | |
… | |
58 | |
58 | |
59 | typedef object_thawer &object_thawer_ref; |
59 | typedef object_thawer &object_thawer_ref; |
60 | typedef object_freezer &object_freezer_ref; |
60 | typedef object_freezer &object_freezer_ref; |
61 | |
61 | |
62 | typedef std::string std__string; |
62 | typedef 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 | |
74 | static PerlInterpreter *perl; |
64 | static PerlInterpreter *perl; |
75 | |
65 | |
76 | tstamp NOW, runtime; |
66 | tstamp NOW, runtime; |
77 | |
67 | |
… | |
… | |
444 | inline SV *to_sv (living & v) { return to_sv (&v); } |
434 | inline SV *to_sv (living & v) { return to_sv (&v); } |
445 | |
435 | |
446 | inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } |
436 | inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } |
447 | inline SV *to_sv (const treasurelist *v) { return to_sv (v->name); } |
437 | inline SV *to_sv (const treasurelist *v) { return to_sv (v->name); } |
448 | |
438 | |
449 | inline SV *to_sv (UUID v) |
439 | inline 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 | |
456 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; } |
441 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; } |
457 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
442 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
458 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
443 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
459 | inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } |
444 | inline 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 | |
504 | inline void sv_to (SV *sv, UUID &v) |
489 | inline 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 | |
512 | inline void sv_to (SV *sv, object::flags_t::reference v) { v = SvTRUE (sv); } |
495 | inline 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) |
… | |
… | |
1534 | } |
1518 | } |
1535 | |
1519 | |
1536 | SvCUR_set (data_sv, dst - SvPVX (data_sv)); |
1520 | SvCUR_set (data_sv, dst - SvPVX (data_sv)); |
1537 | } |
1521 | } |
1538 | |
1522 | |
1539 | void evthread_start () |
1523 | void evthread_start (int aiofd) |
1540 | |
1524 | |
1541 | void cede_to_tick () |
1525 | void cede_to_tick () |
1542 | CODE: |
1526 | CODE: |
1543 | coroapi::cede_to_tick (); |
1527 | coroapi::cede_to_tick (); |
1544 | |
1528 | |
… | |
… | |
1748 | if (atnr >= 0 && atnr < NROFATTACKS) |
1732 | if (atnr >= 0 && atnr < NROFATTACKS) |
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 |
|
|
1737 | |
|
|
1738 | UUID |
|
|
1739 | uuid_cur () |
|
|
1740 | CODE: |
|
|
1741 | RETVAL = UUID::cur; |
|
|
1742 | OUTPUT: |
|
|
1743 | RETVAL |
|
|
1744 | |
|
|
1745 | UUID |
|
|
1746 | uuid_gen () |
|
|
1747 | CODE: |
|
|
1748 | RETVAL = UUID::gen (); |
|
|
1749 | OUTPUT: |
|
|
1750 | RETVAL |
|
|
1751 | |
|
|
1752 | val64 |
|
|
1753 | uuid_seq (UUID uuid) |
|
|
1754 | CODE: |
|
|
1755 | RETVAL = uuid.seq; |
|
|
1756 | OUTPUT: |
|
|
1757 | RETVAL |
|
|
1758 | |
|
|
1759 | UUID |
|
|
1760 | uuid_str (val64 seq) |
|
|
1761 | CODE: |
|
|
1762 | RETVAL.seq = seq; |
|
|
1763 | OUTPUT: |
|
|
1764 | RETVAL |
|
|
1765 | |
|
|
1766 | void |
|
|
1767 | coin_names () |
|
|
1768 | PPCODE: |
|
|
1769 | EXTEND (SP, NUM_COINS); |
|
|
1770 | for (int i = 0; i < NUM_COINS; ++i) |
|
|
1771 | PUSHs (sv_2mortal (newSVpv (coins [i], 0))); |
|
|
1772 | |
|
|
1773 | void |
|
|
1774 | coin_archetypes () |
|
|
1775 | PPCODE: |
|
|
1776 | EXTEND (SP, NUM_COINS); |
|
|
1777 | for (int i = 0; i < NUM_COINS; ++i) |
|
|
1778 | PUSHs (sv_2mortal (to_sv (archetype::find (coins [i])))); |
1753 | |
1779 | |
1754 | bool |
1780 | bool |
1755 | load_resource_file (octet_string filename) |
1781 | load_resource_file (octet_string filename) |
1756 | |
1782 | |
1757 | MODULE = cf PACKAGE = cf::attachable |
1783 | MODULE = cf PACKAGE = cf::attachable |