[comp.sys.mac.programmer] documenting resources

mrk@wuphys.UUCP (Mark R. Kaufmann) (04/06/88)

I am new to Macintosh programming and have recently discovered the
usefulness of ResEdit.

However, I have one concern:
how does one document the "code" that is "written" using ResEdit?
(I don't think I like the idea of writing code without being able to obtain
a useful hard copy of it.)

So far, the only ideas we have come up with are:

(1) creating a hex dump of the .rsrc file (not very useful except to
    reproduce the .rsrc file if it is lost)

(2) starting ResEdit and opening every resource, displaying it on the
    screen, creating a screen dump to a file, and later printing all of
    the screen dumps from within MacPaint.

What do all of the expert Mac programmers out there do?

Please e-mail responses; I will summarize.

================================
Mark R. Kaufmann
UUCP: ...!ihnp4!wuphys!mrk
      ...!uunet!wucs1!wuphys!mrk
Internet: mrk@wuphys.wustl.edu
================================

han@Apple.COM (Byron Han, fire fighter) (04/07/88)

In article <534@wuphys.UUCP> mrk@wuphys.UUCP (Mark R. Kaufmann) writes:
>
>
>However, I have one concern:
>how does one document the "code" that is "written" using ResEdit?
>(I don't think I like the idea of writing code without being able to obtain
>a useful hard copy of it.)
>
Try using DeRez from the Macintosh Programmers Workshop.  You can dump
resource files into formatted text files which can be edited and processed
by Rez into a resource file again.  You can create you own templates for
the DeRez'ing so you can get something more intelligable than a straight
hex dump.

Example of formatted DeRez output:
resource 'STR#' (-4001) {
	{
	"1.0D1",
	"Written by Byron Han.\0x0DCopyright  1988 - Apple Computer, Inc."
	}
};

Example of unformatted Rez output:
data 'STR#' (-4001) {
	$"0002 0531 2E30 4431 2543 6F70 7972 6967"        /* ...1.0D1%Copyrig */
	$"6874 20A9 2031 3938 3820 2D20 4279 726F"        /* ht  1988 - Byro */
	$"6E20 422E 2048 616E 2C20 6573 712E"             /* n B. Han, esq. */
};

Both are accepted by Rez to create a resource file.  The formatted version
requires the templates which are included with MPW.  The templates include
most all resources (DITL, DLOG, STR , WIND, vers, SIZE, et cetera ad nauseum
et rigor mortis...)

MPW is available from APDA - 290 SW 43rd Street;  Renton, WA 98055

This does not represent an official Apple statement of position.

-- 
------------------------ Byron Han,  Communications Tool ----------------------
     Apple Computer, Inc.  20525 Mariani Ave, MS 27Y  Cupertino, CA 95014
 ATTnet:408-973-6450    applelink:HAN1    domain:han@apple.COM     MacNET:HAN
GENIE:BYRONHAN   COMPUSERVE:72167,1664   UUCP:{sun,voder,nsc,decwrl}!apple!han

mrk@wuphys.UUCP (Mark R. Kaufmann) (04/29/88)

A couple of weeks ago (<534@wuphys.UUCP>),
I asked the following question of the net:

How does one document the resource "code" that is "written" using ResEdit?

The responses kept trickling in, and this article attempts to summarize
all of those responses. (Sorry it has taken so long.)
Thanks to all of you who replied; I have not included your names here.
------------------------
There are several resource-decompilers available; they eat a resource
file and spit out ASCII text which is suitable for input into one of the
standard resource-compilers.

In particular:
MPW (Macintosh Programmers Workshop)
includes a pair of tools called a resource compiler and resource decompiler.
They've defined a textual specification language for describing resource
contents; the compiler (Rez) converts text files to resources;
the decompiler (DeRez) converts resource files to Rez source format.
You can build resources using ResEdit or whatever, then
use the decompiler to make a textual equivalent for documentation purposes,
including hard copy.
Some resources simply become hex dumps, but others are
converted into a more readable form.
You can create you own templates (using a language similar to C) for
the DeRez'ing so you can get
something more intelligable than a straight hex dump.
Both formatted and unformatted (hex dump) forms are accepted by Rez to
create a resource file.  The formatted version
requires the templates which are included with MPW.  The templates include
most all resources (DITL, DLOG, STR , WIND, vers, SIZE, etc.).

[MPW is available from APDA, 290 SW 43rd Street, Renton, WA  98055, USA.
Disclaimer: I have no connection with APDA at all!]
------------------------
There are also PD/shareware resource compilers & decompilers.
Try looking in the SUMEX archives for names like "DeRez", "ResTools", etc.

I believe there is a public domain/shareware program (ResDecomp?) to
convert resources into a textual form that would be accepted by RMaker,
which other development systems use to compile resources.
------------------------
One person says:
However, most people I know have never felt the need for hard copy of
resource files.  I just build them as I need them and keep plenty of
backups in case ResEdit turns around and bites me.

Someone else:
I don't find myself documenting resources for archival purposes.  Maybe
for describing them to others....(writing an article?)
------------------------
One person, oster%SOE.Berkeley.EDU@jade.berkeley.edu (David Phillip Oster) asks:
Does anyone know
if there is any facility like '#define' in Rez? It would be useful for
example, to define a grid of editable text items, and have their size contained
in a single '#define'.

================================
Mark R. Kaufmann
UUCP: ...!ihnp4!wuphys!mrk
      ...!uunet!wucs1!wuphys!mrk
Internet: mrk@wuphys.wustl.edu
================================