io.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * IO Manager - The peTI-NESulator Project
  3. * os/macos/graphics.c
  4. *
  5. * Created by Manoël Trapier on 04/01/09.
  6. * Copyright (c) 2003-2009 986 Corp. All rights reserved.
  7. *
  8. * $LastChangedDate$
  9. * $Author$
  10. * $HeadURL$
  11. * $Revision$
  12. *
  13. */
  14. #include <stdio.h>
  15. #include <stdarg.h>
  16. #include <os_dependent.h>
  17. char LevelChar[] = { 'E', 'W', 'A', 'N', 'V', 'D'};
  18. ConsoleLevel console_ActualLevel = Console_Default;
  19. /* Actually nothing to do */
  20. int console_init(ConsoleLevel DefaultLevel)
  21. {
  22. console_ActualLevel = DefaultLevel;
  23. return 0;
  24. }
  25. /* Actually a simple printf with levels */
  26. int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
  27. {
  28. if (console_ActualLevel >= level)
  29. vprintf(format, ap);
  30. return 0;
  31. }
  32. int console_printf(const ConsoleLevel level, const char *format, ...)
  33. {
  34. int ret = 0;
  35. va_list ap;
  36. va_start(ap, format);
  37. ret = console_vprintf(level, format, ap);
  38. va_end(ap);
  39. return ret;
  40. }
  41. int console_printf_d(const char *format, ...)
  42. {
  43. va_list ap;
  44. va_start(ap, format);
  45. console_vprintf (Console_Debug, format, ap);
  46. return 0;
  47. }