1
0
mirror of https://github.com/pfusik/xasm.git synced 2024-06-15 18:29:31 +00:00

Allow stdout for the listing and label table.

This commit is contained in:
Piotr Fusik 2022-12-08 09:27:19 +01:00
parent 83d2f8ff1d
commit 30c96357bc
2 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,6 @@
// xasm 3.2.0 by Piotr Fusik <fox@scene.pl>
// http://xasm.atari.org
// Can be compiled with DMD v2.097.0.
// Can be compiled with DMD v2.101.0.
// Poetic License:
//
@ -1085,6 +1085,8 @@ File openInputFile(string filename) {
}
File openOutputFile(string filename, string msg) {
if (filename == "-")
return stdout;
if (!getOption('q'))
messageStream.writeln(msg);
try {
@ -1184,11 +1186,8 @@ void objectByte(ubyte b) {
} else {
assert(pass2);
if (!optionObject) return;
if (!objectStream.isOpen) {
objectStream = objectFilename == "-"
? stdout
: openOutputFile(objectFilename, "Writing object file...");
}
if (!objectStream.isOpen)
objectStream = openOutputFile(objectFilename, "Writing object file...");
try {
objectStream.write(cast(char) b);
} catch (Exception e) {
@ -3007,8 +3006,10 @@ int main(string[] args) {
core.stdc.stdio.remove(toStringz(objectFilename));
}
}
listingStream.close();
objectStream.close();
if (listingStream != stdout)
listingStream.close();
if (objectStream != stdout)
objectStream.close();
if (exitCode <= 1) {
if (!getOption('q')) {
messageStream.writefln("%d lines of source assembled", totalLines);

View File

@ -38,6 +38,7 @@ The listing file should exclude included files.
*-l* '[LISTING_FILE]'::
Generates a listing file.
Using '-' as 'LISTING_FILE' makes *xasm* write to standard output.
If 'LISTING_FILE' is omitted, the listing filename
is 'SOURCE_FILE' with the extension changed to `.lst`.
@ -47,7 +48,7 @@ First line of the rule lists 'OBJECT_FILE' as the target of the rule
and all source files (including the ones specified with `icl` and `ins`) as dependencies.
The second line contains the command line with 'OBJECT_FILE'
replaced by the *make* macro `$@` and 'SOURCE_FILE' replaced by the macro `$<`.
Dollars in the command line are doubled.
Dollar signs in the command line are doubled.
Your *make* or shell may require further escaping.
*-o* 'OBJECT_FILE'::
@ -64,6 +65,7 @@ Quiet mode. Prevents *xasm* from printing its banner and compilation summary.
*-t* '[LABEL_FILE]'::
Generates a label table.
Using '-' as 'LABEL_FILE' makes *xasm* write to standard output.
If 'LABEL_FILE' is omitted then the table is appended at the end of the listing.
[[new_unlabels]]*-u*::