The following is copied from "A/UX Toolbox: Macintosh ROM Interface manual", Chapter 6 File Systems and File Formats, pages 6-16 to 6-19. It's available in a printable version, too

Applesingle and AppleDouble format internals

Applesingle format stores the data, resources, and attributes of a Macintosh file in a single A/UX file. AppleDouble format stores a file's data in one file and stores its resources and attributes in another file.

This section uses these terms:

Applesingle format

In Applesingle format, all of a file's contents and attributes are stored in a single file in the foreign file system.

An Applesingle file consists of a header followed by one or more data entries. The header consists of several fixed fields and a list of entry descriptors, each pointing to an entry. Table 6-3 describes the contents of an Applesingle file header.

Table 6-3 AppleSingle file header:


Field Length
Magic number 4 bytes Version number 4 bytes Home file system 16 bytes. ASCII encoded Number of entities 2 bytes Entry descriptor for each entry Entry ID 4 bytes Offset 4 bytes Length 4 bytes

Byte ordering in the file-header fields follows MC68000, MC68020, and MC68030 conventions. Here is a description of each field:

The entry data follows all of the entry descriptors. The data in each entry must be in a single, contiguous block. You can leave holes in the file for later expansion of data. For example, even if a file's comment field is only 10 bytes long, you can place the offset of the next field 200 bytes beyond the offset of the comment field, to leave room for the comment to grow to its maximum length of 200 bytes.

The entries can appear in any order, but you can maximize the efficiency of file access by following these recommendations:

Figure 6.5

Figure 6-5 Formats for "file info" field entries

AppleDouble format

In AppleDouble format, the file's data fork is stored in a file called the AppleDouble data file, and the file's attributes and resources are stored in a separate file called the AppleDouble headerfile.

The AppleDouble data file contains the data fork, in exactly the form in which it appears in a Macintosh file. with no extra header.

The AppleDouble header file has the same format as an Applesingle file, except that it contains no data fork entry. The magic number for an AppleDouble header file is 0x00051607. The entries in the header file can appear in any order. It is usually more efficient to put the resource fork at the end of the file because the resource fork is the entry most likely to expand.