[Oberon] Oberon 3 on Windows 7, PELinker, Windows executable
Chris Burrows
chris at cfbsoftware.com
Mon Mar 16 00:28:57 CET 2015
>
> From: Dieter [mailto:d.gloetzel at web.de]
> Sent: Monday, 16 March 2015 4:30 AM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Oberon 3 on Windows 7, PELinker, Windows
> executable
>
> Hi Chris,
>
> thanks for your recommendations. I tried, what you told me. But I did
> not succeed. It seems I am lacking some crucial information.
>
> o.k. with the HelloCon-example:
>
Great!
> Compile->Link->Register->Run and "Hello from Oberon!" appears on the
> DOS-Console. This example is somewhat limited.
> It does not tell me how to deal with an executable Oberon Procedure
> in a Module or maybe several of these in one Module.
>
If you have one executable Oberon Procedure in the Module then just put a
call to that procedure in the initialisation section of the Module after all
of the existing initialisation code.
If you have more than one executable Oberon procedure in the Module then you
could add a third parameter to your command line. You can then read that
parameter and interpret it in your program to decide which executable
procedure to call.
> Then I tried to extend this in a way that the EXE would read a
> parameter from the command line.
> Since I do not know the intricacies of the Kernel32-Library,
OK - here is a start for you. Kernel32 has a procedure call GetCommandLine
that returns the content of the command line that your program was called
with. I have extended the HelloCon example to get the command line and
display it. Hence, if you call it with the command:
Hello abc xyz 123
It will display:
Hello from Oberon!
Hello abc xyz 123
The source code is:
MODULE HelloCon;
IMPORT Kernel32;
VAR
cl: Kernel32.LPSTR;
commandLine: ARRAY 255 OF CHAR;
BEGIN
Kernel32.Str("Hello from Oberon!"); Kernel32.Ln();
cl := Kernel32.GetCommandLine();
Kernel32.CopyString(cl, commandLine);
Kernel32.Str(commandLine); Kernel32.Ln();
END HelloCon.
The work that you will now have to do is parse that command line to extract
the three parameters "abc", "def", "123" as strings and then interpret them
according to your requirements.
> I tried the following:
> The only idea I had was to try to use the parameter mechanism of
> Oberon
> and hope that this would be magically transferred to the
> executable.
Unfortunately not. Once you get out of the Oberon environment and into a
Windows command line (i.e. MS-DOS) environment then you have to give up all
of the GUI capabilities of the Oberon environment. If your program is
dependent on any GUI, graphics or mouse capabilities then you need to have a
rethink about what you are trying to do.
>
> A batch solution like << myprogram.exe "path to input file" "path to
> output file">> would be sufficient for my present task.
Good. That will make your life a whole lot easier.
> But could one also produce screen oriented interactive Windows
> programs from Oberon code?
Yes. If you use a development system that was primarily designed to produce
screen oriented interactive MS Windows programs e.g. Blackbox, Gardens Point
Component Pascal, POW! etc.
Regards,
Chris
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
More information about the Oberon
mailing list