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);
49 void siod_server_init(
void);
51 int main(
int argc,
char **argv)
56 int stdin_input,interactive;
57 int heap_size = DEFAULT_HEAP_SIZE;
62 "Summary: Scheme in one Defun interpreter, file arguments are loaded\n"+
63 "-b Run in batch mode (no interaction)\n"+
64 "--batch Run in batch mode (no interaction)\n"+
65 "-i Run in interactive mode (default)\n"+
67 " Run in interactive mode (default)\n"+
68 "--pipe Run in pipe mode, reading commands from\n"+
69 " stdin, but no prompt or return values\n"+
70 " are printed (default if stdin not a tty)\n"+
71 "-heap <int> {512000}\n"+
72 " Initial size of heap\n",
76 heap_size = al.
ival(
"-heap");
84 else if ((al.
present(
"--pipe")))
105 siod_init(heap_size);
110 siod_prog_name =
"siod";
115 siod_load_default_files();
117 for (p=files.head(); p != 0; p=p->next())
121 else if (files(p).matches(make_regex(
"^(.*")))
124 l = read_from_string(files(p));
134 siod_print_welcome(
EST_String::cat(
"Modified for ", est_name,
" v", est_tools_version));
135 siod_repl(interactive);
141 static void siod_load_default_files(
void)
151 initfile +=
"init.scm";
153 if (access((
const char *)initfile,R_OK) == 0)
154 vload(initfile,FALSE);
156 cerr <<
"Initialization file " << initfile <<
" not found" << endl;
159 static void siod_lisp_vars(
void)
162 int major=0,minor=0,subminor=0;
168 siod_set_lval(
"libdir",strintern(lib));
172 siod_set_lval(
"datadir",strintern(lib));
174 if (!strcmp(est_ostype,
""))
175 siod_set_lval(
"*ostype*",rintern(est_ostype));
176 siod_set_lval(
"est_version",
177 strcons(strlen(est_tools_version),est_tools_version));
181 int nbits = split(est_tools_version, bits, 4, sep);
184 major = bits[0].Int();
186 minor = bits[1].Int();
188 subminor = bits[2].Int();
190 siod_set_lval(
"est_version_number",
193 cons(flocons(subminor),NIL))));
200 putenv(wstrdup(
"PATH=" + path));
202 siod_set_lval(
"*modules*",NIL);
int ival(const EST_String &rkey, int m=1) const
A Regular expression class to go with the CSTR EST_String class.
static EST_String cat(const EST_String s1, const EST_String s2=Empty, const EST_String s3=Empty, const EST_String s4=Empty, const EST_String s5=Empty, const EST_String s6=Empty, const EST_String s7=Empty, const EST_String s8=Empty, const EST_String s9=Empty)
const int present(const K &rkey) const
Returns true if key is present.