public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* portable cdecl 'elliptic' function calls
@ 2003-07-28 22:48 Camm Maguire
  2003-07-29  9:52 ` Fergus Henderson
  2003-07-29 11:37 ` [Axiom-developer] " Arthur Norman
  0 siblings, 2 replies; 8+ messages in thread
From: Camm Maguire @ 2003-07-28 22:48 UTC (permalink / raw)
  To: gcc, gcl-devel, axiom-developer

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			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-08-01  0:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-28 22:48 portable cdecl 'elliptic' function calls Camm Maguire
2003-07-29  9:52 ` Fergus Henderson
2003-07-31  2:40   ` Camm Maguire
2003-07-31  6:42     ` [Gcl-devel] " Mike Thomas
2003-07-31 14:53       ` Fergus Henderson
2003-08-01  1:22       ` Tom Tromey
2003-08-01  2:29         ` Tom Tromey
2003-07-29 11:37 ` [Axiom-developer] " Arthur Norman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).