[Oberon] Calling a command from within a normal procedure

Dieter d.gloetzel at web.de
Mon Mar 7 10:53:38 CET 2016


Please find attached an example with ETH PlugIn Oberon for WindowsTM / 
Win32 2.5 (18.12.2010)

==========================================================================
MODULE OberonCall;
IMPORT Oberon,Out, Objects,Texts;
PROCEDURE hello*;
VAR S : Texts.Scanner;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
Out.String("Hello World!"); Out.String (S.s);
END hello;

PROCEDURE Callhello*;
VAR par : Oberon.ParList; W : Texts.Writer;  res : INTEGER; t : Texts.Text;
BEGIN
NEW(par);
Texts.New;  t := Objects.NewObj( Texts.Text );
Texts.OpenWriter(W);
Texts.WriteString(W," Dieter");
Texts.Append(t,W.buf);
par.text := t; par.pos := 0;
Oberon.Call ("OberonCall.hello", par, FALSE, res);
END Callhello;

END OberonCall.hello " Dieter"

System.Free OberonCall

OberonCall.Callhello
=============================================================================
Note thate the extra BLANK in <<Texts.WriteString(W," Dieter");>> is 
ignored, because of the scanning in "PROCEDURE hello".
This works equally well on Peter Mathias' OLR.

Regards,
Dieter

Am 07.03.2016 um 09:07 schrieb eas lab:
> That's a novel idea.
> Since I don't know the answer: the reasoning process is more valuable.
> Will it compile? What syntax would you use ?
> `Edit.Open <a valid file name>
> What makes the <file name> valid?
>
> I've got an extra problem, using LEO, because that's designed to 'fit in'
> with linux, and can even do: `System.Execute <any valid linux cmnd>`
>
> But lets consider old:NativeOberon:
> If you imported "Edit"; you'd have access to proc: Edit.Open.
> But Edit.Open is designed to input it's arg by <scanning the display>
> and not by having the arg passed.
>
> .... interesting problem  ...
> Right now, I lack access to Edit.Mod [while this garbage gmail is running].
> OK: since Edit.Mod is intended to be accessed by the OS, it has no
> <parameters to be given>. It starts and fetched its own arg/s.
>
> It's not the answer that counts; but the reasoning process ......
>
> == Chris Glur.
>
>
>
>
> On 3/6/16, Srinivas Nayak<sinu.nayak2001 at gmail.com>  wrote:
>> Dear All,
>>
>> Can we call a procedure from within a program which we can call as a
>> command?
>> Ex. Edit.Open
>> This is a pure procedure and we can use this as a command.
>> Can we call this procedure from within another procedure?
>>
>>
>> With thanks and best regards,
>>
>> Yours sincerely,
>> Srinivas Nayak
>>
>> Home:http://www.mathmeth.com/sn/
>> Blog:http://srinivas-nayak.blogspot.in/
>> --
>> Oberon at lists.inf.ethz.ch  mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>
> --
> Oberon at lists.inf.ethz.ch  mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>




More information about the Oberon mailing list