trivial compile file
0.1.0Standardises the behaviour of compile-file around source locations and compiler messages.
Table of Contents
About trivial-compile-file
This is a small portability wrapper around compile-file to allow specifying an alternate source file path, source line, source column, and source position. This is useful in contexts where only a subsection of a file, or some new context within a file is compiled in, and source information should be kept correct.
How To
This system exports a drop-in replacement for the standard compile-file with the following specified additional arguments:
source-namestring
The namestring of the file that this should be actually attributed to. If possible this will also influence the value of*compile-file-pathname*and*compile-file-truename*.source-line
The line (zero indexed) at which point within the "real file" this file begins.source-column
The column (zero indexed) at which point within the "real file" this file begins.source-position
The octet position (zero indexed) at which point within the "real file" this file begins.
In order to attain maximum support from implementations for source tracking, you should provide both line, column, and position if possible.
Additionally, the external-format is defaulted to utf-8, which should be the expected behaviour anyway, and any compiler notes or messages are converted to instances of compiler-note, providing a standardised interface to those kinds of messages as well.
In the case of compile or other interactive compilation, you can also use with-compiler-notes to convert the notes to standardised conditions.
Implementation Support
The following implementations are currently partially or fully supported:
ABCL
Allegro
CCL
Clasp
CMUCL
ECL
MKCL
SBCL
SCL
System Information
Definition Index
-
ORG.SHIRAKUMO.TRIVIAL-COMPILE-FILE
No documentation provided.-
EXTERNAL CONDITION COMPILER-NOTE
Condition representing a warning, message or note from the compiler. See ORIGINAL-CONDITION See MESSAGE See KIND See SOURCE
-
EXTERNAL FUNCTION COMPILE-FILE
- FILE
- &REST
- ARGS
- &KEY
- SOURCE-NAMESTRING
- SOURCE-LINE
- SOURCE-COLUMN
- SOURCE-POSITION
- EXTERNAL-FORMAT
- &ALLOW-OTHER-KEYS
Compile the given source file. Like CL:COMPILE, but standardised several behaviours, such as changing the *COMPILE-FILE-PATHNAME*, specifying source location, the default external-format, and so on. The following extra arguments are specified, beyond everything the standard and your implementation offers: SOURCE-NAMESTRING --- The namestring of the file that this should be actually attributed to. SOURCE-LINE --- The line (zero indexed) at which point within the "real file" this file begins. SOURCE-COLUMN --- The column (zero indexed) at which point within the "real file" this file begins. SOURCE-POSITION --- The octet position (zero indexed) at which point within the "real file" this file begins. Automatically uses WITH-COMPILER-NOTES for you. See WITH-COMPILER-NOTES -
EXTERNAL GENERIC-FUNCTION KIND
- CONDITION
Returns a keyword describing the kind of note this is. See COMPILER-NOTE
-
EXTERNAL GENERIC-FUNCTION MESSAGE
- CONDITION
Returns a human-readable message about the note. See COMPILER-NOTE
-
EXTERNAL GENERIC-FUNCTION ORIGINAL-CONDITION
- CONDITION
Returns the original condition that this was converted from. See COMPILER-NOTE
-
EXTERNAL GENERIC-FUNCTION SOURCE
- CONDITION
Returns a plist with source location information about the note. The plist can have the following entries: :NAMESTRING --- The namestring of the file in which this note occurred. :POSITION --- The octet offset within the file marking the start of the form that caused this note. :END-POSITION --- The octet offset within the file marking the end of the form that caused this note. :PATH --- A list of integers denoting the nested form numbers within the file, up to and including the form that caused this note. :ERROR --- A string describing the error that occurred while trying to obtain the source location. See COMPILER-NOTE -
EXTERNAL MACRO WITH-COMPILER-NOTES
- &KEY
- SOURCE-NAMESTRING
- &BODY
- BODY
Captures and converts messages, warnings, and notes from the compiler during BODY. Any error, note, warning, or message signalled during the execution of BODY is captured and converted to a COMPILER-NOTE condition instead. Note that unlike all other condition types, WARNINGs are still signalled outwards anyway to allow for proper handling of muffling and so on. Note that because errors and warnings of all kinds are captured, you should only use this directly around compilation units such as calls to COMPILE, EVAL, LOAD, or similar. See COMPILER-NOTE (type)
-