[fa.info-mac] sumacc C/Pascal-routine interface routines

info-mac@uw-beaver (01/25/85)

From: edmoy%ucbopal.CC@UCB-VAX

Here are some useful routines to allow a C routine to call a Pascal
routine directly, as in the case where you have changed the window
definition procedure handle in a window to point to your own routine,
but this routine still calls the original window def proc.  They are in
shar format.

getpargs is an existing routine that gets the pascal argument list when
your C routine is called.  It has just been slightly optimized and included
for completeness.

setpargs sets up the stack for a call to a pascal routine, in a matter
exactly opposite of getpargs.  For pascal function that pass back a value
on the stack, we must use allocpval to allocate space on the stack, and
afterwards, deallocate the space with freepval.

allocpval with a zero allocate value will return the current value of the
stack register.  One could theoretically use it to manipulate the stack,
but this would really be a kludge!

Edward Moy
Computing Services
University of California
Berkeley, CA  94720

edmoy@ucbopal.ARPA
ucbvax!ucbopal!edmoy

[filed on <info-mac>getpargs.shar]