From: Joe Marshall Date: Wed, 18 Aug 2010 00:02:05 +0000 (-0700) Subject: Add appropriate const qualifiers for anal compiler. X-Git-Tag: 20101212-Gtk~95^2~1 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=028ec6ef3d96c2ce0d1c3b3df040b1c6d1d99d94;p=mit-scheme.git Add appropriate const qualifiers for anal compiler. --- diff --git a/src/microcode/debug.c b/src/microcode/debug.c index 8d51ff617..39e93943e 100644 --- a/src/microcode/debug.c +++ b/src/microcode/debug.c @@ -37,13 +37,13 @@ USA. static void do_printing (outf_channel, SCHEME_OBJECT, bool); static bool print_primitive_name (outf_channel, SCHEME_OBJECT); -static void print_expression (outf_channel, SCHEME_OBJECT, char *); +static void print_expression (outf_channel, SCHEME_OBJECT, const char *); /* Compiled Code Debugging */ #ifdef CC_SUPPORT_P -char * +const char * compiled_entry_filename (SCHEME_OBJECT entry) { SCHEME_OBJECT result = (compiled_entry_debug_filename (entry)); @@ -320,7 +320,7 @@ Print_Vector (SCHEME_OBJECT vector) } static void -print_expression (outf_channel stream, SCHEME_OBJECT expression, char * string) +print_expression (outf_channel stream, SCHEME_OBJECT expression, const char * string) { if ((string [0]) != 0) outf (stream, "%s: ", string); @@ -328,7 +328,7 @@ print_expression (outf_channel stream, SCHEME_OBJECT expression, char * string) } void -Print_Expression (SCHEME_OBJECT expression, char * string) +Print_Expression (SCHEME_OBJECT expression, const char * string) { print_expression (ERROR_OUTPUT, expression, string); } diff --git a/src/microcode/extern.h b/src/microcode/extern.h index 03b79669f..73554f60b 100644 --- a/src/microcode/extern.h +++ b/src/microcode/extern.h @@ -158,10 +158,10 @@ extern SCHEME_OBJECT fixed_objects; extern SCHEME_OBJECT ephemeron_array; extern unsigned long ephemeron_count; -extern char * CONT_PRINT_RETURN_MESSAGE; -extern char * CONT_PRINT_EXPR_MESSAGE; -extern char * RESTORE_CONT_RETURN_MESSAGE; -extern char * RESTORE_CONT_EXPR_MESSAGE; +extern const char * CONT_PRINT_RETURN_MESSAGE; +extern const char * CONT_PRINT_EXPR_MESSAGE; +extern const char * RESTORE_CONT_RETURN_MESSAGE; +extern const char * RESTORE_CONT_EXPR_MESSAGE; extern unsigned long MAX_RETURN; @@ -317,7 +317,7 @@ extern void import_primitive_table extern void initialize_primitives (void); extern SCHEME_OBJECT make_primitive (const char *, int); -extern SCHEME_OBJECT find_primitive_cname (char *, bool, bool, int); +extern SCHEME_OBJECT find_primitive_cname (const char *, bool, bool, int); extern SCHEME_OBJECT find_primitive (SCHEME_OBJECT, bool, bool, int); /* Interpreter utilities */ @@ -351,7 +351,7 @@ extern void Debug_Stack_Trace (void); extern void Debug_Print (SCHEME_OBJECT, bool); extern void Show_Env (SCHEME_OBJECT); extern void Print_Return (char *); -extern void Print_Expression (SCHEME_OBJECT, char *); +extern void Print_Expression (SCHEME_OBJECT, const char *); extern void Print_Primitive (SCHEME_OBJECT); #endif /* not SCM_EXTERN_H */ diff --git a/src/microcode/findprim.c b/src/microcode/findprim.c index 75710f41f..9695021f8 100644 --- a/src/microcode/findprim.c +++ b/src/microcode/findprim.c @@ -142,16 +142,16 @@ char external_variable [] = "MAX_EXTERNAL_PRIMITIVE"; FILE * input; FILE * output; -char * name; -char * file_name; +const char * name; +const char * file_name; struct descriptor { - char * c_name; /* The C name of the function */ - char * arity; /* Number of arguments */ - char * scheme_name; /* Scheme name of the primitive */ - char * documentation; /* Documentation string */ - char * file_name; /* File where found. */ + const char * c_name; /* The C name of the function */ + const char * arity; /* Number of arguments */ + const char * scheme_name; /* Scheme name of the primitive */ + const char * documentation; /* Documentation string */ + const char * file_name; /* File where found. */ }; int buffer_index; @@ -183,8 +183,8 @@ char inexistent_error_string [] = TOKEN_PROCESSOR scan (void); bool whitespace (int c); int compare_descriptors (struct descriptor * d1, struct descriptor * d2); -int read_index (char * arg, char * identification); -int strcmp_ci (char * s1, char * s2); +int read_index (const char * arg, const char * identification); +int strcmp_ci (const char * s1, const char * s2); pseudo_void create_alternate_entry (void); pseudo_void create_builtin_entry (void); pseudo_void create_normal_entry (void); @@ -206,7 +206,7 @@ void print_spaces (FILE * output, int how_many); void print_entry (FILE * output, int index, struct descriptor * primitive_descriptor); void process (void); -void process_argument (char * fn); +void process_argument (const char * fn); void scan_to_token_start (void); void skip_token (void); void sort (void); @@ -318,7 +318,7 @@ main (int argc, char ** argv) } void -process_argument (char * fn) +process_argument (const char * fn) { file_name = fn; if ((strcmp ("-", file_name)) == 0) @@ -520,7 +520,7 @@ void print_primitives (FILE * output, int limit) { int count; - char * table_entry; + const char * table_entry; /* Print the procedure table. */ fprintf @@ -697,7 +697,7 @@ enum tokentype }; void -copy_token (char ** target, int * size, enum tokentype token_type) +copy_token (const char ** target, int * size, enum tokentype token_type) { int c; TOKEN_BUFFER_DECLS (); @@ -999,7 +999,7 @@ create_builtin_entry (void) struct descriptor desc; int length; int index; - char * index_buffer; + const char * index_buffer; COPY_C_NAME (desc); COPY_ARITY (desc); @@ -1040,7 +1040,7 @@ create_builtin_entry (void) } int -read_index (char * arg, char * identification) +read_index (const char * arg, const char * identification) { int result = 0; if (((arg [0]) == '0') && ((arg [1]) == 'x')) @@ -1181,7 +1181,7 @@ compare_descriptors (struct descriptor * d1, struct descriptor * d2) } int -strcmp_ci (char * s1, char * s2) +strcmp_ci (const char * s1, const char * s2) { int length1 = (strlen (s1)); int length2 = (strlen (s2)); diff --git a/src/microcode/prbfish.c b/src/microcode/prbfish.c index 4b604dfa2..1f308a7f3 100644 --- a/src/microcode/prbfish.c +++ b/src/microcode/prbfish.c @@ -236,7 +236,7 @@ Returned value is the new value of NUM.") #ifdef COMPILE_AS_MODULE -char * +const char * dload_initialize_file (void) { declare_primitive diff --git a/src/microcode/prename.h b/src/microcode/prename.h index 546538e6f..aca2e9407 100644 --- a/src/microcode/prename.h +++ b/src/microcode/prename.h @@ -30,8 +30,8 @@ USA. struct primitive_alias_s { - char * alias; - char * name; + const char * alias; + const char * name; }; static struct primitive_alias_s primitive_aliases [] = diff --git a/src/microcode/primutl.c b/src/microcode/primutl.c index 00b2f1007..a45f95a68 100644 --- a/src/microcode/primutl.c +++ b/src/microcode/primutl.c @@ -107,7 +107,7 @@ Prim_unimplemented (void) } static void -initialization_error (char * reason, char * item) +initialization_error (const char * reason, const char * item) { outf_fatal ("initialize_primitives: Error %s %s.\n", reason, item); termination_init_error (); @@ -329,7 +329,7 @@ make_primitive (const char * name, int arity) } SCHEME_OBJECT -find_primitive_cname (char * name, bool intern_p, bool allow_p, int arity) +find_primitive_cname (const char * name, bool intern_p, bool allow_p, int arity) { tree_node prim = (tree_lookup (prim_procedure_tree, name)); if (prim != 0) diff --git a/src/microcode/prmd5.c b/src/microcode/prmd5.c index fa7f35864..e681c07fc 100644 --- a/src/microcode/prmd5.c +++ b/src/microcode/prmd5.c @@ -153,7 +153,7 @@ Finalize CONTEXT and return the digest as a 16-byte string.") #ifdef COMPILE_AS_MODULE -char * +const char * dload_initialize_file (void) { declare_primitive diff --git a/src/microcode/prosio.c b/src/microcode/prosio.c index 9ea92b65b..a0230ed05 100644 --- a/src/microcode/prosio.c +++ b/src/microcode/prosio.c @@ -115,7 +115,7 @@ DEFINE_PRIMITIVE ("CHANNEL-TYPE", Prim_channel_type, 1, 1, } /* Must match definition of `enum channel_type' in "osio.h". */ -static char * channel_type_names [] = +static const char * channel_type_names [] = { "unknown", "file", diff --git a/src/microcode/prx11.c b/src/microcode/prx11.c index 1aed240a7..2f4068d3e 100644 --- a/src/microcode/prx11.c +++ b/src/microcode/prx11.c @@ -32,7 +32,7 @@ extern void dload_initialize_x11color (void); extern void dload_initialize_x11graph (void); extern void dload_initialize_x11term (void); -char * +const char * dload_initialize_file (void) { diff --git a/src/microcode/storage.c b/src/microcode/storage.c index e28abc6c6..432734020 100644 --- a/src/microcode/storage.c +++ b/src/microcode/storage.c @@ -112,10 +112,10 @@ unsigned long gc_space_needed; unsigned int local_circle [100]; #endif -char * CONT_PRINT_RETURN_MESSAGE = "SAVE_CONT, return code"; -char * CONT_PRINT_EXPR_MESSAGE = "SAVE_CONT, expression"; -char * RESTORE_CONT_RETURN_MESSAGE = "RESTORE_CONT, return code"; -char * RESTORE_CONT_EXPR_MESSAGE = "RESTORE_CONT, expression"; +const char * CONT_PRINT_RETURN_MESSAGE = "SAVE_CONT, return code"; +const char * CONT_PRINT_EXPR_MESSAGE = "SAVE_CONT, expression"; +const char * RESTORE_CONT_RETURN_MESSAGE = "RESTORE_CONT, return code"; +const char * RESTORE_CONT_EXPR_MESSAGE = "RESTORE_CONT, expression"; /* Interpreter code name and message tables */ diff --git a/src/microcode/utils.c b/src/microcode/utils.c index 5eac8950b..c57a98545 100644 --- a/src/microcode/utils.c +++ b/src/microcode/utils.c @@ -38,7 +38,7 @@ SCHEME_OBJECT * history_register; unsigned long prev_restore_history_offset; static SCHEME_OBJECT copy_history (SCHEME_OBJECT); -static void error_death (long, char *) NORETURN; +static void error_death (long, const char *) NORETURN; /* Helper procedures for setup_interrupt, which follows. */ @@ -181,7 +181,7 @@ err_print (long error_code, outf_channel where) long death_blow; static void -error_death (long code, char * message) +error_death (long code, const char * message) { death_blow = code; outf_fatal ("\nMicrocode Error: %s.\n", message); diff --git a/src/microcode/x11.h b/src/microcode/x11.h index 65bd7bd00..ac0349efc 100644 --- a/src/microcode/x11.h +++ b/src/microcode/x11.h @@ -303,13 +303,13 @@ extern int x_debug; extern void * x_malloc (unsigned int size); extern void * x_realloc (void * ptr, unsigned int size); -extern char * x_get_default +extern const char * x_get_default (Display * display, const char * resource_name, const char * resource_class, const char * property_name, const char * property_class, - char * sdefault); + const char * sdefault); extern void x_default_attributes (Display * display, diff --git a/src/microcode/x11base.c b/src/microcode/x11base.c index 52709a040..8a5ca3310 100644 --- a/src/microcode/x11base.c +++ b/src/microcode/x11base.c @@ -331,7 +331,7 @@ any_x_errors_p (Display * display) static int x_decode_color (Display * display, Colormap color_map, - char * color_name, + const char * color_name, unsigned long * color_return) { XColor cdef; @@ -386,15 +386,15 @@ x_set_mouse_colors (Display * display, XRecolorCursor (display, mouse_cursor, (&mouse_color), (&background_color)); } -char * +const char * x_get_default (Display * display, const char * resource_name, const char * resource_class, const char * property_name, const char * property_class, - char * sdefault) + const char * sdefault) { - char * result = (XGetDefault (display, resource_name, property_name)); + const char * result = (XGetDefault (display, resource_name, property_name)); if (result != 0) return (result); result = (XGetDefault (display, resource_class, property_name)); @@ -417,7 +417,7 @@ x_default_color (Display * display, const char * property_class, unsigned long default_color) { - char * color_name + const char * color_name = (x_get_default (display, resource_name, resource_class, property_name, property_class, 0)); unsigned long result; @@ -450,7 +450,7 @@ x_default_attributes (Display * display, if ((attributes->font) == 0) error_external_return (); { - char * s + const char * s = (x_get_default (display, resource_name, resource_class, "borderWidth", "BorderWidth", @@ -458,7 +458,7 @@ x_default_attributes (Display * display, (attributes->border_width) = ((s == 0) ? 0 : (atoi (s))); } { - char * s + const char * s = (x_get_default (display, resource_name, resource_class, "internalBorder", "BorderWidth", @@ -893,7 +893,7 @@ xw_process_event (struct xwindow * xw, XEvent * event) { if (x_debug > 0) { - char * type_name; + const char * type_name; fprintf (stderr, "\nX event on 0x%lx: ", ((event->xany) . window)); switch (event->type) {