stdio.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* stdio.h */
  2. /*
  3. * Copyright (c) 2014 Wind River Systems, Inc.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. */
  7. #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_
  8. #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_
  9. #include <toolchain.h>
  10. #include <stdarg.h> /* Needed to get definition of va_list */
  11. #include <bits/restrict.h>
  12. #include <stddef.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #if !defined(__FILE_defined)
  17. #define __FILE_defined
  18. typedef int FILE;
  19. #endif
  20. #if !defined(EOF)
  21. #define EOF (-1)
  22. #endif
  23. #define stdin ((FILE *) 1)
  24. #define stdout ((FILE *) 2)
  25. #define stderr ((FILE *) 3)
  26. int __printf_like(1, 2) printf(const char *_MLIBC_RESTRICT format, ...);
  27. int __printf_like(3, 4) snprintf(char *_MLIBC_RESTRICT str, size_t len,
  28. const char *_MLIBC_RESTRICT format, ...);
  29. int __printf_like(2, 3) sprintf(char *_MLIBC_RESTRICT str,
  30. const char *_MLIBC_RESTRICT format, ...);
  31. int __printf_like(2, 3) fprintf(FILE * _MLIBC_RESTRICT stream,
  32. const char *_MLIBC_RESTRICT format, ...);
  33. int __printf_like(1, 0) vprintf(const char *_MLIBC_RESTRICT format, va_list list);
  34. int __printf_like(3, 0) vsnprintf(char *_MLIBC_RESTRICT str, size_t len,
  35. const char *_MLIBC_RESTRICT format,
  36. va_list list);
  37. int __printf_like(2, 0) vsprintf(char *_MLIBC_RESTRICT str,
  38. const char *_MLIBC_RESTRICT format, va_list list);
  39. int __printf_like(2, 0) vfprintf(FILE * _MLIBC_RESTRICT stream,
  40. const char *_MLIBC_RESTRICT format,
  41. va_list ap);
  42. int puts(const char *s);
  43. int fputc(int c, FILE *stream);
  44. int fputs(const char *_MLIBC_RESTRICT s, FILE *_MLIBC_RESTRICT stream);
  45. size_t fwrite(const void *_MLIBC_RESTRICT ptr, size_t size, size_t nitems,
  46. FILE *_MLIBC_RESTRICT stream);
  47. static inline int putc(int c, FILE *stream)
  48. {
  49. return fputc(c, stream);
  50. }
  51. static inline int putchar(int c)
  52. {
  53. return putc(c, stdout);
  54. }
  55. int sscanf(const char *str, const char *format, ...);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDIO_H_ */