File: cgen.man

package info (click to toggle)
tcllib 1.21%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 69,456 kB
  • sloc: tcl: 266,493; ansic: 14,259; sh: 2,936; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 112; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (63 lines) | stat: -rw-r--r-- 1,934 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin fileutil::magic::cgen n 1.2.0]
[see_also file(1)]
[see_also fileutil]
[see_also magic(5)]
[keywords {file recognition}]
[keywords {file type}]
[keywords {file utilities}]
[keywords mime]
[keywords type]
[moddesc   {file utilities}]
[titledesc {Generator core for compiler of magic(5) files}]
[category  {Programming tools}]
[require Tcl 8.4]
[require fileutil::magic::cgen [opt 1.2.0]]
[require fileutil::magic::rt [opt 1.2.0]]

[require struct::tree]
[require struct::list]
[description]
[para]

This package provides the generator backend for a compiler of magic(5)
files into recognizers based on the [package fileutil::magic::rt]
recognizer runtime package. For the compiler frontend using this
generator see the package [package fileutil::magic::cfront].

[section COMMANDS]

[list_begin definitions]

[call [cmd ::fileutil::magic::cgen::2tree] [arg script]]

This command converts the recognizer specified by the [arg script]
into a tree and returns the object command of that tree as its
result. It uses the package [package struct::tree] for the tree.

[para]

The [arg script] is in the format specified by magic(5).

[call [cmd ::fileutil::magic::cgen::treedump] [arg tree]]

This command takes a [arg tree] as generated by
[cmd ::fileutil::magic::cgen::2tree] and returns a string encoding the
tree for human consumption, to aid in debugging.

[call [cmd ::fileutil::magic::cgen::treegen] [arg tree] [arg node]]

This command takes a [arg tree] as generated by
[cmd ::fileutil::magic::cgen::2tree] and returns a Tcl script, the
recognizer for the file types represented by the sub-tree rooted at
the [arg node].

The generated script makes extensive use of the commands provided by
the recognizer runtime package [package fileutil::magic::rt] to
perform its duties.

[list_end]

[vset CATEGORY {fileutil :: magic}]
[include ../common-text/feedback.inc]
[manpage_end]