added Oberon.Mod which can be used to read command line arguments by

reading Oberon.Par.text like in Oberon system.


Former-commit-id: 461148de7e
This commit is contained in:
Norayr Chilingarian 2015-01-29 00:03:17 +04:00
parent d12d46a435
commit 20e9470c1f
2 changed files with 62 additions and 1 deletions

61
src/lib/v4/Oberon.Mod Normal file
View file

@ -0,0 +1,61 @@
MODULE Oberon;
(* this version should not have dependency on graphics -- noch *)
IMPORT Kernel, Texts, Args;
TYPE
ParList* = POINTER TO ParRec;
ParRec* = RECORD
(* vwr*: Viewers.Viewer;
frame*: Display.Frame;*)
text*: Texts.Text;
pos*: LONGINT
END;
VAR
Log*: Texts.Text;
Par*: ParList; (*actual parameters*)
W : Texts.Writer;
(*clocks*)
PROCEDURE GetClock* (VAR t, d: LONGINT);
BEGIN Kernel.GetClock(t, d)
END GetClock;
PROCEDURE Time* (): LONGINT;
BEGIN
RETURN Kernel.Time()
END Time;
PROCEDURE PopulateParams;
VAR W : Texts.Writer;
i : INTEGER;
str : ARRAY 32 OF CHAR;
BEGIN
i := 1; (* skip program name *)
Texts.OpenWriter(W);
REPEAT
IF i < Args.argc THEN
Args.Get(i, str);
Texts.WriteString(W, str);
Texts.WriteString(W, " ");
END;
INC(i)
UNTIL i >= Args.argc;
Texts.Append (Par^.text, W.buf);
END PopulateParams;
BEGIN
NEW(Par);
NEW(Par.text);
Texts.Open(Par.text, "");
PopulateParams;
END Oberon.

View file

@ -1 +1 @@
ea3eeab60e2534238860b93b768a164507a37366
3709b2b5f9471ed687fa9b371bbbb71467f0364a