1fileutil::magic::cfront(n) file utilities fileutil::magic::cfront(n)
2
3
4
5______________________________________________________________________________
6
8 fileutil::magic::cfront - Generator core for compiler of magic(5) files
9
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
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
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 recognizer for all the file types specified
42 in these files.
43
44 All the files have to be in the format specified by magic(5).
45
46 The result of the command is a Tcl script containing the gener‐
47 ated recognizer.
48
49 ::fileutil::magic::cfront::procdef procname path...
50 This command behaves like ::fileutil::magic::cfront::compile
51 with regard to the specified path arguments, then wraps the re‐
52 sulting recognizer script into a procedure named procname, puts
53 code setting up the namespace of procname in front, and returns
54 the resulting script.
55
56 ::fileutil::magic::cfront::install path...
57 This command uses ::fileutil::magic::cfront::procdef to compile
58 each of the paths into a recognizer procedure and installs the
59 result in the current interpreter.
60
61 The name of each new procedure is derived from the name of the
62 file/directory used in its creation, with file/directory "FOO"
63 causing the creation of procedure ::fileutil::magic::/FOO::run.
64
66 This document, and the package it describes, will undoubtedly contain
67 bugs and other problems. Please report such in the category fileutil
68 :: magic of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
69 Please also report any ideas for enhancements you may have for either
70 package and/or documentation.
71
72 When proposing code changes, please provide unified diffs, i.e the out‐
73 put of diff -u.
74
75 Note further that attachments are strongly preferred over inlined
76 patches. Attachments can be made by going to the Edit form of the
77 ticket immediately after its creation, and then using the left-most
78 button in the secondary navigation bar.
79
81 file(1), fileutil, magic(5)
82
84 file recognition, file type, file utilities, mime, type
85
87 Programming tools
88
89
90
91tcllib 1.2.0 fileutil::magic::cfront(n)