void literal (void) { switch (prev_tok) { case ONE: /* printf ("literal() ONE\n"); */ black_box (ONE); eat (ONE); break; case ZERO: /* printf ("literal() ZERO\n"); */ black_box (ZERO); eat (ZERO); break; case EPSILON: /* printf ("literal() EPSILON\n"); */ black_box (EPSILON); eat (EPSILON); break; default: /* printf ("*** literal() General Error\n"); */ exit (0); break; } }
cell::ptr create_black_box(plasm::ptr plasm, int niter, const tendrils& p, const tendrils& i, const tendrils& o) { cell_<BlackBox>::ptr black_box(new cell_<BlackBox>); cell::ptr base(black_box); BlackBox::shallow_merge(p, base->parameters); BlackBox::shallow_merge(i, base->inputs); BlackBox::shallow_merge(o, base->outputs); base->configure(); //This causes the impl to be created black_box->impl->plasm_ = plasm; //initialize a few thangs black_box->impl->niter_ = niter; return black_box; }
/* Purpose: Render everything in the game that could appear on the screen Input : structs on screen, missiles, and explosions to update Returns: updates the frame buffer to represent new game state Assume : the game has one missile, one explosion, and all cities and the silo are already initialized */ void render_main(long int *base,struct city city1,struct city city2,struct city city3,struct city city4,struct city city5,struct city city6,struct missile_Silo silo, struct missile mis[],struct missile mis2[], struct explosion exp[],int mouseX,int mouseY) { render_city(base,city1); render_city(base,city2); render_city(base,city3); render_city(base,city4); render_city(base,city5); render_city(base,city6); render_silo(base,silo); black_box(base); render_missile(base,mis); render_missile(base,mis2); render_explosion(base,exp); render_Mouse(base,mouseX,mouseY); }
void expr (void) { int flag = 0; switch (prev_tok) { case LPAREN: /* printf ("expr() LPAREN expr RPAREN\n"); */ eat (LPAREN); sub_section_queue[queue_ptr].start_node = cur_sub_section.start_node; sub_section_queue[queue_ptr].end_node = cur_sub_section.end_node; queue_ptr++; sub_section_stack[stack_ptr].start_node = cur_sub_section.start_node; sub_section_stack[stack_ptr].end_node = 0; stack_ptr++; level++; expr (); expr (); break; case ONE: case ZERO: case EPSILON: /* printf ("expr() LITERAL (ONE or ZERO or EPSILON)\n"); */ if (cur_tok == PLUS) { /* printf ("expr() PLUS encountered!! (literal followed by +)\n"); */ literal(); if (sub_section_stack[stack_ptr-1].end_node == 0) { sub_section_stack[stack_ptr-1].end_node = node_num; } black_box (PLUS); eat (PLUS); expr(); /* must be followed by expr */ } else if (cur_tok == ASTERIX) { /* printf ("expr() ASTERIX encountered!! (literal followed by *)\n"); */ literal(); black_box (ASTERIX); eat (ASTERIX); /* * now what if all this is followed by a + ???? */ } else { literal(); } break; case PLUS: printf ("FATAL ERROR\n"); printf ("*** expr() Error not expecting PLUS\n"); exit (0); break; case ASTERIX: printf ("FATAL ERROR\n"); printf ("*** expr() Error not expecting ASTERIX\n"); exit (0); break; case RPAREN: if (level == 0) { printf ("FATAL ERROR\n"); printf ("*** expr() Error not expecting RPAREN\n"); exit (0); } else { /* printf ("expr() encountered ')', going up one level.\n"); */ if (cur_tok == PLUS) { /* printf ("expr() PLUS encountered!! (')' followed by +)\n"); */ if (sub_section_stack[stack_ptr-1].end_node == 0) { sub_section_stack[stack_ptr-1].end_node = node_num; } stack_ptr--; black_box (PLUS); eat (RPAREN); level--; eat (PLUS); queue_ptr--; expr(); /* must be followed by another expr */ } else if (cur_tok == ASTERIX) { /* printf ("expr() ASTERIX encountered!! (')' followed by *)\n"); */ level--; black_box (ASTERIX); eat (RPAREN); eat (ASTERIX); queue_ptr--; stack_ptr--; /* * now what if all this is followed by a + ???? */ } else { eat (RPAREN); level--; queue_ptr--; stack_ptr--; } } break; case 0: /* printf ("the end"); */ flag = 1; /* special trick */ break; case 32: eat (32); break; default: printf ("FATAL ERROR\n"); printf ("*** expr() Default error %d\n", prev_tok); exit (0); } if (((cur_tok != 0 && prev_tok != RPAREN) || (cur_tok == 0 && prev_tok != RPAREN)) && flag == 0) { /* printf ("expr() inside the SPECIAL PART\n"); */ expr(); } /* printf ("\t\t\t\t\tExiting expr()\n"); */ }