R_API RCons *r_cons_free () { I.refcnt--; if (I.refcnt != 0) return NULL; r_cons_pal_free (); if (I.line) { r_line_free (); I.line = NULL; } if (I.buffer) { free (I.buffer); I.buffer = NULL; } return NULL; }
R_API RCons *r_cons_free() { I.refcnt--; if (I.refcnt != 0) { return NULL; } r_cons_pal_free (); if (I.line) { r_line_free (); I.line = NULL; } if (I.buffer) { free (I.buffer); I.buffer = NULL; } R_FREE (I.break_word); r_stack_free (I.cons_stack); r_stack_free (I.break_stack); return NULL; }
R_API void r_cons_pal_init() { RCons *cons = r_cons_singleton (); memset (&cons->cpal, 0, sizeof (cons->cpal)); memset (&cons->pal, 0, sizeof (cons->pal)); cons->cpal.b0x00 = (RColor) RColor_GREEN; cons->cpal.b0x7f = (RColor) RColor_CYAN; cons->cpal.b0xff = (RColor) RColor_RED; cons->cpal.args = (RColor) RColor_YELLOW; cons->cpal.bin = (RColor) RColor_CYAN; cons->cpal.btext = (RColor) RColor_YELLOW; cons->cpal.call = (RColor) RColor_GREEN; cons->cpal.call.attr = R_CONS_ATTR_BOLD; cons->cpal.cjmp = (RColor) RColor_GREEN; cons->cpal.cmp = (RColor) RColor_CYAN; cons->cpal.comment = (RColor) RColor_RED; cons->cpal.usercomment = (RColor) RColor_WHITE; cons->cpal.creg = (RColor) RColor_CYAN; cons->cpal.flag = (RColor) RColor_CYAN; cons->cpal.fline = (RColor) RColor_CYAN; cons->cpal.floc = (RColor) RColor_CYAN; cons->cpal.flow = (RColor) RColor_CYAN; cons->cpal.flow2 = (RColor) RColor_BLUE; cons->cpal.fname = (RColor) RColor_RED; cons->cpal.help = (RColor) RColor_GREEN; cons->cpal.input = (RColor) RColor_WHITE; cons->cpal.invalid = (RColor) RColor_RED; cons->cpal.invalid.attr = R_CONS_ATTR_BOLD; cons->cpal.jmp = (RColor) RColor_GREEN; cons->cpal.label = (RColor) RColor_CYAN; cons->cpal.math = (RColor) RColor_YELLOW; cons->cpal.mov = (RColor) RColor_WHITE; cons->cpal.nop = (RColor) RColor_BLUE; cons->cpal.num = (RColor) RColor_YELLOW; cons->cpal.offset = (RColor) RColor_GREEN; cons->cpal.other = (RColor) RColor_WHITE; cons->cpal.pop = (RColor) RColor_MAGENTA; cons->cpal.pop.attr = R_CONS_ATTR_BOLD; cons->cpal.prompt = (RColor) RColor_YELLOW; cons->cpal.push = (RColor) RColor_MAGENTA; cons->cpal.crypto = (RColor) RColor_BGBLUE; cons->cpal.reg = (RColor) RColor_CYAN; cons->cpal.ret = (RColor) RColor_RED; cons->cpal.swi = (RColor) RColor_MAGENTA; cons->cpal.trap = (RColor) RColor_RED; cons->cpal.trap.attr = R_CONS_ATTR_BOLD; cons->cpal.ai_read = (RColor) RColor_GREEN; cons->cpal.ai_write = (RColor) RColor_BLUE; cons->cpal.ai_exec = (RColor) RColor_RED; cons->cpal.ai_seq = (RColor) RColor_MAGENTA; cons->cpal.ai_ascii = (RColor) RColor_YELLOW; cons->cpal.gui_cflow = (RColor) RColor_YELLOW; cons->cpal.gui_dataoffset = (RColor) RColor_YELLOW; cons->cpal.gui_background = (RColor) RColor_BLACK; cons->cpal.gui_alt_background = (RColor) RColor_WHITE; cons->cpal.gui_border = (RColor) RColor_BLACK; cons->cpal.wordhl = (RColor) RColor_BGRED; cons->cpal.linehl = (RColor) RCOLOR (ALPHA_BG, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00); cons->cpal.func_var = (RColor) RColor_WHITE; cons->cpal.func_var_type = (RColor) RColor_BLUE; cons->cpal.func_var_addr = (RColor) RColor_CYAN; cons->cpal.widget_bg = (RColor) RCOLOR (ALPHA_BG, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00); cons->cpal.widget_sel = (RColor) RColor_BGRED; cons->cpal.graph_box = (RColor) RColor_NULL; cons->cpal.graph_box2 = (RColor) RColor_BLUE; cons->cpal.graph_box3 = (RColor) RColor_MAGENTA; cons->cpal.graph_box4 = (RColor) RColor_GRAY; cons->cpal.graph_true = (RColor) RColor_GREEN; cons->cpal.graph_false = (RColor) RColor_RED; cons->cpal.graph_trufae = (RColor) RColor_BLUE; // single jump cons->cpal.graph_traced = (RColor) RColor_YELLOW; cons->cpal.graph_current = (RColor) RColor_BLUE; cons->pal.rainbow = NULL; cons->pal.rainbow_sz = 0; r_cons_pal_free (); cons->pal.reset = Color_RESET; // reset is not user accessible, const char* is ok r_cons_pal_update_event (); }
R_API void r_cons_pal_init (const char *foo) { RCons *cons = r_cons_singleton (); memset (&cons->pal, 0, sizeof (cons->pal)); cons->pal.b0x00 = Color_GREEN; cons->pal.b0x7f = Color_CYAN; cons->pal.b0xff = Color_RED; cons->pal.args = Color_YELLOW; cons->pal.bin = Color_CYAN; cons->pal.btext = Color_YELLOW; cons->pal.call = Color_BGREEN; cons->pal.cjmp = Color_GREEN; cons->pal.cmp = Color_CYAN; cons->pal.comment = Color_RED; cons->pal.creg = Color_CYAN; cons->pal.flag = Color_CYAN; cons->pal.fline = Color_CYAN; cons->pal.floc = Color_CYAN; cons->pal.flow = Color_CYAN; cons->pal.fname = Color_RED; cons->pal.help = Color_GREEN; cons->pal.input = Color_WHITE; cons->pal.invalid = Color_BRED; cons->pal.jmp = Color_GREEN; cons->pal.label = Color_CYAN; cons->pal.math = Color_YELLOW; cons->pal.mov = Color_WHITE; cons->pal.nop = Color_BLUE; cons->pal.num = Color_YELLOW; cons->pal.offset = Color_GREEN; cons->pal.other = Color_WHITE; cons->pal.pop = Color_BMAGENTA; cons->pal.prompt = Color_YELLOW; cons->pal.push = Color_MAGENTA; cons->pal.crypto = Color_BGBLUE; cons->pal.reg = Color_CYAN; cons->pal.reset = Color_RESET; cons->pal.ret = Color_RED; cons->pal.swi = Color_MAGENTA; cons->pal.trap = Color_BRED; cons->pal.ai_read = Color_GREEN; cons->pal.ai_write = Color_BLUE; cons->pal.ai_exec = Color_RED; cons->pal.ai_seq = Color_MAGENTA; cons->pal.ai_ascii = Color_YELLOW; cons->pal.gui_cflow = Color_YELLOW; cons->pal.gui_dataoffset = Color_YELLOW; cons->pal.gui_background = Color_BLACK; cons->pal.gui_alt_background = Color_WHITE; cons->pal.gui_border = Color_BLACK; cons->pal.graph_box = Color_RESET; cons->pal.graph_box2 = Color_BLUE; cons->pal.graph_box3 = Color_MAGENTA; cons->pal.graph_box4 = Color_GRAY; cons->pal.graph_true = Color_GREEN; cons->pal.graph_false = Color_RED; cons->pal.graph_trufae = Color_BLUE; // single jump cons->pal.graph_traced = Color_YELLOW; cons->pal.graph_current = Color_BLUE; r_cons_pal_free (); cons->pal.list[0] = strdup (Color_RED); cons->pal.list[1] = strdup (Color_YELLOW); cons->pal.list[2] = strdup (Color_BGREEN); cons->pal.list[3] = strdup (Color_CYAN); cons->pal.list[4] = strdup (Color_MAGENTA); cons->pal.list[5] = strdup (Color_GRAY); cons->pal.list[6] = strdup (Color_BLUE); cons->pal.list[7] = strdup (Color_GREEN); }