Resource Fork - Data Types in A Resource Fork

Data Types in A Resource Fork

The smallest elements making up a resource fork are called data types. There are several data types. After a resource fork is accessed, its contents can be found by reading it in as appropriate for the data types defined in advance. Placing definitions inside the program stating how data is to be treated makes it possible to store resources called TMPL resources as well. Using this method increases the visibility of the data when viewed with a program such as ResEdit, making later editing simpler. As the Macintosh platform originated with Motorola-based processors (68k and PPC), the data is serialized to disk in big endian format.

The following is a list of the major data types, in alphabetical order.

Data type (actual name) Description
BBIT (binary bit) Represents a single boolean bit (true or false). Normally the number of BBITs must be a multiple of 8.
BOOL (boolean) Represents a boolean value. It consists of 2 bytes; 256 is true, and 0 is false.
CHAR (character) Represents a one-byte character.
CSTR (C string) Represents a string of the form used in the C programming language: a null-terminated string of bytes.
DLNG (decimal long word integer) A decimal long word (4 byte) integer. Represents values between approximately −2.1 billion and 2.1 billion.
HEXD (hex dump) Indicates that the data from this position to the end is hexadecimal. This is used to represent code resources or compressed data.
HLNG (long word hexadecimal) This data is treated as a 4 byte hexadecimal value. It is used, among other things, to represent integers greater than 2.1 billion, such as unsigned long values in C.
PSTR (Pascal string) Represents a Pascal string, with the first byte giving the length of the string.
TNAM (type name) A string representing a value such as a creator code, which is always 4 bytes long.
RECT (rectangle) Represents the coordinates of the corners of a rectangle. Always 8 bytes long.

Read more about this topic:  Resource Fork

Famous quotes containing the words data, types, resource and/or fork:

    Mental health data from the 1950’s on middle-aged women showed them to be a particularly distressed group, vulnerable to depression and feelings of uselessness. This isn’t surprising. If society tells you that your main role is to be attractive to men and you are getting crow’s feet, and to be a mother to children and yours are leaving home, no wonder you are distressed.
    Grace Baruch (20th century)

    If there is nothing new on the earth, still the traveler always has a resource in the skies. They are constantly turning a new page to view. The wind sets the types on this blue ground, and the inquiring may always read a new truth there.
    Henry David Thoreau (1817–1862)

    No, Ernest, don’t talk about action.... It is the last resource of those who know not how to dream.
    Oscar Wilde (1854–1900)

    Wherever a man separates from the multitude, and goes his own way in this mood, there indeed is a fork in the road, though ordinary travelers may see only a gap in the paling. His solitary path across lots will turn out the higher way of the two.
    Henry David Thoreau (1817–1862)