Hi Doug, > Basically replacing main() with: > ... > void miniPicoLisp_init( const char * home_dir ) > { > heapAlloc(); > initSymbols(); > > if (home_dir) { > int l = strlen(home_dir) + 1; > Home = malloc( l ); > memcpy(Home, home_dir, l ); > Home[ l ] = '\0'; > } > > Reloc = Nil; > InFile = stdin, Env.get = getStdin; > OutFile = stdout, Env.put = putStdout; > > // ?? > ApplyArgs = cons(cons(consSym(Nil,0), Nil), Nil); > ApplyBody = cons(Nil,Nil); > }
Yes, the Apply* lines are needed (or what does the "??" imply?). I see one remaining problem: The 'ErrRst' global, the error restart jump buffer, is not initialized. This may cause a crash if a runtime error occurs. So I would include something like if (setjmp(ErrRst)) error_Message_or_exit() > { > return load(NULL, 0, mkStr(str)); > } Doesn't this have the disadvantage that 'str' must always begin with a minus sign? Regarding the question of cleanup: I would write a function void miniPicoLisp_stop(void) which is identical to bye(), except for the exit() at the end. Cheers, - Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe