resorcerer


Resource Data Templates

R esorcerer contains a very powerful, fully 32-bit Data Editor, which you can use to edit arbitrary binary resource or data fork data in a structured manner.

The Data Editor parses the data of a given type by following a set of instructions that declares the structure to use. Each set of instructions is called a template. Each template is itself kept in a resource, and Resorcerer provides a dedicated Template Editor for creating, viewing, and maintaining templates.

Resorcerer looks for standard templates for commonly edited system or application resources in its own templates folder, shipped with the application. You can also keep templates for your private resources types in a Private Templates folder, or you can keep one right in the same file as the custom resource it describes (Resorcerer will use it first before looking elsewhere).


Template Resources

Each template is stored in a resource of type 'TMPL'. The first 4 characters of the 'TMPL' resource's name uniquely identify the type of data structure the template declares.

The 'TMPL' resource is itself a binary data structure. It is nothing more than an arbitrarily long repeated list of entries called fields, where each field consists of two parts:

The Pascal string is called the field's label. It consists of an unsigned length byte followed by that many bytes of data. The label primarily serves to identify for the user of the Data Editor what each parsed data field's purpose is. Occasionally, the label has certain special characteristics for the benefit of the Data Editor's parser, but in general it is equivalent to a comment in a compiled language.

The four-byte constant, or type, encodes the size and manner of presentation of the next data field to be parsed from the data. There are over 120 defined field types in Resorcerer, described below.

There are no pad bytes anywhere in the 'TMPL' structure, so a 4-byte type field can occur at any byte position in the template.


Resorcerer Supports All ResEdit Templates

The above-described template structure was first implemented in Apple's ResEdit resource editor in the mid-80's. ResEdit supports 35 four-byte field types with which you can define and then directly edit various simple data structures. Although these field types suffice to describe a minimal set of standard Macintosh resources, in the ensuing decade developers have needed to create much larger and more complicated data structures than ResEdit can support.

Fortunately, if you've invested time in creating your own ResEdit templates, Resorcerer won't let you down. The parsing engine in Resorcerer's Data Editor completely supports ResEdit-style 'TMPL' resources, at the same time as significantly enhancing the kinds of data that you parse and edit. The Data Editor's interface is fairly different from ResEdit's, but much faster and more powerful. Unlike ResEdit, the Data Editor in Resorcerer is also completely 32-bit so it can handle very large resources quickly and easily.

If you would like to try the Resorcerer template system out (as well as the rest of the program), first download our demo. Then try opening the special 'Demo' 128 resource in the accompanying file, "Resorcerer TMPL Demo".


Resorcerer Template Field Types

Resorcerer's extended field types provide support for

and more. You can even use special insertion/deletion field types to add or subtract data fields, including repeated instances, to existing resources automatically.

The following tables list all Resorcerer-supported template field types, as of version 2.0. Those types that will only work in Resorcerer are noted in red. All types marked Both will also work in ResEdit templates.

Decimal and Hex Integer Field Types

Type
Description
Size
Editor
DBYT
Signed Decimal Byte
1 byte
Both
DWRD
Signed Decimal Word
2 bytes
Both
DLNG
Signed Decimal Long
4 bytes
Both
UBYT
Unsigned Decimal Byte
1 byte
Resorcerer
UWRD
Unsigned Decimal Word
2 bytes
Resorcerer
ULNG
Unsigned Decimal Long
4 bytes
Resorcerer
HBYT
Unsigned Hex Byte
1 byte
Both
HWRD
Unsigned Hex Word
2 bytes
Both
HLNG
Unsigned Hex Long
4 bytes
Both

Bit and Bit Field Types (parsing proceeds from high-order bits first)

Type
Description
Size
Editor
BBIT
Bit Within a Byte
1 bit
Both
BBnn
Bit Field Within a Byte
nn bits
Both
WBIT
Bit Within a Word
1 bit
Resorcerer
WBnn
Bit Field Within a Word
nn bits
Resorcerer
LBIT
Bit Within a Long
1 bit
Resorcerer
LBnn
Bit Field Within a Long
nn bits
Resorcerer
BFLG
Byte Boolean Flag (low-order bit)
1 byte
Resorcerer
WFLG
Word Boolean Flag (low-order bit)
2 bytes
Resorcerer
LFLG
Long Boolean Flag (low-order bit)
4 bytes
Resorcerer

Miscellaneous Graphic and System Field Types

Type
Description
Size
Editor
RSID
Signed Resource ID Integer
2 bytes
Resorcerer
BOOL
Boolean Word
2 bytes
Both*
CHAR
ASCII Character
1 byte
Both
TNAM
Type Name
4 bytes
Both
DATE
Macintosh System Date/Time (seconds)
4 bytes
Resorcerer
MDAT
Modification Date/Time (seconds)
4 bytes
Resorcerer
SCPC
MacOS System Script Code
2 bytes
Resorcerer
LNGC
MacOS System Language Code
2 bytes
Resorcerer
RGNC
MacOS System Region Code
2 bytes
Resorcerer
PNT **
QuickDraw Point
4 bytes
Both
RECT
QuickDraw Rectangle
8 bytes
Both
COLR
QuickDraw Color RGB Triplet
6 bytes
Resorcerer
CLUT
Color Lookup Table Hex Dump
variable
Resorcerer
CODE
680x0 Disassembled Code Dump
variable
Resorcerer

* You can configure Resorcerer to use any 16-bit non-zero value when setting a BOOL field to true.
** The 'PNT ' field type ends in a space character.

Floating and Fixed Point Field Types

Type
Description
Size
Editor
REAL
Single Precision Float
4 bytes
Resorcerer
DOUB
Double Precision Float
8 bytes
Resorcerer
EXTN
Extended 80-bit SANE Float
10 bytes
Resorcerer
XT96
Extended 96-bit SANE Float
12 bytes
Resorcerer
UNIV
THINK C Universal 96-bit Float
12 bytes
Resorcerer
FIXD
16:16 Fixed Point Number
4 bytes
Resorcerer
FRAC
2:30 Fixed Point Fraction
4 bytes
Resorcerer
SFRC
0:16 Fixed Point Small Fraction
2 bytes
Resorcerer
FWID
4:12 Fixed Point Font Width
2 bytes
Resorcerer
FXYZ
1:15 Fixed Point Color Component
2 bytes
Resorcerer

ASCII Text String Field Types

Type
Description
Bytes
Editor
PSTR
Pascal String
1 ... 256
Both
ESTR
Even-Padded Pascal String
2 ... 256
Both
PPST
Even Pascal String (pad included)
2 .... 256
Resorcerer
OSTR
Pascal String Odd-Padded
1 ... 255
Both
CSTR
Null-Terminated C String
1 or more
Both
ECST
Even-Padded C String
2 or more
Both
OCST
C String Odd-Padded
1 or more
Both
BSTR
Byte Length String (same as PSTR)
1 ... 256
Resorcerer
WSTR
Word Length String
2 ... 65KB
Both
LSTR
Long Length String
4 ... 4MB
Both
TXTS
Sized Text Dump
variable
Resorcerer
Pnmm
Pascal String with Fixed Padding
$nmm bytes
Both*
Cnmm
C String with Fixed Padding
$nmm bytes
Both
Tnmm
Text with Fixed Padding
$nmm bytes
Resorcerer

* This field type's behavior is configurable between ResEdit-style and Resorcerer's more consistent style.

Hexadecimal Dump Field Types

Type
Description
Bytes
Editor
BHEX
Byte Length Hex Dump
1 ... 256
Resorcerer
WHEX
Word Length Hex Dump
2 ... 65KB
Resorcerer
LHEX
Long Length Hex Dump
4 ... 4MB
Resorcerer
BSHX
Byte Length - 1 Hex Dump
1 ... 255
Resorcerer
WSHX
Word Length - 2 Hex Dump
2 ... 65KB-2
Resorcerer
LSHX
Long Length - 4 Hex Dump
4 ... 4MB-4
Resorcerer
Hnmm
Fixed-Length Hex Dump
$nmm
Both
HEXS
Sized Hex Dump
variable
Resorcerer
HEXD
Hex Dump
variable
Both*

* This field type's behavior is more general in Resorcerer's Data Editor than in ResEdit's

Skip Offset Field Types (automatically computed)

Type
Description
Size
Editor
BSKP
Offset to SKPE in Byte, inclusive
1 byte
Resorcerer
WSKP
Offset to SKPE in Word, inclusive
2 bytes
Resorcerer
LSKP
Offset to SKPE in Long, inclusive
4 bytes
Resorcerer
BSIZ
Offset to SKPE in Byte, exclusive
1 byte
Resorcerer
WSIZ
Offset to SKPE in Word, exclusive
2 bytes
Resorcerer
LSIZ
Offset to SKPE in Long, exclusive
4 bytes
Resorcerer
SKPE
End of Skip or Sizeof
0 bytes
Resorcerer

Symbolic Constants and Comments

Type
Description
Size
Editor
CASE
Symbolic and/or Default Value
0 bytes
Resorcerer
DVDR
Divider Line with Comment
0 bytes
Resorcerer

Counted Lists/Arrays

Type
Description
Size
Editor
BCNT
Byte Count of List Items
1 byte
Resorcerer
OCNT
One-Based Count of List Items
2 bytes
Both
WCNT
Word Count of List Items (same as OCNT)
2 bytes
Resorcerer
LCNT
Long Count of List Items
4 bytes
Resorcerer
ZCNT
Zero-Based Count of List Items
2 bytes
Resorcerer
LZCT
Zero-Based Count of List Items
4 bytes
Resorcerer
FCNT
Fixed Count of List Items
0 bytes
Resorcerer
LSTC
Begin Counted List Item
0 bytes
Both
LSTB
Begin Non-Counted List Item
0 bytes
Both
LSTS
Begin Sized List Item
0 bytes
Resorcerer
LSTZ
Begin List Item, Ending in Zero Byte
0 bytes
Both
LSTE
End of any List Item
0 or 1 bytes
Both
SELF
List Item is Entire TMPL
variable
Resorcerer

Key Values for Subsequent Variant Items

Type
Description
Size
Editor
KBYT
Signed Decimal Byte Key
1 byte
Resorcerer
KWRD
Signed Decimal Word Key
2 bytes
Resorcerer
KLNG
Signed Decimal Long Key
4 bytes
Resorcerer
KUBT
Unsigned Decimal Byte Key
1 byte
Resorcerer
KUWD
Unsigned Decimal Word Key
2 bytes
Resorcerer
KULG
Unsigned Decimal Long Key
4 bytes
Resorcerer
KHBT
Unsigned Hex Byte Key
1 byte
Resorcerer
KHWD
Unsigned Hex Word Key
2 bytes
Resorcerer
KHLG
Unsigned Hex Long Key
4 bytes
Resorcerer
KCHR
Single ASCII Character Key
1 byte
Resorcerer
KTYP
Four-Character Type Key
4 bytes
Resorcerer
KRID
Key on Resource ID, Not Data
0 bytes
Resorcerer
KEYB
Begin Keyed Item for Previous CASE
0 bytes
Resorcerer
KEYE
End of Keyed Item
0 bytes
Resorcerer

Alignment Field Types (Uneditable)

Type
Description
Bytes
Editor
AWRD
Align to 2-byte boundary
0 or 1
Both
ALNG
Align to 4-byte boundary
0 ... 3
Both
AL08
Align to 8-byte boundary
0 ... 7
Resorcerer
AL16
Align to 16-byte boundary
0 ... 15
Resorcerer

Filler Field Types (Uneditable)

Type
Description
Size
Editor
FBYT
Fill Byte
1 byte
Both
FWRD
Fill Word
2 bytes
Both
FLNG
Fill Long
4 bytes
Both
Fnmm
Fill Bytes
$nmm bytes
Resorcerer

Inserting New Data Fields in Existing Resources

Type
Description
Bytes
Editor
+BYT
Insert a Byte When Opening
1
Resorcerer
+WRD
Insert a Word When Opening
2
Resorcerer
+LNG
Insert a Long When Opening
4
Resorcerer
+nmm
Insert Bytes When Opening
$nmm
Resorcerer
+PST
Insert a Pascal String When Opening
1 ... 256
Resorcerer
+EST
Insert an Even Pascal String When Opening
2 ... 256
Resorcerer
+CST
Insert a C String When Opening
1 or more
Resorcerer

Deleting Old Data Fields from Existing Resources

Type
Description
Bytes
Editor
-BYT
Delete a Byte When Closing
1
Resorcerer
-WRD
Delete a Word When Closing
2
Resorcerer
-LNG
Delete a Long When Closing
4
Resorcerer
-nmm
Delete Bytes When Closing
$nmm
Resorcerer
-PST
Delete a Pascal String When Closing
1 ... 256
Resorcerer
-EST
Delete an Even Pascal String When Closing
2 ... 256
Resorcerer
-CST
Delete a C String When Closing
1 or more
Resorcerer

Big and Little-Endian Parsing

Type
Description
Size
Editor
BNDN
Use Big-Endian Data Parsing
0
Resorcerer
LNDN
Use Little-Endian Data Parsing
0
Resorcerer

Pre- and Post-Processing Data with Code Filters

Type
Description
Size
Editor
FLTR
Declare Filtered Template (with comment)
0
Resorcerer


Filtered Templates

For resources that can't be fully described by the above language, you can use Resorcerer's resource filtering system to pre- and post-process resources to make them temporarily editable. Thus, nearly all possible data structures (that have anything in them worth editing) are interactively editable with Resorcerer. This includes:

This system lets you design a template for those parts of a resource that humans should attend to, and an algorithmic code resource for those structural parts of a resource that the computer is better at attending to. Because the filter code need have no user-interface, filters are much easier to create as code resources than a complete ResEdit editor might be. A filter's sole responsibility is to convert one handle of data into another handle of data, and then back again.

For instance, Resorcerer's Data Editor lets you open any of the standard color QuickDraw resources with indexed pixmaps ('crsr', 'cicn', or 'ppat') in them in order to see their color tables. The various templates that parse the QuickDraw resources are filtered, so that they can perform proper computations for pixmap data sizes, etc. that would otherwise be impossible in a standard non-filtered template.


Data Sheets and Descriptions: General | Editors

home salesinfo 125 ways ftp site
Home Page Ordering 125 Ways Free Demos