scsh-0.5/scsh/dbm.c

185 lines
5.5 KiB
C
Raw Permalink Normal View History

1995-10-13 23:34:21 -04:00
/* This is an Scheme48/C interface file,
** automatically generated by cig.
*/
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
#include <sys/types.h>
#include <limits.h>
#include <ndbm.h>
#include <db.h>
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
scheme_value df_db_check(long nargs, scheme_value *args)
{
extern int db_check(void);
scheme_value ret1;
int r1;
cig_check_nargs(0, nargs, "db_check");
r1 = db_check();
ret1 = ENTER_BOOLEAN(r1);
return ret1;
}
scheme_value df_db_open_default(long nargs, scheme_value *args)
{
extern int db_open_default(const char *, int , int , DB** *);
scheme_value ret1;
int r1;
DB** r2;
cig_check_nargs(4, nargs, "db_open_default");
r1 = db_open_default(cig_string_body(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
scheme_value df_db_open_btree(long nargs, scheme_value *args)
{
extern int db_open_btree(const char *, int , int , int , int , int , int , int , int , int , DB** *);
scheme_value ret1;
int r1;
DB** r2;
cig_check_nargs(11, nargs, "db_open_btree");
r1 = db_open_btree(cig_string_body(args[10]), EXTRACT_FIXNUM(args[9]), EXTRACT_FIXNUM(args[8]), EXTRACT_FIXNUM(args[7]), EXTRACT_FIXNUM(args[6]), EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
scheme_value df_db_open_hash(long nargs, scheme_value *args)
{
extern int db_open_hash(const char *, int , int , int , int , int , int , int , int , DB** *);
scheme_value ret1;
int r1;
DB** r2;
cig_check_nargs(10, nargs, "db_open_hash");
r1 = db_open_hash(cig_string_body(args[9]), EXTRACT_FIXNUM(args[8]), EXTRACT_FIXNUM(args[7]), EXTRACT_FIXNUM(args[6]), EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
scheme_value df_db_open_recno(long nargs, scheme_value *args)
{
extern int db_open_recno(const char *, int , int , int , int , int , int , int , int , char , const char *, DB** *);
scheme_value ret1;
int r1;
DB** r2;
cig_check_nargs(12, nargs, "db_open_recno");
r1 = db_open_recno(cig_string_body(args[11]), EXTRACT_FIXNUM(args[10]), EXTRACT_FIXNUM(args[9]), EXTRACT_FIXNUM(args[8]), EXTRACT_FIXNUM(args[7]), EXTRACT_FIXNUM(args[6]), EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), EXTRACT_CHAR(args[2]), cig_string_body(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
scheme_value df_dbm_close(long nargs, scheme_value *args)
{
extern int dbm_close(DBM* );
scheme_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_close");
r1 = dbm_close((DBM* )AlienVal(args[0]));
ret1 = ENTER_FIXNUM(r1);
return ret1;
}
scheme_value df_dbm_error(long nargs, scheme_value *args)
{
extern int dbm_error(DBM* );
scheme_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_error");
r1 = dbm_error((DBM* )AlienVal(args[0]));
ret1 = ENTER_FIXNUM(r1);
return ret1;
}
scheme_value df_dbm_clearerr(long nargs, scheme_value *args)
{
extern int dbm_clearerr(DBM* );
scheme_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_clearerr");
r1 = dbm_clearerr((DBM* )AlienVal(args[0]));
ret1 = ENTER_FIXNUM(r1);
return ret1;
}
scheme_value df_database_delete(long nargs, scheme_value *args)
{
extern int database_delete(DBM* , scheme_value );
scheme_value ret1;
int r1;
cig_check_nargs(2, nargs, "database_delete");
r1 = database_delete((DBM* )AlienVal(args[1]), args[0]);
ret1 = ENTER_FIXNUM(r1);
return ret1;
}
scheme_value df_database_fetch(long nargs, scheme_value *args)
{
extern const char *database_fetch(DBM* , scheme_value );
scheme_value ret1;
const char *r1;
cig_check_nargs(3, nargs, "database_fetch");
r1 = database_fetch((DBM* )AlienVal(args[2]), args[1]);
ret1 = VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}
scheme_value df_database_store(long nargs, scheme_value *args)
{
extern int database_store(DBM* , scheme_value , scheme_value , int );
scheme_value ret1;
int r1;
cig_check_nargs(4, nargs, "database_store");
r1 = database_store((DBM* )AlienVal(args[3]), args[2], args[1], EXTRACT_FIXNUM(args[0]));
ret1 = ENTER_FIXNUM(r1);
return ret1;
}
scheme_value df_database_first(long nargs, scheme_value *args)
{
extern const char *database_first(DBM* );
scheme_value ret1;
const char *r1;
cig_check_nargs(2, nargs, "database_first");
r1 = database_first((DBM* )AlienVal(args[1]));
ret1 = VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}
scheme_value df_database_next(long nargs, scheme_value *args)
{
extern const char *database_next(DBM* );
scheme_value ret1;
const char *r1;
cig_check_nargs(2, nargs, "database_next");
r1 = database_next((DBM* )AlienVal(args[1]));
ret1 = VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}