Skip to main content

Compact fixup usage page

This is the usage page of fixup-compact, a fix up tool for Compact. This document assumes you are using fixup-compact by itself. However, use the Compact command-line tool instead of using the fix up tool on its own. The usage page of the Compact command-line tool is provided separately.

NAME

fixup-compact

OVERVIEW

The Compact fixup is part of Compact toolchain and it takes as input a Compact source program in a specified source file, attempts to update it to account for recent changes in the Compact language, formats it, and writes the updated and reformatted program to a specified file. If such a file is not specified, it writes the updated and formatted program to standard output.

SYNOPSIS

fixup-compact flag ...... sourcepath targetpath

DESCRIPTION

The flags flag ... are optional. They are described under FLAGS later in this document.

sourcepath should specify a file containing a Compact source program, and targetpath should specify the file into which the updated and formatted program should be written. targetpath may be the same as sourcepath, in which case the source program is replaced with the updated and reformatted equivalent. We recommend, however, that you direct the output to a different file and compare it with the original, to verify that the changes make sense.

FLAGS

The following flags, if present, affect the fixup tool's behavior as follows:

--help

Prints help text and exits.

--version

Prints the compiler version and exits.

--language-version

Prints the language version and exits.

--vscode

Causes error messages to be printed on a single line so they are rendered properly within the VS Code extension for Compact.

--update-Uint-ranges

Adjusts the end point of each Uint whose size is given by a range with a constant end point and issues a warning for each Uint whose size is given by a range when the end point is a generic-variable reference.

--compact-path search list

Sets the Compact search list to search list, overriding the default (the value of the COMPACT_PATH environment variable, if set, otherwise empty). The search list is a colon-separated (semicolon-separated on Windows) list of directory pathnames.

--trace-search

Causes the fixup tool to print a sequence of messages saying where it is looking for each included file and imported module source file.

--line-length n

Sets the target line length to n (default 100).

EXAMPLES

Assuming src/test.compact contains a well-formed Compact program, running:

fixup-compact src/test.compact

prints the updated and formatted program of src/test.compact to standard output.

Assuming that fixed is an existing directory, running:

fixup-compact src/test.compact fixed/test.compact

writes the updated and formatted program to fixed/test.compact. If the fixed directory does not exist the fixup tool complains that it cannot create the output file.

Alternatively, running:

fixup-compact src/test.compact src/test.compact

rewrites the updated and formatted program to src/test.compact.

Assuming src/test.compact contains an ill-formed Compact program, running:

fixup-compact src/test.compact

exits with an error message describing the problem that prevents the Compact program in src/test.compact from compiling.