Lines Matching full:state
43 /* bldtbl - build table entries for dfa state
46 * int state[numecs], statenum, totaltrans, comstate, comfreq;
47 * bldtbl( state, statenum, totaltrans, comstate, comfreq );
49 * State is the statenum'th dfa state. It is indexed by equivalence class and
50 * gives the number of the state to enter for a given equivalence class.
51 * totaltrans is the total number of transitions out of the state. Comstate
52 * is that state which is the destination of the most transitions out of State.
53 * Comfreq is how many transitions there are out of State to Comstate.
57 * either being redundant (a state processed later will have an identical
58 * transition table) or nearly redundant (a state processed later will have
66 * to the same destination state on basically the same character set.
70 * state will differ from the proto for two out-transitions. One of these
73 * state does not go to the common destination. Templates, on the other
74 * hand, go to the common state on EVERY transition character, and therefore
78 void bldtbl( state, statenum, totaltrans, comstate, comfreq )
79 int state[], statenum, totaltrans, comstate, comfreq;
86 * which occur in "state" but not in the proto which, to date,
87 * has the fewest differences between itself and "state". If
96 /* If the state has too few out-transitions, don't bother trying to
101 mkentry( state, numecs, statenum, JAMSTATE, totaltrans );
105 /* "checkcom" is true if we should only check "state" against
121 mindiff = tbldiff( state, minprot,
130 * out of "state" does not occur with a high enough
132 * that if this state is entered into the proto list,
140 mindiff = tbldiff( state, minprot,
158 d = tbldiff( state, i, extrct[1 - extptr] );
169 * enough to the state we want to match to be usable.
174 /* No good. If the state is homogeneous enough,
181 mktemplate( state, statenum, comstate );
185 mkprot( state, statenum, comstate );
186 mkentry( state, numecs, statenum,
196 /* If this state was sufficiently different from the
202 mkprot( state, statenum, comstate );
292 /* Leave room for the jam-state after the last real state. */
317 /* find_table_space - finds a space in the table for a state to be placed
320 * int *state, numtrans, block_start;
323 * block_start = find_table_space( state, numtrans );
325 * State is the state to be added to the full speed transition table.
326 * Numtrans is the number of out-transitions for the state.
329 * chk) able to accommodate the state
331 * In determining if a state will or will not fit, find_table_space() must take
332 * into account the fact that an end-of-buffer state will be added at [0],
336 int find_table_space( state, numtrans )
337 int *state, numtrans;
346 /* If there are too many out-transitions, put the state at the end of
366 * hold the new state).
410 * that are needed for the new state have not yet been taken.
413 state_ptr = &state[1];
501 * int state[numchars + 1], numchars, statenum, deflink, totaltrans;
502 * mkentry( state, numchars, statenum, deflink, totaltrans );
504 * "state" is a transition array "numchars" characters in size, "statenum"
507 * "JAMSTATE", then no attempt will be made to fit zero entries of "state"
509 * "JAMSTATE" they will be taken care of. In any case, entries in "state"
512 * number of transitions out of the state. If it is below a certain threshold,
514 * state array.
517 void mkentry( state, numchars, statenum, deflink, totaltrans )
518 register int *state;
537 if ( state[minec] != SAME_TRANS )
538 if ( state[minec] != 0 || deflink != JAMSTATE )
547 stack1( statenum, minec, state[minec], deflink );
553 if ( state[maxec] != SAME_TRANS )
554 if ( state[maxec] != 0 || deflink != JAMSTATE )
558 /* Whether we try to fit the state table in the middle of the table
559 * entries we have already generated, or if we just take the state
567 /* Find the first transition of state that we need to worry about. */
586 if ( state[i] != SAME_TRANS &&
587 (state[i] != 0 || deflink != JAMSTATE) &&
625 if ( state[i] != SAME_TRANS )
626 if ( state[i] != 0 || deflink != JAMSTATE )
628 nxt[tblbase + i] = state[i];
641 /* mk1tbl - create table entries for a state (or state fragment) which
645 void mk1tbl( state, sym, onenxt, onedef )
646 int state, sym, onenxt, onedef;
655 base[state] = firstfree - sym;
656 def[state] = onedef;
657 chk[firstfree] = state;
672 void mkprot( state, statenum, comstate )
673 int state[], statenum, comstate;
699 /* Copy state into save area so it can be compared with rapidly. */
703 protsave[tblbase + i] = state[i];
707 /* mktemplate - create a template entry based on a state, and connect the state
711 void mktemplate( state, statenum, comstate )
712 int state[], statenum, comstate;
740 if ( state[i] == 0 )
757 numdiff = tbldiff( state, firstprot, tmp );
785 /* place_state - place a state into full speed transition table
787 * State is the statenum'th state. It is indexed by equivalence class and
788 * gives the number of the state to enter for a given equivalence class.
789 * Transnum is the number of out-transitions for the state.
792 void place_state( state, statenum, transnum )
793 int *state, statenum, transnum;
797 int position = find_table_space( state, transnum );
805 * state.
814 /* Place the state into chk and nxt. */
815 state_ptr = &state[1];
831 * If there's room for another state on the "one-transition" stack, the
832 * state is pushed onto it, to be processed later by mk1tbl. If there's
853 /* tbldiff - compute differences between two state tables
855 * "state" is the state array which is to be extracted from the pr'th
858 * state table. Each entry in "state" which differs from the corresponding
861 * Entries which are the same in both "state" and "pr" will be marked
863 * between "state" and "pr" is returned as function value. Note that this
867 int tbldiff( state, pr, ext )
868 int state[], pr, ext[];
870 register int i, *sp = state, *ep = ext, *protp;