From 72e371d77fe01220ecf4527748318ab77113ba1b Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 2 May 2021 14:58:23 +0200 Subject: [PATCH] core: Resurrect gcc-10 support. * include/mes/mes.h (g_datadir, g_debug, g_buf, g_continuations, g_symbols, g_symbol_max, g_mini, R0, R1, R2, R3, M0, g_macros, g_ports, ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE, GC_SAFETY, MAX_STRING, g_arena, cell_arena, cell_zero, g_free, g_symbol, g_stack_array, g_cells, g_news, g_stack, gc_count, gc_start_time, gc_end_time, gc_time, __execl_c_argv, __open_boot_buf, __open_boot_file_name, __setenv_buf, __reader_read_char_buf, g_start_time, __gettimeofday_time, __get_internal_run_time_ts): Declare extern. * include/mes/symbols.h ( cell_nil, cell_f, cell_t, cell_dot, cell_arrow, cell_undefined, cell_unspecified, cell_closure, cell_circular, cell_vm_apply, cell_vm_apply2, cell_vm_begin, cell_vm_begin_eval, cell_vm_begin_expand, cell_vm_begin_expand_eval, cell_vm_begin_expand_macro, cell_vm_begin_expand_primitive_load, cell_vm_begin_primitive_load, cell_vm_begin_read_input_file, cell_vm_call_with_current_continuation2, cell_vm_call_with_values2, cell_vm_eval, cell_vm_eval2, cell_vm_eval_check_func, cell_vm_eval_define, cell_vm_eval_macro_expand_eval, cell_vm_eval_macro_expand_expand, cell_vm_eval_pmatch_car, cell_vm_eval_pmatch_cdr, cell_vm_eval_set_x, cell_vm_evlis, cell_vm_evlis2, cell_vm_evlis3, cell_vm_if, cell_vm_if_expr, cell_vm_macro_expand, cell_vm_macro_expand_car, cell_vm_macro_expand_cdr, cell_vm_macro_expand_define, cell_vm_macro_expand_define_macro, cell_vm_macro_expand_lambda, cell_vm_macro_expand_set_x, cell_vm_return, cell_symbol_lambda, cell_symbol_begin, cell_symbol_if, cell_symbol_quote, cell_symbol_define, cell_symbol_define_macro, cell_symbol_quasiquote, cell_symbol_unquote, cell_symbol_unquote_splicing, cell_symbol_syntax, cell_symbol_quasisyntax, cell_symbol_unsyntax, cell_symbol_unsyntax_splicing, cell_symbol_set_x, cell_symbol_sc_expand, cell_symbol_macro_expand, cell_symbol_portable_macro_expand, cell_symbol_sc_expander_alist, cell_symbol_call_with_values, cell_symbol_call_with_current_continuation, cell_symbol_boot_module, cell_symbol_current_module, cell_symbol_primitive_load, cell_symbol_car, cell_symbol_cdr, cell_symbol_not_a_number, cell_symbol_not_a_pair, cell_symbol_system_error, cell_symbol_throw, cell_symbol_unbound_variable, cell_symbol_wrong_number_of_args, cell_symbol_wrong_type_arg, cell_symbol_buckets, cell_symbol_builtin, cell_symbol_frame, cell_symbol_hashq_table, cell_symbol_module, cell_symbol_procedure, cell_symbol_record_type, cell_symbol_size, cell_symbol_stack, cell_symbol_argv, cell_symbol_mes_datadir, cell_symbol_mes_version, cell_symbol_internal_time_units_per_second, cell_symbol_compiler, cell_symbol_arch, cell_symbol_pmatch_car, cell_symbol_pmatch_cdr, cell_type_bytes, cell_type_char, cell_type_closure, cell_type_continuation, cell_type_function, cell_type_keyword, cell_type_macro, cell_type_number, cell_type_pair, cell_type_port, cell_type_ref, cell_type_special, cell_type_string, cell_type_struct, cell_type_symbol, cell_type_values, cell_type_variable, cell_type_vector, cell_type_broken_heart, cell_symbol_program, cell_symbol_test): Likewise. * src/globals.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. --- build-aux/configure-lib.sh | 1 + include/mes/mes.h | 82 ++++++------- include/mes/symbols.h | 228 ++++++++++++++++++------------------- src/globals.c | 25 ++++ src/symbol.c | 2 - 5 files changed, 181 insertions(+), 157 deletions(-) create mode 100644 src/globals.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 0f09d489..609dcaff 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -439,6 +439,7 @@ src/core.c src/display.c src/eval-apply.c src/gc.c +src/globals.c src/hash.c src/lib.c src/math.c diff --git a/include/mes/mes.h b/include/mes/mes.h index 90abe592..9ef6491e 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -54,59 +54,59 @@ struct scm }; /* mes */ -char *g_datadir; -int g_debug; -char *g_buf; -int g_continuations; -struct scm *g_symbols; -struct scm *g_symbol_max; -int g_mini; +extern char *g_datadir; +extern int g_debug; +extern char *g_buf; +extern int g_continuations; +extern struct scm *g_symbols; +extern struct scm *g_symbol_max; +extern int g_mini; /* a/env */ -struct scm *R0; +extern struct scm *R0; /* param 1 */ -struct scm *R1; +extern struct scm *R1; /* save 2 */ -struct scm *R2; +extern struct scm *R2; /* continuation */ -struct scm *R3; +extern struct scm *R3; /* current-module */ -struct scm *M0; +extern struct scm *M0; /* macro */ -struct scm *g_macros; -struct scm *g_ports; +extern struct scm *g_macros; +extern struct scm *g_ports; /* gc */ -size_t ARENA_SIZE; -size_t MAX_ARENA_SIZE; -size_t STACK_SIZE; -size_t JAM_SIZE; -size_t GC_SAFETY; -size_t MAX_STRING; -char *g_arena; -struct scm *cell_arena; -struct scm *cell_zero; +extern size_t ARENA_SIZE; +extern size_t MAX_ARENA_SIZE; +extern size_t STACK_SIZE; +extern size_t JAM_SIZE; +extern size_t GC_SAFETY; +extern size_t MAX_STRING; +extern char *g_arena; +extern struct scm *cell_arena; +extern struct scm *cell_zero; -struct scm *g_free; -struct scm *g_symbol; +extern struct scm *g_free; +extern struct scm *g_symbol; -struct scm **g_stack_array; -struct scm *g_cells; -struct scm *g_news; -long g_stack; -size_t gc_count; -struct timespec *gc_start_time; -struct timespec *gc_end_time; -size_t gc_time; +extern struct scm **g_stack_array; +extern struct scm *g_cells; +extern struct scm *g_news; +extern long g_stack; +extern size_t gc_count; +extern struct timespec *gc_start_time; +extern struct timespec *gc_end_time; +extern size_t gc_time; -char **__execl_c_argv; -char *__open_boot_buf; -char *__open_boot_file_name; -char *__setenv_buf; -char *__reader_read_char_buf; -struct timespec *g_start_time; -struct timeval *__gettimeofday_time; -struct timespec *__get_internal_run_time_ts; +extern char **__execl_c_argv; +extern char *__open_boot_buf; +extern char *__open_boot_file_name; +extern char *__setenv_buf; +extern char *__reader_read_char_buf; +extern struct timespec *g_start_time; +extern struct timeval *__gettimeofday_time; +extern struct timespec *__get_internal_run_time_ts; struct scm *cast_charp_to_scmp (char const *i); struct scm **cast_charp_to_scmpp (char const *i); diff --git a/include/mes/symbols.h b/include/mes/symbols.h index ec185bdc..490fa1e2 100644 --- a/include/mes/symbols.h +++ b/include/mes/symbols.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,121 +21,121 @@ #ifndef __MES_SYMBOLS_H #define __MES_SYMBOLS_H -struct scm *cell_nil; -struct scm *cell_f; -struct scm *cell_t; -struct scm *cell_dot; -struct scm *cell_arrow; -struct scm *cell_undefined; -struct scm *cell_unspecified; -struct scm *cell_closure; -struct scm *cell_circular; +extern struct scm *cell_nil; +extern struct scm *cell_f; +extern struct scm *cell_t; +extern struct scm *cell_dot; +extern struct scm *cell_arrow; +extern struct scm *cell_undefined; +extern struct scm *cell_unspecified; +extern struct scm *cell_closure; +extern struct scm *cell_circular; -struct scm *cell_vm_apply; -struct scm *cell_vm_apply2; -struct scm *cell_vm_begin; -struct scm *cell_vm_begin_eval; -struct scm *cell_vm_begin_expand; -struct scm *cell_vm_begin_expand_eval; -struct scm *cell_vm_begin_expand_macro; -struct scm *cell_vm_begin_expand_primitive_load; -struct scm *cell_vm_begin_primitive_load; -struct scm *cell_vm_begin_read_input_file; -struct scm *cell_vm_call_with_current_continuation2; -struct scm *cell_vm_call_with_values2; -struct scm *cell_vm_eval; -struct scm *cell_vm_eval2; -struct scm *cell_vm_eval_check_func; -struct scm *cell_vm_eval_define; -struct scm *cell_vm_eval_macro_expand_eval; -struct scm *cell_vm_eval_macro_expand_expand; -struct scm *cell_vm_eval_pmatch_car; -struct scm *cell_vm_eval_pmatch_cdr; -struct scm *cell_vm_eval_set_x; -struct scm *cell_vm_evlis; -struct scm *cell_vm_evlis2; -struct scm *cell_vm_evlis3; -struct scm *cell_vm_if; -struct scm *cell_vm_if_expr; -struct scm *cell_vm_macro_expand; -struct scm *cell_vm_macro_expand_car; -struct scm *cell_vm_macro_expand_cdr; -struct scm *cell_vm_macro_expand_define; -struct scm *cell_vm_macro_expand_define_macro; -struct scm *cell_vm_macro_expand_lambda; -struct scm *cell_vm_macro_expand_set_x; -struct scm *cell_vm_return; +extern struct scm *cell_vm_apply; +extern struct scm *cell_vm_apply2; +extern struct scm *cell_vm_begin; +extern struct scm *cell_vm_begin_eval; +extern struct scm *cell_vm_begin_expand; +extern struct scm *cell_vm_begin_expand_eval; +extern struct scm *cell_vm_begin_expand_macro; +extern struct scm *cell_vm_begin_expand_primitive_load; +extern struct scm *cell_vm_begin_primitive_load; +extern struct scm *cell_vm_begin_read_input_file; +extern struct scm *cell_vm_call_with_current_continuation2; +extern struct scm *cell_vm_call_with_values2; +extern struct scm *cell_vm_eval; +extern struct scm *cell_vm_eval2; +extern struct scm *cell_vm_eval_check_func; +extern struct scm *cell_vm_eval_define; +extern struct scm *cell_vm_eval_macro_expand_eval; +extern struct scm *cell_vm_eval_macro_expand_expand; +extern struct scm *cell_vm_eval_pmatch_car; +extern struct scm *cell_vm_eval_pmatch_cdr; +extern struct scm *cell_vm_eval_set_x; +extern struct scm *cell_vm_evlis; +extern struct scm *cell_vm_evlis2; +extern struct scm *cell_vm_evlis3; +extern struct scm *cell_vm_if; +extern struct scm *cell_vm_if_expr; +extern struct scm *cell_vm_macro_expand; +extern struct scm *cell_vm_macro_expand_car; +extern struct scm *cell_vm_macro_expand_cdr; +extern struct scm *cell_vm_macro_expand_define; +extern struct scm *cell_vm_macro_expand_define_macro; +extern struct scm *cell_vm_macro_expand_lambda; +extern struct scm *cell_vm_macro_expand_set_x; +extern struct scm *cell_vm_return; -struct scm *cell_symbol_lambda; -struct scm *cell_symbol_begin; -struct scm *cell_symbol_if; -struct scm *cell_symbol_quote; -struct scm *cell_symbol_define; -struct scm *cell_symbol_define_macro; -struct scm *cell_symbol_quasiquote; -struct scm *cell_symbol_unquote; -struct scm *cell_symbol_unquote_splicing; -struct scm *cell_symbol_syntax; -struct scm *cell_symbol_quasisyntax; -struct scm *cell_symbol_unsyntax; -struct scm *cell_symbol_unsyntax_splicing; -struct scm *cell_symbol_set_x; -struct scm *cell_symbol_sc_expand; -struct scm *cell_symbol_macro_expand; -struct scm *cell_symbol_portable_macro_expand; -struct scm *cell_symbol_sc_expander_alist; -struct scm *cell_symbol_call_with_values; -struct scm *cell_symbol_call_with_current_continuation; -struct scm *cell_symbol_boot_module; -struct scm *cell_symbol_current_module; -struct scm *cell_symbol_primitive_load; -struct scm *cell_symbol_car; -struct scm *cell_symbol_cdr; -struct scm *cell_symbol_not_a_number; -struct scm *cell_symbol_not_a_pair; -struct scm *cell_symbol_system_error; -struct scm *cell_symbol_throw; -struct scm *cell_symbol_unbound_variable; -struct scm *cell_symbol_wrong_number_of_args; -struct scm *cell_symbol_wrong_type_arg; -struct scm *cell_symbol_buckets; -struct scm *cell_symbol_builtin; -struct scm *cell_symbol_frame; -struct scm *cell_symbol_hashq_table; -struct scm *cell_symbol_module; -struct scm *cell_symbol_procedure; -struct scm *cell_symbol_record_type; -struct scm *cell_symbol_size; -struct scm *cell_symbol_stack; -struct scm *cell_symbol_argv; -struct scm *cell_symbol_mes_datadir; -struct scm *cell_symbol_mes_version; -struct scm *cell_symbol_internal_time_units_per_second; -struct scm *cell_symbol_compiler; -struct scm *cell_symbol_arch; -struct scm *cell_symbol_pmatch_car; -struct scm *cell_symbol_pmatch_cdr; -struct scm *cell_type_bytes; -struct scm *cell_type_char; -struct scm *cell_type_closure; -struct scm *cell_type_continuation; -struct scm *cell_type_function; -struct scm *cell_type_keyword; -struct scm *cell_type_macro; -struct scm *cell_type_number; -struct scm *cell_type_pair; -struct scm *cell_type_port; -struct scm *cell_type_ref; -struct scm *cell_type_special; -struct scm *cell_type_string; -struct scm *cell_type_struct; -struct scm *cell_type_symbol; -struct scm *cell_type_values; -struct scm *cell_type_variable; -struct scm *cell_type_vector; -struct scm *cell_type_broken_heart; -struct scm *cell_symbol_program; -struct scm *cell_symbol_test; +extern struct scm *cell_symbol_lambda; +extern struct scm *cell_symbol_begin; +extern struct scm *cell_symbol_if; +extern struct scm *cell_symbol_quote; +extern struct scm *cell_symbol_define; +extern struct scm *cell_symbol_define_macro; +extern struct scm *cell_symbol_quasiquote; +extern struct scm *cell_symbol_unquote; +extern struct scm *cell_symbol_unquote_splicing; +extern struct scm *cell_symbol_syntax; +extern struct scm *cell_symbol_quasisyntax; +extern struct scm *cell_symbol_unsyntax; +extern struct scm *cell_symbol_unsyntax_splicing; +extern struct scm *cell_symbol_set_x; +extern struct scm *cell_symbol_sc_expand; +extern struct scm *cell_symbol_macro_expand; +extern struct scm *cell_symbol_portable_macro_expand; +extern struct scm *cell_symbol_sc_expander_alist; +extern struct scm *cell_symbol_call_with_values; +extern struct scm *cell_symbol_call_with_current_continuation; +extern struct scm *cell_symbol_boot_module; +extern struct scm *cell_symbol_current_module; +extern struct scm *cell_symbol_primitive_load; +extern struct scm *cell_symbol_car; +extern struct scm *cell_symbol_cdr; +extern struct scm *cell_symbol_not_a_number; +extern struct scm *cell_symbol_not_a_pair; +extern struct scm *cell_symbol_system_error; +extern struct scm *cell_symbol_throw; +extern struct scm *cell_symbol_unbound_variable; +extern struct scm *cell_symbol_wrong_number_of_args; +extern struct scm *cell_symbol_wrong_type_arg; +extern struct scm *cell_symbol_buckets; +extern struct scm *cell_symbol_builtin; +extern struct scm *cell_symbol_frame; +extern struct scm *cell_symbol_hashq_table; +extern struct scm *cell_symbol_module; +extern struct scm *cell_symbol_procedure; +extern struct scm *cell_symbol_record_type; +extern struct scm *cell_symbol_size; +extern struct scm *cell_symbol_stack; +extern struct scm *cell_symbol_argv; +extern struct scm *cell_symbol_mes_datadir; +extern struct scm *cell_symbol_mes_version; +extern struct scm *cell_symbol_internal_time_units_per_second; +extern struct scm *cell_symbol_compiler; +extern struct scm *cell_symbol_arch; +extern struct scm *cell_symbol_pmatch_car; +extern struct scm *cell_symbol_pmatch_cdr; +extern struct scm *cell_type_bytes; +extern struct scm *cell_type_char; +extern struct scm *cell_type_closure; +extern struct scm *cell_type_continuation; +extern struct scm *cell_type_function; +extern struct scm *cell_type_keyword; +extern struct scm *cell_type_macro; +extern struct scm *cell_type_number; +extern struct scm *cell_type_pair; +extern struct scm *cell_type_port; +extern struct scm *cell_type_ref; +extern struct scm *cell_type_special; +extern struct scm *cell_type_string; +extern struct scm *cell_type_struct; +extern struct scm *cell_type_symbol; +extern struct scm *cell_type_values; +extern struct scm *cell_type_variable; +extern struct scm *cell_type_vector; +extern struct scm *cell_type_broken_heart; +extern struct scm *cell_symbol_program; +extern struct scm *cell_symbol_test; // CONSTANT SYMBOL_MAX 114 #define SYMBOL_MAX 114 diff --git a/src/globals.c b/src/globals.c new file mode 100644 index 00000000..43c255f3 --- /dev/null +++ b/src/globals.c @@ -0,0 +1,25 @@ +/* + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2021 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include + +#define extern +#include +#include diff --git a/src/symbol.c b/src/symbol.c index 1b6850f5..11dc9311 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -33,8 +33,6 @@ // CONSTANT M2_CELL_SIZE 12 #endif -struct scm *g_symbol; - struct scm * init_symbol (struct scm *x, long type, char const *name) {