Please consider a donation to the Higher Intellect project. See or the Donate to Higher Intellect page for more info.


From Higher Intellect Vintage Wiki
Jump to navigation Jump to search

Rez is a compiler used to generate resource s from a text description or the format of the text description (the Rez language).

Unlike more visual resource editors, such as ResEdit and Resorcerer, Rez uses a text-based approach to creating resources. Originally an MPW tool, Rez has spawned a family of resource compilers capable of understanding the same resource description language. Both Symantec C++ and CodeWarrior include their own resource compilers that function similarly to Rez. The Rez language is fairly straightforward and should look familiar to anyone who has programmed in C or C++.

The following code shows a sample of Rez language:

resource 'MENU' (mFile, "File menu", preload) {
mFile, textMenuProc,
enabled, "File",
noicon, "N", nomark, plain;
noicon, "O", nomark, plain;
noicon, nokey, nomark, plain;
noicon, "W", nomark, plain;
noicon, "S", nomark, plain;
"Save As…",
noicon, nokey, nomark, plain;
noicon, nokey, nomark, plain;
"Page Setup…",
noicon, nokey, nomark, plain;
noicon, nokey, nomark, plain;
noicon, nokey, nomark, plain;
noicon, "Q", nomark, plain;

The whole idea of describing resources in a textual format might seem a little backward. After all, why would you want to describe a resource in Rez when you can just draw it in ResEdit? Well, there are some very good reasons. Although some resources, such as icons, would be difficult to create in Rez, others, such as lists of text strings or balloon help resources, are well suited to a text representation. And some very complex resources, such as PowerPlant “ppob” resources, can’t be created in ResEdit at all (Resorcerer and Constructor can handle them).

Because the Rez language supports C-style include files, it’s easy to keep resource ID numbers consistent between a set of C or C++ source files and the resources themselves. Also, text descriptions of resources are frequently easier to include in books or to transfer to other computers whose files aren’t blessed with resource forks.

No discussion of Rez would be complete without a mention of its sister, DeRez. DeRez, reversing the process of Rez, creates a text description of compiled resources. Combined with a resource editor, Rez and DeRez make a powerful combination.