macintosh revision 68349
168349Sobrien
268349Sobrien#------------------------------------------------------------------------------
368349Sobrien# macintosh description
468349Sobrien#
568349Sobrien# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
668349Sobrien# Daniel Quinlan, quinlan@yggdrasil.com
768349Sobrien11	string	must\ be\ converted\ with\ BinHex	BinHex binary text
868349Sobrien>41	string	x					\b, version %.3s
968349Sobrien
1068349Sobrien# Stuffit archives are the de facto standard of compression for Macintosh
1168349Sobrien# files obtained from most archives. (franklsm@tuns.ca)
1268349Sobrien0	string		SIT!			StuffIt Archive (data)
1368349Sobrien>2	string		x			: %s
1468349Sobrien0	string		SITD			StuffIt Deluxe (data)
1568349Sobrien>2	string		x			: %s
1668349Sobrien0	string		Seg			StuffIt Deluxe Segment (data)
1768349Sobrien>2	string		x			: %s
1868349Sobrien
1968349Sobrien# Macintosh Applications and Installation binaries (franklsm@tuns.ca)
2068349Sobrien0	string		APPL			Macintosh Application (data)
2168349Sobrien>2	string		x			\b: %s
2268349Sobrien
2368349Sobrien# Macintosh System files (franklsm@tuns.ca)
2468349Sobrien0	string		zsys			Macintosh System File (data)
2568349Sobrien0	string		FNDR			Macintosh Finder (data)
2668349Sobrien0	string		libr			Macintosh Library (data)
2768349Sobrien>2	string		x			: %s
2868349Sobrien0	string		shlb			Macintosh Shared Library (data)
2968349Sobrien>2	string		x			: %s
3068349Sobrien0	string		cdev			Macintosh Control Panel (data)
3168349Sobrien>2	string		x			: %s
3268349Sobrien0	string		INIT			Macintosh Extension (data)
3368349Sobrien>2	string		x			: %s
3468349Sobrien0	string		FFIL			Macintosh Truetype Font (data)
3568349Sobrien>2	string		x			: %s
3668349Sobrien0	string		LWFN			Macintosh Postscript Font (data)
3768349Sobrien>2	string		x			: %s
3868349Sobrien
3968349Sobrien# Additional Macintosh Files (franklsm@tuns.ca)
4068349Sobrien0	string		PACT			Macintosh Compact Pro Archive (data)
4168349Sobrien>2	string		x			: %s
4268349Sobrien0	string		ttro			Macintosh TeachText File (data)
4368349Sobrien>2	string		x			: %s
4468349Sobrien0	string		TEXT			Macintosh TeachText File (data)
4568349Sobrien>2	string		x			: %s
4668349Sobrien0	string		PDF			Macintosh PDF File (data)
4768349Sobrien>2	string		x			: %s
4868349Sobrien
4968349Sobrien# MacBinary format (Eric Fischer, enf@pobox.com)
5068349Sobrien#
5168349Sobrien# Unfortunately MacBinary doesn't really have a magic number prior
5268349Sobrien# to the MacBinary III format.  The checksum is really the way to
5368349Sobrien# do it, but the magic file format isn't up to the challenge.
5468349Sobrien#
5568349Sobrien# 0	byte		0
5668349Sobrien# 1	byte				# filename length
5768349Sobrien# 2	string				# filename
5868349Sobrien# 65    string				# file type
5968349Sobrien# 69	string				# file creator
6068349Sobrien# 73	byte				# Finder flags
6168349Sobrien# 74	byte		0
6268349Sobrien# 75	beshort				# vertical posn in window
6368349Sobrien# 77	beshort				# horiz posn in window
6468349Sobrien# 79	beshort				# window or folder ID
6568349Sobrien# 81    byte				# protected?
6668349Sobrien# 82	byte		0
6768349Sobrien# 83	belong				# length of data segment
6868349Sobrien# 87	belong				# length of resource segment
6968349Sobrien# 91	belong				# file creation date
7068349Sobrien# 95	belong				# file modification date
7168349Sobrien# 99	beshort				# length of comment after resource
7268349Sobrien# 101	byte				# new Finder flags
7368349Sobrien# 102	string		mBIN		# (only in MacBinary III)
7468349Sobrien# 106	byte				# char. code of file name
7568349Sobrien# 107	byte				# still more Finder flags
7668349Sobrien# 116	belong				# total file length
7768349Sobrien# 120	beshort				# length of add'l header
7868349Sobrien# 122	byte		129		# for MacBinary II
7968349Sobrien# 122	byte		130		# for MacBinary III
8068349Sobrien# 123	byte		129		# minimum version that can read fmt
8168349Sobrien# 124	beshort				# checksum
8268349Sobrien#
8368349Sobrien# This attempts to use the version numbers as a magic number, requiring
8468349Sobrien# that the first one be 0x80, 0x81, 0x82, or 0x83, and that the second
8568349Sobrien# be 0x81.  This works for the files I have, but maybe not for everyone's.
8668349Sobrien
8768349Sobrien122	beshort&0xFCFF	0x8081		Macintosh MacBinary data
8868349Sobrien
8968349Sobrien# MacBinary I doesn't have the version number field at all, but MacBinary II
9068349Sobrien# has been in use since 1987 so I hope there aren't many really old files
9168349Sobrien# floating around that this will miss.  The original spec calls for using
9268349Sobrien# the nulls in 0, 74, and 82 as the magic number.
9368349Sobrien#
9468349Sobrien# Another possibility, that would also work for MacBinary I, is to use
9568349Sobrien# the assumption that 65-72 will all be ASCII (0x20-0x7F), that 73 will
9668349Sobrien# have bits 1 (changed), 2 (busy), 3 (bozo), and 6 (invisible) unset,
9768349Sobrien# and that 74 will be 0.  So something like
9868349Sobrien# 
9968349Sobrien# 71 	belong&0x80804EFF 0x00000000 	Macintosh MacBinary data
10068349Sobrien# 
10168349Sobrien# >73	byte&0x01	0x01		\b, inited
10268349Sobrien# >73	byte&0x02	0x02		\b, changed
10368349Sobrien# >73	byte&0x04	0x04		\b, busy
10468349Sobrien# >73	byte&0x08	0x08		\b, bozo
10568349Sobrien# >73	byte&0x10	0x10		\b, system
10668349Sobrien# >73	byte&0x10	0x20		\b, bundle
10768349Sobrien# >73	byte&0x10	0x40		\b, invisible
10868349Sobrien# >73	byte&0x10	0x80		\b, locked
10968349Sobrien
11068349Sobrien>65	string		x		\b, type "%4.4s"
11168349Sobrien
11268349Sobrien>65	string		8BIM		(PhotoShop)
11368349Sobrien>65	string		ALB3		(PageMaker 3)
11468349Sobrien>65	string		ALB4		(PageMaker 4)
11568349Sobrien>65	string		ALT3		(PageMaker 3)
11668349Sobrien>65	string		APPL		(application)
11768349Sobrien>65	string		AWWP		(AppleWorks word processor)
11868349Sobrien>65	string		CIRC		(simulated circuit)
11968349Sobrien>65	string		DRWG		(MacDraw)
12068349Sobrien>65	string		EPSF		(Encapsulated PostScript)
12168349Sobrien>65	string		FFIL		(font suitcase)
12268349Sobrien>65	string		FKEY		(function key)
12368349Sobrien>65	string		FNDR		(Macintosh Finder)
12468349Sobrien>65	string		GIFf		(GIF image)
12568349Sobrien>65	string		Gzip		(GNU gzip)
12668349Sobrien>65	string		INIT		(system extension)
12768349Sobrien>65	string		LIB\ 		(library)
12868349Sobrien>65	string		LWFN		(PostScript font)
12968349Sobrien>65	string		MSBC		(Microsoft BASIC)
13068349Sobrien>65	string		PACT		(Compact Pro archive)
13168349Sobrien>65	string		PDF\ 		(Portable Document Format)
13268349Sobrien>65	string		PICT		(picture)
13368349Sobrien>65	string		PNTG		(MacPaint picture)
13468349Sobrien>65	string		PREF		(preferences)
13568349Sobrien>65	string		PROJ		(Think C project)
13668349Sobrien>65	string		QPRJ		(Think Pascal project)
13768349Sobrien>65	string		SCFL		(Defender scores)
13868349Sobrien>65	string		SCRN		(startup screen)
13968349Sobrien>65	string		SITD		(StuffIt Deluxe)
14068349Sobrien>65	string		SPn3		(SuperPaint)
14168349Sobrien>65	string		STAK		(HyperCard stack)
14268349Sobrien>65	string		Seg\ 		(StuffIt segment)
14368349Sobrien>65	string		TARF		(Unix tar archive)
14468349Sobrien>65	string		TEXT		(ASCII)
14568349Sobrien>65	string		TIFF		(TIFF image)
14668349Sobrien>65	string		TOVF		(Eudora table of contents)
14768349Sobrien>65	string		WDBN		(Microsoft Word word processor)
14868349Sobrien>65	string		WORD		(MacWrite word processor)
14968349Sobrien>65	string		XLS\ 		(Microsoft Excel)
15068349Sobrien>65	string		ZIVM		(compress (.Z))
15168349Sobrien>65	string		ZSYS		(Pre-System 7 system file)
15268349Sobrien>65	string		acf3		(Aldus FreeHand)
15368349Sobrien>65	string		cdev		(control panel)
15468349Sobrien>65	string		dfil		(Desk Acessory suitcase)
15568349Sobrien>65	string		libr		(library)
15668349Sobrien>65	string		nX^d		(WriteNow word processor)
15768349Sobrien>65	string		nX^w		(WriteNow dictionary)
15868349Sobrien>65	string		rsrc		(resource)
15968349Sobrien>65	string		scbk		(Scrapbook)
16068349Sobrien>65	string		shlb		(shared library)
16168349Sobrien>65	string		ttro		(SimpleText read-only)
16268349Sobrien>65	string		zsys		(system file)
16368349Sobrien
16468349Sobrien>69	string		x		\b, creator "%4.4s"
16568349Sobrien
16668349Sobrien# Somewhere, Apple has a repository of registered Creator IDs.  These are
16768349Sobrien# just the ones that I happened to have files from and was able to identify.
16868349Sobrien
16968349Sobrien>69	string		8BIM		(Adobe Photoshop)
17068349Sobrien>69	string		ALD3		(PageMaker 3)
17168349Sobrien>69	string		ALD4		(PageMaker 4)
17268349Sobrien>69	string		ALFA		(Alpha editor)
17368349Sobrien>69	string		APLS		(Apple Scanner)
17468349Sobrien>69	string		APSC		(Apple Scanner)
17568349Sobrien>69	string		BRKL		(Brickles)
17668349Sobrien>69	string		BTFT		(BitFont)
17768349Sobrien>69	string		CCL2 		(Common Lisp 2)
17868349Sobrien>69	string		CCL\ 		(Common Lisp)
17968349Sobrien>69	string		CDmo		(The Talking Moose)
18068349Sobrien>69	string		CPCT		(Compact Pro)
18168349Sobrien>69	string		CSOm		(Eudora)
18268349Sobrien>69	string		DMOV		(Font/DA Mover)
18368349Sobrien>69	string		DSIM		(DigSim)
18468349Sobrien>69	string		EDIT		(Macintosh Edit)
18568349Sobrien>69	string		ERIK		(Macintosh Finder)
18668349Sobrien>69	string		EXTR		(self-extracting archive)
18768349Sobrien>69	string		Gzip		(GNU gzip)
18868349Sobrien>69	string		KAHL		(Think C)
18968349Sobrien>69	string		LWFU		(LaserWriter Utility)
19068349Sobrien>69	string		LZIV		(compress)
19168349Sobrien>69	string		MACA		(MacWrite)
19268349Sobrien>69	string		MACS		(Macintosh operating system)
19368349Sobrien>69	string		MAcK		(MacKnowledge terminal emulator)
19468349Sobrien>69	string		MLND		(Defender)
19568349Sobrien>69	string		MPNT		(MacPaint)
19668349Sobrien>69	string		MSBB		(Microsoft BASIC (binary))
19768349Sobrien>69	string		MSWD		(Microsoft Word)
19868349Sobrien>69	string		NCSA		(NCSA Telnet)
19968349Sobrien>69	string		PJMM		(Think Pascal)
20068349Sobrien>69	string		PSAL		(Hunt the Wumpus)
20168349Sobrien>69	string		PSI2		(Apple File Exchange)
20268349Sobrien>69	string		R*ch		(BBEdit)
20368349Sobrien>69	string		RMKR		(Resource Maker)
20468349Sobrien>69	string		RSED		(Resource Editor)
20568349Sobrien>69	string		Rich		(BBEdit)
20668349Sobrien>69	string		SIT!		(StuffIt)
20768349Sobrien>69	string		SPNT		(SuperPaint)
20868349Sobrien>69	string		Unix		(NeXT Mac filesystem)
20968349Sobrien>69	string		VIM!		(Vim editor)
21068349Sobrien>69	string		WILD		(HyperCard)
21168349Sobrien>69	string		XCEL		(Microsoft Excel)
21268349Sobrien>69	string		aCa2		(Fontographer)
21368349Sobrien>69	string		aca3		(Aldus FreeHand)
21468349Sobrien>69	string		dosa		(Macintosh MS-DOS file system)
21568349Sobrien>69	string		movr		(Font/DA Mover)
21668349Sobrien>69	string		nX^n		(WriteNow)
21768349Sobrien>69	string		pdos		(Apple ProDOS file system)
21868349Sobrien>69	string		scbk		(Scrapbook)
21968349Sobrien>69	string		ttxt		(SimpleText)
22068349Sobrien>69	string		ufox		(Foreign File Access)
22168349Sobrien
22268349Sobrien# Just in case...
22368349Sobrien
22468349Sobrien102	string		mBIN		MacBinary III data with surprising version number
225