Result:
found more than 1151 distributions - search limited to the first 2001 files matching your query ( run in 2.689 )


Linux-Seccomp

 view release on metacpan or  search on metacpan

fallback/const-xs.inc  view on Meta::CPAN

	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */

 view all matches for this distribution


Linux-Setns

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- Almost complete rewrite of the function!
	- Changed the interface, to setns(). Now instead of file descriptor we directly give it path to a namespace file. This removes the need to convert Perl FD into C FD.
	- Improved the error handling and now we catch all setns() errors
	- Replaced __NR_setns with SYS_setns. In order for the change to work I also changed the included headers
	- Simplified the setns() function in the XS code
	- Replaced the PPCODE with CODE and now I properly return the RETVAL from the XS code
	- Added new test for invalid path

0.05  Fri Jun 03 10:52:49 2016
	- Replaced the Perl 5.18 requirement with Perl 5.10

 view all matches for this distribution


Linux-Shadow

 view release on metacpan or  search on metacpan

Shadow.xs  view on Meta::CPAN

void
getspnam (name)
        const char * name
    INIT:
        struct spwd *shadow;
    PPCODE:
        shadow = getspnam(name);
        if (shadow) {
            XPUSHs(sv_2mortal(newSVpvf("%s", shadow->sp_namp)));
            XPUSHs(sv_2mortal(newSVpvf("%s", shadow->sp_pwdp)));
            XPUSHs(sv_2mortal(newSViv(shadow->sp_lstchg)));

Shadow.xs  view on Meta::CPAN


void
getspent ()
    INIT:
        struct spwd *shadow;
    PPCODE:
        shadow = getspent();
        if (shadow) {
            XPUSHs(sv_2mortal(newSVpvf("%s", shadow->sp_namp)));
            XPUSHs(sv_2mortal(newSVpvf("%s", shadow->sp_pwdp)));
            XPUSHs(sv_2mortal(newSViv(shadow->sp_lstchg)));

 view all matches for this distribution


Linux-Smaps-Tiny

 view release on metacpan or  search on metacpan

Tiny.xs  view on Meta::CPAN

MODULE = Linux::Smaps::Tiny PACKAGE = Linux::Smaps::Tiny
PROTOTYPES: DISABLE

SV*
get_smaps_summary(char* process = "self")
PPCODE:
    struct smaps_sizes sizes;
    memset(&sizes, 0, sizeof sizes);

    char filename[100];
    memset(&filename, 0, sizeof filename);

 view all matches for this distribution


Linux-Socket-Accept4

 view release on metacpan or  search on metacpan

lib/Linux/Socket/Accept4.xs  view on Meta::CPAN

    IO *gstio;
    IO *nstio;
    char namebuf[MAXPATHLEN];
    Sock_size_t len = sizeof namebuf;
    int fd;
PPCODE:
{
        if (items !=3) {
            croak("Usage: accept4(ngv, ggv, flags)");
        }
        switch (SvTYPE(ST(0))) {

 view all matches for this distribution


Linux-Svgalib

 view release on metacpan or  search on metacpan

Svgalib.xs  view on Meta::CPAN

int xdim
int ydim
int cols
int xbytes
int bytespp
   PPCODE:
      IV newmode;
      SV *retmode; 

      newmode = (IV)vga_addmode(xdim, ydim, cols, xbytes, bytespp);

Svgalib.xs  view on Meta::CPAN

int	VDisplay
int	VSyncStart
int	VSyncEnd
int	VTotal
int	flags
   PPCODE:
      vga_addtiming(pixelClock, 
                       HDisplay, 
                       HSyncStart, 
                       HSyncEnd, 
                       HTotal, 

Svgalib.xs  view on Meta::CPAN

int	VDisplay
int	VSyncStart
int	VSyncEnd
int	VTotal
int	flags
   PPCODE:
      vga_changetiming(pixelClock, 
                       HDisplay, 
                       HSyncStart, 
                       HSyncEnd, 
                       HTotal, 

Svgalib.xs  view on Meta::CPAN

      

void
clear(self)
SV *self
   PPCODE:
      vga_clear();  

void
disabledriverreport(self)
SV *self
    PPCODE:
       vga_disabledriverreport();

void
drawline(self,x1, y1, x2, y2)
SV *self
int  x1
int  y1
int  x2
int  y2
  PPCODE:
     vga_drawline(x1,y1,x2,y2);

void
drawpixel(self,x, y)
SV *self
SV  *x
SV  *y 
   PPCODE: 
     int i_x;
     int i_y;

     i_x = (int)SvIV(x);
     i_y = (int)SvIV(y);

Svgalib.xs  view on Meta::CPAN

void
drawscanline(self,line, colors)
SV *self
SV *line
SV *colors
   PPCODE:
      int _line;
      char *_colors;
      AV *av_colors;

      if (SvROK(colors) && (SvTYPE(SvRV(colors)) == SVt_PVAV))

Svgalib.xs  view on Meta::CPAN

drawscansegment(self,colors, x, y)
SV *self
SV *colors
SV *x
SV *y
   PPCODE:  
      int i_x;
      int i_y;
      int length; 
      char *_colors;
      AV *av_colors;

Svgalib.xs  view on Meta::CPAN

      }

SV *
getch(self)
SV *self
  PPCODE:
    UV c;
    SV *ret;

    c = (UV)vga_getch();

Svgalib.xs  view on Meta::CPAN

   PUSHs(sv_2mortal(ret));

SV *
getcolors(self)
SV *self
   PPCODE:
     SV *num_colors;

     num_colors = newSViv((IV)vga_getcolors());
     EXTEND(SP,1);
     PUSHs(sv_2mortal(num_colors));      

SV *
getcurrentchipset(self)
SV *self
   PPCODE:
     IV chipset;
     SV *ret;

     chipset = (IV)vga_getcurrentchipset();

Svgalib.xs  view on Meta::CPAN



SV *
getcurrentmode(self)
SV *self
   PPCODE:
     IV mode;
     SV *ret;

     mode = (IV)vga_getcurrentmode();

Svgalib.xs  view on Meta::CPAN

     PUSHs(sv_2mortal(ret));      

void
getcurrenttiming(self)
SV *self
   PPCODE:
	int *pixelClock;
	int *HDisplay;
	int *HSyncStart;
	int *HSyncEnd;
	int *HTotal;

Svgalib.xs  view on Meta::CPAN

        PUSHs(sv_2mortal(newSViv((IV) *flags)));

void
getdefaultmode(self)
SV *self
  PPCODE:
    SV *ret;

    ret = newSViv(vga_getdefaultmode());
    EXTEND(SP,1);
    PUSHs(sv_2mortal(ret));


void
getkey(self)
SV *self
   PPCODE:
     int _key;
     SV *key;

     _key = vga_getkey();

Svgalib.xs  view on Meta::CPAN


void
getmodeinfo(self,mode)
SV *self
SV* mode
  PPCODE:
    vga_modeinfo *mi;
    
    HV *mi_stash;
    HV *mi_h;
    SV *mi_ref;

Svgalib.xs  view on Meta::CPAN


SV *
getmodename(self,mode)
SV *self
SV *mode
    PPCODE:
       int i_mode;
       SV  *modename;


       i_mode = SvIV(mode);

Svgalib.xs  view on Meta::CPAN


SV *
getmodenumber(self,name)
SV *self
SV *name
   PPCODE:
     SV *modenumber;
     char *modename;

     modename = SvPV_nolen(name);

Svgalib.xs  view on Meta::CPAN

     PUSHs(modenumber);

void
getmonitortype(self)
SV *self
   PPCODE:
     EXTEND(SP,1);
     PUSHs(sv_2mortal(newSViv(vga_getmonitortype())));

void
getpalette(self, index)
SV *self
int index
   PPCODE:
	int *	red;
	int *	green;
	int *	blue;

        vga_getpalette(index,red, green, blue);

Svgalib.xs  view on Meta::CPAN

void
getpixel(self,x, y)
SV *self
SV *x
SV *y
  PPCODE:
    IV pcol;
    int i_x;
    int i_y;
    SV *ret;

Svgalib.xs  view on Meta::CPAN

getscansegment(self, x, y, length)
SV *self
SV *x
SV *y
SV *length
     PPCODE:
       char *_colors;
       AV *av_colors;  
       SV *ret;
       int i_x;
       int i_y;

Svgalib.xs  view on Meta::CPAN

       PUSHs(sv_2mortal(ret));
       
void
getxdim(self)
SV *self
   PPCODE:
     SV *xdim;
   
     xdim = newSViv((IV)vga_getxdim());
     EXTEND(SP,1);
     PUSHs(sv_2mortal(xdim));

void
getydim(self)
SV *self
   PPCODE:
     SV *ydim;
   
     ydim = newSViv((IV)vga_getydim());
     EXTEND(SP,1);
     PUSHs(sv_2mortal(ydim));

SV *
hasmode(self,mode)
SV *self
SV *mode
   PPCODE:
      IV ret;
      SV *rc;
      int _mode;

      _mode = (int)SvIV(mode);

Svgalib.xs  view on Meta::CPAN

      PUSHs(sv_2mortal(rc)); 
     
SV *
init(self)
SV * self
  PPCODE:
    SV *ret;
      
    if (vga_init() != 0 )
    { 
      ret = &PL_sv_no;

Svgalib.xs  view on Meta::CPAN

    PUSHs(sv_2mortal(ret));
     
SV *
lastmodenumber(self)
SV *self
  PPCODE:
     SV *mode;
     mode = newSViv(vga_lastmodenumber());
     EXTEND(SP,1);
     PUSHs(sv_2mortal(mode));  

void
lockvc(self)
SV *self
  PPCODE:
    vga_lockvc();

SV *
oktowrite(self)
SV *self
  PPCODE:
    SV *ret;
    EXTEND(SP,1);
    if ( vga_oktowrite() == 0 )
    {
      ret = &PL_sv_yes;

Svgalib.xs  view on Meta::CPAN

 

void
screenoff(self)
SV *self
   PPCODE:
     vga_screenoff();

void
screenon(self)
SV *self
   PPCODE:
    vga_screenon();

void
setcolor(self,color)
SV *self
SV *color
     PPCODE:
        IV  _color;

        _color = SvIV(color); 
 
        vga_setcolor(_color);

SV *
setmode(self,mode)
SV *self
SV *mode
   PPCODE:
     IV _mode;
     IV ret;
     SV *rc;

     _mode = SvIV(mode);

Svgalib.xs  view on Meta::CPAN

SV *self
SV *index
SV *red
SV *green
SV *blue
   PPCODE:
      int _index, _red, _green, _blue;

      _index = SvIV(index);
      _red   = SvIV(red);
      _green = SvIV(green);

Svgalib.xs  view on Meta::CPAN

setrgbcolor(self,red, green, blue)
SV *self
SV *red
SV *green
SV *blue
   PPCODE:
      int  _red, _green, _blue;

      _red   = SvIV(red);
      _green = SvIV(green);
      _blue  = SvIV(blue);

Svgalib.xs  view on Meta::CPAN



void
unlockvc(self)
SV *self
    PPCODE:
      vga_unlockvc();

void
white(self)
SV *self
  PPCODE:
     SV *white;

     white = newSViv((IV)vga_white());

     EXTEND(SP,1);

 view all matches for this distribution


Linux-Sys-CPU-Affinity

 view release on metacpan or  search on metacpan

Affinity.xs  view on Meta::CPAN



IV cpu_isset (cpuset, cpu)
    Linux_Sys_CPU_Affinity *cpuset
    UV cpu
PPCODE:
    int res = CPU_ISSET_S((uint32_t) cpu, cpuset->size, cpuset->set);
    mXPUSHu( res );
    XSRETURN(1);


void cpu_set (cpuset, cpu)
    Linux_Sys_CPU_Affinity *cpuset
    UV cpu
PPCODE:
    CPU_SET_S((uint32_t) cpu, cpuset->size, cpuset->set);
    XSRETURN_EMPTY;


void cpu_clr (cpuset, cpu)
    Linux_Sys_CPU_Affinity *cpuset
    UV cpu
PPCODE:
    CPU_CLR_S((uint32_t) cpu, cpuset->size, cpuset->set);
    XSRETURN_EMPTY;


UV cpu_count(cpuset)
    Linux_Sys_CPU_Affinity *cpuset
PPCODE:
    int cpu_count = CPU_COUNT_S(cpuset->size, cpuset->set);
    mXPUSHu( cpu_count ); // PUSHs(sv_2mortal(newSVuv(cpu_count)));
    XSRETURN(1);


IV cpu_equal (cpusetA, cpusetB)
    Linux_Sys_CPU_Affinity *cpusetA
    Linux_Sys_CPU_Affinity *cpusetB
PPCODE:
    int res = 0;
    if (cpusetA->size == cpusetB->size)
        res = CPU_EQUAL_S(cpusetA->size, cpusetA->set, cpusetB->set);
    mXPUSHu( res );
    XSRETURN(1);

Affinity.xs  view on Meta::CPAN



IV set_affinity(cpuset, pid)
    Linux_Sys_CPU_Affinity *cpuset
    UV pid
PPCODE:
    int res = sched_setaffinity((pid_t) pid, cpuset->size, cpuset->set);
    if (res == -1) {
        SV *error = get_sched_error_text(errno, 0);
        croak((char *) SvPV_nolen(error));
    }
    mXPUSHi( res );
    XSRETURN(1);


void DESTROY (cpuset)
PPCODE:
    Linux_Sys_CPU_Affinity *self = (Linux_Sys_CPU_Affinity *) SvUV(SvRV(ST(0)));
    if (PL_dirty)
        return;
    CPU_FREE(self->set);
    safefree(self);
    XSRETURN_EMPTY;


IV get_nprocs ()
PPCODE:
    int nprocs = get_available_nprocs();
    mXPUSHi( nprocs );
    XSRETURN(1);

 view all matches for this distribution


Linux-Sysfs

 view release on metacpan or  search on metacpan

xs/Bus.xs  view on Meta::CPAN

get_devices(bus)
		struct sysfs_bus* bus
	PREINIT:
		struct dlist* dev_list = NULL;
		struct sysfs_device* dev = NULL;
	PPCODE:
		dev_list = sysfs_get_bus_devices(bus);

		if (dev_list == NULL)
			XSRETURN_EMPTY;

xs/Bus.xs  view on Meta::CPAN

get_drivers(bus)
		struct sysfs_bus* bus
	PREINIT:
		struct dlist* drv_list = NULL;
		struct sysfs_driver* drv = NULL;
	PPCODE:
		drv_list = sysfs_get_bus_drivers(bus);

		if (drv_list == NULL)
			XSRETURN_EMPTY;

 view all matches for this distribution


Linux-Termios2

 view release on metacpan or  search on metacpan

lib/Linux/Termios2.xs  view on Meta::CPAN


void
getattr(self, fd)
  Linux::Termios2 self
  int             fd
  PPCODE:
    if(ioctl(fd, TCGETS2, self))
      XSRETURN_UNDEF;

    ST(0) = &PL_sv_yes;
    XSRETURN(1);

lib/Linux/Termios2.xs  view on Meta::CPAN

void
setattr(self, fd, act)
  Linux::Termios2 self
  int             fd
  int             act
  PPCODE:
  {
    int ctl;
    switch(act) {
      case TCSANOW:   ctl = TCSETS2; break;
      case TCSADRAIN: ctl = TCSETSW2; break;

 view all matches for this distribution


Linux-Unshare

 view release on metacpan or  search on metacpan

fallback/const-xs.inc  view on Meta::CPAN

	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */

 view all matches for this distribution


Linux-UserXAttr

 view release on metacpan or  search on metacpan

UserXAttr.xs  view on Meta::CPAN

setxattr(handle, name, value, flags=0)
     SV* handle
     char *name
     SV *value
     int flags
  PPCODE:
{
  STRLEN vlen;
  int fd=handle2fd(handle);
  char *vcp;
  vcp=SvPV(value, vlen);

UserXAttr.xs  view on Meta::CPAN


void
getxattr(handle, name)
     SV* handle
     char *name
  PPCODE:
{
  int fd=handle2fd(handle);
  char buf[4096];
  ssize_t rc;

UserXAttr.xs  view on Meta::CPAN

}

void
listxattr(handle)
     SV* handle
  PPCODE:
{
  int fd=handle2fd(handle);
  char buf[4096];
  ssize_t rc;

UserXAttr.xs  view on Meta::CPAN


void
removexattr(handle, name)
     SV* handle
     char *name
  PPCODE:
{
  int fd=handle2fd(handle);

  if( fd>=0 ) {
    if( !fremovexattr(fd, name) ) {

UserXAttr.xs  view on Meta::CPAN

lsetxattr(path, name, value, flags=0)
     char *path
     char *name
     SV *value
     int flags
  PPCODE:
{
  STRLEN len;
  char *cp=SvPV(value, len);
  if( !lsetxattr(path, name, cp, len, flags) ) {
    mPUSHi(1);

UserXAttr.xs  view on Meta::CPAN


void
lgetxattr(path, name)
     char *path
     char *name
  PPCODE:
{
  char buf[4096];
  ssize_t rc;

  errno=0;

UserXAttr.xs  view on Meta::CPAN


void
lremovexattr(path, name)
     char *path
     char *name
  PPCODE:
{
  if( !lremovexattr(path, name) ) {
    mPUSHi(1);
  }
}

void
llistxattr(path)
     char *path
  PPCODE:
{
  char buf[4096];
  ssize_t rc;

  errno=0;

 view all matches for this distribution


Linux-WireGuard

 view release on metacpan or  search on metacpan

WireGuard.xs  view on Meta::CPAN


PROTOTYPES: DISABLE

void
list_device_names()
    PPCODE:
        char *device_names, *device_name;
        size_t len;

        device_names = wg_list_device_names();
        if (!device_names) {

 view all matches for this distribution


Linux-loadavg

 view release on metacpan or  search on metacpan

loadavg.xs  view on Meta::CPAN

PROTOTYPE: ;$
PREINIT:
   double loadavg[3];
   int     rc, i;
   int     nelem;
PPCODE:
   if (items == 0) {
     nelem = 3;
   } else {
     nelem = atoi(SvPV_nolen(ST(0)));
   }

 view all matches for this distribution


List-BinarySearch-XS

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.04 2013-09-17
  - Improvements to auto-generated META.* files.

0.03 2013-09-06
  - Micro-optimization in XS code for binsearch (Consolidated output code
    into PPCODE section.
  - Remove "DEV RELEASE" mention in POD.

0.02 2013-09-05
  - PUBLIC RELEASE
  - Enough smoke tests have trickled in that I'm comfortable with portability

 view all matches for this distribution


List-Flatten-XS

 view release on metacpan or  search on metacpan

lib/List/Flatten/XS.xs  view on Meta::CPAN


void *
flatten(ref, svlevel = sv_2mortal(newSViv(-1)))
    SV *ref;
    SV *svlevel;
PPCODE:
{
    if (!SvROK(ref) || SvTYPE(SvRV(ref)) != SVt_PVAV)
        Perl_croak(aTHX_ "Please pass an array reference to the first argument");
    
    IV level = SvIV(svlevel);

 view all matches for this distribution


List-Helpers-XS

 view release on metacpan or  search on metacpan

XS.xs  view on Meta::CPAN

#endif

AV* random_slice (av, num)
    AV* av
    IV num
PPCODE:

    if (num < 0)
        croak("The slice's size can't be less than 0");

    if (num != 0) {

XS.xs  view on Meta::CPAN

    XSRETURN(1);


void shuffle (av)
    AV *av
PPCODE:
    SSize_t len = av_len(av);
    /* it's faster than "shuffle_av_first_num_elements" */
    shuffle_av_last_num_elements(av, len, len);
    XSRETURN_EMPTY;


void shuffle_multi(av, ...)
    AV* av;
PPCODE:
    static SSize_t i;
    static SSize_t len;
    SV* sv;
    SV *ref;

 view all matches for this distribution


List-MergeSorted-XS

 view release on metacpan or  search on metacpan

const-xs.inc  view on Meta::CPAN

	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
	type = constant(aTHX_ s, len);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:

 view all matches for this distribution


List-MoreUtils-XS

 view release on metacpan or  search on metacpan

XS.xs  view on Meta::CPAN

pairwise (code, list1, list2)
    SV *code;
    AV *list1;
    AV *list2;
PROTOTYPE: &\@\@
PPCODE:
{
    dMULTICALL;
    dMULTICALLSVCV;
    int i, maxitems;
    AV *rc = newAV();

 view all matches for this distribution


List-Slice

 view release on metacpan or  search on metacpan

Slice.xs  view on Meta::CPAN

head(size,...)
PROTOTYPE: $@
ALIAS:
    head = 0
    tail = 1
PPCODE:
{
    int size = 0;
    int start = 0;
    int end = 0;
    int i = 0;

 view all matches for this distribution


List-SomeUtils-XS

 view release on metacpan or  search on metacpan

XS.xs  view on Meta::CPAN


void
pairwise (code, ...)
    SV *code;
PROTOTYPE: &\@\@
PPCODE:
{
#define av_items(a) (av_len(a)+1)

    /* This function is not quite as efficient as it ought to be: We call
     * 'code' multiple times and want to gather its return values all in one

XS.xs  view on Meta::CPAN

    RETVAL

void
mode (...)
PROTOTYPE: @
PPCODE:
{
    int i;
    unsigned int max = 0;
    unsigned int c = 0;
    unsigned int modality = 0;

 view all matches for this distribution


List-Uniqnum

 view release on metacpan or  search on metacpan

Uniqnum.xs  view on Meta::CPAN

void
uniqnum (input_sv, ...)
	SV *	input_sv
        PREINIT:
        I32* temp;
        PPCODE:
        temp = PL_markstack_ptr++;
        uniqnum(aTHX_ input_sv);
        if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
          PL_markstack_ptr = temp;

 view all matches for this distribution


Location-GeoTool

 view release on metacpan or  search on metacpan

GeoTool.xs  view on Meta::CPAN

    double lat
    double lon
    double tlat
    double tlon

    PPCODE:
    double e2,r,tu1,tu2;
    double cu1,su1,cu2,s1,b1,f1,x,d;
    double sx,cx,sy,cy,y,sa,c2a,cz,e,c;
    double dir,dis;
    int iter;

GeoTool.xs  view on Meta::CPAN

    double lat
    double lon
    double dir
    double dis

    PPCODE:
    double r,tu,sf,cf,b,cu,su,sa,c2a,x;
    double c,d,y,sy,cy,cz,e;
    double rlat,rlon;

    lat = lat *rd;

GeoTool.xs  view on Meta::CPAN

    double dx
    double dy
    double dz
    double rd

    PPCODE:
    double bda,e2,da,df,db,dl,dh;
    double sb,cb,sl,cl,rn,rm;
    double rb,rl,rh;

    b *= rd;

 view all matches for this distribution


Log-Syslog-Fast

 view release on metacpan or  search on metacpan

fallback/const-xs.inc  view on Meta::CPAN

	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
	type = constant(aTHX_ s, len);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:

 view all matches for this distribution


Lua-API

 view release on metacpan or  search on metacpan

API.xs  view on Meta::CPAN

 # of parameters
void
lua_checkstack(L, sz, ...)
	lua_State *	L
	int	  sz
	PPCODE:
	  /* call lua_checkstack */
	  if ( items == 2 )
	  {
	    int status = lua_checkstack( L, sz );
            EXTEND(SP, 1);

API.xs  view on Meta::CPAN

	int	n

void
lua_getmetatable(L, ...)
	lua_State *	L
      PPCODE:
	if ( items != 1 )
	    croak_xs_usage( cv, "L,(objindex|name)" );
	if ( looks_like_number( ST(1) ) )
	{
	    int	objindex = (int)SvIV(ST(1));

API.xs  view on Meta::CPAN

	char *CLASS = NO_INIT
    PROTOTYPE: $
    ALIAS:
	open = 1
	new = 2
    PPCODE:
        RETVAL = luaL_newstate();
	ST(0) = sv_newmortal();
        sv_setref_iv(ST(0), "Lua::API::State", PTR2IV(RETVAL));
	set_Perl_object( RETVAL, ST(0) );
        XSRETURN(1);

API.xs  view on Meta::CPAN


lua_Debug *
new(CLASS)
	char *CLASS = NO_INIT
    PROTOTYPE: $
    PPCODE:
        Newxz( RETVAL, 1, lua_Debug );
	ST(0) = sv_newmortal();
        sv_setref_iv(ST(0), "Lua::API::Debug", PTR2IV(RETVAL));
	set_Perl_object( RETVAL, ST(0) );
        XSRETURN(1);

API.xs  view on Meta::CPAN


luaL_Buffer *
new(CLASS)
	char *CLASS = NO_INIT
    PROTOTYPE: $
    PPCODE:
        Newxz( RETVAL, 1, luaL_Buffer );
	ST(0) = sv_newmortal();
        sv_setref_iv(ST(0), "Lua::API::Buffer", PTR2IV(RETVAL));
	set_Perl_object( RETVAL, ST(0) );
        XSRETURN(1);

 view all matches for this distribution


Lucy

 view release on metacpan or  search on metacpan

buildlib/Lucy/Build/Binding/Analysis.pm  view on Meta::CPAN


void
set_text(self, sv)
    lucy_Token *self;
    SV *sv;
PPCODE:
{
    STRLEN len;
    char *ptr = SvPVutf8(sv, len);
    LUCY_Token_Set_Text(self, ptr, len);
}

 view all matches for this distribution


Lugh

 view release on metacpan or  search on metacpan

lib/Lugh.xs  view on Meta::CPAN

OUTPUT:
    RETVAL

void
available_backends()
PPCODE:
{
    size_t i, count;
    /* Always include "auto" option */
    count = ggml_backend_reg_count();
    EXTEND(SP, count + 1);

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int i, j;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Parse named parameters: forward(tokens => \@t, lora => $l, ...) */
    parse_forward_options(aTHX_ &opts, &ST(0), 1, items);

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int j;
PPCODE:
    if (!SvROK(tokens_ref) || SvTYPE(SvRV(tokens_ref)) != SVt_PVAV) {
        croak("forward_simple() requires an array reference");
    }
    
    hv = (HV*)SvRV(self);

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int j;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Detect positional: forward_cache($cache, \@tokens, ...) */
    if (items >= 3 && sv_isobject(ST(1)) && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVAV) {

lib/Lugh.xs  view on Meta::CPAN

    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int j;
    SV **svp;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Detect positional: forward_pool($pool, \@tokens, ...) */
    if (items >= 3 && sv_isobject(ST(1)) && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVAV) {

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int i, j;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Detect positional: forward_batch(\@sequences, ...) */
    if (items >= 2 && SvROK(ST(1)) && SvTYPE(SvRV(ST(1))) == SVt_PVAV) {

lib/Lugh.xs  view on Meta::CPAN

    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int j;
    SV **svp;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Detect positional: forward_cache_pool($cache, $pool, \@tokens, ...) */
    if (items >= 4 && sv_isobject(ST(1)) && sv_isobject(ST(2)) &&

lib/Lugh.xs  view on Meta::CPAN

    HV *hv;
    LughForwardOpts opts;
    LughForwardResult result;
    int i, j;
    SV **svp;
PPCODE:
    hv = (HV*)SvRV(self);
    Zero(&opts, 1, LughForwardOpts);

    /* Detect positional: forward_batch_pool($pool, \@sequences, ...) */
    if (items >= 3 && sv_isobject(ST(1)) && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVAV) {

lib/Lugh.xs  view on Meta::CPAN

    int greedy = 0;
    SV *callback = NULL;
    int i;
    int n_result;
    SV **orig_sp;
PPCODE:
    orig_sp = SP;  /* Save original stack pointer */
    
    /* Get model */
    hv = (HV*)SvRV(self);
    svp = hv_fetch(hv, "_model", 6, 0);

lib/Lugh.xs  view on Meta::CPAN

    AV *tokens;
    int add_bos = 1;
    int bos_id, eos_id, unk_id;
    size_t pos;
    int i;
PPCODE:
    hv = (HV*)SvRV(self);
    
    svp = hv_fetch(hv, "_token_to_id", 12, 0);
    if (!svp || !SvROK(*svp)) croak("Tokenizer not initialized");
    token_to_id = (HV*)SvRV(*svp);

lib/Lugh.xs  view on Meta::CPAN

get_f32(self)
    SV *self
PREINIT:
    struct ggml_tensor *tensor;
    int64_t i, n_elements;
PPCODE:
    tensor = INT2PTR(struct ggml_tensor *, SvIV(SvRV(self)));
    n_elements = ggml_nelements(tensor);
    
    EXTEND(SP, n_elements);
    for (i = 0; i < n_elements; i++) {

lib/Lugh.xs  view on Meta::CPAN

shape(self)
    SV *self
PREINIT:
    struct ggml_tensor *tensor;
    int i, n_dims;
PPCODE:
    tensor = INT2PTR(struct ggml_tensor *, SvIV(SvRV(self)));
    n_dims = ggml_n_dims(tensor);
    
    EXTEND(SP, n_dims);
    for (i = 0; i < n_dims; i++) {

lib/Lugh.xs  view on Meta::CPAN

    SV *self
    const char *name
PREINIT:
    LughModel *lm;
    struct ggml_tensor *t;
PPCODE:
    lm = get_lugh_model(aTHX_ self);
    t = ggml_get_tensor(lm->ctx, name);
    if (t) {
        /* Return: type, n_dims, ne[0], ne[1], ne[2], ne[3] */
        EXTEND(SP, 6);

lib/Lugh.xs  view on Meta::CPAN

tensor_names(self)
    SV *self
PREINIT:
    LughModel *lm;
    int64_t i;
PPCODE:
    lm = get_lugh_model(aTHX_ self);
    EXTEND(SP, lm->n_tensors);
    for (i = 0; i < lm->n_tensors; i++) {
        mPUSHs(newSVpv(gguf_get_tensor_name(lm->gguf, i), 0));
    }

lib/Lugh.xs  view on Meta::CPAN

kv_keys(self)
    SV *self
PREINIT:
    LughModel *lm;
    int64_t i;
PPCODE:
    lm = get_lugh_model(aTHX_ self);
    EXTEND(SP, lm->n_kv);
    for (i = 0; i < lm->n_kv; i++) {
        mPUSHs(newSVpv(gguf_get_key(lm->gguf, i), 0));
    }

lib/Lugh.xs  view on Meta::CPAN

    SV *self
PREINIT:
    LughLoRAAdapter *lora;
    MAGIC *mg;
    int i;
PPCODE:
    if (!SvROK(self)) croak("Not a reference");
    mg = mg_findext(SvRV(self), PERL_MAGIC_ext, &lugh_lora_vtbl);
    if (!mg) croak("Invalid LoRA object");
    lora = get_lora_by_id((int)(IV)mg->mg_ptr);
    if (!lora) croak("LoRA adapter not found");

lib/Lugh.xs  view on Meta::CPAN

    LughLoRAAdapter *lora;
    LughTensor *lt;
    MAGIC *mg;
    int i, count = 0;
    HV *result_hv;
PPCODE:
    if (!SvROK(self)) croak("Not a reference");
    mg = mg_findext(SvRV(self), PERL_MAGIC_ext, &lugh_lora_vtbl);
    if (!mg) croak("Invalid LoRA object");
    lora = get_lora_by_id((int)(IV)mg->mg_ptr);
    if (!lora) croak("LoRA adapter not found");

lib/Lugh.xs  view on Meta::CPAN

    SV **svp;
    LughSpeculative *spec;
    AV *input_av, *draft_av;
    int i, n_input;
    int *input_tokens;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Speculative object");
    hv = (HV*)SvRV(self);
    
    svp = hv_fetch(hv, "_spec_id", 8, 0);

lib/Lugh.xs  view on Meta::CPAN

    SV **svp;
    LughSpeculative *spec;
    AV *input_av, *draft_av_in, *accepted_av;
    int i, n_input, n_draft;
    int *input_tokens, *draft_tokens;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Speculative object");
    hv = (HV*)SvRV(self);
    
    svp = hv_fetch(hv, "_spec_id", 8, 0);

lib/Lugh.xs  view on Meta::CPAN

    SV **svp;
    LughSpeculative *spec;
    AV *input_av, *accepted_av;
    int *input_tokens;
    int n_input, i;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Speculative object");
    hv = (HV*)SvRV(self);
    
    svp = hv_fetch(hv, "_spec_id", 8, 0);

lib/Lugh.xs  view on Meta::CPAN

    LughSpeculative *spec;
    AV *input_av, *output_av, *accepted_av;
    int *current_tokens;
    int n_current, n_generated;
    int i;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Speculative object");
    hv = (HV*)SvRV(self);
    
    svp = hv_fetch(hv, "_spec_id", 8, 0);

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    SV **svp;
    LughTensor *lt;
    int64_t i, n_elements;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Autograd::Tensor object");
    hv = (HV*)SvRV(self);
    svp = hv_fetch(hv, "_tensor_id", 10, 0);
    if (!svp) croak("Invalid tensor object");

lib/Lugh.xs  view on Meta::CPAN

PREINIT:
    HV *hv;
    SV **svp;
    LughTensor *lt;
    int i, n_dims;
PPCODE:
    if (!SvROK(self) || SvTYPE(SvRV(self)) != SVt_PVHV)
        croak("Invalid Lugh::Autograd::Tensor object");
    hv = (HV*)SvRV(self);
    svp = hv_fetch(hv, "_tensor_id", 10, 0);
    if (!svp) croak("Invalid tensor object");

lib/Lugh.xs  view on Meta::CPAN

    STRLEN batch_size = 32;
    int shuffle = 0;
    STRLEN data_len, i, j;
    STRLEN *indices = NULL;
    AV *result_av;
PPCODE:
    PERL_UNUSED_VAR(class);
    
    /* Parse optional args - items includes class and data_av, so remaining must be even */
    if (items > 2) {
        if ((items - 2) % 2 != 0) croak("Expected key-value pairs after data");

lib/Lugh.xs  view on Meta::CPAN

    STRLEN max_length = 512;
    STRLEN i, n_texts;
    AV *all_input_ids;
    AV *all_targets;
    AV *result;
PPCODE:
    PERL_UNUSED_VAR(class);
    
    if (!tokenizer || !SvOK(tokenizer)) {
        croak("tokenizer required");
    }

lib/Lugh.xs  view on Meta::CPAN

void
zero_grad(class, ...)
    SV* class
PREINIT:
    STRLEN i;
PPCODE:
    PERL_UNUSED_VAR(class);
    
    for (i = 1; i < (STRLEN)items; i++) {
        SV *tensor_sv = ST(i);
        if (!SvOK(tensor_sv)) continue;

lib/Lugh.xs  view on Meta::CPAN

    float total_norm = 0.0f;
    float clip_coef;
    STRLEN i;
    AV* tensors_av = NULL;
    AV* all_grads = NULL;
PPCODE:
    PERL_UNUSED_VAR(class);
    
    if (max_norm <= 0) {
        croak("max_norm must be positive");
    }

lib/Lugh.xs  view on Meta::CPAN

clip_grad_value(class, max_value, ...)
    SV* class
    float max_value
PREINIT:
    STRLEN i;
PPCODE:
    PERL_UNUSED_VAR(class);
    
    if (max_value <= 0) {
        croak("max_value must be positive");
    }

 view all matches for this distribution


MCDB_File

 view release on metacpan or  search on metacpan

MCDB_File.xs  view on Meta::CPAN

  PREINIT:
    SV *k, *v;
    char *kp, *vp;
    STRLEN klen, vlen;
    int x;
  PPCODE:
    for (x = 1; x+1 < items; x += 2) {
        k = ST(x); v = ST(x+1);
        if (SvOK(k) && SvOK(v)) {
            kp = SvPV(k, klen); vp = SvPV(v, vlen);
            if (mcdb_make_add(mk, kp, klen, vp, vlen) != 0)

 view all matches for this distribution


MIME-Explode

 view release on metacpan or  search on metacpan

Explode.xs  view on Meta::CPAN

		SV	*source
	PREINIT:
		STRLEN srcl;
		unsigned long len;
		unsigned char *s;
	PPCODE:
		s = (unsigned char*)SvPV(source, srcl);
		if(s = _rfc822_qprint(s, (unsigned long)srcl, &len)) {
			XPUSHs(sv_2mortal(newSVpv((char*)s, (STRLEN)len)));
			Safefree(s);
		}

Explode.xs  view on Meta::CPAN

		SV	*source
	PREINIT:
		STRLEN srcl;
		unsigned long len;
		unsigned char *s;
	PPCODE:
		s = (unsigned char*)SvPV(source, srcl);
		if(s = _rfc822_base64(s, (unsigned long)srcl, &len)) {
			XPUSHs(sv_2mortal(newSVpv((char*)s, (STRLEN)len)));
			Safefree(s);
		}

Explode.xs  view on Meta::CPAN

	PREINIT:
		STRLEN srcl;
		unsigned char *s;
		char *base = NULL;
		char *mt;
	PPCODE:
		if(items == 2) base = SvPV(ST(1), PL_na);
		s = (unsigned char*)SvPV(source, srcl);
		mt = set_mime_type(s, (unsigned long)srcl, base);
		XPUSHs(sv_2mortal(newSVpv(mt, (STRLEN)strlen(mt))));

Explode.xs  view on Meta::CPAN

		bool action = TRUE;
		char mimetype[BUFFLEN] = "";
		AV *av_ret = newAV();
		char tmp[TMPBUFFLEN];
		unsigned long tmplen = 0;
	PPCODE:
		if((avlen = av_len(av_fhs)) != -1) {
			fpin = IoIFP(sv_2io(*av_fetch(av_fhs, 0, 0)));
			if(avlen == 1)
				fptmp = IoIFP(sv_2io(*av_fetch(av_fhs, 1, 0)));
		} else

Explode.xs  view on Meta::CPAN

		char tmp[TMPBUFFLEN];
		unsigned long tmplen = 0;
		answers findmbox = NO;
		answers endbase64 = NO;
		char *mimetype;
	PPCODE:
		if((avlen = av_len(av_fhs)) != -1) {
			fpin = IoIFP(sv_2io(*av_fetch(av_fhs, 0, 0)));
			if(avlen == 1)
				fptmp = IoIFP(sv_2io(*av_fetch(av_fhs, 1, 0)));
		} else

 view all matches for this distribution


MIME-Fast

 view release on metacpan or  search on metacpan

Fast/Hash.xs  view on Meta::CPAN

    PREINIT:
        MIME__Fast__Message		msg;
        GList			*gret = NULL, *item;
        AV *			retav;
        I32			gimme = GIMME_V;
    PPCODE:
        msg = obj->objptr;

        /* THE HACK - FETCH method would get value indirectly from NEXTKEY */
        if (obj->keyindex != -1 && obj->fetchvalue != NULL) {
          XPUSHs(sv_2mortal(newSVpv(obj->fetchvalue,0)));

Fast/Hash.xs  view on Meta::CPAN

        struct raw_header	*h;
    INIT:
        if (ix == 1) {
          obj->keyindex = -1;
        }
    PPCODE:
        msg = obj->objptr;
        ++obj->keyindex;
        if (gmime_debug)
          warn("hash_NEXTKEY");
        i = obj->keyindex;

 view all matches for this distribution


MMapDB

 view release on metacpan or  search on metacpan

MMapDB.xs  view on Meta::CPAN

PROTOTYPES: DISABLED

void
index_lookup(I, ...)
    MMapDB I;
  PPCODE:
    if( expect_true(items>1) ) {
      UV pos=SvUV(ST(1));
      STRLEN keylen;
      char *datap, *intfmt, *keyp;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

MMapDB.xs  view on Meta::CPAN

   END:

void
index_lookup_position(I, ...)
    MMapDB I;
  PPCODE:
    if( expect_true(items>1) ) {
      UV pos=SvUV(ST(1));
      STRLEN keylen;
      char *datap, *intfmt, *keyp;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

MMapDB.xs  view on Meta::CPAN


void
id_index_lookup(I, id)
    MMapDB I;
    UV id;
  PPCODE:
    {
      char *datap, *intfmt;
      UV pos;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

MMapDB.xs  view on Meta::CPAN

    }

void
data_record(I, ...)
    MMapDB I;
  PPCODE:
    if( items>1 ) {
      int i;
      UV pos;
      char *datap, *intfmt;
      UV dataend, dbfmt;

MMapDB.xs  view on Meta::CPAN

    }

void
index_lookup_records(I, ...)
    MMapDB I;
  PPCODE:
    if( expect_true(items>1) ) {
      UV pos=SvUV(ST(1));
      STRLEN keylen;
      char *datap, *intfmt, *keyp;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

MMapDB.xs  view on Meta::CPAN

   END:

void
data_value(I, ...)
    MMapDB I;
  PPCODE:
    if( items>1 ) {
      int i;
      UV pos;
      char *datap, *intfmt;
      UV dataend, dbfmt;

MMapDB.xs  view on Meta::CPAN

    }

void
index_lookup_values(I, ...)
    MMapDB I;
  PPCODE:
    if( expect_true(items>1) ) {
      UV pos=SvUV(ST(1));
      STRLEN keylen;
      char *datap, *intfmt, *keyp;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

MMapDB.xs  view on Meta::CPAN

   END:

void
data_sort(I, ...)
    MMapDB I;
  PPCODE:
    if( items>1 ) {
      int i;
      UV pos;
      char *datap, *intfmt;
      UV dataend, dbfmt;

MMapDB.xs  view on Meta::CPAN

    }

void
index_lookup_sorts(I, ...)
    MMapDB I;
  PPCODE:
    if( expect_true(items>1) ) {
      UV pos=SvUV(ST(1));
      STRLEN keylen;
      char *datap, *intfmt, *keyp;
      SV **svp=av_fetch(I, MMDB_DATA, 0);

 view all matches for this distribution


( run in 2.689 seconds using v1.01-cache-2.11-cpan-5511b514fd6 )