[Oberon] Calling a command from within a normal procedure

Dieter d.gloetzel at web.de
Tue Mar 8 09:40:10 CET 2016


Hi Chris,

It was not my intention to mystify anybody with my contribution.

It just describes a way (maybe there are others) to hand over data to an 
external procedure called within another procedure.

For parameterless Procedures your example is certainly to be preferred.

I used this construct many years ago, in order to use "PictConverters" 
under program control.

Something like "PictConverters.GIFToPict Clown.gif => ClownG.Pict ~".

Oberon.Call is a totally dynamic call without the need to import the 
concerned Module.

Regards,
Dieter

P.S.: By the way the Module "Texts"  deals with strings of arbitrary length,
        a problem being discussed during the last months in this list.


============================================================================= 

MODULE OberonCall;
IMPORT Oberon,Out,Objects,Texts;

PROCEDURE CallEdit*;
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);
(* Put here path and filename *)
Texts.WriteString(W,"D:/ETHOberon/work/Fifo.Mod");
Texts.Append(t,W.buf);
par.text := t; par.pos := 0;
Out.Ln();Oberon.Call ("Edit.Open", par, FALSE, res);
END CallEdit;

END OberonCall.CallEdit

System.Free OberonCall
=============================================================================

This works in ETH PlugIn Oberon for WindowsTM / Win32 2.5 (18.12.2010) 
as well as in Peter Mathias' OLR.





Am 07.03.2016 um 11:37 schrieb Chris Burrows:
>> -----Original Message-----
>> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
>> Chris Burrows
>> Sent: Monday, 7 March 2016 6:06 PM
>> To: 'ETH Oberon and related systems'
>> Subject: Re: [Oberon] Calling a command from within a normal
>> procedure
>>
>>> -----Original Message-----
>>> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
>>> Srinivas Nayak
>>> Sent: Monday, 7 March 2016 3:09 PM
>>> To: ETH Oberon and related systems
>>> Subject: [Oberon] Calling a command from within a normal procedure
>>>
>>> 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?
>>>
>> Yes you can.
>>
> I'm mystified by the other complicated replies here or did I misunderstand
> the question? To clarify my previous reply, here's a simple test program
> that illustrates calling a parameterless exported procedure (Edit.Open) from
> another procedure:
>
> MODULE Command;
>
> IMPORT Edit;
>
> PROCEDURE Run*;
> BEGIN
>    Edit.Open
> END Run;
>
> END Command.
>
> Regards,
> Chris
>
> --
> Oberon at lists.inf.ethz.ch  mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>


-- 
____________________________________
Dr. Dieter Glötzel
Im Rosengarten 27
64367 Mühltal
Tel.: 06151 / 360 82 72



More information about the Oberon mailing list