fileutil::magic::cfront(3tcl)

πŸ“¦
version 2.0 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– fileutil::magic::cfront πŸ’–

okay bestie, sit down, we're talking about fileutil::magic::cfront β€” that's the 3tcl manual page, the generator core for the compiler of magic(5) files. she's the frontend girlie of the whole operation. periodt.


✨ NAME ✨

fileutil::magic::cfront β€” generator core for the compiler of magic(5) files. no cap, that's literally her whole job title.


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require fileutil::magic::cfront ?1.3.2?

package require fileutil::magic::cgen ?1.2.0?

package require fileutil::magic::rt ?1.2.0?

package require struct::list

package require fileutil

::fileutil::magic::cfront::compile path...

::fileutil::magic::cfront::procdef procname path...

::fileutil::magic::cfront::install path...

πŸ¦‹ DESCRIPTION πŸ¦‹

so this package is the frontend of a compiler that takes magic(5) files and turns them into recognizers β€” and those recognizers run on the fileutil::magic::rt recognizer runtime package. it's giving build pipeline energy. πŸ’…

if you wanna meet the generator backend that this compiler leans on, go say hi to the fileutil::magic::cgen package. she's the one actually doing the heavy lifting behind the scenes. 🫢


πŸ‘‘ COMMANDS πŸ‘‘

  • ::fileutil::magic::cfront::compile path... β€” bestie, you hand her the paths of one or more files and directories, and she compiles all of it β€” every file, plus every file inside every directory β€” into a single analyzer covering all the file types those files specify. obsessed. what does she give you back? a list whose first item is a list of per-file dictionaries of analyzer scripts, and whose second item is a list of analyzer commands. every single file you feed her has to be in the format that magic(5) lays out, no exceptions, she will notice. and the result of the command is a Tcl script containing the generated recognizer. iconic.
  • ::fileutil::magic::cfront::procdef procname path... β€” this one acts just like ::fileutil::magic::cfront::compile as far as those path arguments go, and then she takes the recognizer script that came out, wraps it all up into a procedure named procname, slaps code that sets up the namespace of procname right in front of it, and hands you the resulting script. cute little gift-wrapped procedure, honestly. πŸŽ€
  • ::fileutil::magic::cfront::install path... β€” she uses ::fileutil::magic::cfront::procdef to compile each of the paths into a recognizer procedure, then installs the whole thing straight into the current interpreter. the name of each new procedure comes from the name of the file/directory used to create it β€” so a file/directory FOO gets you a procedure ::fileutil::magic::/FOO::run. yes the path really does have that slash in it, look at it again, it's fine, she's built different. πŸ’€

😭 BUGS, IDEAS, FEEDBACK 😭

ngl, this document β€” and the package it describes β€” will undoubtedly contain bugs and other problems. it's not a vibe, it's just reality. please report them in the category fileutil :: magic of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. 🫢

also please report any ideas for enhancements you have for either the package and/or the documentation. we want the glow-up ideas, fr fr.

when you're proposing code changes, please provide unified diffs β€” that means the output of diff -u. don't freestyle it.

also note: attachments are strongly preferred over inlined patches. make an attachment by going to the Edit form of the ticket immediately after it's created, and then use the left-most button in the secondary navigation bar. iykyk.

🌈 SEE ALSO 🌈

file(1), fileutil, magic(5)


⭐ KEYWORDS ⭐

file recognition, file type, file utilities, mime, type


πŸ“ CATEGORY πŸ“

Programming tools


and that's the whole page, bestie πŸ’œ β€” this one ships as part of tcllib, version 1.3.2, and it's the fileutil::magic::cfront(3tcl) manual page. go compile something cute with it. mwah. πŸ’…βœ¨

πŸ“¦ where this page comes from