[comp.sys.mac.programmer] Scratch8, Scratch20 lmg's

bowman@reed.UUCP (Eric Bowman) (03/15/90)

Just wondering:  how safe are Scratch8 and Scratch20 in terms of future
compatibility?  (I realize this is kind of unanswerable, but if I can get
a feel for how many people _use_ them, I'll probably have a good feel for
how safe they are.)

Thanks,
bObO
bowman@reed.{bitnet,UUCP,edu}

tim@hoptoad.uucp (Tim Maroney) (03/18/90)

In article <14420@reed.UUCP> bowman@reed.UUCP (Eric Bowman) writes:
>Just wondering:  how safe are Scratch8 and Scratch20 in terms of future
>compatibility?  (I realize this is kind of unanswerable, but if I can get
>a feel for how many people _use_ them, I'll probably have a good feel for
>how safe they are.)

They're low-memory globals, and therefore unsafe.  Of the low-memory
globals, I would expect Apple to consider these among the most
dispensable.

Low-memory globals may go away at some point in the future for purposes
of simplifying and improving multitasking.  Or they may not -- Apple
couldn't get rid of any large set of them without breaking a huge
amount of the binary software available now.

The recommended solution for most Scratch-using software is to use
code space and PC-relative reads and writes for global data that can't
be reached with a globals register.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"What's bad? What's the use of turning?
 In Hell I'll be there a-burning!
 Meanwhile, think of what I'm earning!
 All on account of my name." - Bill Sykes, "Oliver"

bowman@reed.UUCP (Eric Bowman) (03/19/90)

In article <10848@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>The recommended solution for most Scratch-using software is to use
>code space and PC-relative reads and writes for global data that can't
>be reached with a globals register.

Could someone perhaps elaborate on an appropriate technique for sharing
data between an application and an LDEF?  The only way I could figure out
how to do this without a serious performance sacrifice was with Scratch stuff.

Thanks,
BoBo
bowman@reed.{bitnet,UUCP,edu}

siegel@endor.harvard.edu (Rich Siegel) (03/20/90)

In article <14443@reed.UUCP> bowman@reed.UUCP (Eric Bowman) writes:
>
>Could someone perhaps elaborate on an appropriate technique for sharing
>data between an application and an LDEF?  The only way I could figure out
>how to do this without a serious performance sacrifice was with Scratch stuff.

	How about embedding the LDEF as source code in the application, 
and using a fake LDEF resource to point to it? Do a textual search for
"Siegel" on Phil & Dave's Excellent CD, and it'll point you to the right
file.

R.


~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"When someone who makes four hundred and fifty dollars an hour wants to
tell you something for free, it's a good idea to listen."

~~~~~~~~~~~~~~~

tim@hoptoad.uucp (Tim Maroney) (03/20/90)

In article <10848@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>>The recommended solution for most Scratch-using software is to use
>>code space and PC-relative reads and writes for global data that can't
>>be reached with a globals register.

In article <14443@reed.UUCP> bowman@reed.UUCP (Eric Bowman) writes:
>Could someone perhaps elaborate on an appropriate technique for sharing
>data between an application and an LDEF?  The only way I could figure out
>how to do this without a serious performance sacrifice was with Scratch stuff.

Try using the refCon and userHandle fields of the list record.  There's
no significant performance difference (a couple of extra derefs) between
this and using the Scratch variables.

Incidentally, has anyone come up with a canonical way to share information
between the caller of Standard File and its filter routines, without
using globals?  The problem is that the caller doesn't have access to
the dialog window or any of its controls, which haven't been created
yet at the time of call, so it can't stash a pointer to information
in a refCon.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"There are no Famous People on the net.  Only some of us with bigger mouths
 than others."  -- Dan'l Danehy-Oakes, The Roach

brecher@well.sf.ca.us (Steve Brecher) (03/21/90)

In article <14443@reed.UUCP>, bowman@reed.UUCP (Eric Bowman) writes:

> Could someone perhaps elaborate on an appropriate technique for sharing
> data between an application and an LDEF?

A List Record contains two four-byte fields that you can use for sharing
data:  RefCon and UserHandle.  You can put whatever you want in these
fields.  If the shared data won't fit into the fields themselves, you
can store a pointer or handle to shared data in either or both of
them.
-- 

brecher@well.sf.ca.us (Steve Brecher)