Ilya Martynov <[EMAIL PROTECTED]> wrote:

> Hello all,

> 1) First question is how to tell if variadic function recieved 11 or
>    12 or more params (for simplicity let's suppose that we use only
>    pmc parameters).

> According calling conventions (pdd03) first 11 params end up in P5-P15
> registers and leftover goes into array in P3. The problem is that
> there is no indication (unless I'm missing something) if function was
> called with more than 11 params other than register P3 being
> initialized with some array PMC. But it may be as well that function
> was called with just 11 params and P3 contains some array by accident
> (it could be for example some array from previous sub call).

11 arguments passed: P5..P15, P3 is NULL (is_null P3 ...)
12 arguments passed: P5..P15, Ix = P3, Ix := 1

But I'm not sure if P3 actually is cleared (rather not :)

> 2) Second question if there is an op to access registers by their
>    number (it is quite troublesome to write code to retrieve
>    parameters in variadic function from P5-P15 registeres without such
>    op).

You are probably looking for C<foldup>. s. t/op/calling.t

> 3) Not really a question but a feature request for IMCC to provide
>    some support for variadic functions to avoid writing same code
>    again and again to read parameters of variadic function from either
>    P5-P15 registers or from array in P3 register as necessary. Not
>    sure about syntax though. It could look for example like this:

C<foldup> again.

leo

Reply via email to