73 #define SCROLL_X_MAX (DBCOLS - DCOLS)
74 #define SCROLL_Y_MAX (DBROWS - DROWS)
142 if (cmd_str->empty()) {
152 if (
stricmp(dc_commands[i]->
name, command.c_str()) == 0) {
157 if (i == dc_commands_size) {
158 dc_printf(
"Command not found: '%s'\n", command.c_str());
163 dc_commands[
i]->
func();
166 dc_printf(
"Require string(s) not found: \n");
181 dc_printf(
"Ignoring the unused command line tail '%s'\n", command.c_str() );
221 SCP_string::iterator str_it;
224 cmd_lines = (out_str.size() /
DCOLS) + 1;
226 buffer_lines =
DROWS - cmd_lines;
228 buffer_lines =
DROWS;
237 if (dc_buffer.size() >= buffer_lines) {
244 for (i = 0; i < buffer_lines; ++
i) {
255 for (str_it = out_str.begin(); str_it < out_str.end(); ++str_it) {
256 if (j == (
DCOLS - 1)) {
258 str_it = out_str.insert(str_it,
'\n');
292 dc_history.push_back(
"");
293 last_oldcommand = dc_history.begin();
297 dc_buffer.push_back(
"");
308 dc_printf(
"More to follow. Press any key to continue. ESC halts output...");
362 SCP_string::iterator tmp_it;
364 va_start(args, format);
368 for (tmp_it = tmp.begin(); tmp_it != tmp.end(); ++tmp_it) {
388 temp_str = *line_str;
389 temp_str.push_back(c);
397 *line_str = temp_str;
412 temp_str = *line_str;
413 temp_str.append(i,
' ');
421 *line_str = temp_str;
436 if (line_str->size() >
DBCOLS) {
439 dc_buffer.push_back(
"");
445 while (dc_buffer.size() >
DBROWS) {
446 dc_buffer.pop_front();
455 temp_str = *line_str;
456 temp_str.push_back(c);
469 dc_buffer.push_back(temp_str);
470 line_str = &dc_buffer.back();
476 while (dc_buffer.size() >
DBROWS) {
477 dc_buffer.pop_front();
482 line_str->push_back(c);
487 line_str->push_back(c);
492 return (strcmp(first->
name, second->
name) < 0);
529 if (last_oldcommand < (dc_history.end() - 1)) {
537 if (last_oldcommand > dc_history.begin()) {
560 last_oldcommand = dc_history.begin();
579 last_oldcommand = dc_history.begin();
581 while (dc_history.size() >
DCMDS) {
582 dc_history.pop_back();
void gr_rect(int x, int y, int w, int h, int resize_mode)
GLenum GLsizei GLenum format
void dc_draw_cursor(SCP_string &cmd_string, int x, int y)
GLfloat GLfloat GLfloat GLfloat h
void dc_putc(char c)
Stuffs the given character into the output buffer.
SCP_deque< SCP_string >::iterator last_oldcommand
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
bool dcmd_less(debug_command *first, debug_command *second)
Predicate function used to sort debug_commands.
void gr_set_color_fast(color *dst)
Class thrown when a required token is not found.
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
int key_to_ascii(int keycode)
void debug_console(void(*_func)(void))
Opens and processes the debug console. (Blocking call)
#define CLAMP(x, min, max)
void dc_init(void)
Initializes the debug console.
void vsprintf(SCP_string &dest, const char *format, va_list ap)
Maximum number of dc_token elements. Primarily used as an end value in loops.
void dc_do_command(SCP_string *cmd_str)
Process the entered command string.
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
Class to aggregate a debug command with its name (as shown in the console) and short help...
bool dc_maybe_stuff_string(char *out_str, size_t maxlen)
Tries to stuff a string to out_str from the command line, stopping at the end of the command line...
GLint GLint GLint GLint GLint x
void(* func)()
Pointer to the function that to run when this command is evoked.
SCP_vector< SCP_string > expected_tokens
Class thrown when an expected string was not found. Can/should contain all of the expected strings...
SCP_string dc_command_buf
GLuint const GLchar * name
void dc_stuff_string_white(char *out_str, size_t maxlen)
Stuffs a whitespace delimited string to out_str from the command line, stopping at the end of the com...
ubyte DTABS
Tab size in spaces.
fix timer_get_fixed_seconds()
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
debug_command * dc_commands[DC_MAX_COMMANDS]
void dc_parse_init(SCP_string &str)
Initializes the DC command line parser.
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
SCP_string dc_command_str
Is progressively culled from the left as commands, arguments are parsed in DCF's. ...
bool Dc_debug_on
Flag used to print console and command debugging strings.
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
void dc_draw(bool show_prompt)
Draws the in-game console.
SCP_deque< SCP_string > dc_history
bool dc_pause_output(void)
Pauses the output of a command and allows user to scroll through the output history.
void gr_set_font(int fontnum)
SCP_deque< SCP_string > dc_buffer
void dc_draw_window(bool show_prompt)
const char * name
The name of the command, as shown in the debug console.