1 
2 //          Copyright Michael D. Parker 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.sdl.bind.sdllog;
8 
9 import core.stdc.stdarg : va_list;
10 import bindbc.sdl.config;
11 
12 enum SDL_MAX_LOG_MESSAGE = 4096;
13 
14 enum {
15     SDL_LOG_CATEGORY_APPLICATION,
16     SDL_LOG_CATEGORY_ERROR,
17     SDL_LOG_CATEGORY_ASSERT,
18     SDL_LOG_CATEGORY_SYSTEM,
19     SDL_LOG_CATEGORY_AUDIO,
20     SDL_LOG_CATEGORY_VIDEO,
21     SDL_LOG_CATEGORY_RENDER,
22     SDL_LOG_CATEGORY_INPUT,
23     SDL_LOG_CATEGORY_TEST,
24 
25     SDL_LOG_CATEGORY_RESERVED1,
26     SDL_LOG_CATEGORY_RESERVED2,
27     SDL_LOG_CATEGORY_RESERVED3,
28     SDL_LOG_CATEGORY_RESERVED4,
29     SDL_LOG_CATEGORY_RESERVED5,
30     SDL_LOG_CATEGORY_RESERVED6,
31     SDL_LOG_CATEGORY_RESERVED7,
32     SDL_LOG_CATEGORY_RESERVED8,
33     SDL_LOG_CATEGORY_RESERVED9,
34     SDL_LOG_CATEGORY_RESERVED10,
35 
36     SDL_LOG_CATEGORY_CUSTOM
37 }
38 
39 enum SDL_LogPriority {
40     SDL_LOG_PRIORITY_VERBOSE = 1,
41     SDL_LOG_PRIORITY_DEBUG,
42     SDL_LOG_PRIORITY_INFO,
43     SDL_LOG_PRIORITY_WARN,
44     SDL_LOG_PRIORITY_ERROR,
45     SDL_LOG_PRIORITY_CRITICAL,
46     SDL_NUM_LOG_PRIORITIES
47 }
48 mixin(expandEnum!SDL_LogPriority);
49 
50 extern(C) nothrow alias SDL_LogOutputFunction = void function(void*, int, SDL_LogPriority, const(char)*);
51 
52 version(BindSDL_Static) {
53     extern(C) @nogc nothrow {
54         void SDL_LogSetAllPriority(SDL_LogPriority);
55         void SDL_LogSetPriority(int,SDL_LogPriority);
56         SDL_LogPriority SDL_LogGetPriority(int);
57         void SDL_LogResetPriorities();
58         void SDL_Log(const(char)*,...);
59         void SDL_LogVerbose(int,const(char)*,...);
60         void SDL_LogDebug(int,const(char)*,...);
61         void SDL_LogInfo(int,const(char)*,...);
62         void SDL_LogWarn(int,const(char)*,...);
63         void SDL_LogError(int,const(char)*,...);
64         void SDL_LogCritical(int,const(char)*,...);
65         void SDL_LogMessage(int,SDL_LogPriority,const(char)*,...);
66         void SDL_LogMessageV(int,SDL_LogPriority,const(char)*,va_list);
67         void SDL_LogGetOutputFunction(SDL_LogOutputFunction,void**);
68         void SDL_LogSetOutputFunction(SDL_LogOutputFunction,void*);
69     }
70 }
71 else {
72     extern(C) @nogc nothrow {
73         alias pSDL_LogSetAllPriority = void function(SDL_LogPriority);
74         alias pSDL_LogSetPriority = void function(int,SDL_LogPriority);
75         alias pSDL_LogGetPriority = SDL_LogPriority function(int);
76         alias pSDL_LogResetPriorities = void function();
77         alias pSDL_Log = void function(const(char)*,...);
78         alias pSDL_LogVerbose = void function(int,const(char)*,...);
79         alias pSDL_LogDebug = void function(int,const(char)*,...);
80         alias pSDL_LogInfo = void function(int,const(char)*,...);
81         alias pSDL_LogWarn = void function(int,const(char)*,...);
82         alias pSDL_LogError = void function(int,const(char)*,...);
83         alias pSDL_LogCritical = void function(int,const(char)*,...);
84         alias pSDL_LogMessage = void function(int,SDL_LogPriority,const(char)*,...);
85         alias pSDL_LogMessageV = void function(int,SDL_LogPriority,const(char)*,va_list);
86         alias pSDL_LogGetOutputFunction = void function(SDL_LogOutputFunction,void**);
87         alias pSDL_LogSetOutputFunction = void function(SDL_LogOutputFunction,void*);
88     }
89 
90     __gshared {
91         pSDL_LogSetAllPriority SDL_LogSetAllPriority;
92         pSDL_LogSetPriority SDL_LogSetPriority;
93         pSDL_LogGetPriority SDL_LogGetPriority;
94         pSDL_LogResetPriorities SDL_LogResetPriorities;
95         pSDL_Log SDL_Log;
96         pSDL_LogVerbose SDL_LogVerbose;
97         pSDL_LogDebug SDL_LogDebug;
98         pSDL_LogInfo SDL_LogInfo;
99         pSDL_LogWarn SDL_LogWarn;
100         pSDL_LogError SDL_LogError;
101         pSDL_LogCritical SDL_LogCritical;
102         pSDL_LogMessage SDL_LogMessage;
103         pSDL_LogMessageV SDL_LogMessageV;
104         pSDL_LogGetOutputFunction SDL_LogGetOutputFunction;
105         pSDL_LogSetOutputFunction SDL_LogSetOutputFunction;
106     }
107 }