fileutil::magic::cgen(n)
β¨ fileutil::magic::cgen β¨
okay bestie, welcome to fileutil::magic::cgen β the generator core for the compiler of magic(5) files. yes that's a lot of words, we'll get through it together, i promise π
π NAME π
fileutil::magic::cgen β generator core for compiler of magic(5) files. that's the whole vibe. it generates. it's a core. it does magic files. slay β¨
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require fileutil::magic::cgen ?1.2.0?
package require fileutil::magic::rt ?1.2.0?
package require struct::tree
package require struct::list
::fileutil::magic::cgen::2tree script
::fileutil::magic::cgen::treedump tree
::fileutil::magic::cgen::treegen tree node
like, that's it, that's the whole entrance. Tcl 8.5 9, the cgen package itself at ?1.2.0?, plus fileutil::magic::rt at ?1.2.0?, plus struct::tree and struct::list. three commands. iconique. π
π DESCRIPTION π
so this package is the generator backend for a compiler that turns magic(5) files into recognizers β and those recognizers are built on top of the fileutil::magic::rt recognizer runtime package. that's the runtime, that's where the actual doing-things lives.
if you're looking for the compiler frontend that uses this generator, that's a different girl: the package fileutil::magic::cfront. go say hi. π«Ά
π COMMANDS π
::fileutil::magic::cgen::2treescript β converts the recognizer specified by script into a tree, and returns the object command of that tree as its result. it uses the packagestruct::treeto make the tree happen. and the script? it's in the format specified bymagic(5). no cap.::fileutil::magic::cgen::treedumptree β takes a tree that came out of::fileutil::magic::cgen::2treeand returns a string encoding that tree for human consumption. it's a debugging aid. it's giving "let me see what you actually built". π::fileutil::magic::cgen::treegentree node β takes a tree that came out of::fileutil::magic::cgen::2treeand returns a Tcl script β specifically the recognizer for the file types represented by the sub-tree rooted at node. and listen, that generated script makes extensive use of the commands provided by the recognizer runtime packagefileutil::magic::rtto do its duties. teamwork, fr fr. π€
π¦ BUGS, IDEAS, FEEDBACK π¦
ngl, this document and the package it describes will undoubtedly contain bugs and other problems. i'm just being honest with you. π
please report such bugs in the category fileutil :: magic of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist
and please also report any ideas for enhancements you may have for either the package and/or the documentation. we want the ideas. we love the ideas. β¨
when proposing code changes, please provide unified diffs β i.e. the output of diff -u.
also, note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk. π
π SEE ALSO π
β KEYWORDS β
file recognition, file type, file utilities, mime, type
π CATEGORY π
Programming tools
okay that's the whole page, you understood all of it, i'm so proud of you π₯Ήπ
this little masterpiece is brought to you by tcllib, version 1.2.0, and it lives under the name fileutil::magic::cgen(n). go forth and generate, bestie. periodt. π
β¨π¦
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms