1fileutil::magic::cgen(n)        file utilities        fileutil::magic::cgen(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       fileutil::magic::cgen - Generator core for compiler of magic(5) files
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require fileutil::magic::cgen  ?1.2.0?
14
15       package require fileutil::magic::rt  ?1.2.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

DESCRIPTION

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

COMMANDS

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

BUGS, IDEAS, FEEDBACK

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 Trackers [http://core.tcl.tk/tcllib/reportlist].
60       Please also report any ideas for enhancements you may have  for  either
61       package and/or documentation.
62
63       When proposing code changes, please provide unified diffs, i.e the out‐
64       put of diff -u.
65
66       Note further that  attachments  are  strongly  preferred  over  inlined
67       patches.  Attachments  can  be  made  by  going to the Edit form of the
68       ticket immediately after its creation, and  then  using  the  left-most
69       button in the secondary navigation bar.
70

SEE ALSO

72       file(1), fileutil, magic(5)
73

KEYWORDS

75       file recognition, file type, file utilities, mime, type
76

CATEGORY

78       Programming tools
79
80
81
82tcllib                               1.2.0            fileutil::magic::cgen(n)
Impressum