scsh-0.6/scsh/dbm.c

185 lines
5.5 KiB
C

/* 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) ? s48_enter_integer(errno) : S48_FALSE)
s48_value df_db_check(long nargs, s48_value *args)
{
extern int db_check(void);
s48_value ret1;
int r1;
cig_check_nargs(0, nargs, "db_check");
r1 = db_check();
ret1 = ENTER_BOOLEAN(r1);
return ret1;
}
s48_value df_db_open_default(long nargs, s48_value *args)
{
extern int db_open_default(const char *, int , int , DB** *);
s48_value ret1;
int r1;
DB** r2;
cig_check_nargs(4, nargs, "db_open_default");
r1 = db_open_default(cig_string_body(args[3]), s48_extract_fixnum(args[2]), s48_extract_fixnum(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
s48_value df_db_open_btree(long nargs, s48_value *args)
{
extern int db_open_btree(const char *, int , int , int , int , int , int , int , int , int , DB** *);
s48_value ret1;
int r1;
DB** r2;
cig_check_nargs(11, nargs, "db_open_btree");
r1 = db_open_btree(cig_string_body(args[10]), s48_extract_fixnum(args[9]), s48_extract_fixnum(args[8]), s48_extract_fixnum(args[7]), s48_extract_fixnum(args[6]), s48_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;
}
s48_value df_db_open_hash(long nargs, s48_value *args)
{
extern int db_open_hash(const char *, int , int , int , int , int , int , int , int , DB** *);
s48_value ret1;
int r1;
DB** r2;
cig_check_nargs(10, nargs, "db_open_hash");
r1 = db_open_hash(cig_string_body(args[9]), s48_extract_fixnum(args[8]), s48_extract_fixnum(args[7]), s48_extract_fixnum(args[6]), s48_extract_fixnum(args[5]), s48_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;
}
s48_value df_db_open_recno(long nargs, s48_value *args)
{
extern int db_open_recno(const char *, int , int , int , int , int , int , int , int , char , const char *, DB** *);
s48_value ret1;
int r1;
DB** r2;
cig_check_nargs(12, nargs, "db_open_recno");
r1 = db_open_recno(cig_string_body(args[11]), s48_extract_fixnum(args[10]), s48_extract_fixnum(args[9]), s48_extract_fixnum(args[8]), s48_extract_fixnum(args[7]), s48_extract_fixnum(args[6]), EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), s48_extract_char(args[2]), cig_string_body(args[1]), &r2);
ret1 = errno_or_false(r1);
AlienVal(VECTOR_REF(*args,0)) = (long) r2;
return ret1;
}
s48_value df_dbm_close(long nargs, s48_value *args)
{
extern int dbm_close(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_close");
r1 = dbm_close((DBM* )AlienVal(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_dbm_error(long nargs, s48_value *args)
{
extern int dbm_error(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_error");
r1 = dbm_error((DBM* )AlienVal(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_dbm_clearerr(long nargs, s48_value *args)
{
extern int dbm_clearerr(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "dbm_clearerr");
r1 = dbm_clearerr((DBM* )AlienVal(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_database_delete(long nargs, s48_value *args)
{
extern int database_delete(DBM* , s48_value );
s48_value ret1;
int r1;
cig_check_nargs(2, nargs, "database_delete");
r1 = database_delete((DBM* )AlienVal(args[1]), args[0]);
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_database_fetch(long nargs, s48_value *args)
{
extern const char *database_fetch(DBM* , s48_value );
s48_value ret1;
const char *r1;
cig_check_nargs(3, nargs, "database_fetch");
r1 = database_fetch((DBM* )AlienVal(args[2]), args[1]);
ret1 = S48_VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}
s48_value df_database_store(long nargs, s48_value *args)
{
extern int database_store(DBM* , s48_value , s48_value , int );
s48_value ret1;
int r1;
cig_check_nargs(4, nargs, "database_store");
r1 = database_store((DBM* )AlienVal(args[3]), args[2], args[1], s48_extract_fixnum(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_database_first(long nargs, s48_value *args)
{
extern const char *database_first(DBM* );
s48_value ret1;
const char *r1;
cig_check_nargs(2, nargs, "database_first");
r1 = database_first((DBM* )AlienVal(args[1]));
ret1 = S48_VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}
s48_value df_database_next(long nargs, s48_value *args)
{
extern const char *database_next(DBM* );
s48_value ret1;
const char *r1;
cig_check_nargs(2, nargs, "database_next");
r1 = database_next((DBM* )AlienVal(args[1]));
ret1 = S48_VECTOR_REF(*args,0);
{AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
return ret1;
}