/*
 * FILE : pisock_wrap.c
 * 
 * This file was automatically generated by :
 * Simplified Wrapper and Interface Generator (SWIG)
 * Version 1.1 (Build 883)
 * 
 * Portions Copyright (c) 1995-1998
 * The University of Utah and The Regents of the University of California.
 * Permission is granted to distribute this file in any manner provided
 * this notice remains intact.
 * 
 * Do not make changes to this file--changes will be lost!
 *
 */


#define SWIGCODE
/* Implementation : PYTHON */

#define SWIGPYTHON
/***********************************************************************
 * $Header: /cvs/pilot-link/pilot-link_src/bindings/Python/src/pisock_wrap.c,v 1.8 2002/12/18 12:43:42 desrod Exp $
 * swig_lib/python/python.cfg
 *
 * Contains variable linking and pointer type-checking code.
 ************************************************************************/

#include <string.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif
#include "Python.h"

/* Definitions for Windows/Unix exporting */
#if defined(_WIN32) || defined(__WIN32__)
#   if defined(_MSC_VER)
#	define SWIGEXPORT(a) __declspec(dllexport) a
#   else
#	if defined(__BORLANDC__)
#	    define SWIGEXPORT(a) a _export
#	else
#	    define SWIGEXPORT(a) a
#	endif
#   endif
#else
#   define SWIGEXPORT(a) a
#endif

#ifdef SWIG_GLOBAL
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
#else
#define SWIGSTATICRUNTIME(a) static a
#endif

typedef struct {
  char  *name;
  PyObject *(*get_attr)(void);
  int (*set_attr)(PyObject *);
} swig_globalvar;

typedef struct swig_varlinkobject {
  PyObject_HEAD
  swig_globalvar **vars;
  int      nvars;
  int      maxvars;
} swig_varlinkobject;

/* ----------------------------------------------------------------------
   swig_varlink_repr()

   Function for python repr method
   ---------------------------------------------------------------------- */

static PyObject *
swig_varlink_repr(swig_varlinkobject *v)
{
  v = v;
  return PyString_FromString("<Global variables>");
}

/* ---------------------------------------------------------------------
   swig_varlink_print()

   Print out all of the global variable names
   --------------------------------------------------------------------- */

static int
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags)
{

  int i = 0;
  flags = flags;
  fprintf(fp,"Global variables { ");
  while (v->vars[i]) {
    fprintf(fp,"%s", v->vars[i]->name);
    i++;
    if (v->vars[i]) fprintf(fp,", ");
  }
  fprintf(fp," }\n");
  return 0;
}

/* --------------------------------------------------------------------
   swig_varlink_getattr
 
   This function gets the value of a variable and returns it as a
   PyObject.   In our case, we'll be looking at the datatype and
   converting into a number or string
   -------------------------------------------------------------------- */

static PyObject *
swig_varlink_getattr(swig_varlinkobject *v, char *n)
{
  int i = 0;
  char temp[128];

  while (v->vars[i]) {
    if (strcmp(v->vars[i]->name,n) == 0) {
      return (*v->vars[i]->get_attr)();
    }
    i++;
  }
  sprintf(temp,"C global variable %s not found.", n);
  PyErr_SetString(PyExc_NameError,temp);
  return NULL;
}

/* -------------------------------------------------------------------
   swig_varlink_setattr()

   This function sets the value of a variable.
   ------------------------------------------------------------------- */

static int
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
{
  char temp[128];
  int i = 0;
  while (v->vars[i]) {
    if (strcmp(v->vars[i]->name,n) == 0) {
      return (*v->vars[i]->set_attr)(p);
    }
    i++;
  }
  sprintf(temp,"C global variable %s not found.", n);
  PyErr_SetString(PyExc_NameError,temp);
  return 1;
}

statichere PyTypeObject varlinktype = {
/*  PyObject_HEAD_INIT(&PyType_Type)  Note : This doesn't work on some machines */
  PyObject_HEAD_INIT(0)              
  0,
  "varlink",                          /* Type name    */
  sizeof(swig_varlinkobject),         /* Basic size   */
  0,                                  /* Itemsize     */
  0,                                  /* Deallocator  */ 
  (printfunc) swig_varlink_print,     /* Print        */
  (getattrfunc) swig_varlink_getattr, /* get attr     */
  (setattrfunc) swig_varlink_setattr, /* Set attr     */
  0,                                  /* tp_compare   */
  (reprfunc) swig_varlink_repr,       /* tp_repr      */    
  0,                                  /* tp_as_number */
  0,                                  /* tp_as_mapping*/
  0,                                  /* tp_hash      */
};

/* Create a variable linking object for use later */

SWIGSTATICRUNTIME(PyObject *)
SWIG_newvarlink(void)
{
  swig_varlinkobject *result = 0;
  result = PyMem_NEW(swig_varlinkobject,1);
  varlinktype.ob_type = &PyType_Type;    /* Patch varlinktype into a PyType */
  result->ob_type = &varlinktype;
  /*  _Py_NewReference(result);  Does not seem to be necessary */
  result->nvars = 0;
  result->maxvars = 64;
  result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *));
  result->vars[0] = 0;
  result->ob_refcnt = 0;
  Py_XINCREF((PyObject *) result);
  return ((PyObject*) result);
}

SWIGSTATICRUNTIME(void)
SWIG_addvarlink(PyObject *p, char *name,
	   PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p))
{
  swig_varlinkobject *v;
  v= (swig_varlinkobject *) p;
	
  if (v->nvars >= v->maxvars -1) {
    v->maxvars = 2*v->maxvars;
    v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
    if (v->vars == NULL) {
      fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n");
      exit(1);
    }
  }
  v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar));
  v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1);
  strcpy(v->vars[v->nvars]->name,name);
  v->vars[v->nvars]->get_attr = get_attr;
  v->vars[v->nvars]->set_attr = set_attr;
  v->nvars++;
  v->vars[v->nvars] = 0;
}

/* -----------------------------------------------------------------------------
 * Pointer type-checking
 * ----------------------------------------------------------------------------- */

/* SWIG pointer structure */
typedef struct SwigPtrType {
  char               *name;               /* Datatype name                  */
  int                 len;                /* Length (used for optimization) */
  void               *(*cast)(void *);    /* Pointer casting function       */
  struct SwigPtrType *next;               /* Linked list pointer            */
} SwigPtrType;

/* Pointer cache structure */
typedef struct {
  int                 stat;               /* Status (valid) bit             */
  SwigPtrType        *tp;                 /* Pointer to type structure      */
  char                name[256];          /* Given datatype name            */
  char                mapped[256];        /* Equivalent name                */
} SwigCacheType;

static int SwigPtrMax  = 64;           /* Max entries that can be currently held */
static int SwigPtrN    = 0;            /* Current number of entries              */
static int SwigPtrSort = 0;            /* Status flag indicating sort            */
static int SwigStart[256];             /* Starting positions of types            */
static SwigPtrType *SwigPtrTable = 0;  /* Table containing pointer equivalences  */

/* Cached values */
#define SWIG_CACHESIZE  8
#define SWIG_CACHEMASK  0x7
static SwigCacheType SwigCache[SWIG_CACHESIZE];  
static int SwigCacheIndex = 0;
static int SwigLastCache = 0;

/* Sort comparison function */
static int swigsort(const void *data1, const void *data2) {
	SwigPtrType *d1 = (SwigPtrType *) data1;
	SwigPtrType *d2 = (SwigPtrType *) data2;
	return strcmp(d1->name,d2->name);
}

/* Register a new datatype with the type-checker */
SWIGSTATICRUNTIME(void) 
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
  int i;
  SwigPtrType *t = 0,*t1;

  /* Allocate the pointer table if necessary */
  if (!SwigPtrTable) {     
    SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
  }

  /* Grow the table */
  if (SwigPtrN >= SwigPtrMax) {
    SwigPtrMax = 2*SwigPtrMax;
    SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
  }
  for (i = 0; i < SwigPtrN; i++) {
    if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
      t = &SwigPtrTable[i];
      break;
    }
  }
  if (!t) {
    t = &SwigPtrTable[SwigPtrN++];
    t->name = origtype;
    t->len = strlen(t->name);
    t->cast = 0;
    t->next = 0;
  }

  /* Check for existing entries */
  while (t->next) {
    if ((strcmp(t->name,newtype) == 0)) {
      if (cast) t->cast = cast;
      return;
    }
    t = t->next;
  }
  t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
  t1->name = newtype;
  t1->len = strlen(t1->name);
  t1->cast = cast;
  t1->next = 0;            
  t->next = t1;           
  SwigPtrSort = 0;
}

/* Make a pointer value string */
SWIGSTATICRUNTIME(void) 
SWIG_MakePtr(char *c, const void *ptr, char *type) {
  static char hex[17] = "0123456789abcdef";
  unsigned long p, s;
  char result[24], *r; 
  r = result;
  p = (unsigned long) ptr;
  if (p > 0) {
    while (p > 0) {
      s = p & 0xf;
      *(r++) = hex[s];
      p = p >> 4;
    }
    *r = '_';
    while (r >= result)
      *(c++) = *(r--);
    strcpy (c, type);
  } else {
    strcpy (c, "NULL");
  }
}

/* Function for getting a pointer value */
SWIGSTATICRUNTIME(char *) 
SWIG_GetPtr(char *c, void **ptr, char *t)
{
  unsigned long p;
  char temp_type[256], *name;
  int  i, len, start, end;
  SwigPtrType *sp,*tp;
  SwigCacheType *cache;
  register int d;

  p = 0;
  /* Pointer values must start with leading underscore */
  if (*c != '_') {
    *ptr = (void *) 0;
    if (strcmp(c,"NULL") == 0) return (char *) 0;
    else return c;
  }
  c++;
  /* Extract hex value from pointer */
  while (d = *c) {
    if ((d >= '0') && (d <= '9'))
      p = (p << 4) + (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      p = (p << 4) + (d - ('a'-10));
    else
      break; 
    c++;
  }
  *ptr = (void *) p;
  if ((!t) || (strcmp(t,c)==0)) return (char *) 0;

  if (!SwigPtrSort) {
    qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); 
    for (i = 0; i < 256; i++) SwigStart[i] = SwigPtrN;
    for (i = SwigPtrN-1; i >= 0; i--) SwigStart[(int) (SwigPtrTable[i].name[1])] = i;
    for (i = 255; i >= 1; i--) {
      if (SwigStart[i-1] > SwigStart[i])
	SwigStart[i-1] = SwigStart[i];
    }
    SwigPtrSort = 1;
    for (i = 0; i < SWIG_CACHESIZE; i++) SwigCache[i].stat = 0;
  }
  /* First check cache for matches.  Uses last cache value as starting point */
  cache = &SwigCache[SwigLastCache];
  for (i = 0; i < SWIG_CACHESIZE; i++) {
    if (cache->stat && (strcmp(t,cache->name) == 0) && (strcmp(c,cache->mapped) == 0)) {
      cache->stat++;
      if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
      return (char *) 0;
    }
    SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
    if (!SwigLastCache) cache = SwigCache;
    else cache++;
  }
  /* Type mismatch.  Look through type-mapping table */
  start = SwigStart[(int) t[1]];
  end = SwigStart[(int) t[1]+1];
  sp = &SwigPtrTable[start];

  /* Try to find a match */
  while (start <= end) {
    if (strncmp(t,sp->name,sp->len) == 0) {
      name = sp->name;
      len = sp->len;
      tp = sp->next;
      /* Try to find entry for our given datatype */
      while(tp) {
	if (tp->len >= 255) {
	  return c;
	}
	strcpy(temp_type,tp->name);
	strncat(temp_type,t+len,255-tp->len);
	if (strcmp(c,temp_type) == 0) {
	  strcpy(SwigCache[SwigCacheIndex].mapped,c);
	  strcpy(SwigCache[SwigCacheIndex].name,t);
	  SwigCache[SwigCacheIndex].stat = 1;
	  SwigCache[SwigCacheIndex].tp = tp;
	  SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
	  /* Get pointer value */
	  *ptr = (void *) p;
	  if (tp->cast) *ptr = (*(tp->cast))(*ptr);
	  return (char *) 0;
	}
	tp = tp->next;
      }
    }
    sp++;
    start++;
  }
  return c;
} 

/* New object-based GetPointer function. This uses the Python abstract
 * object interface to automatically dereference the 'this' attribute
 * of shadow objects. */

SWIGSTATICRUNTIME(char *)
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
  PyObject *sobj = obj;
  char     *str;
  if (!PyString_Check(obj)) {
    sobj = PyObject_GetAttrString(obj,"this");
    if (!sobj) return "";
  }
  str = PyString_AsString(sobj);
  return SWIG_GetPtr(str,ptr,type);
}

#ifdef __cplusplus
}
#endif


#define SWIG_init    init_pisock

#define SWIG_name    "_pisock"

#include <time.h>
#include "pi-socket.h"
#include "pi-dlp.h"
#include "pi-file.h"
#include "pi-header.h"    
    
extern char *printlong(unsigned long);
extern unsigned long makelong(char *c);

void *__dlp_buf;

#define DLPMAXBUF 0xFFFF 

#define DGETLONG(src,key,default) (PyDict_GetItemString(src,key) ? PyInt_AsLong(PyDict_GetItemString(src,key)) : default)
#define DGETSTR(src,key,default) (PyDict_GetItemString(src,key) ? PyString_AsString(PyDict_GetItemString(src,key)) : default)

typedef int DLPERROR;
typedef int DLPDBERROR;
 typedef int PIERROR;

static PyObject *Error;

static PyObject* l_output_helper(PyObject* target, PyObject* o) {
    PyObject*   o2;
    if (!target) {                   
        target = o;
    } else if (target == Py_None) {  
        Py_DECREF(Py_None);
        target = o;
    } else {                         
        if (!PyList_Check(target)) {
            o2 = target;
            target = PyList_New(0);
            PyList_Append(target, o2);
	    Py_XDECREF(o2);
        }
        PyList_Append(target,o);
	Py_XDECREF(o);
    }
    return target;
}

static PyObject* t_output_helper(PyObject* target, PyObject* o) {
    PyObject*   o2;
    PyObject*   o3;

    if (!target) {                   
        target = o;
    } else if (target == Py_None) {  
        Py_DECREF(Py_None);
        target = o;
    } else {                         
        if (!PyTuple_Check(target)) {
            o2 = target;
            target = PyTuple_New(1);
            PyTuple_SetItem(target, 0, o2);
        }
        o3 = PyTuple_New(1);            
        PyTuple_SetItem(o3, 0, o);      

        o2 = target;
        target = PySequence_Concat(o2, o3); 
        Py_DECREF(o2);                      
        Py_DECREF(o3);
    }
    return target;
}
extern int pilot_connect(char *);
extern int pi_socket(int ,int ,int );
extern int pi_connect(int ,struct sockaddr *,int );
extern int pi_bind(int ,struct sockaddr *,int );
extern int pi_listen(int ,int );
extern int pi_accept(int ,struct sockaddr *,int *);
extern int pi_accept_to(int ,struct sockaddr *,int *,int );
extern int pi_send(int ,void *,int ,unsigned int );
extern int pi_recv(int ,void *,int ,unsigned int );
extern int pi_read(int ,void *,int );
extern int pi_write(int ,void *,int );
extern int pi_getsockname(int ,struct sockaddr *,int *);
extern int pi_getsockpeer(int ,struct sockaddr *,int *);
extern int pi_setsockopt(int ,int ,int ,const void *,int *);
extern int pi_getsockopt(int ,int ,int ,void *,int *);
extern int pi_version(int );
extern int pi_tickle(int );
extern int pi_watchdog(int ,int );
extern int pi_close(int );
extern char * dlp_errorlist[]; 
extern char *dlp_strerror(int );
extern DLPERROR dlp_GetSysDateTime(int ,time_t *);
extern DLPERROR dlp_SetSysDateTime(int ,time_t );
extern DLPERROR dlp_ReadStorageInfo(int ,int ,struct CardInfo *);
extern DLPERROR dlp_ReadSysInfo(int ,struct SysInfo *);
extern DLPERROR dlp_ReadDBList(int ,int ,int ,int ,struct DBInfo *);
extern DLPERROR dlp_FindDBInfo(int ,int ,int ,char *,unsigned long ,unsigned long ,struct DBInfo *);
extern DLPERROR dlp_OpenDB(int ,int ,int ,char *,int *);
extern DLPERROR dlp_CloseDB(int ,int );
extern DLPERROR dlp_CloseDB_All(int );
extern DLPERROR dlp_DeleteDB(int ,int ,const char *);
extern DLPERROR dlp_CreateDB(int ,long ,long ,int ,int ,int ,const char *,int *);
extern DLPERROR dlp_ResetSystem(int );
extern DLPERROR dlp_AddSyncLogEntry(int ,char *);
extern DLPERROR dlp_OpenConduit(int );
extern DLPERROR dlp_EndOfSync(int ,int );
extern DLPERROR dlp_AbortSync(int );
extern DLPERROR dlp_ReadOpenDBInfo(int ,int ,int *);
extern DLPERROR dlp_MoveCategory(int ,int ,int ,int );
extern DLPERROR dlp_WriteUserInfo(int ,struct PilotUser *);
extern DLPERROR dlp_ReadUserInfo(int ,struct PilotUser *);
extern DLPERROR dlp_ResetLastSyncPC(int );
extern DLPERROR dlp_WriteAppBlock(int ,int ,const void *,int );
extern DLPERROR dlp_WriteSortBlock(int ,int ,const void *,int );
extern DLPERROR dlp_ResetDBIndex(int ,int );
extern DLPDBERROR dlp_WriteRecord(int ,int ,int ,recordid_t ,int ,void *,int ,recordid_t *);
extern DLPERROR dlp_DeleteRecord(int ,int ,int ,recordid_t );
extern DLPERROR dlp_DeleteCategory(int ,int ,int );
extern DLPDBERROR dlp_ReadResourceByType(int ,int ,unsigned long ,int ,void *,int *,int *);
extern DLPDBERROR dlp_ReadResourceByIndex(int ,int ,int ,void *,unsigned long *,int *,int *);
extern DLPDBERROR dlp_WriteResource(int ,int ,unsigned long ,int ,const void *,int );
extern DLPERROR dlp_DeleteResource(int ,int ,int ,unsigned long ,int );
extern DLPDBERROR dlp_ReadNextModifiedRec(int ,int ,void *,recordid_t *,int *,int *,int *,int *);
extern DLPDBERROR dlp_ReadNextModifiedRecInCategory(int ,int ,int ,void *,recordid_t *,int *,int *,int *);
extern DLPDBERROR dlp_ReadNextRecInCategory(int ,int ,int ,void *,recordid_t *,int *,int *,int *);
extern DLPDBERROR dlp_ReadRecordById(int ,int ,recordid_t ,void *,int *,int *,int *,int *);
extern DLPDBERROR dlp_ReadRecordByIndex(int ,int ,int ,void *,recordid_t *,int *,int *,int *);
extern DLPERROR dlp_CleanUpDatabase(int ,int );
extern DLPERROR dlp_ResetSyncFlags(int ,int );
extern DLPERROR dlp_ReadFeature(int ,unsigned long ,unsigned int ,unsigned long *);
extern DLPERROR dlp_ReadNetSyncInfo(int ,struct NetSyncInfo *);
extern DLPERROR dlp_WriteNetSyncInfo(int ,struct NetSyncInfo *);
extern DLPERROR dlp_ReadAppPreference(int ,unsigned long ,int ,int ,int ,void *,int *,int *);
extern DLPERROR dlp_WriteAppPreference(int ,unsigned long ,int ,int ,int ,void *,int );
extern struct pi_file *pi_file_open(char *);
extern PIERROR pi_file_close(struct pi_file *);
extern PIERROR pi_file_get_info(struct pi_file *,struct DBInfo *);
extern PIERROR pi_file_get_app_info(struct pi_file *,void **,int *);
extern PIERROR pi_file_get_sort_info(struct pi_file *,void **,int *);
extern PIERROR pi_file_read_resource(struct pi_file *,int ,void **,int *,unsigned long *,int *);
extern PIERROR pi_file_read_resource_by_type_id(struct pi_file *,unsigned long ,int ,void **,int *,int *);
extern PIERROR pi_file_type_id_used(struct pi_file *,unsigned long ,int );
extern PIERROR pi_file_read_record(struct pi_file *,int ,void **,int *,int *,int *,recordid_t *);
extern PIERROR pi_file_get_entries(struct pi_file *,int *);
extern PIERROR pi_file_read_record_by_id(struct pi_file *,recordid_t ,void **,int *,int *,int *,int *);
extern PIERROR pi_file_id_used(struct pi_file *,recordid_t );
extern struct pi_file *pi_file_create(char *,struct DBInfo *);
extern PIERROR pi_file_set_info(struct pi_file *,struct DBInfo *);
extern PIERROR pi_file_set_app_info(struct pi_file *,void *,int );
extern PIERROR pi_file_set_sort_info(struct pi_file *,void *,int );
extern PIERROR pi_file_append_resource(struct pi_file *,void *,int ,unsigned long ,int );
extern PIERROR pi_file_append_record(struct pi_file *,void *,int ,int ,int ,recordid_t );
extern PIERROR pi_file_retrieve(struct pi_file *,int ,int );
extern PIERROR pi_file_install(struct pi_file *,int ,int );
extern PIERROR pi_file_merge(struct pi_file *,int ,int );


#define PYCFUNC(x) static PyObject *x (PyObject *self, PyObject *args)

PYCFUNC(_wrap_dlp_ReadAppBlock) {
    int a0, a1, a2;
    int ret;
    PyObject *o;
    
    if (!PyArg_ParseTuple(args,"iii", &a0, &a1, &a2))
	return NULL;

    ret = dlp_ReadAppBlock(a0, a1, a2, __dlp_buf, DLPMAXBUF);
    if (ret < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", ret, dlp_strerror(ret)));
	return NULL;
    } else if (ret > 0) {
	o = Py_BuildValue("s#", __dlp_buf, ret);
    } else {
	o = Py_None;
	Py_INCREF(Py_None);
    }
    return o;
}

PYCFUNC(_wrap_dlp_ReadSortBlock) {
    int a0, a1, a2;
    int ret;
    PyObject *o;
    
    if (!PyArg_ParseTuple(args,"iii", &a0, &a1, &a2))
	return NULL;

    ret = dlp_ReadSortBlock(a0, a1, a2, __dlp_buf, DLPMAXBUF);
    if (ret < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", ret, dlp_strerror(ret)));
	return NULL;
    } else if (ret > 0) {
	o = Py_BuildValue("s#", __dlp_buf, ret);
    } else {
	o = Py_None;
	Py_INCREF(Py_None);
    }
    return o;
}

/* sd, dbf, sort, start, max, recordid_t *IDS, int *count
 */
PYCFUNC(_wrap_dlp_ReadRecordIDList) {
    int sd, dbf, sort, start, max;
    int ret;
    recordid_t *buf;
    int count, i;
    PyObject *list;
    
    if (!PyArg_ParseTuple(args, "iiiii", &sd, &dbf, &sort, &start, &max))
	return NULL;

/* this is a rather simplistic wrapper.  if max is too big, we just
 * refuse to do it; we don't loop, figuring that that is the job of
 * the python wrapper.
 */
    if (max > (0xFFFF/sizeof(recordid_t))) {
	PyErr_SetString(PyExc_ValueError, "can only return about 64k worth of ids at once");
	return NULL;
    }

    buf = (recordid_t *)__dlp_buf;
    ret = dlp_ReadRecordIDList(sd, dbf, sort, start, max, buf, &count);

    if (ret < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", ret, dlp_strerror(ret)));
	return NULL;
    } else {
	list = PyList_New(0);
	for (i=0; i<count; i++)
	    PyList_Append(list, PyInt_FromLong((long)buf[i]));
	return list;
    }
}

#ifdef __cplusplus
extern "C" {
#endif
static PyObject *_wrap_pilot_connect(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    char * _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"s:pilot_connect",&_arg0)) 
        return NULL;
    _result = (int )pilot_connect(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_socket(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;

    self = self;
    if(!PyArg_ParseTuple(args,"iii:pi_socket",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (int )pi_socket(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_connect(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    int  _arg2;
    PyObject * _obj1 = 0;

    self = self;
{
    _arg2 = sizeof(struct pi_sockaddr);
}
    if(!PyArg_ParseTuple(args,"iO:pi_connect",&_arg0,&_obj1)) 
        return NULL;
{
    static struct pi_sockaddr temp;
    char *dev;
    int len;

    if (!PyArg_ParseTuple(_obj1, "is#", &temp.pi_family, &dev, &len)) {
	return NULL;
    }
    if (len > 255) {
      // Should really raise an exception
      len = 255;
    }
    strncpy(temp.pi_device, dev, len);
    temp.pi_device[len] = 0;

    _arg1 = (struct sockaddr *)&temp;
}
    _result = (int )pi_connect(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_bind(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    int  _arg2;
    PyObject * _obj1 = 0;

    self = self;
{
    _arg2 = sizeof(struct pi_sockaddr);
}
    if(!PyArg_ParseTuple(args,"iO:pi_bind",&_arg0,&_obj1)) 
        return NULL;
{
    static struct pi_sockaddr temp;
    char *dev;
    int len;

    if (!PyArg_ParseTuple(_obj1, "is#", &temp.pi_family, &dev, &len)) {
	return NULL;
    }
    if (len > 255) {
      // Should really raise an exception
      len = 255;
    }
    strncpy(temp.pi_device, dev, len);
    temp.pi_device[len] = 0;

    _arg1 = (struct sockaddr *)&temp;
}
    _result = (int )pi_bind(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_listen(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:pi_listen",&_arg0,&_arg1)) 
        return NULL;
    _result = (int )pi_listen(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_accept(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    struct pi_sockaddr  temp;
    int * _arg2;
    int  temp0;

    self = self;
{
    _arg1 = (struct sockaddr *)&temp;
}
{
  _arg2 = &temp0;
}
    if(!PyArg_ParseTuple(args,"i:pi_accept",&_arg0)) 
        return NULL;
    _result = (int )pi_accept(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
{
    PyObject *o;

    if (_arg1) {
	o = Py_BuildValue("(is)", (int)((struct pi_sockaddr *)_arg1)->pi_family,
			  ((struct pi_sockaddr *)_arg1)->pi_device);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg2));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_accept_to(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    struct pi_sockaddr  temp;
    int * _arg2;
    int  temp0;
    int  _arg3;

    self = self;
{
    _arg1 = (struct sockaddr *)&temp;
}
{
  _arg2 = &temp0;
}
    if(!PyArg_ParseTuple(args,"ii:pi_accept_to",&_arg0,&_arg3)) 
        return NULL;
    _result = (int )pi_accept_to(_arg0,_arg1,_arg2,_arg3);
    _resultobj = Py_BuildValue("i",_result);
{
    PyObject *o;

    if (_arg1) {
	o = Py_BuildValue("(is)", (int)((struct pi_sockaddr *)_arg1)->pi_family,
			  ((struct pi_sockaddr *)_arg1)->pi_device);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg2));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_send(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    void * _arg1;
    int  _arg2;
    unsigned int  _arg3;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iOii:pi_send",&_arg0,&_argo1,&_arg2,&_arg3)) 
        return NULL;
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of pi_send. Expected _void_p.");
        return NULL;
        }
    }
    _result = (int )pi_send(_arg0,_arg1,_arg2,_arg3);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_recv(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    void * _arg1;
    int  _arg2;
    unsigned int  _arg3;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iOii:pi_recv",&_arg0,&_argo1,&_arg2,&_arg3)) 
        return NULL;
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of pi_recv. Expected _void_p.");
        return NULL;
        }
    }
    _result = (int )pi_recv(_arg0,_arg1,_arg2,_arg3);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_read(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    void * _arg1;
    int  _arg2;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iOi:pi_read",&_arg0,&_argo1,&_arg2)) 
        return NULL;
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of pi_read. Expected _void_p.");
        return NULL;
        }
    }
    _result = (int )pi_read(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_write(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    void * _arg1;
    int  _arg2;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iOi:pi_write",&_arg0,&_argo1,&_arg2)) 
        return NULL;
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of pi_write. Expected _void_p.");
        return NULL;
        }
    }
    _result = (int )pi_write(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_getsockname(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    struct pi_sockaddr  temp;
    int * _arg2;
    int  temp0;

    self = self;
{
    _arg1 = (struct sockaddr *)&temp;
}
{
  _arg2 = &temp0;
}
    if(!PyArg_ParseTuple(args,"i:pi_getsockname",&_arg0)) 
        return NULL;
    _result = (int )pi_getsockname(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
{
    PyObject *o;

    if (_arg1) {
	o = Py_BuildValue("(is)", (int)((struct pi_sockaddr *)_arg1)->pi_family,
			  ((struct pi_sockaddr *)_arg1)->pi_device);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg2));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_getsockpeer(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    struct sockaddr * _arg1;
    struct pi_sockaddr  temp;
    int * _arg2;
    int  temp0;

    self = self;
{
    _arg1 = (struct sockaddr *)&temp;
}
{
  _arg2 = &temp0;
}
    if(!PyArg_ParseTuple(args,"i:pi_getsockpeer",&_arg0)) 
        return NULL;
    _result = (int )pi_getsockpeer(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
{
    PyObject *o;

    if (_arg1) {
	o = Py_BuildValue("(is)", (int)((struct pi_sockaddr *)_arg1)->pi_family,
			  ((struct pi_sockaddr *)_arg1)->pi_device);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg2));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_setsockopt(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    int * _arg4;
    PyObject * _argo3 = 0;
    PyObject * _argo4 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iiiOO:pi_setsockopt",&_arg0,&_arg1,&_arg2,&_argo3,&_argo4)) 
        return NULL;
    if (_argo3) {
        if (_argo3 == Py_None) { _arg3 = NULL; }
        else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of pi_setsockopt. Expected _void_p.");
        return NULL;
        }
    }
    if (_argo4) {
        if (_argo4 == Py_None) { _arg4 = NULL; }
        else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of pi_setsockopt. Expected _int_p.");
        return NULL;
        }
    }
    _result = (int )pi_setsockopt(_arg0,_arg1,_arg2,_arg3,_arg4);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_getsockopt(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    int * _arg4;
    PyObject * _argo3 = 0;
    PyObject * _argo4 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iiiOO:pi_getsockopt",&_arg0,&_arg1,&_arg2,&_argo3,&_argo4)) 
        return NULL;
    if (_argo3) {
        if (_argo3 == Py_None) { _arg3 = NULL; }
        else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of pi_getsockopt. Expected _void_p.");
        return NULL;
        }
    }
    if (_argo4) {
        if (_argo4 == Py_None) { _arg4 = NULL; }
        else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of pi_getsockopt. Expected _int_p.");
        return NULL;
        }
    }
    _result = (int )pi_getsockopt(_arg0,_arg1,_arg2,_arg3,_arg4);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_version(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:pi_version",&_arg0)) 
        return NULL;
    _result = (int )pi_version(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_tickle(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:pi_tickle",&_arg0)) 
        return NULL;
    _result = (int )pi_tickle(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_watchdog(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:pi_watchdog",&_arg0,&_arg1)) 
        return NULL;
    _result = (int )pi_watchdog(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_pi_close(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:pi_close",&_arg0)) 
        return NULL;
    _result = (int )pi_close(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static int _wrap_dlp_errorlist_set(PyObject *val) {

    PyErr_SetString(PyExc_TypeError,"Variable dlp_errorlist is read-only.");
    return 1;
}

static PyObject *_wrap_dlp_errorlist_get() {
    PyObject * pyobj;
    char ptemp[128];

    SWIG_MakePtr(ptemp, (char *) dlp_errorlist,"_char_pp");
    pyobj = PyString_FromString(ptemp);
    return pyobj;
}

static PyObject *_wrap_dlp_strerror(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_strerror",&_arg0)) 
        return NULL;
    _result = (char *)dlp_strerror(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_dlp_GetSysDateTime(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    time_t * _arg1;
    long  temp;

    self = self;
{
  _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"i:dlp_GetSysDateTime",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_GetSysDateTime(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg1));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_SetSysDateTime(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    time_t * _arg1;
    long  temp;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iO:dlp_SetSysDateTime",&_arg0,&_obj1)) 
        return NULL;
{
  temp = (long) PyInt_AsLong(_obj1);
  _arg1 = &temp;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_SetSysDateTime(_arg0,*_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadStorageInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    struct CardInfo * _arg2;
    struct CardInfo  temp;

    self = self;
{
    _arg2 = &temp;
}
    if(!PyArg_ParseTuple(args,"ii:dlp_ReadStorageInfo",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadStorageInfo(_arg0,_arg1,_arg2);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;

    if (_arg2) {
	o = Py_BuildValue("{sisislslslslsssssi}",
			  "card", _arg2->card,
			  "version", _arg2->version,
			  "creation", _arg2->creation,
			  "romSize", _arg2->romSize,
			  "ramSize", _arg2->ramSize,
			  "ramFree", _arg2->ramFree,
			  "name", _arg2->name,
			  "manufacturer", _arg2->manufacturer,
			  "more", _arg2->more);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadSysInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    struct SysInfo * _arg1;
    struct SysInfo  temp;

    self = self;
{
    _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"i:dlp_ReadSysInfo",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadSysInfo(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    
    if (_arg1) {
	o = Py_BuildValue("{slslss#}",
			  "romVersion", _arg1->romVersion,
			  "locale", _arg1->locale,
			  "name", _arg1->prodID, _arg1->prodIDLength);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadDBList(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    int  _arg3;
    struct DBInfo * _arg4;
    struct DBInfo  temp;

    self = self;
{
    _arg4 = &temp;
}
    if(!PyArg_ParseTuple(args,"iiii:dlp_ReadDBList",&_arg0,&_arg1,&_arg2,&_arg3)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadDBList(_arg0,_arg1,_arg2,_arg3,_arg4);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;

    if (_arg4) {
	o = Py_BuildValue("{sisisisOsOsislslslslsisssisisisisisisisisisisi}",
			  "more", _arg4->more,
			  "flags", _arg4->flags,
			  "miscFlags", _arg4->miscFlags,
			  "type", PyString_FromStringAndSize(printlong(_arg4->type), 4),
			  "creator", PyString_FromStringAndSize(printlong(_arg4->creator), 4),
			  "version", _arg4->version,
			  "modnum", _arg4->modnum,
			  "createDate", _arg4->createDate,
			  "modifyDate", _arg4->modifyDate,
			  "backupDate", _arg4->backupDate,
			  "index", _arg4->index,
			  "name", _arg4->name,

			  "flagResource", !!(_arg4->flags & dlpDBFlagResource),
			  "flagReadOnly", !!(_arg4->flags & dlpDBFlagReadOnly),
			  "flagAppInfoDirty", !!(_arg4->flags & dlpDBFlagAppInfoDirty),
			  "flagBackup", !!(_arg4->flags & dlpDBFlagBackup),
			  "flagClipping", !!(_arg4->flags & dlpDBFlagClipping),
			  "flagOpen", !!(_arg4->flags & dlpDBFlagOpen),
			  "flagNewer", !!(_arg4->flags & dlpDBFlagNewer),
			  "flagReset", !!(_arg4->flags & dlpDBFlagReset),
			  "flagCopyPrevention", !!(_arg4->flags & dlpDBFlagCopyPrevention),
			  "flagStream", !!(_arg4->flags & dlpDBFlagStream),
			  "flagExcludeFromSync", !!(_arg4->miscFlags & dlpDBMiscFlagExcludeFromSync));
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_FindDBInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    char * _arg3;
    unsigned long  _arg4;
    unsigned long  _arg5;
    struct DBInfo * _arg6;
    struct DBInfo  temp;
    PyObject * _obj3 = 0;
    PyObject * _obj4 = 0;
    PyObject * _obj5 = 0;

    self = self;
{
    _arg6 = &temp;
}
    if(!PyArg_ParseTuple(args,"iiiOOO:dlp_FindDBInfo",&_arg0,&_arg1,&_arg2,&_obj3,&_obj4,&_obj5)) 
        return NULL;
{
    if (!(_obj3) || (_obj3 == Py_None)) {
	_arg3 = NULL;
    } else {
	_arg3 = PyString_AsString(_obj3);
    }
}
{
    if (!(_obj4) || (_obj4 == Py_None)) {
	_arg4 = 0;
    } else {
	if (!PyString_Check(_obj4) || (PyString_Size(_obj4) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg4 = makelong(PyString_AsString(_obj4));
    }
}
{
    if (!(_obj5) || (_obj5 == Py_None)) {
	_arg5 = 0;
    } else {
	if (!PyString_Check(_obj5) || (PyString_Size(_obj5) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg5 = makelong(PyString_AsString(_obj5));
    }
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_FindDBInfo(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;

    if (_arg6) {
	o = Py_BuildValue("{sisisisOsOsislslslslsisssisisisisisisisisisisi}",
			  "more", _arg6->more,
			  "flags", _arg6->flags,
			  "miscFlags", _arg6->miscFlags,
			  "type", PyString_FromStringAndSize(printlong(_arg6->type), 4),
			  "creator", PyString_FromStringAndSize(printlong(_arg6->creator), 4),
			  "version", _arg6->version,
			  "modnum", _arg6->modnum,
			  "createDate", _arg6->createDate,
			  "modifyDate", _arg6->modifyDate,
			  "backupDate", _arg6->backupDate,
			  "index", _arg6->index,
			  "name", _arg6->name,

			  "flagResource", !!(_arg6->flags & dlpDBFlagResource),
			  "flagReadOnly", !!(_arg6->flags & dlpDBFlagReadOnly),
			  "flagAppInfoDirty", !!(_arg6->flags & dlpDBFlagAppInfoDirty),
			  "flagBackup", !!(_arg6->flags & dlpDBFlagBackup),
			  "flagClipping", !!(_arg6->flags & dlpDBFlagClipping),
			  "flagOpen", !!(_arg6->flags & dlpDBFlagOpen),
			  "flagNewer", !!(_arg6->flags & dlpDBFlagNewer),
			  "flagReset", !!(_arg6->flags & dlpDBFlagReset),
			  "flagCopyPrevention", !!(_arg6->flags & dlpDBFlagCopyPrevention),
			  "flagStream", !!(_arg6->flags & dlpDBFlagStream),
			  "flagExcludeFromSync", !!(_arg6->miscFlags & dlpDBMiscFlagExcludeFromSync));
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_OpenDB(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    char * _arg3;
    int * _arg4;
    int  temp;

    self = self;
{
  _arg4 = &temp;
}
    if(!PyArg_ParseTuple(args,"iiis:dlp_OpenDB",&_arg0,&_arg1,&_arg2,&_arg3)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_OpenDB(_arg0,_arg1,_arg2,_arg3,_arg4);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_CloseDB(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:dlp_CloseDB",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_CloseDB(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_CloseDB_All(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_CloseDB_All",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_CloseDB_All(_arg0);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_DeleteDB(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    char * _arg2;

    self = self;
    if(!PyArg_ParseTuple(args,"iis:dlp_DeleteDB",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_DeleteDB(_arg0,_arg1,_arg2);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_CreateDB(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    long  _arg1;
    long  _arg2;
    int  _arg3;
    int  _arg4;
    int  _arg5;
    char * _arg6;
    int * _arg7;
    int  temp;
    PyObject * _obj1 = 0;
    PyObject * _obj2 = 0;

    self = self;
{
  _arg7 = &temp;
}
    if(!PyArg_ParseTuple(args,"iOOiiis:dlp_CreateDB",&_arg0,&_obj1,&_obj2,&_arg3,&_arg4,&_arg5,&_arg6)) 
        return NULL;
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
{
    if (!(_obj2) || (_obj2 == Py_None)) {
	_arg2 = 0;
    } else {
	if (!PyString_Check(_obj2) || (PyString_Size(_obj2) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg2 = makelong(PyString_AsString(_obj2));
    }
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_CreateDB(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ResetSystem(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_ResetSystem",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ResetSystem(_arg0);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_AddSyncLogEntry(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    char * _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"is:dlp_AddSyncLogEntry",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_AddSyncLogEntry(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_OpenConduit(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_OpenConduit",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_OpenConduit(_arg0);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_EndOfSync(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:dlp_EndOfSync",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_EndOfSync(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_AbortSync(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_AbortSync",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_AbortSync(_arg0);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadOpenDBInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int * _arg2;
    int  temp;

    self = self;
{
  _arg2 = &temp;
}
    if(!PyArg_ParseTuple(args,"ii:dlp_ReadOpenDBInfo",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadOpenDBInfo(_arg0,_arg1,_arg2);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg2));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_MoveCategory(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    int  _arg3;

    self = self;
    if(!PyArg_ParseTuple(args,"iiii:dlp_MoveCategory",&_arg0,&_arg1,&_arg2,&_arg3)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_MoveCategory(_arg0,_arg1,_arg2,_arg3);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteUserInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    struct PilotUser * _arg1;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iO:dlp_WriteUserInfo",&_arg0,&_obj1)) 
        return NULL;
{
    static struct PilotUser temp;
    int l;
    PyObject *foo;

    temp.userID = DGETLONG(_obj1,"userID",0);
    temp.viewerID = DGETLONG(_obj1,"viewerID",0);
    temp.lastSyncPC = DGETLONG(_obj1,"lastSyncPC",0);
    temp.successfulSyncDate = DGETLONG(_obj1,"successfulSyncDate",0);
    temp.lastSyncDate = DGETLONG(_obj1,"lastSyncDate",0);
    strncpy(temp.username, DGETSTR(_obj1,"name",""), 128);

    foo = PyDict_GetItemString(_obj1,"password");
    if (PyString_Check(foo)) {
	l = PyString_Size(foo);
	temp.passwordLength = l;
	memcpy(temp.password, PyString_AsString(foo), l);
    }
    
    _arg1 = &temp;    
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_WriteUserInfo(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadUserInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    struct PilotUser * _arg1;
    struct PilotUser  temp;

    self = self;
{
    _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"i:dlp_ReadUserInfo",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadUserInfo(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    
    if (_arg1) {
	o = Py_BuildValue("{slslslslslssss#}",
			  "userID", _arg1->userID,
			  "viewerID", _arg1->viewerID,
			  "lastSyncPC", _arg1->lastSyncPC,
			  "successfulSyncDate", _arg1->successfulSyncDate,
			  "lastSyncDate", _arg1->lastSyncDate,
			  "name", _arg1->username,
			  "password", _arg1->password, _arg1->passwordLength);
        _resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ResetLastSyncPC(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:dlp_ResetLastSyncPC",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ResetLastSyncPC(_arg0);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteAppBlock(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    void * _arg2;
    int  _arg3;
    int  __buflen;
    PyObject * _obj2 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"iiO:dlp_WriteAppBlock",&_arg0,&_arg1,&_obj2)) 
        return NULL;
{
    __buflen = PyString_Size(_obj2);
    _arg2 = (void *)PyString_AsString(_obj2);
}
{
    _arg3 = __buflen;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_WriteAppBlock(_arg0,_arg1,_arg2,_arg3);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteSortBlock(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    void * _arg2;
    int  _arg3;
    int  __buflen;
    PyObject * _obj2 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"iiO:dlp_WriteSortBlock",&_arg0,&_arg1,&_obj2)) 
        return NULL;
{
    __buflen = PyString_Size(_obj2);
    _arg2 = (void *)PyString_AsString(_obj2);
}
{
    _arg3 = __buflen;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_WriteSortBlock(_arg0,_arg1,_arg2,_arg3);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ResetDBIndex(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:dlp_ResetDBIndex",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ResetDBIndex(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteRecord(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    recordid_t * _arg3;
    int  _arg4;
    void * _arg5;
    int  _arg6;
    recordid_t * _arg7;
    unsigned long  temp;
    unsigned long  temp0;
    PyObject * _obj3 = 0;
    int  __buflen;
    PyObject * _obj5 = 0;

    self = self;
{
}
{
  _arg7 = &temp;
}
    if(!PyArg_ParseTuple(args,"iiiOiO:dlp_WriteRecord",&_arg0,&_arg1,&_arg2,&_obj3,&_arg4,&_obj5)) 
        return NULL;
{
  temp0 = (unsigned long) PyInt_AsLong(_obj3);
  _arg3 = &temp0;
}
{
    __buflen = PyString_Size(_obj5);
    _arg5 = (void *)PyString_AsString(_obj5);
}
{
    _arg6 = __buflen;
}
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_WriteRecord(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_DeleteRecord(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    recordid_t * _arg3;
    unsigned long  temp;
    PyObject * _obj3 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iiiO:dlp_DeleteRecord",&_arg0,&_arg1,&_arg2,&_obj3)) 
        return NULL;
{
  temp = (unsigned long) PyInt_AsLong(_obj3);
  _arg3 = &temp;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_DeleteRecord(_arg0,_arg1,_arg2,*_arg3);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_DeleteCategory(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;

    self = self;
    if(!PyArg_ParseTuple(args,"iii:dlp_DeleteCategory",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_DeleteCategory(_arg0,_arg1,_arg2);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadResourceByType(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    unsigned long  _arg2;
    int  _arg3;
    void * _arg4;
    int * _arg5;
    int  temp;
    int * _arg6;
    int  __buflen;
    PyObject * _obj2 = 0;

    self = self;
{
    _arg4 = __dlp_buf;
}
{
  _arg5 = &temp;
}
{
    _arg6 = &__buflen;
}
    if(!PyArg_ParseTuple(args,"iiOi:dlp_ReadResourceByType",&_arg0,&_arg1,&_obj2,&_arg3)) 
        return NULL;
{
    if (!(_obj2) || (_obj2 == Py_None)) {
	_arg2 = 0;
    } else {
	if (!PyString_Check(_obj2) || (PyString_Size(_obj2) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg2 = makelong(PyString_AsString(_obj2));
    }
}
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadResourceByType(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg4) {
	o = Py_BuildValue("s#", _arg4, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadResourceByIndex(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    unsigned long * _arg4;
    unsigned long  temp;
    int * _arg5;
    int  temp0;
    int * _arg6;
    int  __buflen;

    self = self;
{
    _arg3 = __dlp_buf;
}
{
    _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
{
    _arg6 = &__buflen;
}
    if(!PyArg_ParseTuple(args,"iii:dlp_ReadResourceByIndex",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadResourceByIndex(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg3) {
	o = Py_BuildValue("s#", _arg3, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    if (_arg4) {
	o = PyString_FromStringAndSize(printlong(*_arg4), 4);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteResource(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    unsigned long  _arg2;
    int  _arg3;
    void * _arg4;
    int  _arg5;
    PyObject * _obj2 = 0;
    int  __buflen;
    PyObject * _obj4 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"iiOiO:dlp_WriteResource",&_arg0,&_arg1,&_obj2,&_arg3,&_obj4)) 
        return NULL;
{
    if (!(_obj2) || (_obj2 == Py_None)) {
	_arg2 = 0;
    } else {
	if (!PyString_Check(_obj2) || (PyString_Size(_obj2) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg2 = makelong(PyString_AsString(_obj2));
    }
}
{
    __buflen = PyString_Size(_obj4);
    _arg4 = (void *)PyString_AsString(_obj4);
}
{
    _arg5 = __buflen;
}
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_WriteResource(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_DeleteResource(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    unsigned long  _arg3;
    int  _arg4;
    PyObject * _obj3 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iiiOi:dlp_DeleteResource",&_arg0,&_arg1,&_arg2,&_obj3,&_arg4)) 
        return NULL;
{
    if (!(_obj3) || (_obj3 == Py_None)) {
	_arg3 = 0;
    } else {
	if (!PyString_Check(_obj3) || (PyString_Size(_obj3) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg3 = makelong(PyString_AsString(_obj3));
    }
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_DeleteResource(_arg0,_arg1,_arg2,_arg3,_arg4);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadNextModifiedRec(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    void * _arg2;
    recordid_t * _arg3;
    unsigned long  temp;
    int * _arg4;
    int  temp0;
    int * _arg5;
    int  __buflen;
    int * _arg6;
    int  temp1;
    int * _arg7;
    int  temp2;

    self = self;
{
    _arg2 = __dlp_buf;
}
{
  _arg3 = &temp;
}
{
  _arg4 = &temp0;
}
{
    _arg5 = &__buflen;
}
{
  _arg6 = &temp1;
}
{
  _arg7 = &temp2;
}
    if(!PyArg_ParseTuple(args,"ii:dlp_ReadNextModifiedRec",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadNextModifiedRec(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg2) {
	o = Py_BuildValue("s#", _arg2, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg3));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg6));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadNextModifiedRecInCategory(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    recordid_t * _arg4;
    unsigned long  temp;
    int * _arg5;
    int  temp0;
    int * _arg6;
    int  __buflen;
    int * _arg7;
    int  temp1;

    self = self;
{
    _arg3 = __dlp_buf;
}
{
  _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
{
    _arg6 = &__buflen;
}
{
  _arg7 = &temp1;
}
    if(!PyArg_ParseTuple(args,"iii:dlp_ReadNextModifiedRecInCategory",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadNextModifiedRecInCategory(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg3) {
	o = Py_BuildValue("s#", _arg3, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadNextRecInCategory(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    recordid_t * _arg4;
    unsigned long  temp;
    int * _arg5;
    int  temp0;
    int * _arg6;
    int  __buflen;
    int * _arg7;
    int  temp1;
    PyObject * _argo3 = 0;

    self = self;
{
  _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
{
    _arg6 = &__buflen;
}
{
  _arg7 = &temp1;
}
    if(!PyArg_ParseTuple(args,"iiiO:dlp_ReadNextRecInCategory",&_arg0,&_arg1,&_arg2,&_argo3)) 
        return NULL;
    if (_argo3) {
        if (_argo3 == Py_None) { _arg3 = NULL; }
        else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of dlp_ReadNextRecInCategory. Expected _void_p.");
        return NULL;
        }
    }
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadNextRecInCategory(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadRecordById(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    recordid_t * _arg2;
    void * _arg3;
    int * _arg4;
    int  temp;
    int * _arg5;
    int  __buflen;
    int * _arg6;
    int  temp0;
    int * _arg7;
    int  temp1;
    unsigned long  temp2;
    PyObject * _obj2 = 0;

    self = self;
{
    _arg3 = __dlp_buf;
}
{
  _arg4 = &temp;
}
{
    _arg5 = &__buflen;
}
{
  _arg6 = &temp0;
}
{
  _arg7 = &temp1;
}
    if(!PyArg_ParseTuple(args,"iiO:dlp_ReadRecordById",&_arg0,&_arg1,&_obj2)) 
        return NULL;
{
  temp2 = (unsigned long) PyInt_AsLong(_obj2);
  _arg2 = &temp2;
}
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadRecordById(_arg0,_arg1,*_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg3) {
	o = Py_BuildValue("s#", _arg3, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg6));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadRecordByIndex(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPDBERROR * _result;
    int  _arg0;
    int  _arg1;
    int  _arg2;
    void * _arg3;
    recordid_t * _arg4;
    unsigned long  temp;
    int * _arg5;
    int  __buflen;
    int * _arg6;
    int  temp0;
    int * _arg7;
    int  temp1;

    self = self;
{
    _arg3 = __dlp_buf;
}
{
  _arg4 = &temp;
}
{
    _arg5 = &__buflen;
}
{
  _arg6 = &temp0;
}
{
  _arg7 = &temp1;
}
    if(!PyArg_ParseTuple(args,"iii:dlp_ReadRecordByIndex",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (DLPDBERROR *) malloc(sizeof(DLPDBERROR ));
    *(_result) = dlp_ReadRecordByIndex(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) == -5) {
	Py_INCREF(Py_None);
	return Py_None;
    } else if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg3) {
	o = Py_BuildValue("s#", _arg3, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg6));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_CleanUpDatabase(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:dlp_CleanUpDatabase",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_CleanUpDatabase(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ResetSyncFlags(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    int  _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ii:dlp_ResetSyncFlags",&_arg0,&_arg1)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ResetSyncFlags(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadFeature(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    unsigned long  _arg1;
    unsigned int  _arg2;
    unsigned long * _arg3;
    unsigned long  temp;
    PyObject * _obj1 = 0;

    self = self;
{
  _arg3 = &temp;
}
    if(!PyArg_ParseTuple(args,"iOi:dlp_ReadFeature",&_arg0,&_obj1,&_arg2)) 
        return NULL;
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadFeature(_arg0,_arg1,_arg2,_arg3);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg3));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadNetSyncInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    struct NetSyncInfo * _arg1;
    struct NetSyncInfo  temp;

    self = self;
{
    _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"i:dlp_ReadNetSyncInfo",&_arg0)) 
        return NULL;
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadNetSyncInfo(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg1){
	o = Py_BuildValue("{sissssss}",
			  "lanSync", _arg1->lanSync,
			  "hostName", _arg1->hostName,
			  "hostAddress", _arg1->hostAddress,
			  "hostSubnetMask", _arg1->hostSubnetMask);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteNetSyncInfo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    struct NetSyncInfo * _arg1;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"iO:dlp_WriteNetSyncInfo",&_arg0,&_obj1)) 
        return NULL;
{
    static struct NetSyncInfo temp;

    temp.lanSync = (int) DGETLONG(_obj1,"lanSync",0);
    strncpy(temp.hostName, DGETSTR(_obj1,"hostName",""), 256);
    strncpy(temp.hostAddress, DGETSTR(_obj1,"hostAddress",""), 40);
    strncpy(temp.hostSubnetMask, DGETSTR(_obj1,"hostSubnetMask",""), 40);

    _arg1 = &temp;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_WriteNetSyncInfo(_arg0,_arg1);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_ReadAppPreference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    unsigned long  _arg1;
    int  _arg2;
    int  _arg3;
    int  _arg4;
    void * _arg5;
    int * _arg6;
    int  __buflen;
    int * _arg7;
    int  temp;
    PyObject * _obj1 = 0;

    self = self;
{
    _arg4 = DLPMAXBUF;
}
{
    _arg5 = __dlp_buf;
}
{
    _arg6 = &__buflen;
}
{
  _arg7 = &temp;
}
    if(!PyArg_ParseTuple(args,"iOii:dlp_ReadAppPreference",&_arg0,&_obj1,&_arg2,&_arg3)) 
        return NULL;
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_ReadAppPreference(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg5) {
	o = Py_BuildValue("s#", _arg5, __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg7));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_dlp_WriteAppPreference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    DLPERROR * _result;
    int  _arg0;
    unsigned long  _arg1;
    int  _arg2;
    int  _arg3;
    int  _arg4;
    void * _arg5;
    int  _arg6;
    PyObject * _obj1 = 0;
    int  __buflen;
    PyObject * _obj5 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"iOiiiO:dlp_WriteAppPreference",&_arg0,&_obj1,&_arg2,&_arg3,&_arg4,&_obj5)) 
        return NULL;
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
{
    __buflen = PyString_Size(_obj5);
    _arg5 = (void *)PyString_AsString(_obj5);
}
{
    _arg6 = __buflen;
}
    _result = (DLPERROR *) malloc(sizeof(DLPERROR ));
    *(_result) = dlp_WriteAppPreference(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) < 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     dlp_strerror(*(_result))));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_open(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    struct pi_file * _result;
    char * _arg0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"s:pi_file_open",&_arg0)) 
        return NULL;
    _result = (struct pi_file *)pi_file_open(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_struct_pi_file_p");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_pi_file_close(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:pi_file_close",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_close. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_close(_arg0);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_get_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    struct DBInfo * _arg1;
    struct DBInfo  temp;
    PyObject * _argo0 = 0;

    self = self;
{
    _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"O:pi_file_get_info",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_get_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_get_info(_arg0,_arg1);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;

    if (_arg1) {
	o = Py_BuildValue("{sisisisOsOsislslslslsisssisisisisisisisisisisi}",
			  "more", _arg1->more,
			  "flags", _arg1->flags,
			  "miscFlags", _arg1->miscFlags,
			  "type", PyString_FromStringAndSize(printlong(_arg1->type), 4),
			  "creator", PyString_FromStringAndSize(printlong(_arg1->creator), 4),
			  "version", _arg1->version,
			  "modnum", _arg1->modnum,
			  "createDate", _arg1->createDate,
			  "modifyDate", _arg1->modifyDate,
			  "backupDate", _arg1->backupDate,
			  "index", _arg1->index,
			  "name", _arg1->name,

			  "flagResource", !!(_arg1->flags & dlpDBFlagResource),
			  "flagReadOnly", !!(_arg1->flags & dlpDBFlagReadOnly),
			  "flagAppInfoDirty", !!(_arg1->flags & dlpDBFlagAppInfoDirty),
			  "flagBackup", !!(_arg1->flags & dlpDBFlagBackup),
			  "flagClipping", !!(_arg1->flags & dlpDBFlagClipping),
			  "flagOpen", !!(_arg1->flags & dlpDBFlagOpen),
			  "flagNewer", !!(_arg1->flags & dlpDBFlagNewer),
			  "flagReset", !!(_arg1->flags & dlpDBFlagReset),
			  "flagCopyPrevention", !!(_arg1->flags & dlpDBFlagCopyPrevention),
			  "flagStream", !!(_arg1->flags & dlpDBFlagStream),
			  "flagExcludeFromSync", !!(_arg1->miscFlags & dlpDBMiscFlagExcludeFromSync));
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_get_app_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void ** _arg1;
    int * _arg2;
    int  __buflen;
    PyObject * _argo0 = 0;

    self = self;
{
    static void *foo;
    _arg1 = &foo;
}
{
    _arg2 = &__buflen;
}
    if(!PyArg_ParseTuple(args,"O:pi_file_get_app_info",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_get_app_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_get_app_info(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg1) {
	o = Py_BuildValue("s#", *(_arg1), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_get_sort_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void ** _arg1;
    int * _arg2;
    int  __buflen;
    PyObject * _argo0 = 0;

    self = self;
{
    static void *foo;
    _arg1 = &foo;
}
{
    _arg2 = &__buflen;
}
    if(!PyArg_ParseTuple(args,"O:pi_file_get_sort_info",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_get_sort_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_get_sort_info(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg1) {
	o = Py_BuildValue("s#", *(_arg1), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_read_resource(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int  _arg1;
    void ** _arg2;
    int * _arg3;
    int  __buflen;
    unsigned long * _arg4;
    unsigned long  temp;
    int * _arg5;
    int  temp0;
    PyObject * _argo0 = 0;

    self = self;
{
    static void *foo;
    _arg2 = &foo;
}
{
    _arg3 = &__buflen;
}
{
    _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
    if(!PyArg_ParseTuple(args,"Oi:pi_file_read_resource",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_read_resource. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_read_resource(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg2) {
	o = Py_BuildValue("s#", *(_arg2), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    if (_arg4) {
	o = PyString_FromStringAndSize(printlong(*_arg4), 4);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_read_resource_by_type_id(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    unsigned long  _arg1;
    int  _arg2;
    void ** _arg3;
    int * _arg4;
    int  __buflen;
    int * _arg5;
    int  temp;
    PyObject * _argo0 = 0;
    PyObject * _obj1 = 0;

    self = self;
{
    static void *foo;
    _arg3 = &foo;
}
{
    _arg4 = &__buflen;
}
{
  _arg5 = &temp;
}
    if(!PyArg_ParseTuple(args,"OOi:pi_file_read_resource_by_type_id",&_argo0,&_obj1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_read_resource_by_type_id. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_read_resource_by_type_id(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg3) {
	o = Py_BuildValue("s#", *(_arg3), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_type_id_used(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    unsigned long  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OOi:pi_file_type_id_used",&_argo0,&_obj1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_type_id_used. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    if (!(_obj1) || (_obj1 == Py_None)) {
	_arg1 = 0;
    } else {
	if (!PyString_Check(_obj1) || (PyString_Size(_obj1) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg1 = makelong(PyString_AsString(_obj1));
    }
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_type_id_used(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_read_record(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int  _arg1;
    void ** _arg2;
    int * _arg3;
    int  __buflen;
    int * _arg4;
    int  temp;
    int * _arg5;
    int  temp0;
    recordid_t * _arg6;
    unsigned long  temp1;
    PyObject * _argo0 = 0;

    self = self;
{
    static void *foo;
    _arg2 = &foo;
}
{
    _arg3 = &__buflen;
}
{
  _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
{
  _arg6 = &temp1;
}
    if(!PyArg_ParseTuple(args,"Oi:pi_file_read_record",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_read_record. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_read_record(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg2) {
	o = Py_BuildValue("s#", *(_arg2), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg6));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_get_entries(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int * _arg1;
    int  temp;
    PyObject * _argo0 = 0;

    self = self;
{
  _arg1 = &temp;
}
    if(!PyArg_ParseTuple(args,"O:pi_file_get_entries",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_get_entries. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_get_entries(_arg0,_arg1);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg1));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_read_record_by_id(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    recordid_t * _arg1;
    void ** _arg2;
    int * _arg3;
    int  __buflen;
    int * _arg4;
    int  temp;
    int * _arg5;
    int  temp0;
    int * _arg6;
    int  temp1;
    PyObject * _argo0 = 0;
    unsigned long  temp2;
    PyObject * _obj1 = 0;

    self = self;
{
    static void *foo;
    _arg2 = &foo;
}
{
    _arg3 = &__buflen;
}
{
  _arg4 = &temp;
}
{
  _arg5 = &temp0;
}
{
  _arg6 = &temp1;
}
    if(!PyArg_ParseTuple(args,"OO:pi_file_read_record_by_id",&_argo0,&_obj1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_read_record_by_id. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
  temp2 = (unsigned long) PyInt_AsLong(_obj1);
  _arg1 = &temp2;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_read_record_by_id(_arg0,*_arg1,_arg2,_arg3,_arg4,_arg5,_arg6);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
{
    PyObject *o;
    if (_arg2) {
	o = Py_BuildValue("s#", *(_arg2), __buflen);
	_resultobj = t_output_helper(_resultobj, o);
    }
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg4));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg5));
    _resultobj = t_output_helper(_resultobj, o);
}
{
    PyObject *o;
    o = PyInt_FromLong((long) (*_arg6));
    _resultobj = t_output_helper(_resultobj, o);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_id_used(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    recordid_t * _arg1;
    PyObject * _argo0 = 0;
    unsigned long  temp;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:pi_file_id_used",&_argo0,&_obj1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_id_used. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
  temp = (unsigned long) PyInt_AsLong(_obj1);
  _arg1 = &temp;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_id_used(_arg0,*_arg1);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_create(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    struct pi_file * _result;
    char * _arg0;
    struct DBInfo * _arg1;
    PyObject * _obj1 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"sO:pi_file_create",&_arg0,&_obj1)) 
        return NULL;
{
    static struct DBInfo temp;

    temp.more = (int) DGETLONG(_obj1, "more", 0);
    temp.type = makelong(DGETSTR(_obj1, "type", "    "));
    temp.creator = makelong(DGETSTR(_obj1, "creator", "    "));
    temp.version = DGETLONG(_obj1, "version", 0);
    temp.modnum = DGETLONG(_obj1, "modnum", 0);
    temp.createDate = DGETLONG(_obj1, "createDate", 0);
    temp.modifyDate = DGETLONG(_obj1, "modifyDate", 0);
    temp.backupDate = DGETLONG(_obj1, "backupDate", 0);
    temp.index = DGETLONG(_obj1, "index", 0);
    strncpy(temp.name, DGETSTR(_obj1,"name",""), 34);
    temp.flags = 0;
    if (DGETLONG(_obj1,"flagResource",0)) temp.flags |= dlpDBFlagResource;
    if (DGETLONG(_obj1,"flagReadOnly",0)) temp.flags |= dlpDBFlagReadOnly;
    if (DGETLONG(_obj1,"flagAppInfoDirty",0)) temp.flags |= dlpDBFlagAppInfoDirty;
    if (DGETLONG(_obj1,"flagBackup",0)) temp.flags |= dlpDBFlagBackup;
    if (DGETLONG(_obj1,"flagClipping",0)) temp.flags |= dlpDBFlagClipping;
    if (DGETLONG(_obj1,"flagOpen",0)) temp.flags |= dlpDBFlagOpen;
    if (DGETLONG(_obj1,"flagNewer",0)) temp.flags |= dlpDBFlagNewer;
    if (DGETLONG(_obj1,"flagReset",0)) temp.flags |= dlpDBFlagReset;
    if (DGETLONG(_obj1,"flagCopyPrevention",0)) temp.flags |= dlpDBFlagCopyPrevention;
    if (DGETLONG(_obj1,"flagStream",0)) temp.flags |= dlpDBFlagStream;
    temp.miscFlags = 0;
    if (DGETLONG(_obj1,"flagExcludeFromSync",0)) temp.miscFlags |= dlpDBMiscFlagExcludeFromSync;
    _arg1 = &temp;
}
    _result = (struct pi_file *)pi_file_create(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_struct_pi_file_p");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_pi_file_set_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    struct DBInfo * _arg1;
    PyObject * _argo0 = 0;
    PyObject * _obj1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:pi_file_set_info",&_argo0,&_obj1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_set_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    static struct DBInfo temp;

    temp.more = (int) DGETLONG(_obj1, "more", 0);
    temp.type = makelong(DGETSTR(_obj1, "type", "    "));
    temp.creator = makelong(DGETSTR(_obj1, "creator", "    "));
    temp.version = DGETLONG(_obj1, "version", 0);
    temp.modnum = DGETLONG(_obj1, "modnum", 0);
    temp.createDate = DGETLONG(_obj1, "createDate", 0);
    temp.modifyDate = DGETLONG(_obj1, "modifyDate", 0);
    temp.backupDate = DGETLONG(_obj1, "backupDate", 0);
    temp.index = DGETLONG(_obj1, "index", 0);
    strncpy(temp.name, DGETSTR(_obj1,"name",""), 34);
    temp.flags = 0;
    if (DGETLONG(_obj1,"flagResource",0)) temp.flags |= dlpDBFlagResource;
    if (DGETLONG(_obj1,"flagReadOnly",0)) temp.flags |= dlpDBFlagReadOnly;
    if (DGETLONG(_obj1,"flagAppInfoDirty",0)) temp.flags |= dlpDBFlagAppInfoDirty;
    if (DGETLONG(_obj1,"flagBackup",0)) temp.flags |= dlpDBFlagBackup;
    if (DGETLONG(_obj1,"flagClipping",0)) temp.flags |= dlpDBFlagClipping;
    if (DGETLONG(_obj1,"flagOpen",0)) temp.flags |= dlpDBFlagOpen;
    if (DGETLONG(_obj1,"flagNewer",0)) temp.flags |= dlpDBFlagNewer;
    if (DGETLONG(_obj1,"flagReset",0)) temp.flags |= dlpDBFlagReset;
    if (DGETLONG(_obj1,"flagCopyPrevention",0)) temp.flags |= dlpDBFlagCopyPrevention;
    if (DGETLONG(_obj1,"flagStream",0)) temp.flags |= dlpDBFlagStream;
    temp.miscFlags = 0;
    if (DGETLONG(_obj1,"flagExcludeFromSync",0)) temp.miscFlags |= dlpDBMiscFlagExcludeFromSync;
    _arg1 = &temp;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_set_info(_arg0,_arg1);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_set_app_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void * _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;
    int  __buflen;
    PyObject * _obj1 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"OO:pi_file_set_app_info",&_argo0,&_obj1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_set_app_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    __buflen = PyString_Size(_obj1);
    _arg1 = (void *)PyString_AsString(_obj1);
}
{
    _arg2 = __buflen;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_set_app_info(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_set_sort_info(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void * _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;
    int  __buflen;
    PyObject * _obj1 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"OO:pi_file_set_sort_info",&_argo0,&_obj1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_set_sort_info. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    __buflen = PyString_Size(_obj1);
    _arg1 = (void *)PyString_AsString(_obj1);
}
{
    _arg2 = __buflen;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_set_sort_info(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_append_resource(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void * _arg1;
    int  _arg2;
    unsigned long  _arg3;
    int  _arg4;
    PyObject * _argo0 = 0;
    int  __buflen;
    PyObject * _obj1 = 0;
    PyObject * _obj3 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"OOOi:pi_file_append_resource",&_argo0,&_obj1,&_obj3,&_arg4)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_append_resource. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    __buflen = PyString_Size(_obj1);
    _arg1 = (void *)PyString_AsString(_obj1);
}
{
    if (!(_obj3) || (_obj3 == Py_None)) {
	_arg3 = 0;
    } else {
	if (!PyString_Check(_obj3) || (PyString_Size(_obj3) != 4)) {
	    PyErr_SetString(PyExc_ValueError, "argument must be a 4-character string");
	    return 0;
	}
	_arg3 = makelong(PyString_AsString(_obj3));
    }
}
{
    _arg2 = __buflen;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_append_resource(_arg0,_arg1,_arg2,_arg3,_arg4);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_append_record(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    void * _arg1;
    int  _arg2;
    int  _arg3;
    int  _arg4;
    recordid_t * _arg5;
    PyObject * _argo0 = 0;
    int  __buflen;
    PyObject * _obj1 = 0;
    unsigned long  temp;
    PyObject * _obj5 = 0;

    self = self;
{
}
    if(!PyArg_ParseTuple(args,"OOiiO:pi_file_append_record",&_argo0,&_obj1,&_arg3,&_arg4,&_obj5)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_append_record. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
{
    __buflen = PyString_Size(_obj1);
    _arg1 = (void *)PyString_AsString(_obj1);
}
    if (_obj5)
{
  temp = (unsigned long) PyInt_AsLong(_obj5);
  _arg5 = &temp;
}
{
    _arg2 = __buflen;
}
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_append_record(_arg0,_arg1,_arg2,_arg3,_arg4,*_arg5);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_retrieve(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oii:pi_file_retrieve",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_retrieve. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_retrieve(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_install(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oii:pi_file_install",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_install. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_install(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyObject *_wrap_pi_file_merge(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    PIERROR * _result;
    struct pi_file * _arg0;
    int  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oii:pi_file_merge",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_struct_pi_file_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of pi_file_merge. Expected _struct_pi_file_p.");
        return NULL;
        }
    }
    _result = (PIERROR *) malloc(sizeof(PIERROR ));
    *(_result) = pi_file_merge(_arg0,_arg1,_arg2);
{
    if (*(_result) != 0) {
	PyErr_SetObject(Error, Py_BuildValue("(is)", *(_result),
					     "pisock error"));
	return NULL;
    }
    _resultobj = Py_None;
    Py_INCREF(Py_None);
}
    return _resultobj;
}

static PyMethodDef _pisockMethods[] = {
	 { "pi_file_merge", _wrap_pi_file_merge, METH_VARARGS },
	 { "pi_file_install", _wrap_pi_file_install, METH_VARARGS },
	 { "pi_file_retrieve", _wrap_pi_file_retrieve, METH_VARARGS },
	 { "pi_file_append_record", _wrap_pi_file_append_record, METH_VARARGS },
	 { "pi_file_append_resource", _wrap_pi_file_append_resource, METH_VARARGS },
	 { "pi_file_set_sort_info", _wrap_pi_file_set_sort_info, METH_VARARGS },
	 { "pi_file_set_app_info", _wrap_pi_file_set_app_info, METH_VARARGS },
	 { "pi_file_set_info", _wrap_pi_file_set_info, METH_VARARGS },
	 { "pi_file_create", _wrap_pi_file_create, METH_VARARGS },
	 { "pi_file_id_used", _wrap_pi_file_id_used, METH_VARARGS },
	 { "pi_file_read_record_by_id", _wrap_pi_file_read_record_by_id, METH_VARARGS },
	 { "pi_file_get_entries", _wrap_pi_file_get_entries, METH_VARARGS },
	 { "pi_file_read_record", _wrap_pi_file_read_record, METH_VARARGS },
	 { "pi_file_type_id_used", _wrap_pi_file_type_id_used, METH_VARARGS },
	 { "pi_file_read_resource_by_type_id", _wrap_pi_file_read_resource_by_type_id, METH_VARARGS },
	 { "pi_file_read_resource", _wrap_pi_file_read_resource, METH_VARARGS },
	 { "pi_file_get_sort_info", _wrap_pi_file_get_sort_info, METH_VARARGS },
	 { "pi_file_get_app_info", _wrap_pi_file_get_app_info, METH_VARARGS },
	 { "pi_file_get_info", _wrap_pi_file_get_info, METH_VARARGS },
	 { "pi_file_close", _wrap_pi_file_close, METH_VARARGS },
	 { "pi_file_open", _wrap_pi_file_open, METH_VARARGS },
	 { "dlp_WriteAppPreference", _wrap_dlp_WriteAppPreference, METH_VARARGS },
	 { "dlp_ReadAppPreference", _wrap_dlp_ReadAppPreference, METH_VARARGS },
	 { "dlp_WriteNetSyncInfo", _wrap_dlp_WriteNetSyncInfo, METH_VARARGS },
	 { "dlp_ReadNetSyncInfo", _wrap_dlp_ReadNetSyncInfo, METH_VARARGS },
	 { "dlp_ReadFeature", _wrap_dlp_ReadFeature, METH_VARARGS },
	 { "dlp_ResetSyncFlags", _wrap_dlp_ResetSyncFlags, METH_VARARGS },
	 { "dlp_CleanUpDatabase", _wrap_dlp_CleanUpDatabase, METH_VARARGS },
	 { "dlp_ReadRecordByIndex", _wrap_dlp_ReadRecordByIndex, METH_VARARGS },
	 { "dlp_ReadRecordById", _wrap_dlp_ReadRecordById, METH_VARARGS },
	 { "dlp_ReadNextRecInCategory", _wrap_dlp_ReadNextRecInCategory, METH_VARARGS },
	 { "dlp_ReadNextModifiedRecInCategory", _wrap_dlp_ReadNextModifiedRecInCategory, METH_VARARGS },
	 { "dlp_ReadNextModifiedRec", _wrap_dlp_ReadNextModifiedRec, METH_VARARGS },
	 { "dlp_DeleteResource", _wrap_dlp_DeleteResource, METH_VARARGS },
	 { "dlp_WriteResource", _wrap_dlp_WriteResource, METH_VARARGS },
	 { "dlp_ReadResourceByIndex", _wrap_dlp_ReadResourceByIndex, METH_VARARGS },
	 { "dlp_ReadResourceByType", _wrap_dlp_ReadResourceByType, METH_VARARGS },
	 { "dlp_DeleteCategory", _wrap_dlp_DeleteCategory, METH_VARARGS },
	 { "dlp_DeleteRecord", _wrap_dlp_DeleteRecord, METH_VARARGS },
	 { "dlp_WriteRecord", _wrap_dlp_WriteRecord, METH_VARARGS },
	 { "dlp_ReadRecordIDList", _wrap_dlp_ReadRecordIDList, METH_VARARGS },
	 { "dlp_ResetDBIndex", _wrap_dlp_ResetDBIndex, METH_VARARGS },
	 { "dlp_WriteSortBlock", _wrap_dlp_WriteSortBlock, METH_VARARGS },
	 { "dlp_ReadSortBlock", _wrap_dlp_ReadSortBlock, METH_VARARGS },
	 { "dlp_WriteAppBlock", _wrap_dlp_WriteAppBlock, METH_VARARGS },
	 { "dlp_ReadAppBlock", _wrap_dlp_ReadAppBlock, METH_VARARGS },
	 { "dlp_ResetLastSyncPC", _wrap_dlp_ResetLastSyncPC, METH_VARARGS },
	 { "dlp_ReadUserInfo", _wrap_dlp_ReadUserInfo, METH_VARARGS },
	 { "dlp_WriteUserInfo", _wrap_dlp_WriteUserInfo, METH_VARARGS },
	 { "dlp_MoveCategory", _wrap_dlp_MoveCategory, METH_VARARGS },
	 { "dlp_ReadOpenDBInfo", _wrap_dlp_ReadOpenDBInfo, METH_VARARGS },
	 { "dlp_AbortSync", _wrap_dlp_AbortSync, METH_VARARGS },
	 { "dlp_EndOfSync", _wrap_dlp_EndOfSync, METH_VARARGS },
	 { "dlp_OpenConduit", _wrap_dlp_OpenConduit, METH_VARARGS },
	 { "dlp_AddSyncLogEntry", _wrap_dlp_AddSyncLogEntry, METH_VARARGS },
	 { "dlp_ResetSystem", _wrap_dlp_ResetSystem, METH_VARARGS },
	 { "dlp_CreateDB", _wrap_dlp_CreateDB, METH_VARARGS },
	 { "dlp_DeleteDB", _wrap_dlp_DeleteDB, METH_VARARGS },
	 { "dlp_CloseDB_All", _wrap_dlp_CloseDB_All, METH_VARARGS },
	 { "dlp_CloseDB", _wrap_dlp_CloseDB, METH_VARARGS },
	 { "dlp_OpenDB", _wrap_dlp_OpenDB, METH_VARARGS },
	 { "dlp_FindDBInfo", _wrap_dlp_FindDBInfo, METH_VARARGS },
	 { "dlp_ReadDBList", _wrap_dlp_ReadDBList, METH_VARARGS },
	 { "dlp_ReadSysInfo", _wrap_dlp_ReadSysInfo, METH_VARARGS },
	 { "dlp_ReadStorageInfo", _wrap_dlp_ReadStorageInfo, METH_VARARGS },
	 { "dlp_SetSysDateTime", _wrap_dlp_SetSysDateTime, METH_VARARGS },
	 { "dlp_GetSysDateTime", _wrap_dlp_GetSysDateTime, METH_VARARGS },
	 { "dlp_strerror", _wrap_dlp_strerror, METH_VARARGS },
	 { "pi_close", _wrap_pi_close, METH_VARARGS },
	 { "pi_watchdog", _wrap_pi_watchdog, METH_VARARGS },
	 { "pi_tickle", _wrap_pi_tickle, METH_VARARGS },
	 { "pi_version", _wrap_pi_version, METH_VARARGS },
	 { "pi_getsockopt", _wrap_pi_getsockopt, METH_VARARGS },
	 { "pi_setsockopt", _wrap_pi_setsockopt, METH_VARARGS },
	 { "pi_getsockpeer", _wrap_pi_getsockpeer, METH_VARARGS },
	 { "pi_getsockname", _wrap_pi_getsockname, METH_VARARGS },
	 { "pi_write", _wrap_pi_write, METH_VARARGS },
	 { "pi_read", _wrap_pi_read, METH_VARARGS },
	 { "pi_recv", _wrap_pi_recv, METH_VARARGS },
	 { "pi_send", _wrap_pi_send, METH_VARARGS },
	 { "pi_accept_to", _wrap_pi_accept_to, METH_VARARGS },
	 { "pi_accept", _wrap_pi_accept, METH_VARARGS },
	 { "pi_listen", _wrap_pi_listen, METH_VARARGS },
	 { "pi_bind", _wrap_pi_bind, METH_VARARGS },
	 { "pi_connect", _wrap_pi_connect, METH_VARARGS },
	 { "pi_socket", _wrap_pi_socket, METH_VARARGS },
	 { "pilot_connect", _wrap_pilot_connect, METH_VARARGS },
	 { NULL, NULL }
};
#ifdef __cplusplus
}
#endif
/*
 * This table is used by the pointer type-checker
 */
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
    { "_signed_long","_long",0},
    { "_long","_unsigned_long",0},
    { "_long","_signed_long",0},
    { "_unsigned_long","_long",0},
    { "_signed_int","_int",0},
    { "_unsigned_short","_short",0},
    { "_signed_short","_short",0},
    { "_unsigned_int","_int",0},
    { "_short","_unsigned_short",0},
    { "_short","_signed_short",0},
    { "_int","_unsigned_int",0},
    { "_int","_signed_int",0},
{0,0,0}};

static PyObject *SWIG_globals;
#ifdef __cplusplus
extern "C" 
#endif
SWIGEXPORT(void) init_pisock() {
	 PyObject *m, *d;
	 SWIG_globals = SWIG_newvarlink();
	 m = Py_InitModule("_pisock", _pisockMethods);
	 d = PyModule_GetDict(m);

    __dlp_buf = (void *)PyMem_Malloc(DLPMAXBUF);
    Error = PyErr_NewException("pisock.error", NULL, NULL);
    PyDict_SetItemString(d, "error", Error);
	 PyDict_SetItemString(d,"PI_AF_PILOT", PyInt_FromLong((long) 0x00));
	 PyDict_SetItemString(d,"PI_PF_DEV", PyInt_FromLong((long) 0x01));
	 PyDict_SetItemString(d,"PI_PF_SLP", PyInt_FromLong((long) 0x02));
	 PyDict_SetItemString(d,"PI_PF_SYS", PyInt_FromLong((long) 0x03));
	 PyDict_SetItemString(d,"PI_PF_PADP", PyInt_FromLong((long) 0x04));
	 PyDict_SetItemString(d,"PI_PF_NET", PyInt_FromLong((long) 0x05));
	 PyDict_SetItemString(d,"PI_PF_DLP", PyInt_FromLong((long) 0x06));
	 PyDict_SetItemString(d,"PI_SOCK_STREAM", PyInt_FromLong((long) 0x0010));
	 PyDict_SetItemString(d,"PI_SOCK_RAW", PyInt_FromLong((long) 0x0030));
	 PyDict_SetItemString(d,"PI_CMD_CMP", PyInt_FromLong((long) 0x01));
	 PyDict_SetItemString(d,"PI_CMD_NET", PyInt_FromLong((long) 0x02));
	 PyDict_SetItemString(d,"PI_CMD_SYS", PyInt_FromLong((long) 0x03));
	 PyDict_SetItemString(d,"PI_MSG_PEEK", PyInt_FromLong((long) 0x01));
	 PyDict_SetItemString(d,"PI_LEVEL_DEV", PyInt_FromLong((long) PI_LEVEL_DEV));
	 PyDict_SetItemString(d,"PI_LEVEL_SLP", PyInt_FromLong((long) PI_LEVEL_SLP));
	 PyDict_SetItemString(d,"PI_LEVEL_PADP", PyInt_FromLong((long) PI_LEVEL_PADP));
	 PyDict_SetItemString(d,"PI_LEVEL_NET", PyInt_FromLong((long) PI_LEVEL_NET));
	 PyDict_SetItemString(d,"PI_LEVEL_SYS", PyInt_FromLong((long) PI_LEVEL_SYS));
	 PyDict_SetItemString(d,"PI_LEVEL_CMP", PyInt_FromLong((long) PI_LEVEL_CMP));
	 PyDict_SetItemString(d,"PI_LEVEL_DLP", PyInt_FromLong((long) PI_LEVEL_DLP));
	 PyDict_SetItemString(d,"PI_LEVEL_SOCK", PyInt_FromLong((long) PI_LEVEL_SOCK));
	 PyDict_SetItemString(d,"PI_DEV_RATE", PyInt_FromLong((long) PI_DEV_RATE));
	 PyDict_SetItemString(d,"PI_DEV_ESTRATE", PyInt_FromLong((long) PI_DEV_ESTRATE));
	 PyDict_SetItemString(d,"PI_DEV_HIGHRATE", PyInt_FromLong((long) PI_DEV_HIGHRATE));
	 PyDict_SetItemString(d,"PI_DEV_TIMEOUT", PyInt_FromLong((long) PI_DEV_TIMEOUT));
	 PyDict_SetItemString(d,"PI_SLP_DEST", PyInt_FromLong((long) PI_SLP_DEST));
	 PyDict_SetItemString(d,"PI_SLP_LASTDEST", PyInt_FromLong((long) PI_SLP_LASTDEST));
	 PyDict_SetItemString(d,"PI_SLP_SRC", PyInt_FromLong((long) PI_SLP_SRC));
	 PyDict_SetItemString(d,"PI_SLP_LASTSRC", PyInt_FromLong((long) PI_SLP_LASTSRC));
	 PyDict_SetItemString(d,"PI_SLP_TYPE", PyInt_FromLong((long) PI_SLP_TYPE));
	 PyDict_SetItemString(d,"PI_SLP_LASTTYPE", PyInt_FromLong((long) PI_SLP_LASTTYPE));
	 PyDict_SetItemString(d,"PI_SLP_TXID", PyInt_FromLong((long) PI_SLP_TXID));
	 PyDict_SetItemString(d,"PI_SLP_LASTTXID", PyInt_FromLong((long) PI_SLP_LASTTXID));
	 PyDict_SetItemString(d,"PI_PADP_TYPE", PyInt_FromLong((long) PI_PADP_TYPE));
	 PyDict_SetItemString(d,"PI_PADP_LASTTYPE", PyInt_FromLong((long) PI_PADP_LASTTYPE));
	 PyDict_SetItemString(d,"PI_CMP_TYPE", PyInt_FromLong((long) PI_CMP_TYPE));
	 PyDict_SetItemString(d,"PI_CMP_FLAGS", PyInt_FromLong((long) PI_CMP_FLAGS));
	 PyDict_SetItemString(d,"PI_CMP_VERS", PyInt_FromLong((long) PI_CMP_VERS));
	 PyDict_SetItemString(d,"PI_CMP_BAUD", PyInt_FromLong((long) PI_CMP_BAUD));
	 PyDict_SetItemString(d,"PI_NET_TYPE", PyInt_FromLong((long) PI_NET_TYPE));
	 PyDict_SetItemString(d,"PI_SOCK_STATE", PyInt_FromLong((long) PI_SOCK_STATE));
	 PyDict_SetItemString(d,"PI_PilotSocketDLP", PyInt_FromLong((long) 3));
	 PyDict_SetItemString(d,"PI_PilotSocketConsole", PyInt_FromLong((long) 1));
	 PyDict_SetItemString(d,"PI_PilotSocketDebugger", PyInt_FromLong((long) 0));
	 PyDict_SetItemString(d,"PI_PilotSocketRemoteUI", PyInt_FromLong((long) 2));
	 PyDict_SetItemString(d,"dlpDBFlagResource", PyInt_FromLong((long) dlpDBFlagResource));
	 PyDict_SetItemString(d,"dlpDBFlagReadOnly", PyInt_FromLong((long) dlpDBFlagReadOnly));
	 PyDict_SetItemString(d,"dlpDBFlagAppInfoDirty", PyInt_FromLong((long) dlpDBFlagAppInfoDirty));
	 PyDict_SetItemString(d,"dlpDBFlagBackup", PyInt_FromLong((long) dlpDBFlagBackup));
	 PyDict_SetItemString(d,"dlpDBFlagClipping", PyInt_FromLong((long) dlpDBFlagClipping));
	 PyDict_SetItemString(d,"dlpDBFlagOpen", PyInt_FromLong((long) dlpDBFlagOpen));
	 PyDict_SetItemString(d,"dlpDBFlagNewer", PyInt_FromLong((long) dlpDBFlagNewer));
	 PyDict_SetItemString(d,"dlpDBFlagReset", PyInt_FromLong((long) dlpDBFlagReset));
	 PyDict_SetItemString(d,"dlpDBFlagCopyPrevention", PyInt_FromLong((long) dlpDBFlagCopyPrevention));
	 PyDict_SetItemString(d,"dlpDBFlagStream", PyInt_FromLong((long) dlpDBFlagStream));
	 PyDict_SetItemString(d,"dlpDBMiscFlagExcludeFromSync", PyInt_FromLong((long) dlpDBMiscFlagExcludeFromSync));
	 PyDict_SetItemString(d,"dlpRecAttrDeleted", PyInt_FromLong((long) dlpRecAttrDeleted));
	 PyDict_SetItemString(d,"dlpRecAttrDirty", PyInt_FromLong((long) dlpRecAttrDirty));
	 PyDict_SetItemString(d,"dlpRecAttrBusy", PyInt_FromLong((long) dlpRecAttrBusy));
	 PyDict_SetItemString(d,"dlpRecAttrSecret", PyInt_FromLong((long) dlpRecAttrSecret));
	 PyDict_SetItemString(d,"dlpRecAttrArchived", PyInt_FromLong((long) dlpRecAttrArchived));
	 PyDict_SetItemString(d,"dlpOpenRead", PyInt_FromLong((long) dlpOpenRead));
	 PyDict_SetItemString(d,"dlpOpenWrite", PyInt_FromLong((long) dlpOpenWrite));
	 PyDict_SetItemString(d,"dlpOpenExclusive", PyInt_FromLong((long) dlpOpenExclusive));
	 PyDict_SetItemString(d,"dlpOpenSecret", PyInt_FromLong((long) dlpOpenSecret));
	 PyDict_SetItemString(d,"dlpOpenReadWrite", PyInt_FromLong((long) dlpOpenReadWrite));
	 PyDict_SetItemString(d,"dlpEndCodeNormal", PyInt_FromLong((long) dlpEndCodeNormal));
	 PyDict_SetItemString(d,"dlpEndCodeOutOfMemory", PyInt_FromLong((long) dlpEndCodeOutOfMemory));
	 PyDict_SetItemString(d,"dlpEndCodeUserCan", PyInt_FromLong((long) dlpEndCodeUserCan));
	 PyDict_SetItemString(d,"dlpEndCodeOther", PyInt_FromLong((long) dlpEndCodeOther));
	 PyDict_SetItemString(d,"dlpDBListRAM", PyInt_FromLong((long) dlpDBListRAM));
	 PyDict_SetItemString(d,"dlpDBListROM", PyInt_FromLong((long) dlpDBListROM));
	 PyDict_SetItemString(d,"dlpErrNoError", PyInt_FromLong((long) dlpErrNoError));
	 PyDict_SetItemString(d,"dlpErrSystem", PyInt_FromLong((long) dlpErrSystem));
	 PyDict_SetItemString(d,"dlpErrMemory", PyInt_FromLong((long) dlpErrMemory));
	 PyDict_SetItemString(d,"dlpErrParam", PyInt_FromLong((long) dlpErrParam));
	 PyDict_SetItemString(d,"dlpErrNotFound", PyInt_FromLong((long) dlpErrNotFound));
	 PyDict_SetItemString(d,"dlpErrNoneOpen", PyInt_FromLong((long) dlpErrNoneOpen));
	 PyDict_SetItemString(d,"dlpErrAlreadyOpen", PyInt_FromLong((long) dlpErrAlreadyOpen));
	 PyDict_SetItemString(d,"dlpErrTooManyOpen", PyInt_FromLong((long) dlpErrTooManyOpen));
	 PyDict_SetItemString(d,"dlpErrExists", PyInt_FromLong((long) dlpErrExists));
	 PyDict_SetItemString(d,"dlpErrOpen", PyInt_FromLong((long) dlpErrOpen));
	 PyDict_SetItemString(d,"dlpErrDeleted", PyInt_FromLong((long) dlpErrDeleted));
	 PyDict_SetItemString(d,"dlpErrBusy", PyInt_FromLong((long) dlpErrBusy));
	 PyDict_SetItemString(d,"dlpErrNotSupp", PyInt_FromLong((long) dlpErrNotSupp));
	 PyDict_SetItemString(d,"dlpErrUnused1", PyInt_FromLong((long) dlpErrUnused1));
	 PyDict_SetItemString(d,"dlpErrReadOnly", PyInt_FromLong((long) dlpErrReadOnly));
	 PyDict_SetItemString(d,"dlpErrSpace", PyInt_FromLong((long) dlpErrSpace));
	 PyDict_SetItemString(d,"dlpErrLimit", PyInt_FromLong((long) dlpErrLimit));
	 PyDict_SetItemString(d,"dlpErrSync", PyInt_FromLong((long) dlpErrSync));
	 PyDict_SetItemString(d,"dlpErrWrapper", PyInt_FromLong((long) dlpErrWrapper));
	 PyDict_SetItemString(d,"dlpErrArgument", PyInt_FromLong((long) dlpErrArgument));
	 PyDict_SetItemString(d,"dlpErrSize", PyInt_FromLong((long) dlpErrSize));
	 PyDict_SetItemString(d,"dlpErrUnknown", PyInt_FromLong((long) dlpErrUnknown));
	 PyDict_SetItemString(d,"cvar", SWIG_globals);
	 SWIG_addvarlink(SWIG_globals,"dlp_errorlist",_wrap_dlp_errorlist_get, _wrap_dlp_errorlist_set);
{
   int i;
   for (i = 0; _swig_mapping[i].n1; i++)
        SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
}
}
