#include <stdio.h>
#include "LabelDict.hpp"
#include "FSM.hpp"
#include "Load.hpp"
Go to the source code of this file.
|
Definition at line 684 of file FSM.cpp. 00686 { 00687 StateEqualPair *nextpair; 00688 00689 if((nextstate1==NULL)||(nextstate2==NULL)) 00690 return; 00691 00692 unsigned sid1=nextstate1->GetStateID(); 00693 unsigned sid2=nextstate2->GetStateID(); 00694 if(sid1==sid2) 00695 return; 00696 00697 nextpair= (sid2<sid1) ? (array[sid1]+sid2) : (array[sid2]+sid1); 00698 00699 if((nextpair->dependlist==NULL)|| 00700 (nextpair->dependlist->statepair!=curpair)) 00701 // We only insert if 'curpair' is not already at the beginning of the list 00702 nextpair->dependlist=new StateEqualPairListItem(curpair,nextpair->dependlist); 00703 } |
|
Definition at line 346 of file FSM.cpp. Referenced by CreateStateSet().
00353 { 00354 // Check if the state is already in the set 00355 // In this case, we don't have to do anything 00356 if(IsInStateSet(set,state)) 00357 return set; 00358 00359 set=new FSMStateSetItem(state,set); 00360 00361 // We also add the states that are reachable by empty paths 00362 00363 FSMEdge *outedges=state->GetOutEdges(); 00364 while(outedges!=NULL) 00365 { 00366 if(outedges->GetType()==EDGETYPE_EMPTY) 00367 set=AddToStateSet(set,outedges->GetNextState()); 00368 outedges=outedges->next; 00369 } 00370 return set; 00371 } |
|
Definition at line 659 of file FSM.cpp. 00663 { 00664 if(nextstate1!=NULL) 00665 { 00666 if(nextstate2==NULL) // 'curlabel' is accepted in one state, but not 00667 // in the other ? ==> states are not equal ! 00668 return 0; 00669 00670 unsigned sid1=nextstate1->GetStateID(); 00671 unsigned sid2=nextstate2->GetStateID(); 00672 if(sid1==sid2) 00673 return 1; // Are the two states identical? 00674 00675 if(sid2<sid1) 00676 return !(array[sid1][sid2].isnotequal); 00677 else 00678 return !(array[sid2][sid1].isnotequal); 00679 } 00680 else 00681 return nextstate2==NULL; 00682 } |
|
Definition at line 398 of file FSM.cpp. Referenced by ConsiderLabelIDAtState(), and ConsiderNegEdgeAtState().
00401 { 00402 int count1=0; 00403 FSMStateSetItem *curitem=set2; 00404 00405 // For every element of 'set1', we check whether it is in 'set2' 00406 // If not, we return 0 00407 // We also count the number of elements in 'count1' 00408 00409 while(set1!=NULL) 00410 { 00411 if(!IsInStateSet(set2,set1->state)) // Not in set? 00412 return 0; 00413 00414 count1++; 00415 set1=set1->next; 00416 } 00417 00418 // Now we check whether the two sets have the same number of elements 00419 curitem=set2; 00420 while(curitem!=NULL) 00421 { 00422 count1--; 00423 if(count1<0) 00424 return 0; 00425 curitem=curitem->next; 00426 } 00427 return 1; 00428 } |
|
Definition at line 518 of file FSM.cpp. 00523 { 00524 FSMStateSetItem *nextstateset; 00525 FSMEdge *edge; 00526 00527 // First, we find all nextstates that are reachable from origstateset over 'labelid' 00528 CreateStateSet(curstate->GetOrigStateSet(),labelid,&nextstateset); 00529 00530 // If the new state set is empty, then we do not have to do anything 00531 if(nextstateset==NULL) 00532 return 0; 00533 00534 // Now, we check whether we already have a state with the same statelist 00535 while(curstatelist!=NULL) 00536 { 00537 if(CompareStateSets(nextstateset,curstatelist->GetOrigStateSet())) 00538 // If checkstate has the same stateset, then we use that existing one 00539 { 00540 *newstate=curstatelist; 00541 00542 // We check if we already have a negedge between the two 00543 // existing states 00544 edge=curstate->FindNegEdge(); 00545 if((edge!=NULL)&&(edge->GetNextState()==curstatelist)) 00546 // If yes, then we only need to remove the label from the negative list 00547 RemoveFromLabelList(edge->GetLabelListRef(),labelid); 00548 else 00549 newfsm->CreateLabelEdge(curstate,curstatelist,labelid); 00550 00551 return 0; 00552 } 00553 curstatelist=curstatelist->GetNextStateInList(); 00554 } 00555 00556 // We didn't find any state with the same state set 00557 // ==> then we must create one 00558 00559 *newstate=newfsm->CreateState(nextstateset); 00560 00561 newfsm->CreateLabelEdge(curstate,*newstate,labelid); 00562 return 1; 00563 } |
|
Definition at line 480 of file FSM.cpp. 00485 { 00486 FSMStateSetItem *nextstateset; 00487 00488 // First, we find all nextstates that are reachable from origstateset over 'labelid' 00489 CreateStateSet(curstate->GetOrigStateSet(),LABEL_UNDEFINED,&nextstateset); 00490 00491 // If the new state set is empty, then we do not have to do anything 00492 if(nextstateset==NULL) 00493 return 0; 00494 00495 // Now, we check whether we already have a state with the same statelist 00496 while(curstatelist!=NULL) 00497 { 00498 if(CompareStateSets(nextstateset,curstatelist->GetOrigStateSet())) 00499 // If checkstate has the same stateset, then we use that existing one 00500 { 00501 newfsm->CreateNegEdge(curstate,curstatelist,mylabellist); 00502 00503 *newstate=curstatelist; 00504 return 0; 00505 } 00506 curstatelist=curstatelist->GetNextStateInList(); 00507 } 00508 00509 // We didn't find any state with the same state set 00510 // ==> then we must create one 00511 00512 *newstate=newfsm->CreateState(nextstateset); 00513 newfsm->CreateNegEdge(curstate,*newstate,mylabellist); 00514 00515 return 1; 00516 } |
|
Definition at line 373 of file FSM.cpp. 00378 { 00379 FSMEdge *curedge; 00380 00381 *newset=NULL; 00382 00383 while(fromstateset!=NULL) 00384 { 00385 curedge=fromstateset->state->GetOutEdges(); 00386 00387 while(curedge!=NULL) 00388 { 00389 if(curedge->DoesMatchLabel(labelid)) 00390 *newset=AddToStateSet(*newset,curedge->GetNextState()); 00391 00392 curedge=curedge->next; 00393 } 00394 fromstateset=fromstateset->next; 00395 } 00396 } |
|
|
|
Definition at line 45 of file FSM.cpp. 00047 { 00048 elementpoundlabelid=globallabeldict.CreateLabelOrAttrib("#",1,0); 00049 attribpoundlabelid=globallabeldict.CreateLabelOrAttrib("#",1,1); 00050 } |
|
Definition at line 466 of file FSM.cpp. 00469 { 00470 // We iterate over all states and all outgoing edges 00471 while(set!=NULL) 00472 { 00473 // We enumerate for a specific state 00474 FindAllOutgoingLabels(set->state,dest); 00475 00476 set=set->next; 00477 } 00478 } |
|
Definition at line 430 of file FSM.cpp. 00435 { 00436 FSMLabel *curlabel; 00437 FSMEdge *outedge; 00438 00439 outedge=state->GetOutEdges(); 00440 while(outedge!=NULL) 00441 { 00442 switch(outedge->GetType()) 00443 { 00444 case EDGETYPE_LABEL: 00445 if(!IsInLabelList(*dest,outedge->GetLabelID())) 00446 // We only insert if the label is not already in the list 00447 *dest=new(fsmtmpmem) FSMLabel(outedge->GetLabelID(),*dest); 00448 00449 break; 00450 00451 case EDGETYPE_NEGLABELLIST: 00452 curlabel=outedge->GetLabelList(); 00453 while(curlabel!=NULL) 00454 { 00455 if(!IsInLabelList(*dest,curlabel->labelid)) 00456 // We only insert if the label is not already in the list 00457 *dest=new(fsmtmpmem) FSMLabel(curlabel->labelid,*dest); 00458 00459 curlabel=curlabel->next; 00460 } 00461 } 00462 outedge=outedge->next; 00463 } 00464 } |
|
Definition at line 66 of file FSM.cpp. Referenced by FSMEdge::DoesMatchLabel().
|
|
Definition at line 331 of file FSM.cpp. Referenced by CompareStateSets().
00333 { 00334 FSMStateSetItem *curitem=set; 00335 00336 // Check if the state is not already in the set 00337 while(curitem!=NULL) 00338 { 00339 if(curitem->state==state) 00340 return 1; 00341 curitem=curitem->next; 00342 } 00343 return 0; 00344 } |
|
Definition at line 705 of file FSM.cpp. 00708 { 00709 while(dependlist!=NULL) 00710 { 00711 if(dependlist->statepair->isnotequal==0) 00712 { 00713 dependlist->statepair->isnotequal=1; 00714 if(dependlist->statepair->dependlist!=NULL) 00715 MarkDependentNotEqual(dependlist->statepair->dependlist); 00716 } 00717 dependlist=dependlist->next; 00718 } 00719 } |
|
Definition at line 79 of file FSM.cpp. Referenced by ConsiderLabelIDAtState().
|
|
|
|
|
|
|
|
|