[comp.lang.lisp.x] exploratory system for unix system calls/facilities

kan@dg-rtp.dg.com (Victor Kan) (10/10/89)

Does anyone know of an interactive environment for playing around with
all those wonderful Unix system calls?

I guess what I'd like is something that will let me try things out without 
having to write/compile/debug C code.  For example, a simple client/server 
using shared memory, semaphores, etc. implemented in a few Lisp expressions 
would run in a couple of terminals (or windows).
Doing this junk in C, needless to say, is a real pain in the butt.

I recall that Byte had a description of XLisp extensions on OS/2 that 
allowed you to use system services interactively.

I'm looking for something like it to run on any major version of Unix,
particularly if it supports IPCs (local and network).

Does Common Lisp on Unix have a package for one type of system service, e.g.
a local-IPC package that gives you all the structures and access functions
for shared memory, semaphores and message queues?


| Victor Kan               | I speak only for myself.               |  ***
| Data General Corporation | Edito cum Emacs, ergo sum.             | ****
| 62 T.W. Alexander Drive  | Columbia Lions Win, 9 October 1988 for | **** %%%%
| RTP, NC  27709           | a record of 1-44.  Way to go, Lions!   |  *** %%%

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (10/12/89)

In article <1753@xyzzy.UUCP> kan@tom.dg.com () writes:
>Does anyone know of an interactive environment for playing around with
>all those wonderful Unix system calls?
>
>I guess what I'd like is something that will let me try things out without 
>having to write/compile/debug C code.  For example, a simple client/server 
>using shared memory, semaphores, etc. implemented in a few Lisp expressions 
>would run in a couple of terminals (or windows).
>Doing this junk in C, needless to say, is a real pain in the butt.

I've added a few "easy" unix system (e.g. system(3), popen(3) etc) calls to
xlisp in my WINTERP X11/Motif application prototyping, development and
delivery environment. Furthermore, in WINTERP, the xlisp read-eval-loop has
been transformed into a lisp server allowing for clients to send
lisp-expressions from other applications distributed across the network. Is
this what you mean by a simple client/server? Haven't touched (nor do i
want to get my hands dirty with) shared memory, semaphores, etc. But then
again, I'm building this system as a platform for our research and
experiments in multimedia computing and groupware, so our aims might be
different.

Mostly, I've been concentrating on making a clean "object-oriented"
interface to the Motif widgets. By the time I release WINTERP, it may also
have an interface to the Xtoolkit's XtAddInput() routine which will provide
for a simple way of having WINTERP maintain open connections to multiple
network clients; intefacing the XtAddWorkProc() routine should allow for
simple internal process scheduling.

I'd certainly be interested in getting any enhancements to xlisp for
supporting some of the uglier aspects of unix hacking in a cleaner fashion.
My winterp code should be publically available by November 24th, and will
hopefully be included on the X11r4 contrib tape.

>I recall that Byte had a description of XLisp extensions on OS/2 that 
>allowed you to use system services interactively.

I haven't seen this. Which issue?

-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *

net@tub.UUCP (Oliver Laumann) (10/13/89)

In article <1753@xyzzy.UUCP> kan@tom.dg.com () writes:
> Does anyone know of an interactive environment for playing around with
> all those wonderful Unix system calls?
> 
> I guess what I'd like is something that will let me try things out without 
> having to write/compile/debug C code.

You may want to have a look at the recently posted Elk Extension Language
Kit.  The distribution contains interfaces to the X11R3 Xlib, the Athena
and HP widgets, and to a couple of UNIX system calls and functions of the
C library.  The latter interface can be easily extended to cover most
system calls and C library functions.

Thus Elk enables you to interactively write and test Scheme code that makes
use of the above mentioned functionality.  Is this what you were looking for?

By the way, I have just completed an Elk interface to the OSF/Motif
widget set.  If someone is interested in a copy, drop me a letter.

Regards,
--
Oliver Laumann              net@TUB.BITNET              net@tub.UUCP

kan@dg-rtp.dg.com (Victor Kan) (10/15/89)

In article <4139@hplabsz.HPL.HP.COM> mayer@hplabs.hp.com (Niels Mayer) writes:
>In article <1753@xyzzy.UUCP> kan@tom.dg.com () writes:
>>Does anyone know of an interactive environment for playing around with
>>all those wonderful Unix system calls?
>>
>I've added a few "easy" unix system (e.g. system(3), popen(3) etc) calls to
>xlisp in my WINTERP X11/Motif application prototyping, development and
>delivery environment. Furthermore, in WINTERP, the xlisp read-eval-loop has
>been transformed into a lisp server allowing for clients to send
>lisp-expressions from other applications distributed across the network. Is
>this what you mean by a simple client/server? Haven't touched (nor do i
>want to get my hands dirty with) shared memory, semaphores, etc. But then
>again, I'm building this system as a platform for our research and
>experiments in multimedia computing and groupware, so our aims might be
>different.

When I say client/server, I'm not refering to a distributed XLISP system,
but client/server prototypes implemented in XLISP.  Hopefully, I could
debug a protocol in the XLISP interpreter rather than a C compiler.

>
>Mostly, I've been concentrating on making a clean "object-oriented"
>interface to the Motif widgets. By the time I release WINTERP, it may also
>have an interface to the Xtoolkit's XtAddInput() routine which will provide
>for a simple way of having WINTERP maintain open connections to multiple
>network clients; intefacing the XtAddWorkProc() routine should allow for
>simple internal process scheduling.
>

Has it been tricky using XLISP rather than C/C++ to interface with the
X library (excuse me, Motif Widgets :-), or has the joy of lisp offset
the headaches?  

>I'd certainly be interested in getting any enhancements to xlisp for
>supporting some of the uglier aspects of unix hacking in a cleaner fashion.
>My winterp code should be publically available by November 24th, and will
>hopefully be included on the X11r4 contrib tape.
>
>>I recall that Byte had a description of XLisp extensions on OS/2 that 
>>allowed you to use system services interactively.
>
>I haven't seen this. Which issue?

I've been looking for the issue for weeks, but finally found it today.
It's in the Byte IBM Special Edition for Fall 1988 (volume 13, #11).
To summarize, C library functions are called with the c-call function.
C style structures are handled like this:

/* from their example */
struct FileFindBuf {
	unsigned create_date;
	unsigned create_time;
	unsigned access_date;
.
.
.
}

becomes:

(define FileFindBuf
	'((word create_date)
	  (word create_time)
	  (word access_date)
.
.
.
))

Unfortunately, the source for the extentions of XLISP to OS2XLISP were not
published in the issue.  I assume it's available from the usual Byte
source sources.

>
>-------------------------------------------------------------------------------
>	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
>		  Human-Computer Interaction Department
>		       Hewlett-Packard Laboratories
>			      Palo Alto, CA.
>				   *
>


| Victor Kan               | I speak only for myself.               |  ***
| Data General Corporation | Edito cum Emacs, ergo sum.             | ****
| 62 T.W. Alexander Drive  | Columbia Lions Win, 9 October 1988 for | **** %%%%
| RTP, NC  27709           | a record of 1-44.  Way to go, Lions!   |  *** %%%

brian@topaz.jpl.nasa.gov (Brian of ASTD-CP) (10/17/89)

  There are currently at least two extensible / customizable 
  interactive scheme implementations out there.  The new one
  is Extension Language Kit (Elk -- see references).  The older
  one is the venerable xscheme, now in version 0.17 (see the
  comp.lang.scheme newsgroup).  

  Has anyone compared them for speed, memory performance, and
  robustness?  

  I have run truly huge jobs with xscheme, and it has never failed
  on me (except for the well-known, and STILL unfixed save/restore
  problem -- see my recent posting in comp.lang.scheme).  I have
  also found xscheme's speed to be quite good for a byte-code
  compiler.

  The big advantage of Elk is that it's already hooked up to 
  XWindows.  I need an interactive XWindows tool, and I'm trying
  to decide whether to glue xscheme to XWindows or to switch to
  Elk.  To make that decision, I need some info on Elk's perfor-
  mance (space and time) and robustness compared to xscheme.

. . . Brian Beckman  . . . . . . . . . brian@topaz.jpl.nasa.gov. . .
. . . JPL Computer Graphics Lab. . . . (818) 397-9207. . . . . . . .

raible@orville.nas.nasa.gov (Eric Raible) (10/21/89)

In article <1852@xyzzy.UUCP> kan@mutley.dg.com () writes:
>I've been looking for the issue for weeks, but finally found it today.
>It's in the Byte IBM Special Edition for Fall 1988 (volume 13, #11).
>To summarize, C library functions are called with the c-call function.
>C style structures are handled like this:
>
>/* from their example */
>struct FileFindBuf {
>	unsigned create_date;
>	unsigned create_time;
>	unsigned access_date;
>.
>}
>
>becomes:
>
>(define FileFindBuf
>	'((word create_date)
>	  (word create_time)
>	  (word access_date)
>.
>))
>
>Unfortunately, the source for the extentions of XLISP to OS2XLISP were not
>published in the issue.  I assume it's available from the usual Byte
>source sources.
>

I needed to access and set C structures (i.e. defined and allocated by C),
so I hacked together a parser that converts C structure definitions into
a form that is suitable for use in scheme, and some scheme utility code
to use it.

As an example, given:

typedef struct {
   int i;
   char c;
   float f;
} Example;

And a scheme function 'get-an-example' that returns a pointer to a new
example, I can do the following:

(make-struct-accessor 'Example 'i)
(make-struct-accessor 'Example 'c)
(make-struct-accessor 'Example 'f)

(define s (get-an-example))

(set-example-i! s 10)
(set-example-c! s #\newline)
(set-example-f! s 1.2)

(+ (example-i s) (example-f s)) => 11.2

Note that this code is not really suitable for structures in scheme
(although it could be adapted), but rather for accessing and modifying
structures in C from scheme.

Mail to me for more info.

- Eric (raible@orville.nas.nasa.gov)