aboutsummaryrefslogtreecommitdiff
path: root/source/command_line_interface.elna
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-10-09 09:55:53 +0200
committerEugen Wissner <belka@caraus.de>2026-10-09 10:33:53 +0200
commit244449004fb62adbfd43b81e8dfce7500ca4a7e4 (patch)
treeb115946fc1efc2edc0de71a4e6d7cce2c50f39f2 /source/command_line_interface.elna
parent994e6c95929ad9551901d86617e4678920f8f357 (diff)
downloadelna-244449004fb62adbfd43b81e8dfce7500ca4a7e4.tar.gz
Move export mark after the generic parameters
Diffstat (limited to 'source/command_line_interface.elna')
-rw-r--r--source/command_line_interface.elna89
1 files changed, 0 insertions, 89 deletions
diff --git a/source/command_line_interface.elna b/source/command_line_interface.elna
deleted file mode 100644
index 4c3c1a6..0000000
--- a/source/command_line_interface.elna
+++ /dev/null
@@ -1,89 +0,0 @@
-(* This Source Code Form is subject to the terms of the Mozilla Public License,
- v. 2.0. If a copy of the MPL was not distributed with this file, You can
- obtain one at https://mozilla.org/MPL/2.0/. *)
-(*
- Command line handling.
-*)
-module
-import sys.posix.cstdlib, sys.posix.cstring, common
-
-type
- CommandLine* = record
- input: ^Word8;
- output: ^Word8;
- lex: Bool;
- parse: Bool
- end
-
-proc parse_command_line*(argc: Int; argv: ^^Word8) -> ^CommandLine
-var
- parameter: ^Word8
- i: Int
- result: ^CommandLine
- parsed: Bool
-begin
- i := 1;
- result := malloc#[CommandLine](#size(CommandLine));
- result^.lex := false;
- result^.parse := false;
- result^.input := nil;
- result^.output := nil;
-
- while i < argc & result <> nil do
- parameter := (argv + i)^;
- parsed := false;
-
- if strcmp(parameter, "--lex\0".ptr) = 0 then
- parsed := true;
- result^.lex := true
- end;
- if strcmp(parameter, "--parse\0".ptr) = 0 then
- parsed := true;
- result^.parse := true
- end;
- if strcmp(parameter, "-o\0".ptr) = 0 then
- i := i + 1;
-
- if i = argc then
- write_s("Fatal error: expecting a file name following -o.");
- result := nil
- end;
- if i < argc then
- parameter := (argv + i)^;
- result^.output := parameter
- end;
- parsed := true
- end;
- if (parameter^ <> '-') & ~parsed then
- parsed := true;
-
- if result^.input <> nil then
- write_s("Fatal error: only one source file can be compiled at once. First given \"");
- write_z(result^.input);
- write_s("\", then \"");
- write_z(parameter);
- write_s("\".\n");
- result := nil
- end;
- if result <> nil then
- result^.input := parameter
- end
- end;
- if ~parsed then
- write_s("Fatal error: unknown command line options: ");
-
- write_z(parameter);
- write_s(".\n");
-
- result := nil
- end;
-
- i := i + 1
- end;
- if result <> nil & result^.input = nil then
- write_s("Fatal error: no input files.\n");
- result := nil
- end
-return result
-
-end.