xtutil.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* $Id$ */
  2. /*******************************************************************************/
  3. /* Copyright (c) 2001-2013 by Tensilica Inc. ALL RIGHTS RESERVED. */
  4. /* These coded instructions, statements, and computer programs are the */
  5. /* copyrighted works and confidential proprietary information of Tensilica Inc.*/
  6. /* They may not be modified, copied, reproduced, distributed, or disclosed to */
  7. /* third parties in any manner, medium, or form, in whole or in part, without */
  8. /* the prior written consent of Tensilica Inc. */
  9. /*******************************************************************************/
  10. #ifndef XTUTIL_H
  11. #define XTUTIL_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <stdarg.h>
  16. extern int xt_putchar(int c);
  17. extern int xt_puts(const char * s);
  18. extern void xt_putn(unsigned n);
  19. extern int xt_atoi(const char * s);
  20. extern int xt_printf(const char *fmt, ...);
  21. extern int xt_sprintf(char * buf, const char * fmt, ...);
  22. typedef int xt_output_fn(int *, int, const void *, int);
  23. extern xt_output_fn * xt_set_output_fn(xt_output_fn * fn);
  24. #ifdef XTUTIL_LIB
  25. // Only defined if building library
  26. typedef void (xt_outbuf_fn)(void *, char *, int);
  27. extern int xt_vprintf(xt_outbuf_fn * out, void * outarg, const char * fmt, va_list ap);
  28. #else
  29. // Only defined if building application and overriding
  30. #ifndef XTUTIL_NO_OVERRIDE
  31. #define putchar xt_putchar
  32. #define puts xt_puts
  33. #define putn xt_putn
  34. #define atoi xt_atoi
  35. #define printf xt_printf
  36. #define sprintf xt_sprintf
  37. #endif // XTUTIL_NO_OVERRIDE
  38. #endif // XTUTIL_LIB
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif // XTUTIL_H