scsh-0.6/scsh/ndbm.c

132 lines
3.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 <ndbm.h>
extern int errno;
#define errno_or_false(x) (((x) == -1) ? s48_enter_integer(errno) : S48_FALSE)
/* stub used to return FALSE when scheme checks for Berkeley dbm */
int db_check()
return 1;
s48_value df_database_open(long nargs, s48_value *args)
{
extern int database_open(const char *, int , int , DBM** *);
s48_value ret1;
int r1;
DBM** r2;
cig_check_nargs(4, nargs, "database_open");
r1 = database_open(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_database_close(long nargs, s48_value *args)
{
extern int database_close(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "database_close");
r1 = database_close((DBM* )AlienVal(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_database_error(long nargs, s48_value *args)
{
extern int database_error(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "database_error");
r1 = database_error((DBM* )AlienVal(args[0]));
ret1 = s48_enter_fixnum(r1);
return ret1;
}
s48_value df_database_clearerr(long nargs, s48_value *args)
{
extern int database_clearerr(DBM* );
s48_value ret1;
int r1;
cig_check_nargs(1, nargs, "database_clearerr");
r1 = database_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* , const char *);
s48_value ret1;
int r1;
cig_check_nargs(2, nargs, "database_delete");
r1 = database_delete((DBM* )AlienVal(args[1]), cig_string_body(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* , const char *);
s48_value ret1;
const char *r1;
cig_check_nargs(3, nargs, "database_fetch");
r1 = database_fetch((DBM* )AlienVal(args[2]), cig_string_body(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* , const char *, const char *, int );
s48_value ret1;
int r1;
cig_check_nargs(4, nargs, "database_store");
r1 = database_store((DBM* )AlienVal(args[3]), cig_string_body(args[2]), cig_string_body(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;
}