From cd7e2ed80772dd1537f6dc320dfc506311495fc9 Mon Sep 17 00:00:00 2001
From: DeaDDooMER <deaddoomer@deadsoftware.ru>
Date: Mon, 22 Jul 2019 18:52:36 +0300
Subject: [PATCH] add option -version

---
 src/generic/Dsw/Mod/Compiler486Main.cp     | 5 +++++
 src/generic/Dsw/Mod/CompilerCPfrontMain.cp | 5 +++++
 src/generic/Dsw/Mod/Linker486Main.cp       | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/src/generic/Dsw/Mod/Compiler486Main.cp b/src/generic/Dsw/Mod/Compiler486Main.cp
index 5d1a68f..0718582 100644
--- a/src/generic/Dsw/Mod/Compiler486Main.cp
+++ b/src/generic/Dsw/Mod/Compiler486Main.cp
@@ -11,6 +11,8 @@ MODULE DswCompiler486Main;
     hint = 29; oberon = 30; errorTrap = 31;
     defopt = {checks, assert, obj, ref, allref, srcpos, signatures};
 
+    version = "0.2";
+
     emulong = 0;
     defopt2 = {};
 
@@ -166,6 +168,9 @@ MODULE DswCompiler486Main;
           INCL(opts2, emulong)
         ELSIF p = "-no-long-calls" THEN
           EXCL(opts2, emulong)
+        ELSIF p = "-version" THEN
+          Console.WriteStr(version); Console.WriteLn;
+          Kernel.Quit(0)
         ELSE
           Console.WriteStr("unknown option ");
           Console.WriteStr(p); Console.WriteLn;
diff --git a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp
index b5d4ec9..efbd6f7 100644
--- a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp
+++ b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp
@@ -12,6 +12,8 @@ MODULE DswCompilerCPfrontMain;
     (* defopt = {checks, assert, obj, ref, allref, srcpos, signatures}; *)
     defopt = {checks, assert, obj};
 
+    version = "0.2";
+
     emulong = 0;
     defopt2 = {};
 
@@ -167,6 +169,9 @@ MODULE DswCompilerCPfrontMain;
           INCL(opts2, emulong)
         ELSIF p = "-no-long-calls" THEN
           EXCL(opts2, emulong)
+        ELSIF p = "-version" THEN
+          Console.WriteStr(version); Console.WriteLn;
+          Kernel.Quit(0)
         ELSE
           Console.WriteStr("unknown option ");
           Console.WriteStr(p); Console.WriteLn;
diff --git a/src/generic/Dsw/Mod/Linker486Main.cp b/src/generic/Dsw/Mod/Linker486Main.cp
index 677681f..9396d01 100644
--- a/src/generic/Dsw/Mod/Linker486Main.cp
+++ b/src/generic/Dsw/Mod/Linker486Main.cp
@@ -7,6 +7,8 @@ MODULE DswLinker486Main;
   CONST
     tgtElfStatic = 0; tgtElfExe = 1; tgtElfDll = 2; tgtPeExe = 3; tgtPeDll = 4;
 
+    version = "0.2";
+
   TYPE
     Elem = POINTER TO RECORD
       name: ARRAY 256 OF CHAR;
@@ -105,6 +107,9 @@ MODULE DswLinker486Main;
         ELSIF p = "-trap" THEN
           LB.trap := TRUE;
           Kernel.intTrap := TRUE
+        ELSIF p = "-version" THEN
+          Console.WriteStr(version); Console.WriteLn;
+          Kernel.Quit(0)
         ELSE
           Console.WriteStr("unknown option ");
           Console.WriteStr(p); Console.WriteLn;
-- 
2.29.2