mirror of
https://github.com/pfusik/xasm.git
synced 2025-08-15 15:27:23 +00:00
Remove duplicate filenames for -M.
This commit is contained in:
18
xasm.d
18
xasm.d
@@ -16,12 +16,12 @@
|
|||||||
// free or for profit.
|
// free or for profit.
|
||||||
// These rights, on this notice, rely.
|
// These rights, on this notice, rely.
|
||||||
|
|
||||||
|
import std.algorithm;
|
||||||
import std.array;
|
import std.array;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
import std.math;
|
import std.math;
|
||||||
import std.path;
|
import std.path;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import std.string;
|
|
||||||
|
|
||||||
version (Windows) {
|
version (Windows) {
|
||||||
import std.c.windows.windows;
|
import std.c.windows.windows;
|
||||||
@@ -35,7 +35,7 @@ bool[26] options;
|
|||||||
string[26] optionParameters;
|
string[26] optionParameters;
|
||||||
string[] commandLineDefinitions = null;
|
string[] commandLineDefinitions = null;
|
||||||
string makeTarget;
|
string makeTarget;
|
||||||
string makeSources = null;
|
string[] makeSources = null;
|
||||||
|
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
|
|
||||||
@@ -1058,7 +1058,8 @@ string makeEscape(string s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
File openInputFile(string filename) {
|
File openInputFile(string filename) {
|
||||||
makeSources ~= ' ' ~ makeEscape(filename);
|
if (find(makeSources, filename).empty)
|
||||||
|
makeSources ~= filename;
|
||||||
try {
|
try {
|
||||||
return File(filename);
|
return File(filename);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -2832,9 +2833,7 @@ void assemblyPass() {
|
|||||||
currentFilename = "command line";
|
currentFilename = "command line";
|
||||||
lineNo = 0;
|
lineNo = 0;
|
||||||
foreach (definition; commandLineDefinitions) {
|
foreach (definition; commandLineDefinitions) {
|
||||||
immutable i = indexOf(definition, '=');
|
line = replaceFirst(definition, "=", " equ ");
|
||||||
assert(i >= 0);
|
|
||||||
line = definition[0 .. i] ~ " equ " ~ definition[i + 1 .. $];
|
|
||||||
assemblyLine();
|
assemblyLine();
|
||||||
}
|
}
|
||||||
line = null;
|
line = null;
|
||||||
@@ -2889,7 +2888,7 @@ int main(string[] args) {
|
|||||||
definition = arg[3 .. $];
|
definition = arg[3 .. $];
|
||||||
} else if (i + 1 < args.length && !isOption(args[i + 1]))
|
} else if (i + 1 < args.length && !isOption(args[i + 1]))
|
||||||
definition = args[++i];
|
definition = args[++i];
|
||||||
if (definition is null || indexOf(definition, '=') < 0)
|
if (definition is null || find(definition, '=').empty)
|
||||||
exitCode = 3;
|
exitCode = 3;
|
||||||
commandLineDefinitions ~= definition;
|
commandLineDefinitions ~= definition;
|
||||||
break;
|
break;
|
||||||
@@ -2955,7 +2954,10 @@ int main(string[] args) {
|
|||||||
writefln("%d bytes written to the object file", objectBytes);
|
writefln("%d bytes written to the object file", objectBytes);
|
||||||
}
|
}
|
||||||
if (getOption('m')) {
|
if (getOption('m')) {
|
||||||
writef("%s:%s\n\txasm", makeTarget, makeSources);
|
writef("%s:", makeTarget);
|
||||||
|
foreach (filename; makeSources)
|
||||||
|
writef(" %s", makeEscape(filename));
|
||||||
|
write("\n\txasm");
|
||||||
for (int i = 1; i < args.length; i++) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
string arg = args[i];
|
string arg = args[i];
|
||||||
if (isOption(arg)) {
|
if (isOption(arg)) {
|
||||||
|
Reference in New Issue
Block a user