running LISP interpreter as background process
I try to run some lisp interpreter as a background process communicating with other applications by reading and writing from files.
The intention is as follows:
- I start the lisp interpreter as a backgroud process
- a file with initial commands (initfile) is loaded
- the interpreter stays active, waiting for additional commands or an exit signal
- every time a new line is added to the initfile (or another specified file) the interpreter reads this line, evaluates it and writes the output to another file
- the interpreter stops when receiving order to do so....
My problem is:
every time the interpreter reaches the initfile's EOF it exits, so I have to reload the whole thing with every new line
- clisp <infile >outfile &
- nohup 0<&- 1<infile >outfile &
- nohup 0<&- >/dev/null #no way to communicate
All without success
I hope you can help me, thx
Ps: I am working on a x86 32Bit with linux
You could use a fifo:
if you have an init file for clisp
clisp -i init.lisp
it won't exit then.
and it will be in normal interactive mode.
You cannot monitor a file in the way you suggest.
when you open a file it's read there and then and closed, any
subsequent changes will not work.
A fifo won't do what you want either.
what are you trying to do?
(It's good to see someone using lisp though.)
sockets are easy if you want them...
Here is a simple socket server...
clisp -i your-init-file socket.lisp
to illustrate it
you can interact in another xterm using netcat
nc localhost 50123
I have a program with an output like this:
(spec bird (prop has_wings))))
The program spits that kind of code out whenever it has computed its own input.
Now I have three problems:
1. How do I feed my program time after time (solved by FIFO)
2. How do i lookup the data:
here the problems are:
1. I dont know the structures depht (which is variable) 2. I dont know how to retrieve the information once stored because of 1.
3. How to store it in a DB (solved conceptually by my own)
what sort of data structure?
is it a hash-table?
now you wondered why lisp has read macros and prin1
did you know that you can prin1 a lisp data structure out to a file
(a list, a hash table etc.)
then read it back in again as is!
|All times are GMT -5. The time now is 11:52 AM.|