41 #include "EST_cmd_line.h"
42 #include "EST_cutils.h"
43 #include "EST_Pathname.h"
46 static void siod_lisp_vars(
void);
47 static void siod_load_default_files(
void);
83 int main(
int argc,
char **argv)
88 int stdin_input,interactive;
89 int heap_size = DEFAULT_HEAP_SIZE;
94 "Summary: Scheme in one Defun interpreter, file arguments are loaded\n"+
95 "-b Run in batch mode (no interaction)\n"+
96 "--batch Run in batch mode (no interaction)\n"+
97 "-i Run in interactive mode (default)\n"+
99 " Run in interactive mode (default)\n"+
100 "--pipe Run in pipe mode, reading commands from\n"+
101 " stdin, but no prompt or return values\n"+
102 " are printed (default if stdin not a tty)\n"+
103 "-heap <int> {512000}\n"+
104 " Initial size of heap\n",
108 heap_size = al.
ival(
"-heap");
116 else if ((al.
present(
"--pipe")))
137 siod_init(heap_size);
142 siod_prog_name =
"siod";
147 siod_load_default_files();
149 for (p=files.head(); p != 0; p=p->next())
153 else if (files(p).matches(make_regex(
"^(.*")))
156 l = read_from_string(files(p));
166 siod_print_welcome(
EST_String::cat(
"Modified for ", est_name,
" v", est_tools_version));
167 siod_repl(interactive);
173 static void siod_load_default_files(
void)
183 initfile +=
"init.scm";
185 if (access((
const char *)initfile,R_OK) == 0)
186 vload(initfile,FALSE);
188 cerr <<
"Initialization file " << initfile <<
" not found" << endl;
191 static void siod_lisp_vars(
void)
194 int major=0,minor=0,subminor=0;
201 siod_set_lval(
"libdir",strintern(lib));
203 if (!strcmp(est_ostype,
""))
204 siod_set_lval(
"*ostype*",rintern(est_ostype));
205 siod_set_lval(
"est_version",
206 strcons(strlen(est_tools_version),est_tools_version));
210 int nbits = split(est_tools_version, bits, 4, sep);
213 major = bits[0].Int();
215 minor = bits[1].Int();
217 subminor = bits[2].Int();
219 siod_set_lval(
"est_version_number",
222 cons(flocons(subminor),NIL))));
225 etcdircommon +=
"etc";
228 etcdir += est_ostype;
231 siod_set_lval(
"etc-path",cons(rintern(etcdir),
232 cons(rintern(etcdircommon),NIL)));
238 putenv(wstrdup(
"PATH=" + path));
240 siod_set_lval(
"*modules*",NIL);