Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* Decomposed printf argument list.
  2. Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU Library General Public License as published
  5. by the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  14. USA. */
  15. #ifndef _PRINTF_ARGS_H
  16. #define _PRINTF_ARGS_H
  17. /* Get size_t. */
  18. #include <stddef.h>
  19. /* Get wchar_t. */
  20. #ifdef HAVE_WCHAR_T
  21. # include <stddef.h>
  22. #endif
  23. /* Get wint_t. */
  24. #ifdef HAVE_WINT_T
  25. # include <wchar.h>
  26. #endif
  27. /* Get va_list. */
  28. #include <stdarg.h>
  29. /* Argument types */
  30. typedef enum
  31. {
  32. TYPE_NONE,
  33. TYPE_SCHAR,
  34. TYPE_UCHAR,
  35. TYPE_SHORT,
  36. TYPE_USHORT,
  37. TYPE_INT,
  38. TYPE_UINT,
  39. TYPE_LONGINT,
  40. TYPE_ULONGINT,
  41. #ifdef HAVE_LONG_LONG
  42. TYPE_LONGLONGINT,
  43. TYPE_ULONGLONGINT,
  44. #endif
  45. TYPE_DOUBLE,
  46. #ifdef HAVE_LONG_DOUBLE
  47. TYPE_LONGDOUBLE,
  48. #endif
  49. TYPE_CHAR,
  50. #ifdef HAVE_WINT_T
  51. TYPE_WIDE_CHAR,
  52. #endif
  53. TYPE_STRING,
  54. #ifdef HAVE_WCHAR_T
  55. TYPE_WIDE_STRING,
  56. #endif
  57. TYPE_POINTER,
  58. TYPE_COUNT_SCHAR_POINTER,
  59. TYPE_COUNT_SHORT_POINTER,
  60. TYPE_COUNT_INT_POINTER,
  61. TYPE_COUNT_LONGINT_POINTER
  62. #ifdef HAVE_LONG_LONG
  63. , TYPE_COUNT_LONGLONGINT_POINTER
  64. #endif
  65. } arg_type;
  66. /* Polymorphic argument */
  67. typedef struct
  68. {
  69. arg_type type;
  70. union
  71. {
  72. signed char a_schar;
  73. unsigned char a_uchar;
  74. short a_short;
  75. unsigned short a_ushort;
  76. int a_int;
  77. unsigned int a_uint;
  78. long int a_longint;
  79. unsigned long int a_ulongint;
  80. #ifdef HAVE_LONG_LONG
  81. long long int a_longlongint;
  82. unsigned long long int a_ulonglongint;
  83. #endif
  84. float a_float;
  85. double a_double;
  86. #ifdef HAVE_LONG_DOUBLE
  87. long double a_longdouble;
  88. #endif
  89. int a_char;
  90. #ifdef HAVE_WINT_T
  91. wint_t a_wide_char;
  92. #endif
  93. const char* a_string;
  94. #ifdef HAVE_WCHAR_T
  95. const wchar_t* a_wide_string;
  96. #endif
  97. void* a_pointer;
  98. signed char * a_count_schar_pointer;
  99. short * a_count_short_pointer;
  100. int * a_count_int_pointer;
  101. long int * a_count_longint_pointer;
  102. #ifdef HAVE_LONG_LONG
  103. long long int * a_count_longlongint_pointer;
  104. #endif
  105. }
  106. a;
  107. }
  108. argument;
  109. typedef struct
  110. {
  111. size_t count;
  112. argument *arg;
  113. }
  114. arguments;
  115. /* Fetch the arguments, putting them into a. */
  116. #ifdef STATIC
  117. STATIC
  118. #else
  119. extern
  120. #endif
  121. int printf_fetchargs (va_list args, arguments *a);
  122. #endif /* _PRINTF_ARGS_H */