[comp.sys.mac.programmer] Standard File Question

mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (06/12/89)

Subject: Standard File Question
Newsgroups: comp.sys.mac.programmer

IM-4 and a Technote state that the global variables SFSaveDisk and CurDirSTore
contain the negative of the volume reference number and the directory id of
what standard file is currently looking at.

I tried acessing these variables using the locations given in the technote, but
they always give me the same values of 532 and 920.  These values are the
same when i am in or out of the calls.

Is there some special access method or has there been a correction to the
Technote?

What i want these values for is for a file filter for my getfile call.  I
need to not show files that have been previously selected by my application.
What i am attempting to do is compare the dir and vol of files with that of
ones i know i've opened so that i can tell the call not to show those file.

--Michael O'Rourke

gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) (06/12/89)

In article <5739@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes:
>IM-4 and a Technote state that the global variables SFSaveDisk and CurDirSTore
>contain the negative of the volume reference number and the directory id of
>what standard file is currently looking at.
>
>I tried acessing these variables using the locations given in the technote, but
>they always give me the same values of 532 and 920.  These values are the
>same when i am in or out of the calls.
>
532 happens to be the address of SFSaveDisk.  920 is probably the address of
CurDirStore (it's not in the back of Knaster, and I didn't bother to look
through the MPW assembler equates).

What you need is to do is look at the word (or long word) stored there.
Remember, with the exception of Quickdraw "globals", globals are low memory
locations.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= "Whether you like it, or don't like it, sit   | - gandreas@ub.d.umn.edu - =
=  back and take a look at it, because it's the |   Glenn Andreas           =
=  best going today!  WOOOOoooo!" - Ric Flair   |                           =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

tim@hoptoad.uucp (Tim Maroney) (06/13/89)

In article <1101@umn-d-ub.D.UMN.EDU> gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) writes:
>532 happens to be the address of SFSaveDisk.  920 is probably the address of
>CurDirStore (it's not in the back of Knaster, and I didn't bother to look
>through the MPW assembler equates).
>
>What you need is to do is look at the word (or long word) stored there.
>Remember, with the exception of Quickdraw "globals", globals are low memory
>locations.

Quite right.  In case it's not clear to people how to access low memory
globals in C, here is the syntax for SFSaveDisk and CurDirStore:

#define SFSaveDisk (*(short *)0x214)
#define CurDirStore (*(long *)0x398)

You can find the address of low memory globals in Inside Macintosh,
volume III, Appendix D.  Globals added on the Mac Plus ROMs are in
Inside Mac, volume IV, Appendix C, and yet later ones are in volume V,
Appendix D.  You don't need Knaster or MPW assembler to find them.

Don't use low-memory globals if you can avoid it; Apple has been
claiming for some time that they will be going away in the future,
probably to make context switching faster.  However, some times you
need them, like finding the current directory inside Standard File.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com
Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934

"I don't know that atheists should be considered citizens, nor should they
 be considered patriots.  This is one nation under God."
    -- George Bush in FREE INQUIRY magazine, Fall 1988