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