Rez-ervations
Volume Number: 3
Issue Number: 2
Column Tag: Resource Roundup
No Rez-ervations Needed!
By Joel West, Western Software Technology, MacTutor Contributing
Editor
Facing the Future
Since the last installment of Resource Roundup, there have been some major
changes Mac-wise around here.
As the tag line suggests, I have a new venue, in this case working full-time on the
Macintosh in a company headed by yours truly. My Mac Plus showed up and the 512K
is gone (sold, not stolen like the 128). Now if only I had Alan Kay’s Dynabook-style
Mac, rumored due late in ’88: in writing this at 41,000 feet, my Mac is useless in the
overhead compartment.
However, it isn’t the prospect of swapping floppies 40 hours a week that
prompted me to buy a hard disk. True, with the Ram Cache set at 384k, my Mac Plus
with a Peak Systems hard disk seems at least 3x as fast as those 400k floppies. (The
Peak Plus-30 was the cheapest 30mb I could find). However, I hate to agree with
Steve Jobs -- whose closed-architecture Mac design was admitted a failure by John
Sculley -- but the Plus30’s fan is driving me bonkers.
No, the reason W.S.T. emptied its bank account could be found on the 13 MPW
floppies that had been lying around unused for a few weeks. I cheefully installed these
floppies on the Peak Plus-30, tying up about 4 mb in the process. Which brings me to
the subject of this month’s Resource Roundup:
MPW!
Macintosh Programmer’s Workshop is a complete development environment, and
Apple’s long awaited “official” Macintosh-based development tool. Since the Lisa’s are
no longer made and, after the long-rumored slotted Mac is introduced next month, no
one would want one anyway, Apple is nearing completion of a two-year project to make
Macintosh-based development available, both in-house and for outside developers.
At this writing, Macintosh Programmer’s Workshop is in release 1.0B2,
meaning the second “beta” test release. It is rumored the complete MPW system will
be in final release after the January Mac Expo, which should mean "by the time you
read this!" Check with APDA on it's final status.
MPW includes a shell, editor, various utilities, 68000/68010/68020
assembler, C, Pascal and the MacApp extensible application. Encouragingly, the MPW
object code format is straightforward, and the documentation describes it in enough
detail for use by third-party compilers. (I’ve written and maintained compilers with
more cryptic documentation than that.)
But of course, the focus here is on resources, and MPW has plenty to talk about.
MPW comes with three new resource tools: Rez is a resource compiler; DeRez is a
resource decompiler; and RezDet performs rigorous consistency checks on resource
forks.
All three are implemented as MPW tools, which means these are invoked from
within the MPW programming environment with a UNIX-like line-oriented command.
If you grok UNIX, Rez reads from standard input and writes to a resource fork. DeRez
and RezDet read from a resource fork and write to standard output. Of course, the
standard input and output of MPW apply to the data fork of any file they access,
ignoring the resource fork, if any. Normally, standard output is the screen, and
standard input is redirected from a file using the UNIX-like “<” notation.
The Pascal compiler also includes the source to ResEqual (It seems misspelled to
me) as a sample MPW tool for those who want to write their own. The tool compares
the resources in two files, and reports the differences (if any) by resource type and
number. As a tool, it has limited utility, but it illustrates how to use Resource
Manager calls to read unknown resources, such as those added in a user-configurable
application.
MPW also includes ResEdit, the same one that has been pre-released in the
various software supplements. MPW 1.0B2 comes with 1.0A1 version of ResEdit (A
for “Alpha”, or first-level field test); however, this is labeled 1.0D11 (D for
“Development”, or internal testing), certainly not the latest version available at the
release date, but perhaps the most stable. ResEdit is, as before, a stand-alone
window-oriented application, rather than a line-oriented MPW tool. As with other
conventional Mac applications, it can be called from within the MPW shell, although
not as flexibly as an MPW tool.
How to Get MPW
MPW can be purchased by anyone from the Apple Programmer’s and Developer’s
Association (APDA, 206-251-6548). If you haven’t heard about APDA yet, you
obviously haven’t been reading the ads in MacTutor! APDA is Apple’s latest attempt to
provide a mechanism for supplying technical information and software to the thousands
of Mac owners out there who want it (though it also applies to the Apple II). I can only
hope it turns into a reliable and timely conduit for such information.
If you’re an APDA member ($20), you can order the base MPW configuration for
$100; this includes the shell, utilities, assembler, linkers and, of course, the
resource tools. The C and Pascal compilers are $75 extra; MacApp is $50, but it
requires the Pascal compiler.
However, the fine print in the APDA catalog says:
This is a beta version of a product that will eventually be sold
through Apple retail outlets. Purchasing this version does not
entitle you to a discount or free upgrade on the final product.
This is, of course, the most anti-user upgrade policy possible. On the other
hand, this will probably have its desired effect, which is to discourage all but the most
eager MPW-lover from buying it prior to its commercial release (The APDA/Dealer
official status should be determined by Expo time, so check for an updatted status. It
may be distributed to Apple dealers by this time.)
Even if you decide not to get MPW, let’s hope that third party companies license a
version of the MPW resource tools, as the improvements over earlier tools are as
dramatic as night and day. However, these improvements come at a price
La Plus Ça Change
Perhaps the one thing I retained from a semester of college French was the saying
La plus ça change, la plus la même chose.
which is a fancy way of saying, “The more things change, the more they stay the
same.”
The resource tools of the Macintosh Programmer’s Workshop are nothing like
those of earlier development systems. They are radically different, definitely better,
but are also completely incompatible. Macintosh developers have been suffering
through a series of incompatibilities (when did YOU finally get an HFS-compatible
update on your development system?), and this is the latest from Apple. (There is a
clean migration path, as we’ll see later.)
On the other hand, I’d like to hand it to Apple for not being hide-bound to
tradition and stifling innovation for the name of compatability. The new resource
formats are also more clearly thought out, extensible, coherent and without the ad hoc
flavor of their predecessors. (Besides, it gives writers like me a way to make
money!)
The MPW shell provides a demonstrable improvement in convenience and speed
over most other development systems, which tend to use “Transfer” menus or their
own mini- finder. The Think Technologies (Lightspeed C and Pascal) programming
environment is the only one I’ve seen of comparable power. Ironically, it is more
Mac-like than Apple’s MPW environment, which resembles a line-oriented operating
system (e.g., UNIX) grafted onto a windowing computer (e.g., a Sun). The two
approaches each have advantages, but I’d say the choice is more a matter of personal
preference.
However, there’s no denying that when it comes to resources, MPW extends the
standard for development systems. The two (and a half) new tools provide needed
functionality, but more importantly, the MPW resource tools are far more flexible
than their predecessors.
The MDS Era
By now, you’re probably familiar with the Lisa resource compiler input format.
It was the one used in the looseleaf Inside Macintosh and most of the early writing about
Macintosh development. (Although I’d say there was disappointingly little written
about resources, which is one reason I volunteered to write Resource Roundup.)
If you’ve ever used REdit to disassemble a resource, what you got was Lisa
format. The Dialog Creator is another tool that uses this format. This is a nicely done
and useful tool, but it would be a lot more useful if only it could read a resource fork of
an application under development!
So if you check your bookshelf, you’ve probably got all this documentation that
uses the Lisa resource compiler. But if you’re like me, a small-sized developer (or
serious hobbyist), you never could afford two machines, or at least justify the Lisa to
the family finance committee. So instead, you purchased one of the many third party
Mac-based development systems.
Most of these systems borrowed some or all of their utilities from MDS, Apple’s
Macintosh 68000 Development System. So far, I’ve owned Microsoft Basic, UCSD
Pascal (MacAdvantage), Megamax C, Rascal, TML Pascal, MacMETH Modula-2 and
Lightspeed C. MS-Basic, MacMETH and Rascal don’t include resource tools. All the
others came with RMaker, the MDS resource compiler.
RMaker and the Lisa resource compiler of course run on different machines. But
from a documentation standpoint, the main difference is the input syntax. Dave Wilson
published a list of the syntax of these two resource formats in a previous issue of
MacTutor (Volume 2 No. 6 June '86).
Table 1 shows the list of resource types supported by the two resource
compilers. RMaker is more or less a subset of its Lisa counterpart. Those resources
not supported by RMaker (or either one) must be input as GNRL resources. A the
format of a GNRL-defined resource is not known by the resource compiler; instead, it
is input with each instance of the resource. (This is an important difference from
MPW, as we’ll see later.)
Supported by MDS and Lisa
ALRT Alerts
BNDL Application bundle
CNTL Control
DITL Dialog/alert item list
DLOG Dialog box
FREF File references
GNRL General type
MENU Menu
STR String
STR# List of strings
WIND Window
Supported by Lisa only
ANYB Arbitrary bytes from a file
CDEF* Control definition procedure
CURS 16-by-16 cursor
DRVR* Driver/DA
FONT Text font
FKEY* Function key
FWID Font width table
HEXA Hexadecimal literal
ICON 32-by-32 icon
ICN# List of icons (usually for Finder)
MDEF* Menu definition procedure
PACK* Package
PAT 8-by-8 pattern
PAT# Pattern palette
PICT QuickDraw picture
WDEF* Window definition procedure
*Implemented using PROC resources with MDS
Table 1: Resource types for Lisa and MDS resource compilers
The definition of a GNRL resource begins with the target resource type, followed
by a series of data fields. Each field is preceeded by .P, .I, .L, or .H, which allow
specifying Pascal strings, integers, long intergers, or hex data by respectively. (Two
other forms, .S and .R, are documented but rarely used.) Example 1 shows how the
GNRL format is used to input a missing resource type under MDS.
In the case of DLOG and BNDL resources, the formats are actually incompatible.
Example 2 shows the MDS and Lisa equivalents of these resource types.
TYPE ICON = GNRL
,128
.H
0001 0000 0002 8000 0004 4000 0008 2000
0010 1000 0022 0800 0044 8400 0089 0200