⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.c

📁 aee是一种易使用的文本编辑器。你可以不用说明书来使用它。它提供终端接口和本地的X-windows接口。它的特性包括即弹的菜单
💻 C
📖 第 1 页 / 共 4 页
字号:
	ctr[26] = fn_MENU_str; 	/* control [ */	ctr[27] = ""; 		/* control \\ */	ctr[28] = ""; 		/* control ] */	ctr[29] = ""; 		/* control ^ */	ctr[30] = ""; 		/* control _ */	ctr[31] = fn_BCK_str;	/* control ?*/	/* delete key	*/	g_ctr[0] = fn_MC_str;		/* gold control a */	g_ctr[1] = fn_APPEND_str;	/* gold control b */	g_ctr[2] = fn_CL_str;		/* gold control c */	g_ctr[3] = fn_PREFIX_str;	/* gold control c */	g_ctr[4] = "";			/* gold control e */	g_ctr[5] = fn_PSRCH_str;	/* gold control f */	g_ctr[6] = fn_GOLD_str;		/* gold control g */	g_ctr[7] = "";			/* gold control h */	g_ctr[8] = "";			/* gold control i */	g_ctr[9] = "";			/* gold control j */	g_ctr[10] = fn_UDC_str;		/* gold control k */	g_ctr[11] = fn_UDL_str;		/* gold control l */	g_ctr[12] = ""; 		/* gold control m */	g_ctr[13] = fn_NB_str;		/* gold control n */	g_ctr[14] = ""; 		/* gold control o */	g_ctr[15] = fn_PB_str;		/* gold control p */	g_ctr[16] = "";			/* gold control q */	g_ctr[17] = fn_REV_str;		/* gold control r */	g_ctr[18] = "";			/* gold control s */	g_ctr[19] = "";			/* gold control t */	g_ctr[20] = "";			/* gold control u */	g_ctr[21] = fn_FWD_str;		/* gold control v */	g_ctr[22] = fn_UDW_str;		/* gold control w */	g_ctr[23] = fn_FORMAT_str;	/* gold control x */	g_ctr[24] = fn_PW_str;		/* gold control y */	g_ctr[25] = fn_PRP_str;		/* gold control z */	g_ctr[26] = ""; 		/* control [ */	g_ctr[27] = ""; 		/* control \\ */	g_ctr[28] = ""; 		/* control ] */	g_ctr[29] = ""; 		/* control ^ */	g_ctr[30] = ""; 		/* control _ */	g_ctr[31] = ""; 		/* control ? */	f[0] = "";		f[1] = fn_GOLD_str;	f[2] = fn_UDC_str;	f[3] = fn_DW_str;	f[4] = fn_AW_str;	f[5] = fn_SRCH_str;	f[6] = fn_MARK_str;	f[7] = fn_CUT_str;	f[8] = fn_AL_str;	g_f[0] = "";	g_f[1] = fn_GOLD_str;	g_f[2] = fn_UDL_str;	g_f[3] = fn_UDW_str;	g_f[4] = fn_BOL_str;	g_f[5] = fn_PSRCH_str;	g_f[6] = fn_COPY_str;	g_f[7] = fn_PST_str;	g_f[8] = fn_CMD_str;	for (counter = 0; counter < 9; counter++)	{		g_f_changed[counter] = FALSE;		f_changed[counter] = FALSE;	}	counter = 9;	while (counter < 64)	{		f[counter] = "";		g_f[counter] = "";		g_f_changed[counter] = FALSE;		f_changed[counter] = FALSE;		counter++;	}	keypads[0] = "";	keypads[1] = "";	keypads[2] = "";	keypads[3] = "";	keypads[4] = "";	g_keypads[0] = "";	g_keypads[1] = "";	g_keypads[2] = "";	g_keypads[3] = "";	g_keypads[4] = "";	for (counter = 0; counter < 32; counter++)	{		g_ctr_changed[counter] = FALSE;		ctr_changed[counter] = FALSE;	}}void parse(string)		/* parse commands in string		*/char *string;{	char *temp;	char dir;	int valid_flag; /* try to keep GOLD from being executed within multiple definition	*/	int delim;	/* delimiter for inserting a string	*/	temp = string;	if ((*temp == ' ') || (*temp == '\t'))		temp = next_word(temp);	valid_flag = FALSE;	while (*temp != (char) NULL)	{		if ((!compare(temp, fn_GOLD_str, FALSE)) && (!valid_flag))			valid_flag = TRUE;		if (compare(temp, fn_DL_str, FALSE))			del_line(TRUE);		else if (compare(temp, fn_DC_str, FALSE))			del_char(TRUE);		else if (compare(temp, fn_CL_str, FALSE))			Clear_line(TRUE);		else if (compare(temp, fn_NP_str, FALSE))		{			next_page();		}		else if (compare(temp, fn_PP_str, FALSE))		{			prev_page();		}		else if (compare(temp, fn_NB_str, FALSE))		{			if (curr_buff->next_buff == NULL)				t_buff = first_buff;			else				t_buff = curr_buff->next_buff;			chng_buf(t_buff->name);		}		else if (compare(temp, fn_PB_str, FALSE))		{			t_buff = first_buff;			while ((t_buff->next_buff != curr_buff) && (t_buff->next_buff != NULL))				t_buff = t_buff->next_buff;			chng_buf(t_buff->name);		}		else if (compare(temp, fn_UDL_str, FALSE))			undel_line();		else if (compare(temp, fn_UDC_str, FALSE))			undel_char();		else if (compare(temp, fn_DW_str, FALSE))			del_word(TRUE);		else if (compare(temp, fn_UDW_str, FALSE))			undel_word();		else if (compare(temp, fn_UND_str, FALSE))			undel_last();		else if (compare(temp, fn_EOL_str, FALSE))			eol();		else if (compare(temp, fn_BOL_str, FALSE))			bol();		else if (compare(temp, fn_BOT_str, FALSE))			top();		else if (compare(temp, fn_EOT_str, FALSE))			bottom();		else if (compare(temp, fn_FORMAT_str,  FALSE))			Format();		else if ((compare(temp, fn_GOLD_str, FALSE)) && (!valid_flag) && (*(next_word(temp)) == (char) NULL))			gold_func();		else if (compare(temp, fn_MARGINS_str, FALSE))			observ_margins = TRUE;		else if (compare(temp, fn_NOMARGINS_str, FALSE))			observ_margins = FALSE;		else if (compare(temp, fn_IL_str, FALSE))		{			insert_line(TRUE);			if (curr_buff->position != 1)				bol();			left(TRUE);		}		else if (compare(temp, fn_PRP_str, FALSE))			repl_prompt(TRUE);		else if (compare(temp, fn_RP_str, FALSE))			replace();		else if (compare(temp, fn_MC_str, FALSE))			match();		else if (compare(temp, fn_PSRCH_str, FALSE))			search_prompt(TRUE);		else if (compare(temp, fn_SRCH_str, FALSE))			value = search(TRUE, curr_buff->curr_line, curr_buff->position, curr_buff->pointer, 0, FALSE, TRUE);		else if (compare(temp, fn_AL_str, FALSE))			adv_line();		else if (compare(temp, fn_AW_str, FALSE))			adv_word();		else if (compare(temp, fn_AC_str, FALSE))			ascii();		else if (compare(temp, fn_PW_str, FALSE))			prev_word();		else if (compare(temp, fn_CUT_str, FALSE))			cut();		else if (compare(temp, fn_FWD_str, FALSE))		{			forward = TRUE;			wmove(com_win, 0,0);			wclrtoeol(com_win);			wprintw(com_win, fwd_mode_str);			wrefresh(com_win);			clr_cmd_line = TRUE;		}		else if (compare(temp, fn_REV_str, FALSE))		{			forward = FALSE;			wmove(com_win, 0,0);			wclrtoeol(com_win);			wprintw(com_win, rev_mode_str);			wrefresh(com_win);			clr_cmd_line = TRUE;		}		else if (compare(temp, fn_MARK_str, FALSE))			slct(Mark);		else if (compare(temp, fn_UNMARK_str, FALSE))			unmark_text();		else if (compare(temp, fn_APPEND_str, FALSE))			slct(Append);		else if (compare(temp, fn_PREFIX_str, FALSE))			slct(Prefix);		else if (compare(temp, fn_COPY_str, FALSE))		{			copy();		}		else if (compare(temp, fn_CMD_str, FALSE))		{			command_prompt();		}		else if (compare(temp, fn_PST_str, FALSE))			paste();		else if (compare(temp, fn_RD_str, FALSE))		{			clearok(curr_buff->win, TRUE);			redraw();		}		else if (compare(temp, fn_UP_str,  FALSE))			up();		else if (compare(temp, fn_DOWN_str,  FALSE))			down();		else if (compare(temp, fn_LEFT_str,  FALSE))			left(TRUE);		else if (compare(temp, fn_RIGHT_str,  FALSE))			right(TRUE);		else if (compare(temp, fn_BCK_str,  FALSE))		{			if (overstrike)			{				if (curr_buff->position > 1)				{					if ((!observ_margins) || 					    ((observ_margins) && 					    (curr_buff->scr_pos > left_margin)))					{						left(TRUE);						/*						 |	save the deleted character 						 */						if (in == 8)							d_char = *curr_buff->pointer;						insert(' ');						left(TRUE);						last_deleted(CHAR_BACKSPACE, 1, &d_char);					}				}				/*				 |	if at begin of line, do nothing				 */			}			else			{				if (delete(TRUE))					last_deleted(CHAR_BACKSPACE, 1, &d_char);			}		}		else if (compare(temp, fn_CR_str,  FALSE))			insert_line(TRUE);		else if (compare(temp, fn_EXPAND_str,  FALSE))			expand = TRUE;		else if (compare(temp, fn_NOEXPAND_str,  FALSE))			expand = FALSE;		else if (compare(temp, fn_EXIT_str,  FALSE))			finish(temp);		else if (compare(temp, fn_QUIT_str,  FALSE))			quit(temp);		else if (compare(temp, fn_LITERAL_str,  FALSE))			literal = TRUE;		else if (compare(temp, fn_NOLITERAL_str,  FALSE))			literal = FALSE;		else if (compare(temp, fn_STATUS_str,  FALSE))			status_line = TRUE;		else if (compare(temp, fn_NOSTATUS_str,  FALSE))			status_line = FALSE;		else if (compare(temp, fn_INDENT_str,  FALSE))			indent = TRUE;		else if (compare(temp, fn_NOINDENT_str,  FALSE))			indent = FALSE;		else if (compare(temp, fn_OVERSTRIKE_str,  FALSE))			overstrike = TRUE;		else if (compare(temp, fn_NOOVERSTRIKE_str,  FALSE))			overstrike = FALSE;		else if (compare(temp, fn_CASE_str,  FALSE))			case_sen = TRUE;		else if (compare(temp, fn_NOCASE_str,  FALSE))			case_sen = FALSE;		else if (compare(temp, fn_WINDOWS_str,  FALSE))			make_win();		else if (compare(temp, fn_NOWINDOWS_str,  FALSE))			no_windows();		else if (compare(temp, fn_HELP_str,  FALSE))			help();		else if ((*temp == '+') || (*temp == '-'))		{			if (*temp == '+')				dir = 'd';			else				dir = 'u';			temp++;			if ((*temp == ' ') || (*temp == '\t'))				temp = next_word(temp);			value = 0;			while ((*temp >='0') && (*temp <= '9'))			{				value = value * 10 + (*temp - '0');				temp++;			}			move_rel(&dir, value);			if (!status_line)			{				clr_cmd_line = TRUE;				werase(com_win);				wmove(com_win, 0,0);				wprintw(com_win, line_num_str, curr_buff->curr_line->line_number);				wrefresh(com_win);			}		}		else if ( ! (((*temp >= 'a') && (*temp <= 'z')) || 			     ((*temp >= 'A') && (*temp <= 'Z')) || 			     ((*temp >= '0') && (*temp <= '9'))) )		{			delim = *temp;			temp++;			while ((*temp != delim) && (*temp != (char) NULL))			{				insert(*temp);				temp++;			}		}		else if (compare(temp, fn_MENU_str,  FALSE))			menu_op(main_menu);		else		{			wmove(com_win,0,0);			wclrtoeol(com_win);			wprintw(com_win, unkn_syntax_msg, temp);			wrefresh(com_win);			clr_cmd_line = TRUE;		}		temp = next_word(temp);	}}intrestrict_mode(){	if (!restricted)		return(FALSE);	wmove(com_win, 0, 0);	wprintw(com_win, restricted_msg);	wclrtoeol(com_win);	wrefresh(com_win);	clr_cmd_line = TRUE;	return(TRUE);}/* |	Save current configuration to .init.ee file in the current directory. */void dump_aee_conf()	{	FILE *init_file;	FILE *old_init_file = NULL;	char *file_name = ".init.ae";	char *home_dir =  "~/.init.ae";	char buffer[512];	struct stat buf;	char *string;	int length;	int counter;	int option = 0;	struct tab_stops *stack_point;	if (restrict_mode())	{		return;	}	option = menu_op(config_dump_menu);	werase(com_win);	wmove(com_win, 0, 0);	if (option == 0)	{		wprintw(com_win, conf_not_saved_msg);		wrefresh(com_win);		return;	}	else if (option == 2)		file_name = resolve_name(home_dir);	/*	 |	If a .init.ae file exists, move it to .init.ae.old.	 */	if (stat(file_name, &buf) != -1)	{		sprintf(buffer, "%s.old", file_name);		unlink(buffer);		link(file_name, buffer);		unlink(file_name);		old_init_file = fopen(buffer, "r");	}	init_file = fopen(file_name, "w");	if (init_file == NULL)	{		wprintw(com_win, conf_dump_err_msg);		wrefresh(com_win);		return;	}	if (old_init_file != NULL)	{		/*		 |	Copy non-configuration info into new .init.ae file.		 */		while ((string = fgets(buffer, 512, old_init_file)) != NULL)		{			length = strlen(string);			string[length - 1] = (char) NULL;			if (unique_test(string, init_strings) == 1)			{				if (compare(string, ECHO_str, FALSE))				{					fprintf(init_file, "%s\n", string);				}			}			else				fprintf(init_file, "%s\n", string);		}		fclose(old_init_file);	}	fprintf(init_file, "%s\n", case_sen ? CASE_str : NOCASE_str);	fprintf(init_file, "%s\n", expand ? EXPAND_str : NOEXPAND_str);	fprintf(init_file, "%s\n", info_window ? INFO_str : NOINFO_str );	fprintf(init_file, "%s\n", observ_margins ? MARGINS_str : NOMARGINS_str );	fprintf(init_file, "%s\n", auto_format ? AUTOFORMAT_str : NOAUTOFORMAT_str );	fprintf(init_file, "%s %s\n", PRINTCOMMAND_str, print_command);	fprintf(init_file, "%s %d\n", RIGHTMARGIN_str, right_margin);	fprintf(init_file, "%s %d\n", LEFTMARGIN_str, left_margin);	fprintf(init_file, "%s\n", nohighlight ? NOHIGHLIGHT_str : HIGHLIGHT_str );	fprintf(init_file, "%s\n", eightbit ? EIGHT_str : NOEIGHT_str );	fprintf(init_file, "%s\n", literal ? LITERAL_str : NOLITERAL_str );	fprintf(init_file, "%s\n", observ_margins ? MARGINS_str : NOMARGINS_str );	fprintf(init_file, "%s\n", status_line ? STATUS_str : NOSTATUS_str );	fprintf(init_file, "%s\n", indent ? INDENT_str : NOINDENT_str );	fprintf(init_file, "%s\n", overstrike ? OVERSTRIKE_str : NOOVERSTRIKE_str );	fprintf(init_file, "%s\n", windows ? WINDOWS_str : NOWINDOWS_str );	fprintf(init_file, "%s\n", text_only ? text_cmd : binary_cmd );	if (info_win_height != INFO_WIN_HEIGHT_DEF)	{		fprintf(init_file, "%s %d\n", info_win_height_cmd_str, (info_win_height - 1));	}	for (counter = 0; counter < 64; counter++)	{		if (f_changed[counter])			fprintf(init_file, "%s f%d %s\n", DEFINE_str, counter, f[counter]);	}	for (counter = 0; counter < 64; counter++)	{		if (g_f_changed[counter])			fprintf(init_file, "%s %s f%d %s\n", DEFINE_str, GOLD_str, counter, g_f[counter]);	}	for (counter = 0; counter < 32; counter++)	{		if (ctr_changed[counter])			fprintf(init_file, "%s %s %s\n", DEFINE_str, ctrl_table[counter + 1], ctr[counter]);	}	for (counter = 0; counter < 32; counter++)	{		if (g_ctr_changed[counter])			fprintf(init_file, "%s %s %s %s\n", DEFINE_str, GOLD_str, ctrl_table[counter + 1], g_ctr[counter]);	}	if (tabs->next_stop != NULL)	{		stack_point = tabs->next_stop;		fprintf(init_file, "%s ", TABS_str);		while (stack_point != NULL)		{			fprintf(init_file, " %d", stack_point->column);			stack_point = stack_point->next_stop;		}		fprintf(init_file, "\n");	}	if (tab_spacing != 8)	{		fprintf(init_file, "%s %d\n", SPACING_str, tab_spacing);	}	fclose(init_file);	wprintw(com_win, conf_dump_success_msg, file_name);	wrefresh(com_win);	if ((option == 2) && (file_name != home_dir))	{		free(file_name);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -