fileutil::magic::cgen(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ 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::2tree script β€” converts the recognizer specified by script into a tree, and returns the object command of that tree as its result. it uses the package struct::tree to make the tree happen. and the script? it's in the format specified by magic(5). no cap.
  • ::fileutil::magic::cgen::treedump tree β€” takes a tree that came out of ::fileutil::magic::cgen::2tree and 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::treegen tree node β€” takes a tree that came out of ::fileutil::magic::cgen::2tree and 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 package fileutil::magic::rt to 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