[comp.sys.mac.hypercard] Calling HyperCard recursively?

michael_alan_hauser@cup.portal.com (09/04/88)

I am working on a HyperCard application where I need to pass control
to Hypercard from within a script and then have control passed back
to the script at some point. In other words, I want to call the
Hypercard main event loop or evaluator or shell or whatever you want
to call it as a function from within a script.

The goal is to create a hierarchical system of cards where a script in
a card at one level can control the order of execution of its sub-cards.

Is this currently possible or is it another one for the HyperCard wish
list?

Michael Hauser
michael_alan_hauser@cup.portal.com

dan@Apple.COM (Dan Allen) (09/06/88)

In article <8730@cup.portal.com> michael_alan_hauser@cup.portal.com writes:
>I am working on a HyperCard application where I need to pass control
>to Hypercard from within a script and then have control passed back
>to the script at some point. In other words, I want to call the
>Hypercard main event loop or evaluator or shell or whatever you want
>to call it as a function from within a script.
>
>The goal is to create a hierarchical system of cards where a script in
>a card at one level can control the order of execution of its sub-cards.
>
>Is this currently possible or is it another one for the HyperCard wish
>list?

I am not completely sure what you are describing, but maybe using the
send command would allow you to direct messages to specific cards, thus
creating a hierarchical-like system.

Dan Allen
Apple Computer

michael_alan_hauser@cup.portal.com (09/07/88)

My earlier description wasn't very clear. I want to be able to
create a system with the following behavior:

A handler (let's call it Foo) in card A gets executed (called
by a button script or whatever). During its execution, Foo
does a "go card B" AND PASSES CONTROL BACK TO HYPERCARD. The
user is now interacting with card B (and Hypercard). Some user
event causes a "Finished" handler in card B to be executed and
control is returned to Foo (the handler in card A). Note that
just doing a send to Foo won't do the trick. Foo needs to
start back up where it left off. In other words, it needs to
be able to call Hypercard as a function (or by passing a
message or whatever) and then continue with what it was doing.


Michael Hauser
ARPA: michael_alan_hauser@cup.portal.com
MacNET: HAUSER

borton@uva.UUCP (Chris Borton) (09/14/88)

In article <8831@cup.portal.com> michael_alan_hauser@cup.portal.com writes:
>A handler (let's call it Foo) in card A gets executed (called
>by a button script or whatever). During its execution, Foo
>does a "go card B" AND PASSES CONTROL BACK TO HYPERCARD. The
>user is now interacting with card B (and Hypercard). Some user
>event causes a "Finished" handler in card B to be executed and
>control is returned to Foo (the handler in card A). Note that
>just doing a send to Foo won't do the trick. Foo needs to
>start back up where it left off. In other words, it needs to
>be able to call Hypercard as a function (or by passing a
>message or whatever) and then continue with what it was doing.

I suspect that the true coroutine process you wish may not be possible.  But,
and simpler, if not so elegant, solution popped into my mind: have a State
variable in your Foo handler that determines its actions.  For complicated
stuff this could get very kludgey, but it wouldn't be hard to initialize
myState on openStack, and then act in Foo according to the setting of
myState.  So, you would set it to something else in the first section of Foo
and when you 'returned' from handler B by sending the same call to Foo,
myState would direct it to start elsewhere rather than the beginning.

Anyone with a more elegant solution?

-cbb
-- 
Chris Borton	borton%uva@mcvax.{nl,bitnet,uucp} 
Rotary Scholar, University of Amsterdam CS