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-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 07 Jan 2008 23:20:40 -0600 From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Create a procedure with multiple arguments ... Date: Mon, 7 Jan 2008 21:23:13 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original Message-ID: X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 24.20.111.206 X-Trace: sv3-MMkayfDoF9U38vg7LPIe+bnfnRivPLUy/lSbbeg1UeIwB8FJKx+njcqHh6bZu4J+4bcSEhGxCCcuS5a!Jx4C++LhfAL+p75o2EG4k06D6vkuxo/x3N9PnPjpCHj/qfUtk8uF/9EH8vm2urWIulQ0mlpUKmq1!FquPMq2bPhp0mCy/S44r8fMMLd/PgQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.37 Xref: g2news1.google.com comp.lang.ada:19266 Date: 2008-01-07T21:23:13-08:00 List-Id: 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. I am guessing that the procedure call you're describing is for a C binding to interact with the interpreter. With 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? Or is that where you found the information you are describing. I would expect 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. If that is the case then 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, ..., 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