printf.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _PRINTF_H
  2. /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
  3. #include <bits/floatn.h>
  4. #if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  5. # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
  6. # pragma GCC system_header
  7. # endif
  8. #endif
  9. #include <stdio-common/printf.h>
  10. # ifndef _ISOMAC
  11. /* Internal interfaces for registered specifiers. */
  12. extern printf_arginfo_size_function **__printf_arginfo_table attribute_hidden;
  13. extern printf_function **__printf_function_table attribute_hidden;
  14. extern printf_va_arg_function **__printf_va_arg_table attribute_hidden;
  15. int __register_printf_specifier (int, printf_function,
  16. printf_arginfo_size_function);
  17. libc_hidden_proto (__register_printf_specifier)
  18. /* The various kinds of arguments that can be passed to printf. */
  19. union printf_arg
  20. {
  21. wchar_t pa_wchar;
  22. int pa_int;
  23. long int pa_long_int;
  24. long long int pa_long_long_int;
  25. unsigned int pa_u_int;
  26. unsigned long int pa_u_long_int;
  27. unsigned long long int pa_u_long_long_int;
  28. double pa_double;
  29. long double pa_long_double;
  30. #if __HAVE_FLOAT128_UNLIKE_LDBL
  31. _Float128 pa_float128;
  32. #endif
  33. const char *pa_string;
  34. const wchar_t *pa_wstring;
  35. void *pa_pointer;
  36. void *pa_user;
  37. };
  38. /* Invoke a registered printf callback. Called from vfprintf and vfwprintf. */
  39. int __printf_function_invoke (void *, printf_function callback,
  40. union printf_arg *args_value,
  41. size_t ndata_args,
  42. struct printf_info *info) attribute_hidden;
  43. int __wprintf_function_invoke (void *, printf_function callback,
  44. union printf_arg *args_value,
  45. size_t ndata_args,
  46. struct printf_info *info) attribute_hidden;
  47. #include <bits/types/locale_t.h>
  48. /* Returns the width (as for printf, in bytes) of the converted ASCII
  49. number in the characters in the range [FIRST, LAST). The range
  50. must only contain ASCII digits. The caller is responsible for
  51. avoiding overflow.
  52. This function is used during non-wide digit translation. Wide
  53. digit translate produces one wide character per ASCII digit,
  54. so the width is simply LAST - FIRST. */
  55. int __translated_number_width (locale_t loc,
  56. const char *first, const char *last)
  57. attribute_hidden;
  58. struct __printf_buffer;
  59. void __printf_buffer (struct __printf_buffer *buf, const char *format,
  60. va_list ap, unsigned int mode_flags);
  61. struct __wprintf_buffer;
  62. void __wprintf_buffer (struct __wprintf_buffer *buf, const wchar_t *format,
  63. va_list ap, unsigned int mode_flags);
  64. extern int __printf_fp (FILE *, const struct printf_info *,
  65. const void *const *);
  66. libc_hidden_proto (__printf_fp)
  67. void __printf_fphex_l_buffer (struct __printf_buffer *, locale_t,
  68. const struct printf_info *,
  69. const void *const *) attribute_hidden;
  70. void __printf_fp_l_buffer (struct __printf_buffer *, locale_t,
  71. const struct printf_info *,
  72. const void *const *) attribute_hidden;
  73. struct __wprintf_buffer;
  74. void __wprintf_fphex_l_buffer (struct __wprintf_buffer *, locale_t,
  75. const struct printf_info *,
  76. const void *const *) attribute_hidden;
  77. void __wprintf_fp_l_buffer (struct __wprintf_buffer *, locale_t,
  78. const struct printf_info *,
  79. const void *const *) attribute_hidden;
  80. # endif /* !_ISOMAC */
  81. #endif