File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ version RM86
66 "Hello, RM86!\n" printstr
77end
88
9+ # will execute on Linux86 backend
10+ version Linux86
11+ "Hello, Linux86!\n" printstr
12+ end
13+
914# won't execute unless you set the Foo version
1015version Foo
1116 "Hello, Foo!\n" printstr
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import std.file;
55import std.stdio ;
66import std.string ;
77import std.process ;
8+ import std.algorithm ;
89import callisto.compiler;
910import callisto.language;
1011import callisto.optimiser;
3132 with the Callisto stack)
3233 -d - Enables debug symbols (if available)
3334 -l LIB - Links LIB with the linker (if available)
35+ -dv VER - Disables VER
3436
3537Backends:
3638 rm86 - Real mode x86 and MS-DOS
@@ -60,6 +62,7 @@ int main(string[] args) {
6062 bool debugParser;
6163 bool exportSymbols;
6264 string [] link;
65+ string [] disabled;
6366
6467 for (size_t i = 1 ; i < args.length; ++ i) {
6568 if (args[i][0 ] == ' -' ) {
@@ -178,6 +181,16 @@ int main(string[] args) {
178181 link ~= args[i];
179182 break ;
180183 }
184+ case " -dv" : {
185+ ++ i;
186+ if (i >= args.length) {
187+ stderr.writeln(" -dv expects VER argument" );
188+ return 1 ;
189+ }
190+
191+ disabled ~= args[i];
192+ break ;
193+ }
181194 default : {
182195 stderr.writefln(" Unknown flag '%s'" , args[i]);
183196 return 1 ;
@@ -220,6 +233,21 @@ int main(string[] args) {
220233
221234 version s ~= compiler.backend.GetVersions();
222235
236+ bool removing = true ;
237+ while (removing) {
238+ foreach (ref ver ; disabled) {
239+ if (versions.canFind(ver)) {
240+ version s = versions.remove(versions.countUntil(ver));
241+ goto next;
242+ }
243+ }
244+
245+ removing = false ;
246+ next:
247+ }
248+ writeln(disabled);
249+ writeln(versions);
250+
223251 auto preproc = new Preprocessor();
224252 preproc.includeDirs = includeDirs;
225253 preproc.versions = versions;
You can’t perform that action at this time.
0 commit comments