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

NAME

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

SYNOPSIS

11       package require Tcl  8.5
12
13       package require fileutil::magic::cfront  ?1.2.0?
14
15       package require fileutil::magic::cgen  ?1.2.0?
16
17       package require fileutil::magic::rt  ?1.2.0?
18
19       package require struct::list
20
21       package require fileutil
22
23       ::fileutil::magic::cfront::compile path...
24
25       ::fileutil::magic::cfront::procdef procname path...
26
27       ::fileutil::magic::cfront::install path...
28
29______________________________________________________________________________
30

DESCRIPTION

32       This package provides the frontend of a compiler of magic(5) files into
33       recognizers based on the fileutil::magic::rt recognizer  runtime  pack‐
34       age.  For  the  generator  backed used by this compiler see the package
35       fileutil::magic::cgen.
36

COMMANDS

38       ::fileutil::magic::cfront::compile path...
39              This command takes the paths of one or more files  and  directo‐
40              ries and compiles all the files, and the files in all the direc‐
41              tories into a single analyzer for all the file  types  specified
42              in  these  files.   It returns a list whose first item is a list
43              per-file dictionaries of analyzer scripts and whose second  item
44              is a list of analyzer commands.
45
46              All the files have to be in the format specified by magic(5).
47
48              The  result of the command is a Tcl script containing the gener‐
49              ated recognizer.
50
51       ::fileutil::magic::cfront::procdef procname path...
52              This  command  behaves  like  ::fileutil::magic::cfront::compile
53              with  regard to the specified path arguments, then wraps the re‐
54              sulting recognizer script into a procedure named procname,  puts
55              code  setting up the namespace of procname in front, and returns
56              the resulting script.
57
58       ::fileutil::magic::cfront::install path...
59              This command uses ::fileutil::magic::cfront::procdef to  compile
60              each  of  the paths into a recognizer procedure and installs the
61              result in the current interpreter.
62
63              The name of each new procedure is derived from the name  of  the
64              file/directory  used  in its creation, with file/directory "FOO"
65              causing the creation of procedure ::fileutil::magic::/FOO::run.
66

BUGS, IDEAS, FEEDBACK

68       This document, and the package it describes, will  undoubtedly  contain
69       bugs  and  other problems.  Please report such in the category fileutil
70       :: magic of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
71       Please  also  report any ideas for enhancements you may have for either
72       package and/or documentation.
73
74       When proposing code changes, please provide unified diffs, i.e the out‐
75       put of diff -u.
76
77       Note  further  that  attachments  are  strongly  preferred over inlined
78       patches. Attachments can be made by going  to  the  Edit  form  of  the
79       ticket  immediately  after  its  creation, and then using the left-most
80       button in the secondary navigation bar.
81

SEE ALSO

83       file(1), fileutil, magic(5)
84

KEYWORDS

86       file recognition, file type, file utilities, mime, type
87

CATEGORY

89       Programming tools
90
91
92
93tcllib                               1.2.0          fileutil::magic::cfront(n)
Impressum