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.4
12
13 package require fileutil::magic::cfront ?1.0?
14
15 package require fileutil::magic::cgen ?1.0?
16
17 package require fileutil::magic::rt ?1.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
52 resulting recognizer script into a procedure named procname,
53 puts code setting up the namespace of procname in front, and
54 returns 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 SF Trackers [http://source‐
69 forge.net/tracker/?group_id=12883]. Please also report any ideas for
70 enhancements you may have for either package and/or documentation.
71
73 file(1), fileutil, magic(5)
74
76 file recognition, file type, file utilities, mime, type
77
78
79
80fumagic 1.0 fileutil::magic::cfront(n)