[comp.sys.mac.hypercard] XFCN/XCMD

Arne.Venstad@elab-runit.sintef.no (10/22/90)

I have just started experimenting with writing XFCNs for HyperCard (1.2.x), using
Think C 4.0 as environment. My XFCN is a kind of filter procedure for the contents
of a HC field. The function thus always returns a field contents which is a (not
necessarily true) subset of the original field contents. In order to save space
and prevent heap fragmentation, I thougth it was a good idea to use the parameter
handle HC delivers for the field parameter as the result handle for the function.
(Of course taking into account the problem of overwriting data before they are 
fetched).
I have tried it and it works in my test. But is this a safe solution, i.e. will
HC alway copy the contents of the returnValue handle before it disposes the
params handles? 
I have no other documentation for writing XCMD/XFCN other than the HyperGlue 
document(s) by Dan Winkler and what is said about in Think C manuals. Is there
any free documnetation on this subject available, both for HC 1.2.x and HC 2.0?
I know there is a book: "XCMD's for HyperCard" by Dan Winkler. Is there or will
it be a new revision of this book in connection with the HC 2.0 release?

Any help or hints are appreciated, thank you!

Arne Venstad            E-mail:Arne.Venstad@elab-runit.sintef.no
ELAB-RUNIT
SINTEF
N-7034 Trondheim, Norway.

jkc@Apple.COM (John Kevin Calhoun) (10/23/90)

In article <90Oct22.134718*Arne.Venstad@elab-runit.sintef.no>
Arne.Venstad@elab-runit.sintef.no (Arne Venstad) asks whether it's
safe to take a handle passed to an XCMD as one of its parameters,
munge it, and put it into the returnValue field of the XCMDBlock.

The answer is yes.  We made sure that this still works in 2.0.  We
check whether a handle used as one of the parameters is the same as
the handle in the returnValue field before disposing of it.

Kevin Calhoun
HyperCard Engineer
Apple Computer, Inc.

kamins@kumr.UUCP (Scot Kamins) (10/24/90)

>"XCMD's for HyperCard" by Dan Winkler
                           ^^^^^^^^^^
(Actually, it's by Gary Bond.)

Gary hasn't yet started work on a 2.0 version of his book. So if he does do one, it will be quite a while before it comes out.

Dan Winkler has written more about XCMD's and XFCN's in "Hypertalk 2.0: The Book" (Bantam Electronic Publishing, 1990), but it's all on 1.2.# stuff.

Scot Kamins