From 28a2fc3eff46249ae6bc7720b6231f8a328c65c8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 29 Oct 2019 15:16:13 +0100 Subject: [PATCH] core: display: Prepare for pointer cells, M2-Planet. * src/display.c (display_helper): Use cell_ref, return. etc --- include/mes/mes.h | 11 ++++++----- src/display.c | 29 +++++++++++++---------------- src/gc.c | 1 + 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/include/mes/mes.h b/include/mes/mes.h index f1180b9c..27d79378 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -86,17 +86,18 @@ char *g_arena; SCM cell_arena; SCM cell_zero; -#if POINTER_CELLS -SCM g_free; -long g_stack; -#else +#if !POINTER_CELLS long g_free; -SCM g_stack; +long g_symbol; +#else +SCM g_free; +SCM g_symbol; #endif SCM *g_stack_array; struct scm *g_cells; struct scm *g_news; +long g_stack; char **__execl_c_argv; char *__getcwd_buf; diff --git a/src/display.c b/src/display.c index 34984f6a..de548ac4 100644 --- a/src/display.c +++ b/src/display.c @@ -42,8 +42,9 @@ fdwrite_char (char v, int fd) fdputs ("\\vtab", fd); else if (v == '\f') fdputs ("\\page", fd); - //Nyacc bug - // else if (v == '\r') fdputs ("return", fd); + /* Nyacc bug + else if (v == '\r') fdputs ("return", fd); + */ else if (v == 13) fdputs ("\\return", fd); else if (v == ' ') @@ -73,17 +74,14 @@ fdwrite_string_char (char v, int fd) fdputs ("\\n", fd); else if (v == '\f') fdputs ("\\f", fd); -#if 1 //__MESC__ - //Nyacc bug + /* Nyacc bug + else if (v == '\r') fdputs ("\\r", fd); + else if (v == '\e') fdputs ("\\e", fd); + */ else if (v == 13) fdputs ("\\r", fd); else if (v == 27) fdputs ("\\e", fd); -#else - //else if (v == '\r') fdputs ("\\r", fd); - //Nyacc crash - //else if (v == '\e') fdputs ("\\e", fd); -#endif else if (v == '\\') fdputs ("\\\\", fd); else if (v == '"') @@ -168,11 +166,11 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p) } else { - if (x && x != cell_nil) + if (x != 0 && x != cell_nil) fdisplay_ (CAR (x), fd, write_p); - if (CDR (x) && TYPE (CDR (x)) == TPAIR) + if (CDR (x) != 0 && TYPE (CDR (x)) == TPAIR) display_helper (CDR (x), 1, " ", fd, write_p); - else if (CDR (x) && CDR (x) != cell_nil) + else if (CDR (x) != 0 && CDR (x) != cell_nil) { if (TYPE (CDR (x)) != TPAIR) fdputs (" . ", fd); @@ -215,7 +213,6 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p) fdisplay_ (REF (x), fd, write_p); else if (t == TSTRUCT) { - //SCM printer = STRUCT (x) + 1; SCM printer = struct_ref_ (x, STRUCT_PRINTER); if (TYPE (printer) == TREF) printer = REF (printer); @@ -231,7 +228,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p) for (i = 2; i < size; i = i + 1) { fdputc (' ', fd); - fdisplay_ (STRUCT (x) + i, fd, write_p); + fdisplay_ (cell_ref (STRUCT (x), i), fd, write_p); } fdputc ('>', fd); } @@ -245,7 +242,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p) { if (i != 0) fdputc (' ', fd); - fdisplay_ (VECTOR (x) + i, fd, write_p); + fdisplay_ (cell_ref (VECTOR (x), i), fd, write_p); } fdputc (')', fd); } @@ -257,7 +254,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p) fdputs (itoa (x), fd); fdputs (">", fd); } - return 0; + return cell_unspecified; } SCM diff --git a/src/gc.c b/src/gc.c index 955dfc83..4f90eed4 100644 --- a/src/gc.c +++ b/src/gc.c @@ -65,6 +65,7 @@ gc_init () ARENA_SIZE = 100000000; /* 2.3GiB */ #elif ! __M2_PLANET__ ARENA_SIZE = 300000; /* 32b: 3MiB, 64b: 6 MiB */ + ARENA_SIZE = 600000; /* 32b: 6MiB, 64b: 12 MiB */ #else ARENA_SIZE = 20000000; #endif