core: Resurrect dump-tiny.

* src/reader.c (dump): Resurrect dump-tiny.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-18 22:55:23 +02:00
parent 8793e0dde3
commit a1334148ca
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 35 additions and 1 deletions

View file

@ -2391,6 +2391,7 @@ main (int argc, char *argv[])
SCM program = (argc > 1 && !strcmp (argv[1], "--load")) SCM program = (argc > 1 && !strcmp (argv[1], "--load"))
? bload_env (r0) : load_env (r0); ? bload_env (r0) : load_env (r0);
g_tiny = argc > 2 && !strcmp (argv[2], "--tiny");
if (argc > 1 && !strcmp (argv[1], "--dump")) if (argc > 1 && !strcmp (argv[1], "--dump"))
return dump (); return dump ();

View file

@ -458,6 +458,8 @@ reader_read_string ()
return MAKE_STRING (lst); return MAKE_STRING (lst);
} }
int g_tiny = 0;
int int
dump () dump ()
{ {
@ -472,7 +474,38 @@ dump ()
putchar (g_stack >> 8); putchar (g_stack >> 8);
putchar (g_stack % 256); putchar (g_stack % 256);
eputs ("dumping\n"); eputs ("dumping\n");
if (g_debug > 1) // See HACKING, simple crafted dump for tiny-mes.c
if (g_tiny || getenv ("MES_TINY"))
{
eputs ("dumping TINY\n");
TYPE (9) = 0x2d2d2d2d;
CAR (9) = 0x2d2d2d2d;
CDR (9) = 0x3e3e3e3e;
TYPE (10) = TPAIR;
CAR (10) = 11;
CDR (10) = 12;
TYPE (11) = TCHAR;
CAR (11) = 0x58585858;
CDR (11) = 65;
TYPE (12) = TPAIR;
CAR (12) = 13;
CDR (12) = 1;
TYPE (13) = TCHAR;
CAR (11) = 0x58585858;
CDR (13) = 66;
TYPE (14) = 0x3c3c3c3c;
CAR (14) = 0x2d2d2d2d;
CDR (14) = 0x2d2d2d2d;
g_free = 15;
}
else if (g_debug > 1)
{ {
eputs ("program r2="); eputs ("program r2=");
display_error_ (r2); display_error_ (r2);