/
trilirium
/
Archived_BLC
Обзор
Документация
Войти
/
trilirium
/
Archived_BLC
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
viscript.cpp
1 487 строк
29 KB
Trilirium
repo created OK
22 янв 2026, 16:43
22 янв 2026, 16:43
f05d14b
Код
Авторство
О чём код?
/* + === - === - === - === - === - === - === - === | | viscript.cpp | | Source-level control commands parsing | + === - === - === - === - === - === - === - === */ #include "mem_mgr.h" #include "canvas.h" #include "widgets.h" #include "textform.h" #include <unistd.h> #include "parser.h" static void _text_free (char const *text) { delete [] text; } void (* RootWindow::def_free) (char const *text) = _text_free; struct SrcParser { unsigned lines; char *current; A_Console &logger; SrcParser (A_Console &_logger) : logger (_logger) { current = 0; lines = 0; } // SrcParser // (line is complete) virtual void line_ready (char *line) = 0; void add_line (char *line) { unsigned length = line ? strlen (line) : 0; if (length) { if (current) { unsigned p_length = strlen (current); char *buffer = new char [p_length + length + 1]; memcpy (buffer, current, p_length); memcpy (buffer + p_length, line, length); buffer [p_length + length] = '\0'; delete current; current = buffer; } else { current = new char [length + 1]; memcpy (current, line, length); current [length] = '\0'; } lines ++; } else { // (finale) if (current) line_ready (current); delete current; current = 0; } } // add_line void parse_source_file (char const *file, char const **ext_vec); }; // SrcParser #include "Container.h" struct SourceParse : LinesIterator { SrcParser &src_parser; // // constructor // SourceParse (A_Input &_source, unsigned capacity, SrcParser &_parser) : LinesIterator (_source, capacity), src_parser (_parser) {} // // -- redefine virtual // void line_ready (char *line_pointer, unsigned line_no) { src_parser. add_line (line_pointer); } }; // SourceParse void SrcParser::parse_source_file (char const *file, char const **ext_vec) { File_Input source (file, 0); if (source.open ()) { SourceParse parser (source, 256, *this); parser.engage (); source.close (); } else logger. out_label ("Can't read source:"). out_cstr (file). out_ch ('!'). out_nl (); } // SrcParser::parse_source_file struct LogParser : SrcParser { void line_ready (char *line) { logger. out_cstr (line). out_nl (); } }; // LogParser // // Source level command // struct Command_ { char const * name; // (name of command) char const * args_info; // (info about command) char const * description; // (command description) // // (constructor) // Command_ () { follow = 0; name = args_info = description = 0; } // Command_ // (simple text argument) static void argument_text (Prime_Parser &src_text, const char *_tag, char const * &var_text) { var_text = src_text.copy_text (_tag); } // argument_text // (Point argument) static void argument_point (Prime_Parser &src_point, Point &point) { point = src_point.parse_point (); } // argument_point // (Color argument) static void argument_color (Prime_Parser &src_color, Color &color) { color = src_color.parse_color (); } // argument_color // (Size/metric argument) static void argument_metric (Prime_Parser &src_metric, unsigned short &var_metric) { var_metric = src_metric.parse_length (); } // argument_metric // (Index argument) static void argument_index (Prime_Parser &src_index, unsigned &var_index) { var_index = src_index.arg_check ('&') ? src_index.parse_hex () : src_index.parse_decimal (); } // argument_index // (Style argument) static void argument_style (Prime_Parser &src_style, char op_char, unsigned &style_mask, unsigned (*style_map) (char ch)) { char style_ch = src_style.arg_head (); if (style_ch) { unsigned mask = style_map (style_ch) & 0xFFFF; if (mask) switch (op_char) { case '+': // (bits set) style_mask |= mask | (mask << A_FontDef::FS_SHIFT); return; case '-': // (bits clear) style_mask |= mask << A_FontDef::FS_SHIFT; return; case '~': // (bits invert) style_mask |= mask; return; } } } // argument_style // // Default virtuals // // (reset parameters to default) virtual void reset () {} // (handle short argument) virtual bool arg_short (Prime_Parser &option_short) { return false; } // (handle long argument) virtual bool arg_long (Prime_Parser &option_long) { return false; } // (finish command) virtual bool finish (RootWindow &window) { return true; } static Command_ *chain; // (start of chain) Command_ *follow; // (next in chain) // (Install command into chain) static void install (Command_ *command, char const *name, char const *args = 0, char const *descr = 0) { if (command) { command->name = name; command->args_info = args; command->description = descr; command->follow = chain; chain = command; } } // install // (Look for command in chain) static Command_ * lookup (char *name, unsigned length) { for (Command_ *command = chain; command; command = command->follow) if (strlen (command->name) == length && memcmp (command->name, name, length) == 0) return command; return 0; } // lookup // (Release all) static void release_all () { Command_ *command = chain, *next; while (command) { next = command->follow; delete command; command = next; } } // release_all }; // Command_ // Command chain Command_ * Command_::chain = 0; #define Expecting(Type,Ptr) (dynamic_cast <Type *> (Ptr)) // // Window attribute(s) command // // // Window title // struct Command_Title : Command_ { char const *title; void reset () { title = 0; } bool arg_long (Prime_Parser &option) { argument_text (option, "title_Window", title); return true; } // arg_long bool finish (RootWindow &window) { window.title = title; return true; } static void init () { install (new ("Command/Title") Command_Title, "Title", "=TitleText", "Set window caption to TitleText"); } }; // Command_Title // // Window area // struct Command_Area : Command_ { Rect area; void reset () { area.clear (); } // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, area.LeftTop); break; case '#': argument_point (option, area.RightBottom); break; default: return false; } return true; } // arg_short bool finish (RootWindow &window) { window.area = area; return true; } static void init () { install (new ("Command/Area") Command_Area, "Area", "@Origin #Extent", "Set window area to Origin#Extent"); } }; // Command_Area // // Window background color // struct Command_Color : Command_ { Color background; void reset () { background = 0; } // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '$': argument_color (option, background); break; default: return false; } return true; } // arg_short bool finish (RootWindow &window) { window.background = background; return true; } static void init () { install (new ("Command/Color") Command_Color, "Color", "$Background", "Set window background color to Background"); } }; // Command_Color // // Menu commands // struct Command_Menu : Command_ { enum { M_NONE, M_OPEN, M_CLOSE, M_ITEM, M_DIV } menu_type; char const *menu_label; unsigned menu_ID; MenuBuild *builder; Command_Menu () { menu_type = M_NONE; builder = 0; } void reset () { menu_type = M_NONE; menu_label = 0; menu_ID = 0; } // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '%': menu_type = M_ITEM; argument_index (option, menu_ID); break; case '-': case '|': menu_type = M_DIV; break; case '{': case '(': case '<': menu_type = M_OPEN; break; case '>': case ')': case '}': menu_type = M_CLOSE; break; default: return false; } return true; } // arg_short bool arg_long (Prime_Parser &option) { argument_text (option, "entry_Menu", menu_label); return true; } // arg_long bool finish (RootWindow &window) { if (! builder) builder = new ("MenuBuilder") MenuBuild (window); switch (menu_type) { case M_NONE: return false; case M_DIV: builder->menu_divider (); break; case M_ITEM: builder->menu_option (menu_ID, menu_label); break; case M_OPEN: builder->menu_open (menu_label); break; case M_CLOSE: builder->menu_close (); break; } menu_type = M_NONE; return true; } // finish // (default action) static void def_action (RootWindow *window, unsigned index) { window-> logger-> out_label ("Option:"). out_dec (index). out_nl (); } static void init () { install (new ("Command/Menu") Command_Menu, "Menu", "%Menu_ID =Entry", "Window menu: add item | add divider | open menu | close menu "); } }; // Command_Menu // // Alert message command // struct Command_Alert : Command_ { char const *title; char const *message; void reset () { title = message = 0; } bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '^': argument_text (option, "title_Alert", title); return true; } return false; } // arg_short bool arg_long (Prime_Parser &option) { argument_text (option, "message_Alert", message); return true; } // arg_long // (when done) bool finish (RootWindow &window) { window.add_widget (new ("Widget/Alert") W_Alert (message, title ? title : "- Alert -", 0)); return true; } static void init () { install (new ("Command/Alert") Command_Alert, "Alert", "^AlertTitle =AlertMessage", "Show alert box"); } }; // Command_Alert // // Font definition command // struct Command_FontDef : Command_ { char const *font_face; unsigned short font_size; Color font_color; unsigned font_style; void reset () { font_face = 0; // (no change) font_size = 0; // (no change) font_color = ~0; // (no change) font_style = 0; // (no change) } // reset // (map letter to font style) static unsigned style_flags (char style) { switch (style) { case 'b': case 'B': return A_FontDef:: FS_Bold; case 'i': case 'I': return A_FontDef:: FS_Italic; case 'u': case 'U': return A_FontDef:: FS_Under; case 'o': case 'O': return A_FontDef:: FS_Over; } // (default:) return 0; } // style_flags bool arg_short (Prime_Parser &option) { char opt_ch; switch (opt_ch = option.arg_head ()) { case '#': argument_metric (option, font_size); break; case '$': argument_color (option, font_color); break; case '+': case '-': case '~': argument_style (option, opt_ch, font_style, style_flags); break; default: return false; } return true; } // arg_short bool arg_long (Prime_Parser &option) { argument_text (option, "font_face", font_face); return true; } // arg_long // (when done) bool finish (RootWindow &window) { window.add_widget (new A_FontDef (font_face, font_size, font_color, font_style)); return true; } static void init () { install (new ("Command/FontDef") Command_FontDef, "Font", "#Size $Color [+-~]Style", "Define controls font"); } }; // Command_FontDef // // Frame command // struct Command_Frame : Command_ { char const *label; unsigned ID; Area area; void reset () { label = 0; ID = 0; area.clear (); } // reset // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; case '%': argument_index (option, ID); break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "title_Frame", label); return true; } // arg_long // (when done) bool finish (RootWindow &window) { A_Frame *frame = Controls::create_Frame (ID, label, area); window.add_widget (frame); return true; } // finish static void init () { install (new ("Command/Frame") Command_Frame, "Frame", "%Frame_ID @Origin #Extent =Title", "Create frame control"); } }; // Command_Frame // // Filler command // struct Command_Filler : Command_ { int style; Area area; void reset () { style = 0; area.clear (); } // reset // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; case '^': switch (option.arg_head ()) { case '-': style = -1; break; case '+': style = 1; break; case '*': case '.': style = 0; break; } break; default: return false; } return true; } // arg_short // (when done) bool finish (RootWindow &window) { A_Fill *filler = Controls::create_Filler (style, area); window.add_widget (filler); return true; } // finish static void init () { install (new ("Command/Filler") Command_Filler, "Filler", "@Origin #Extent ^Style", "Create fill control"); } }; // Command_Filler // // Label command // struct Command_Label : Command_ { char const *label; int align; unsigned ID; Area area; void reset () { label = 0; ID = 0; area.clear (); align = 0; } // reset // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; case '%': argument_index (option, ID); break; case '^': // (label alignment:) switch (option.arg_head ()) { case '-': case '<': align = -1; break; case '+': case '>': align = 1; break; case '*': align = 0; break; } break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "label_Text", label); return true; } // arg_long // (when done) bool finish (RootWindow &window) { window.add_widget (Controls::create_Label (ID, label, align, area)); return true; } // finish static void init () { install (new ("Command/Label") Command_Label, "Label", "%Label_ID @Origin #Extent ^HAlign =Label"); } }; // Command_Label // // Button command // struct Command_Button : Command_ { char const *label; unsigned ID; Area area; void reset () { label = 0; ID = 0; area.clear (); } // reset // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; case '%': argument_index (option, ID); break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "title_Button", label); return true; } // arg_long static void action_click (RootWindow &root, A_Button *self) { root.logger-> out_label ("Pressed:"). out_cstr (self->label). out_tab (). out_ch ('#'). out_dec (self->ID). out_nl (); } // action_click // (when done) bool finish (RootWindow &window) { A_Button *button = Controls::create_Button (ID, label, area); button->on_click = action_click; window.add_widget (button); return true; } // finish static void init () { install (new ("Command/Button") Command_Button, "Button", "%Button_ID @Origin #Extent =Label"); } }; // Command_Button struct Command_Check : Command_Button { static void action_check (RootWindow &root, A_Button *self) { root.logger-> out_label ("Checked:"). out_cstr (self->label). out_tab (). out_ch ('#'). out_dec (self->ID). out_cstr (self->get_check () ? "[+]" : "[-]"). out_nl (); } // action_check // (when done) bool finish (RootWindow &window) { A_Button *button = Controls::create_Check (ID, label, area); button->on_click = action_check; window.add_widget (button); return true; } // finish static void init () { install (new ("Command/Check") Command_Check, "Check", "%Check_ID @Origin #Extent =Label"); } }; // Command_Check struct Command_Radio : Command_Button { // (when done) bool finish (RootWindow &window) { A_Button *button = Controls::create_Radio (ID, label, area); button->on_click = Command_Check::action_click; window.add_widget (button); return true; } // finish static void init () { install (new ("Command/Radio") Command_Radio, "Radio", "%Radio_ID @Origin #Extent =Label"); } }; // Command_Radio // // Text editor command // struct Command_Editor : Command_ { unsigned ID; Area area; char const *content; // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '%': argument_index (option, ID); break; case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "title_Editor", content); return true; } // arg_long // (when done) bool finish (RootWindow &window) { A_Editor *editor = Controls::create_Editor (true, ID, content, area); window.add_widget (editor); return true; } static void init () { install (new ("Command/Editor") Command_Editor, "Editor", "%Editor_ID @Origin #Extent =Content"); } }; // Command_Editor // (text line editor) struct Command_Edliner : Command_Editor { bool finish (RootWindow &window) { A_Editor *edliner = Controls::create_Edliner (true, ID, content, area); window.add_widget (edliner); return true; } static void init () { install (new ("Command/Edliner") Command_Edliner, "Edliner", "%Editor_ID @Origin #Extent =Content"); } }; // Command_Edliner // // Item selector command // struct Command_Selector : Command_ { unsigned ID; Area area; char const *content; // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '%': argument_index (option, ID); break; case '@': argument_point (option, area.Origin); break; case '#': argument_point (option, area.Extent); break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "title_Selector", content); return true; } // arg_long // (when done) bool finish (RootWindow &window) { A_Selector *selector = Controls::create_Selector (ID, content, area, false); window.add_widget (selector); return true; } static void init () { install (new ("Command/Selector") Command_Selector, "Selector", "%Selector_ID @Origin #Extent =OptionList"); } }; // Command_Selector // (selector with editing) struct Command_Seledit : Command_Selector { bool finish (RootWindow &window) { A_Selector *selector = Controls::create_Selector (ID, content, area, true); window.add_widget (selector); return true; } static void init () { install (new ("Command/Seledit") Command_Seledit, "Seledit", "%Selector_ID @Origin #Extent =OptionList"); } }; // Command_Seledit // // Text box command // struct Command_TextBox : Command_ { Point origin, extent; Color color; char const * text_source; TFE_Term *text_content; unsigned flags; void reset () { origin.clear (); extent.clear (); color = 0xC0C0C0; flags = 0; text_source = 0; text_content = 0; } // reset // (short argument) bool arg_short (Prime_Parser &option) { switch (option.arg_head ()) { case '@': argument_point (option, origin); break; case '#': argument_point (option, extent); break; case '$': argument_color (option, color); break; case '?': flags |= W_TextBox::WTB_Dump; break; case '!': flags |= W_TextBox::WTB_Wrap; break; case '.': flags |= W_TextBox::WTB_Split; break; case '~': flags |= W_TextBox::WTB_Mouse; break; default: return false; } return true; } // arg_short // (long argument) bool arg_long (Prime_Parser &option) { argument_text (option, "text_box_source", text_source); return true; } // arg_long bool finish (RootWindow &window) { W_TextBox *text_box = new ("Widget/TextBox") W_TextBox (origin, extent, color, text_content, flags); window.add_widget (text_box); text_box->content = text_box->parse_source (*window.logger, text_source, 0); delete text_source; return true; } static void init () { install (new ("Command/TextBox") Command_TextBox, "TextBox", "@Origin #Extent $Background =TextContent"); } }; // Command_TextBox // // Nesting window sequences // struct Command_WinList : Command_ { Point origin; unsigned short flags; unsigned short inspace; int action; void reset () { action = 0; flags = WV_Off; inspace = 0; origin.clear (); } // (parse vector format) bool parse_vecform (char ch_head, Prime_Parser &option) { switch (ch_head) { case 'v': case 'V': // (vertical) flags = WV_Ver; break; case 'h': case 'H': // (horizontal) flags = WV_Hor; break; default: flags = WV_Off; return false; } argument_metric (option, inspace); while (ch_head = option.arg_head ()) { switch (ch_head) { case '<': flags &= ~ WV_Align; flags |= WV_Left; break; case '>': flags &= ~ WV_Align; flags |= WV_Right; break; case '*': flags |= WV_Center; break; case '[': flags |= WV_Before; break; case ']': flags |= WV_After; break; default: return true; } } // while (arg_head ()) return true; } // parse_vecform // (short argument) bool arg_short (Prime_Parser &option) { char ch_head; switch (ch_head = option.arg_head ()) { case '@': argument_point (option, origin); break; case '{': case '(': case '[': ++ action; break; case '}': case ')': case ']': -- action; break; default: return parse_vecform (ch_head, option); } return true; } // arg_short bool finish (RootWindow &window) { if (action > 0) { Widget_List * widgets = flags == WV_Off ? new ("Widget_List") Widget_List () : new ("Widget_Vector") Widget_Vector (flags, inspace); widgets->area_total.Origin = origin; window.open_list (widgets); } else if (action < 0) window.close_list (); return true; } // finish static void init () { install (new ("Command/WinList") Command_WinList, "WinList", "@Origin ([{ | }])"); } }; // Command_WinList // // Output info: parser attributes, with argument(s) // struct Command_Attr_List : Command_ { // (when done) bool finish (RootWindow &window) { A_Console &console = *window.logger; dump_attributes_list (console); return true; } // finish static void init () { install (new ("Command/Attr_List") Command_Attr_List, "List_Attr", "<>"); } }; // Command_Attr_List // // Output info: symbolic character(s) // struct Command_Char_List : Command_ { // (when done) bool finish (RootWindow &window) { A_Console &console = *window.logger; dump_characters_list (console); return true; } // finish static void init () { install (new ("Command/Char_List") Command_Char_List, "List_Char", "<>"); } }; // Command_Char_List // // Output info: named color(s) // struct Command_Color_List : Command_ { // (when done) bool finish (RootWindow &window) { A_Console &console = *window.logger; dump_colors_list (console); return true; } // finish static void init () { install (new ("Command/Color_List") Command_Color_List, "List_Color", "<>"); } }; // Command_Color_List // // General help on commands // struct Command_Help : Command_ { // (when done) bool finish (RootWindow &window) { A_Console &console = *window.logger; unsigned count = 0; for (Command_ *command = chain; command; command = command->follow) { console. out_qstr (command->name, '[', ']'). out_tab (). out_cstr (command->args_info). out_nl (); if (command->description) console. out_cstr (command->description). out_nl (); ++ count; } // for (command) console. out_label ("Commands defined:"). out_dec (count). out_nl (); return true; } // finish static void init () { install (new ("Command/Help") Command_Help, "Help", "<>"); } }; // Command_Help // // Null widget // struct Command_Null : Command_ { // (when done) bool finish (RootWindow &window) { window.add_widget (0); return true; } static void init () { install (new ("Command/Null") Command_Null, "~", ""); } }; // Command_Null // // // Actual command parser // // // Check for blank character: static bool cp_space (char ch) { return (ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r'); } // cp_space struct Parser_Commands : SrcParser { RootWindow &window; unsigned commands; bool debug_out; // // constructor // Parser_Commands (RootWindow &_window, bool debug) : window (_window), SrcParser (* _window.logger) { commands = 0; debug_out = debug; } // (Handle error) void command_error (char const *message, char const *cmd, unsigned cmd_len, Prime_Parser *argument = 0) { A_Console &logger = *window.logger; logger. out_label (message); if (cmd) { logger. out_text(cmd, cmd_len). out_label(':'); if (argument) { logger. out_ch ('{'); argument->dump (logger); logger. out_ch ('}'); } // (argument) } logger. out_nl (); } // command_error void line_ready (char *line) { if (debug_out) window.logger-> out_dec(commands). out_label (':'). out_cstr (line). out_nl (); // Empty or comment line ?? if (*line == '\0' || *line == '#') { ++ commands; return; } // Command : // skip start space while (*line && cp_space (*line)) line ++; char *ptr = line; // get command name while (*ptr && ! cp_space (*ptr)) ptr ++; if (ptr > line) { unsigned cmd_len = ptr - line; Command_ *command = Command_::lookup (line, cmd_len); char *eoc = ptr + strlen (ptr); if (command) { command->reset (); // parse command arguments char *short_arg, *long_arg = strchr (ptr, '='); if (long_arg) { short_arg = long_arg; while (cp_space (* ++ long_arg)); Prime_Parser opt_long (long_arg, eoc); if (! command->arg_long (opt_long)) command_error ("Invalid long argument", line, cmd_len, &opt_long); eoc = short_arg; } while (ptr != eoc) { while (ptr != eoc && cp_space (*ptr)) ++ ptr; short_arg = ptr; while (ptr != eoc && !cp_space (*ptr)) ++ ptr; if (ptr != short_arg) { Prime_Parser opt_short (short_arg, ptr); if (! command->arg_short (opt_short)) command_error ("Invalid short argument", line, cmd_len, &opt_short); } } // while (ptr) // (command complete) if (! command->finish (window)) command_error ("Incomplete command", line, cmd_len); } // (command found) else command_error ("Invalid command", line, cmd_len); } // (command not empty) ++ commands; } // line_ready // (done with parsing) void done () { window.logger-> out_label ("Total:"). out_cstr ("lines="). out_dec (lines). out_cstr (" / commands="). out_dec (commands). out_nl (); } // done }; // Parser_Commands // // Entry point // void init_commands () { Command_Null::init (); Command_Help::init (); Command_Attr_List::init (); Command_Char_List::init (); Command_Color_List::init (); Command_Button::init (); Command_Check::init (); Command_Radio::init (); Command_Filler::init (); Command_Frame::init (); Command_Label::init (); Command_Editor::init (); Command_Edliner::init (); Command_Selector::init (); Command_Seledit::init (); Command_TextBox::init (); Command_Menu::init (); Command_Alert::init (); Command_FontDef::init (); Command_WinList::init (); Command_Title::init (); Command_Area::init (); Command_Color::init (); } // init_commands static char const *parse_file = 0; static void parse_create_window (RootWindow &window) { bool debug_mode = false; if (*parse_file == '#') { ++ parse_file; debug_mode = true; } Parser_Commands file_parser (window, debug_mode); window.logger -> out_label ("Parsing source:"). out_qstr (parse_file, '"'). out_nl (); file_parser.parse_source_file (parse_file, 0); file_parser.done (); // (default menu action) window.on_action = Command_Menu::def_action; } // parse_create_window bool parse_source_file (A_Console &logger, char const *file) { if (* file) { parse_file = file; RootWindow::create_window (logger, 0, parse_create_window); parse_file = 0; } return true; } // parse_source_file void close_up () { // Free all commands Command_::release_all (); free_caches (); } // close_up