Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
Archivo: parser.c Proyecto: 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;
}