DeRez.1   [plain text]


.TH DeRez 1 "July 24, 2000" "Mac OS X"
.na
.nh
.SH NAME
Rez
\- compiles resources
.na
.nh
.SH SYNTAX
.B DeRez 
.I resourceFile 
[ 
.I typeDeclFile1 
[ 
.I typeDeclFile2 
] ... ] 
.br
[ \fB-c\fR[\fBompatible\fR] ] 
[ \fB-d\fR[\fBefine\fR] \fImacro\fR [ = \fIdata\fR ] ] 
.br
[ \fB-e\fR[\fBscape\fR] ] 
[ \fB-i \fIdirectoryPath\fR ] 
.br
[ \fB-m\fR[\fBaxstringsize\fR] \fIn\fR ] 
[ \fB-noResolve\fR ] 
.br
[ \fB-only\fR \fItypeExpr\fR [ \fB(\fIidExpr1\fR [\fB:\fIidExpr2\fR ] | \firesourceName\fB)\fR ] ] 
.br
[ \fB-only \fItype\fR ] 
[ \fB-p\fR ] 
[ \fB-rd\fR ]
.br 
[ \fB-script Roman \fR|\fB Japanese \fR|\fB Korean \fR|\fB SimpChinese \fR|\fB 
.br
\ \ \ TradChinese \fR] 
.br
[ \fB-s\fR[\fBkip\fR] \fItypeExpr\fR [ \fB(\fIidExpr1\fR [\fB:\fIidExpr2\fR ] | \fIresourceName\fB)\fR ] ] 
.br
[ \fB-s\fR[\fBkip\fR] \fItype\fR ] 
[ \fB-u\fR[\fBndef\fR] \fImacro\fR ] 
.br
[ \fB-useDF\fR ]
.SH DESCRIPTION
The 
.B DeRez 
tool decompiles the resource fork of 
.I resourceFile 
according to the type declarations supplied by the type declaration files. The resource description produced by this decompilation contains the resource definitions (resource and data statements) associated with these type declarations. If for some reason it cannot reproduce the appropriate resource statements, 
.B DeRez 
generates hexadecimal data statements instead.
.PP
A type declaration file is a file of type declarations used by the resource compiler, 
.B Rez. 
The type declarations for the standard Macintosh resources are contained in the 
.B Types.r 
and 
.B SysTypes.r 
files, contained in the 
.B {RIncludes} 
folder. If you do not specify any type declaration files, 
.B DeRez 
produces data statements in hexadecimal form.
.PP
This same process works backward to recompile the resource fork. If you use the output of 
.B DeRez 
and the appropriate type declaration files as input to 
.B Rez, 
it produces the original resource fork of 
.I resourceFile. 
.SH INPUT
An input file containing resources in its resource fork. 
.B DeRez 
does not read standard input. You can also specify resource description files containing type declarations. For each type declaration file on the command line, 
.B DeRez 
applies the following search rules:
.PP
.PD 0
.IP 1. 3
.B DeRez 
tries to open the file with the name specified as is.
.IP 2. 3
If rule 1 fails and the filename contains no colons or begins with a colon, 
.B DeRez 
appends the filename to each of the pathnames specified by the 
.B {RIncludes} 
variable and tries to open the file.
.PD
.SH OUTPUT
Standard output. 
.B DeRez 
writes a resource description to standard output consisting of resource and data statements that can be understood by 
.B Rez. 
If you omit the 
.I typeDeclFile1 
[ 
.I typeDeclFile2 
]... parameter, 
.B DeRez 
generates hexadecimal data statements instead.
.PP
Errors and warnings are written to diagnostic output.
.SH ALIAS RESOLUTION
This command resolves Finder aliases on all input file specifications. Finder aliases are also resolved in the pathnames of any files included by specified resource definition files. You can optionally suppress the resolution of leaf aliases for the input resource file (with the 
.B -noResolve 
option).
.SH STATUS
DeRez can return the following status codes:
.PP
.PD 0
.TP 3
.B 0
no errors
.TP 3
.B 1
error in parameters
.TP 3
.B 2
syntax error in resourceFile
.TP 3
.B 3
I/O or program error
.PD 
.SH PARAMETERS
.TP 
.I resourceFile
Specifies a file containing the resource fork to be decompiled.
.TP
\fItypeDeclFile1\fR [ \fItypeDeclFile2\fR ]...
Specifies one or more files containing type declarations. These type declarations are the templates associated with the information in the resource description. In addition to using those in the 
.B {RIncludes} 
folder, you can also specify your own type declaration files. 
.IP 
.B Note
.br
The 
.B DeRez 
tool ignores any 
.B include 
(but not 
.B #include\fR), 
.B read\fR, 
.B data\fR, 
.B change\fR, 
.B delete\fR, 
and 
.B resource 
statements found in these files. However, it still checks these statements for correct syntax. 
.SH OPTIONS
.TP 
\fB-c\fR[\fBompatible\fR]
Generates output that is backward-compatible with 
.B Rez 
1.0.
.TP
\fB-d\fR[\fBefine\fR] \fImacro\fR [ \fB= \fIdata\fR ] 
Defines the macro variable 
.I macro 
as having the value 
.I data\fR. 
You can use this option more than once on a command line.
.RS
.TP
.I macro
Specifies the macro variable to be defined. 
.TP
.I data
Specifies the value of 
.I macro. 
This is the same as writing
.IP
#define 
.I macro
[ 
.I data
] 
.IP
at the beginning of the resource file.
.IP
If you do not specify 
.I data, 
.B DeRez 
sets the value of 
.I data 
to the null string. Note that this still defines the macro.
.RE 
.TP
\fB-e\fR[\fBscape\fR]
Prints characters that are normally escaped, such as \\0xff, as extended Macintosh characters. By default, characters with values between $20 and $FF are printed as Macintosh characters. With this option, however, 
.B DeRez 
prints all characters (except null, newline, tab, backspace, form feed, vertical tab, and rubout) as characters, not as escape sequences.
.IP
.B Note
.br
Not all fonts have all the characters defined.
.TP
\fB-i \fIdirectoryPath\fR
Specifies the directory to search for 
.B #include 
files. You may specify this option more than once. Directory paths are searched in the order in which they appear on the command line. 
.TP 
\fB-m\fR[\fBaxstringsize\fR] \fIn\fR
Sets the maximum output string width to 
.I n\fR, 
where 
.I n 
must be in the range 2\-120. 
.TP 
.B -noResolve
Suppresses leaf alias resolution of the file or pathname for the input resource file thus allowing the resource fork of a Finder alias file to be decompiled. Finder aliases are still resolved on all resource definition file paths and on any files they may include.
.TP 
\fB-only \fItypeExpr\fR [ \fB(\fIidExpr1\fR[\fB:\fIidExpr2\fR] | \fIresourceName\fB)\fR ]
Reads only resources of the type indicated by 
.I typeExpr\fR. 
An ID (\fIidExpr1\fR), range of IDs (\fIidExpr1\fR:\fIidExpr2\fR), or resource name can also be supplied to further specify which resources to read. If you provide this additional information, 
.B DeRez 
reads only the specified resources. 
.IP
This option can be repeated multiple times. Note that this option cannot be specified in conjunction with the 
.B -skip 
option.
.IP
.B Note
.br
The 
.I typeExpr 
parameter is an expression and must be enclosed in single quotation marks. If you also specify an ID, range of IDs, or resource name, you must place double quotation marks around the entire option parameter, as in these examples:
.IP
-only "'MENU' (1:128)" 
.br
-only "'MENU' ("MyMenu")"
.TP
\fB-only \fItype\fR
Reads only resources of the specified type. It is not necessary to place quotation marks around the type as long as it starts with a letter and contains no spaces or special characters. For example, this specification doesn't require quotation marks:
.IP
-only MENU
.IP
Escape characters are not allowed. This option can be repeated multiple times.
.TP
.B -p
Writes progress and summary information to standard output.
.TP
.B -rd
Suppresses warning messages emitted when a resource type is redeclared.
.TP
\fB-script Roman \fR|\fB Japanese \fR|\fB Korean \fR|\fB SimpChinese \fR|\fB TradChinese\fR
Enables the recognition of any of several 2-byte character script systems to use when compiling and decompiling files. This option insures that 2-byte characters in strings are handled as indivisible entities. The default language is 
.B Roman 
and specifies 1-byte character sets.
.TP
\fB-s\fR[\fBkip\fR] \fItypeExpr\fR [ \fB(\fIidExpr1\fR [\fB:\fIidExpr2\fR ] | \fIresourceName\fB)\fR ]
Skips resources of the type indicated by 
.I typeExpr\fR. 
For example, it is very useful to be able to skip 'CODE' resources. 
.IP
An ID (\fIidExpr1\fR), range of IDs (\fIidExpr1\fR:\fIidExpr2\fR), or resource name can also be supplied to further specify which resources to skip. If you provide this additional information, 
.B DeRez 
skips only the specified resources. 
.IP
You can repeat this option multiple times. Note that this option cannot be used in conjunction with the 
.B -only 
option.
.IP
.B Note
.br
The 
.I typeExpr 
parameter is an expression and must be enclosed in single quotation marks. If you also specify an ID, range of IDs, or resource name, you must place double quotation marks around the entire option parameter, as in this example: 
.IP
-skip "'MENU' (1:128)" 
.br
-skip "'MENU' ("MyMenu")"
.TP
\fB-s\fR[\fBkip\fR] \fItype\fR
Skips only resources of the specified type. It is not necessary to place quotation marks around the type as long as it starts with a letter and does not contain spaces or special characters. For example, this specification doesn't require quotation marks:
.IP
-skip CODE
.IP
Escape characters are not allowed. This option can be repeated multiple times.
.TP
\fB-u\fR[\fBndef\fR] \fImacro\fR
Undefines the preset macro variable 
.Imacro\fR. 
This is the same as writing 
.IP
#undef 
.I macro 
.IP
at the beginning of the resource file. This option can be repeated more than once on a command line.
.TP
.B -useDF
Reads and writes resouce information from the files' data forks, instead of their resource forks.
.SH EXAMPLES
The following command line displays all the 'MENU' resources used by the MPW Shell. The type declaration for 'MENU' resources is found in the 
.B Types.r 
file. 
.PP
DeRez "{ShellDirectory}MPW Shell" -only MENU Types.r 
.PP
In the following example, 
.B DeRez 
decompiles the string resource with ID 150 in the System file located in the 
.B HD:OS 
directory. 
.PP
DeRez HD:OS:System SysTypes.r -only "'STR ' (150)" 
.SH SEE ALSO
.B Rez
.br
Type declaration files in the 
.B {RIncludes} 
folder