slang-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] embedding slsh ?


I would be particularly interested in seeing the following functions available from the library:

* slsh_interactive
* slsh_use_readline
* slsh_init_readline_intrinsics

Granted, thats a pretty small chunk of code. It also seems that slsh loads the autoload.sl and slshrl.sl files on start up - and the behavior of the above listed functions does not quite match the behavior of slsh unless those files are loaded. I suppose applications could load those files manually, given the installation prefix to S-lang.

The desired functionality would be to allow the interactive interpreter to access the internals of a running copy/instance of the host program - and be able to take advantage of the existing readline functionality defined in slsh/readline.c.

I hadn't thought about loading part of my application as a module. I'll look into that as well.

Thanks,
~Brian

John E. Davis wrote:
Brian Ahr <brianahr@xxxxxxxxx> wrote:
I am curious if there are any plans to make the interactive S-lang interpreter (slsh) accessible from the S-lang library?

It is possible to embed slsh as it stands now, although applications which do so would probably wind up including parts of slsh, and thus would be required to manually merge any patches/updates to slsh. Having access to slsh through the library would allow applications to embed an interactive S-lang interpreter without having to modify/reuse parts of slsh itself.

I am not exactly sure what parts of slsh you would like to see merged
into the slang library.  In some sense, slsh is a wrapper around the
slang readline routines (SLrline), and the slang interpreter
(SLang_load_*).  There is not much else to it.

If you want your program to prompt for interactive input to be fed to
the slang interpreter, then you can use something as simple as fgets
followed by SLang_load_string.  Alternatively, have you considered
making parts of your application available as a module and then load
that module into slsh?

Thanks,
--John


[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]