core: Remove --dump, --load.

* mes/module/mes/boot-0.scm.in (tty?): Remove --dump, --load.
* src/mes.c (bload_env): Remove.
* src/reader.c (dump): Remove.
This commit is contained in:
Jan Nieuwenhuizen 2018-12-27 16:47:56 +01:00
parent bc9de4ce0c
commit 00289fb651
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 2 additions and 140 deletions

View File

@ -218,9 +218,7 @@
(let* ((option-spec
'((no-auto-compile)
(compiled-path (single-char #\C) (value #t))
(dump)
(help (single-char #\h))
(load)
(load-path (single-char #\L) (value #t))
(main (single-char #\e) (value #t))
(source (single-char #\s) (value #t))
@ -252,10 +250,8 @@ Evaluate code with Mes, interactively or from a script.
The above switches stop argument processing, and pass all
remaining arguments as the value of (command-line).
--dump dump binary program to stdout
-e,--main=MAIN after reading script, apply MAIN to command-line arguments
-h, --help display this help and exit
--load load binary program [module/mes/boot-0.32-mo]
-L,--load-path=DIR add DIR to the front of the module load path
-v, --version display version information and exit

View File

@ -53,7 +53,7 @@ SCM *g_stack_array = 0;
SCM r0 = 0;
// param 1
SCM r1 = 0;
// save 2+load/dump
// save 2
SCM r2 = 0;
// continuation
SCM r3 = 0;
@ -2546,72 +2546,6 @@ load_env () ///((internal))
return r2;
}
SCM
bload_env () ///((internal))
{
#if !POSIX
char *mo = "mes/boot-0.32-mo";
g_stdin = open ("module/mes/boot-0.32-mo", O_RDONLY);
char *read0 = MODULEDIR "/mes/boot-0.32-mo";
g_stdin = g_stdin >= 0 ? g_stdin : open (read0, O_RDONLY);
#else
char *mo ="mes/boot-0.mo";
g_stdin = open ("module/mes/boot-0.mo", O_RDONLY);
g_stdin = g_stdin >= 0 ? g_stdin : open (MODULEDIR "/mes/boot-0.mo", O_RDONLY);
#endif
if (g_stdin < 0)
{
eputs ("no such file: ");
eputs (mo);
eputs ("\n");
return 1;
}
assert (getchar () == 'M');
assert (getchar () == 'E');
assert (getchar () == 'S');
if (g_debug)
eputs ("*GOT MES*\n");
g_stack = getchar () << 8;
g_stack += getchar ();
char *p = (char*)g_cells;
int c = getchar ();
while (c != EOF)
{
*p++ = c;
c = getchar ();
}
g_free = (p-(char*)g_cells) / sizeof (struct scm);
gc_peek_frame ();
g_symbols = r1;
g_stdin = STDIN;
// SCM a = struct_ref (r0, 4);
// a = mes_builtins (a);
// struct_set_x (r0, 4, a);
r0 = mes_builtins (r0);
if (g_debug > 3)
{
eputs ("symbols: ");
write_error_ (g_symbols);
eputs ("\n");
eputs ("functions: ");
eputs (itoa (g_function));
eputs ("\n");
for (int i = 0; i < g_function; i++)
{
eputs ("[");
eputs (itoa (i));
eputs ("]: ");
eputs (g_functions[i].name);
eputs ("\n");
}
}
return r2;
}
#include "src/vector.c"
#include "src/strings.c"
#include "src/struct.c"
@ -2655,12 +2589,7 @@ main (int argc, char *argv[])
if (g_debug > 3)
module_printer (m0);
SCM program = (argc > 1 && !strcmp (argv[1], "--load"))
? bload_env () : load_env ();
g_tiny = argc > 2 && !strcmp (argv[2], "--tiny");
if (argc > 1 && !strcmp (argv[1], "--dump"))
return dump ();
SCM program = load_env ();
push_cc (r2, cell_unspecified, r0, cell_unspecified);
if (g_debug > 2)

View File

@ -477,66 +477,3 @@ reader_read_string ()
g_buf[i] = 0;
return make_string (g_buf, i);
}
int g_tiny = 0;
int
dump ()
{
r1 = g_symbols;
gc_push_frame ();
gc ();
gc_peek_frame ();
char *p = (char*)g_cells;
putchar ('M');
putchar ('E');
putchar ('S');
putchar (g_stack >> 8);
putchar (g_stack % 256);
eputs ("dumping\n");
// 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=");
display_error_ (r2);
eputs ("\n");
}
long i;
for (i=0; i<g_free * sizeof (struct scm); i = i + 1)
{
putchar (p[0]);
p = p + 1;
}
return 0;
}