Back to index

tetex-bin  3.0
Classes | Enumerations | Functions
printf-args.h File Reference
#include <stddef.h>
#include <stdarg.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  argument
struct  arguments
union  argument.a

Enumerations

enum  arg_type {
  TYPE_NONE, TYPE_SCHAR, TYPE_UCHAR, TYPE_SHORT,
  TYPE_USHORT, TYPE_INT, TYPE_UINT, TYPE_LONGINT,
  TYPE_ULONGINT, TYPE_DOUBLE, TYPE_CHAR, TYPE_STRING,
  TYPE_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER,
  TYPE_COUNT_LONGINT_POINTER
}

Functions

int printf_fetchargs (va_list args, arguments *a)

Class Documentation

struct argument

Definition at line 78 of file printf-args.h.

Class Members
union argument a
arg_type type
struct arguments

Definition at line 121 of file printf-args.h.

Collaboration diagram for arguments:
Class Members
argument * arg
size_t count
union argument.a

Definition at line 81 of file printf-args.h.

Class Members
int a_char
int * a_count_int_pointer
long int * a_count_longint_pointer
signed char * a_count_schar_pointer
short * a_count_short_pointer
double a_double
float a_float
int a_int
long int a_longint
void * a_pointer
signed char a_schar
short a_short
const char * a_string
unsigned char a_uchar
unsigned int a_uint
unsigned long int a_ulongint
unsigned short a_ushort

Enumeration Type Documentation

enum arg_type
Enumerator:
TYPE_NONE 
TYPE_SCHAR 
TYPE_UCHAR 
TYPE_SHORT 
TYPE_USHORT 
TYPE_INT 
TYPE_UINT 
TYPE_LONGINT 
TYPE_ULONGINT 
TYPE_DOUBLE 
TYPE_CHAR 
TYPE_STRING 
TYPE_POINTER 
TYPE_COUNT_SCHAR_POINTER 
TYPE_COUNT_SHORT_POINTER 
TYPE_COUNT_INT_POINTER 
TYPE_COUNT_LONGINT_POINTER 

Definition at line 40 of file printf-args.h.

{
  TYPE_NONE,
  TYPE_SCHAR,
  TYPE_UCHAR,
  TYPE_SHORT,
  TYPE_USHORT,
  TYPE_INT,
  TYPE_UINT,
  TYPE_LONGINT,
  TYPE_ULONGINT,
#ifdef HAVE_LONG_LONG
  TYPE_LONGLONGINT,
  TYPE_ULONGLONGINT,
#endif
  TYPE_DOUBLE,
#ifdef HAVE_LONG_DOUBLE
  TYPE_LONGDOUBLE,
#endif
  TYPE_CHAR,
#ifdef HAVE_WINT_T
  TYPE_WIDE_CHAR,
#endif
  TYPE_STRING,
#ifdef HAVE_WCHAR_T
  TYPE_WIDE_STRING,
#endif
  TYPE_POINTER,
  TYPE_COUNT_SCHAR_POINTER,
  TYPE_COUNT_SHORT_POINTER,
  TYPE_COUNT_INT_POINTER,
  TYPE_COUNT_LONGINT_POINTER
#ifdef HAVE_LONG_LONG
, TYPE_COUNT_LONGLONGINT_POINTER
#endif
} arg_type;

Function Documentation

int printf_fetchargs ( va_list  args,
arguments a 
)

Definition at line 30 of file printf-args.c.

{
  size_t i;
  argument *ap;

  for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
    switch (ap->type)
      {
      case TYPE_SCHAR:
       ap->a.a_schar = va_arg (args, /*signed char*/ int);
       break;
      case TYPE_UCHAR:
       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
       break;
      case TYPE_SHORT:
       ap->a.a_short = va_arg (args, /*short*/ int);
       break;
      case TYPE_USHORT:
       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
       break;
      case TYPE_INT:
       ap->a.a_int = va_arg (args, int);
       break;
      case TYPE_UINT:
       ap->a.a_uint = va_arg (args, unsigned int);
       break;
      case TYPE_LONGINT:
       ap->a.a_longint = va_arg (args, long int);
       break;
      case TYPE_ULONGINT:
       ap->a.a_ulongint = va_arg (args, unsigned long int);
       break;
#ifdef HAVE_LONG_LONG
      case TYPE_LONGLONGINT:
       ap->a.a_longlongint = va_arg (args, long long int);
       break;
      case TYPE_ULONGLONGINT:
       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
       break;
#endif
      case TYPE_DOUBLE:
       ap->a.a_double = va_arg (args, double);
       break;
#ifdef HAVE_LONG_DOUBLE
      case TYPE_LONGDOUBLE:
       ap->a.a_longdouble = va_arg (args, long double);
       break;
#endif
      case TYPE_CHAR:
       ap->a.a_char = va_arg (args, int);
       break;
#ifdef HAVE_WINT_T
      case TYPE_WIDE_CHAR:
       ap->a.a_wide_char = va_arg (args, wint_t);
       break;
#endif
      case TYPE_STRING:
       ap->a.a_string = va_arg (args, const char *);
       break;
#ifdef HAVE_WCHAR_T
      case TYPE_WIDE_STRING:
       ap->a.a_wide_string = va_arg (args, const wchar_t *);
       break;
#endif
      case TYPE_POINTER:
       ap->a.a_pointer = va_arg (args, void *);
       break;
      case TYPE_COUNT_SCHAR_POINTER:
       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
       break;
      case TYPE_COUNT_SHORT_POINTER:
       ap->a.a_count_short_pointer = va_arg (args, short *);
       break;
      case TYPE_COUNT_INT_POINTER:
       ap->a.a_count_int_pointer = va_arg (args, int *);
       break;
      case TYPE_COUNT_LONGINT_POINTER:
       ap->a.a_count_longint_pointer = va_arg (args, long int *);
       break;
#ifdef HAVE_LONG_LONG
      case TYPE_COUNT_LONGLONGINT_POINTER:
       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
       break;
#endif
      default:
       /* Unknown type.  */
       return -1;
      }
  return 0;
}

Here is the caller graph for this function: