SpM_Ordr::~SpM_Ordr() { dword i; for (i = 1; i <= size; i++) { kill_list(& rowordering[ (i) - 1]); kill_list(& colordering[ (i) - 1]); } kill_list(& freelist); }
void modified_input(void) { kill_list(gtd->ses->list[LIST_TABCYCLE]); if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYSEARCH)) { cursor_history_find(""); } if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYBROWSE)) { DEL_BIT(gtd->flags, TINTIN_FLAG_HISTORYBROWSE); } }
void SpM_Ordr::Clear(dword n) { dword i; for (i = 1; i <= size; i++) { kill_list(& rowordering[ (i) - 1]); kill_list(& colordering[ (i) - 1]); } kill_list(& freelist); // ----------- rowplacer = NULL; colplacer = NULL; freelist = NULL; size = n; rows .SetSize(Max(rows .GetSize(), (int)(n+BUG_EXTRA))); /* Dynamic Arrays */ cols .SetSize(Max(cols .GetSize(), (int)(n+BUG_EXTRA))); rowordering .SetSize(Max(rowordering .GetSize(), (int)(n+BUG_EXTRA))); colordering .SetSize(Max(colordering .GetSize(), (int)(n+BUG_EXTRA))); freelist = new SpM_Node; /* Never have to check if FreeList is empty */ freelist->next = NULL; freelist->prev = NULL; for (i = 1; i <= size; i++) { rows[ (i) - 1] = NULL; cols[ (i) - 1] = NULL; rowordering[ (i) - 1] = NULL; colordering[ (i) - 1] = NULL; } }
void cursor_show_completion(int input_now, int show_last_node) { struct listroot *root = gtd->ses->list[LIST_TABCYCLE]; struct listnode *node; if (!root->used) { return; } node = show_last_node ? root->list[root->used - 1] : root->list[0]; /* if (gtd->input_cur < gtd->input_len) { input_printf("\033[%dC", gtd->input_len - gtd->input_cur); } if (gtd->input_len > input_now) { input_printf("\033[%dD\033[%dP", gtd->input_len - input_now, gtd->input_len - input_now); } if (input_now + (int) strlen(node->left) < gtd->ses->cols - 2) { input_printf("%s", node->left); } */ strcpy(>d->input_buf[input_now], node->left); gtd->input_len = input_now + strlen(node->left); gtd->input_cur = gtd->input_len; gtd->input_pos = gtd->input_len; cursor_redraw_line(""); if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYSEARCH)) { cursor_history_find(""); } if (node == root->list[0]) { kill_list(gtd->ses->list[LIST_TABCYCLE]); } return; }
void read_line() { char buffer[STRING_SIZE]; struct listnode *node; struct listroot *root; int len, cnt, match; gtd->input_buf[gtd->input_len] = 0; len = read(0, buffer, 1); buffer[len] = 0; if (HAS_BIT(gtd->ses->flags, SES_FLAG_CONVERTMETA) || HAS_BIT(gtd->flags, TINTIN_FLAG_CONVERTMETACHAR)) { convert_meta(buffer, >d->macro_buf[strlen(gtd->macro_buf)]); } else { strcat(gtd->macro_buf, buffer); } if (!HAS_BIT(gtd->ses->flags, SES_FLAG_CONVERTMETA)) { match = 0; root = gtd->ses->list[LIST_MACRO]; for (root->update = 0; root->update < root->used; root->update++) { node = root->list[root->update]; if (!strcmp(gtd->macro_buf, node->pr)) { script_driver(gtd->ses, LIST_MACRO, node->right); gtd->macro_buf[0] = 0; return; } else if (!strncmp(gtd->macro_buf, node->pr, strlen(gtd->macro_buf))) { match = 1; } } for (cnt = 0; *cursor_table[cnt].fun != NULL; cnt++) { if (!strcmp(gtd->macro_buf, cursor_table[cnt].code)) { cursor_table[cnt].fun(""); gtd->macro_buf[0] = 0; return; } else if (!strncmp(gtd->macro_buf, cursor_table[cnt].code, strlen(gtd->macro_buf))) { match = 1; } } if (match) { return; } } if (gtd->macro_buf[0] == ESCAPE) { strcpy(buffer, gtd->macro_buf); convert_meta(buffer, gtd->macro_buf); } for (cnt = 0; gtd->macro_buf[cnt]; cnt++) { switch (gtd->macro_buf[cnt]) { case 10: cursor_enter(""); break; default: if (HAS_BIT(gtd->flags, TINTIN_FLAG_INSERTINPUT) && gtd->input_len != gtd->input_cur) { if (!HAS_BIT(gtd->ses->flags, SES_FLAG_UTF8) || (gtd->macro_buf[cnt] & 192) != 128) { cursor_delete(""); } } ins_sprintf(>d->input_buf[gtd->input_cur], "%c", gtd->macro_buf[cnt]); gtd->input_len++; gtd->input_cur++; if (!HAS_BIT(gtd->ses->flags, SES_FLAG_UTF8) || (gtd->macro_buf[cnt] & 192) != 128) { gtd->input_pos++; } if (gtd->input_len != gtd->input_cur) { if (HAS_BIT(gtd->ses->flags, SES_FLAG_UTF8) && (gtd->macro_buf[cnt] & 192) == 128) { input_printf("%c", gtd->macro_buf[cnt]); } else { input_printf("\033[1@%c", gtd->macro_buf[cnt]); } } else { input_printf("%c", gtd->macro_buf[cnt]); } gtd->macro_buf[0] = 0; gtd->input_tmp[0] = 0; gtd->input_buf[gtd->input_len] = 0; cursor_check_line_modified(""); DEL_BIT(gtd->flags, TINTIN_FLAG_HISTORYBROWSE); kill_list(gtd->ses->list[LIST_TABCYCLE]); if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYSEARCH)) { cursor_history_find(""); } break; } } }
void KillAll(int mode, char *arg) { int Show = 0; if ( arg && *arg != '0') { Show = 1; } GROUP_INDEX gind; // !!! delete groups here, GROUP should remove EVERY object in it, but later gind = GroupList.begin(); while ( gind != GroupList.end () ) { delete gind->second; gind ++; } GroupList.clear (); VAR_INDEX vind = VarList.begin(); while (vind != VarList.end() ) { delete vind->second; vind++; } VarList.clear (); HOTKEY_INDEX hind = HotkeyList.begin(); while ( hind != HotkeyList.end() ) { delete hind->second; hind++; } HotkeyList.clear (); GroupList[DEFAULT_GROUP_NAME] = new CGROUP(DEFAULT_GROUP_NAME); //vls-begin// script files SCRIPTFILE_INDEX sfind = ScriptFileList.begin(); while ( sfind != ScriptFileList.end() ) { delete (*sfind); sfind++; } ScriptFileList.clear(); //vls-end// switch (mode) { case CLEAN: kill_list(common_subs); common_subs=init_list(); kill_list(common_antisubs); common_antisubs=init_list(); /* CHANGED to kill path stuff as well */ kill_list(common_path); common_path=init_list(); kill_list(common_pathdirs); common_pathdirs=init_pathdir_list(); if ( Show ) tintin_puts2(rs::rs(1094)); acnum = subnum = hinum = antisubnum = 0; break; case END: kill_list(common_subs); kill_list(common_antisubs); kill_list(common_path); kill_list(common_pathdirs); break; } /* Switch */ }
static void apply_options(void) { char temp[BUFFER_SIZE], sname[BUFFER_SIZE]; char ustr[BUFFER_SIZE]; const char *home; FILE *f; # define DO_INPUT(str,iv) local_to_utf8(ustr, str, BUFFER_SIZE, 0);\ activesession=parse_input(str, iv, activesession); for (struct listnode *opt=options->next; opt; opt=opt->next) { switch (*opt->left) { case '#': *opt->left=tintin_char; activesession=parse_input(opt->left, true, activesession); break; case 'c': DO_INPUT(opt->right, false); break; case 'r': set_magic_hook(activesession); make_name(sname, opt->right); snprintf(temp, BUFFER_SIZE, "%crun %.*s {%s}", tintin_char, MAX_SESNAME_LENGTH, sname, opt->right); DO_INPUT(temp, true); break; case 's': set_magic_hook(activesession); make_name(sname, opt->right); snprintf(temp, BUFFER_SIZE, "%cses %.*s {%s %s}", tintin_char, MAX_SESNAME_LENGTH, sname, opt->right, opt->pr); DO_INPUT(temp, true); break; case 'S': set_magic_hook(activesession); make_name(sname, opt->right); snprintf(temp, BUFFER_SIZE, "%csslses %.*s {%s %s}", tintin_char, MAX_SESNAME_LENGTH, sname, opt->right, opt->pr); DO_INPUT(temp, true); break; case ' ': local_to_utf8(ustr, opt->right, BUFFER_SIZE, 0); if ((f=fopen(opt->right, "r"))) { if (activesession->verbose || !real_quiet) tintin_printf(0, "#READING {%s}", ustr); activesession = do_read(f, ustr, activesession); } else tintin_eprintf(0, "#FILE NOT FOUND: {%s}", ustr); break; case '-': if (!strcmp(DEFAULT_FILE_DIR, "HOME")) if ((home = getenv("HOME"))) strcpy(temp, home); else *temp = '\0'; else strcpy(temp, DEFAULT_FILE_DIR); strcat(temp, "/.tintinrc"); local_to_utf8(ustr, temp, BUFFER_SIZE, 0); if ((f=fopen(temp, "r"))) activesession = do_read(f, ustr, activesession); else if ((home = getenv("HOME"))) { strcpy(temp, home); strcat(temp, "/.tintinrc"); local_to_utf8(ustr, temp, BUFFER_SIZE, 0); if ((f=fopen(temp, "r"))) activesession = do_read(f, ustr, activesession); } } } kill_list(options); }