In addition to the key --from/to options, rejig offers:
--comma-radix: Use a comma as the decimal separator in cosmetic outputs instead of the default period.1 There is limited support for this on input; we have to obey the program format rules.--fix-obsolete: When parsing input, accept obsolete ops instead of failing.--fmt: Reformat files in place. More elsewhere…--frame: Give a state file to use as a “frame” for the output program data. For.modoutput this keeps an existing module’s header and page placement while its program image is replaced.--module-title,--module-author,--module-version,--module-xrom: Override the matching.modheader field from--frameor from the fixed defaults. The title must be non-blank. The XROM must be set, as a number from 0 to 31. Author and version may be omitted.--line-numbers: Include line numbers in output. Details.--list-{input,output}-formats: Emit a table of--from/toformats, plus associated file name extensions and aliases.--list-machines: Emit a table of the--validate/syntaxarguments and the file name extensions that imply them.--map: Produce a map file alongside the--outputfile.--ops: Emit the programmable op set as a tab-separated table on stdout and exit. Give an argument to select a machine using the same tokens as--validate/--syntax, or leave it off to imply R47. Columns are:Code— R47 integer op codeBytes— byte-coded machine-specific form of that op; P47 codes for R47,.rawfor HP-42S, and key codes for Voyagers; hex for HP-42S, decimal for all elseName— canonical name for that op, under the matching--syntaxruleArgType— short hint of the argument shape that this particular byte-coded form of the op expectsAliases— legal alternatives toNamefor the op on this machine, space-separated;nonewhen only the canonical form is allowed, modulo the case-folding rules
The effect of the obsolete
--num-opsflag isrejig --ops | wc -lminus one for the header line.--output/o: Write output to a named file.You may give
-here to tellrejigto write tostdout, but because that is the default, it’s a no-op.If the output is a directory instead of a file, the input program is written to a file in that directory named after the first label in that program. If there are multiple programs in that input separated by
END, this occurs for each in turn.--quiet/-q: Suppress warnings--reduced-charset: UTF-8 outputs normally presume that you are using a full-featured Unicode font, but you may give this flag to causerejigto prefer op aliases compatible with lesser fonts. The current target is the default LaTeX monospace font, but this flag affects all UTF-8 based output formats, including the defaultstdoutone.--syntax: Applies output restrictions and styling for a particular machine. This is mainly useful whenrejigcannot guess the proper rule set on its own, as from a machine-specific file name extension given to--output.The primary case where this occurs is with
--to unicode, since the default presumption is that you wantrejigto be able to write any R47 instruction in its output text listing. Giving--syntax hp42scausesrejigto validate that each instruction in the IR form of the program is representable on the HP-42S. Plus, it engages HP-42S styling: straight ASCII double-quotes around labels and named variables, mostly-uppercase op names, theINDstyle for indirect register access instead of the R47’s arrow syntax, etc.The other case where
--syntaxmust be given to override generic rules is with--to hprawto enforce the distinctions between the various forty-family machine types. It presumes--syntax plus42otherwise.All other
--toformats implicitly carry an implied syntax rule set and thus do not benefit from--syntax.--validate: Functional inverse of--syntax, restricting the input path’s op/arg compatibility checker to what is valid for a specific machine type.As with
--syntax, we try to guess the correct rule set where possible. The primary wayrejiginfers this is from the file name extension, when input comes from a file, notstdin. For text inputs, the first line of the file might have a suitable clue that guides us. A strong example of this is the shebang line in NutEm/PC inputs. A weaker one is the “00” line at the start ofraw2txtstyle outputs, where the best we can do is guess--validate plus42, the least restrictive of the matching cases.--fail-if-warnings: Exit with error status on any warning; default disabled--no-fail-on-error: The first error normally stops processing, but giving this flag is useful to get a punch list of problems to address. Sufficiently intractable errors cannot be bulled past in this way, and detection of any error will prevent program output.--verbose: Show debugging output.--version/v: Show the program’s version information. For release builds, it is a semantic version number alone. Between releases, it also has information about the Fossil commit it was built from, plus the branch that commit is on and the build date. This additional information avoids the need for manual timeline delving.
Run “rejig --help” to get a précis of the above.
If no input file names are given, rejig follows Pandoc in taking input from stdin instead. You can give - alone on the command line to force this, but as of version 0.41.0, it is no longer required.
The primary reason rejig does not enable --line-numbers by default is that it focuses on writing outputs that allow lossless round-tripping, enforced by a test that runs frequently during development. If rejig emitted line numbers by default, you would have to manually add these line numbers to hand-written tests merely to placate the test harness, and if you reordered lines, you’d have to manually renumber them. Plus, it would complicate blank line generation in UTF-8 output.
The same principles explain why --verbose isn’t default, and why header comments in the formats that allow them do not include frequently-changing details like timestamps or Fossil commit IDs.
Here’s an easy prediction: if a proposed change to the program’s default behavior will cause excessive test failures during development, that proposal will be rejected.
(You may now wish to return to the rejig home page.)
License
This work is © 2026 by Warren Young and is licensed under CC BY-NC-SA 4.0
- ^
You might now be wondering about thousands separators, but
rejighas you covered: our UTF-8 input format follows the common convention in programming languages to allow underscores as a non-semantic separator in number literals, obeying an amalgam of the Go and Perl conventions on this. Please don’t ask for this to be configurable. Spaces and commas in particular would complicate the input parsers beyond any utility such a feature could justify. Further, we will not bend the rules set by other input formats; if you want group separators in them, bring the request to these formats’ creators, then notify me if they accede; I can then see about bringingrejiginto alignment.