author | Camm Maguire <camm@transcendence.maguirefamily.org> | 2025年04月27日 10:54:59 -0400 |
---|---|---|
committer | Camm Maguire <camm@transcendence.maguirefamily.org> | 2025年04月27日 10:54:59 -0400 |
commit | 1d1362e2b38eb7f4f07e7f983d7fcb55fe43f5e9 (patch) | |
tree | be38e80af546eae3cceee515c30481490dd7c890 | |
parent | 49cd106307bf75edc3f35bd476ebf6d84e8e139f (diff) | |
download | gcl-c23.tar.gz |
-rwxr-xr-x | gcl/bin/dpp.c | 20 | ||||
-rw-r--r-- | gcl/h/att_ext.h | 2 | ||||
-rw-r--r-- | gcl/h/linux.h | 4 | ||||
-rw-r--r-- | gcl/o/character.d | 45 | ||||
-rw-r--r-- | gcl/o/cmac.c | 6 | ||||
-rw-r--r-- | gcl/o/eval.c | 2 | ||||
-rw-r--r-- | gcl/o/fasdump.c | 2 | ||||
-rw-r--r-- | gcl/o/file.d | 107 | ||||
-rw-r--r-- | gcl/o/funlink.c | 6 | ||||
-rw-r--r-- | gcl/o/gmp_big.c | 6 | ||||
-rw-r--r-- | gcl/o/list.d | 37 | ||||
-rw-r--r-- | gcl/o/main.c | 13 | ||||
-rw-r--r-- | gcl/o/package.d | 85 | ||||
-rw-r--r-- | gcl/o/print.d | 33 | ||||
-rw-r--r-- | gcl/o/read.d | 52 | ||||
-rw-r--r-- | gcl/o/run_process.c | 19 | ||||
-rw-r--r-- | gcl/o/sequence.d | 15 | ||||
-rw-r--r-- | gcl/o/sockets.c | 13 | ||||
-rw-r--r-- | gcl/o/string.d | 61 | ||||
-rw-r--r-- | gcl/o/symbol.d | 99 | ||||
-rw-r--r-- | gcl/o/unexelf.c | 5 | ||||
-rw-r--r-- | gcl/o/usig.c | 2 |
diff --git a/gcl/bin/dpp.c b/gcl/bin/dpp.c index fc2632786..e924567bf 100755 --- a/gcl/bin/dpp.c +++ b/gcl/bin/dpp.c @@ -128,9 +128,8 @@ char *result[MAXRES]; int nres; void -error(s) -char *s; -{ +error(char *s) { + printf("Error in line %d: %s.\n", line, s); exit(0); } @@ -165,9 +164,8 @@ nextc() } void -unreadc(c) -int c; -{ +unreadc(int c) { + if (c == '\n') --line; else if (c == '\t') @@ -176,9 +174,8 @@ int c; } void -put_tabs(n) -int n; -{ +put_tabs(int n) { + int i; for (i = 0; i < n; i++) @@ -186,9 +183,8 @@ int n; } void -pushc(c) -int c; -{ +pushc(int c) { + if (poolp >= &pool[POOLSIZE]) error("buffer bool overflow"); *poolp++ = c; diff --git a/gcl/h/att_ext.h b/gcl/h/att_ext.h index e00b5c6de..4c39db720 100644 --- a/gcl/h/att_ext.h +++ b/gcl/h/att_ext.h @@ -418,4 +418,4 @@ EXTER object sSPmemory; EXTER object sSPinit; /* string.d */ -int (*casefun)(); +int (*casefun)(int,int *); diff --git a/gcl/h/linux.h b/gcl/h/linux.h index 13b899191..7e532ce86 100644 --- a/gcl/h/linux.h +++ b/gcl/h/linux.h @@ -165,7 +165,7 @@ do { int c = 0; \ #else #define FPE_TCODE(x_) \ - {ufixnum _x=(x_),_y=0; \ + ({ufixnum _x=(x_),_y=0; \ switch(_x) { \ case FPE_FLTINV: _y=FE_INVALID;break; \ case FPE_FLTDIV: _y=FE_DIVBYZERO;break; \ @@ -174,7 +174,7 @@ do { int c = 0; \ case FPE_FLTRES: _y=FE_INEXACT;break; \ } \ _y; \ - } + }) #define FPE_CODE(i_,v_) make_fixnum(FPE_TCODE((fixnum)SF(i_)->si_code)) #define FPE_ADDR(i_,v_) make_fixnum((fixnum)SF(i_)->si_addr) #define FPE_CTXT(v_) Cnil diff --git a/gcl/o/character.d b/gcl/o/character.d index b16b036e0..aa352c9b6 100644 --- a/gcl/o/character.d +++ b/gcl/o/character.d @@ -108,9 +108,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. If r > 36 or i is not a digit, -1 is returned. */ int -digitp(i, r) -int i, r; -{ +digitp(int i,int r) { + if ('0' <= i && i <= '9' && 1 < r && i < '0' + r) return(i - '0'); if ('A' <= i && 10 < r && r <= 36 && i < 'A' + (r - 10)) @@ -149,9 +148,8 @@ int i, r; @) bool -char_eq(x, y) -object x, y; -{ +char_eq(object x,object y) { + return(char_code(x) == char_code(y) && char_bits(x) == char_bits(y) && char_font(x) == char_font(y)); @@ -186,9 +184,8 @@ object x, y; static int -char_cmp(x, y) -object x, y; -{ +char_cmp(object x,object y) { + if (char_font(x) < char_font(y)) return(-1); if (char_font(x) > char_font(y)) @@ -205,9 +202,8 @@ object x, y; } static void -Lchar_cmp(s, t) -int s, t; -{ +Lchar_cmp(int s,int t) { + int narg, i; narg = vs_top - vs_base; @@ -232,9 +228,8 @@ LFD(Lchar_ge)() { Lchar_cmp(-1, 0); } bool -char_equal(x, y) -object x, y; -{ +char_equal(object x,object y) { + int i, j; i = char_code(x); @@ -273,9 +268,8 @@ object x, y; static int -char_compare(x, y) -object x, y; -{ +char_compare(object x,object y) { + int i, j; i = char_code(x); @@ -293,9 +287,8 @@ object x, y; } static void -Lchar_compare(s, t) -int s, t; -{ +Lchar_compare(int s,int t) { + int narg, i; narg = vs_top - vs_base; @@ -320,9 +313,8 @@ LFD(Lchar_not_lessp)() { Lchar_compare(-1, 0); } object -coerce_to_character(x) -object x; -{ +coerce_to_character(object x) { + BEGIN: switch (type_of(x)) { case t_fixnum: @@ -408,9 +400,8 @@ BEGIN: @) int -digit_weight(w, r) -int w, r; -{ +digit_weight(int w,int r) { + if (r < 2 || r > 36 || w < 0 || w >= r) return(-1); if (w < 10) diff --git a/gcl/o/cmac.c b/gcl/o/cmac.c index 64a3a0934..7317a6898 100644 --- a/gcl/o/cmac.c +++ b/gcl/o/cmac.c @@ -55,9 +55,9 @@ dblrem(int a, int b, int mod) #else static int -dblrem(a,b,mod) -int a,b,mod; -{int h,sign; +dblrem(int a,int b,int mod) { + + int h,sign; if (a<0) {a= -a; sign= (b<0)? (b= -b,1) :-1;} else { sign= (b<0) ? (b= -b,-1) : 1;} diff --git a/gcl/o/eval.c b/gcl/o/eval.c index ecda3fc62..5bc0e4815 100644 --- a/gcl/o/eval.c +++ b/gcl/o/eval.c @@ -704,7 +704,7 @@ APPLICATION: ihs_check; ihs_push(form); ihs_top->ihs_base = lex_env; - ((void (*)())fun->s.s_sfdef)(MMcdr(form)); + ((void (*)(object))fun->s.s_sfdef)(MMcdr(form)); CHECK_AVMA; ihs_pop(); return; diff --git a/gcl/o/fasdump.c b/gcl/o/fasdump.c index 906c9a7a3..2a27e9dbe 100644 --- a/gcl/o/fasdump.c +++ b/gcl/o/fasdump.c @@ -29,7 +29,7 @@ static void clrhash(object); -object coerce_stream(); +object coerce_stream(object,int); static object fasd_patch_sharp(object x, int depth); object make_pathname (); diff --git a/gcl/o/file.d b/gcl/o/file.d index 5a0b37de5..e473a2991 100644 --- a/gcl/o/file.d +++ b/gcl/o/file.d @@ -106,9 +106,7 @@ object LSP_string; object sSAignore_eof_on_terminal_ioA; static bool -feof1(fp) -FILE *fp; -{ +feof1(FILE *fp) { #ifdef USE_READLINE if (readline_on && fp==rl_instream && rl_line_buffer && *rl_line_buffer==EOF) @@ -199,9 +197,8 @@ DEFUN("TERMINAL-INPUT-STREAM-P",object,fSterminal_input_stream_p,SI,1,1,NONE,OO, but only checks the mode of the stream (sm_mode). */ static bool -input_stream_p(strm) -object strm; -{ +input_stream_p(object strm) { + BEGIN: switch (strm->sm.sm_mode) { case smm_input: @@ -256,9 +253,8 @@ BEGIN: but only checks the mode of the stream (sm_mode). */ static bool -output_stream_p(strm) -object strm; -{ +output_stream_p(object strm) { + BEGIN: switch (strm->sm.sm_mode) { case smm_input: @@ -306,9 +302,8 @@ BEGIN: } static object -stream_element_type(strm) -object strm; -{ +stream_element_type(object strm) { + object x; BEGIN: @@ -656,9 +651,8 @@ fLinteractive_stream_p(object x) { #endif object -make_two_way_stream(istrm, ostrm) -object istrm, ostrm; -{ +make_two_way_stream(object istrm,object ostrm) { + object strm; strm = alloc_object(t_stream); @@ -673,9 +667,8 @@ object istrm, ostrm; } static object -make_echo_stream(istrm, ostrm) -object istrm, ostrm; -{ +make_echo_stream(object istrm,object ostrm) { + object strm; strm = make_two_way_stream(istrm, ostrm); @@ -764,9 +757,8 @@ DEFUN("STRING-OUTPUT-STREAM-P",object,fSstring_output_stream_p,SI,1,1,NONE,OO,OO } object -make_string_output_stream(line_length) -int line_length; -{ +make_string_output_stream(int line_length) { + object strng, strm; vs_mark; @@ -786,9 +778,8 @@ int line_length; } static object -get_output_stream_string(strm) -object strm; -{ +get_output_stream_string(object strm) { + object strng; strng = copy_simple_string(STRING_STREAM_STRING(strm)); @@ -803,9 +794,8 @@ cannot_read(object); static void closed_stream(object); int -readc_stream(strm) -object strm; -{ +readc_stream(object strm) { + int c; BEGIN: @@ -1515,9 +1505,8 @@ BEGIN: } int -file_position(strm) -object strm; -{ +file_position(object strm) { + BEGIN: switch (strm->sm.sm_mode) { case smm_input: @@ -1564,10 +1553,8 @@ BEGIN: } int -file_position_set(strm, disp) -object strm; -int disp; -{ +file_position_set(object strm,int disp) { + BEGIN: switch (strm->sm.sm_mode) { case smm_socket: @@ -1615,9 +1602,8 @@ BEGIN: } static int -file_length(strm) -object strm; -{ +file_length(object strm) { + BEGIN: switch (strm->sm.sm_mode) { case smm_input: @@ -2243,30 +2229,22 @@ LFD(siLcopy_stream)() } static void -cannot_open(fn) -object fn; -{ +cannot_open(object fn) { FILE_ERROR(fn,"Cannot open"); } static void -cannot_create(fn) -object fn; -{ +cannot_create(object fn) { FILE_ERROR(fn,"Cannot create"); } static void -cannot_read(strm) -object strm; -{ +cannot_read(object strm) { FEerror("Cannot read the stream ~S.", 1, strm); } static void -cannot_write(strm) -object strm; -{ +cannot_write(object strm) { FEerror("Cannot write to the stream ~S.", 1, strm); } @@ -2285,9 +2263,8 @@ FFN(siLuser_stream_state)() #endif static void -closed_stream(strm) -object strm; -{ +closed_stream(object strm) { + if (!GET_STREAM_FLAG(strm,gcl_sm_had_error)) { SET_STREAM_FLAG(strm,gcl_sm_had_error,1); @@ -2308,10 +2285,8 @@ object strm; */ object -coerce_stream(strm,out) -object strm; -int out; -{ +coerce_stream(object strm,int out) { + BEGIN: if (type_of(strm) != t_stream) FEwrong_type_argument(sLstream, strm); @@ -2416,10 +2391,8 @@ DEFUN("FREAD",object,fSfread,SI,4,4,NONE,OO,OO,OO,OO, of the buffer may be changed. */ static void -putCharGclSocket(strm,ch) - object strm; - int ch; -{ +putCharGclSocket(object strm,int ch) { + object bufp = SOCKET_STREAM_BUFFER(strm); AGAIN: @@ -2435,10 +2408,8 @@ putCharGclSocket(strm,ch) } static void -gclFlushSocket(strm) - object strm; +gclFlushSocket(object strm) { -{ int fd = SOCKET_STREAM_FD(strm); object bufp = SOCKET_STREAM_BUFFER(strm); int i=0; @@ -2470,14 +2441,8 @@ gclFlushSocket(strm) static object -make_socket_stream(fd,mode,server,host,port,async) -int fd; -enum gcl_sm_flags mode; -object server; -object host; -object port; -object async; -{ +make_socket_stream(int fd,enum gcl_sm_flags mode,object server,object host,object port,object async) { + object x; if (fd < 0 ) { diff --git a/gcl/o/funlink.c b/gcl/o/funlink.c index 89ab1fd29..49a086d30 100644 --- a/gcl/o/funlink.c +++ b/gcl/o/funlink.c @@ -341,7 +341,7 @@ call_proc_new(object sym,ufixnum clp,ufixnum vld,void **link,ufixnum argd,object } if (sSAprofilingA->s.s_dbind!=Cnil) - sSin_call->s.s_gfdef->fun.fun_self(sym); + ((object (*)(object))sSin_call->s.s_gfdef->fun.fun_self)(sym); if (fas) { @@ -352,7 +352,7 @@ call_proc_new(object sym,ufixnum clp,ufixnum vld,void **link,ufixnum argd,object } if (sSAprofilingA->s.s_dbind!=Cnil) - sSout_call->s.s_gfdef->fun.fun_self(fSgettimeofday()); + ((object (*)(object))sSout_call->s.s_gfdef->fun.fun_self)(fSgettimeofday()); return(c_apply_n_fun(fun,x-tmp,tmp)); @@ -428,7 +428,7 @@ call_proc_new(object sym,ufixnum clp,ufixnum vld,void **link,ufixnum argd,object } if (sSAprofilingA->s.s_dbind!=Cnil) - sSout_call->s.s_gfdef->fun.fun_self(fSgettimeofday()); + ((object (*)(object))sSout_call->s.s_gfdef->fun.fun_self)(fSgettimeofday()); return res; diff --git a/gcl/o/gmp_big.c b/gcl/o/gmp_big.c index f61632fd2..42b55fc64 100644 --- a/gcl/o/gmp_big.c +++ b/gcl/o/gmp_big.c @@ -526,16 +526,16 @@ integer_quotient_remainder_1(object x, object y, object *qp, object *rp,fixnum d if (qp) { if (rp) { - void (*f)()=d<0 ? mpz_fdiv_qr : (d>0 ? mpz_cdiv_qr : mpz_tdiv_qr); + void (*f)(__mpz_struct *,__mpz_struct *,__mpz_struct *,__mpz_struct *)=d<0 ? mpz_fdiv_qr : (d>0 ? mpz_cdiv_qr : mpz_tdiv_qr); f(MP(big_fixnum3),MP(big_fixnum4),b1,b2); *rp=maybe_replace_big(big_fixnum4); } else { - void (*f)()=d<0 ? mpz_fdiv_q : (d>0 ? mpz_cdiv_q : mpz_tdiv_q); + void (*f)(__mpz_struct *,__mpz_struct *,__mpz_struct *)=d<0 ? mpz_fdiv_q : (d>0 ? mpz_cdiv_q : mpz_tdiv_q); f(MP(big_fixnum3),b1,b2); } *qp=maybe_replace_big(big_fixnum3); } else if (rp) { - void (*f)()=d<0 ? mpz_fdiv_r : (d>0 ? mpz_cdiv_r : mpz_tdiv_r); + void (*f)(__mpz_struct *,__mpz_struct *,__mpz_struct *)=d<0 ? mpz_fdiv_r : (d>0 ? mpz_cdiv_r : mpz_tdiv_r); f(MP(big_fixnum4),b1,b2); *rp=maybe_replace_big(big_fixnum4); } diff --git a/gcl/o/list.d b/gcl/o/list.d index dd9f5a6d0..02c48650c 100644 --- a/gcl/o/list.d +++ b/gcl/o/list.d @@ -32,9 +32,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. object -car(x) -object x; -{ +car(object x) { + if (x == Cnil) return(x); if (consp(x)) @@ -44,9 +43,8 @@ object x; } object -cdr(x) -object x; -{ +cdr(object x) { + if (x == Cnil) return(x); if (consp(x)) @@ -192,9 +190,8 @@ append(object x, object y) { } object -copy_list(x) -object x; -{ +copy_list(object x) { + object y; if (!consp(x)) @@ -277,10 +274,10 @@ stack_list(void) { } -object on_stack_make_list(n) -int n; -{ object res=(object) alloca_val; - struct cons *p = (struct cons *)res; +object on_stack_make_list(int n) { + + object res=(object) alloca_val; + struct cons *p = (struct cons *)res; if (n<=0) return Cnil; TOP: #ifdef WIDE_CONS @@ -315,9 +312,8 @@ DEFUN("RPLACD",object,fLrplacd,LISP,2,2,NONE,OO,OO,OO,OO,(object o,object d),"") void -check_proper_list(alist) -object alist; -{ +check_proper_list(object alist) { + object v; /* if (alist == Cnil) @@ -336,9 +332,7 @@ DEFUN("PROPER-LISTP",object,fSproper_listp,SI,1,1,NONE,OO,OO,OO,OO,(object x),"" bool -member_eq(x, l) -object x, l; -{ +member_eq(object x,object l) { for (; consp(l); l = l->c.c_cdr) if (x == l->c.c_car) @@ -347,9 +341,8 @@ object x, l; } void -delete_eq(x, lp) -object x, *lp; -{ +delete_eq(object x,object *lp) { + for (; consp(*lp); lp = &(*lp)->c.c_cdr) if ((*lp)->c.c_car == x) { *lp = (*lp)->c.c_cdr; diff --git a/gcl/o/main.c b/gcl/o/main.c index 7728f61c9..294f02835 100644 --- a/gcl/o/main.c +++ b/gcl/o/main.c @@ -1461,7 +1461,7 @@ my_fprintf(void *v,const char *f,...) { #ifdef HAVE_FPRINTF_STYLED_FTYPE static int -my_fprintf_styled(void *v,enum disassembler_style,const char *f,...) { +my_fprintf_styled(void *v,enum disassembler_style s,const char *f,...) { va_list va; int r; va_start(va,f); @@ -1490,25 +1490,24 @@ DEFUN("DISASSEMBLE-INSTRUCTION",object,fSdisassemble_instruction,SI,1,1,NONE,OI, #if defined(HAVE_DIS_ASM_H) && defined(OUTPUT_ARCH) static disassemble_info i; - void *v; - void * (*s)(); + void *v,*s; fixnum j,j1,k; object x; if ((v=dlopen("libopcodes.so",RTLD_NOW))) { if ((s=dlsym(v,"init_disassemble_info"))) { - s(&i, stdout,(fprintf_ftype)my_fprintf #ifdef HAVE_FPRINTF_STYLED_FTYPE - ,my_fprintf_styled + ((void * (*)(disassemble_info *,FILE *,fprintf_ftype,fprintf_styled_ftype))s)(&i,stdout,my_fprintf,my_fprintf_styled); +#else + ((void * (*)(disassemble_info *,FILE *,fprintf_ftype))s)(&i,stdout,my_fprintf); #endif - ); i.read_memory_func=my_read; i.print_address_func=my_pa; #if defined(OUTPUT_MACH) i.mach=OUTPUT_MACH; #endif if ((s=dlsym(v,"disassembler"))) { - disassembler_ftype disasm=(disassembler_ftype)(ufixnum)s(OUTPUT_ARCH,0,0,NULL); + disassembler_ftype disasm=((disassembler_ftype (*)(int,int,int,void *))s)(OUTPUT_ARCH,0,0,NULL); bp=b; disasm(addr,&i); my_fprintf(NULL," ;"); diff --git a/gcl/o/package.d b/gcl/o/package.d index d50841da9..d85fd0761 100644 --- a/gcl/o/package.d +++ b/gcl/o/package.d @@ -39,9 +39,8 @@ void check_type_or_symbol_string_package(object *); static bool -member_string_eq(x, l) -object x, l; -{ +member_string_eq(object x,object l) { + for (; consp(l); l = l->c.c_cdr) if (string_eq(x, l->c.c_car)) return(TRUE); @@ -126,10 +125,7 @@ suitable_package_size(ufixnum n) or package names i.e. strings or symbols. */ static object -make_package(n, ns, ul,isize,esize) -object n, ns, ul; -int isize,esize; -{ +make_package(object n,object ns,object ul,int isize,int esize) { object x, y; int i; @@ -199,10 +195,7 @@ static void use_package(object,object); static object -in_package(n, ns, ul,isize,esize) -object n, ns, ul; -int isize,esize; -{ +in_package(object n,object ns,object ul,int isize,int esize) { object x, y; vs_mark; @@ -237,9 +230,7 @@ L: } static object -rename_package(x, n, ns) -object x, n, ns; -{ +rename_package(object x,object n,object ns) { object y; vs_mark; @@ -278,9 +269,8 @@ object x, n, ns; If not so, an error is signaled. */ object -find_package(n) -object n; -{ +find_package(object n) { + struct package *p; check_package_designator(n); @@ -291,9 +281,8 @@ object n; } static object -coerce_to_package(p) -object p; -{ +coerce_to_package(object p) { + object pp; if (type_of(p) == t_package) @@ -327,9 +316,9 @@ current_package() */ int -pack_hash(x) -object x; -{unsigned int h=0; +pack_hash(object x) { + + unsigned int h=0; x=coerce_to_string(x); {int len=VLEN(x); char *s; @@ -393,9 +382,8 @@ DEFUN("PACKAGE-EXTERNAL_SIZE",object,fSpackage_external_size,SI,1,1,NONE,IO,OO,O Intern(st, p) interns string st in package p. */ object -intern(st, p) -object st, p; -{ +intern(object st,object p) { + int j; object x, *ip, *ep, l, ul; vs_mark; @@ -450,9 +438,8 @@ object st, p; Find_symbol(st, p) searches for string st in package p. */ object -find_symbol(st, p) -object st, p; -{ +find_symbol(object st,object p) { + int j; object *ip, *ep, l, ul; {BEGIN_NO_INTERRUPT; @@ -483,9 +470,8 @@ object st, p; }} static bool -unintern(s, p) -object s, p; -{ +unintern(object s,object p) { + object x, y, l, *lp; int j; {BEGIN_NO_INTERRUPT; @@ -533,9 +519,8 @@ UNINTERN: }} void -export(s, p) -object s, p; -{ +export(object s,object p) { + object x; int j; object *ep, *ip, l; @@ -578,9 +563,8 @@ BEGIN: } static void -unexport(s, p) -object s, p; -{ +unexport(object s,object p) { + object x, *ep, *ip; int j; @@ -609,9 +593,8 @@ object s, p; } void -import(s, p) -object s, p; -{ +import(object s,object p) { + object x; int j; object *ip; @@ -635,9 +618,8 @@ object s, p; } static void -shadowing_import(s, p) -object s, p; -{ +shadowing_import(object s,object p) { + object x, *ip; x=find_symbol(s, p); @@ -668,9 +650,8 @@ object s, p; } static void -shadow(s, p) -object s, p; -{ +shadow(object s,object p) { + int j; object *ip,x; @@ -692,9 +673,8 @@ object s, p; } static void -use_package(x0, p) -object x0, p; -{ +use_package(object x0,object p) { + object x = x0; int i; object y, l; @@ -735,9 +715,8 @@ object x0, p; } static void -unuse_package(x0, p) -object x0, p; -{ +unuse_package(object x0,object p) { + object x = x0; BEGIN: diff --git a/gcl/o/print.d b/gcl/o/print.d index 9884345a8..c1bdf83b7 100644 --- a/gcl/o/print.d +++ b/gcl/o/print.d @@ -156,9 +156,8 @@ static void write_decimal1(int); static void -write_decimal(i) -int i; -{ +write_decimal(int i) { + if (i == 0) { write_ch('0'); return; @@ -623,17 +622,15 @@ writec_queue(int c,void *v) { void -write_str(s) -char *s; -{ +write_str(char *s) { + while (*s != '0円') write_ch(*s++); } static void -write_decimal1(i) -int i; -{ +write_decimal1(int i) { + if (i == 0) return; write_decimal1(i/10); @@ -641,9 +638,8 @@ int i; } static void -write_addr(x) -object x; -{ +write_addr(object x) { + long i; int j, k; @@ -799,11 +795,8 @@ write_unreadable_str(object x,char *str) { } static void -write_double(d, e, shortp) -double d; -int e; -bool shortp; -{ +write_double(double d,int e,bool shortp) { + int sign; char buff[FPRC+5]; int exp; @@ -1847,10 +1840,8 @@ travel_find_sharing(object x,object table) { } static bool -potential_number_p(strng, base) -object strng; -int base; -{ +potential_number_p(object strng,int base) { + int i, l, c, dc; char *s; diff --git a/gcl/o/read.d b/gcl/o/read.d index 5f80080ec..9e8938ed7 100644 --- a/gcl/o/read.d +++ b/gcl/o/read.d @@ -261,9 +261,8 @@ setup_READ() } object -read_char(in) -object in; -{ +read_char(object in) { + return(code_char(readc_stream(in))); } @@ -286,9 +285,8 @@ read_char_no_echo(object in) { #define read_char(in) code_char(readc_stream(in)) static void -unread_char(c, in) -object c, in; -{ +unread_char(object c,object in) { + if (type_of(c) != t_character) FEwrong_type_argument(sLcharacter, c); unreadc_stream(char_code(c), in); @@ -299,10 +297,8 @@ object c, in; When pt is TRUE, preceeding whitespaces are ignored. */ object -peek_char(pt, in) -bool pt; -object in; -{ +peek_char(bool pt,object in) { + object c; if (pt) { @@ -320,9 +316,8 @@ object in; static object -read_object_recursive(in) -object in; -{ +read_object_recursive(object in) { + VOL object x; bool e; @@ -388,9 +383,8 @@ L: object -read_object_non_recursive(in) -object in; -{ +read_object_non_recursive(object in) { + VOL object x; bool e; object old_READtable; @@ -509,9 +503,8 @@ L: */ object -read_object(in) -object in; -{ +read_object(object in) { + object x; object c=Cnil; enum chattrib a; @@ -801,10 +794,8 @@ ENDUP: Delim is not included in the string but discarded. */ static void -read_string(delim, in) -int delim; -object in; -{ +read_string(int delim,object in) { + int i; object c; @@ -828,9 +819,8 @@ object in; and places it in token_buffer. */ static void -read_constituent(in) -object in; -{ +read_constituent(object in) { + int i, j; object c; @@ -2159,9 +2149,8 @@ DEFUNM("PARSE-INTEGER-INT",object,fSparse_integer_int,SI,5,5,NONE,OO,OO,IO,OO, /* } */ object -read_char1(strm,eof) -object strm,eof; -{ +read_char1(object strm,object eof) { + if (strm == Cnil) strm = symbol_value(sLAstandard_inputA); else if (strm == Ct) @@ -2340,9 +2329,8 @@ DEFUN("SET-READTABLE-CASE",object,fSset_readtable_case,SI,2,2,NONE,OO,OO,OO,OO,( @) static object -string_to_object(x) -object x; -{ +string_to_object(object x) { + object in; vs_mark; diff --git a/gcl/o/run_process.c b/gcl/o/run_process.c index 6427d35ed..7d00fec9c 100644 --- a/gcl/o/run_process.c +++ b/gcl/o/run_process.c @@ -374,10 +374,8 @@ static char *lisp_to_string(object string) { * for a service on the same host as the clinet. * */ -static int open_connection(host,server) -char *host; -int server; -{ +static int open_connection(char *host,int server) { + int res; int pid; int sock; @@ -430,11 +428,8 @@ int server; return(sock); } -object make_stream(host_l,socket,smm) -object host_l; -int socket; -enum smmode smm; -{ +object make_stream(object host_l,int socket,enum smmode smm) { + char *mode=NULL; object stream; FILE *fp; @@ -470,10 +465,8 @@ enum smmode smm; } object -make_socket_stream(host_l,port) -object host_l; -object port; -{ +make_socket_stream(object host_l,object port) { + char *host = lisp_to_string(host_l); object stream_in; object stream_out; diff --git a/gcl/o/sequence.d b/gcl/o/sequence.d index a24c615a9..740474399 100644 --- a/gcl/o/sequence.d +++ b/gcl/o/sequence.d @@ -269,9 +269,8 @@ LFD(Lcopy_seq)() } int -length(x) -object x; -{ +length(object x) { + int i; switch (type_of(x)) { @@ -317,9 +316,8 @@ LFD(Lreverse)() } object -reverse(seq) -object seq; -{ +reverse(object seq) { + object x, y, *v; int i, j, k; @@ -430,9 +428,8 @@ LFD(Lnreverse)() } object /*FIXME boot*/ -nreverse(seq) -object seq; -{ +nreverse(object seq) { + object x, y, z; int i, j, k; diff --git a/gcl/o/sockets.c b/gcl/o/sockets.c index c15f565fc..c84f906a9 100644 --- a/gcl/o/sockets.c +++ b/gcl/o/sockets.c @@ -53,9 +53,6 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #include <errno.h> -static void write_timeout_error(); -static void connection_failure(); - #ifdef __MINGW32__ /* Keep track of socket initialisations */ int w32_socket_initialisations = 0; @@ -554,15 +551,13 @@ DEFUN("CLEAR-CONNECTION-STATE",object,fSclear_connection_state, #endif static void -write_timeout_error(s) - char *s; -{FEerror("Write timeout: ~s",1,make_simple_string(s)); +write_timeout_error(char *s) { + FEerror("Write timeout: ~s",1,make_simple_string(s)); } static void -connection_failure(s) - char *s; -{FEerror("Connect failure: ~s",1,make_simple_string(s)); +connection_failure(char *s) { + FEerror("Connect failure: ~s",1,make_simple_string(s)); } diff --git a/gcl/o/string.d b/gcl/o/string.d index 5d31ac7f0..b01b26767 100644 --- a/gcl/o/string.d +++ b/gcl/o/string.d @@ -82,9 +82,8 @@ alloc_simple_string(fixnum l) { Make_simple_string(s) makes a simple string from C string s. */ object -make_simple_string(s) -const char *s; -{ +make_simple_string(const char *s) { + int l, i; char *p; object x; @@ -103,9 +102,8 @@ const char *s; } object -make_string(s) -char *s; -{ +make_string(char *s) { + int l, i; char *p; object x; @@ -128,9 +126,8 @@ char *s; This correponds to string= (just the string equality). */ bool -string_eq(x, y) -object x, y; -{ +string_eq(object x,object y) { + int i, j; @@ -151,9 +148,8 @@ object x, y; (string equality ignoring the case). */ bool -string_equal(x, y) -object x, y; -{ +string_equal(object x,object y) { + int i, j; char *p, *q; @@ -178,9 +174,8 @@ object x, y; Copy_simple_string(x) copies string x to a simple string. */ object -copy_simple_string(x) -object x; -{ +copy_simple_string(object x) { + object y; int i; vs_mark; @@ -205,9 +200,8 @@ object x; } object -copy_string(x) -object x; -{ +copy_string(object x) { + object y; int i; vs_mark; @@ -238,9 +232,8 @@ object x; } object -coerce_to_string(x) -object x; -{ +coerce_to_string(object x) { + object y; vs_mark; @@ -276,10 +269,8 @@ object x; void -get_string_start_end(str, start, end, ps, pe) -object str, start, end; -int *ps, *pe; -{ +get_string_start_end(object str,object start,object end,int *ps,int *pe) { + if (start == Cnil) *ps = 0; else if (type_of(start) != t_fixnum) @@ -458,10 +449,7 @@ LFD(Lstring_not_equal)() { string_sign = 0; string_boundary = 1; FFN(Lstring @) static bool -member_char(c, char_bag) -int c; -object char_bag; -{ +member_char(int c,object char_bag) { int i, f; @@ -533,27 +521,24 @@ LFD(Lstring_trim)() { left_trim = right_trim = TRUE; FFN(Lstring_trim0)(); } LFD(Lstring_left_trim)() { left_trim = TRUE; right_trim = FALSE; FFN(Lstring_trim0)(); } LFD(Lstring_right_trim)() { left_trim = FALSE; right_trim = TRUE; FFN(Lstring_trim0)();} -static int char_upcase(c, bp) -int c, *bp; -{ +static int char_upcase(int c,int *bp) { + if (isLower(c)) return(c - ('a' - 'A')); else return(c); } -static int char_downcase(c, bp) -int c, *bp; -{ +static int char_downcase(int c,int *bp) { + if (isUpper(c)) return(c + ('a' - 'A')); else return(c); } -static int char_capitalize(c, bp) -int c, *bp; -{ +static int char_capitalize(int c,int *bp) { + if (isLower(c)) { if (*bp) c -= 'a' - 'A'; diff --git a/gcl/o/symbol.d b/gcl/o/symbol.d index 2dbca3e9a..90e6c7fb4 100644 --- a/gcl/o/symbol.d +++ b/gcl/o/symbol.d @@ -40,9 +40,8 @@ odd_plist(object); object siSpname; object -make_symbol(st) -object st; -{ +make_symbol(object st) { + object x; {BEGIN_NO_INTERRUPT; @@ -70,9 +69,8 @@ object st; object -make_ordinary(s) -char *s; -{ +make_ordinary(char *s) { + int j; object x, l, *ep; vs_mark; @@ -96,10 +94,8 @@ char *s; with initial value v in lisp package. */ object -make_special(s, v) -char *s; -object v; -{ +make_special(char *s,object v) { + object x; x = make_ordinary(s); @@ -113,10 +109,8 @@ object v; with constant value v in lisp package. */ object -make_constant(s, v) -char *s; -object v; -{ +make_constant(char *s,object v) { + object x; x = make_ordinary(s); @@ -134,9 +128,8 @@ object v; object -make_si_ordinary(s) -char *s; -{ +make_si_ordinary(char *s) { + int j; object x, l, *ep; vs_mark; @@ -161,9 +154,8 @@ char *s; } object -make_gmp_ordinary(s) -char *s; -{ +make_gmp_ordinary(char *s) { + int i,j; object x, l, *ep; vs_mark; @@ -196,10 +188,8 @@ char *s; with initial value v in system package. */ object -make_si_special(s, v) -char *s; -object v; -{ +make_si_special(char *s,object v) { + object x; x = make_si_ordinary(s); @@ -213,25 +203,23 @@ object v; with constant value v in system package. */ object -make_si_constant(s, v) -char *s; -object v; -{ +make_si_constant(char *s,object v) { + object x; x = make_si_ordinary(s); x->s.s_stype = (short)stp_constant; x->s.s_dbind = v; return(x); + } /* Make_keyword(s) makes a keyword from C string s. */ object -make_keyword(s) -char *s; -{ +make_keyword(char *s) { + int j; object x, l, *ep; vs_mark; @@ -254,9 +242,8 @@ char *s; } object -symbol_value(s) -object s; -{ +symbol_value(object s) { + /* if (type_of(s) != t_symbol) FEinvalid_variable("~S is not a symbol.", s); @@ -267,9 +254,7 @@ object s; } object -getf(place, indicator, deflt) -object place, indicator, deflt; -{ +getf(object place,object indicator,object deflt) { object l; #define cendp(obj) ((!consp(obj))) @@ -285,9 +270,8 @@ object place, indicator, deflt; } object -get(s, p, d) -object s, p, d; -{ +get(object s,object p,object d) { + if (type_of(s) != t_symbol) not_a_symbol(s); return(getf(s->s.s_plist, p, d)); @@ -298,9 +282,8 @@ object s, p, d; and returns the resulting property list. */ object -putf(p, v, i) -object p, v, i; -{ +putf(object p,object v,object i) { + object l; for (l = p; !cendp(l); l = l->c.c_cdr->c.c_cdr) { @@ -316,9 +299,8 @@ object p, v, i; } object -putprop(s, v, p) -object s, v, p; -{ +putprop(object s,object v,object p) { + if (type_of(s) != t_symbol) not_a_symbol(s); s->s.s_plist = putf(s->s.s_plist, v, p); @@ -350,9 +332,8 @@ fSsputprop(object x,object y,object z) { FALSE otherwise. */ bool -remf(p, i) -object *p, i; -{ +remf(object *p,object i) { + object l0 = *p; for(; !endp(*p); p = &(*p)->c.c_cdr->c.c_cdr) { @@ -367,9 +348,8 @@ object *p, i; } object -remprop(s, p) -object s, p; -{ +remprop(object s,object p) { + if (type_of(s) != t_symbol) not_a_symbol(s); if (remf(&s->s.s_plist, p)) @@ -379,9 +359,8 @@ object s, p; } bool -keywordp(s) -object s; -{ +keywordp(object s) { + return(type_of(s) == t_symbol && s->s.s_hpack == keyword_package); /* if (type_of(s) != t_symbol) { @@ -445,11 +424,11 @@ DEFUN("SYMBOL-STRING",object,fSsymbol_string,SI,1,1,NONE,OO,OO,OO,OO,(object sym object -symbol_name(x) -object x; -{ +symbol_name(object x) { + if (type_of(x)!=t_symbol) FEwrong_type_argument(sLsymbol,x); return(x->s.s_name); + } DEFUN("SYMBOL-NAME",object,fLsymbol_name,LISP,1,1,NONE,OO,OO,OO,OO,(object sym),"") { @@ -674,9 +653,7 @@ LFD(siLputprop)() static void -odd_plist(place) -object place; -{ +odd_plist(object place) { FEerror("The length of the property-list ~S is odd.", 1, place); } diff --git a/gcl/o/unexelf.c b/gcl/o/unexelf.c index 124f71cff..576b888ed 100644 --- a/gcl/o/unexelf.c +++ b/gcl/o/unexelf.c @@ -583,9 +583,8 @@ typedef unsigned char byte; /* Round X up to a multiple of Y. */ static ElfW(Addr) -round_up (x, y) - ElfW(Addr) x, y; -{ +round_up (ElfW(Addr) x,ElfW(Addr) y) { + int rem = x % y; if (rem == 0) return x; diff --git a/gcl/o/usig.c b/gcl/o/usig.c index d6479f467..bddf2dd37 100644 --- a/gcl/o/usig.c +++ b/gcl/o/usig.c @@ -178,7 +178,7 @@ DEFUN("FEENABLEEXCEPT",object,fSfeenableexcept,SI,1,1,NONE,II,OO,OO,OO,(fixnum x DEFUN("FEDISABLEEXCEPT",object,fSfedisableexcept,SI,0,0,NONE,IO,OO,OO,OO,(void),"") { - fixnum x; + fixnum x=0; #ifdef HAVE_FEENABLEEXCEPT |