[Oberon] Oberon 3 on Windows 7, PELinker, Windows executable
Dieter
d.gloetzel at web.de
Mon Mar 16 19:30:44 CET 2015
Hi Chris,
I made a prototype of a module which would split the inputline. The EXE
is called "/twolines.exe/";
The command line would be e.g.
/twolines.exe// "d:/musix/telemann/telemann.xml"
"d:/musix/telemann/telemann.pmx"/
====================================================
MODULE InOut;
IMPORT Kernel32,Strings;
CONST EOR = 0DX; NL = 0AX; BLANK = 20X; TAB = 09X; DBLQUOTE = 22X;
VAR
cl: Kernel32.LPSTR;
commandLine: ARRAY 255 OF CHAR; pos : LONGINT;
infilename, outfilename : ARRAY 64 OF CHAR;
PROCEDURE strbetween(s : ARRAY OF CHAR; VAR name : ARRAY OF
CHAR;VAR pos : LONGINT);
(* Finds strings delimited by doublequote *)
VAR i,j : LONGINT;
BEGIN
i:= pos; WHILE (i < Strings.Length(s) ) & ( s[i] # DBLQUOTE ) DO
INC(i) END;
j := 0; INC(i);
WHILE(i < Strings.Length(s) ) & (s[i] # DBLQUOTE) DO
name[j] := s[i]; INC(i); INC(j) END; pos := i +1; name[j+1] := 0X;
END strbetween;
(* PROCEDURE InOut*;
VAR comline : ARRAY 255 OF CHAR; infile, outfile : ARRAY 64 OF
CHAR; i, pos : LONGINT;
S : Texts.Scanner; R : Texts.Reader; c : CHAR;
BEGIN
Texts.OpenReader(R,Oberon.Par.text,Oberon.Par.pos); Texts.Read(R,c);
i := 0;
WHILE ~R.eot DO comline[i] := c; Texts.Read(R,c); INC(i) END;
comline[i] := 0X;
pos := 0;
strbetween(comline,infilename,pos);
Out.String(infilename); Out.Ln();
strbetween(comline,outfilename,pos);
Out.String(outfilename);
END InOut; *)
BEGIN
cl := Kernel32.GetCommandLine();
Kernel32.CopyString(cl, commandLine);
pos := 0;
strbetween(commandLine,infilename,pos);
Kernel32.Str(infilename); Kernel32.Ln();
strbetween(commandLine,outfilename,pos);
Kernel32.Str(outfilename); Kernel32.Ln();
END InOut.InOut "d:/musix/telemann/telemann.xml"
"d:/musix/telemann/telemann.pmx"~
===============================================================
I modified the HelloCon.Link as best, as I could think off, like:
===========================================================
PROGRAM twolines
SUBSYSTEM CUI
IMGVERSION 2.5
HEAPSIZE 010000H
MODULES
Kernel32, Kernel, ADVAPI32, Registry, FileDir, AosIO, Files,
Modules, Strings, InOut
IMPORTS
Kernel.bootHeapAdr = HeapAdr,
Kernel.bootHeapSize = HeapSize,
Kernel.isEXE = isEXE,
Kernel32.AllocConsole = KERNEL32.AllocConsole,
/ in between same as HelloCon.Link/
ADVAPI32.VerQueryValue = Version.VerQueryValueA
ICONS
Oberon = Oberon.ico
VERSION
CompanyName = "Institute for Computer Systems of ETH Zürich",
FileDescription = "ETH PlugIn Oberon Hello",
FileVersion = "Release 2.5",
LegalCopyright = "(c) 2004 Team of the Institute for Computer
Systems of ETH Zürich",
LegalTrademarks = '"Oberon" and "Gadgets" are trademarks of
Eidgenössische Technische Hochschule, Zürich (ETHZ)',
OriginalFilename = "twolines.EXE"
==============================================================
This yields another trap
==============================================================
TRAP 100 HALT statement in thread Oberon.Loop
BootLinker.Halt PC = 1857
msg = "Imported module not loaded"
BootLinker.ReadImport PC = 10781
R = 00416E98H Files.Rider
m = 0273AE80H BootLinker.ModuleDesc
BootLinker.LoadModule PC = 16007
R = 00416E98H Files.Rider
base = 4305628
body = NIL
ch = 00000000X
e = 0
i = 0
imp = 00000000H (BootLinker.ModuleDesc)
j = 0
k = 0
m = 0273AE80H BootLinker.ModuleDesc
mname = "Dates"
mno = 0
nofDataLinks = 4
nofLinks = 1
symSize = 932
t = 0
tmp = 960
BootLinker.Load PC = 18567
R = 00416E98H Files.Rider
base = 4305628
f = 02915B60H Files.File
fname = "Strings.Obj"
imp = 00000000H (BootLinker.ModuleDesc)
m = 0273AE80H BootLinker.ModuleDesc
name = "Strings"
tag = 000000AFX
PELinker.DoLink PC = 22134
F = 026FA2A0H Files.File
R = 00416E98H Files.Rider
T = 0299A520H Texts.TextDesc
base = 4305628
context = 0042DB98H Exceptions.Context
done = FALSE
mod = 0273AE80H BootLinker.ModuleDesc
name = 029C2CE0H PELinker.NameList
offs = 0
sections = 3
PELinker.Link PC = 23391
S = 00447158H Texts.Scanner
T = 0299A520H Texts.TextDesc
done = FALSE
Oberon.Call PC = 5931
Mod = 026C3C00H Kernel.ModuleDesc
P = PELinker.Link PC = 22948
cur = 027327C0H Windows.Window (Displays.Display)
f = 028761E0H Desktops.DocViewerDesc (Objects.ObjDesc)
i = 9
j = 13
name = "Link"
new = FALSE
par = 026EA540H Oberon.ParRec
res = 1
Builder.Compile \s InOut.Mod ~
PELinker.Link InOut.Link ~
RegistryTools.Load InOut.reg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.inf.ethz.ch/pipermail/oberon/attachments/20150316/44274c7d/attachment.html
More information about the Oberon
mailing list