Hi all,
I'm fairly new to CL, but I do have some experience with using clisp. I was
wondering how well CL can be used for doing "frontends" to other programs--
specifically for creating things like just simple text based menus for
command line programs. I know that there is the (run-program) function
under clisp, but I've also heard about opening streams. Looking at the
hyperspec, I haven't really seen anything about using streams that will
allow me to run a program with command line switches and capture output
from that program.
Is this something that CL is really well suited for, or should I be looking
elsewhere?
Thanks,
Jeremy
Hi Jeremy Whetzel,
> I'm fairly new to CL, but I do have some experience with using clisp. I
> was wondering how well CL can be used for doing "frontends" to other
> programs-- specifically for creating things like just simple text based
> menus for command line programs. I know that there is the (run-program)
> function under clisp, but I've also heard about opening streams. Looking
> at the hyperspec, I haven't really seen anything about using streams
> that will allow me to run a program with command line switches and
> capture output from that program.
>
> Is this something that CL is really well suited for, or should I be
> looking elsewhere?
I came across rep-gtk the other day:
http://rep-gtk.sourceforge.net/
This would be a good solution if you wanted to build GTK GUI based menus.
The hello world is elegant: http://rep-gtk.sourceforge.net/hello.jl
More on topic, these are the notes that tell you how to run and capture
shell output using CLISP:
http://clisp.sourceforge.net/impnotes.html#shell
Regards,
Adam
> Looking at the hyperspec, I haven't really seen anything about using
> streams that will allow me to run a program with command line
> switches and capture output from that program.
The concept of "running programs" is OS-specific. There really are
powerful, real-world OSs with no concept of running programs. (Genera
is one example that springs to mind, and Genera had a big effect on
the shape of Common Lisp.) The HyperSpec only documents the CL
standard; it does not discuss everything that your CL implementation
offers.
My point is, for OS-specific tasks, look at the docs for your CL
implementation, not the HyperSpec.
Cheers,
joelh
Joel Ray Holveck <·····@juniper.net> wrote:
>> Looking at the hyperspec, I haven't really seen anything about using
>> streams that will allow me to run a program with command line
>> switches and capture output from that program.
>
>The concept of "running programs" is OS-specific. There really are
>powerful, real-world OSs with no concept of running programs. (Genera
>is one example that springs to mind, and Genera had a big effect on
>the shape of Common Lisp.)
Sorry for going on an off-topic tangent, but I can't resist asking
about this. How do programs run on OSs with no concept of running
programs? What invokes the program? What happens when the program ends?
Can you elaborate a little bit?
(I don't have much experience about OSs other than *N*X systems.)
The world rejoiced as ········@engin.umich.edu (Sayan Bhattacharyya) wrote:
> Joel Ray Holveck <·····@juniper.net> wrote:
>>> Looking at the hyperspec, I haven't really seen anything about using
>>> streams that will allow me to run a program with command line
>>> switches and capture output from that program.
>>
>>The concept of "running programs" is OS-specific. There really are
>>powerful, real-world OSs with no concept of running programs. (Genera
>>is one example that springs to mind, and Genera had a big effect on
>>the shape of Common Lisp.)
>
> Sorry for going on an off-topic tangent, but I can't resist asking
> about this. How do programs run on OSs with no concept of running
> programs? What invokes the program? What happens when the program ends?
> Can you elaborate a little bit?
>
> (I don't have much experience about OSs other than *N*X systems.)
On a system like Genera, what you've got is a Lisp environment that's
basically a big memory image with all the code for all of the
"applications" you plan to use.
You load up an editor...
(load "zmacs")
And that loads in a bunch of functions, defines classes, variable
bindings, and all that sort of "stuff."
And when you want to invoke the editor, you don't run a "program;" you
just have to invoke the function to open an editor window for whatever
file you want to edit.
If you want to see this in action without having to buy an Alpha box
and searching to see if you can find someone to buy Genera from, you
might try searching out "Squeak," the Smalltalk environment. (It
bears quite a marked resemblance to a "Lisp Machine" environment, and
is well worth a look.)
You invoke the Squeak process, and it pops up a window inside which
the Squeak environment does its thing. There's a web browser called
"Scamper" that is part of the Squeak environment; once the
code for Scamper gets compiled, it is bound to the environment.
Once loaded, Scamper becomes part of the Squeak environment, and
"invoking" it merely requires calling a Smalltalk function, "Scamper
open," and passing a URL to it.
Scamper isn't a "program;" it's part of the Squeak environment. It's
just kind of "there." When you're done, you close the window, and the
browser instance gets garbage collected. The code is still in the
environment, so invoking it again just requires invoking "Scamper
open" again.
Three notable complexities arise from this that are quite different
from Unix:
a) There's not necessarily a trivial way to say "get rid of that."
If all the code is tied to a particular namespace, you might query
the namespace for its symbols, and delete them all.
That's quite opposite from the "Unix way," where once a process
does an exit(), all the memory and program tied to it gets
automagically reaped and thrown back to the system.
b) If you always want Scamper (or the equivalent) loaded, you need to
have some way of dumping the environment.
This wouldn't be meaningful _at all_ on Unix, although Emacs and
TeX and Perl have all had a history of having "dumpers" that allow
you to load a whack of code in along with the binary executable,
and then save the combination.
That speeds up later invokations, as it takes some time for these
systems' interpreters to load in code. If you always use 42
different Perl libraries, for instance, this means that those 42
libraries would be integrated into the binary, thus meaning you
don't have to load each of them at runtime, thus consuming dynamic
memory as well as CPU time for the load/compile.
c) Rebuilding the environment cleanly can become a hassle.
If you wind up customizing a whack of stuff and then saving the
environment so that it always loads up thus customized, it may be
quite troublesome some time down the road if you want to upgrade to
a new version of Squeak/Genera as it may be problematic to figure
out which bits of "environmental change" ought to be brought into
the new version and how they should be brought in.
a) and c) both dictate that you have decent tools around to inspect
the environment as well as making intelligent use of namespaces to
organize the customizations to wherever they properly belong.
--
(concatenate 'string "cbbrowne" ·@acm.org")
http://cbbrowne.com/info/
Rules of the Evil Overlord #154. "I will instruct my Legions of Terror
in proper search techniques. In particular, if they are searching for
escapees and someone shouts, "Quick! They went that way!", they must
first ascertain the identity of this helpful informant before dashing
off in hot pursuit." <http://www.eviloverlord.com/>
On Tue, 09 Jul 2002 23:28:16 +0000, Jeremy Whetzel
<······@iamthethinker.com> wrote:
> I'm fairly new to CL, but I do have some experience with using clisp. I was
> wondering how well CL can be used for doing "frontends" to other programs--
You may check the gnuplot interface included with `cllib' which, in turn,
is part of CLOCC (Common Lisp Open Code Collection):
http://clocc.sourceforge.net
See the file src/cllib/gnuplot.lisp.
Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README