1fileutil::magic::cgen(n) file utilities fileutil::magic::cgen(n)
2
3
4
5______________________________________________________________________________
6
8 fileutil::magic::cgen - Generator core for compiler of magic(5) files
9
11 package require Tcl 8.4
12
13 package require fileutil::magic::cgen ?1.0?
14
15 package require fileutil::magic::rt ?1.0?
16
17 package require struct::tree
18
19 package require struct::list
20
21 ::fileutil::magic::cgen::2tree script
22
23 ::fileutil::magic::cgen::treedump tree
24
25 ::fileutil::magic::cgen::treegen tree node
26
27_________________________________________________________________
28
30 This package provides the generator backend for a compiler of magic(5)
31 files into recognizers based on the fileutil::magic::rt recognizer run‐
32 time package. For the compiler frontend using this generator see the
33 package fileutil::magic::cfront.
34
36 ::fileutil::magic::cgen::2tree script
37 This command converts the recognizer specified by the script
38 into a tree and returns the object command of that tree as its
39 result. It uses the package struct::tree for the tree.
40
41 The script is in the format specified by magic(5).
42
43 ::fileutil::magic::cgen::treedump tree
44 This command takes a tree as generated by ::fileu‐
45 til::magic::cgen::2tree and returns a string encoding the tree
46 for human consumption, to aid in debugging.
47
48 ::fileutil::magic::cgen::treegen tree node
49 This command takes a tree as generated by ::fileu‐
50 til::magic::cgen::2tree and returns a Tcl script, the recognizer
51 for the file types represented by the sub-tree rooted at the
52 node. The generated script makes extensive use of the commands
53 provided by the recognizer runtime package fileutil::magic::rt
54 to perform its duties.
55
57 This document, and the package it describes, will undoubtedly contain
58 bugs and other problems. Please report such in the category fileutil
59 :: magic of the Tcllib SF Trackers [http://source‐
60 forge.net/tracker/?group_id=12883]. Please also report any ideas for
61 enhancements you may have for either package and/or documentation.
62
64 file(1), fileutil, magic(5)
65
67 file recognition, file type, file utilities, mime, type
68
69
70
71fumagic 1.0 fileutil::magic::cgen(n)