Db-Ctree

 view release on metacpan or  search on metacpan

Ctree.xs  view on Meta::CPAN


/* 
   CTREE includes
*/

#include "ctstdr.h"
#include "ctoptn.h"
#include "ctaerr.h"
#include "ctdecl.h"
#include "cterrc.h"

typedef COUNT CtreeINIT;

MODULE = Db::Ctree		PACKAGE = Db::Ctree		

 #
 # NOTE: OUTPUT specifiers are not giving for VOID * types because
 #       their values can contain nulls and this will screw up length
 #       calculations.  The CTREE practice of ensuring proper buffer space
 #       holds true!!
 #

 #
 # Functions for CTREE global variables
 #

COUNT
isam_err()
     CODE:
         RETVAL = isam_err;
     OUTPUT:
         RETVAL

COUNT
isam_fil()
     CODE:
         RETVAL = isam_fil;
     OUTPUT:
         RETVAL

COUNT
sysiocod()
     CODE:
         RETVAL = sysiocod;
     OUTPUT:
         RETVAL

COUNT
uerr_cod()
     CODE:
         RETVAL = uerr_cod;
     OUTPUT:
         RETVAL

 #
 # custom GetDODA returns values as list type
 #
void
MyGetDODA(datano)
       COUNT datano
       PPCODE:
           DATOBJ doda[100];
           int    i=0;
           i=GetDODA(datano,sizeof(DATOBJ)*100,doda,SCHEMA_DODA);
           if (i)
             for(i=0; i<100 ; i++)
             {
                if (doda[i].fwhat == -1 ) break;
                EXTEND(sp, 4);
                if (doda[i].fsymb == 0 )
                   PUSHs(sv_2mortal(newSViv(i)));/*deal with null field name*/
                else
                   PUSHs(sv_2mortal(newSVpv(doda[i].fsymb,0)));
                   PUSHs(sv_2mortal(newSViv((IV)doda[i].fadr)));
                   PUSHs(sv_2mortal(newSViv(doda[i].ftype)));
                   PUSHs(sv_2mortal(newSViv(doda[i].flen )));
             } 
           else
               XSRETURN_EMPTY;
                
 #
 # custom InitISAM returns a ptr of special type to detect when the program exits.   
 # On DESTROY of the return value StopUser() is executed to ensure
 #  shared memory is cleaned up!

CtreeINIT *
MyInitISAM(bufs,fils,sect)
     COUNT  bufs
     COUNT  fils
     COUNT  sect
     CODE:
        RETVAL = malloc(sizeof(CtreeINIT));
        *RETVAL = InitISAM(bufs,fils,sect);
     OUTPUT:
        RETVAL


 # This code is executed automatically upon exit to clean up
 # shared memory.
MODULE = Db::Ctree		PACKAGE = CtreeINITPtr
void
DESTROY(init)
      CtreeINIT *init
      CODE:
           StopUser();
           free(init); 	

 #
 # Most Ctree functions converted automatically
 #
MODULE = Db::Ctree		PACKAGE = Db::Ctree		

COUNT
Abort()

COUNT
AbortXtd(lokmod)
    COUNT lokmod

COUNT
AddCtResource(datno,resptr,varlen)



( run in 2.314 seconds using v1.01-cache-2.11-cpan-71847e10f99 )