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.275 by root, Fri Apr 11 13:59:06 2008 UTC vs.
Revision 1.280 by root, Mon Apr 21 06:35:26 2008 UTC

43# include <sys/mman.h> 43# include <sys/mman.h>
44#endif 44#endif
45 45
46#if HAVE_MALLOC_H 46#if HAVE_MALLOC_H
47# include <malloc.h> 47# include <malloc.h>
48#endif
49
50#if !__GLIBC__
51# define malloc_trim(pad) -1
48#endif 52#endif
49 53
50#include <EXTERN.h> 54#include <EXTERN.h>
51#include <perl.h> 55#include <perl.h>
52#include <XSUB.h> 56#include <XSUB.h>
1402 const_iv (ATNR_PARALYZE) const_iv (ATNR_TURN_UNDEAD) const_iv (ATNR_FEAR) const_iv (ATNR_CANCELLATION) 1406 const_iv (ATNR_PARALYZE) const_iv (ATNR_TURN_UNDEAD) const_iv (ATNR_FEAR) const_iv (ATNR_CANCELLATION)
1403 const_iv (ATNR_DEPLETE) const_iv (ATNR_DEATH) const_iv (ATNR_CHAOS) const_iv (ATNR_COUNTERSPELL) 1407 const_iv (ATNR_DEPLETE) const_iv (ATNR_DEATH) const_iv (ATNR_CHAOS) const_iv (ATNR_COUNTERSPELL)
1404 const_iv (ATNR_GODPOWER) const_iv (ATNR_HOLYWORD) const_iv (ATNR_BLIND) const_iv (ATNR_INTERNAL) 1408 const_iv (ATNR_GODPOWER) const_iv (ATNR_HOLYWORD) const_iv (ATNR_BLIND) const_iv (ATNR_INTERNAL)
1405 const_iv (ATNR_LIFE_STEALING) const_iv (ATNR_DISEASE) 1409 const_iv (ATNR_LIFE_STEALING) const_iv (ATNR_DISEASE)
1406 1410
1407 const_iv (MAP_IN_MEMORY) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING) 1411 const_iv (MAP_ACTIVE) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING)
1412 const_iv (MAP_INACTIVE)
1408 1413
1409 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) 1414 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT)
1410 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) 1415 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP)
1411 1416
1412 const_iv (VERSION_CS) const_iv (VERSION_SC) 1417 const_iv (VERSION_CS) const_iv (VERSION_SC)
1611octet_string path_combine (octet_string base, octet_string path) 1616octet_string path_combine (octet_string base, octet_string path)
1612 PROTOTYPE: $$ 1617 PROTOTYPE: $$
1613 1618
1614octet_string path_combine_and_normalize (octet_string base, octet_string path) 1619octet_string path_combine_and_normalize (octet_string base, octet_string path)
1615 PROTOTYPE: $$ 1620 PROTOTYPE: $$
1616
1617void
1618mallinfo ()
1619 PPCODE:
1620{
1621#if __GLIBC__
1622 struct mallinfo mai = mallinfo ();
1623 EXTEND (SP, 10*2);
1624 PUSHs (sv_2mortal (newSVpv ("arena" , 0))); PUSHs (sv_2mortal (newSViv (mai.arena)));
1625 PUSHs (sv_2mortal (newSVpv ("ordblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.ordblks)));
1626 PUSHs (sv_2mortal (newSVpv ("smblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.smblks)));
1627 PUSHs (sv_2mortal (newSVpv ("hblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblks)));
1628 PUSHs (sv_2mortal (newSVpv ("hblkhd" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblkhd)));
1629 PUSHs (sv_2mortal (newSVpv ("usmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.usmblks)));
1630 PUSHs (sv_2mortal (newSVpv ("fsmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.fsmblks)));
1631 PUSHs (sv_2mortal (newSVpv ("uordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.uordblks)));
1632 PUSHs (sv_2mortal (newSVpv ("fordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.fordblks)));
1633 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost)));
1634#endif
1635 EXTEND (SP, 2*2);
1636 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc)));
1637 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc)));
1638}
1639 1621
1640void 1622void
1641sub_generation_inc () 1623sub_generation_inc ()
1642 CODE: 1624 CODE:
1643 PL_sub_generation++; 1625 PL_sub_generation++;
1680 1662
1681#if _POSIX_MEMLOCK 1663#if _POSIX_MEMLOCK
1682 1664
1683int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) 1665int mlockall (int flags = MCL_CURRENT | MCL_FUTURE)
1684 INIT: 1666 INIT:
1667#if __GLIBC__
1685 mallopt (M_PERTURB, 0xaa); // bug-workaround for linux glibc+mlockall+calloc 1668 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc
1669#endif
1686 1670
1687int munlockall () 1671int munlockall ()
1688 1672
1689#endif 1673#endif
1674
1675int
1676malloc_trim (IV pad = 0)
1677
1678void
1679mallinfo ()
1680 PPCODE:
1681{
1682#if __GLIBC__
1683 struct mallinfo mai = mallinfo ();
1684 EXTEND (SP, 10*2);
1685 PUSHs (sv_2mortal (newSVpv ("arena" , 0))); PUSHs (sv_2mortal (newSViv (mai.arena)));
1686 PUSHs (sv_2mortal (newSVpv ("ordblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.ordblks)));
1687 PUSHs (sv_2mortal (newSVpv ("smblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.smblks)));
1688 PUSHs (sv_2mortal (newSVpv ("hblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblks)));
1689 PUSHs (sv_2mortal (newSVpv ("hblkhd" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblkhd)));
1690 PUSHs (sv_2mortal (newSVpv ("usmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.usmblks)));
1691 PUSHs (sv_2mortal (newSVpv ("fsmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.fsmblks)));
1692 PUSHs (sv_2mortal (newSVpv ("uordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.uordblks)));
1693 PUSHs (sv_2mortal (newSVpv ("fordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.fordblks)));
1694 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost)));
1695#endif
1696 EXTEND (SP, 2*2);
1697 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc)));
1698 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc)));
1699}
1690 1700
1691int find_animation (utf8_string text) 1701int find_animation (utf8_string text)
1692 PROTOTYPE: $ 1702 PROTOTYPE: $
1693 1703
1694int random_roll (int min, int max, object *op, int goodbad); 1704int random_roll (int min, int max, object *op, int goodbad);
1775 EXTEND (SP, NUM_COINS); 1785 EXTEND (SP, NUM_COINS);
1776 for (int i = 0; i < NUM_COINS; ++i) 1786 for (int i = 0; i < NUM_COINS; ++i)
1777 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i])))); 1787 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i]))));
1778 1788
1779bool 1789bool
1780load_resource_file (octet_string filename) 1790load_resource_file_ (octet_string filename)
1781 1791
1782MODULE = cf PACKAGE = cf::attachable 1792MODULE = cf PACKAGE = cf::attachable
1783 1793
1784int 1794int
1785valid (SV *obj) 1795valid (SV *obj)
2068const_utf8_string 2078const_utf8_string
2069base_name (object *op, int plural = op->nrof > 1) 2079base_name (object *op, int plural = op->nrof > 1)
2070 CODE: 2080 CODE:
2071 RETVAL = query_base_name (op, plural); 2081 RETVAL = query_base_name (op, plural);
2072 OUTPUT: RETVAL 2082 OUTPUT: RETVAL
2073
2074object *decrease_ob_nr (object *op, unsigned long i)
2075 2083
2076# return the tail of an object, excluding itself 2084# return the tail of an object, excluding itself
2077void 2085void
2078tail (object *op) 2086tail (object *op)
2079 PPCODE: 2087 PPCODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines