[Oberon] Oberon 3 on Windows 7, PELinker, Windows executable
Dieter
d.gloetzel at web.de
Tue Mar 17 19:25:19 CET 2015
Hi Chris,
this is great news. Thank you so much! It seems that making the PELinker
work is more an art than science.
I have now a new Version, which tries to read and write a file.
The module is:
================================================================================
MODULE InOut;
(* IMPORT Files,Oberon,Objects, Strings, Texts,Out; Import for
Oberon Version*)
IMPORT Kernel32, Files, Oberon,Objects, Strings, Texts;
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; c : CHAR;
ti, to : Texts.Text; R : Texts.Reader; W : Texts.Writer; S :
Texts.Scanner; f : Files.File;
PROCEDURE strbetween(s : ARRAY OF CHAR; VAR name : ARRAY OF
CHAR;VAR pos : LONGINT);
VAR i,j : LONGINT;
BEGIN
i:= pos; WHILE (i < Strings.Length(s) ) & ( s[i] # DBLQUOTE )
DO INC(i) END; (* Find first doublequote *)
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 Storewo( t: Texts.Text; f: Files.File );
(* stores a Texts.Text to disk. but eliminates multiple BLANKs. *)
VAR R: Texts.Reader; r: Files.Rider; ch: CHAR;
BEGIN
Files.Set( r, f, 0 ); Texts.OpenReader( R, t, 0 ); Texts.Read(
R, ch );
WHILE ~R.eot DO
Files.Write( r, Strings.OberonToISO[ORD( ch )] );
IF ch =Strings.CR THEN Files.Write(r,NL); END;
IF (ch = BLANK) THEN
WHILE (ch = BLANK) DO Texts.Read( R, ch ); END;
ELSE Texts.Read( R, ch );
END;
END;
END Storewo;
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();
Texts.New; ti := Objects.NewObj( Texts.Text ); Texts.Open( ti,
infilename ); Texts.OpenReader( R, ti, 0 );
Texts.New; to := Objects.NewObj( Texts.Text ); Texts.OpenWriter( W );
WHILE ~ R.eot DO Texts.Read(R,c) ; Texts.Write(W,c); END;
f := Files.New( outfilename); Texts.Append( to, W.buf ); Storewo(
to , f ); Files.Close( f ); Files.Register( f );
END InOut.InOut "d:/musix/telemann/telemann.xml"
"d:/musix/telemann/telemann.copy"~
=====================================================================================
I tried several versions of the Modules list in PELinker without success.
=======================================================================
MODULES
Kernel32, Kernel, ADVAPI32, Reals, Registry, Dates, FileDir, AosIO,
User32, GDI32, Threads,
Files, Modules, Strings, Objects, Displays, Texts, InOut
======================================================================
I tested the Oberon Version, but the linker crashed again.
Regards, Dieter
System.Free InOut ~
Builder.Compile \s InOut.Mod ~
PELinker.Link InOut.Link ~
RegistryTools.Load InOut.reg
More information about the Oberon
mailing list