/* This is an Scheme48/C interface file, 
** automatically generated by cig.
*/

#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"

/* Make sure foreign-function stubs interface to the C funs correctly: */
#include <sys/types.h>
#include "../regexp/regex.h"
#include "re1.h"

scheme_value df_compile_re(long nargs, scheme_value *args)
{
    extern int compile_re(scheme_value , int , regex_t* *);
    scheme_value ret1;
    int r1;
    regex_t* r2;

    cig_check_nargs(3, nargs, "compile_re");
    r1 = compile_re(args[2], EXTRACT_BOOLEAN(args[1]), &r2);
    ret1 = ENTER_FIXNUM(r1);
    AlienVal(VECTOR_REF(*args,0)) = (long) r2;
    return ret1;
    }

scheme_value df_re_search(long nargs, scheme_value *args)
{
    extern scheme_value re_search(const regex_t *, scheme_value , int , scheme_value , int , scheme_value , scheme_value );
    scheme_value ret1;
    scheme_value r1;

    cig_check_nargs(7, nargs, "re_search");
    r1 = re_search((const regex_t *)AlienVal(args[6]), args[5], EXTRACT_FIXNUM(args[4]), args[3], EXTRACT_FIXNUM(args[2]), args[1], args[0]);
    ret1 = r1;
    return ret1;
    }

scheme_value df_re_errint2str(long nargs, scheme_value *args)
{
    extern const char *re_errint2str(int , const regex_t *);
    scheme_value ret1;
    const char *r1;

    cig_check_nargs(3, nargs, "re_errint2str");
    r1 = re_errint2str(EXTRACT_FIXNUM(args[2]), (const regex_t *)AlienVal(args[1]));
    ret1 = VECTOR_REF(*args,0);
    {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);}
    return ret1;
    }

scheme_value df_free_re(long nargs, scheme_value *args)
{
    extern void free_re(regex_t* );

    cig_check_nargs(1, nargs, "free_re");
    free_re((regex_t* )AlienVal(args[0]));
    return SCHFALSE;
    }

