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