/* 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 <unistd.h>
#include <errno.h>
#include <fcntl.h>

/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "flock1.h"

#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)

scheme_value df_set_lock(long nargs, scheme_value *args)
{
    extern int set_lock(int , int , int , int , int , int );
    scheme_value ret1;
    int r1;

    cig_check_nargs(6, nargs, "set_lock");
    r1 = set_lock(EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), EXTRACT_FIXNUM(args[0]));
    ret1 = errno_or_false(r1);
    return ret1;
    }

scheme_value df_get_lock(long nargs, scheme_value *args)
{
    extern int get_lock(int , int , int , int , int , int , int *, int *, int *, int *, int *);
    scheme_value ret1;
    int r1;
    int r2;
    int r3;
    int r4;
    int r5;
    int r6;

    cig_check_nargs(7, nargs, "get_lock");
    r1 = get_lock(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, &r3, &r4, &r5, &r6);
    ret1 = errno_or_false(r1);
    VECTOR_REF(*args,0) = ENTER_FIXNUM(r2);
    VECTOR_REF(*args,1) = ENTER_FIXNUM(r3);
    VECTOR_REF(*args,2) = ENTER_FIXNUM(r4);
    VECTOR_REF(*args,3) = ENTER_FIXNUM(r5);
    VECTOR_REF(*args,4) = ENTER_FIXNUM(r6);
    return ret1;
    }

