scsh-0.6/scsh/flock.c

70 lines
2.0 KiB
C

/* This is an Scheme48/C interface file,
** automatically generated by a hacked version of cig 3.0.
step 4
*/
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
extern int errno;
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "flock1.h"
#define errno_or_false(x) (((x) == -1) ? s48_enter_fixnum(errno) : S48_FALSE)
s48_value df_set_lock(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5, s48_value g6)
{
extern int set_lock(int , int , int , int , int , int );
s48_value ret1;
S48_DECLARE_GC_PROTECT(1);
int r1;
S48_GC_PROTECT_1(ret1);
r1 = set_lock(s48_extract_integer(g1), s48_extract_integer(g2), s48_extract_integer(g3), s48_extract_integer(g4), s48_extract_integer(g5), s48_extract_integer(g6));
ret1 = errno_or_false(r1);
S48_GC_UNPROTECT();
return ret1;
}
s48_value df_get_lock(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5, s48_value g6, s48_value mv_vec)
{
extern int get_lock(int , int , int , int , int , int , int *, int *, int *, int *, int *);
s48_value ret1;
S48_DECLARE_GC_PROTECT(2);
int r1;
int r2;
int r3;
int r4;
int r5;
int r6;
S48_GC_PROTECT_2(mv_vec,ret1);
r1 = get_lock(s48_extract_integer(g1), s48_extract_integer(g2), s48_extract_integer(g3), s48_extract_integer(g4), s48_extract_integer(g5), s48_extract_integer(g6), &r2, &r3, &r4, &r5, &r6);
ret1 = errno_or_false(r1);
S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r2));
S48_VECTOR_SET(mv_vec,1,s48_enter_integer(r3));
S48_VECTOR_SET(mv_vec,2,s48_enter_integer(r4));
S48_VECTOR_SET(mv_vec,3,s48_enter_integer(r5));
S48_VECTOR_SET(mv_vec,4,s48_enter_integer(r6));
S48_GC_UNPROTECT();
return ret1;
}
s48_value s48_init_flock(void)
{
S48_EXPORT_FUNCTION(df_set_lock);
S48_EXPORT_FUNCTION(df_get_lock);
return S48_UNSPECIFIC;
}