[comp.sys.mac.hypercard] HC and expert systems, task-to-task communication

thschulz@iraul1.ira.uka.de (Thomas Schulz) (10/04/88)

dsr@otter.hple.hp.com (Dave Raggett), dan@Apple.COM (Dan Allen)
and geb@cadre.dsl.PITTSBURGH.EDU (Gordon E. Banks) discussed
the integration of HyperCard HC with an expert system XPS.

So far you have two main solutions of integrating other programs
into HC:

1) You rewrite the other programs functionality into XCMDs and call
it from HC. This is only practicable if it is a small portion of code.
No
avail if you want to integrate a whole Lisp interpreter with running
XPS-shell and the XPS itself.

2) You run the two programs (HC and XPS) in parallel under
MultiFinder. If you want to communicate with another large
program (like Prolog or Lisp, or databases etc.) which is already
existing as a stand-alone or is manufactured by another vendor and
relatively closed-up this is the cleanest way (other operating

systems offer task-to-task communication facilities for doing that).


However we run into problems using the current OS of Macintosh:
1) no explicit and safe task-to-task-communication means
2) even if you find a way to send messages between the processes
you must control the task switching by yourself. Make sure that
after a message is sent from A to B the MultiFinder switches to B
which in turn receives the message. HyperCard does not give away
the CPU when executing scripts ! Only when HC is in IDLE
MultiFinder gets a chance to switch.


What I do:

At the University of Karlsruhe we have an expert system shell
MED2 which is implemented in Common Lisp. On top of that is an
actual automobil diagnosis system called MODIS.
Right now I am integrating this expert system with HyperCard in
order to use all of these Multimedia features ofvideo disks, speech, CD-ROM and other tools in the Mac

environment.

How to do it:

1) A clean means of communicating on a Macintosh is AppleTalk
(and so far the only way besides hacking). I wrote interface
functions in Allegro Common Lisp which provide a Lisp Stream to
the AppleTalk Data Stream Protocol ADSP.
On the HC side I wrote XCMDs reading from and sending on ADSP,
too. There are some XCMDs from Apple now (they came later than
my own), so you could use these if you understand the buggy
demos coming with them.
That solves the first problem.
2) However, you must be sure that HC just sends a message and
then runs into idle mode. Then the MultiFinder switches to Lisp.
Allegro Common Lisp behaves great, it gives away the CPU even
when running compiled Lisp.
So your protocol becomes strictly event oriented. No RPC-like
message passing but instead sending and receiving at arbitrary
times.


Being a strict server/client design you get free a network solution.
Set up an expert system server anywhere in the network (hopefully
on a Mac II) and use this from many Mac+s. Also you can run both
(server and client) on the same Mac if this is a Mac 
SE or Mac II. Their implementations of AppleTalk can speak to
sockets on the same node. However, I need 2 MB min for Lisp and 2
MB for HC which means you better try that on a BIG MAC.

If you are interested in my work please feel free to ask for more
information. The resulting prototyp of an "hypermedia expert
system" will be available in December 88.

Tom.

patnaik@adm.ARPA (William Stanberg ) (10/13/88)

Sorry I had to post this, my mailer wouldn't work..

I am interested in using Hypercard as a front-end to a graphics/data
manipulation program.  Since this program is expected to be quite large
and complex, I do not think I can use it as an XCMD.  I was thinking
of using files to pass information between the program and Hypercard.  However,
I still have to deal with the problem of task-to-task communication; I need
to let the other program know when one finishes.

Can you send me some information on how you are doing this?  I am just now
beginning to work on this problem.  I am not a MAC programmer, though I have
a lot of experience on other machines.  Any help you can give will be 
appreciated.

Thanks.

Gopal Patnaik

p.s.  ANY help will be appreciated

sas1@tank.uchicago.edu (stuart austin schmukler) (10/13/88)

MacTutor is publishing a series of articles on an IAC (nie. IPC) for
the Macintosh.  The interface is thru driver calls, so it should be 
	"a mere matter of programming" 
to get an XCMD running to talk with the IAC system.

The design can be losely called a black-board (or cork-board) where
you post and read versions of "documents".

Written by Frank Alviani and Paul Snively, it is described in the
Augest and October issues of MacTutor.  There will be follow-on
articles published in the coming months.


SaS

PS: I have no current connection to MacTutor or the Project.