Extensive frame-like data structures in Rev, 'Applescript-like' communication with externals

Jim Witte jswitte at bloomington.in.us
Sun Aug 11 22:03:01 CDT 2002


Hello,

(This may be repeated tomorrow because I didn't realize I had 
unsubscribed from use-revolution when I sent it)

   I'm planning to make a functional-clone of the Newton Toolkit in 
Revolution (mainly because NTK only works under Classic, needs a serial 
shim workaround, doesn't support Ethernet in Windows [I think], and is a 
bit of a pain-in-the-neck to use).  One of the major components would be 
a rewrite of the frame-system (like Smalltalk).  Basically I need a way 
to accommodate a data structure like this (off the top of my head, in 
psudocode):

type TFrame = record {
	VNumSlots
	VFrameSlotArray = <expandible array of TSlot>
}

type TSlot = record {
	VSlotRefCount = <number of references to this slot in view system>
	VSlotName = string
	VSlotType = enum( int, boolean, long, char, string, TFrameRef)
	VSlotValue = <value coerced or pointer to another TFrame>
}

   And then I need functions that will add slots to frames, remove, map 
functions over them (LISP-like), copy references to other places 
(incrementing the reference count), clone whole frames recursively, etc.

   Another part would be a Newtonscript->bytecode parser, and a bytecode 
interpreter (mainly for syntax checking initially)  The package output 
and project file storage portions pretty much requre a frame system to 
be built, as the NTK file format as well as the package format are 
large, flattened frames.

   I was initially thinking of coding the system in C or C++, but then 
the GUI (layout) code is harder and not cross-platform, so Revolution 
came to mind.  However, I don't know if Revolution would be suited to 
doing "heavy" data structures such as this.  If it were as simple as 
taking the stuff from the GUI layout, sticking it in a text file, and 
then compiling it to a package, I could use an Hypercard-like external.  
However, the layout manager must be able to access individual pieces of 
the frame data, as well as perhaps tweak the code (for syntax 
verification and correction), or later on execute bytecode single-step 
(for a partial debugger).

   Is there a good way to handle this kind of "traditional programming 
language"/Revolution interaction that I don't know about (my knowledge 
of externals stops at HC 2.0).  What I think would be ideal is if I 
could have revolution spawn a persistent process from an external, which 
I could communicate with in a Applescript-style tell block to be able to 
access the externals data structures (yet still have the external code 
be relatively platform independent in underlying memory management)  Is 
this possible?

Thanks,
Jim Witte
jswitte at bloomington.in.us
After Midnight Lizard Products




More information about the use-livecode mailing list