sdllog.inc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //since the array of const in delphi is not C compatible:
  2. {$IFDEF FPC}
  3. {**
  4. * \brief The maximum size of a log message
  5. *
  6. * Messages longer than the maximum size will be truncated
  7. *}
  8. const
  9. SDL_MAX_LOG_MESSAGE = 4096;
  10. {**
  11. * \brief The predefined log categories
  12. *
  13. * By default the application category is enabled at the INFO level,
  14. * the assert category is enabled at the WARN level, test is enabled
  15. * at the VERBOSE level and all other categories are enabled at the
  16. * CRITICAL level.
  17. *}
  18. type
  19. PPSDL_LogCategory = ^PSDL_LogCategory;
  20. PSDL_LogCategory = ^TSDL_LogCategory;
  21. TSDL_LogCategory = type cint;
  22. const
  23. SDL_LOG_CATEGORY_APPLICATION = TSDL_LogCategory(0);
  24. SDL_LOG_CATEGORY_ERROR = TSDL_LogCategory(1);
  25. SDL_LOG_CATEGORY_ASSERT = TSDL_LogCategory(2);
  26. SDL_LOG_CATEGORY_SYSTEM = TSDL_LogCategory(3);
  27. SDL_LOG_CATEGORY_AUDIO = TSDL_LogCategory(4);
  28. SDL_LOG_CATEGORY_VIDEO = TSDL_LogCategory(5);
  29. SDL_LOG_CATEGORY_RENDER = TSDL_LogCategory(6);
  30. SDL_LOG_CATEGORY_INPUT = TSDL_LogCategory(7);
  31. SDL_LOG_CATEGORY_TEST = TSDL_LogCategory(8);
  32. {* Reserved for future SDL library use *}
  33. SDL_LOG_CATEGORY_RESERVED1 = TSDL_LogCategory(9);
  34. SDL_LOG_CATEGORY_RESERVED2 = TSDL_LogCategory(10);
  35. SDL_LOG_CATEGORY_RESERVED3 = TSDL_LogCategory(11);
  36. SDL_LOG_CATEGORY_RESERVED4 = TSDL_LogCategory(12);
  37. SDL_LOG_CATEGORY_RESERVED5 = TSDL_LogCategory(13);
  38. SDL_LOG_CATEGORY_RESERVED6 = TSDL_LogCategory(14);
  39. SDL_LOG_CATEGORY_RESERVED7 = TSDL_LogCategory(15);
  40. SDL_LOG_CATEGORY_RESERVED8 = TSDL_LogCategory(16);
  41. SDL_LOG_CATEGORY_RESERVED9 = TSDL_LogCategory(17);
  42. SDL_LOG_CATEGORY_RESERVED10 = TSDL_LogCategory(18);
  43. {* Beyond this point is reserved for application use *}
  44. SDL_LOG_CATEGORY_CUSTOM = TSDL_LogCategory(19);
  45. {**
  46. * \brief The predefined log priorities
  47. *}
  48. type
  49. PPSDL_LogPriority = ^PSDL_LogPriority;
  50. PSDL_LogPriority = ^TSDL_LogPriority;
  51. TSDL_LogPriority = type cint32;
  52. const
  53. SDL_LOG_PRIORITY_VERBOSE = TSDL_LogPriority(1);
  54. SDL_LOG_PRIORITY_DEBUG = TSDL_LogPriority(2);
  55. SDL_LOG_PRIORITY_INFO = TSDL_LogPriority(3);
  56. SDL_LOG_PRIORITY_WARN = TSDL_LogPriority(4);
  57. SDL_LOG_PRIORITY_ERROR = TSDL_LogPriority(5);
  58. SDL_LOG_PRIORITY_CRITICAL = TSDL_LogPriority(6);
  59. SDL_NUM_LOG_PRIORITIES = TSDL_LogPriority(7);
  60. {**
  61. * \brief Set the priority of all log categories
  62. *}
  63. procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl;
  64. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetAllPriority' {$ENDIF} {$ENDIF};
  65. {**
  66. * \brief Set the priority of a particular log category
  67. *}
  68. procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl;
  69. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetPriority' {$ENDIF} {$ENDIF};
  70. {**
  71. * \brief Get the priority of a particular log category
  72. *}
  73. function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl;
  74. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetPriority' {$ENDIF} {$ENDIF};
  75. {**
  76. * \brief Reset all priorities to default.
  77. *
  78. * \note This is called in SDL_Quit().
  79. *}
  80. procedure SDL_LogResetPriorities(); cdecl;
  81. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogResetPriorities' {$ENDIF} {$ENDIF};
  82. {**
  83. * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
  84. *}
  85. procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl;
  86. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF};
  87. {**
  88. * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
  89. *}
  90. procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  91. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogVerbose' {$ENDIF} {$ENDIF};
  92. {**
  93. * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
  94. *}
  95. procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  96. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogDebug' {$ENDIF} {$ENDIF};
  97. {**
  98. * \brief Log a message with SDL_LOG_PRIORITY_INFO
  99. *}
  100. procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  101. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogInfo' {$ENDIF} {$ENDIF};
  102. {**
  103. * \brief Log a message with SDL_LOG_PRIORITY_WARN
  104. *}
  105. procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  106. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogWarn' {$ENDIF} {$ENDIF};
  107. {**
  108. * \brief Log a message with SDL_LOG_PRIORITY_ERROR
  109. *}
  110. procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  111. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogError' {$ENDIF} {$ENDIF};
  112. {**
  113. * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
  114. *}
  115. procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl;
  116. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogCritical' {$ENDIF} {$ENDIF};
  117. {**
  118. * \brief Log a message with the specified category and priority.
  119. *}
  120. procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl;
  121. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessage' {$ENDIF} {$ENDIF};
  122. {**
  123. * \brief Log a message with the specified category and priority.
  124. *}
  125. procedure SDL_LogMessageV(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl;
  126. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessageV' {$ENDIF} {$ENDIF};
  127. {**
  128. * \brief The prototype for the log output function
  129. *}
  130. type
  131. PPSDL_LogOutputFunction = ^PSDL_LogOutputFunction;
  132. PSDL_LogOutputFunction = ^TSDL_LogOutputFunction;
  133. TSDL_LogOutputFunction = procedure(
  134. userdata: Pointer;
  135. category: TSDL_LogCategory;
  136. priority: TSDL_LogPriority;
  137. const msg: PAnsiChar); cdecl;
  138. {**
  139. * \brief Get the current log output function.
  140. *}
  141. procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl;
  142. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF};
  143. {**
  144. * \brief This function allows you to replace the default log output
  145. * function with one of your own.
  146. *}
  147. procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl;
  148. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF};
  149. {$ENDIF}