DEADSOFTWARE

sdl: fix build on linux
[d2df-sdl.git] / src / lib / sdl2 / sdlerror.inc
1 //from "sdl_error.h"
2 const
3 ERR_MAX_STRLEN = 128;
4 ERR_MAX_ARGS = 5;
6 {* Public functions *}
8 {* SDL_SetError() unconditionally returns -1. *}
9 function SDL_SetError(const fmt: PAnsiChar): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF} {$ENDIF};
10 function SDL_GetError: PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF};
11 procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF};
12 {*Internal error functions*}
13 {**
14 * Internal error functions
15 *
16 * Private error reporting function - used internally.
17 *}
19 {
20 #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
21 #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
22 #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
23 }
24 type
25 TSDL_ErrorCode = (SDL_ENOMEM,
26 SDL_EFREAD,
27 SDL_EFWRITE,
28 SDL_EFSEEK,
29 SDL_UNSUPPORTED,
30 SDL_LASTERROR);
32 TSDL_Error = record
33 {* This is a numeric value corresponding to the current error *}
34 error: SInt32;
36 {* This is a key used to index into a language hashtable containing
37 internationalized versions of the SDL error messages. If the key
38 is not in the hashtable, or no hashtable is available, the key is
39 used directly as an error message format string.
40 *}
41 key: String[ERR_MAX_STRLEN];
43 {* These are the arguments for the error functions *}
44 argc: SInt32;
45 case SInt32 of
46 {* What is a character anyway? (UNICODE issues) *}
47 0: (value_c: Byte;);
48 1: (value_ptr: Pointer;);
49 2: (value_i: SInt32;);
50 3: (value_f: Double;);
51 4: (buf: String[ERR_MAX_STRLEN];);
52 end;
54 {* SDL_Error() unconditionally returns -1. *}
55 function SDL_Error(code: TSDL_ErrorCode): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Error' {$ENDIF} {$ENDIF};