… | |
… | |
19 | * GNU General Public License for more details. |
19 | * GNU General Public License for more details. |
20 | * |
20 | * |
21 | * You should have received a copy of the GNU General Public License |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 | */ |
24 | */ |
25 | |
25 | |
26 | #define PLUGIN_NAME "perl" |
26 | #define PLUGIN_NAME "perl" |
27 | #define PLUGIN_VERSION "cfperl 0.5" |
27 | #define PLUGIN_VERSION "cfperl 0.5" |
28 | |
28 | |
29 | #include <plugin_common.h> |
29 | #include <plugin_common.h> |
… | |
… | |
192 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
192 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
193 | |
193 | |
194 | template<int N> |
194 | template<int N> |
195 | inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } |
195 | inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } |
196 | |
196 | |
|
|
197 | inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); } |
|
|
198 | inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } |
|
|
199 | inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } |
|
|
200 | inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } |
|
|
201 | inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } |
|
|
202 | |
197 | inline void sv_to (SV *sv, UUID &v) |
203 | inline void sv_to (SV *sv, UUID &v) |
198 | { |
204 | { |
199 | unsigned int version; |
205 | unsigned int version; |
200 | |
206 | |
201 | if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version) |
207 | if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version) |
202 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
208 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
203 | } |
209 | } |
|
|
210 | |
|
|
211 | inline void sv_to (SV *sv, object::flags_t::reference v) { v = boolSV (sv); } |
204 | |
212 | |
205 | static SV * |
213 | static SV * |
206 | newSVdt_va (va_list &ap, data_type type) |
214 | newSVdt_va (va_list &ap, data_type type) |
207 | { |
215 | { |
208 | SV *sv; |
216 | SV *sv; |
… | |
… | |
361 | |
369 | |
362 | HV *hv = (HV *)SvRV ((SV *)self); |
370 | HV *hv = (HV *)SvRV ((SV *)self); |
363 | |
371 | |
364 | if (SvREFCNT ((SV *)self) == 1 |
372 | if (SvREFCNT ((SV *)self) == 1 |
365 | && SvREFCNT ((SV *)hv) == 1 |
373 | && SvREFCNT ((SV *)hv) == 1 |
366 | && !HvKEYS (hv)) |
374 | && !HvTOTALKEYS (hv)) |
367 | { |
375 | { |
368 | SvREFCNT_dec ((SV *)self); |
376 | SvREFCNT_dec ((SV *)self); |
369 | self = 0; |
377 | self = 0; |
370 | } |
378 | } |
371 | } |
379 | } |
… | |
… | |
1008 | |
1016 | |
1009 | switch (KLASS_OF (event)) |
1017 | switch (KLASS_OF (event)) |
1010 | { |
1018 | { |
1011 | case KLASS_OBJECT: PUSHs (sv_2mortal (newSVdt (DT_OBJECT, op))); break; |
1019 | case KLASS_OBJECT: PUSHs (sv_2mortal (newSVdt (DT_OBJECT, op))); break; |
1012 | case KLASS_PLAYER: PUSHs (sv_2mortal (newSVdt (DT_PLAYER, pl))); break; |
1020 | case KLASS_PLAYER: PUSHs (sv_2mortal (newSVdt (DT_PLAYER, pl))); break; |
1013 | case KLASS_CLIENT: PUSHs (sv_2mortal (newSVdt (DT_CLIENT, pl))); break; |
1021 | case KLASS_CLIENT: PUSHs (sv_2mortal (newSVdt (DT_CLIENT, ns))); break; |
1014 | case KLASS_MAP: PUSHs (sv_2mortal (newSVdt (DT_MAP, map))); break; |
1022 | case KLASS_MAP: PUSHs (sv_2mortal (newSVdt (DT_MAP, map))); break; |
1015 | } |
1023 | } |
1016 | |
1024 | |
1017 | for (;;) |
1025 | for (;;) |
1018 | { |
1026 | { |
… | |
… | |
1410 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1418 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1411 | const_iv (FLAG_IS_WATER) |
1419 | const_iv (FLAG_IS_WATER) |
1412 | const_iv (FLAG_CONTENT_ON_GEN) |
1420 | const_iv (FLAG_CONTENT_ON_GEN) |
1413 | const_iv (FLAG_IS_A_TEMPLATE) |
1421 | const_iv (FLAG_IS_A_TEMPLATE) |
1414 | const_iv (FLAG_IS_BUILDABLE) |
1422 | const_iv (FLAG_IS_BUILDABLE) |
1415 | const_iv (FLAG_AFK) |
|
|
1416 | |
1423 | |
1417 | const_iv (NDI_BLACK) |
1424 | const_iv (NDI_BLACK) |
1418 | const_iv (NDI_WHITE) |
1425 | const_iv (NDI_WHITE) |
1419 | const_iv (NDI_NAVY) |
1426 | const_iv (NDI_NAVY) |
1420 | const_iv (NDI_RED) |
1427 | const_iv (NDI_RED) |
… | |
… | |
1621 | const_iv (KLASS_GLOBAL) |
1628 | const_iv (KLASS_GLOBAL) |
1622 | const_iv (KLASS_OBJECT) |
1629 | const_iv (KLASS_OBJECT) |
1623 | const_iv (KLASS_CLIENT) |
1630 | const_iv (KLASS_CLIENT) |
1624 | const_iv (KLASS_PLAYER) |
1631 | const_iv (KLASS_PLAYER) |
1625 | const_iv (KLASS_MAP) |
1632 | const_iv (KLASS_MAP) |
|
|
1633 | |
|
|
1634 | const_iv (CS_QUERY_YESNO) |
|
|
1635 | const_iv (CS_QUERY_SINGLECHAR) |
|
|
1636 | const_iv (CS_QUERY_HIDEINPUT) |
|
|
1637 | |
|
|
1638 | const_iv (ST_DEAD) |
|
|
1639 | const_iv (ST_SETUP) |
|
|
1640 | const_iv (ST_PLAYING) |
|
|
1641 | const_iv (ST_CUSTOM) |
|
|
1642 | |
|
|
1643 | const_iv (ST_CHANGE_CLASS) |
|
|
1644 | const_iv (ST_CONFIRM_QUIT) |
|
|
1645 | const_iv (ST_GET_PARTY_PASSWORD) |
1626 | }; |
1646 | }; |
1627 | |
1647 | |
1628 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1648 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1629 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1649 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1630 | |
1650 | |
… | |
… | |
1738 | |
1758 | |
1739 | int random_roll (int min, int max, object *op, int goodbad); |
1759 | int random_roll (int min, int max, object *op, int goodbad); |
1740 | |
1760 | |
1741 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1761 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1742 | |
1762 | |
1743 | int invoke (int event, ...) |
|
|
1744 | CODE: |
|
|
1745 | if (KLASS_OF (event) != KLASS_GLOBAL) croak ("event class must be GLOBAL"); |
|
|
1746 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1747 | for (int i = 1; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
|
|
1748 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
|
|
1749 | OUTPUT: RETVAL |
|
|
1750 | |
|
|
1751 | int |
1763 | int |
1752 | exp_to_level (val64 exp) |
1764 | exp_to_level (val64 exp) |
1753 | CODE: |
1765 | CODE: |
1754 | { |
1766 | { |
1755 | int i = 0; |
1767 | int i = 0; |
… | |
… | |
1785 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1797 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1786 | else |
1798 | else |
1787 | XSRETURN_UNDEF; |
1799 | XSRETURN_UNDEF; |
1788 | OUTPUT: RETVAL |
1800 | OUTPUT: RETVAL |
1789 | |
1801 | |
|
|
1802 | MODULE = cf PACKAGE = cf::attachable |
|
|
1803 | |
1790 | int |
1804 | int |
1791 | _valid (SV *obj) |
1805 | valid (SV *obj) |
1792 | CODE: |
1806 | CODE: |
1793 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1807 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1794 | OUTPUT: |
1808 | OUTPUT: |
1795 | RETVAL |
1809 | RETVAL |
|
|
1810 | |
|
|
1811 | MODULE = cf PACKAGE = cf::global |
|
|
1812 | |
|
|
1813 | int invoke (SV *klass, int event, ...) |
|
|
1814 | CODE: |
|
|
1815 | if (KLASS_OF (event) != KLASS_GLOBAL) croak ("event class must be GLOBAL"); |
|
|
1816 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1817 | for (int i = 1; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
|
|
1818 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
|
|
1819 | OUTPUT: RETVAL |
1796 | |
1820 | |
1797 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1821 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1798 | |
1822 | |
1799 | INCLUDE: $PERL genacc object ../include/object.h | |
1823 | INCLUDE: $PERL genacc object ../include/object.h | |
1800 | |
1824 | |
… | |
… | |
1819 | RETVAL = object::first; |
1843 | RETVAL = object::first; |
1820 | OUTPUT: RETVAL |
1844 | OUTPUT: RETVAL |
1821 | |
1845 | |
1822 | # missing properties |
1846 | # missing properties |
1823 | |
1847 | |
1824 | int flag (object *op, int flag, int value = 1) |
|
|
1825 | PROTOTYPE: $$;$ |
|
|
1826 | CODE: |
|
|
1827 | RETVAL = QUERY_FLAG (op, flag); |
|
|
1828 | if (items >= 3) |
|
|
1829 | if (value) |
|
|
1830 | SET_FLAG (op, flag); |
|
|
1831 | else |
|
|
1832 | CLEAR_FLAG (op, flag); |
|
|
1833 | OUTPUT: RETVAL |
|
|
1834 | |
|
|
1835 | object *head (object *op) |
1848 | object *head (object *op) |
1836 | PROTOTYPE: $ |
1849 | PROTOTYPE: $ |
1837 | CODE: |
1850 | CODE: |
1838 | RETVAL = op->head ? op->head : op; |
1851 | RETVAL = op->head ? op->head : op; |
1839 | OUTPUT: RETVAL |
1852 | OUTPUT: RETVAL |
… | |
… | |
1849 | PROTOTYPE: $ |
1862 | PROTOTYPE: $ |
1850 | PPCODE: |
1863 | PPCODE: |
1851 | { |
1864 | { |
1852 | object *o; |
1865 | object *o; |
1853 | for (o = obj->inv; o; o = o->below) |
1866 | for (o = obj->inv; o; o = o->below) |
1854 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
1867 | XPUSHs (sv_2mortal (to_sv (o))); |
1855 | } |
1868 | } |
|
|
1869 | |
|
|
1870 | void |
|
|
1871 | set_animation (object *op, int idx) |
|
|
1872 | CODE: |
|
|
1873 | SET_ANIMATION (op, idx); |
|
|
1874 | |
|
|
1875 | void |
|
|
1876 | object::drain_stat () |
|
|
1877 | |
|
|
1878 | void |
|
|
1879 | object::drain_specific_stat (int stat) |
|
|
1880 | |
|
|
1881 | void |
|
|
1882 | object::change_luck (int change) |
|
|
1883 | |
|
|
1884 | void |
|
|
1885 | object::add_statbonus () |
|
|
1886 | |
|
|
1887 | void |
|
|
1888 | object::remove_statbonus () |
1856 | |
1889 | |
1857 | object *find_best_object_match (object *op, const char *match) |
1890 | object *find_best_object_match (object *op, const char *match) |
1858 | |
1891 | |
1859 | object *find_marked_object (object *op) |
1892 | object *find_marked_object (object *op) |
1860 | |
|
|
1861 | int resistance (object *op, int rtype, int newval = 0) |
|
|
1862 | CODE: |
|
|
1863 | if (rtype < 0 || rtype >= NROFATTACKS) |
|
|
1864 | croak ("resistance out of bounds"); |
|
|
1865 | RETVAL = op->resist [rtype]; |
|
|
1866 | if (items >= 3) |
|
|
1867 | op->resist [rtype] = newval; |
|
|
1868 | OUTPUT: RETVAL |
|
|
1869 | |
|
|
1870 | void set_resistance (object *op, int rtype, int val) |
|
|
1871 | CODE: |
|
|
1872 | if (rtype < 0 || rtype >= NROFATTACKS) |
|
|
1873 | op->resist[rtype] = val; |
|
|
1874 | |
1893 | |
1875 | int need_identify (const object *obj); |
1894 | int need_identify (const object *obj); |
1876 | |
1895 | |
1877 | int apply_shop_mat (object *shop_mat, object *op); |
1896 | int apply_shop_mat (object *shop_mat, object *op); |
1878 | |
1897 | |
… | |
… | |
1961 | |
1980 | |
1962 | object *cf_object_insert_in_ob (object *ob, object *where) |
1981 | object *cf_object_insert_in_ob (object *ob, object *where) |
1963 | |
1982 | |
1964 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1983 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1965 | |
1984 | |
1966 | void update (object *op, int action) |
1985 | void update_object (object *op, int action) |
1967 | CODE: |
|
|
1968 | update_object (op, action); |
|
|
1969 | |
1986 | |
1970 | object *cf_create_object_by_name (const char *name) |
1987 | object *cf_create_object_by_name (const char *name) |
1971 | |
1988 | |
1972 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1989 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1973 | |
1990 | |
… | |
… | |
1985 | |
2002 | |
1986 | void remove_button_link (object *op); |
2003 | void remove_button_link (object *op); |
1987 | |
2004 | |
1988 | |
2005 | |
1989 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
2006 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1990 | |
|
|
1991 | void cf_fix_object (object *pl) |
|
|
1992 | ALIAS: fix = 0 |
|
|
1993 | |
2007 | |
1994 | object *cf_insert_ob_in_ob (object *ob, object *where) |
2008 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1995 | |
2009 | |
1996 | # no clean way to get an object from an archetype - stupid idiotic |
2010 | # no clean way to get an object from an archetype - stupid idiotic |
1997 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
2011 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
… | |
… | |
2020 | |
2034 | |
2021 | player *contr (object *op) |
2035 | player *contr (object *op) |
2022 | CODE: |
2036 | CODE: |
2023 | RETVAL = op->contr; |
2037 | RETVAL = op->contr; |
2024 | OUTPUT: RETVAL |
2038 | OUTPUT: RETVAL |
|
|
2039 | |
|
|
2040 | void |
|
|
2041 | object::roll_stats () |
|
|
2042 | |
|
|
2043 | void |
|
|
2044 | object::update_stats () |
|
|
2045 | |
|
|
2046 | void |
|
|
2047 | object::swap_stats (int a, int b) |
2025 | |
2048 | |
2026 | const char *get_ob_key_value (object *op, const char *key) |
2049 | const char *get_ob_key_value (object *op, const char *key) |
2027 | |
2050 | |
2028 | bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) |
2051 | bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) |
2029 | |
2052 | |
… | |
… | |
2064 | player *player (object *op) |
2087 | player *player (object *op) |
2065 | CODE: |
2088 | CODE: |
2066 | RETVAL = op->contr; |
2089 | RETVAL = op->contr; |
2067 | OUTPUT: RETVAL |
2090 | OUTPUT: RETVAL |
2068 | |
2091 | |
|
|
2092 | void check_score (object *op) |
|
|
2093 | |
2069 | void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
2094 | void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
2070 | |
2095 | |
2071 | object *cf_player_send_inventory (object *op) |
2096 | object *cf_player_send_inventory (object *op) |
2072 | |
2097 | |
2073 | char *cf_player_get_ip (object *op) |
2098 | char *cf_player_get_ip (object *op) |
… | |
… | |
2115 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
2140 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
2116 | OUTPUT: RETVAL |
2141 | OUTPUT: RETVAL |
2117 | |
2142 | |
2118 | SV *registry (player *pl) |
2143 | SV *registry (player *pl) |
2119 | |
2144 | |
|
|
2145 | player * |
|
|
2146 | create () |
|
|
2147 | CODE: |
|
|
2148 | RETVAL = player::create (); |
|
|
2149 | OUTPUT: |
|
|
2150 | RETVAL |
|
|
2151 | |
|
|
2152 | player * |
|
|
2153 | load (const char *path) |
|
|
2154 | CODE: |
|
|
2155 | RETVAL = player::load (path); |
|
|
2156 | OUTPUT: |
|
|
2157 | RETVAL |
|
|
2158 | |
|
|
2159 | void |
|
|
2160 | player::save (bool final = false) |
|
|
2161 | |
|
|
2162 | void |
|
|
2163 | player::connect (client *ns) |
|
|
2164 | |
|
|
2165 | void |
|
|
2166 | save_stats (player *pl) |
|
|
2167 | CODE: |
|
|
2168 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
|
|
2169 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
|
|
2170 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
|
|
2171 | pl->orig_stats = pl->ob->stats; |
|
|
2172 | |
2120 | player *cf_player_find (char *name) |
2173 | player *cf_player_find (char *name) |
2121 | PROTOTYPE: $ |
2174 | PROTOTYPE: $ |
2122 | |
2175 | |
2123 | void cf_player_move (player *pl, int dir) |
2176 | void cf_player_move (player *pl, int dir) |
2124 | |
2177 | |
… | |
… | |
2127 | player *first () |
2180 | player *first () |
2128 | CODE: |
2181 | CODE: |
2129 | RETVAL = first_player; |
2182 | RETVAL = first_player; |
2130 | OUTPUT: RETVAL |
2183 | OUTPUT: RETVAL |
2131 | |
2184 | |
2132 | player *next (player *pl) |
|
|
2133 | CODE: |
|
|
2134 | RETVAL = pl->next; |
|
|
2135 | OUTPUT: RETVAL |
|
|
2136 | |
|
|
2137 | bool |
2185 | bool |
2138 | cell_visible (player *pl, int dx, int dy) |
2186 | cell_visible (player *pl, int dx, int dy) |
2139 | CODE: |
2187 | CODE: |
2140 | RETVAL = FABS (dx) <= pl->socket->mapx / 2 && FABS (dy) <= pl->socket->mapy / 2 |
2188 | RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 |
2141 | && !pl->blocked_los [dx + pl->socket->mapx / 2][dy + pl->socket->mapy / 2]; |
2189 | && !pl->blocked_los [dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]; |
2142 | OUTPUT: |
2190 | OUTPUT: |
2143 | RETVAL |
2191 | RETVAL |
2144 | |
2192 | |
2145 | void |
2193 | void |
2146 | send (player *pl, SV *packet) |
2194 | send (player *pl, SV *packet) |
2147 | CODE: |
2195 | CODE: |
2148 | { |
2196 | { |
2149 | STRLEN len; |
2197 | STRLEN len; |
2150 | char *buf = SvPVbyte (packet, len); |
2198 | char *buf = SvPVbyte (packet, len); |
2151 | |
2199 | |
|
|
2200 | if (pl->ns) |
2152 | pl->socket->send_packet (buf, len); |
2201 | pl->ns->send_packet (buf, len); |
2153 | } |
2202 | } |
2154 | |
2203 | |
2155 | int |
2204 | int |
2156 | listening (player *pl, int new_value = -1) |
2205 | listening (player *pl, int new_value = -1) |
2157 | CODE: |
2206 | CODE: |
… | |
… | |
2176 | if (y) sv_to (y, pl->bed_y); |
2225 | if (y) sv_to (y, pl->bed_y); |
2177 | |
2226 | |
2178 | void |
2227 | void |
2179 | list () |
2228 | list () |
2180 | PPCODE: |
2229 | PPCODE: |
2181 | { |
|
|
2182 | player *pl; |
|
|
2183 | for (pl = first_player; pl; pl = pl->next) |
2230 | for (player *pl = first_player; pl; pl = pl->next) |
2184 | XPUSHs (newSVcfapi (CFAPI_PPLAYER, pl)); |
2231 | XPUSHs (sv_2mortal (to_sv (pl))); |
2185 | } |
|
|
2186 | |
2232 | |
2187 | bool |
2233 | bool |
2188 | peaceful (player *pl, bool new_setting = 0) |
2234 | peaceful (player *pl, bool new_setting = 0) |
2189 | PROTOTYPE: $;$ |
2235 | PROTOTYPE: $;$ |
2190 | CODE: |
2236 | CODE: |
… | |
… | |
2452 | RETVAL = INVOKE_((event_type)event, ARG_CLIENT (ns), ARG_AV (av)); |
2498 | RETVAL = INVOKE_((event_type)event, ARG_CLIENT (ns), ARG_AV (av)); |
2453 | OUTPUT: RETVAL |
2499 | OUTPUT: RETVAL |
2454 | |
2500 | |
2455 | SV *registry (client *ns) |
2501 | SV *registry (client *ns) |
2456 | |
2502 | |
|
|
2503 | void |
|
|
2504 | list () |
|
|
2505 | PPCODE: |
|
|
2506 | EXTEND (SP, clients.size ()); |
|
|
2507 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) |
|
|
2508 | PUSHs (sv_2mortal (to_sv (*i))); |
|
|
2509 | |
2457 | client * |
2510 | client * |
2458 | create (int fd, const char *peername) |
2511 | create (int fd, const char *peername) |
2459 | CODE: |
2512 | CODE: |
2460 | RETVAL = client::create (fd, peername); |
2513 | RETVAL = client::create (fd, peername); |
2461 | OUTPUT: |
2514 | OUTPUT: |
2462 | RETVAL |
2515 | RETVAL |
2463 | |
2516 | |
2464 | void |
2517 | void |
|
|
2518 | client::send_packet (SV *packet) |
|
|
2519 | CODE: |
|
|
2520 | { |
|
|
2521 | STRLEN len; |
|
|
2522 | char *buf = SvPVbyte (packet, len); |
|
|
2523 | |
|
|
2524 | THIS->send_packet (buf, len); |
|
|
2525 | } |
|
|
2526 | |
|
|
2527 | void |
2465 | client::destroy () |
2528 | client::destroy () |
2466 | |
2529 | |