[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

calling XCMDs from MCL




I've been trying to run XCMDs written for HyperCard from within
MCL 2.0p2, and I've been having little luck. I've been using
the xcmds.lisp code by Apple's Advanced Technology Group, which
is on cambridge.apple.com.
 
My real aim is to use the MIDI externals that are part of the
HyperMIDI 2.0 system (from EarLevel Engineering). However, since
MIDI communications are always messy, I figured I'd first 
experiment with simpler XCMDs and XFCNs.
 
Although xcmds.lisp loads without error (one warning:
Unused lexical variable CALLBACK-RESULT, in CALLBACK-HANDLER.),
none of the xcmds that I have tried work correctly. I have
tried several of the XCMDs from Fredric Rinaldi's X-Archive 3.1,
a popular set of freeware XCMDs. I created resource files containing
each XCMD in the CCL directory, each named with the name of the
XCMD. My calls to the XCMDs seem to find the appropriate resources,
but they either cause errors or return the wrong results! For example,
the HowMany XFCN takes two strings and returns the number of times
that the first occurs in the second. A HyperCard stack with this
XFCN will return 2 for the call:
HowMany("foo", "here's one:foo and another foo too")
 
But in MCL, with xcmds.lisp loaded and the resource file in the
correct place I get:
 
? (do-xcmd "HowMany" "foo" "here's one:foo and another foo too")
"foo"
? 
 
Others give errors like:
 
? (do-xcmd "ChooseColor")
> Error: Array index 53 out of bounds for #<SIMPLE-VECTOR 42> .
> While executing: CCL::CALLBACK-HANDLER
> Type Command-. to abort.
See the RestartsI menu item for further choices.
1 >
 
or:
? (do-xcmd "mousoid")
> Error: Array index 100 out of bounds for #<SIMPLE-VECTOR 42> .
> While executing: CCL::CALLBACK-HANDLER
> Type Command-. to abort.
See the RestartsI menu item for further choices.
1 > 
 
Figuring that perhaps Rinaldi's functions make too many or the
wrong kinds of callbacks, I tried the example in the xcmds.lisp
file: MacroMind's PlayMovie XCMD. This too fails to work, even
after fixing the typo (a parend is misplaced in the with-pstrs):
 
? (do-xcmd "PlayMovie" "Explosion" "movieNoClear" "movieNoUpdate")
 
Pretending to execute following message:
          answer "PlayMovie: You must have MacroMind Player in the
same folder as this stack to play Director movies"
"You must have MacroMind Player in the same folder as this stack
to play Director movies"
? 
 
I *do* have the MacroMind Player application in the CCL directory,
which is where the instructions say to put it (along with a
resource file containing the PlayMovie XCMD).
 
It seems that I'm running into a variety of problems here -- some
certainly due to unimplemented callbacks to hypercard, and others
due to...?
 
If anyone can nudge me in the right direction, or provide updated
xcmd code, I'd appreciate it greatly.
 
Thanks!
 
Lee Spector
Assistant Professor of Computer Science
School of Communications and Cognitive Science
Hampshire College
Amherst, Massachusetts 01002-5001
e-mail: lspector@hamp.hampshire.edu