io.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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) 2002-2019 986-Studio.
  7. *
  8. */
  9. #include <stdio.h>
  10. #include <stdarg.h>
  11. #include <os_dependent.h>
  12. char LevelChar[] = { 'E', 'W', 'A', 'N', 'V', 'D' };
  13. ConsoleLevel console_ActualLevel = Console_Default;
  14. /* Actually nothing to do */
  15. int console_init(ConsoleLevel DefaultLevel)
  16. {
  17. console_ActualLevel = DefaultLevel;
  18. return 0;
  19. }
  20. /* Actually a simple printf with levels */
  21. int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
  22. {
  23. if (console_ActualLevel >= level)
  24. {
  25. vprintf(format, ap);
  26. }
  27. return 0;
  28. }
  29. int console_printf(const ConsoleLevel level, const char *format, ...)
  30. {
  31. va_list ap;
  32. va_start(ap, format);
  33. console_vprintf(level, format, ap);
  34. va_end(ap);
  35. return 0;
  36. }
  37. int console_printf_d(const char *format, ...)
  38. {
  39. va_list ap;
  40. va_start(ap, format);
  41. console_vprintf(Console_Debug, format, ap);
  42. va_end(ap);
  43. return 0;
  44. }