Macros | |
#define | oslDebug(format...) ({ char __str2[1000], __str[1000]; sprintf(__str2, "Debug (%s:%i,%s)",__FUNCTION__,__LINE__,__FILE__); sprintf(__str , ##format); oslMessageBox(__str, __str2, oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_OK,OSL_KEY_TRIANGLE,OSL_MB_QUIT,0,0)); }) |
#define | oslMake3Buttons(b1, a1, b2, a2, b3, a3) ((b1)|((a1)<<5)|((b2)<<9)|((a2)<<14)|((b3)<<18)|((a3)<<23)) |
#define | oslWarning(format...) ({ char __str[1000]; sprintf(__str , ##format); oslMessageBox(__str, "Warning", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_OK,OSL_KEY_TRIANGLE,OSL_MB_QUIT,0,0)); }) |
#define | oslFatalError(format...) ({ char __str[1000]; sprintf(__str , ##format); oslMessageBox(__str, "Fatal error", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_QUIT,0,0,0,0)); }) |
#define | oslAssert(cond) ({ if (!(cond)) { char __str[1000]; sprintf(__str , "This program encountered a fatal error and must be terminated.\n\nFile : %s:%i\nError: %s",__FILE__,__LINE__,""#cond); oslMessageBox(__str, "Fatal error", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_QUIT,0,0,0,0)); } }) |
Enumerations | |
enum | OSL_MB_ACTIONS { OSL_MB_OK =1, OSL_MB_CANCEL, OSL_MB_YES, OSL_MB_NO, OSL_MB_QUIT } |
Functions | |
unsigned int | oslMessageBox (const char *text, const char *title, unsigned int flags) |
Message box functions in OSLib.
#define oslDebug | ( | format... | ) | ({ char __str2[1000], __str[1000]; sprintf(__str2, "Debug (%s:%i,%s)",__FUNCTION__,__LINE__,__FILE__); sprintf(__str , ##format); oslMessageBox(__str, __str2, oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_OK,OSL_KEY_TRIANGLE,OSL_MB_QUIT,0,0)); }) |
Displays a debug message, with the same format as printf. The title displays the file, the line number and the function from where it has been called. The following example displays 'var = 2' in a message box, where you can either continue execution (close the message box) either quit your application directly (press triangle):
#define oslMake3Buttons | ( | b1, | |
a1, | |||
b2, | |||
a2, | |||
b3, | |||
a3 | |||
) | ((b1)|((a1)<<5)|((b2)<<9)|((a2)<<14)|((b3)<<18)|((a3)<<23)) |
Creates a 32-bit integer to be used for the 'flags' parameter when calling oslMessageBox. There are 6 arguments, 2 per button. The first one of each pair represents the button assigned (one of the OSL_KEY_BITS values) and the second one represents the action (one of OSL_MB_ACTIONS values).
#define oslWarning | ( | format... | ) | ({ char __str[1000]; sprintf(__str , ##format); oslMessageBox(__str, "Warning", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_OK,OSL_KEY_TRIANGLE,OSL_MB_QUIT,0,0)); }) |
Same as oslDebug, except that it displays a warning message instead.
#define oslFatalError | ( | format... | ) | ({ char __str[1000]; sprintf(__str , ##format); oslMessageBox(__str, "Fatal error", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_QUIT,0,0,0,0)); }) |
Same as oslDebug, except that it displays a fatal error message instead. You cannot continue the execution from here, the only available choice is 'Quit', so you are sure this function is a dead end and no one will ever return from there.
#define oslAssert | ( | cond | ) | ({ if (!(cond)) { char __str[1000]; sprintf(__str , "This program encountered a fatal error and must be terminated.\n\nFile : %s:%i\nError: %s",__FILE__,__LINE__,""#cond); oslMessageBox(__str, "Fatal error", oslMake3Buttons(OSL_KEY_CROSS,OSL_MB_QUIT,0,0,0,0)); } }) |
Displays a fatal error message if the condition is not satisfied.
enum OSL_MB_ACTIONS |
unsigned int oslMessageBox | ( | const char * | text, |
const char * | title, | ||
unsigned int | flags | ||
) |
Displays a message box.
text | Text displayed inside of the message box. |
title | Title of the message box. |
flags | See oslMake3Buttons. |
There is a code sample with the oslMake3Buttons documentation.