[Oberon] Identify Calling Command

Felix Friedrich friedrich at gsf.de
Thu Aug 22 11:42:37 CEST 2002


> > Is there a portable way to identify the caller of a procedure, I need
>
>I don't really know a portable way (since ETH Oberon does not have
>full-featured metaprogramming facilities in all versions), but the
>following works on Native Oberon and Windows Oberon.
Thanks a lot, Pieter,
that's exactly what I need. I need it for the following: consider the Procedure

PROCEDURE New*;
VAR l: antsCommands.tScanList;        name: vyName.tNameArray;  c: Chain;
BEGIN
         aM.enter("antsMC.New");
         l := antsCommands.ScanFromPar("name=NAME # create new markov chain");
         IF antsCommands.ExpectNameFromKeyword(l, "name", name) THEN
                 Gen;
                 c := Objects.NewObj(Chain);
                 vyName.RegisterNamed(c, name)
         END
END New;

The third line is the one I wanted to circumvent. The mechanism is the 
following: The user should give a command like
antsMC.New myMarkovChain or antsMC.New name=myMarkovChain. Suppose he makes 
some mistake like executing  antsMC.New  without any parameters then I want 
a statement in the Log like
usage: antsMC.New name=NAME # create new markov chain

Now, since you have answered I can ommit the statement aM.enter("antsMC.New");

Thank you again,

Felix.
--

Felix Friedrich

Institut für Biomathematik und Biometrie
GSF - Forschungszentrum für Umwelt und Gesundheit, GmbH
Ingolstädter Landstraße 1, D-85764 Neuherberg

Tel:      ++49 89 3187 2436
email:  friedrich at gsf.de

--




More information about the Oberon mailing list