wmb@MITCH.ENG.SUN.COM (12/13/90)
> Also, I am interested in Mitch Bradley's technique of "using a C program > to wrap the system-independant Forth dictionary image." How exactly is > this done? I presume the dictionary image is embedded within a C program > as a declaration of data bytes. It could be embedded as data, but usually I read it in from a binary file. > Is this image somehow called from main? Yes, I allocate an array, read the dictionary image into that array, and then call it as a subroutine. The indirect call syntax is pretty tricky: char * loadaddr; loadaddr = malloc(MAX_KERNEL_SIZE); <read dictionary image file into array at loadaddr> (*(int (*) ())loadaddr)(loadaddr, functions); > And how does the image interface to C's standard I/O? > Are the addresses of the interface routines patched by the > C program into pre-defined locations in the image? The "functions" argument to the above call is the address of an array of I/O subroutine entry points. Another thing: the dictionary image has to be relocatable. It can either be position-independent (that's how my SPARC version works), or it can carry around a relocation bitmap and relocate itself when it is first entered (that's how my 680x0 version works). Forth to the Future, Mitch Bradley, wmb@Eng.Sun.COM