[comp.sys.amiga.programmer] #pragmas, prototypes and stdarg.h in SAS-C

swalton@solaria.csun.edu (Stephen Walton) (01/19/91)

In article <1991Jan18.093448.6181@uni-paderborn.de>, fillg1@uni-paderborn (Michael Illgner) writes:
>Hi folks,
>
>I have some difficulties building the right prototypes and #pragma libcall's
>for functions with a variable number of parameters.

The prototype for a typical variable arguments function would be

int scanf(char *format, ...);

As for libcalls, I don't think you can do it.  A libcall #pragma means
that all arguments are to be passed in registers, not on the stack.
This isn't possible, especially in the new 2.0 tag-type functions
where the variable number of parameters can easily be 20.

bj@cbmvax.commodore.com (Brian Jackson) (01/21/91)

In article <1991Jan19.010507.2684@csun.edu> swalton@solaria.csun.edu (Stephen Walton) writes:
>In article <1991Jan18.093448.6181@uni-paderborn.de>, fillg1@uni-paderborn (Michael Illgner) writes:
>>Hi folks,
>>
>>I have some difficulties building the right prototypes and #pragma libcall's
>>for functions with a variable number of parameters.
>
>The prototype for a typical variable arguments function would be
>
>int scanf(char *format, ...);
>
>As for libcalls, I don't think you can do it.  A libcall #pragma means
>that all arguments are to be passed in registers, not on the stack.
>This isn't possible, especially in the new 2.0 tag-type functions
>where the variable number of parameters can easily be 20.

Most all of the new functions that take Tags as an argument give you
the choice of functions, one passes a vararg array of tag values and one
passes a pointer to the first element in an array of Tagitems.
 
 Example (from GadTools autodoc) :
 
	CreateMenusA(struct NewMenu *, struct TagItem *) ; 
 
	CreateMenus( struct Newmenu *, Tag, ... ) ;

bj

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEnie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 | "Seek simplicity, and distrust it."                                 |
 -----------------------------------------------------------------------