-/* This is an interface which allows to us make a va_list. */
-typedef struct {
- unsigned int nargs;
- unsigned int max_arg_size;
-
- /* Current position in bytes. */
- unsigned int argindex;
-
-#ifdef MAKEVA_EXTRA_INFO
- /* For host dependent information. */
- MAKEVA_EXTRA_INFO
-#endif
-
- /* Some systems (mips, pa) would like this to be aligned, and it never
- will hurt. */
- union
- {
- char arg_bytes[1];
- double force_double_align;
- LONGEST force_long_align;
- } aligner;
-} makeva_list;
-
-/* Tell the caller how many bytes to allocate for a makeva_list with NARGS
- arguments and whose largest argument is MAX_ARG_SIZE bytes. This
- way the caller can use alloca, malloc, or some other allocator. */
-unsigned int
-makeva_size (nargs, max_arg_size)
- unsigned int nargs;
- unsigned int max_arg_size;
-{
- return sizeof (makeva_list) + nargs * max_arg_size;
-}
-
-/* Start working on LIST with NARGS arguments and whose largest
- argument is MAX_ARG_SIZE bytes. */
-void
-makeva_start (list, nargs, max_arg_size)
- makeva_list *list;
- unsigned int nargs;
- unsigned int max_arg_size;
-{
- list->nargs = nargs;
- list->max_arg_size = max_arg_size;
-#if defined (MAKEVA_START)
- MAKEVA_START (list);
-#else
- list->argindex = 0;
-#endif
-}
-
-/* Add ARG to LIST. */
-void
-makeva_arg (list, argaddr, argsize)
- makeva_list *list;
- PTR argaddr;
- unsigned int argsize;
-{
-#if defined (MAKEVA_ARG)
- MAKEVA_ARG (list, argaddr, argsize);
-#else
- memcpy (&list->aligner.arg_bytes[list->argindex], argaddr, argsize);
- list->argindex += argsize;
-#endif
-}
-
-/* From LIST, for which makeva_arg has been called for each arg,
- return a va_list containing the args. */
-va_list
-makeva_end (list)
- makeva_list *list;
-{
-#if defined (MAKEVA_END)
- MAKEVA_END (list);
-#else
- /* This works if a va_list is just a pointer to the arguments. */
- return (va_list) list->aligner.arg_bytes;
-#endif
-}
-\f