diff --git a/scsh/flock.c b/scsh/flock.c index 2d2b078..64d15ba 100644 --- a/scsh/flock.c +++ b/scsh/flock.c @@ -22,11 +22,15 @@ s48_value df_set_lock(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s4 { extern int set_lock(int , int , int , int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; - r1 = set_lock(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5), s48_extract_fixnum(g6)); + + 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; } @@ -34,6 +38,7 @@ s48_value df_get_lock(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s4 { 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; @@ -42,13 +47,16 @@ s48_value df_get_lock(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s4 int r6; - r1 = get_lock(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5), s48_extract_fixnum(g6), &r2, &r3, &r4, &r5, &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_fixnum(r2)); - S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); - S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); - S48_VECTOR_SET(mv_vec,3,s48_enter_fixnum(r5)); - S48_VECTOR_SET(mv_vec,4,s48_enter_fixnum(r6)); + 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; } diff --git a/scsh/network.c b/scsh/network.c index d79fee5..e0fe548 100644 --- a/scsh/network.c +++ b/scsh/network.c @@ -23,12 +23,16 @@ s48_value df_socket(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec) { extern int socket(int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = socket(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -36,11 +40,15 @@ s48_value df_scheme_bind(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_bind(int , int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_bind(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -48,11 +56,15 @@ s48_value df_scheme_connect(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_connect(int , int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_connect(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -60,11 +72,15 @@ s48_value df_listen(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = listen(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -72,12 +88,16 @@ s48_value df_scheme_accept(s48_value g1, s48_value g2, s48_value g3, s48_value m { extern int scheme_accept(int , int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_accept(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -85,11 +105,15 @@ s48_value df_scheme_peer_name(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_peer_name(int , int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_peer_name(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -97,11 +121,15 @@ s48_value df_scheme_socket_name(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_socket_name(int , int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_socket_name(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3); ret1 = False_on_zero(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -109,11 +137,15 @@ s48_value df_shutdown(s48_value g1, s48_value g2) { extern int shutdown(int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = shutdown(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -121,41 +153,53 @@ s48_value df_scheme_socket_pair(s48_value g1, s48_value mv_vec) { extern int scheme_socket_pair(int , int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; int r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_socket_pair(s48_extract_fixnum(g1), &r2, &r3); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); + S48_GC_UNPROTECT(); return ret1; } s48_value df_recv_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5, s48_value g6, s48_value mv_vec) { - extern int recv_substring(int , int , s48_value , int , int , s48_value ); + extern ssize_t recv_substring(int , int , s48_value , size_t , size_t , s48_value ); s48_value ret1; - int r1; + S48_DECLARE_GC_PROTECT(2); + ssize_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = recv_substring(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3, s48_extract_fixnum(g4), s48_extract_fixnum(g5), g6); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } s48_value df_send_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5, s48_value g6, s48_value g7, s48_value mv_vec) { - extern int send_substring(int , int , s48_value , int , int , int , s48_value ); + extern ssize_t send_substring(int , int , s48_value , size_t , size_t , int , s48_value ); s48_value ret1; - int r1; + S48_DECLARE_GC_PROTECT(2); + ssize_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = send_substring(s48_extract_fixnum(g1), s48_extract_fixnum(g2), g3, s48_extract_fixnum(g4), s48_extract_fixnum(g5), s48_extract_fixnum(g6), g7); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -163,12 +207,16 @@ s48_value df_scheme_getsockopt(s48_value g1, s48_value g2, s48_value g3, s48_val { extern int scheme_getsockopt(int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_getsockopt(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -176,14 +224,18 @@ s48_value df_scheme_getsockopt_linger(s48_value g1, s48_value g2, s48_value g3, { extern int scheme_getsockopt_linger(int , int , int , int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_getsockopt_linger(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), &r2); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -191,14 +243,18 @@ s48_value df_scheme_getsockopt_timeout(s48_value g1, s48_value g2, s48_value g3, { extern int scheme_getsockopt_timeout(int , int , int , int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_getsockopt_timeout(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), &r2); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -206,11 +262,15 @@ s48_value df_scheme_setsockopt(s48_value g1, s48_value g2, s48_value g3, s48_val { extern int scheme_setsockopt(int , int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_setsockopt(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -218,11 +278,15 @@ s48_value df_scheme_setsockopt_linger(s48_value g1, s48_value g2, s48_value g3, { extern int scheme_setsockopt_linger(int , int , int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_setsockopt_linger(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -230,11 +294,15 @@ s48_value df_scheme_setsockopt_timeout(s48_value g1, s48_value g2, s48_value g3, { extern int scheme_setsockopt_timeout(int , int , int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_setsockopt_timeout(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -242,17 +310,21 @@ s48_value df_scheme_host_address2host_info(s48_value g1, s48_value mv_vec) { extern int scheme_host_address2host_info(s48_value , char **, char** *, char** *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; char** r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_host_address2host_info(g1, &r2, &r3, &r4); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign SetAlienVal(S48_VECTOR_REF(mv_vec,2),(long) r4);//simple-assign + S48_GC_UNPROTECT(); return ret1; } @@ -260,17 +332,21 @@ s48_value df_scheme_host_name2host_info(s48_value g1, s48_value mv_vec) { extern int scheme_host_name2host_info(const char *, char **, char** *, char** *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; char** r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_host_name2host_info(s48_extract_string(g1), &r2, &r3, &r4); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign SetAlienVal(S48_VECTOR_REF(mv_vec,2),(long) r4);//simple-assign + S48_GC_UNPROTECT(); return ret1; } @@ -278,15 +354,19 @@ s48_value df_scheme_net_address2net_info(s48_value g1, s48_value g2, s48_value m { extern int scheme_net_address2net_info(s48_value , s48_value , char **, char** *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_net_address2net_info(g1, g2, &r2, &r3); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign + S48_GC_UNPROTECT(); return ret1; } @@ -294,15 +374,19 @@ s48_value df_scheme_net_name2net_info(s48_value g1, s48_value g2, s48_value mv_v { extern int scheme_net_name2net_info(const char *, s48_value , char **, char** *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_net_name2net_info(s48_extract_string(g1), g2, &r2, &r3); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign + S48_GC_UNPROTECT(); return ret1; } @@ -310,6 +394,7 @@ s48_value df_scheme_serv_port2serv_info(s48_value g1, s48_value g2, s48_value mv { extern int scheme_serv_port2serv_info(int , const char *, char **, char** *, int *, char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; @@ -317,12 +402,15 @@ s48_value df_scheme_serv_port2serv_info(s48_value g1, s48_value g2, s48_value mv char *r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_serv_port2serv_info(s48_extract_fixnum(g1), s48_extract_string(g2), &r2, &r3, &r4, &r5); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -330,6 +418,7 @@ s48_value df_scheme_serv_name2serv_info(s48_value g1, s48_value g2, s48_value mv { extern int scheme_serv_name2serv_info(const char *, const char *, char **, char** *, int *, char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; @@ -337,12 +426,15 @@ s48_value df_scheme_serv_name2serv_info(s48_value g1, s48_value g2, s48_value mv char *r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_serv_name2serv_info(s48_extract_string(g1), s48_extract_string(g2), &r2, &r3, &r4, &r5); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -350,17 +442,21 @@ s48_value df_scheme_proto_num2proto_info(s48_value g1, s48_value mv_vec) { extern int scheme_proto_num2proto_info(int , char **, char** *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_proto_num2proto_info(s48_extract_fixnum(g1), &r2, &r3, &r4); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } @@ -368,17 +464,21 @@ s48_value df_scheme_proto_name2proto_info(s48_value g1, s48_value mv_vec) { extern int scheme_proto_name2proto_info(const char *, char **, char** *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_proto_name2proto_info(s48_extract_string(g1), &r2, &r3, &r4); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } @@ -386,11 +486,15 @@ s48_value df_veclen(s48_value g1) { extern s48_value veclen(const long * ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); s48_value r1; + + S48_GC_PROTECT_1(ret1); r1 = veclen((const long * )AlienVal(g1)); ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } diff --git a/scsh/rdelim.c b/scsh/rdelim.c index 421aecd..d3d7424 100644 --- a/scsh/rdelim.c +++ b/scsh/rdelim.c @@ -16,13 +16,17 @@ s48_value df_read_delim(s48_value g1, s48_value g2, s48_value g3, s48_value g4, { extern s48_value read_delim(const char *, char *, int , int , int , int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = read_delim(s48_extract_string(g1), s48_extract_string(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5), &r2); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -30,13 +34,17 @@ s48_value df_skip_chars(s48_value g1, s48_value g2, s48_value mv_vec) { extern s48_value skip_chars(const char *, int , int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = skip_chars(s48_extract_string(g1), s48_extract_fixnum(g2), &r2); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); + S48_GC_UNPROTECT(); return ret1; } diff --git a/scsh/select.c b/scsh/select.c index 4b52698..500367e 100644 --- a/scsh/select.c +++ b/scsh/select.c @@ -14,17 +14,21 @@ s48_value df_select_copyback(s48_value g1, s48_value g2, s48_value g3, s48_value { extern s48_value select_copyback(s48_value , s48_value , s48_value , s48_value , int *, int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; int r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = select_copyback(g1, g2, g3, g4, &r2, &r3, &r4); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } @@ -32,17 +36,21 @@ s48_value df_select_filter(s48_value g1, s48_value g2, s48_value g3, s48_value g { extern s48_value select_filter(s48_value , s48_value , s48_value , s48_value , int *, int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; int r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = select_filter(g1, g2, g3, g4, &r2, &r3, &r4); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } diff --git a/scsh/syscalls.c b/scsh/syscalls.c index 72f913e..81563a5 100644 --- a/scsh/syscalls.c +++ b/scsh/syscalls.c @@ -33,11 +33,15 @@ s48_value df_scheme_exec(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_exec(const char *, s48_value , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_exec(s48_extract_string(g1), g2, g3); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -63,12 +67,16 @@ s48_value df_fork(s48_value mv_vec) { extern pid_t fork(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); pid_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = fork(); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -76,15 +84,19 @@ s48_value df_wait_pid(s48_value g1, s48_value g2, s48_value mv_vec) { extern s48_value wait_pid(pid_t , int , pid_t *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; pid_t r2; int r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = wait_pid(s48_extract_fixnum(g1), s48_extract_fixnum(g2), &r2, &r3); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); + S48_GC_UNPROTECT(); return ret1; } @@ -92,11 +104,15 @@ s48_value df_chdir(s48_value g1) { extern int chdir(const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = chdir(s48_extract_string(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -104,13 +120,17 @@ s48_value df_scheme_cwd(s48_value mv_vec) { extern int scheme_cwd(const char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; const char *r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_cwd(&r2); ret1 = False_on_zero(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -118,11 +138,15 @@ s48_value df_getgid(void) { extern gid_t getgid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); gid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getgid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -130,11 +154,15 @@ s48_value df_getegid(void) { extern gid_t getegid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); gid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getegid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -142,11 +170,15 @@ s48_value df_setgid(s48_value g1) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = setgid(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -154,12 +186,16 @@ s48_value df_num_supp_groups(s48_value mv_vec) { extern int num_supp_groups(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = num_supp_groups(); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -167,12 +203,16 @@ s48_value df_get_groups(s48_value g1, s48_value mv_vec) { extern int get_groups(s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = get_groups(g1); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -180,11 +220,15 @@ s48_value df_getuid(void) { extern uid_t getuid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); uid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getuid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -192,11 +236,15 @@ s48_value df_geteuid(void) { extern uid_t geteuid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); uid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = geteuid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -204,11 +252,15 @@ s48_value df_setuid(s48_value g1) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = setuid(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -216,12 +268,16 @@ s48_value df_my_username(s48_value mv_vec) { extern char *my_username(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char *r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = my_username(); ret1 = S48_VECTOR_REF(mv_vec,0); SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -229,11 +285,15 @@ s48_value df_getpid(void) { extern pid_t getpid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); pid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getpid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -241,11 +301,15 @@ s48_value df_getppid(void) { extern pid_t getppid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); pid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getppid(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -253,11 +317,15 @@ s48_value df_getpgrp(void) { extern pid_t getpgrp(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); pid_t r1; + + S48_GC_PROTECT_1(ret1); r1 = getpgrp(); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -265,11 +333,15 @@ s48_value df_setpgid(s48_value g1, s48_value g2) { extern int setpgid(pid_t , pid_t ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = setpgid(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -277,12 +349,16 @@ s48_value df_setsid(s48_value mv_vec) { extern pid_t setsid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); pid_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = setsid(); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -290,11 +366,15 @@ s48_value df_umask(s48_value g1) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); mode_t r1; + + S48_GC_PROTECT_1(ret1); r1 = umask(s48_extract_fixnum(g1)); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -302,6 +382,7 @@ s48_value df_process_times(s48_value mv_vec) { extern int process_times(clock_t *, clock_t *, clock_t *, clock_t *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; clock_t r2; clock_t r3; @@ -309,12 +390,15 @@ s48_value df_process_times(s48_value mv_vec) clock_t r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = process_times(&r2, &r3, &r4, &r5); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); S48_VECTOR_SET(mv_vec,3,s48_enter_fixnum(r5)); + S48_GC_UNPROTECT(); return ret1; } @@ -322,11 +406,15 @@ s48_value df_cpu_clock_ticks_per_sec(void) { extern int cpu_clock_ticks_per_sec(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = cpu_clock_ticks_per_sec(); ret1 = s48_enter_integer(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -334,11 +422,15 @@ s48_value df_chmod(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = chmod(s48_extract_string(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -346,11 +438,15 @@ s48_value df_fchmod(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = fchmod(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -358,11 +454,15 @@ s48_value df_chown(s48_value g1, s48_value g2, s48_value g3) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = chown(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -370,11 +470,15 @@ s48_value df_fchown(s48_value g1, s48_value g2, s48_value g3) { extern int fchown(int , uid_t , gid_t ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = fchown(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -382,11 +486,15 @@ s48_value df_access(s48_value g1, s48_value g2) { extern int access(const char *, int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = access(s48_extract_string(g1), s48_extract_integer(g2)); ret1 = ENTER_BOOLEAN(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -394,11 +502,15 @@ s48_value df_link(s48_value g1, s48_value g2) { extern int link(const char *, const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = link(s48_extract_string(g1), s48_extract_string(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -406,11 +518,15 @@ s48_value df_mkfifo(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = mkfifo(s48_extract_string(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -418,24 +534,33 @@ s48_value df_mkdir(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = mkdir(s48_extract_string(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } s48_value df_scm_readlink(s48_value g1, s48_value mv_vec) { - extern const char *scm_readlink(const char *); + extern s48_value scm_readlink(const char *, s48_value *); s48_value ret1; - const char *r1; + S48_DECLARE_GC_PROTECT(2); + s48_value r1; + s48_value r2; - r1 = scm_readlink(s48_extract_string(g1)); - ret1 = errno_on_zero_or_false(r1); - SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r1); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r1));//str-and-len + + S48_GC_PROTECT_2(mv_vec,ret1); + r1 = scm_readlink(s48_extract_string(g1), &r2); + ret1 = r1; + S48_VECTOR_SET(mv_vec,0,r2); + S48_GC_UNPROTECT(); return ret1; } @@ -443,11 +568,15 @@ s48_value df_rename(s48_value g1, s48_value g2) { extern int rename(const char *, const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = rename(s48_extract_string(g1), s48_extract_string(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -455,11 +584,15 @@ s48_value df_rmdir(s48_value g1) { extern int rmdir(const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = rmdir(s48_extract_string(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -467,11 +600,15 @@ s48_value df_scm_utime(s48_value g1, s48_value g2, s48_value g3) { extern int scm_utime(const char *, time_t , time_t ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scm_utime(s48_extract_string(g1), s48_extract_integer(g2), s48_extract_integer(g3)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -479,11 +616,15 @@ s48_value df_scm_utime_now(s48_value g1) { extern int scm_utime_now(const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scm_utime_now(s48_extract_string(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -491,11 +632,15 @@ s48_value df_scheme_stat(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_stat(const char *, s48_value , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_stat(s48_extract_string(g1), g2, EXTRACT_BOOLEAN(g3)); ret1 = False_on_zero(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -503,11 +648,15 @@ s48_value df_scheme_fstat(s48_value g1, s48_value g2) { extern int scheme_fstat(int , s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_fstat(s48_extract_integer(g1), g2); ret1 = False_on_zero(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -515,11 +664,15 @@ s48_value df_symlink(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = symlink(s48_extract_string(g1), s48_extract_string(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -527,11 +680,15 @@ s48_value df_truncate(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = truncate(s48_extract_string(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -539,11 +696,15 @@ s48_value df_ftruncate(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = ftruncate(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -551,11 +712,15 @@ s48_value df_unlink(s48_value g1) { extern int unlink(const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = unlink(s48_extract_string(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -563,11 +728,15 @@ s48_value df_fsync(s48_value g1) { extern int fsync(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = fsync(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -584,11 +753,15 @@ s48_value df_close(s48_value g1) { extern int close(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = close(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -596,12 +769,16 @@ s48_value df_dup(s48_value g1, s48_value mv_vec) { extern int dup(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = dup(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -609,12 +786,16 @@ s48_value df_dup2(s48_value g1, s48_value g2, s48_value mv_vec) { extern int dup2(int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = dup2(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -622,12 +803,16 @@ s48_value df_lseek(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec) { extern off_t lseek(int , off_t , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); off_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = lseek(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -635,11 +820,15 @@ s48_value df_char_ready_fdes(s48_value g1) { extern s48_value char_ready_fdes(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); s48_value r1; + + S48_GC_PROTECT_1(ret1); r1 = char_ready_fdes(s48_extract_fixnum(g1)); ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } @@ -647,12 +836,16 @@ s48_value df_open(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec) { s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = open(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -660,15 +853,19 @@ s48_value df_scheme_pipe(s48_value mv_vec) { extern int scheme_pipe(int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; int r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_pipe(&r2, &r3); ret1 = False_on_zero(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); + S48_GC_UNPROTECT(); return ret1; } @@ -676,11 +873,15 @@ s48_value df_read_fdes_char(s48_value g1) { extern s48_value read_fdes_char(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); s48_value r1; + + S48_GC_PROTECT_1(ret1); r1 = read_fdes_char(s48_extract_fixnum(g1)); ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } @@ -688,11 +889,15 @@ s48_value df_write_fdes_char(s48_value g1, s48_value g2) { extern int write_fdes_char(char , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = write_fdes_char(s48_extract_char(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -700,12 +905,16 @@ s48_value df_read_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_v { extern int read_fdes_substring(s48_value , size_t , size_t , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = read_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -713,12 +922,16 @@ s48_value df_write_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_ { extern int write_fdes_substring(s48_value , size_t , size_t , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = write_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -726,11 +939,15 @@ s48_value df_kill(s48_value g1, s48_value g2) { extern int kill(pid_t , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = kill(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -747,11 +964,15 @@ s48_value df_alarm(s48_value g1) { extern unsigned int alarm(unsigned int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); unsigned int r1; + + S48_GC_PROTECT_1(ret1); r1 = alarm(s48_extract_integer(g1)); ret1 = s48_enter_fixnum(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -759,6 +980,7 @@ s48_value df_user_info_uid(s48_value g1, s48_value mv_vec) { extern int user_info_uid(uid_t , char **, gid_t *, char **, char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; gid_t r3; @@ -766,12 +988,15 @@ s48_value df_user_info_uid(s48_value g1, s48_value mv_vec) char *r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = user_info_uid(s48_extract_fixnum(g1), &r2, &r3, &r4, &r5); ret1 = ENTER_BOOLEAN(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,2)),(long) r4); S48_SET_CDR(S48_VECTOR_REF(mv_vec,2),strlen_or_false(r4));//str-and-len SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -779,6 +1004,7 @@ s48_value df_user_info_name(s48_value g1, s48_value mv_vec) { extern int user_info_name(const char *, uid_t *, gid_t *, char **, char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; uid_t r2; gid_t r3; @@ -786,12 +1012,15 @@ s48_value df_user_info_name(s48_value g1, s48_value mv_vec) char *r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = user_info_name(s48_extract_string(g1), &r2, &r3, &r4, &r5); ret1 = ENTER_BOOLEAN(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,2)),(long) r4); S48_SET_CDR(S48_VECTOR_REF(mv_vec,2),strlen_or_false(r4));//str-and-len SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -799,17 +1028,21 @@ s48_value df_group_info_gid(s48_value g1, s48_value mv_vec) { extern int group_info_gid(int , char **, char** *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char *r2; char** r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = group_info_gid(s48_extract_integer(g1), &r2, &r3, &r4); ret1 = ENTER_BOOLEAN(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } @@ -817,17 +1050,21 @@ s48_value df_group_info_name(s48_value g1, s48_value mv_vec) { extern int group_info_name(const char *, int *, char** *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; char** r3; int r4; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = group_info_name(s48_extract_string(g1), &r2, &r3, &r4); ret1 = ENTER_BOOLEAN(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r2)); SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); + S48_GC_UNPROTECT(); return ret1; } @@ -835,15 +1072,19 @@ s48_value df_open_dir(s48_value g1, s48_value mv_vec) { extern int open_dir(const char *, char** *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; char** r2; int r3; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = open_dir(s48_extract_string(g1), &r2, &r3); ret1 = False_on_zero(r1); SetAlienVal(S48_VECTOR_REF(mv_vec,0),(long) r2);//simple-assign S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); + S48_GC_UNPROTECT(); return ret1; } @@ -860,14 +1101,18 @@ s48_value df_scm_envvec(s48_value mv_vec) { extern char** scm_envvec(int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char** r1; int r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scm_envvec(&r2); ret1 = S48_VECTOR_REF(mv_vec,0); SetAlienVal(ret1,(long) r1);//simple-assign S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -875,11 +1120,58 @@ s48_value df_install_env(s48_value g1) { extern int install_env(s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = install_env(g1); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); + return ret1; +} + +s48_value df_create_env(s48_value g1, s48_value mv_vec) +{ + extern int create_env(s48_value , s48_value *); + s48_value ret1; + S48_DECLARE_GC_PROTECT(2); + int r1; + s48_value r2; + + + + S48_GC_PROTECT_2(mv_vec,ret1); + r1 = create_env(g1, &r2); + ret1 = errno_or_false(r1); + S48_VECTOR_SET(mv_vec,0,r2); + S48_GC_UNPROTECT(); + return ret1; +} + +s48_value df_align_env(s48_value g1) +{ + extern void align_env(s48_value ); + + + align_env(g1); + return S48_FALSE; +} + +s48_value df_envvec_setenv(s48_value g1, s48_value g2) +{ + extern s48_value envvec_setenv(s48_value , s48_value ); + s48_value ret1; + S48_DECLARE_GC_PROTECT(1); + s48_value r1; + + + + S48_GC_PROTECT_1(ret1); + r1 = envvec_setenv(g1, g2); + ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } @@ -887,29 +1179,21 @@ s48_value df_getenv(s48_value g1, s48_value mv_vec) { extern char *getenv(const char *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char *r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = getenv(s48_extract_string(g1)); ret1 = S48_VECTOR_REF(mv_vec,0); SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len + S48_GC_UNPROTECT(); return ret1; } #define errno_on_nonzero_or_false(x) ((x) ? s48_enter_fixnum(errno) : S48_FALSE) -s48_value df_putenv(s48_value g1) -{ - - s48_value ret1; - int r1; - - - r1 = putenv(scheme2c_strcpy(g1)); - ret1 = errno_on_nonzero_or_false(r1); - return ret1; -} - s48_value df_delete_env(s48_value g1) { extern void delete_env(const char *); @@ -923,11 +1207,15 @@ s48_value df_set_cloexec(s48_value g1, s48_value g2) { extern int set_cloexec(int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = set_cloexec(s48_extract_fixnum(g1), EXTRACT_BOOLEAN(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -935,12 +1223,16 @@ s48_value df_fcntl_read(s48_value g1, s48_value g2, s48_value mv_vec) { extern int fcntl_read(int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = fcntl_read(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -948,11 +1240,15 @@ s48_value df_fcntl_write(s48_value g1, s48_value g2, s48_value g3) { extern int fcntl_write(int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = fcntl_write(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -960,24 +1256,31 @@ s48_value df_sleep_until(s48_value g1) { extern s48_value sleep_until(time_t ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); s48_value r1; + + S48_GC_PROTECT_1(ret1); r1 = sleep_until(s48_extract_integer(g1)); ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } -s48_value df_scm_gethostname(s48_value mv_vec) +s48_value df_scm_gethostname(void) { - extern char *scm_gethostname(void); + extern s48_value scm_gethostname(void); s48_value ret1; - char *r1; + S48_DECLARE_GC_PROTECT(1); + s48_value r1; + + S48_GC_PROTECT_1(ret1); r1 = scm_gethostname(); - ret1 = S48_VECTOR_REF(mv_vec,0); - SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len + ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } @@ -985,12 +1288,32 @@ s48_value df_errno_msg(s48_value g1, s48_value mv_vec) { extern char *errno_msg(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char *r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = errno_msg(s48_extract_integer(g1)); ret1 = S48_VECTOR_REF(mv_vec,0); SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len + S48_GC_UNPROTECT(); + return ret1; +} + +s48_value df_scm_crypt(s48_value g1, s48_value g2) +{ + extern s48_value scm_crypt(s48_value , s48_value ); + s48_value ret1; + S48_DECLARE_GC_PROTECT(1); + s48_value r1; + + + + S48_GC_PROTECT_1(ret1); + r1 = scm_crypt(g1, g2); + ret1 = r1; + S48_GC_UNPROTECT(); return ret1; } @@ -1063,8 +1386,10 @@ s48_value s48_init_syscalls(void) S48_EXPORT_FUNCTION(df_scm_sort_filevec); S48_EXPORT_FUNCTION(df_scm_envvec); S48_EXPORT_FUNCTION(df_install_env); + S48_EXPORT_FUNCTION(df_create_env); + S48_EXPORT_FUNCTION(df_align_env); + S48_EXPORT_FUNCTION(df_envvec_setenv); S48_EXPORT_FUNCTION(df_getenv); - S48_EXPORT_FUNCTION(df_putenv); S48_EXPORT_FUNCTION(df_delete_env); S48_EXPORT_FUNCTION(df_set_cloexec); S48_EXPORT_FUNCTION(df_fcntl_read); @@ -1072,6 +1397,7 @@ s48_value s48_init_syscalls(void) S48_EXPORT_FUNCTION(df_sleep_until); S48_EXPORT_FUNCTION(df_scm_gethostname); S48_EXPORT_FUNCTION(df_errno_msg); + S48_EXPORT_FUNCTION(df_scm_crypt); return S48_UNSPECIFIC; } diff --git a/scsh/time.c b/scsh/time.c index 14248e5..f9156a1 100644 --- a/scsh/time.c +++ b/scsh/time.c @@ -12,6 +12,7 @@ s48_value df_time_plus_ticks(s48_value mv_vec) { extern s48_value time_plus_ticks(int *, int *, int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; int r3; @@ -19,12 +20,15 @@ s48_value df_time_plus_ticks(s48_value mv_vec) int r5; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = time_plus_ticks(&r2, &r3, &r4, &r5); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3)); S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4)); S48_VECTOR_SET(mv_vec,3,s48_enter_fixnum(r5)); + S48_GC_UNPROTECT(); return ret1; } @@ -32,13 +36,17 @@ s48_value df_scheme_time(s48_value mv_vec) { extern s48_value scheme_time(time_t *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; time_t r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_time(&r2); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -46,13 +54,17 @@ s48_value df_date2time(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s { extern s48_value date2time(int , int , int , int , int , int , s48_value , s48_value , int , time_t *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; time_t r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = date2time(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5), s48_extract_fixnum(g6), g7, g8, EXTRACT_BOOLEAN(g9), &r2); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r2)); + S48_GC_UNPROTECT(); return ret1; } @@ -60,6 +72,7 @@ s48_value df_time2date(s48_value g1, s48_value g2, s48_value mv_vec) { extern s48_value time2date(time_t , s48_value , int *, int *, int *, int *, int *, int *, const char **, int *, int *, int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; int r2; int r3; @@ -74,6 +87,8 @@ s48_value df_time2date(s48_value g1, s48_value g2, s48_value mv_vec) int r12; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = time2date(s48_extract_integer(g1), g2, &r2, &r3, &r4, &r5, &r6, &r7, &r8, &r9, &r10, &r11, &r12); ret1 = r1; S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2)); @@ -87,6 +102,7 @@ s48_value df_time2date(s48_value g1, s48_value g2, s48_value mv_vec) S48_VECTOR_SET(mv_vec,8,ENTER_BOOLEAN(r10)); S48_VECTOR_SET(mv_vec,9,s48_enter_fixnum(r11)); S48_VECTOR_SET(mv_vec,10,s48_enter_fixnum(r12)); + S48_GC_UNPROTECT(); return ret1; } @@ -94,13 +110,17 @@ s48_value df_format_date(s48_value g1, s48_value g2, s48_value g3, s48_value g4, { extern s48_value format_date(const char *, int , int , int , int , int , int , s48_value , int , int , int , const char **); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); s48_value r1; const char *r2; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = format_date(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5), s48_extract_fixnum(g6), s48_extract_fixnum(g7), g8, EXTRACT_BOOLEAN(g9), s48_extract_fixnum(g10), s48_extract_fixnum(g11), &r2); ret1 = r1; SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len + S48_GC_UNPROTECT(); return ret1; } diff --git a/scsh/tty.c b/scsh/tty.c index abefe7f..4b34d8f 100644 --- a/scsh/tty.c +++ b/scsh/tty.c @@ -23,6 +23,7 @@ s48_value df_scheme_tcgetattr(s48_value g1, s48_value g2, s48_value mv_vec) { extern int scheme_tcgetattr(int , char *, int *, int *, int *, int *, int *, int *); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; int r2; int r3; @@ -32,6 +33,8 @@ s48_value df_scheme_tcgetattr(s48_value g1, s48_value g2, s48_value mv_vec) int r7; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scheme_tcgetattr(s48_extract_fixnum(g1), s48_extract_string(g2), &r2, &r3, &r4, &r5, &r6, &r7); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r2)); @@ -40,6 +43,7 @@ s48_value df_scheme_tcgetattr(s48_value g1, s48_value g2, s48_value mv_vec) S48_VECTOR_SET(mv_vec,3,s48_enter_integer(r5)); S48_VECTOR_SET(mv_vec,4,s48_enter_fixnum(r6)); S48_VECTOR_SET(mv_vec,5,s48_enter_fixnum(r7)); + S48_GC_UNPROTECT(); return ret1; } @@ -47,11 +51,15 @@ s48_value df_scheme_tcgetattrB(s48_value g1, s48_value g2, s48_value g3) { extern int scheme_tcgetattrB(int , char *, s48_value ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_tcgetattrB(s48_extract_fixnum(g1), s48_extract_string(g2), g3); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -59,11 +67,15 @@ s48_value df_scheme_tcsetattr(s48_value g1, s48_value g2, s48_value g3, s48_valu { extern int scheme_tcsetattr(int , int , const char *, int , int , int , int , int , int , int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = scheme_tcsetattr(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_string(g3), s48_extract_integer(g4), s48_extract_integer(g5), s48_extract_integer(g6), s48_extract_integer(g7), s48_extract_fixnum(g8), s48_extract_fixnum(g9), s48_extract_fixnum(g10), s48_extract_fixnum(g11)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -71,11 +83,15 @@ s48_value df_tcsendbreak(s48_value g1, s48_value g2) { extern int tcsendbreak(int , int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = tcsendbreak(s48_extract_integer(g1), s48_extract_integer(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -83,11 +99,15 @@ s48_value df_tcdrain(s48_value g1) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = tcdrain(s48_extract_integer(g1)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -95,11 +115,15 @@ s48_value df_tcflush(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = tcflush(s48_extract_integer(g1), s48_extract_integer(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -107,11 +131,15 @@ s48_value df_tcflow(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = tcflow(s48_extract_integer(g1), s48_extract_integer(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -119,11 +147,15 @@ s48_value df_tcsetpgrp(s48_value g1, s48_value g2) { s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = tcsetpgrp(s48_extract_fixnum(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -131,12 +163,16 @@ s48_value df_tcgetpgrp(s48_value g1, s48_value mv_vec) { s48_value ret1; + S48_DECLARE_GC_PROTECT(2); pid_t r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = tcgetpgrp(s48_extract_fixnum(g1)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -144,12 +180,16 @@ s48_value df_open_ctty(s48_value g1, s48_value g2, s48_value mv_vec) { extern int open_ctty(const char *, int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); int r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = open_ctty(s48_extract_string(g1), s48_extract_fixnum(g2)); ret1 = errno_or_false(r1); S48_VECTOR_SET(mv_vec,0,s48_enter_integer(r1)); + S48_GC_UNPROTECT(); return ret1; } @@ -157,11 +197,15 @@ s48_value df_isatty(s48_value g1) { extern int isatty(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(1); int r1; + + S48_GC_PROTECT_1(ret1); r1 = isatty(s48_extract_integer(g1)); ret1 = ENTER_BOOLEAN(r1); + S48_GC_UNPROTECT(); return ret1; } @@ -169,12 +213,16 @@ s48_value df_ttyname(s48_value g1, s48_value mv_vec) { extern char *ttyname(int ); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char *r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = ttyname(s48_extract_integer(g1)); ret1 = errno_on_zero_or_false(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r1); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r1));//str-and-len + S48_GC_UNPROTECT(); return ret1; } @@ -182,12 +230,16 @@ s48_value df_scm_ctermid(s48_value mv_vec) { extern char *scm_ctermid(void); s48_value ret1; + S48_DECLARE_GC_PROTECT(2); char *r1; + + S48_GC_PROTECT_2(mv_vec,ret1); r1 = scm_ctermid(); ret1 = errno_on_zero_or_false(r1); SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r1); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r1));//str-and-len + S48_GC_UNPROTECT(); return ret1; }