ai_msg.h
1 /*
2  * Arnold API header file
3  * Copyright (c) 1998-2009 Marcos Fajardo, (c) 2009-2013 Solid Angle SL
4  */
5 
11 #pragma once
12 #include "ai_types.h"
13 #include "ai_api.h"
14 
18 #if !defined(__AI_FILE__)
19 #define __AI_FILE__ __FILE__
20 #endif
21 #if !defined(__AI_LINE__)
22 #define __AI_LINE__ __LINE__
23 #endif
24 #if !defined(__AI_FUNCTION__)
25 #define __AI_FUNCTION__ __FUNCTION__
26 #endif
27 
31 #define AI_SEVERITY_INFO 0x00
32 #define AI_SEVERITY_WARNING 0x01
33 #define AI_SEVERITY_ERROR 0x02
34 #define AI_SEVERITY_FATAL 0x03
35 /*\}*/
36 
41 #define AI_LOG_NONE 0x0000
42 #define AI_LOG_INFO 0x0001
43 #define AI_LOG_WARNINGS 0x0002
44 #define AI_LOG_ERRORS 0x0004
45 #define AI_LOG_DEBUG 0x0008
46 #define AI_LOG_STATS 0x0010
47 #define AI_LOG_ASS_PARSE 0x0020
48 #define AI_LOG_PLUGINS 0x0040
49 #define AI_LOG_PROGRESS 0x0080
50 #define AI_LOG_NAN 0x0100
51 #define AI_LOG_TIMESTAMP 0x0200
52 #define AI_LOG_BACKTRACE 0x0400
53 #define AI_LOG_MEMORY 0x0800
54 #define AI_LOG_COLOR 0x1000
55 #define AI_LOG_SSS 0x2000
57 #define AI_LOG_ALL \
58  ( AI_LOG_INFO | AI_LOG_WARNINGS | AI_LOG_ERRORS | \
59  AI_LOG_DEBUG | AI_LOG_STATS | AI_LOG_PLUGINS | \
60  AI_LOG_PROGRESS | AI_LOG_NAN | AI_LOG_ASS_PARSE | \
61  AI_LOG_TIMESTAMP | AI_LOG_BACKTRACE | AI_LOG_MEMORY | \
62  AI_LOG_COLOR | AI_LOG_SSS)
63 /*\}*/
64 
65 #ifndef AI_PRINTF_ARGS
66 # ifdef __GNUC__
67  // Enable printf-like warnings with gcc by attaching
68  // AI_PRINTF_ARGS to printf-like functions. Eg:
69  //
70  // void foo (const char* fmt, ...) AI_PRINTF_ARGS(1,2);
71  //
72  // The arguments specify the positions of the format string and the the
73  // beginning of the varargs parameter list respectively.
74 # define AI_PRINTF_ARGS(fmtarg_pos, vararg_pos) __attribute__ ((format (printf, fmtarg_pos, vararg_pos) ))
75 # else
76 # define AI_PRINTF_ARGS(fmtarg_pos, vararg_pos)
77 # endif
78 #endif
79 
81 typedef void (*AtMsgCallBack)(int logmask, int severity, const char* msg_string, int tabs);
82 
83 AI_API void AiMsgSetLogFileName(const char* filename);
84 AI_API void AiMsgSetLogFileFlags(int flags);
85 AI_API void AiMsgSetConsoleFlags(int flags);
86 AI_API void AiMsgSetMaxWarnings(int max_warnings);
87 AI_API void AiMsgSetCallback(AtMsgCallBack func);
88 AI_API void AiMsgResetCallback();
89 
90 AI_API void AiMsgInfo(const char* format, ...) AI_PRINTF_ARGS(1,2);
91 AI_API void AiMsgDebug(const char* format, ...) AI_PRINTF_ARGS(1,2);
92 AI_API void AiMsgWarning(const char* format, ...) AI_PRINTF_ARGS(1,2);
93 AI_API void AiMsgError(const char* format, ...) AI_PRINTF_ARGS(1,2);
94 AI_API void AiMsgFatal(const char* format, ...) AI_PRINTF_ARGS(1,2);
95 AI_API void AiMsgTab(int tabinc);
96 
99 
100 /*\}*/

© 2009-2013 Solid Angle SL · all rights reserved · www.solidangle.com