diff options
-rw-r--r-- | libguile/fports.c | 94 | ||||
-rw-r--r-- | libguile/gdb_interface.h | 29 | ||||
-rw-r--r-- | libguile/genio.c | 70 | ||||
-rw-r--r-- | libguile/gscm.h | 40 | ||||
-rw-r--r-- | libguile/ports.h | 143 |
5 files changed, 125 insertions, 251 deletions
diff --git a/libguile/fports.c b/libguile/fports.c index 64842d653..ddcf2e93f 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -88,14 +88,10 @@ scm_sizet fwrite (); */ /* should be called with SCM_DEFER_INTS active */ -#ifdef __STDC__ -SCM -scm_setbuf0 (SCM port) -#else + SCM scm_setbuf0 (port) SCM port; -#endif { #ifndef NOSETBUF #ifndef MSDOS @@ -114,14 +110,10 @@ scm_setbuf0 (port) * * See PORT FLAGS in scm.h */ -#ifdef __STDC__ -long -scm_mode_bits (char *modes) -#else + long scm_mode_bits (modes) char *modes; -#endif { return (SCM_OPN | (strchr (modes, 'r') || strchr (modes, '+') ? SCM_RDNG : 0) @@ -141,15 +133,11 @@ scm_mode_bits (modes) * Return the new port. */ SCM_PROC(s_open_file, "open-file", 2, 0, 0, scm_open_file); -#ifdef __STDC__ -SCM -scm_open_file (SCM filename, SCM modes) -#else + SCM scm_open_file (filename, modes) SCM filename; SCM modes; -#endif { SCM port; FILE *f; @@ -197,14 +185,10 @@ scm_open_file (filename, modes) */ SCM_PROC(s_port_mode, "port-mode", 1, 0, 0, scm_port_mode); -#ifdef __STDC__ -SCM -scm_port_mode (SCM port) -#else + SCM scm_port_mode (port) SCM port; -#endif { char modes[3]; modes[0] = '\0'; @@ -223,16 +207,14 @@ scm_port_mode (port) } -#ifdef __STDC__ -static int -prinfport (SCM exp, SCM port, int writing) -#else + +static int prinfport SCM_P ((SCM exp, SCM port, scm_print_state *pstate)); + static int -prinfport (exp, port, writing) +prinfport (exp, port, pstate) SCM exp; SCM port; - int writing; -#endif + scm_print_state *pstate; { SCM name; char * c; @@ -254,14 +236,12 @@ prinfport (exp, port, writing) } -#ifdef __STDC__ -static int -scm_fgetc (FILE * s) -#else + +static int scm_fgetc SCM_P ((FILE * s)); + static int scm_fgetc (s) FILE * s; -#endif { if (feof (s)) return EOF; @@ -270,16 +250,14 @@ scm_fgetc (s) } #ifdef vms -#ifdef __STDC__ -static scm_sizet -pwrite (char *ptr, scm_sizet size, nitems, FILE *port) -#else + +static scm_sizet pwrite SCM_P ((char *ptr, scm_sizet size, nitems, FILE *port)); + static scm_sizet pwrite (ptr, size, nitems, port) char *ptr; scm_sizet size, nitems; FILE *port; -#endif { scm_sizet len = size * nitems; scm_sizet i = 0; @@ -297,6 +275,9 @@ pwrite (ptr, size, nitems, port) /* This otherwise pointless code helps some poor * crippled C compilers cope with life. */ + +static int local_fclose SCM_P ((FILE *fp)); + static int local_fclose (fp) FILE * fp; @@ -304,6 +285,8 @@ local_fclose (fp) return fclose (fp); } +static int local_fflush SCM_P ((FILE *fp)); + static int local_fflush (fp) FILE * fp; @@ -311,6 +294,8 @@ local_fflush (fp) return fflush (fp); } +static int local_fputc SCM_P ((int c, FILE *fp)); + static int local_fputc (c, fp) int c; @@ -319,6 +304,8 @@ local_fputc (c, fp) return fputc (c, fp); } +static int local_fputs SCM_P ((char *s, FILE *fp)); + static int local_fputs (s, fp) char * s; @@ -327,6 +314,8 @@ local_fputs (s, fp) return fputs (s, fp); } +static scm_sizet local_ffwrite SCM_P ((void *ptr, int size, int nitems, FILE *fp)); + static scm_sizet local_ffwrite (ptr, size, nitems, fp) void * ptr; @@ -341,15 +330,15 @@ local_ffwrite (ptr, size, nitems, fp) scm_ptobfuns scm_fptob = { scm_mark0, - local_fclose, + (int (*) SCM_P ((SCM))) local_fclose, prinfport, 0, - local_fputc, - local_fputs, - local_ffwrite, - local_fflush, - scm_fgetc, - local_fclose + (int (*) SCM_P ((int, SCM))) local_fputc, + (int (*) SCM_P ((char *, SCM))) local_fputs, + (scm_sizet (*) SCM_P ((char *, scm_sizet, scm_sizet, SCM))) local_ffwrite, + (int (*) SCM_P ((SCM))) local_fflush, + (int (*) SCM_P ((SCM))) scm_fgetc, + (int (*) SCM_P ((SCM))) local_fclose }; /* {Pipe ports} @@ -360,23 +349,16 @@ scm_ptobfuns scm_pipob = 0, /* replaced by pclose in scm_init_ioext() */ 0, /* replaced by prinpipe in scm_init_ioext() */ 0, - local_fputc, - local_fputs, - local_ffwrite, - local_fflush, - scm_fgetc, + (int (*) SCM_P ((int, SCM))) local_fputc, + (int (*) SCM_P ((char *, SCM))) local_fputs, + (scm_sizet (*) SCM_P ((char *, scm_sizet, scm_sizet, SCM))) local_ffwrite, + (int (*) SCM_P ((SCM))) local_fflush, + (int (*) SCM_P ((SCM))) scm_fgetc, 0 }; /* replaced by pclose in scm_init_ioext() */ - -#ifdef __STDC__ -void -scm_init_fports (void) -#else void scm_init_fports () -#endif { #include "fports.x" } - diff --git a/libguile/gdb_interface.h b/libguile/gdb_interface.h index 36a099537..dd8aac3d9 100644 --- a/libguile/gdb_interface.h +++ b/libguile/gdb_interface.h @@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The author can be reached at djurfeldt@nada.kth.se Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */ +#ifndef GDB_INTERFACE_H +#define GDB_INTERFACE_H + /* This is the header file for GDB's interpreter interface. The interpreter must supply definitions of all symbols declared in this file. @@ -74,8 +77,6 @@ extern char *gdb_output; extern int gdb_output_length; -#ifdef __STDC__ - /* Return TRUE if the interpreter regards VALUE's type as valid. A lazy implementation is allowed to pass TRUE always. FALSE should only be returned when it is certain that VALUE is not valid. @@ -83,7 +84,7 @@ extern int gdb_output_length; In the "lisp/c" language mode, this is used to heuristically discriminate lisp values from C values during printing. */ -extern int gdb_maybe_valid_type_p (GDB_TYPE value); +extern int gdb_maybe_valid_type_p SCM_P ((GDB_TYPE value)); /* Parse expression in string STR. Store result in GDB_RESULT, then return 0 to indicate success. On error, return -1 to indicate @@ -92,7 +93,7 @@ extern int gdb_maybe_valid_type_p (GDB_TYPE value); no message is passed. Please note that the resulting value should be protected against garbage collection. */ -extern int gdb_read (char *str); +extern int gdb_read SCM_P ((char *str)); /* Evaluate expression EXP. Store result in GDB_RESULT, then return 0 to indicate success. On error, return -1 to indicate failure. Any @@ -101,7 +102,7 @@ extern int gdb_read (char *str); if no output is passed. Please note that the resulting lisp object should be protected against garbage collection. */ -extern int gdb_eval (GDB_TYPE exp); +extern int gdb_eval SCM_P ((GDB_TYPE exp)); /* Print VALUE. Store output in GDB_OUTPUT and GDB_OUTPUT_LENGTH. Return 0 to indicate success. On error, return -1 to indicate @@ -109,7 +110,7 @@ extern int gdb_eval (GDB_TYPE exp); failure. Note that this function should be robust against strange values. It could in fact be passed any kind of value. */ -extern int gdb_print (GDB_TYPE value); +extern int gdb_print SCM_P ((GDB_TYPE value)); /* Bind NAME to VALUE in interpreter. (GDB has previously obtained NAME by passing a string to gdb_read.) Return 0 to indicate @@ -121,18 +122,6 @@ extern int gdb_print (GDB_TYPE value); For scheme interpreters, this function should introduce top-level bindings. */ -extern int gdb_binding (GDB_TYPE name, GDB_TYPE value); - -#else - -extern int gdb_maybe_valid_type_p (); - -extern int gdb_read (); - -extern int gdb_eval (); - -extern int gdb_print (); - -extern int gdb_binding (); +extern int gdb_binding SCM_P ((GDB_TYPE name, GDB_TYPE value)); -#endif /* __STDC__ */ +#endif /* GDB_INTERFACE_H */ diff --git a/libguile/genio.c b/libguile/genio.c index 815c9ffb3..5ebd86e3f 100644 --- a/libguile/genio.c +++ b/libguile/genio.c @@ -52,30 +52,26 @@ -#ifdef __STDC__ -static void -scm_putc (int c, SCM port) -#else + +static void scm_putc SCM_P ((int c, SCM port)); + static void scm_putc (c, port) int c; SCM port; -#endif { scm_sizet i = SCM_PTOBNUM (port); SCM_SYSCALL ((scm_ptobs[i].fputc) (c, SCM_STREAM (port))); } -#ifdef __STDC__ -static void -scm_puts (char *s, SCM port) -#else + +static void scm_puts SCM_P ((char *s, SCM port)); + static void scm_puts (s, port) char *s; SCM port; -#endif { scm_sizet i = SCM_PTOBNUM (port); SCM_SYSCALL ((scm_ptobs[i].fputs) (s, SCM_STREAM (port))); @@ -86,17 +82,15 @@ scm_puts (s, port) } -#ifdef __STDC__ -static int -scm_lfwrite (char *ptr, scm_sizet size, scm_sizet nitems, SCM port) -#else + +static int scm_lfwrite SCM_P ((char *ptr, scm_sizet size, scm_sizet nitems, SCM port)); + static int scm_lfwrite (ptr, size, nitems, port) char *ptr; scm_sizet size; scm_sizet nitems; SCM port; -#endif { int ret; scm_sizet i = SCM_PTOBNUM (port); @@ -111,15 +105,11 @@ scm_lfwrite (ptr, size, nitems, port) -#ifdef __STDC__ -void -scm_gen_putc (int c, SCM port) -#else + void scm_gen_putc (c, port) int c; SCM port; -#endif { switch (SCM_PORT_REPRESENTATION (port)) { @@ -168,18 +158,12 @@ scm_gen_putc (c, port) -#ifdef __STDC__ -void -scm_gen_puts (enum scm_string_representation_type rep, - char *str_data, - SCM port) -#else + void scm_gen_puts (rep, str_data, port) enum scm_string_representation_type rep; - unsigned char *str_data; + char *str_data; SCM port; -#endif { switch (rep) { @@ -285,17 +269,13 @@ scm_gen_puts (rep, str_data, port) -#ifdef __STDC__ -void -scm_gen_write (enum scm_string_representation_type rep, char *str_data, scm_sizet nitems, SCM port) -#else + void scm_gen_write (rep, str_data, nitems, port) enum scm_string_representation_type rep; char *str_data; scm_sizet nitems; SCM port; -#endif { /* is nitems bytes or characters in the mb_string case? */ @@ -401,33 +381,27 @@ scm_gen_write (rep, str_data, nitems, port) -#ifdef __STDC__ -static int -scm_getc (SCM port) -#else + +static int scm_getc SCM_P ((SCM port)); + static int scm_getc (port) SCM port; -#endif { - FILE *f; + SCM f; int c; scm_sizet i; - f = (FILE *)SCM_STREAM (port); + f = SCM_STREAM (port); i = SCM_PTOBNUM (port); SCM_SYSCALL (c = (scm_ptobs[i].fgetc) (f)); return c; } -#ifdef __STDC__ -int -scm_gen_getc (SCM port) -#else + int scm_gen_getc (port) SCM port; -#endif { int c; @@ -512,15 +486,11 @@ scm_gen_getc (port) } } -#ifdef __STDC__ -void -scm_gen_ungetc (int c, SCM port) -#else + void scm_gen_ungetc (c, port) int c; SCM port; -#endif { /* SCM_ASSERT(!SCM_CRDYP(port), port, SCM_ARG2, "too many scm_gen_ungetc");*/ SCM_CUNGET (c, port); diff --git a/libguile/gscm.h b/libguile/gscm.h index e35f6e8b5..7e0554e5e 100644 --- a/libguile/gscm.h +++ b/libguile/gscm.h @@ -265,33 +265,17 @@ typedef int GSCM_status; -#ifdef __STDC__ -extern GSCM_status gscm_seval_str (SCM *answer, GSCM_top_level toplvl, char * str); -extern GSCM_status gscm_seval_file (SCM *answer, GSCM_top_level toplvl, char * file_name); -extern GSCM_status gscm_eval_str (char ** answer, GSCM_top_level toplvl, char * str); -extern GSCM_status gscm_eval_file (char ** answer, GSCM_top_level toplvl, char * file_name); -extern GSCM_status gscm_run_scm (int argc, char ** argv, FILE * in, FILE * out, FILE * err, GSCM_status (*initfn)(), char * initfile, char * initcmd); -extern char * gscm_error_msg (int n); -extern SCM gscm_make_subr (SCM (*fn)(), int req, int opt, int varp, char * doc); -extern int gscm_2_char (SCM c); -extern void gscm_2_str (char ** out, int * len_out, SCM * objp); -extern void gscm_error (char * message, SCM args); -extern void scm_init_guile (void); - -#else /* STDC */ -extern GSCM_status gscm_seval_str (); -extern void format_load_command (); -extern GSCM_status gscm_seval_file (); -extern GSCM_status gscm_eval_str (); -extern GSCM_status gscm_eval_file (); -extern char * gscm_error_msg (); -extern SCM gscm_make_subr (); -extern int gscm_2_char (); -extern void gscm_2_str (); -extern void gscm_error (); -extern GSCM_status gscm_run_scm (); -extern void scm_init_guile (); - -#endif /* STDC */ +extern GSCM_status gscm_seval_str SCM_P ((SCM *answer, GSCM_top_level toplvl, char * str)); +extern GSCM_status gscm_seval_file SCM_P ((SCM *answer, GSCM_top_level toplvl, char * file_name)); +extern GSCM_status gscm_eval_str SCM_P ((char ** answer, GSCM_top_level toplvl, char * str)); +extern GSCM_status gscm_eval_file SCM_P ((char ** answer, GSCM_top_level toplvl, char * file_name)); +extern GSCM_status gscm_run_scm SCM_P ((int argc, char ** argv, FILE * in, FILE * out, FILE * err, GSCM_status (*initfn)(void), char * initfile, char * initcmd)); +extern char * gscm_error_msg SCM_P ((int n)); +extern SCM gscm_make_subr SCM_P ((SCM (*fn)(), int req, int opt, int varp, char * doc)); +extern int gscm_2_char SCM_P ((SCM c)); +extern void gscm_2_str SCM_P ((char ** out, int * len_out, SCM * objp)); +extern void gscm_error SCM_P ((char * message, SCM args)); +extern void scm_init_guile SCM_P ((void)); + #endif /* GSCMH */ diff --git a/libguile/ports.h b/libguile/ports.h index 4cbba8ea1..46d0f5cad 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -138,16 +138,16 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */ typedef struct scm_ptobfuns { - SCM (*mark) (); - int (*free) (); - int (*print) (); - SCM (*equalp) (); - int (*fputc) (); - int (*fputs) (); - scm_sizet (*fwrite) (); - int (*fflush) (); - int (*fgetc) (); - int (*fclose) (); + SCM (*mark) SCM_P ((SCM)); + int (*free) SCM_P ((SCM)); + int (*print) SCM_P ((SCM exp, SCM port, scm_print_state *pstate)); + SCM (*equalp) SCM_P ((SCM, SCM)); + int (*fputc) SCM_P ((int, SCM stream)); + int (*fputs) SCM_P ((char *, SCM stream)); + scm_sizet (*fwrite) SCM_P ((char *ptr, scm_sizet size, scm_sizet nitems, SCM stream)); + int (*fflush) SCM_P ((SCM stream)); + int (*fgetc) SCM_P ((SCM stream)); + int (*fclose) SCM_P ((SCM stream)); } scm_ptobfuns; #define SCM_PTOBNUM(x) (0x0ff & (SCM_CAR(x)>>8)); @@ -159,93 +159,42 @@ extern scm_sizet scm_numptob; extern int scm_port_table_room; -#ifdef __STDC__ -extern SCM scm_markstream (SCM ptr); -extern long scm_newptob (scm_ptobfuns *ptob); -extern void scm_fflush (SCM port); -extern SCM scm_char_ready_p (SCM port); -extern SCM scm_ungetc_char_ready_p (SCM port); -extern SCM scm_current_input_port (void); -extern SCM scm_current_output_port (void); -extern SCM scm_current_error_port (void); -extern SCM scm_set_current_input_port (SCM port); -extern SCM scm_set_current_output_port (SCM port); -extern SCM scm_set_current_error_port (SCM port); -extern struct scm_port_table * scm_add_to_port_table (SCM port); -extern void scm_remove_from_port_table (SCM port); -extern SCM scm_pt_size (void); -extern SCM scm_pt_member (SCM member); -extern int scm_revealed_count (SCM port); -extern SCM scm_port_revealed (SCM port); -extern SCM scm_set_port_revealed_x (SCM port, SCM rcount); -extern SCM scm_close_port (SCM port); -extern SCM scm_close_all_ports_except (SCM ports); -extern SCM scm_input_port_p (SCM x); -extern SCM scm_output_port_p (SCM x); -extern SCM scm_eof_object_p (SCM x); -extern SCM scm_force_output (SCM port); -extern SCM scm_read_char (SCM port); -extern SCM scm_peek_char (SCM port); -extern SCM scm_unread_char (SCM cobj, SCM port); -extern SCM scm_port_line (SCM port); -extern SCM scm_port_column (SCM port); -extern SCM scm_port_filename (SCM port); -extern SCM scm_set_port_filename_x (SCM port, SCM filename); -extern void scm_prinport (SCM exp, SCM port, char *type); -extern void scm_ports_prehistory (void); -extern SCM scm_void_port (char * mode_str); -extern SCM scm_sys_make_void_port (SCM mode); -extern void scm_init_ports (void); - -#else /* STDC */ -extern SCM scm_markstream (); -extern long scm_newptob (); -extern void scm_fflush (); -extern SCM scm_char_ready_p (); -extern SCM scm_ungetc_char_ready_p (); -extern SCM scm_current_input_port (); -extern SCM scm_current_output_port (); -extern SCM scm_current_error_port (); -extern SCM scm_set_current_input_port (); -extern SCM scm_set_current_output_port (); -extern SCM scm_set_current_error_port (); -extern struct scm_port_table * scm_add_to_port_table (); -extern void scm_remove_from_port_table (); -extern SCM scm_pt_size (); -extern SCM scm_pt_member (); -extern int scm_revealed_count (); -extern SCM scm_port_revealed (); -extern SCM scm_set_port_revealed_x (); -extern SCM scm_close_port (); -extern SCM scm_close_all_ports_except (); -extern SCM scm_input_port_p (); -extern SCM scm_output_port_p (); -extern SCM scm_eof_object_p (); -extern SCM scm_force_output (); -extern SCM scm_read_char (); -extern SCM scm_peek_char (); -extern SCM scm_unread_char (); -extern SCM scm_port_line (); -extern SCM scm_port_column (); -extern SCM scm_port_filename (); -extern SCM scm_set_port_filename_x (); -extern void scm_prinport (); -extern void scm_ports_prehistory (); -extern SCM scm_void_port (); -extern SCM scm_sys_make_void_port (); -extern void scm_init_ports (); - -#endif /* STDC */ - - - - - - - - - - +extern SCM scm_markstream SCM_P ((SCM ptr)); +extern long scm_newptob SCM_P ((scm_ptobfuns *ptob)); +extern void scm_fflush SCM_P ((SCM port)); +extern SCM scm_char_ready_p SCM_P ((SCM port)); +extern SCM scm_ungetc_char_ready_p SCM_P ((SCM port)); +extern SCM scm_current_input_port SCM_P ((void)); +extern SCM scm_current_output_port SCM_P ((void)); +extern SCM scm_current_error_port SCM_P ((void)); +extern SCM scm_set_current_input_port SCM_P ((SCM port)); +extern SCM scm_set_current_output_port SCM_P ((SCM port)); +extern SCM scm_set_current_error_port SCM_P ((SCM port)); +extern struct scm_port_table * scm_add_to_port_table SCM_P ((SCM port)); +extern void scm_remove_from_port_table SCM_P ((SCM port)); +extern SCM scm_pt_size SCM_P ((void)); +extern SCM scm_pt_member SCM_P ((SCM member)); +extern int scm_revealed_count SCM_P ((SCM port)); +extern SCM scm_port_revealed SCM_P ((SCM port)); +extern SCM scm_set_port_revealed_x SCM_P ((SCM port, SCM rcount)); +extern SCM scm_close_port SCM_P ((SCM port)); +extern SCM scm_close_all_ports_except SCM_P ((SCM ports)); +extern SCM scm_input_port_p SCM_P ((SCM x)); +extern SCM scm_output_port_p SCM_P ((SCM x)); +extern SCM scm_eof_object_p SCM_P ((SCM x)); +extern SCM scm_force_output SCM_P ((SCM port)); +extern SCM scm_read_char SCM_P ((SCM port)); +extern SCM scm_peek_char SCM_P ((SCM port)); +extern SCM scm_unread_char SCM_P ((SCM cobj, SCM port)); +extern SCM scm_port_line SCM_P ((SCM port)); +extern SCM scm_port_column SCM_P ((SCM port)); +extern SCM scm_port_filename SCM_P ((SCM port)); +extern SCM scm_set_port_filename_x SCM_P ((SCM port, SCM filename)); +extern void scm_prinport SCM_P ((SCM exp, SCM port, char *type)); +extern void scm_ports_prehistory SCM_P ((void)); +extern SCM scm_void_port SCM_P ((char * mode_str)); +extern SCM scm_sys_make_void_port SCM_P ((SCM mode)); +extern void scm_init_ports SCM_P ((void)); #endif /* PORTSH */ |