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.276 by root, Tue Apr 15 14:21:04 2008 UTC vs.
Revision 1.281 by root, Tue Apr 22 07:01:47 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>
1428 1432
1429 const_iv (SYMMETRY_RANDOM) const_iv (SYMMETRY_NONE) const_iv (SYMMETRY_X) 1433 const_iv (SYMMETRY_RANDOM) const_iv (SYMMETRY_NONE) const_iv (SYMMETRY_X)
1430 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) 1434 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY)
1431 1435
1432 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP) 1436 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP)
1433 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV) 1437 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_MINIMAL)
1434 const_iv (GT_MINIMAL)
1435 1438
1436 const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND) 1439 const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND)
1437 const_iv (FT_RSRC) const_iv (FT_NUM) 1440 const_iv (FT_RSRC) const_iv (FT_NUM)
1438 }; 1441 };
1439 1442
1612octet_string path_combine (octet_string base, octet_string path) 1615octet_string path_combine (octet_string base, octet_string path)
1613 PROTOTYPE: $$ 1616 PROTOTYPE: $$
1614 1617
1615octet_string path_combine_and_normalize (octet_string base, octet_string path) 1618octet_string path_combine_and_normalize (octet_string base, octet_string path)
1616 PROTOTYPE: $$ 1619 PROTOTYPE: $$
1617
1618void
1619mallinfo ()
1620 PPCODE:
1621{
1622#if __GLIBC__
1623 struct mallinfo mai = mallinfo ();
1624 EXTEND (SP, 10*2);
1625 PUSHs (sv_2mortal (newSVpv ("arena" , 0))); PUSHs (sv_2mortal (newSViv (mai.arena)));
1626 PUSHs (sv_2mortal (newSVpv ("ordblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.ordblks)));
1627 PUSHs (sv_2mortal (newSVpv ("smblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.smblks)));
1628 PUSHs (sv_2mortal (newSVpv ("hblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblks)));
1629 PUSHs (sv_2mortal (newSVpv ("hblkhd" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblkhd)));
1630 PUSHs (sv_2mortal (newSVpv ("usmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.usmblks)));
1631 PUSHs (sv_2mortal (newSVpv ("fsmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.fsmblks)));
1632 PUSHs (sv_2mortal (newSVpv ("uordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.uordblks)));
1633 PUSHs (sv_2mortal (newSVpv ("fordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.fordblks)));
1634 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost)));
1635#endif
1636 EXTEND (SP, 2*2);
1637 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc)));
1638 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc)));
1639}
1640 1620
1641void 1621void
1642sub_generation_inc () 1622sub_generation_inc ()
1643 CODE: 1623 CODE:
1644 PL_sub_generation++; 1624 PL_sub_generation++;
1681 1661
1682#if _POSIX_MEMLOCK 1662#if _POSIX_MEMLOCK
1683 1663
1684int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) 1664int mlockall (int flags = MCL_CURRENT | MCL_FUTURE)
1685 INIT: 1665 INIT:
1666#if __GLIBC__
1686 mallopt (M_PERTURB, 0xaa); // bug-workaround for linux glibc+mlockall+calloc 1667 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc
1668#endif
1687 1669
1688int munlockall () 1670int munlockall ()
1689 1671
1690#endif 1672#endif
1673
1674int
1675malloc_trim (IV pad = 0)
1676
1677void
1678mallinfo ()
1679 PPCODE:
1680{
1681#if __GLIBC__
1682 struct mallinfo mai = mallinfo ();
1683 EXTEND (SP, 10*2);
1684 PUSHs (sv_2mortal (newSVpv ("arena" , 0))); PUSHs (sv_2mortal (newSViv (mai.arena)));
1685 PUSHs (sv_2mortal (newSVpv ("ordblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.ordblks)));
1686 PUSHs (sv_2mortal (newSVpv ("smblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.smblks)));
1687 PUSHs (sv_2mortal (newSVpv ("hblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblks)));
1688 PUSHs (sv_2mortal (newSVpv ("hblkhd" , 0))); PUSHs (sv_2mortal (newSViv (mai.hblkhd)));
1689 PUSHs (sv_2mortal (newSVpv ("usmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.usmblks)));
1690 PUSHs (sv_2mortal (newSVpv ("fsmblks" , 0))); PUSHs (sv_2mortal (newSViv (mai.fsmblks)));
1691 PUSHs (sv_2mortal (newSVpv ("uordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.uordblks)));
1692 PUSHs (sv_2mortal (newSVpv ("fordblks", 0))); PUSHs (sv_2mortal (newSViv (mai.fordblks)));
1693 PUSHs (sv_2mortal (newSVpv ("keepcost", 0))); PUSHs (sv_2mortal (newSViv (mai.keepcost)));
1694#endif
1695 EXTEND (SP, 2*2);
1696 PUSHs (sv_2mortal (newSVpv ("slice_alloc", 0))); PUSHs (sv_2mortal (newSVuv (slice_alloc)));
1697 PUSHs (sv_2mortal (newSVpv ("shstr_alloc", 0))); PUSHs (sv_2mortal (newSVuv (shstr_alloc)));
1698}
1691 1699
1692int find_animation (utf8_string text) 1700int find_animation (utf8_string text)
1693 PROTOTYPE: $ 1701 PROTOTYPE: $
1694 1702
1695int random_roll (int min, int max, object *op, int goodbad); 1703int random_roll (int min, int max, object *op, int goodbad);
1776 EXTEND (SP, NUM_COINS); 1784 EXTEND (SP, NUM_COINS);
1777 for (int i = 0; i < NUM_COINS; ++i) 1785 for (int i = 0; i < NUM_COINS; ++i)
1778 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i])))); 1786 PUSHs (sv_2mortal (to_sv (archetype::find (coins [i]))));
1779 1787
1780bool 1788bool
1781load_resource_file (octet_string filename) 1789load_resource_file_ (octet_string filename)
1782 1790
1783MODULE = cf PACKAGE = cf::attachable 1791MODULE = cf PACKAGE = cf::attachable
1784 1792
1785int 1793int
1786valid (SV *obj) 1794valid (SV *obj)
2069const_utf8_string 2077const_utf8_string
2070base_name (object *op, int plural = op->nrof > 1) 2078base_name (object *op, int plural = op->nrof > 1)
2071 CODE: 2079 CODE:
2072 RETVAL = query_base_name (op, plural); 2080 RETVAL = query_base_name (op, plural);
2073 OUTPUT: RETVAL 2081 OUTPUT: RETVAL
2074
2075object *decrease_ob_nr (object *op, unsigned long i)
2076 2082
2077# return the tail of an object, excluding itself 2083# return the tail of an object, excluding itself
2078void 2084void
2079tail (object *op) 2085tail (object *op)
2080 PPCODE: 2086 PPCODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines