core: display: Prepare for pointer cells, M2-Planet.
Rewrite C-constructs not supported by M2-Planet if (foo) -> if (foo != 0) if (!foo) -> if (foo == 0) ; -> 0; // ... -> /* ... */ * src/display.c (display_helper): Use cell_ref.
This commit is contained in:
parent
19ecbfe950
commit
99040a38c4
|
@ -86,17 +86,18 @@ char *g_arena;
|
||||||
SCM cell_arena;
|
SCM cell_arena;
|
||||||
SCM cell_zero;
|
SCM cell_zero;
|
||||||
|
|
||||||
#if POINTER_CELLS
|
#if !POINTER_CELLS
|
||||||
SCM g_free;
|
|
||||||
long g_stack;
|
|
||||||
#else
|
|
||||||
long g_free;
|
long g_free;
|
||||||
SCM g_stack;
|
long g_symbol;
|
||||||
|
#else
|
||||||
|
SCM g_free;
|
||||||
|
SCM g_symbol;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SCM *g_stack_array;
|
SCM *g_stack_array;
|
||||||
struct scm *g_cells;
|
struct scm *g_cells;
|
||||||
struct scm *g_news;
|
struct scm *g_news;
|
||||||
|
long g_stack;
|
||||||
|
|
||||||
char **__execl_c_argv;
|
char **__execl_c_argv;
|
||||||
char *__getcwd_buf;
|
char *__getcwd_buf;
|
||||||
|
|
|
@ -42,8 +42,9 @@ fdwrite_char (char v, int fd)
|
||||||
fdputs ("\\vtab", fd);
|
fdputs ("\\vtab", fd);
|
||||||
else if (v == '\f')
|
else if (v == '\f')
|
||||||
fdputs ("\\page", fd);
|
fdputs ("\\page", fd);
|
||||||
//Nyacc bug
|
/* Nyacc bug
|
||||||
// else if (v == '\r') fdputs ("return", fd);
|
else if (v == '\r') fdputs ("return", fd);
|
||||||
|
*/
|
||||||
else if (v == 13)
|
else if (v == 13)
|
||||||
fdputs ("\\return", fd);
|
fdputs ("\\return", fd);
|
||||||
else if (v == ' ')
|
else if (v == ' ')
|
||||||
|
@ -73,17 +74,14 @@ fdwrite_string_char (char v, int fd)
|
||||||
fdputs ("\\n", fd);
|
fdputs ("\\n", fd);
|
||||||
else if (v == '\f')
|
else if (v == '\f')
|
||||||
fdputs ("\\f", fd);
|
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)
|
else if (v == 13)
|
||||||
fdputs ("\\r", fd);
|
fdputs ("\\r", fd);
|
||||||
else if (v == 27)
|
else if (v == 27)
|
||||||
fdputs ("\\e", fd);
|
fdputs ("\\e", fd);
|
||||||
#else
|
|
||||||
//else if (v == '\r') fdputs ("\\r", fd);
|
|
||||||
//Nyacc crash
|
|
||||||
//else if (v == '\e') fdputs ("\\e", fd);
|
|
||||||
#endif
|
|
||||||
else if (v == '\\')
|
else if (v == '\\')
|
||||||
fdputs ("\\\\", fd);
|
fdputs ("\\\\", fd);
|
||||||
else if (v == '"')
|
else if (v == '"')
|
||||||
|
@ -168,11 +166,11 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x && x != cell_nil)
|
if (x != 0 && x != cell_nil)
|
||||||
fdisplay_ (CAR (x), fd, write_p);
|
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);
|
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)
|
if (TYPE (CDR (x)) != TPAIR)
|
||||||
fdputs (" . ", fd);
|
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);
|
fdisplay_ (REF (x), fd, write_p);
|
||||||
else if (t == TSTRUCT)
|
else if (t == TSTRUCT)
|
||||||
{
|
{
|
||||||
//SCM printer = STRUCT (x) + 1;
|
|
||||||
SCM printer = struct_ref_ (x, STRUCT_PRINTER);
|
SCM printer = struct_ref_ (x, STRUCT_PRINTER);
|
||||||
if (TYPE (printer) == TREF)
|
if (TYPE (printer) == TREF)
|
||||||
printer = REF (printer);
|
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)
|
for (i = 2; i < size; i = i + 1)
|
||||||
{
|
{
|
||||||
fdputc (' ', fd);
|
fdputc (' ', fd);
|
||||||
fdisplay_ (STRUCT (x) + i, fd, write_p);
|
fdisplay_ (cell_ref (STRUCT (x), i), fd, write_p);
|
||||||
}
|
}
|
||||||
fdputc ('>', fd);
|
fdputc ('>', fd);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +242,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
fdputc (' ', fd);
|
fdputc (' ', fd);
|
||||||
fdisplay_ (VECTOR (x) + i, fd, write_p);
|
fdisplay_ (cell_ref (VECTOR (x), i), fd, write_p);
|
||||||
}
|
}
|
||||||
fdputc (')', fd);
|
fdputc (')', fd);
|
||||||
}
|
}
|
||||||
|
@ -257,7 +254,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p)
|
||||||
fdputs (itoa (x), fd);
|
fdputs (itoa (x), fd);
|
||||||
fdputs (">", fd);
|
fdputs (">", fd);
|
||||||
}
|
}
|
||||||
return 0;
|
return cell_unspecified;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
|
|
16
src/gc.c
16
src/gc.c
|
@ -62,6 +62,7 @@ gc_init ()
|
||||||
ARENA_SIZE = 100000000; /* 2.3GiB */
|
ARENA_SIZE = 100000000; /* 2.3GiB */
|
||||||
#elif ! __M2_PLANET__
|
#elif ! __M2_PLANET__
|
||||||
ARENA_SIZE = 300000; /* 32b: 3MiB, 64b: 6 MiB */
|
ARENA_SIZE = 300000; /* 32b: 3MiB, 64b: 6 MiB */
|
||||||
|
ARENA_SIZE = 600000; /* 32b: 6MiB, 64b: 12 MiB */
|
||||||
#else
|
#else
|
||||||
ARENA_SIZE = 20000000;
|
ARENA_SIZE = 20000000;
|
||||||
#endif
|
#endif
|
||||||
|
@ -573,25 +574,26 @@ gc_ ()
|
||||||
gc_up_arena ();
|
gc_up_arena ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if POINTER_CELLS
|
SCM new_cell_nil = g_free;
|
||||||
SCM save_gfree = g_free;
|
|
||||||
#endif
|
|
||||||
SCM s;
|
SCM s;
|
||||||
for (s = cell_nil; s < g_symbol_max; s = s + M2_CELL_SIZE)
|
for (s = cell_nil; s < g_symbol_max; s = s + M2_CELL_SIZE)
|
||||||
gc_copy (s);
|
gc_copy (s);
|
||||||
|
|
||||||
#if POINTER_CELLS
|
#if POINTER_CELLS
|
||||||
|
cell_nil = new_cell_nil;
|
||||||
|
|
||||||
#if GC_TEST
|
#if GC_TEST
|
||||||
cell_nil = save_gfree;
|
cell_zero = cell_nil - M2_CELL_SIZE;
|
||||||
|
g_symbol_max = g_free;
|
||||||
#else
|
#else
|
||||||
long save_gsymbols = g_symbols;
|
long save_gsymbols = g_symbols;
|
||||||
cell_nil = save_gfree;
|
|
||||||
g_symbols = 0;
|
g_symbols = 0;
|
||||||
g_free = save_gfree;
|
g_free = new_cell_nil;
|
||||||
init_symbols_ ();
|
init_symbols_ ();
|
||||||
g_symbol_max = g_symbol;
|
g_symbol_max = g_symbol;
|
||||||
g_symbols = save_gsymbols;
|
g_symbols = save_gsymbols;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_symbols = gc_copy (g_symbols);
|
g_symbols = gc_copy (g_symbols);
|
||||||
|
@ -602,7 +604,7 @@ gc_ ()
|
||||||
for (i = g_stack; i < STACK_SIZE; i = i + 1)
|
for (i = g_stack; i < STACK_SIZE; i = i + 1)
|
||||||
copy_stack (i, gc_copy (g_stack_array[i]));
|
copy_stack (i, gc_copy (g_stack_array[i]));
|
||||||
|
|
||||||
gc_loop (cell_nil);
|
gc_loop (new_cell_nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
|
|
Loading…
Reference in a new issue