From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4c3f68493d9d2340 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!q77g2000hsh.googlegroups.com!not-for-mail From: kug1977@web.de Newsgroups: comp.lang.ada Subject: Re: Create a procedure with multiple arguments ... Date: Tue, 8 Jan 2008 07:22:51 -0800 (PST) Organization: http://groups.google.com Message-ID: <9a05bf3c-654e-4a7b-a97d-ce59edd892bb@q77g2000hsh.googlegroups.com> References: NNTP-Posting-Host: 213.68.78.252 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1199805779 17803 127.0.0.1 (8 Jan 2008 15:22:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Jan 2008 15:22:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q77g2000hsh.googlegroups.com; posting-host=213.68.78.252; posting-account=3ciIaAoAAAA6pCfildcdAcuc3UQuirtL User-Agent: G2/1.0 X-HTTP-Via: 1.0 MUCPISA1 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19271 Date: 2008-01-08T07:22:51-08:00 List-Id: On 8 Jan., 06:23, "Steve" wrote: > wrote in message > > news:f1400d6d-97a4-4803-946d-b44bc96a15cf@1g2000hsl.googlegroups.com... > > > > > > > Hi @ all, > > > I'm a beginner in Ada and have the following problem: > > > - I'm using GNAT 4.3 on a MacOS X 10.4. and develop on the > > OpenFirmware Interface. > > - To connect to the Firmware, the IEEE 1275 define an Procedure call- > > methode(), which can have up multiple arguments. IEEE 1275 define call- > > method as followed: > > > IN: [string] method, ihandle, stack-arg1, ..., stack-argP > > OUT: catch-result, stack-result1, ..., stack-resultQ > > Pushes two less than N-args items, stack-arg1, ..., stack-argP, onto > > the Forth data stack, with stack-arg1 on top of the stack, and > > executes the package method named method in the instance ihandle as > > with $call-method, guarded by catch. Pops the result returned by catch > > into catch-result. If that result is nonzero, restore the depth of the > > Forth data stack to its depth prior to the execution of call-method. > > I don't know much about the OpenFirmware interface (other than what I just= > read on Wikipedia) but it appears to be a regular Forth interpreter, and I= > do know something about Forth. =A0I am guessing that the procedure call yo= u're > describing is for a C binding to interact with the interpreter. =A0With a = C > binding it makes sense to set things up with variable argument lists, but = it > won't work that way with Ada. > > Have you tried looking into interfacing directly with the interpreter? =A0= Or > is that where you found the information you are describing. =A0I would exp= ect > a direct interface to the forth interpreter to send a string containging a= > sequence of tokens separated by spaces to the interpreter and receive a > string containing a similar sequence as output. =A0If that is the case the= n > the interface becomes a simple procedure call with an input string and an > output string. > > Regards, > Steve > (The Duck) > > > > > If that result is zero, pops up to one less than N-returns items, > > stack-result1, =A0..., stack-resultQ, from the Forth data stack into the= > > returned values portion of the argument array, with stack-result1 > > corresponding to the top of the stack. > > N-args and N-returns are stored in the argument array and may be > > different for different calls to > > call-method. If the number of items X left on the Forth data stack as > > a result of the execution of > > method is less than N-returns, only stack-result1 ... stack-resultX > > are modified; other elements of the returned values portion of the > > argument array are unaffected. If X is more than N-returns, additional > > items are popped from the Forth data stack after setting stack- > > result1 ... stack-resultQ so that, in all cases, the execution of call- > > method results in no net change to the depth of the Forth data stack. > > > In C, this is written as followed: static void *of_call(const char > > *service, int nargs, int nret, ...), but how can I write such a thing > > in Ada? > > > Any help would be appreciated ... best regards > > Kay-Uwe- Zitierten Text ausblenden - > > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - Yes, you're right. The OpenFirmware is a Forth Interpreter and the procedure call is for interacting with the OpenFirmware via an interface. As far as I understud the manuals, the procedures do no more than calling the Forth interpreter by putting the parameters on the stack and jump back to OpenFirmware (where this BootLoader is running in). I'm implementing the procedure with overloading first, but couldn't test it now (no time in the moment). What you've written about the space separated tokens make sense, because the OpenFirmware console is no more the a Unix console, where you type in your commands seperated by spaces. I'll test this way, if I'm ready with implementation and will send you a feedback about success. Regards, Kay-Uwe