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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _GPXE_VSPRINTF_H
  2. #define _GPXE_VSPRINTF_H
  3. /** @file
  4. *
  5. * printf() and friends
  6. *
  7. * Etherboot's printf() functions understand the following subset of
  8. * the standard C printf()'s format specifiers:
  9. *
  10. * - Flag characters
  11. * - '#' - Alternate form (i.e. "0x" prefix)
  12. * - '0' - Zero-pad
  13. * - Field widths
  14. * - Length modifiers
  15. * - 'hh' - Signed / unsigned char
  16. * - 'h' - Signed / unsigned short
  17. * - 'l' - Signed / unsigned long
  18. * - 'll' - Signed / unsigned long long
  19. * - 'z' - Signed / unsigned size_t
  20. * - Conversion specifiers
  21. * - 'd' - Signed decimal
  22. * - 'x','X' - Unsigned hexadecimal
  23. * - 'c' - Character
  24. * - 's' - String
  25. * - 'p' - Pointer
  26. *
  27. * Hexadecimal numbers are always zero-padded to the specified field
  28. * width (if any); decimal numbers are always space-padded. Decimal
  29. * long longs are not supported.
  30. *
  31. */
  32. #include <stdint.h>
  33. #include <stdarg.h>
  34. #include <stdio.h>
  35. /**
  36. * A printf context
  37. *
  38. * Contexts are used in order to be able to share code between
  39. * vprintf() and vsnprintf(), without requiring the allocation of a
  40. * buffer for vprintf().
  41. */
  42. struct printf_context {
  43. /**
  44. * Character handler
  45. *
  46. * @v ctx Context
  47. * @v c Character
  48. *
  49. * This method is called for each character written to the
  50. * formatted string.
  51. */
  52. void ( * handler ) ( struct printf_context *ctx, unsigned int c );
  53. /** Length of formatted string
  54. *
  55. * When handler() is called, @len will be set to the number of
  56. * characters written so far (i.e. zero for the first call to
  57. * handler()).
  58. */
  59. size_t len;
  60. };
  61. extern size_t vcprintf ( struct printf_context *ctx, const char *fmt,
  62. va_list args );
  63. extern int vssnprintf ( char *buf, ssize_t ssize, const char *fmt,
  64. va_list args );
  65. extern int __attribute__ (( format ( printf, 3, 4 ) ))
  66. ssnprintf ( char *buf, ssize_t ssize, const char *fmt, ... );
  67. #endif /* _GPXE_VSPRINTF_H */