cross-stack globals, also, file inclusion
joel at alpsgiken.gr.jp
Sun Oct 19 23:03:58 EDT 2003
Two questions for the price of one:
Is there an easy way to set up something similar to file inclusion?
Background, I have several large, complex Hypercard stacks to convert,
and they have hard-wired path names that I need to unwire.
What I've settled on to deal with this is a handler in the primary stack
which sets several global variables, including the path of the primary
stack directory and the sub-directory where the independent sub-stacks
are stored. Then I have handlers that can be called to retrieve the
globals. In the case of the paths, the handlers take a parameter which
will be appended to the directory path.
But I have not been able to come up with a way to get the primary
stack's path unless the primary stack is already running, because the
global "stacks" property/function will execute in the environment of the
I suppose I could check the globals, and if they are empty, peel path
elements back to the primary stack's parent directory. That would work
if I already know the name of the directory the primary stack lives in,
or if I'm willing to go looking for the primary stack by name as I climb
the file tree, or for stacks where all sub-stacks are one directory
below the primary stack.
But I want to generalize a bit. I don't want to have to know the name of
the enclosing directory in advance, and I want to be able to bury
sub-stacks several directories deep.
I suppose I could use the second line of the handler's parameter to
specify the number of levels deep the sub-stack is supposed to be, but
that gets kind of clumsy, and I'd like to avoid it.
(Same-file substacks seem to see globals without any tricks, but I'm
thinking I don't want a 250MB file with about thirty substacks. Also,
the prospect of digging through every script in every stack for path
names that need adjusting is not particularly motivating, although I
expect to have to eventually do that when I convert the image files.
Hopefully, I can get the paths problem fixed enough before I convert the
stacks to RunRev that the converted stacks will run under Mac OS X, to
make the further cross-platform conversions easier.)
Pointers anyone? Or should I just write in the manual that people
clicking on sub-stacks should expect the sub-stacks not to run? (And
probably use the global-fetching handlers to stop them.)
Joel Rees, programmer, Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
"When software is patentable, anything is patentable."
More information about the Use-livecode