[comp.sys.mac.programmer] Resources

gjditchfield@violet.waterloo.edu (Glen Ditchfield) (07/07/88)

In article <434@dogie.edu> terranova@vms.macc.wisc.edu writes:
>...  Rather than putting windows, menus, icons,
>def procs, strings, controls, etc. in resources he would prefer to
>hard code everything into the program and make heavy use of #define
>statements.

Then lsr@apple.apple.com.UUCP (Larry Rosenstein) explained:
>The main motivation for using resources was to allow programs to be
>customized for international markets without recompiling them.  All that you
>need to localize a progam for France, for example, is the original English
>version and a resource manipulation tool (ResEdit, etc.).

We could have it both ways, if compilers could be told to put certain data
items in resources instead of the global data area.  I imagine a compiler
for a C superset with ResTools declaration syntax and a "resource" storage
class specifier stirred in, or a Pascal compiler that accepts programs with
RESOURCE declaration sections.

Heck, I bet it's no more than four times as hard as writing a normal compiler.

    Glen Ditchfield  gjditchfield@violet.uwaterloo.ca  Office: DC 2517
Dept. of Computer Science, U of Waterloo, Waterloo, Ontario, Canada, N2L 3G1
	   Each age thinks itself in possession of the true and
	    only view possible for sensible man -- W. M. Dixon

dvljrt@cs.umu.se (Joakim Rosqvist) (05/02/91)

I am trying to copy a file from within a program. It contains resources only.
If I use Resource manager and call CountTypes, I will get all the types
of *all* open resource files, I just want those in that specific file.
UseResFile will let me skip some of the files, beginning with the one I
wanted to examine, so it won't work either.
Inside Machintosh told me that i should use OpenRF in File Manager for
"block level operations"
I used it and tried to read data with FSRead  ===> boooom.
How should it be done?

/$DR.HEX$

marshall@sdd.hp.com (Marshall Clow) (05/03/91)

In article <1991May2.161706.12121@cs.umu.se> dvljrt@cs.umu.se (Joakim Rosqvist) writes:
>I am trying to copy a file from within a program. It contains resources only.
>If I use Resource manager and call CountTypes, I will get all the types
>of *all* open resource files, I just want those in that specific file.
>UseResFile will let me skip some of the files, beginning with the one I
>wanted to examine, so it won't work either.
>Inside Machintosh told me that i should use OpenRF in File Manager for
>"block level operations"
>I used it and tried to read data with FSRead  ===> boooom.
>How should it be done?
>

IM-IV page 15 documents Count1Types and Count1Resource, which do what you 
seem to want.

My question is, what do you really want? Do you wish a new file that contains
the same resources as the old file? Do you want a file that is byte for byte
identical to the old file? How about the creator and file type? Finder Info?
Creation and modification date? If you copy a locked file, should the copy
be locked?

I have a routine I wrote a few years ago that handles all of these (I think)
If there is an interest, I can post it.

Marshall Clow
marshall@sdd.hp.com