25 #define DC_MAX_COMMANDS 300
60 #define DCF(function_name, help_text) \
61 void dcf_##function_name(); \
62 debug_command dcmd_##function_name(#function_name, help_text, dcf_##function_name); \
63 void dcf_##function_name()
71 #define DCF_BOOL(function_name, bool_variable) \
72 void dcf_##function_name(); \
73 debug_command dcmd_##function_name(#function_name, "Sets or toggles the boolean: "#bool_variable, dcf_##function_name ); \
74 void dcf_##function_name() { \
75 bool bool_tmp = bool_variable != 0; \
76 if (dc_optional_string_either("help", "--help")) { \
77 dc_printf( "Usage: %s [bool]\nSets %s to true or false. If nothing passed, then toggles it.\n", #function_name, #bool_variable ); \
80 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
81 dc_printf("%s = %s\n", #bool_variable, (bool_variable ? "TRUE" : "FALSE")); \
84 if (!dc_maybe_stuff_boolean(&bool_tmp)) { \
85 if (bool_variable != 0) \
95 dc_printf("%s set to %s\n", #bool_variable, (bool_variable != 0 ? "TRUE" : "FALSE")); \
105 #define DCF_BOOL2(function_name, bool_variable, short_help, long_help) \
106 void dcf_##function_name(); \
107 debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
108 void dcf_##function_name() { \
109 if (dc_optional_string_either("help", "--help")) { \
110 dc_printf( #long_help ); \
113 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
114 dc_printf("%s = %s\n", #function_name, (bool_variable ? "TRUE" : "FALSE")); \
117 if (!dc_maybe_stuff_boolean(&bool_variable)) { \
118 bool_variable = !bool_variable; \
129 #define DCF_FLOAT(function_name, float_variable, short_help) \
130 void dcf_##function_name(); \
131 debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
132 void dcf_##function_name() { \
134 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
135 dc_printf("%s = %f\n", #float_variable, float_variable); \
138 dc_stuff_float(&value); \
139 float_variable = value; \
140 dc_printf("%s set to %f\n", #float_variable, float_variable); \
152 #define DCF_FLOAT2(function_name, float_variable, lower_bounds, upper_bounds, short_help) \
153 void dcf_##function_name(); \
154 debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
155 void dcf_##function_name() { \
157 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
158 dc_printf("%s = %f\n", #float_variable, float_variable); \
161 dc_stuff_float(&value); \
162 CLAMP(float_variable, lower_bounds, upper_bounds); \
163 float_variable = value; \
164 dc_printf("%s set to %f\n", #float_variable, float_variable); \
174 #define DCF_INT(function_name, int_variable, short_help) \
175 void dcf_##function_name(); \
176 debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
177 void dcf_##function_name() { \
179 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
180 dc_printf("%s = %i\n", #int_variable, int_variable); \
183 dc_stuff_int(&value); \
184 int_variable = value; \
185 dc_printf("%s set to %i\n", #int_variable, int_variable); \
197 #define DCF_INT2(function_name, int_variable, lower_bounds, upper_bounds, short_help) \
198 void dcf_##function_name(); \
199 debug_command dcmd_##function_name(#function_name, short_help, dcf_##function_name ); \
200 void dcf_##function_name() { \
202 if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) { \
203 dc_printf("%s = %i\n", #int_variable, int_variable); \
206 dc_stuff_int(&value); \
207 CLAMP(int_variable, lower_bounds, upper_bounds); \
208 int_variable = value; \
209 dc_printf("%s set to %i\n", #int_variable, int_variable); \
250 return (strcmp(name, dcmd->
name) == 0);
GLenum GLsizei GLenum format
bool Dc_debug_on
Flag used to print console and command debugging strings.
SCP_string dc_command_str
Is progressively culled from the left as commands, arguments are parsed in DCF's. ...
const char * help
The short help string, as shown by 'help '.
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
Class to aggregate a debug command with its name (as shown in the console) and short help...
Predicate class used to search for a dcmd by name.
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
void debug_console(void(*func)(void)=NULL)
Opens and processes the debug console. (Blocking call)
is_dcmd(const char *_name)
bool operator()(debug_command *dcmd)
Parsing functions for the command line. Previously known as the command line scanner.
bool dc_pause_output(void)
Pauses the output of a command and allows user to scroll through the output history.
const char * name
The name of the command, as shown in the debug console.