int main() { int init=0,n_inputs=3; int arr[4][3]={{1,2,3},{1,1,3},{3,2,3},{3,3,3}},temp[50],expr_len,lex_type; char expr[50]; while(1) { take_expr(expr); lex_type=change_expr_type(expr,n_inputs,temp); expr_len=strlen(expr); if(match(init,arr,temp,n_inputs,expr_len)) { printf("ACCEPTED\t"); if(lex_type==1) printf("Type: Identifier\n"); else if(lex_type==2) printf("Type: Number\n"); } else printf("INVALID\n"); check_escape(); } return 0; }
static void console_putc(char c) { if (check_escape(c)) return; switch (c) { case '\n': new_line(); return; case '\r': pos_x = 0; return; case '\b': if (pos_x == 0) return; pos_x--; return; } vram[pos_y * cols + pos_x] = c | (attrib << 8); pos_x++; if (pos_x >= cols) { pos_x = 0; pos_y++; if (pos_y >= rows) { pos_y = rows - 1; scroll_up(); } } }
int main(void) { bool b_done=false; bool done=false; srand(time(NULL)); initXWindows(); init_opengl(); //declare game object Game game; game.n=0; //declare a box shape game.box[0].width = BOX_WIDTH; game.box[0].height = BOX_HEIGHT; game.box[0].center.x = WINDOW_WIDTH/7; game.box[0].center.y = WINDOW_HEIGHT - WINDOW_HEIGHT/7; game.box[1].width = BOX_WIDTH; game.box[1].height = BOX_HEIGHT; game.box[1].center.x = 2*WINDOW_WIDTH/7; game.box[1].center.y = WINDOW_HEIGHT - 2*(WINDOW_HEIGHT/7); game.box[2].width = BOX_WIDTH; game.box[2].height = BOX_HEIGHT; game.box[2].center.x = 3*WINDOW_WIDTH/7; game.box[2].center.y = WINDOW_HEIGHT - 3*(WINDOW_HEIGHT/7); game.box[3].width = BOX_WIDTH; game.box[3].height = BOX_HEIGHT; game.box[3].center.x = 4*WINDOW_WIDTH/7; game.box[3].center.y = WINDOW_HEIGHT - 4*(WINDOW_HEIGHT/7); game.box[4].width = BOX_WIDTH; game.box[4].height = BOX_HEIGHT; game.box[4].center.x = 5*WINDOW_WIDTH/7; game.box[4].center.y = WINDOW_HEIGHT - 5*(WINDOW_HEIGHT/7); game.circle.radius = CIRCLE_RADIUS; game.circle.center.x = WINDOW_WIDTH; game.circle.center.y = -80; while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); b_done = check_b(&e); if (b_done){ break; } } //start animation while(!done) { while(XPending(dpy)) { XEvent e; XNextEvent(dpy, &e); done = check_escape(&e); } doMakeParticles(&game); movement(&game); render(&game); glXSwapBuffers(dpy, win); } cleanupXWindows(); return 0; }