diff --git a/scsh/re.c b/scsh/re.c index 6bc0661..c32166a 100644 --- a/scsh/re.c +++ b/scsh/re.c @@ -9,21 +9,94 @@ /* Make sure foreign-function stubs interface to the C funs correctly: */ #include "re1.h" -scheme_value df_reg_match(long nargs, scheme_value *args) +scheme_value df_re_byte_len(long nargs, scheme_value *args) { - extern char *reg_match(const char *, const char *, int , scheme_value , scheme_value , int *); + extern char *re_byte_len(const char *, int *); scheme_value ret1; char *r1; int r2; - cig_check_nargs(6, nargs, "reg_match"); - r1 = reg_match(cig_string_body(args[5]), cig_string_body(args[4]), EXTRACT_FIXNUM(args[3]), args[2], args[1], &r2); + cig_check_nargs(2, nargs, "re_byte_len"); + r1 = re_byte_len(cig_string_body(args[1]), &r2); + ret1 = VECTOR_REF(*args,0); + {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} + VECTOR_REF(*args,1) = ENTER_FIXNUM(r2); + return ret1; + } + +scheme_value df_re_compile(long nargs, scheme_value *args) +{ + extern char *re_compile(const char *, scheme_value ); + scheme_value ret1; + char *r1; + + cig_check_nargs(3, nargs, "re_compile"); + r1 = re_compile(cig_string_body(args[2]), args[1]); + ret1 = VECTOR_REF(*args,0); + {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} + return ret1; + } + +scheme_value df_re_exec(long nargs, scheme_value *args) +{ + extern char *re_exec(scheme_value , const char *, int , scheme_value , scheme_value , int *); + scheme_value ret1; + char *r1; + int r2; + + cig_check_nargs(6, nargs, "re_exec"); + r1 = re_exec(args[5], cig_string_body(args[4]), EXTRACT_FIXNUM(args[3]), args[2], args[1], &r2); ret1 = VECTOR_REF(*args,0); {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} VECTOR_REF(*args,1) = ENTER_BOOLEAN(r2); return ret1; } +scheme_value df_re_match(long nargs, scheme_value *args) +{ + extern char *re_match(const char *, const char *, int , scheme_value , scheme_value , int *); + scheme_value ret1; + char *r1; + int r2; + + cig_check_nargs(6, nargs, "re_match"); + r1 = re_match(cig_string_body(args[5]), cig_string_body(args[4]), EXTRACT_FIXNUM(args[3]), args[2], args[1], &r2); + ret1 = VECTOR_REF(*args,0); + {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} + VECTOR_REF(*args,1) = ENTER_BOOLEAN(r2); + return ret1; + } + +scheme_value df_re_subst(long nargs, scheme_value *args) +{ + extern char *re_subst(scheme_value , const char *, const char *, int , scheme_value , scheme_value , scheme_value , int *); + scheme_value ret1; + char *r1; + int r2; + + cig_check_nargs(8, nargs, "re_subst"); + r1 = re_subst(args[7], cig_string_body(args[6]), cig_string_body(args[5]), EXTRACT_FIXNUM(args[4]), args[3], args[2], args[1], &r2); + ret1 = VECTOR_REF(*args,0); + {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} + VECTOR_REF(*args,1) = ENTER_FIXNUM(r2); + return ret1; + } + +scheme_value df_re_subst_len(long nargs, scheme_value *args) +{ + extern char *re_subst_len(scheme_value , const char *, const char *, int , scheme_value , scheme_value , int *); + scheme_value ret1; + char *r1; + int r2; + + cig_check_nargs(7, nargs, "re_subst_len"); + r1 = re_subst_len(args[6], cig_string_body(args[5]), cig_string_body(args[4]), EXTRACT_FIXNUM(args[3]), args[2], args[1], &r2); + ret1 = VECTOR_REF(*args,0); + {AlienVal(CAR(ret1)) = (long) r1; CDR(ret1) = strlen_or_false(r1);} + VECTOR_REF(*args,1) = ENTER_FIXNUM(r2); + return ret1; + } + scheme_value df_filter_stringvec(long nargs, scheme_value *args) { extern char *filter_stringvec(const char *, char const ** , int *); diff --git a/scsh/sighandlers.c b/scsh/sighandlers.c index 8b2bf35..3724f22 100644 --- a/scsh/sighandlers.c +++ b/scsh/sighandlers.c @@ -11,31 +11,15 @@ extern int errno; /* Make sure foreign-function stubs interface to the C funs correctly: */ #include "sighandlers1.h" -scheme_value df_set_procmask(long nargs, scheme_value *args) +scheme_value df_sig2interrupt(long nargs, scheme_value *args) { - extern int set_procmask(int , int , int *); + extern int sig2interrupt(int ); scheme_value ret1; int r1; - int r2; - cig_check_nargs(3, nargs, "set_procmask"); - r1 = set_procmask(EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), &r2); + cig_check_nargs(1, nargs, "sig2interrupt"); + r1 = sig2interrupt(EXTRACT_FIXNUM(args[0])); ret1 = ENTER_FIXNUM(r1); - VECTOR_REF(*args,0) = ENTER_FIXNUM(r2); - return ret1; - } - -scheme_value df_get_procmask(long nargs, scheme_value *args) -{ - extern int get_procmask(int *); - scheme_value ret1; - int r1; - int r2; - - cig_check_nargs(1, nargs, "get_procmask"); - r1 = get_procmask(&r2); - ret1 = ENTER_FIXNUM(r1); - VECTOR_REF(*args,0) = ENTER_FIXNUM(r2); return ret1; } @@ -48,44 +32,56 @@ scheme_value df_do_default_sigaction(long nargs, scheme_value *args) return SCHFALSE; } -scheme_value df_set_sig_handler(long nargs, scheme_value *args) +scheme_value df_scsh_set_sig(long nargs, scheme_value *args) { - extern scheme_value set_sig_handler(int , scheme_value , int , scheme_value *, int *); + extern scheme_value scsh_set_sig(int , int , int , int *, int *); scheme_value ret1; scheme_value r1; - scheme_value r2; + int r2; int r3; - cig_check_nargs(4, nargs, "set_sig_handler"); - r1 = set_sig_handler(EXTRACT_FIXNUM(args[3]), args[2], EXTRACT_FIXNUM(args[1]), &r2, &r3); + cig_check_nargs(4, nargs, "scsh_set_sig"); + r1 = scsh_set_sig(EXTRACT_FIXNUM(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), &r2, &r3); ret1 = r1; - VECTOR_REF(*args,0) = r2; + VECTOR_REF(*args,0) = ENTER_FIXNUM(r2); VECTOR_REF(*args,1) = ENTER_FIXNUM(r3); return ret1; } -scheme_value df_get_sig_handler(long nargs, scheme_value *args) +scheme_value df_scsh_get_sig(long nargs, scheme_value *args) { - extern scheme_value get_sig_handler(int , scheme_value *, int *); + extern scheme_value scsh_get_sig(int , int *, int *); scheme_value ret1; scheme_value r1; - scheme_value r2; + int r2; int r3; - cig_check_nargs(2, nargs, "get_sig_handler"); - r1 = get_sig_handler(EXTRACT_FIXNUM(args[1]), &r2, &r3); + cig_check_nargs(2, nargs, "scsh_get_sig"); + r1 = scsh_get_sig(EXTRACT_FIXNUM(args[1]), &r2, &r3); ret1 = r1; - VECTOR_REF(*args,0) = r2; + VECTOR_REF(*args,0) = ENTER_FIXNUM(r2); VECTOR_REF(*args,1) = ENTER_FIXNUM(r3); return ret1; } -scheme_value df_install_new_handler_vector(long nargs, scheme_value *args) +scheme_value df_install_scsh_handlers(long nargs, scheme_value *args) { - extern void install_new_handler_vector(scheme_value ); + extern void install_scsh_handlers(void); - cig_check_nargs(1, nargs, "install_new_handler_vector"); - install_new_handler_vector(args[0]); + cig_check_nargs(0, nargs, "install_scsh_handlers"); + install_scsh_handlers(); return SCHFALSE; } +scheme_value df_get_int_handlers(long nargs, scheme_value *args) +{ + extern scheme_value get_int_handlers(void); + scheme_value ret1; + scheme_value r1; + + cig_check_nargs(0, nargs, "get_int_handlers"); + r1 = get_int_handlers(); + ret1 = r1; + return ret1; + } + diff --git a/scsh/syscalls.c b/scsh/syscalls.c index 48625f7..be4c11e 100644 --- a/scsh/syscalls.c +++ b/scsh/syscalls.c @@ -1031,6 +1031,18 @@ scheme_value df_set_fdbuf(long nargs, scheme_value *args) return ret1; } +scheme_value df_set_cloexec(long nargs, scheme_value *args) +{ + extern int set_cloexec(int , int ); + scheme_value ret1; + int r1; + + cig_check_nargs(2, nargs, "set_cloexec"); + r1 = set_cloexec(EXTRACT_FIXNUM(args[1]), EXTRACT_BOOLEAN(args[0])); + ret1 = errno_or_false(r1); + return ret1; + } + scheme_value df_init_fdports(long nargs, scheme_value *args) { extern void init_fdports(void); @@ -1040,26 +1052,14 @@ scheme_value df_init_fdports(long nargs, scheme_value *args) return SCHFALSE; } -scheme_value df_cloexec_unrevealed(long nargs, scheme_value *args) -{ - extern scheme_value cloexec_unrevealed(void); - scheme_value ret1; - scheme_value r1; - - cig_check_nargs(0, nargs, "cloexec_unrevealed"); - r1 = cloexec_unrevealed(); - ret1 = r1; - return ret1; - } - scheme_value df_install_port(long nargs, scheme_value *args) { - extern int install_port(int , scheme_value ); + extern int install_port(int , scheme_value , int ); scheme_value ret1; int r1; - cig_check_nargs(2, nargs, "install_port"); - r1 = install_port(EXTRACT_FIXNUM(args[1]), args[0]); + cig_check_nargs(3, nargs, "install_port"); + r1 = install_port(EXTRACT_FIXNUM(args[2]), args[1], EXTRACT_FIXNUM(args[0])); ret1 = False_on_zero(r1); return ret1; }