scsh-0.6/scsh/rx/re-low.c

72 lines
1.9 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"
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include <sys/types.h>
#include "../regexp/regex.h"
#include "re1.h"
s48_value df_compile_re(s48_value g1, s48_value g2, s48_value mv_vec)
{
extern int compile_re(s48_value , int , regex_t* *);
s48_value ret1;
int r1;
regex_t* r2;
r1 = compile_re(g1, EXTRACT_BOOLEAN(g2), &r2);
ret1 = s48_enter_integer(r1);
SetAlienVal(S48_VECTOR_REF(mv_vec,0),(long) r2);//simple-assign
return ret1;
}
s48_value df_re_search(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5, s48_value g6, s48_value g7)
{
extern s48_value re_search(const regex_t *, s48_value , int , s48_value , int , s48_value , s48_value );
s48_value ret1;
s48_value r1;
r1 = re_search((const regex_t *)AlienVal(g1), g2, s48_extract_integer(g3), g4, s48_extract_integer(g5), g6, g7);
ret1 = r1;
return ret1;
}
s48_value df_re_errint2str(s48_value g1, s48_value g2, s48_value mv_vec)
{
extern const char *re_errint2str(int , const regex_t *);
s48_value ret1;
const char *r1;
r1 = re_errint2str(s48_extract_integer(g1), (const regex_t *)AlienVal(g2));
ret1 = S48_VECTOR_REF(mv_vec,0);
SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len
return ret1;
}
s48_value df_free_re(s48_value g1)
{
extern void free_re(regex_t* );
free_re((regex_t* )AlienVal(g1));
return S48_FALSE;
}
s48_value s48_init_re_low(void)
{
S48_EXPORT_FUNCTION(df_compile_re);
S48_EXPORT_FUNCTION(df_re_search);
S48_EXPORT_FUNCTION(df_re_errint2str);
S48_EXPORT_FUNCTION(df_free_re);
return S48_UNSPECIFIC;
}