[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] portable cdecl 'elliptic' function calls
From: |
Camm Maguire |
Subject: |
[Axiom-developer] portable cdecl 'elliptic' function calls |
Date: |
Mon, 28 Jul 2003 17:34:08 -0400 |
Greetings! On 3 of the 11 Debian architectures (i386, m68k, and ia64),
the cdecl calling convention is available, making the following code
possible:
object
c_apply_n(object (*fn)(), int n, object *x)
{object res=Cnil;
#if 1
object *stack;
if (!(stack=alloca(n*sizeof(*stack))))
FEerror("Cannot allocate stack for elliptic call", 0);
memcpy(stack,x,n*sizeof(*stack));
res=fn();
As one might guess, this is taken from GCL and is used to call C
functions with a runtime-determined number of arguments.
I know that the portable way to do this is with a switch statement on
n, but this would always be something of a workaround, limiting the
argument list to some presumably large number, and taking up a fair
bit of space in the code.
My question is whether there is an alternative call analogous to the
one outlined above for the other 8 Debian architectures (arm,
mips(el), alpha, hppa, sparc, ppc, s390), giving an unlimited to
within system stack memory runtime-determined argument list to a C
function call on these platforms as well?
Advice much appreciated,
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
- [Axiom-developer] portable cdecl 'elliptic' function calls,
Camm Maguire <=
Re: [Axiom-developer] portable cdecl 'elliptic' function calls, Arthur Norman, 2003/07/29