[comp.sys.mac.wanted] Resource type counting in a single file: mission impossible?

hsu_wh@jhunix.HCF.JHU.EDU (William H Hsu) (08/11/90)

     I have run into problems trying to perform what I had
expected to be a routine resource operation, but now appears to
be an arcane and undocumented one.  My goal was to count the
number of resource types in the "currently opened" resource file,
so that the number obtained could be used to loop through all
types in that file.  It turned out that CountTypes(), the
function described in the Inside Mac Resource Manager chapter (I
have an ancient copy from the days when it was one volume),
counts all types in ALL open resource files.  This presented a
large obstacle, since much of the code I am working on was
developed by others; I couldn't begin to discover where to close
and reopen the "non-current" files.  Surely, I thought, there
must be a function that does only the current resource file -- if
only I could get the right set of arguments to GetIndType(), all
would be well.  But after placing a call to the Think C support
line, I was told that "nothing in the Tech Notes explains this"! 
In fact, only by using OpenRF() and "poking through the
unformatted binary data for several hundred hours" could I
unearth the secrets of what I considered an everyday function
call.  I am hoping that this is not some sort of proprietary
information, since it is fairly essential to the completion of my
project.  If there is some way to accomplish the above task,
could some kind soul send me the enlightening information?  Thank
you.
     Please E-mail responses to:

          hsu_wh@jhunix.hcf.jhu.edu (BITNET)
          hsu@cs.jhu.edu (ARPAnet)
          hsu_wh@jhuvms.hcf.jhu.edu

     I will summarize to the net if there is any interest at all,
and if APDA doesn't threaten a lawsuit of some sort.

lefty@twg.com (David N. Schlesinger) (08/18/90)

In article <6078@jhunix.HCF.JHU.EDU> hsu_wh@jhunix.HCF.JHU.EDU (William H 
Hsu) writes:
> My goal was to count the
> number of resource types in the "currently opened" resource file,
> so that the number obtained could be used to loop through all
> types in that file.  It turned out that CountTypes(), the
> function described in the Inside Mac Resource Manager chapter (I
> have an ancient copy from the days when it was one volume),
> counts all types in ALL open resource files.  This presented a
> large obstacle, since much of the code I am working on was
> developed by others; I couldn't begin to discover where to close
> and reopen the "non-current" files.  Surely, I thought, there
> must be a function that does only the current resource file -- if
> only I could get the right set of arguments to GetIndType(), all
> would be well.  But after placing a call to the Think C support
> line, I was told that "nothing in the Tech Notes explains this"! 
> In fact, only by using OpenRF() and "poking through the
> unformatted binary data for several hundred hours" could I
> unearth the secrets of what I considered an everyday function
> call.

What about Count1Types() and Get1IndType()?  These should do _exactly_ what you need done!

I hope that was the _janitor_ at Symantec that you were talking to!

|<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>|
|           David N. Schlesinger || "When I have nothing to say,       |
|           The Wollongong Group ||  my lips are sealed;               |
| Internet: Lefty@twg.com        ||  say something once,               |
|    DoD #: 0152                 ||  why say it again?" -- David Byrne |
|<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>|

I
g
n
o
r
e

t
h
i
s
,

i
t
'
s

i
n
e
w
s

f
o
d
d
e
r
.
.
.