October 2000
Intermediate to advanced
432 pages
9h 9m
English
For all practical purposes, any interpreter is pretty useless if it works only interactively. I have added a 'source' built-in command to 'sic_builtin.c', which takes lines of input from a file and evaluates them using 'sic_repl.c' in much the same way as lines typed at the prompt are evaluated otherwise. Here is the built-in handler:
/* List of built in functions. */
#define builtin_functions \
BUILTIN(exit, 0, 1) \
BUILTIN(load, 1, 1) \
BUILTIN(source, 1, -1) \
BUILTIN(unload, 1, -1)
BUILTIN_DECLARATION (source)
{
int status = SIC_OKAY;
int i;
for (i = 1; status == SIC_OKAY && argv[i]; ++i)
status = source (sic, argv[i]);
return status;
}And the 'source' function from 'sic_repl.c':
int source (Sic ...
Read now
Unlock full access