예제 #1
0
파일: main_loop.c 프로젝트: poiiii/vic
int main_loop()
{
    //This function assume the display back is disabled.
    int key_down = 0;
    while (1)
    {
#ifdef __VIC_POSIX
        key_down = getchar();
#endif

#ifdef __VIC_WIN
        key_down = __get_char_win();
//        key_down = getch();
#endif

        switch (mode_flag)
        {
            case NORMAL_MODE:
                normal_mode_process(key_down);
                break;

            case INSERT_MODE:
                insert_mode_process(key_down);
                break;

            case BOTTOMLINE_MODE:
                bottomline_mode_process(key_down);
                break;

            default:
                break;
        }
        parse_highlighting(cur_file);
        redraw_ui();
    }
    return 0;
}
예제 #2
0
파일: parser.c 프로젝트: rju/slp
int parse_listing() {
	int result = 0;
	if ((token = yylex()) == ID) {
		char* language = strduplicate(string);
		char* highlighting;
		char* caption;

		if ((token = yylex()) == LST_FRAME) { /* highlight rows in frame */
			highlighting = parse_highlighting();
			token = yylex();
		} else 
			highlighting = strduplicate("");
		switch (token) {
		case LST_SEPARATOR:
			caption = strduplicate(parse_label());
			result = parse_listing_text(language,caption,highlighting);
			free(caption);
			break;
		case NEWLINE:
			result = parse_listing_text(language,NULL,highlighting);
			break;
		default:
			fprintf(stderr, 
				"[%d] Listing mode: Separator '-' expected, found %s \"%s\" instead\n", 
				yylineno, get_token_name(token), yytext);
			result = 0;
			break;
		}
		free(highlighting);
		free(language);
	} else {
		fprintf(stderr, "[%d] Listing mode: Language name expected, but %s \"%s\"\n",
			yylineno, get_token_name(token), yytext);
		result = 0;
	}
	return result;
}