📄 rfc1740.txt
字号:
Faltstrom, Crocker & Fair [Page 6]RFC 1740 MIME-based Mac files December 1994Appendix A. The AppleSingle format In the AppleSingle format, a file's contents and attributes are stored in a single file in the foreign file system. For example, both forks of a Macintosh file, the Finder information, and an associated comment are arranged in a single file with a simple structure. 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 a data entry. Each entry is optional and may or may not appear in the file. AppleSingle file header: Field Length Magic number 4 bytes Version number 4 bytes Filler 16 bytes Number of entries 2 bytes Entry descriptor for each entry: Entry ID 4 bytes Offset 4 bytes Length 4 bytes Byte ordering in the file fields follows MC68000 conventions, most significant byte first. The fields in the header file follow the conventions described in the following sections. Magic number This field, modelled after the UNIX magic number feature, specifies the file's format. Apple has defined the magic number for the AppleSingle format as $00051600 or 0x00051600. Version number This field denotes the version of AppleSingle format in the event the format evolves (more fields may be added to the header). The version described in this note is version $00020000 or 0x00020000. Filler This field is all zeros ($00 or 0x00). Number of entries This field specifies how many different entries are included inFaltstrom, Crocker & Fair [Page 7]RFC 1740 MIME-based Mac files December 1994 the file. It is an unsigned 16-bit number. If the number of entries is any number other than 0, then that number of entry descriptors immediately follows the number of entries field. Entry descriptors The entry descriptor is made up of the following three fields: Entry ID: an unsigned 32-bit number, defines what the entry is. Entry IDs range from 1 to $FFFFFFFF. Entry ID 0 is invalid. Offset: an unsigned 32-bit number, shows the offset from the beginning of the file to the beginning of the entry's data. Length: an unsigned 32-bit number, shows the length of the data in bytes. The length can be 0. Predefined entry ID's Apple has defined a set of entry IDs and their values as follows: Data Fork 1 Data fork Resource Fork 2 Resource fork Real Name 3 File's name as created on home file system Comment 4 Standard Macintosh comment Icon, B&W 5 Standard Macintosh black and white icon Icon, Colour 6 Macintosh colour icon File Dates Info 8 File creation date, modification date, and so on Finder Info 9 Standard Macintosh Finder information Macintosh File Info 10 Macintosh file information, attributes and so on ProDOS File Info 11 ProDOS file information, attributes and so on MS-DOS File Info 12 MS-DOS file information, attributes and so on Short Name 13 AFP short name AFP File Info 14 AFP file, information, attributes and so on Directory ID 15 AFP directory ID Apple reserves the range of entry IDs from 1 to $7FFFFFFF. The rest of the range is available for applications to define their own entries. Apple does not arbitrate the use of the rest of the range.Appendix B. The AppleDouble formatFaltstrom, Crocker & Fair [Page 8]RFC 1740 MIME-based Mac files December 1994 The AppleDouble format uses two files to store data, resources and attributes. The AppleDouble Data file contains the data fork and the AppleDouble Header file contains the resource fork. The AppleDouble Data file contains the standard Macintosh data fork with no additional header. The AppleDouble Header file has exactly the same format as the AppleSingle file, except that it does not contain a Data fork entry. The magic number in the AppleDouble Header file differs from the magic number in the AppleSingle Header file so that an application can tell whether it needs to look in another file for the data fork. The magic number for the AppleDouble format is $00051607 or 0x00051607. The entries in the AppleDouble Header file can appear in any order; however, since the resource fork is the entry that is most commonly extended (after the data fork), Apple recommends that the resource fork entry to be placed last in the file. The data fork is easily extended because it resides by itself in the AppleDouble Data file.Appendix C. applefile.h This is an example of a header file for the language C which can be used when parsing the data in either an AppleSingle file or AppleDouble header. The file is written by Lee Jones. Distribution is unlimited. /* applefile.h - Data structures used by AppleSingle/AppleDouble * file format * * Written by Lee Jones, 22-Oct-1993 * * For definitive information, see "AppleSingle/AppleDouble * Formats for Foreign Files Developer's Note"; Apple Computer * Inc.; (c) 1990. * * Other details were added from: * Inside Macintosh [old version], volumes II to VI, * Apple include files supplied with Think C 5.0.1, * Microsoft MS-DOS Programmer's Reference, version 5, and * Microsoft C 6.00a's dos.h include file. * * I don't have ProDOS or AFP Server documentation so related * entries may be a bit skimpy. * * Edit history: * * when who whyFaltstrom, Crocker & Fair [Page 9]RFC 1740 MIME-based Mac files December 1994 * --------- --- ------------------------------------------ * 22-Oct-93 LMJ Pull together from Inside Macintosh, * Developer's Note, etc * 26-Oct-93 LMJ Finish writing first version and list * references * 06-Feb-94 EEF Very minor cleanup */ /* Following items define machine specific size (for porting). */ typedef char xchar8; /* 8-bit field */ typedef char schar8; /* signed 8-bit field */ typedef unsigned char uchar8; /* unsigned 8-bit field */ typedef short xint16; /* 16-bit field */ typedef unsigned short uint16; /* unsigned 16-bit field */ typedef long xint32; /* 32-bit field */ typedef long sint32; /* signed 32-bit field */ typedef unsigned long uint32; /* unsigned 32-bit field */ /* REMINDER: the Motorola 680x0 is a big-endian architecture! */ typedef uint32 OSType; /* 32 bit field */ /* In the QuickDraw coordinate plane, each coordinate is * -32767..32767. Each point is at the intersection of a * horizontal grid line and a vertical grid line. Horizontal * coordinates increase from left to right. Vertical * coordinates increase from top to bottom. This is the way * both a TV screen and page of English text are scanned: * from top left to bottom right. */ struct Point /* spot in QuickDraw 2-D grid */ { xint16 v; /* vertical coordinate */ xint16 h; /* horizontal coordinate */ }; /* Point */ typedef struct Point Point; /* See older Inside Macintosh, Volume II page 84 or Volume IV * page 104. */ struct FInfo /* Finder information */ { OSType fdType; /* File type, 4 ASCII chars */ OSType fdCreator; /* File's creator, 4 ASCII chars */Faltstrom, Crocker & Fair [Page 10]RFC 1740 MIME-based Mac files December 1994 uint16 fdFlags; /* Finder flag bits */ Point fdLocation; /* file's location in folder */ xint16 fdFldr; /* file 's folder (aka window) */ }; /* FInfo */ typedef struct FInfo FInfo; /* * Masks for finder flag bits (field fdFlags in struct * FInfo). */ #define F_fOnDesk 0x0001 /* file is on desktop (HFS only) */ #define F_maskColor 0x000E /* color coding (3 bits) */ /* 0x0010 /* reserved (System 7) */ #define F_fSwitchLaunch 0x0020 /* reserved (System 7) */ #define F_fShared 0x0040 /* appl available to multiple users */ #define F_fNoINITs 0x0080 /* file contains no INIT resources */ #define F_fBeenInited 0x0100 /* Finder has loaded bundle res. */ /* 0x0200 /* reserved (System 7) */ #define F_fCustomIcom 0x0400 /* file contains custom icon */ #define F_fStationary 0x0800 /* file is a stationary pad */ #define F_fNameLocked 0x1000 /* file can't be renamed by Finder */ #define F_fHasBundle 0x2000 /* file has a bundle */ #define F_fInvisible 0x4000 /* file's icon is invisible */ #define F_fAlias 0x8000 /* file is an alias file (System 7) */ /* See older Inside Macintosh, Volume IV, page 105. */ struct FXInfo /* Extended finder information */ { xint16 fdIconID; /* icon ID number */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -