void Init(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmdShow) { if (!hPrevInstance) // if no prev instance, this is first InitFirst(hInstance); else // this is not first instance InitAdded(hPrevInstance); InitEvery(hInstance, cmdShow); // init for all instances } // end of Init()
void InitFiFo(firstnode* FirstSet,firstnode* FollowSet,string filename,sets* x,charset* NotEnd) //First集、Follow集初始化 { charset* nt=NotEnd->next; firstnode* ft=FirstSet; while(nt) { firstnode* ff=new firstnode; charset* ch=new charset; ch->c='@'; ch->next=NULL; ff->cur=nt->c; ff->cs=ch; ff->next=NULL; ft->next=ff; ft=ft->next; nt=nt->next; } InitFirst(FirstSet,filename); charset* se=NotEnd->next; while(se) { addFirstSet(se->c,CreateFirst(se->c,FirstSet,x,NotEnd),FirstSet); se=se->next; } nt=NotEnd->next; ft=FollowSet; while(nt) { firstnode* ff=new firstnode; charset* ch=new charset; ch->c='@'; ch->next=NULL; ff->cur=nt->c; ff->cs=ch; ff->next=NULL; ft->next=ff; ft=ft->next; nt=nt->next; } ft=FollowSet->next; charset* ch=new charset; ch->c='#'; ch->next=NULL; ft->cs->next=ch; se=NotEnd->next; while(se) { openVisitAll(x); addFirstSet(se->c,CreateFollow(se->c,FollowSet,FirstSet,x,NotEnd),FollowSet); se=se->next; } }