2016-11-21 08:36:32 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2016-11-21 08:36:32 +00:00
|
|
|
*
|
|
|
|
* This file is part of Mes.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-05-02 21:30:46 +00:00
|
|
|
#include <ctype.h>
|
mini-mes: Merge with mes.c: lib.c, math.c, posix.c.
* mes.c: Include math.c after posix.c.
(assert_defined, check_formals, check_apply, load_env,
bload_env): Move from lib.c
* scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h,
math.c, mini-posix.h, posix.c.
(greater_p, less_p, is_p, minus, plus, divide, modulo, multiply,
logior, ash): Remove.
(ungetchar, peekchar, peek_byte, read_byte, write_byte,
string_to_cstring, getenv_, open_input_file, current_input_port,
set_current_input_port, force_output): Remove.
(mes_builtins): include mini-lib.i, mini-lib.environment.i.
mini-math.i, mini-math.environment.i mini-posix.i,
mini-posix.environment.i.
* GNUmakefile (guile-mini-mes): Add dependencies.
2017-04-08 13:01:24 +00:00
|
|
|
|
core: Move reader and posix functions from mes.c
* mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte, read_input_file_env_, read_input_file_env):
Remove.
* posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte): Move from mes.c.
* reader (read_input_file_env_, read_input_file_env): Move from mes.c.
2016-12-24 10:28:25 +00:00
|
|
|
SCM
|
|
|
|
read_input_file_env_ (SCM e, SCM a)
|
|
|
|
{
|
2018-04-05 19:35:31 +00:00
|
|
|
if (e == cell_nil)
|
|
|
|
return e;
|
core: Move reader and posix functions from mes.c
* mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte, read_input_file_env_, read_input_file_env):
Remove.
* posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte): Move from mes.c.
* reader (read_input_file_env_, read_input_file_env): Move from mes.c.
2016-12-24 10:28:25 +00:00
|
|
|
return cons (e, read_input_file_env_ (read_env (a), a));
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
|
|
|
read_input_file_env (SCM a)
|
|
|
|
{
|
|
|
|
r0 = a;
|
2018-04-03 05:45:12 +00:00
|
|
|
#if 0
|
core+mini-mes: Replace manual snippets by snarfed includes.
* build-aux/mes-snarf.scm (symbol->source, function->header,
function->source, function->environment): Add workarounds to
avoid struct-copy initializers.
* GNUmakefile (mini-mes): Snarf symbols and functions.
* scaffold/mini-mes.c: Include mini-mes.h, mini-mes.symbols.h,
mini-mes.symbols.i, mini-mes.i, mini-mes.environment.i.
Add snarfable symbol/special definitions.
(type_t): Prefix all types with `T', update users.
(assert_defined, gc_push_frame, gc_peek_frame, gc_init_cells): Mark
as internal.
* mes.c (type_t): Prefix all types with `T', update users.
* scaffold/mini-mes.c (eq_p, type_, car_, cdr_,
list_of_char_equal_p, lookup_macro, write_byte): New functions (from
mes.c).
(assq): Add debugging, workaround.
2017-03-10 19:56:18 +00:00
|
|
|
if (assq_ref_env (cell_symbol_read_input_file, r0) != cell_undefined)
|
core: Rewrite eval_apply in continuation passing style.
* mes.c (scm_vm_evlis, scm_vm_evlis2, scm_vm_evlis3, scm_vm_apply,
scm_vm_apply2, scm_vm_eval, scm_vm_eval_set_x, scm_vm_eval_macro,
scm_vm_eval2, scm_vm_macro_expand, scm_vm_begin,
scm_vm_begin_read_input_file, scm_vm_begin2, scm_vm_if,
scm_vm_if_expr, scm_vm_call_with_values, scm_vm_call_with_values2,
scm_vm_return): New specials.
(scm_vm_eval_car, scm_vm_eval_cdr, scm_vm_eval_cons,
scm_vm_eval_null_p)[PRIMITIVE-EVAL]: New specials.
(eval_apply_t, g_target): Remove.
(push_cc): New function.
(eval_apply): Rewrite.
(vm_call, eval_env, apply_env, eval_env, macro_expand_env, begin_env,
call_with_values_env): Remove.
* posix.c (stderr_): Update.
* reader.c (read_input_file_env): Update.
* module/mes/base-0.mes: Update.
2016-12-28 20:55:42 +00:00
|
|
|
return apply (cell_symbol_read_input_file, cell_nil, r0);
|
2018-04-03 05:45:12 +00:00
|
|
|
#endif
|
core: Move reader and posix functions from mes.c
* mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte, read_input_file_env_, read_input_file_env):
Remove.
* posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte,
unread_byte, write_byte): Move from mes.c.
* reader (read_input_file_env_, read_input_file_env): Move from mes.c.
2016-12-24 10:28:25 +00:00
|
|
|
return read_input_file_env_ (read_env (r0), r0);
|
|
|
|
}
|
|
|
|
|
2016-11-21 08:36:32 +00:00
|
|
|
int
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_line_comment (int c)
|
2016-11-21 08:36:32 +00:00
|
|
|
{
|
|
|
|
if (c == '\n') return c;
|
2018-01-06 06:58:23 +00:00
|
|
|
return reader_read_line_comment (getchar ());
|
2016-11-21 08:36:32 +00:00
|
|
|
}
|
|
|
|
|
2018-01-06 06:58:23 +00:00
|
|
|
SCM reader_read_block_comment (int s, int c);
|
2017-12-11 03:52:00 +00:00
|
|
|
SCM read_hash (int c, SCM w, SCM a);
|
2018-04-05 20:41:53 +00:00
|
|
|
SCM reader_read_list (int c, SCM a);
|
2017-12-11 03:52:00 +00:00
|
|
|
|
2016-11-21 08:36:32 +00:00
|
|
|
SCM
|
2018-04-05 20:41:53 +00:00
|
|
|
reader_read_sexp_ (int c, SCM s, SCM a)
|
2016-11-21 08:36:32 +00:00
|
|
|
{
|
2018-04-05 20:41:53 +00:00
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case ' ':
|
|
|
|
return reader_read_sexp_ ('\n', s, a);
|
|
|
|
case '\f':
|
|
|
|
return reader_read_sexp_ ('\n', s, a);
|
|
|
|
case '\t':
|
|
|
|
return reader_read_sexp_ ('\n', s, a);
|
|
|
|
case ';':
|
|
|
|
reader_read_line_comment (c);
|
|
|
|
return reader_read_sexp_ ('\n', s, a);
|
|
|
|
case '#':
|
|
|
|
return read_hash (getchar (), s, a);
|
|
|
|
case '`':
|
|
|
|
return cons (cell_symbol_quasiquote,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
case ',':
|
|
|
|
if (peekchar () == '@')
|
|
|
|
{
|
|
|
|
getchar ();
|
|
|
|
return cons (cell_symbol_unquote_splicing,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
}
|
|
|
|
return cons (cell_symbol_unquote,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
default:
|
|
|
|
if (s == cell_nil)
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case EOF:
|
|
|
|
return cell_nil;
|
|
|
|
case '\n':
|
|
|
|
return reader_read_sexp_ (getchar (), s, a);
|
|
|
|
case '(':
|
|
|
|
return reader_read_list (getchar (), a);
|
|
|
|
case ')':
|
|
|
|
ungetchar (c);
|
|
|
|
return cell_nil;
|
2018-04-07 11:36:23 +00:00
|
|
|
case '\'':
|
|
|
|
return cons (cell_symbol_quote,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
2018-04-05 20:41:53 +00:00
|
|
|
case '"':
|
|
|
|
return reader_read_string ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case EOF:
|
|
|
|
return reader_lookup_ (s, a);
|
|
|
|
case '\n':
|
|
|
|
if (CAR (s) == cell_dot && CDR (s) == cell_nil)
|
|
|
|
return cell_dot;
|
|
|
|
else
|
|
|
|
return reader_lookup_ (s, a);
|
|
|
|
case '(':
|
|
|
|
ungetchar (c);
|
|
|
|
return reader_lookup_ (s, a);
|
|
|
|
case ')':
|
|
|
|
ungetchar (c);
|
|
|
|
return reader_lookup_ (s, a);
|
|
|
|
case '"':
|
|
|
|
ungetchar (c);
|
|
|
|
return reader_lookup_ (s, a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return reader_read_sexp_ (getchar (),
|
|
|
|
append2 (s, cons (MAKE_CHAR (c), cell_nil)), a);
|
2016-11-21 08:36:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eat_whitespace (int c)
|
|
|
|
{
|
2016-12-16 17:30:54 +00:00
|
|
|
while (c == ' ' || c == '\t' || c == '\n' || c == '\f') c = getchar ();
|
2018-01-06 06:58:23 +00:00
|
|
|
if (c == ';') return eat_whitespace (reader_read_line_comment (c));
|
|
|
|
if (c == '#' && (peekchar () == '!' || peekchar () == '|')) {c=getchar (); reader_read_block_comment (c, getchar ()); return eat_whitespace (getchar ());}
|
2016-11-21 08:36:32 +00:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-04-05 20:41:53 +00:00
|
|
|
reader_read_list (int c, SCM a)
|
2016-11-21 08:36:32 +00:00
|
|
|
{
|
|
|
|
c = eat_whitespace (c);
|
|
|
|
if (c == ')') return cell_nil;
|
2018-04-05 20:41:53 +00:00
|
|
|
SCM s = reader_read_sexp_ (c, cell_nil, a);
|
|
|
|
if (s == cell_dot)
|
|
|
|
return car (reader_read_list (getchar (), a));
|
|
|
|
return cons (s, reader_read_list (getchar (), a));
|
2016-11-21 08:36:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
|
|
|
read_env (SCM a)
|
|
|
|
{
|
2018-04-05 20:41:53 +00:00
|
|
|
return reader_read_sexp_ (getchar (), cell_nil, a);
|
2016-11-21 08:36:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-25 14:58:44 +00:00
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_lookup_ (SCM s, SCM a)
|
2017-03-25 14:58:44 +00:00
|
|
|
{
|
|
|
|
if (isdigit (VALUE (car (s))) || (VALUE (car (s)) == '-' && cdr (s) != cell_nil)) {
|
|
|
|
SCM p = s;
|
|
|
|
int sign = 1;
|
|
|
|
if (VALUE (car (s)) == '-') {
|
|
|
|
sign = -1;
|
|
|
|
p = cdr (s);
|
|
|
|
}
|
|
|
|
int n = 0;
|
|
|
|
while (p != cell_nil && isdigit (VALUE (car (p)))) {
|
|
|
|
n *= 10;
|
|
|
|
n += VALUE (car (p)) - '0';
|
|
|
|
p = cdr (p);
|
|
|
|
}
|
|
|
|
if (p == cell_nil) return MAKE_NUMBER (n * sign);
|
|
|
|
}
|
2016-11-21 08:36:32 +00:00
|
|
|
|
2017-03-25 14:58:44 +00:00
|
|
|
return lookup_symbol_ (s);
|
|
|
|
}
|
mini-mes: Merge with mes.c: lib.c, math.c, posix.c.
* mes.c: Include math.c after posix.c.
(assert_defined, check_formals, check_apply, load_env,
bload_env): Move from lib.c
* scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h,
math.c, mini-posix.h, posix.c.
(greater_p, less_p, is_p, minus, plus, divide, modulo, multiply,
logior, ash): Remove.
(ungetchar, peekchar, peek_byte, read_byte, write_byte,
string_to_cstring, getenv_, open_input_file, current_input_port,
set_current_input_port, force_output): Remove.
(mes_builtins): include mini-lib.i, mini-lib.environment.i.
mini-math.i, mini-math.environment.i mini-posix.i,
mini-posix.environment.i.
* GNUmakefile (guile-mini-mes): Add dependencies.
2017-04-08 13:01:24 +00:00
|
|
|
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_block_comment (int s, int c)
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
|
|
|
if (c == s && peekchar () == '#') return getchar ();
|
2018-01-06 06:58:23 +00:00
|
|
|
return reader_read_block_comment (s, getchar ());
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-04-05 20:41:53 +00:00
|
|
|
read_hash (int c, SCM s, SCM a)
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
2018-04-05 20:41:53 +00:00
|
|
|
switch (c)
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
2018-04-05 20:41:53 +00:00
|
|
|
case '!':
|
|
|
|
reader_read_block_comment (c, getchar ());
|
|
|
|
return reader_read_sexp_ (getchar (), s, a);
|
|
|
|
case '|':
|
|
|
|
reader_read_block_comment (c, getchar ());
|
|
|
|
return reader_read_sexp_ (getchar (), s, a);
|
|
|
|
case 'f':
|
|
|
|
return cell_f;
|
|
|
|
case 't':
|
|
|
|
return cell_t;
|
|
|
|
case ',':
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
if (peekchar () == '@')
|
|
|
|
{
|
|
|
|
getchar ();
|
2018-04-05 20:41:53 +00:00
|
|
|
return cons (cell_symbol_unsyntax_splicing,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a),
|
|
|
|
cell_nil));
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
}
|
2018-04-05 20:41:53 +00:00
|
|
|
return cons (cell_symbol_unsyntax,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
case '\'':
|
|
|
|
return cons (cell_symbol_syntax,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
case '`':
|
|
|
|
return cons (cell_symbol_quasisyntax,
|
|
|
|
cons (reader_read_sexp_ (getchar (), s, a), cell_nil));
|
|
|
|
case ':':
|
|
|
|
return MAKE_KEYWORD (CAR (reader_read_sexp_ (getchar (), cell_nil, a)));
|
|
|
|
case 'o':
|
|
|
|
return reader_read_octal ();
|
|
|
|
case 'x':
|
|
|
|
return reader_read_hex ();
|
|
|
|
case '\\':
|
|
|
|
return reader_read_character ();
|
|
|
|
case '(':
|
|
|
|
return list_to_vector (reader_read_list (getchar (), a));
|
|
|
|
case ';':
|
|
|
|
reader_read_sexp_ (getchar (), s, a);
|
|
|
|
return reader_read_sexp_ (getchar (), s, a);
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
}
|
2018-04-05 20:41:53 +00:00
|
|
|
return reader_read_sexp_ (getchar (),
|
|
|
|
append2 (s, cons (MAKE_CHAR (c), cell_nil)), a);
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-04-05 20:41:53 +00:00
|
|
|
reader_read_sexp (SCM c, SCM s, SCM a)
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
2018-04-05 20:41:53 +00:00
|
|
|
return reader_read_sexp_ (VALUE (c), s, a);
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_character ()
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
|
|
|
int c = getchar ();
|
|
|
|
if (c >= '0' && c <= '7'
|
|
|
|
&& peekchar () >= '0' && peekchar () <= '7')
|
|
|
|
{
|
|
|
|
c = c - '0';
|
|
|
|
while (peekchar () >= '0' && peekchar () <= '7')
|
|
|
|
{
|
|
|
|
c <<= 3;
|
|
|
|
c += getchar () - '0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (((c >= 'a' && c <= 'z')
|
|
|
|
|| c == '*')
|
|
|
|
&& ((peekchar () >= 'a' && peekchar () <= 'z')
|
|
|
|
|| peekchar () == '*'))
|
|
|
|
{
|
|
|
|
char buf[10];
|
|
|
|
char *p = buf;
|
|
|
|
*p++ = c;
|
|
|
|
while ((peekchar () >= 'a' && peekchar () <= 'z')
|
|
|
|
|| peekchar () == '*')
|
|
|
|
{
|
|
|
|
*p++ = getchar ();
|
|
|
|
}
|
|
|
|
*p = 0;
|
|
|
|
if (!strcmp (buf, "*eof*")) c = EOF;
|
|
|
|
else if (!strcmp (buf, "nul")) c = '\0';
|
|
|
|
else if (!strcmp (buf, "alarm")) c = '\a';
|
|
|
|
else if (!strcmp (buf, "backspace")) c = '\b';
|
|
|
|
else if (!strcmp (buf, "tab")) c = '\t';
|
2017-12-09 21:36:53 +00:00
|
|
|
else if (!strcmp (buf, "linefeed")) c = '\n';
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
else if (!strcmp (buf, "newline")) c = '\n';
|
|
|
|
else if (!strcmp (buf, "vtab")) c = '\v';
|
|
|
|
else if (!strcmp (buf, "page")) c = '\f';
|
|
|
|
#if __MESC__
|
|
|
|
//Nyacc bug
|
|
|
|
else if (!strcmp (buf, "return")) c = 13;
|
2017-12-09 21:36:53 +00:00
|
|
|
else if (!strcmp (buf, "esc")) c = 27;
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
#else
|
|
|
|
else if (!strcmp (buf, "return")) c = '\r';
|
2017-12-09 21:36:53 +00:00
|
|
|
//Nyacc crash else if (!strcmp (buf, "esc")) c = '\e';
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
#endif
|
|
|
|
else if (!strcmp (buf, "space")) c = ' ';
|
2017-12-09 21:36:53 +00:00
|
|
|
|
|
|
|
#if 1 // Nyacc uses old abbrevs
|
|
|
|
else if (!strcmp (buf, "bel")) c = '\a';
|
|
|
|
else if (!strcmp (buf, "bs")) c = '\b';
|
|
|
|
else if (!strcmp (buf, "ht")) c = '\t';
|
|
|
|
else if (!strcmp (buf, "vt")) c = '\v';
|
|
|
|
|
|
|
|
#if __MESC__
|
|
|
|
//Nyacc bug
|
|
|
|
else if (!strcmp (buf, "cr")) c = 13;
|
|
|
|
#else
|
|
|
|
else if (!strcmp (buf, "cr")) c = '\r';
|
|
|
|
#endif
|
|
|
|
#endif // Nyacc uses old abbrevs
|
|
|
|
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
eputs ("char not supported: ");
|
|
|
|
eputs (buf);
|
|
|
|
eputs ("\n");
|
|
|
|
#if !__MESC__
|
|
|
|
assert (!"char not supported");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return MAKE_CHAR (c);
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_octal ()
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
int c = peekchar ();
|
|
|
|
int s = 1;
|
|
|
|
if (c == '-') {s = -1;getchar (); c = peekchar ();}
|
|
|
|
while (c >= '0' && c <= '7')
|
|
|
|
{
|
|
|
|
n <<= 3;
|
|
|
|
n+= c - '0';
|
|
|
|
getchar ();
|
|
|
|
c = peekchar ();
|
|
|
|
}
|
|
|
|
return MAKE_NUMBER (s*n);
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_hex ()
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
int c = peekchar ();
|
|
|
|
int s = 1;
|
|
|
|
if (c == '-') {s = -1;getchar (); c = peekchar ();}
|
|
|
|
while ((c >= '0' && c <= '9')
|
|
|
|
|| (c >= 'A' && c <= 'F')
|
|
|
|
|| (c >= 'a' && c <= 'f'))
|
|
|
|
{
|
|
|
|
n <<= 4;
|
|
|
|
if (c >= 'a') n += c - 'a' + 10;
|
|
|
|
else if (c >= 'A') n += c - 'A' + 10;
|
|
|
|
else n+= c - '0';
|
|
|
|
getchar ();
|
|
|
|
c = peekchar ();
|
|
|
|
}
|
|
|
|
return MAKE_NUMBER (s*n);
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
|
|
|
append_char (SCM x, int i)
|
|
|
|
{
|
|
|
|
return append2 (x, cons (MAKE_CHAR (i), cell_nil));
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2018-01-06 06:58:23 +00:00
|
|
|
reader_read_string ()
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
{
|
|
|
|
SCM p = cell_nil;
|
|
|
|
int c = getchar ();
|
|
|
|
while (1) {
|
|
|
|
if (c == '"') break;
|
|
|
|
if (c == '\\' && peekchar () == '\\') p = append_char (p, getchar ());
|
|
|
|
else if (c == '\\' && peekchar () == '"') p = append_char (p, getchar ());
|
|
|
|
else if (c == '\\' && peekchar () == 'n') {getchar (); p = append_char (p, '\n');}
|
2017-12-09 18:33:10 +00:00
|
|
|
else if (c == '\\' && peekchar () == 't') {getchar (); p = append_char (p, '\t');}
|
mes: resurrect full reader in C core.
* module/mes/read-0.mes (defined?): New function.
(eat-whitespace, read-env, read-word, read-block-comment,
read-line-comment, read-list, read-character, read-hex, read-octal,
reader:read-string, lookup, read-hash, read-word): Only define if
not %c-reader.
* module/mes/base-0.mes (defined?): Remove.
* src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000.
(scm_symbol_quasiquote scm_symbol_unquote,
scm_symbol_unquote_splicing, scm_symbol_syntax,
scm_symbol_quasisyntax, scm_symbol_unsyntax,
scm_symbol_unsyntax_splicing): New symbol.
(scm_symbol_c_reader): New symbol.
(MAKE_KEYWORD)[MES_C_READER]: New define.
(mes_symbols): Define %c_reader.
* src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme
reader.
(eat_whitespace)[MES_C_READER]: Likewise.
(read_block_comment, read_hash, read_word, read_character,
read_octal, read_hex, append_char, read_string)[MES_C_READER]:
Likewise.
* make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1.
2017-11-29 20:42:50 +00:00
|
|
|
#if !__MESC__
|
|
|
|
else if (c == EOF) assert (!"EOF in string");
|
|
|
|
#endif
|
|
|
|
else p = append_char (p, c);
|
|
|
|
c = getchar ();
|
|
|
|
}
|
|
|
|
return MAKE_STRING (p);
|
|
|
|
}
|
|
|
|
|
2017-04-12 19:27:59 +00:00
|
|
|
int g_tiny = 0;
|
|
|
|
|
mini-mes: Merge with mes.c: lib.c, math.c, posix.c.
* mes.c: Include math.c after posix.c.
(assert_defined, check_formals, check_apply, load_env,
bload_env): Move from lib.c
* scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h,
math.c, mini-posix.h, posix.c.
(greater_p, less_p, is_p, minus, plus, divide, modulo, multiply,
logior, ash): Remove.
(ungetchar, peekchar, peek_byte, read_byte, write_byte,
string_to_cstring, getenv_, open_input_file, current_input_port,
set_current_input_port, force_output): Remove.
(mes_builtins): include mini-lib.i, mini-lib.environment.i.
mini-math.i, mini-math.environment.i mini-posix.i,
mini-posix.environment.i.
* GNUmakefile (guile-mini-mes): Add dependencies.
2017-04-08 13:01:24 +00:00
|
|
|
int
|
|
|
|
dump ()
|
|
|
|
{
|
|
|
|
r1 = g_symbols;
|
|
|
|
gc_push_frame ();
|
|
|
|
gc ();
|
|
|
|
gc_peek_frame ();
|
|
|
|
char *p = (char*)g_cells;
|
2017-04-12 19:27:59 +00:00
|
|
|
putchar ('M');
|
|
|
|
putchar ('E');
|
|
|
|
putchar ('S');
|
|
|
|
putchar (g_stack >> 8);
|
|
|
|
putchar (g_stack % 256);
|
core: Always include reader.c, drop binary read-0-32.mo dependency.
* module/language/c99/compiler.mes (c99-input->full-ast): Remove
obsolete __NYACC__ and MES_FULL defines.
* src/mes.c [!MES_FULL]: Include reader-mes.h.
(mes_builtins) [!MES_FULL]: Include reader.mes.i, reader.me.environment.i.
[!MES_FULL]: Include reader.c.
(main) [!MES_FULL]: By default call load_env, only call bload_env
when --load is supplied. WAS: Always bload read-0-32.mo.
* src/reader.c (__end_of__mes_): Remove.
(dump): Remove option of dumping tiny test program.
* make/mescc-mes.make ($(OUT)/$(TARGET), mescc.mes-ccompile,
mescc.mes.c-compile-E): Depend on $(OUT)/mes, scripts/mes.
* src/src.make (mes.guile): Remove module/mes/read-32-0 dependency.
Do not build $(OUT)/mes.mes.
* module/module.make (module/mes/read-0.mo, module/mes/read-0-32.mo,
module/mes/tiny-0-32.mo): Remove targets.
(CLEAN): Do not add them. Neither install $(OUT)/mes.mes.
* .gitignore: Remove exceptions for them.
* make/install.make (install): Do not install them.
* HACKING: Update info about creating module/mes/read-32-0.mo.
* scaffold/mini-mes.c: Remove.
* scaffold/tiny-mes.c: Remove.
* scaffold/cons-mes.c: Remove.
* scaffold/scaffold.make (tiny-mes.libc, tiny-mes.guile, tiny-mes.mes,
mini-mes.libc, mini-mes.guile, mini-mes.mes): Reemove targets.
2017-05-28 14:03:45 +00:00
|
|
|
eputs ("dumping\n");
|
|
|
|
if (g_debug > 1)
|
2017-04-17 21:32:02 +00:00
|
|
|
{
|
core: Always include reader.c, drop binary read-0-32.mo dependency.
* module/language/c99/compiler.mes (c99-input->full-ast): Remove
obsolete __NYACC__ and MES_FULL defines.
* src/mes.c [!MES_FULL]: Include reader-mes.h.
(mes_builtins) [!MES_FULL]: Include reader.mes.i, reader.me.environment.i.
[!MES_FULL]: Include reader.c.
(main) [!MES_FULL]: By default call load_env, only call bload_env
when --load is supplied. WAS: Always bload read-0-32.mo.
* src/reader.c (__end_of__mes_): Remove.
(dump): Remove option of dumping tiny test program.
* make/mescc-mes.make ($(OUT)/$(TARGET), mescc.mes-ccompile,
mescc.mes.c-compile-E): Depend on $(OUT)/mes, scripts/mes.
* src/src.make (mes.guile): Remove module/mes/read-32-0 dependency.
Do not build $(OUT)/mes.mes.
* module/module.make (module/mes/read-0.mo, module/mes/read-0-32.mo,
module/mes/tiny-0-32.mo): Remove targets.
(CLEAN): Do not add them. Neither install $(OUT)/mes.mes.
* .gitignore: Remove exceptions for them.
* make/install.make (install): Do not install them.
* HACKING: Update info about creating module/mes/read-32-0.mo.
* scaffold/mini-mes.c: Remove.
* scaffold/tiny-mes.c: Remove.
* scaffold/cons-mes.c: Remove.
* scaffold/scaffold.make (tiny-mes.libc, tiny-mes.guile, tiny-mes.mes,
mini-mes.libc, mini-mes.guile, mini-mes.mes): Reemove targets.
2017-05-28 14:03:45 +00:00
|
|
|
eputs ("program r2=");
|
|
|
|
display_error_ (r2);
|
|
|
|
eputs ("\n");
|
2017-04-17 21:32:02 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 07:33:50 +00:00
|
|
|
for (int i=0; i<g_free * sizeof (struct scm); i++)
|
2017-04-12 19:27:59 +00:00
|
|
|
putchar (*p++);
|
mini-mes: Merge with mes.c: lib.c, math.c, posix.c.
* mes.c: Include math.c after posix.c.
(assert_defined, check_formals, check_apply, load_env,
bload_env): Move from lib.c
* scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h,
math.c, mini-posix.h, posix.c.
(greater_p, less_p, is_p, minus, plus, divide, modulo, multiply,
logior, ash): Remove.
(ungetchar, peekchar, peek_byte, read_byte, write_byte,
string_to_cstring, getenv_, open_input_file, current_input_port,
set_current_input_port, force_output): Remove.
(mes_builtins): include mini-lib.i, mini-lib.environment.i.
mini-math.i, mini-math.environment.i mini-posix.i,
mini-posix.environment.i.
* GNUmakefile (guile-mini-mes): Add dependencies.
2017-04-08 13:01:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|