xref: /netbsd-src/external/bsd/file/dist/magic/magdir/forth (revision a77ebd868432a4d7e595fb7709cfc1b8f144789b)
1eff51ed2Schristos
2eff51ed2Schristos#------------------------------------------------------------------------------
3*a77ebd86Schristos# $File: forth,v 1.4 2021/04/26 15:56:00 christos Exp $
4eff51ed2Schristos# forth:  file(1) magic for various Forth environments
5eff51ed2Schristos# From: Lubomir Rintel <lkundrak@v3.sk>
6eff51ed2Schristos#
7eff51ed2Schristos
8eff51ed2Schristos# Has a FORTH stack diagram and something that looks very much like a FORTH
9eff51ed2Schristos# multi-line word definition. Probably a FORTH source.
10eff51ed2Schristos0       regex   \[[:space:]]\\(([[:space:]].*)?\ --\ (.*[[:space:]])?\\)
11eff51ed2Schristos>0      regex   \^:\[[:space:]]
12eff51ed2Schristos>>0     regex   \^;$				FORTH program
13eff51ed2Schristos!:mime  text/x-forth
14eff51ed2Schristos
15eff51ed2Schristos# Inline word definition complete with a stack diagram
16eff51ed2Schristos0       regex   \^:[[:space:]].*[[:space:]]\\(([[:space:]].*)?\ --\ (.*[[:space:]])?\\)[[:space:]].*[[:space:]];$	FORTH program
17eff51ed2Schristos!:mime  text/x-forth
18eff51ed2Schristos
1925f16eeaSchristos# Various dictionary images used by OpenFirware FORTH environment
20eff51ed2Schristos
21eff51ed2Schristos0	lelong	0xe1a00000
2225f16eeaSchristos>8	lelong	0xe1a00000
2325f16eeaSchristos# skip raspberry pi kernel image kernel7.img by checking for positive text length
2425f16eeaSchristos>>24	lelong	>0		ARM OpenFirmware FORTH Dictionary,
2525f16eeaSchristos>>>24	lelong	x		Text length: %d bytes,
2625f16eeaSchristos>>>28	lelong	x		Data length: %d bytes,
2725f16eeaSchristos>>>32	lelong	x		Text Relocation Table length: %d bytes,
2825f16eeaSchristos>>>36	lelong	x		Data Relocation Table length: %d bytes,
29*a77ebd86Schristos>>>40	lelong	x		Entry Point: %#08X,
3025f16eeaSchristos>>>44	lelong	x		BSS length: %d bytes
31eff51ed2Schristos
32eff51ed2Schristos0	string	MP
33eff51ed2Schristos>28	lelong	1		x86 OpenFirmware FORTH Dictionary,
34eff51ed2Schristos>>4	leshort	x		%d blocks
35eff51ed2Schristos>>2	leshort	x		+ %d bytes,
36eff51ed2Schristos>>6	leshort	x		%d relocations,
37eff51ed2Schristos>>8	leshort	x		Header length: %d paragraphs,
38eff51ed2Schristos>>10	leshort	x		Data Size: %d
39eff51ed2Schristos>>12	leshort	x		- %d 4K pages,
40*a77ebd86Schristos>>14	lelong	x		Initial Stack Pointer: %#08X,
41*a77ebd86Schristos>>20	lelong	x		Entry Point: %#08X,
42eff51ed2Schristos>>24	lelong	x		First Relocation Item: %d,
43eff51ed2Schristos>>26	lelong	x		Overlay Number: %d,
44*a77ebd86Schristos>>18	leshort	x		Checksum: %#08X
45eff51ed2Schristos
46eff51ed2Schristos0	belong	0x48000020	PowerPC OpenFirmware FORTH Dictionary,
47eff51ed2Schristos>4	belong	x		Text length: %d bytes,
48eff51ed2Schristos>8	belong	x		Data length: %d bytes,
49eff51ed2Schristos>12	belong	x		BSS length: %d bytes,
50eff51ed2Schristos>16	belong	x		Symbol Table length: %d bytes,
51*a77ebd86Schristos>20	belong	x		Entry Point: %#08X,
52eff51ed2Schristos>24	belong	x		Text Relocation Table length: %d bytes,
53eff51ed2Schristos>28	belong	x		Data Relocation Table length: %d bytes
54eff51ed2Schristos
55eff51ed2Schristos0	lelong	0x10000007	MIPS OpenFirmware FORTH Dictionary,
56eff51ed2Schristos>4	lelong	x		Text length: %d bytes,
57eff51ed2Schristos>8	lelong	x		Data length: %d bytes,
58eff51ed2Schristos>12	lelong	x		BSS length: %d bytes,
59eff51ed2Schristos>16	lelong	x		Symbol Table length: %d bytes,
60*a77ebd86Schristos>20	lelong	x		Entry Point: %#08X,
61eff51ed2Schristos>24	lelong	x		Text Relocation Table length: %d bytes,
62eff51ed2Schristos>28	lelong	x		Data Relocation Table length: %d bytes
63eff51ed2Schristos
64eff51ed2Schristos# Dictionary images used by minimal C FORTH environments, any platform,
65eff51ed2Schristos# using native byte order.
66eff51ed2Schristos
67eff51ed2Schristos# Weak.
68eff51ed2Schristos#0	short	0x5820		cForth 16-bit Dictionary,
69*a77ebd86Schristos#>2	short	x		Serial: %#08X,
70*a77ebd86Schristos#>4	short	x		Dictionary Start: %#08X,
71eff51ed2Schristos#>6	short	x		Dictionary Size: %d bytes,
72*a77ebd86Schristos#>8	short	x		User Area Start: %#08X,
73eff51ed2Schristos#>10	short	x		User Area Size: %d bytes,
74*a77ebd86Schristos#>12	short	x		Entry Point: %#08X
75eff51ed2Schristos
76eff51ed2Schristos0	long	0x581120	cForth 32-bit Dictionary,
77*a77ebd86Schristos>4	long	x		Serial: %#08X,
78*a77ebd86Schristos>8	long	x		Dictionary Start: %#08X,
79eff51ed2Schristos>12	long	x		Dictionary Size: %d bytes,
80*a77ebd86Schristos>16	long	x		User Area Start: %#08X,
81eff51ed2Schristos>20	long	x		User Area Size: %d bytes,
82*a77ebd86Schristos>24	long	x		Entry Point: %#08X
83