1
2#------------------------------------------------------------------------------
3# $File: wordprocessors,v 1.34 2023/01/24 20:13:40 christos Exp $
4# wordprocessors:  file(1) magic fo word processors.
5#
6####### PWP file format used on Smith Corona Personal Word Processors:
72         string    \040\040\040\040\040\040\040\040\040\040\040ML4D\040'92     Smith Corona PWP
8>24       byte      2         \b, single spaced
9>24       byte      3         \b, 1.5 spaced
10>24       byte      4         \b, double spaced
11>25       byte      0x42      \b, letter
12>25       byte      0x54      \b, legal
13>26       byte      0x46      \b, A4
14
15# URL:    http://fileformats.archiveteam.org/wiki/Microsoft_Works_Word_Processor
16# reference:        http://mark0.net/download/triddefs_xml.7z
17#                   /defs/w/wps-works-dos.trid.xml
18# From:   Joerg Jenderek
19# Note:   older non OLE 2 Compound based versions
200         ubeshort  =0x01FE
21>112      ubeshort  =0x0100             Microsoft Works 1-3 (DOS) or 2 (Windows) document
22# title like THE GREAT KHAN GAME
23>>0x100   string              x                   %s
24!:mime    application/vnd-ms-works
25#!:mime   application/x-msworks
26# https://www.macdisk.com/macsigen.php
27!:apple   ????AWWP
28!:ext     wps
29
30# Corel/WordPerfect
31# URL:              https://en.wikipedia.org/wiki/WordPerfect
32# Reference:        https://github.com/OneWingedShark/WordPerfect/blob/master/doc/SDK_Help/FileFormats/WPFF_DocumentStructure.htm
33#                   http://mark0.net/download/triddefs_xml.7z/defs/w/wp-generic.trid.xml
340         string    \xffWPC
35# WordPerfect
36>8        byte      1
37# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/w/wpm-macro.trid.xml
38# Note:             there exist other macro variants
39>>9       byte      1         WordPerfect macro
40#!:mime             application/octet-stream
41!:mime              application/x-wordperfect-wpm
42# like: ALTD.WPM ENDFOOT.WPM FOOTEND.WPM LABELS.WPM REVEALTX.WPM
43!:ext               wpm
44# Note:             used in WordPerfect 5.1; there exist other FIL variants
45>>9       byte      2         WordPerfect help file
46#!:mime             application/octet-stream
47!:mime              application/x-wordperfect-help
48# like: WPHELP.FIL
49!:ext               fil
50# pointer to document area like: 10h
51>>>4                ulelong   !0x10     \b, at %#x document area
52>>9       byte      3         WordPerfect keyboard file
53#!:mime             application/octet-stream
54!:mime              application/x-wordperfect-keyboard
55!:ext               wpk
56# no document area, so point to end of file; so this is file size like: 23381 2978 32835 3355 3775 919
57>>>4                ulelong   x         \b, %u bytes
58>>9       byte      4         WordPerfect VAX keyboard definition
59#!:mime   application/octet-stream
60!:mime    application/x-wordperfect-keyboard
61#!:ext    foo
62# URL:              http://fileformats.archiveteam.org/wiki/WordPerfect
63# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/w/wpd-doc-gen.trid.xml
64>>9       byte      10        WordPerfect document
65# https://www.iana.org/assignments/media-types/application/vnd.wordperfect
66!:mime              application/vnd.wordperfect
67#!:apple            ????WPC2
68# TODO: distinguish different suffix
69!:ext               wpd/wpt/wkb/icr/tut/sty/tst/crs
70>>9       byte      11        WordPerfect dictionary
71>>9       byte      12        WordPerfect thesaurus
72>>9       byte      13        WordPerfect block
73>>9       byte      14        WordPerfect rectangular block
74>>9       byte      15        WordPerfect column block
75>>9       byte      16        WordPerfect printer data
76#!:mime             application/octet-stream
77!:mime              application/x-wordperfect-prs
78# like: STANDARD.PRS WORKBOOK.PRS
79!:ext               prs
80# like: "Standard Printer" "Workbook Printer"
81>>>0x64             pstring/B >A        "%s"
82#>>9      byte      18        WordPerfect Prefix information file
83# printer resource .ALL
84>>9       byte      19        WordPerfect printer data
85#!:mime             application/octet-stream
86!:mime              application/x-wordperfect-all
87!:ext               all
88# display Resource
89>>9       byte      20        WordPerfect driver resource data
90#!:mime             application/octet-stream
91!:mime              application/x-wordperfect-drs
92# like: WPSMALL.DRS
93!:ext               drs
94# pointer to index area with string "smalldrs" like: 46h
95>>>4                uleshort  !0x46     \b, at %#x index area
96>>9       byte      21        WordPerfect Overlay file
97#!:mime             application/octet-stream
98!:mime              application/x-wordperfect-fil
99# like: WP.FIL
100!:ext               fil
101# URL:              http://fileformats.archiveteam.org/wiki/WordPerfect_Graphics
102# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wpg.trid.xml
103# Note:             called "WordPerfect Graphics bitmap" by TrID and
104#                   "WordPerfect Graphics Metafile" by DROID via x-fmt/395 fmt/1042
105#                   "WPG (Word Perfect Graphics)" by ImageMagick `identify -verbose BUTTRFLY.WPG`
106>>9       byte      22        WordPerfect graphic image
107# TODO: skip DROID x-fmt-395-signature-id-132.wpg by check for existing document area
108#>>>4               ulelong   >15       WordPerfect_graphic_OK
109#!:mime             application/octet-stream
110# http://extension.nirsoft.net/wpg
111!:mime              image/x-wordperfect-graphics
112# https://reposcope.com/mimetype/application/x-wpg
113#!:mime             application/x-wpg
114# like: BUTTRFLY.WPG STAR-5.WPG input.wpg WORDPFCT.WPG
115!:ext               wpg
116# pointer to document area like: 10h 1Ah
117>>>4                ulelong             !0x1A     \b, at %#x document area
118>>9       byte      23        WordPerfect hyphenation code
119>>9       byte      24        WordPerfect hyphenation data
120>>9       byte      25        WordPerfect macro resource data
121#!:mime             application/octet-stream
122!:mime              application/x-wordperfect-mrs
123# like: WP.MRS
124!:ext               mrs
125>>9       byte      27        WordPerfect hyphenation lex
126>>9       byte      29        WordPerfect wordlist
127>>9       byte      30        WordPerfect equation resource data
128#!:mime             application/octet-stream
129!:mime              application/x-wordperfect-qrs
130# like: WQ.QRS wpDE.qrs wpen.qrs
131!:ext               qrs
132# jump to document area with some marker and equation
133>>>(4.l)  ubyte     x
134# equation like: "Fraction:  x OVER y"
135>>>>&1              string    >A        (...%-.19s...)
136# pointer to document area like: 17C4h
137>>>4                ulelong   x         \b, at %#x document area
138#>>9      byte      31        reserved
139#>>9      byte      32        WordPerfect VAX .SET
140>>9       byte      33        WordPerfect spell rules
141>>9       byte      34        WordPerfect dictionary rules
142#>>9      byte      35        reserved
143# video resource device driver
144# Note:              filetype 26 for VRS and filetype 36 for WPD apparently is wrong
145>>9       byte      36        WordPerfect Video Resource
146#!:mime             application/octet-stream
147!:mime              application/x-wordperfect-vrs
148# like: STANDARD.VRS
149!:ext               vrs
150# like: "IBM CGA (& compatibles)"
151>>>0x20             string    >A        "%.23s"
152>>9       byte      39        WordPerfect spell rules (Microlytics)
153#>>9      byte      40        reserved
154>>9       byte      41        WordPerfect Install options
155#!:mime             application/octet-stream
156!:mime              application/x-wordperfect-ins
157# like: WP51.INS
158!:ext               ins
159# probably default directory name like: "C:\WP51\"
160>>>0x12             string    >A        "%.8s"
161# maybe mouse driver for WP5.1
162>>9       byte      42        WordPerfect Resource
163#!:mime             application/octet-stream
164!:mime              application/x-wordperfect-irs
165# like: STANDARD.IRS
166!:ext               irs
167# like: "Mouse Driver (MOUSE.COM)"
168>>>0x28             string    >A        "%.24s"
169>>9       byte      43        WordPerfect settings file
170# maybe Macintosh WP2.0 document
171>>9       byte      44        WordPerfect 3.5 document
172!:mime              application/vnd.wordperfect
173!:apple             ????WPD3
174# like: WP3.wpd
175!:ext               wpd
176>>9       byte      45        WordPerfect 4.2 document
177# External spell code module (WP5.1)
178#>>9      byte      46        WordPerfect external spell
179# external spell dictionary .LEX
180#>>9      byte      47        WordPerfect external spell dictionary
181# Macintosh SOFT graphics file (SOFT (Sequential Object Format)
182#>>9      byte      48        WordPerfect SOFT graphics
183#>>9      byte      49        reserved
184#>>9      byte      50        reserved
185# WPWin 5.1 Application Resource Library added for WPWin 5.1
186#>>9      byte      51        WordPerfect application resource library
187>>9       byte      69        WordPerfect dialog file
188# From:             Joerg Jenderek
189# Note:             found in sub directory WritingTools inside WordPerfect 2021 program directory
190>>9       byte      70        WordPerfect Writing Tools
191#!:mime   application/octet-stream
192!:mime    application/x-wordperfect-cbt
193# like: Wt13cbede.cbt Wt13cbeit.cbt Wt13cbefr.cbt WT21cbede.cbt Wt13cbeEN.CBD WT21cbeEN.CBD
194!:ext     cbd/cbt
195>>9       byte      76        WordPerfect button bar
196>>9       default x
197>>>9      byte      x         Corel WordPerfect: Unknown filetype %d
198# Corel Shell
199>8        byte      2
200>>9       byte      1         Corel shell macro
201>>9       byte      10        Corel shell definition
202>>9       default x
203>>>9      byte      x         Corel Shell: Unknown filetype %d
204# Corel Notebook
205>8        byte      3
206>>9       byte      1         Corel Notebook macro
207>>9       byte      2         Corel Notebook help file
208>>9       byte      3         Corel Notebook keyboard file
209>>9       byte      10        Corel Notebook definition
210>>9       default   x
211>>>9      byte      x         Corel Notebook: Unknown filetype %d
212# Corel Calculator
213>8        byte      4
214>>9       byte      2         Corel Calculator help file
215>>9       default   x
216>>>9      byte      x         Corel Calculator: Unknown filetype %d
217# Corel File Manager
218>8        byte      5
219>>9       default   x
220>>>9      byte      x         Corel File Manager: Unknown filetype %d
221# Corel Calendar
222>8        byte      6
223>>9       byte      2         Corel Calendar help file
224>>9       byte      10        Corel Calendar data file
225>>9       default   x
226>>>9      byte      x         Corel Calendar: Unknown filetype %d
227# Corel Program Editor/Ed Editor
228>8        byte      7
229>>9       byte      1         Corel Editor macro
230>>9       byte      2         Corel Editor help file
231>>9       byte      3         Corel Editor keyboard file
232>>9       byte      25        Corel Editor macro resource file
233>>9       default   x
234>>>9      byte      x         Corel Program Editor/Ed Editor: Unknown filetype %d
235# Corel Macro Editor
236>8        byte      8
237>>9       byte      1         Corel Macro editor macro
238>>9       byte      2         Corel Macro editor help file
239>>9       byte      3         Corel Macro editor keyboard file
240>>9       default   x
241>>>9      byte      x         Corel Macro Editor: Unknown filetype %d
242# Corel Plan Perfect
243>8        byte      9
244>>9       default   x
245>>>9      byte      x         Corel Plan Perfect: Unknown filetype %d
246# Corel DataPerfect
247>8        byte      10
248# CHECK: Don't these belong into product 9?
249>>9       byte      1         Corel PlanPerfect macro
250>>9       byte      2         Corel PlanPerfect help file
251>>9       byte      3         Corel PlanPerfect keyboard file
252>>9       byte      10        Corel PlanPerfect worksheet
253>>9       byte      15        Corel PlanPerfect printer definition
254>>9       byte      18        Corel PlanPerfect graphic definition
255>>9       byte      19        Corel PlanPerfect data
256>>9       byte      20        Corel PlanPerfect temporary printer
257>>9       byte      25        Corel PlanPerfect macro resource data
258>>9       default   x
259>>>9      byte      x         Corel DataPerfect: Unknown filetype %d
260# Corel Mail
261>8        byte      11
262>>9       byte      2         Corel Mail help file
263>>9       byte      5         Corel Mail distribution list
264>>9       byte      10        Corel Mail out box
265>>9       byte      11        Corel Mail in box
266>>9       byte      20        Corel Mail users archived mailbox
267>>9       byte      21        Corel Mail archived message database
268>>9       byte      22        Corel Mail archived attachments
269>>9       default   x
270>>>9      byte      x         Corel Mail: Unknown filetype %d
271# Corel Printer
272>8        byte      12
273>>9       byte      11        Corel Printer temporary file
274>>9       default   x
275>>>9      byte      x         Corel Printer: Unknown filetype %d
276# Corel Scheduler
277>8        byte      13
278>>9       byte      2         Corel Scheduler help file
279>>9       byte      10        Corel Scheduler in file
280>>9       byte      11        Corel Scheduler out file
281>>9       default   x
282>>>9      byte      x         Corel Scheduler: Unknown filetype %d
283# Corel WordPerfect Office
284>8        byte      14
285>>9       byte      10        Corel GroupWise settings file
286>>9       byte      17        Corel GroupWise directory services
287>>9       byte      43        Corel GroupWise settings file
288>>9       default   x
289>>>9      byte      x         Corel WordPerfect Office: Unknown filetype %d
290# Corel DrawPerfect
291# URL:              http://fileformats.archiveteam.org/wiki/Corel_Presentations
292# Update: Joerg Jenderek
293>8        byte      15
294# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/s/shw-wp-2.trid.xml
295# Note:             called "WordPerfect Presentations (v2)" by TrID and
296#                   "Corel Presentation" with version "7-8-9" by DROID via PUID fmt/877
297>>9       byte      10        WordPerfect Presentation
298#!:mime             application/octet-stream
299#!:mime             application/vnd.wordperfect
300!:mime              application/x-drawperfect-shw
301# like: BENEFITS.SHW chartbar.shw chartbul.shw chartgal.shw chartorg.shw fig-demo.shw figurgal.shw mastrgal.shw scuba.shw tutorial.shw
302!:ext               shw
303# pointer to document area like: 10h
304>>>4      ulelong   !0x10     \b, at %#x document area
305# according to TrID this is nil
306>>>12     ulelong   !0        \b, at 0xC %#x
307# search for embedded WP file like in tutorial.shw
308#>>>16    search/638/sb       \xffWPC   WPC_MAGIC_FOUND
309# GRR: indirect call leads to recursion! WHY?
310#>>>>&0   indirect  x         \b; contains
311# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/s/shw-wp-3.trid.xml
312# Note:             called "WordPerfect/Corel Presentations (v3)" by TrID and
313#                   "Corel Presentation" with version "3" by DROID via PUID fmt/878
314>>9       byte      15        Corel Presentation
315#!:mime             application/octet-stream
316#!:mime             application/vnd.wordperfect
317!:mime              application/x-drawperfect-shw
318# like: FIG_ANIM.SHW presenta.shw
319!:ext               shw
320# pointer to document area like: 1ah
321>>>4      ulelong   !0x1a     \b, at %#x document area
322# according to TrID this is nil
323>>>12     ulelong   !0        \b, at 0xC %#x
324# reserved like: 3
325>>>16     ulelong   !0x3      \b, at 0x10 %#x
326# file size, not including pad characters at EOF
327>>>0x14   ulelong x \b, %u bytes
328# search for embedded WP file like in foo
329#>>>24    search/638/sb       \xffWPC   WPC_MAGIC_FOUND
330# GRR: indirect call leads to recursion! WHY?
331#>>>>&0   indirect  x         \b; contains
332# embedded inside Compound Document variant handled by ./ole2compounddocs
333>>9       byte      16        Corel Presentation (embeded)
334#!:mime             application/octet-stream
335#!:mime             application/vnd.wordperfect
336!:mime              application/x-corelpresentations
337# like: PerfectOffice_MAIN
338!:ext               /
339# pointer to document area like: 1ah
340>>>4      ulelong   !0x1a     \b, at %#x document area
341>>>12     ulelong   !0        \b, at 0xC %#x
342# reserved like: 3
343>>>16     ulelong   !0x3      \b, at 0x10 %#x
344# file size, not including pad characters at EOF
345>>>0x14   ulelong x \b, %u bytes
346# search for embedded WP file
347#>>>24    search/638/sb       \xffWPC   WPC_MAGIC_FOUND
348# GRR: indirect call leads to recursion! WHY?
349#>>>>&0   indirect  x         \b; contains
350>>9       default   x
351>>>9      byte      x         Corel DrawPerfect: Unknown filetype %d
352# Corel LetterPerfect
353>8        byte      16
354>>9       default   x
355>>>9      byte      x         Corel LetterPerfect: Unknown filetype %d
356# Corel Terminal
357>8        byte      17
358>>9       byte      10        Corel Terminal resource data
359>>9       byte      11        Corel Terminal resource data
360>>9       byte      43        Corel Terminal resource data
361>>9       default   x
362>>>9      byte      x         Corel Terminal: Unknown filetype %d
363# Corel loadable file
364>8        byte      18
365>>9       byte      10        Corel loadable file
366>>9       byte      11        Corel GUI loadable text
367>>9       byte      12        Corel graphics resource data
368>>9       byte      13        Corel printer settings file
369>>9       byte      14        Corel port definition file
370>>9       byte      15        Corel print queue parameters
371>>9       byte      16        Corel compressed file
372>>9       default   x
373>>>9      byte      x         Corel loadable file: Unknown filetype %d
374>>15      byte      0         \b, optimized for Intel
375>>15      byte      1         \b, optimized for Non-Intel
376# Network service
377>8        byte      20
378>>9       byte      10        Corel Network service msg file
379>>9       byte      11        Corel Network service msg file
380>>9       byte      12        Corel Async gateway login msg
381>>9       byte      14        Corel GroupWise message file
382>>9       default   x
383>>>9      byte      x         Corel Network service: Unknown filetype %d
384# GroupWise
385>8        byte      31
386>>9       byte      20        GroupWise admin domain database
387>>9       byte      21        GroupWise admin host database
388>>9       byte      23        GroupWise admin remote host database
389>>9       byte      24        GroupWise admin ADS deferment data file
390>>9       default   x
391>>>9      byte      x         GroupWise: Unknown filetype %d
392# Corel Writing Tools WT*.*
393# From:             Joerg Jenderek
394# URL:              https://support.corel.com/hc/en-us/articles/215876258-Writing-Tools-Spell-Check-Dictionary-does-not-work-in-WordPerfect-X5
395#                   http://wordperfect.helpmax.net/en/editing-and-formatting-documents/using-the-writing-tools/working-with-user-word-lists/
396# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/u/uwl-wp.trid.xml
397>8        byte      32
398>>9       byte      10        Corel Writing Tools User Word List
399#!:mime   application/octet-stream
400!:mime    application/x-wordperfect-wordlist
401# personal user word list UWL under user directory like: WTDE.UWL WTUS.UWL WT21DE.UWL WT21US.UWL WT13DE.UWL ...
402# and "template" SAV/HWL variant under program directory like: wt13en.hwl Wt13de.sav Wt13it.sav wt13ru.sav WT21us.sav Wtcz.sav ...
403!:ext     uwl/hwl/sav
404# jump to document area with some marker and word list
405>>>(4.l)  ubyte     x
406# look for beginning of word list starting mostly with letter a as UTF-16 like: Wt13es.sav
407# but not found in russian wt13ru.sav
408>>>>&0    search/91/sb        a\0
409# word list starting like: "acsesory\022accessory.\001\026acomodate\026accommodate4\001"
410>>>>>&0             lestring16          x         (...%-.33s...)
411# pointer to document area like: 200h
412>>>4      ulelong   !0x200    \b, at %#x document area
413# file size, not including pad characters at EOF
414>>>0x14   uleshort x          \b, %u bytes
415# IntelliTAG
416>8        byte      33
417>>9       byte      10        IntelliTAG (SGML) compiled DTD
418>>9       default   x
419>>>9      byte      x         IntelliTAG: Unknown filetype %d
420# Summary:          Corel WordPerfect WritingTools advise part
421# From:             Joerg Jenderek
422# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/a/adv-wp.trid.xml
423>8        byte      34
424>>9       byte      11        Corel WordPerfect dictionary advise
425#!:mime   application/octet-stream
426!:mime    application/x-wordperfect-adv
427#!:mime   application/vnd.wordperfect.adv
428# like: WT21de.adv Wt13de.adv Wt13es.adv Wt13fr.adv wt13us.adv
429!:ext     adv
430# advise text part often start with tag like: 580A
431#>>>(16.s)          ubequad   x         ADVISE PART %#llx
432# part of advise text like: "This is too informal for most writing."
433>>>(16.s+16)        string    x         (...%-.33s...)
434# everything else
435>8        default x
436>>8       byte      x         Unknown Corel/Wordperfect product %d,
437>>>9      byte      x         file type %d
438>10       byte      0         \b, v5.
439# version of WP file; 2.1~WP 8.0
440# major version of WP file like: 1 2
441>10       byte      !0        \b, v%d.
442# minor version of WP file like: 0 1
443>11       byte      x         \b%d
444
445# Hancom HWP (Hangul Word Processor)
446# Hangul Word Processor 3.0 through 97 used HWP 3.0 format.
447# URL: https://www.hancom.com/etc/hwpDownload.do
4480         string    HWP\ Document\ File     Hancom HWP (Hangul Word Processor) file, version 3.0
449!:ext     hwp
450
451# CosmicBook, from Benoit Rouits
4520       string  CSBK    Ted Neslson's CosmicBook hypertext file
453
4542       string  EYWR    AmigaWriter file
455
456# chi:  file(1) magic for ChiWriter files
4570       string          \\1cw\          ChiWriter file
458>5      string          >\0             version %s
4590       string          \\1cw           ChiWriter file
460
461# Quark Express from https://www.garykessler.net/library/file_sigs.html
4622         string    IIXPR3                        Intel Quark Express Document (English)
4632         string    IIXPRa                        Intel Quark Express Document (Korean)
4642         string    MMXPR3                        Motorola Quark Express Document (English)
465!:mime    application/x-quark-xpress-3
4662         string    MMXPRa                        Motorola Quark Express Document (Korean)
467
468# From:             Joerg Jenderek
469# URL:              http://fileformats.archiveteam.org/wiki/PageMaker
470#                   https://en.wikipedia.org/wiki/Adobe_PageMaker
471# Reference:        http://mark0.net/download/triddefs_xml.7z/defs/p
472#                   pm4-pagemaker.trid.xml
473#                   pm5-pagemaker.trid.xml
474# Note:             since version 6 in 1995 called Adobe PageMaker and
475#                   embedded in Compound Document handled by ./ole2compounddocs
476#                   mainly tested little endian variant
4774         ubelong             =0x0000FF99
478>0        use                 PageMaker
479# big endian variant
4804         ubelong             =0x000099FF
481>0        use                 \^PageMaker
482#         display information of Aldus/Adobe PageMaker document/publication
4830         name                PageMaker
484>110      uleshort  <0x0600                       Aldus
485>110      uleshort  >0x05FF                       Adobe
486>110      uleshort  x                             PageMaker
487# "MP" marker for newer version 4 and above according to TrID
488#>108     string              x                             \b, MARKER "%.2s"
489# http://www.nationalarchives.gov.uk/pronom/fmt/876
490!:mime              application/vnd.pagemaker
491#!:mime             application/x-pagemaker
492# different file name extensions are used depending on version
493# older version like 3
494>110      uleshort/256        =0                            document
495# https://www.macdisk.com/macsigen.php
496!:apple   ALB3ALD3
497# PT3 for template and no example for PageMaker document/publication with PM3 extension
498!:ext     pm3/pt3
499>110      uleshort/256        =4                            document
500!:apple   ALD4ALB4
501# no example for PT4 template
502!:ext     pm4/pt4
503>110      uleshort/256        =5                            document
504!:apple   ALD5ALB5
505# no example for PT5 template
506!:ext     pm5/pt5
507>110      uleshort  =0x0600                       document
508!:apple   ALD6ALB6
509# PT6 for template
510!:ext     pm6/pt6
511# HOWTO to distinguish version 7 from 6.5 ?
512>110      uleshort  =0x0632                       document
513!:apple   AD65AB65
514# no example for T65 template
515!:ext     p65/t65/pmd/pmt
516# version 7 with PMT extension for template
517#!:ext    pmd/pmt
518#!:apple  ????PUBF
519# endian marker FF 99 for little endian
520>6        ubyte     =0xFF                         \b, little-endian
521>6        ubyte     =0x99                         \b, big-endian
522# newer numeric version like: 4 5 6 6.50
523#>110     uleshort  x                             \b, VERSION=%#x
524>110      uleshort  >0x03FF
525>>110     uleshort/256        x                             \b, version %u
526>>110     uleshort%256        >0                            \b.%u
527# older version like 3
528>110      uleshort  <0x0400                       \b, maybe version 3
529
530# adobe indesign (document, whatever...) from querkan
5310         belong    0x0606edf5                    Adobe InDesign
532>16       string    DOCUMENT            Document
533
534#------------------------------------------------------------------------------
535# ichitaro456: file(1) magic for Just System Word Processor Ichitaro
536#
537# Contributor kenzo-:
538# Reversed-engineered JS Ichitaro magic numbers
539#
540
5410         string              DOC
542>43       byte                0x14      Just System Word Processor Ichitaro v4
543!:mime    application/x-ichitaro4
544>144      string    JDASH               application/x-ichitaro4
545
5460         string              DOC
547>43       byte                0x15      Just System Word Processor Ichitaro v5
548!:mime    application/x-ichitaro5
549
5500         string              DOC
551>43       byte                0x16      Just System Word Processor Ichitaro v6
552!:mime    application/x-ichitaro6
553
554# Type: Freemind mindmap documents
555# From: Jamie Thompson <debian-bugs@jamie-thompson.co.uk>
5560         string/w  \<map\ version      Freemind document
557!:mime    application/x-freemind
558
559# Type: Freeplane mindmap documents
560# From: Felix Natter <fnatter@gmx.net>
5610       string/w        \<map\ version="freeplane  Freeplane document
562!:mime  application/x-freeplane
563
564# Type:        Scribus
565# From:        Werner Fink <werner@suse.de>
5660         string    \<SCRIBUSUTF8\ Version                  Scribus Document
5670         string    \<SCRIBUSUTF8NEW\ Version     Scribus Document
568!:mime    application/x-scribus
569
570# help files .hlp compiled from html and used by gfxboot added by Joerg Jenderek
571# markups page=0x04,label=0x12, followed by strings like "opt" or "main" and title=0x14
5720         ulelong&0x8080FFFF  0x00001204          gfxboot compiled html help file
573
574# From:             Joerg Jenderek
575# URL:              https://en.wikipedia.org/wiki/StarOffice
576# Reference:        http://mark0.net/download/triddefs_xml.7z
577#                   /defs/t/thm-staroffice.trid.xml
578# Note:             used in Star-, Open- and Libre-Office
579# named as soffice.StarConfigFile.6 or OpenOffice.org configuration by others
5800                   ubeshort  0x0400
581# non nil gap
582#>(2.s+8) ubequad             x                   \b, gap %#16.16llx
583# test for null value in gap after theme name maybe unreliable
584#>(2.s+9) ubyte               0                   \b, 0-byte
585# look for keyword GALRESRV near the end
586# "C:\Program Files (x86)\StarOffice6.0\share\gallery\sg27.thm" Navigation, 238 objects
587#>0                 search/8415         GALRESRV  \b, GALRESRV found
588# "neues thema6.thm" MorePictures, 315 objects
589#>0                 search/19299        GALRESRV  \b, GALRESRV FOUND
590#>2                 uleshort  x                   \b, name length %u
591# skip file2147.chk by check for positive name length like for sg16.thm "3D"
592>2                  uleshort  >0
593# skip dBase printer form T6.PRF with misidentified gallery
594# name :\DBASE\IV\T6.txts by check for 1st object name or RESRV keyword
595# https://www.clicketyclick.dk/databases/xbase/xbase/dbase_ex.zip
596# template/t6/with_data/T6.PRF
597# by first char of object name or RESRV part of keyword GALRESRV
598>>(2.s+13)          ubyte               >0x1F               StarOffice Gallery theme
599!:mime              application/x-stargallery-thm
600# thm is also used for JPEG thumbnail images
601!:ext               thm
602# gallery name often 1 word like: 3D sounds Diagrams Flussdiagramme Fotos
603# or like private://gallery/hidden/imgppt "Cisco - WAN - LAN"
604>>>2                pstring/h x                   %s
605# number of objects
606>>>(2.s+4)          ulelong             x                   \b, %u object
607# plural s
608>>>(2.s+4)          ulelong             !1                  \bs
609# if available then display first object name
610>>>(2.s+4)          ulelong             >0
611# partial file name, URL or internal name like "dd2*" of 1st object or RESRV
612>>>>(2.s+11)        pstring/h x                   \b, 1st %s
613
614# From:   Joerg Jenderek
615# URL:    http://fileformats.archiveteam.org/wiki/StarOffice_Gallery
616# Note:   used in Star-, Open- and Libre-Office and found in directories like
617#         %APPDATA%\Roaming\LibreOffice\4\user\gallery
618#         $HOME/.config/libreoffice/4/user/gallery
6190         string              SGA3      StarOffice Gallery thumbnails
620# Unknown like 0x04000?0001000142
621#>4       ubequad             x         \b, UNKNOWN %#16.16llx
622#!:mime   application/x-sdg
623!:mime    application/x-stargallery-sdg
624!:ext     sdg
625# display image magic for debugging purpose like 'BM'
626# looking like PC bitmap, Windows 3.x format with unknown compression
627#>11      string              x         \b, image magic '%-.2s'
628# inspect 1st GALLERY thumbnail magic by ./images with 1 space at end
629#>11      indirect  x         \b; contains
630
631