void XMLCodeGen::writeActionTableList() { /* Must first order the action tables based on their id. */ int numTables = nextActionTableId; RedActionTable **tables = new RedActionTable*[numTables]; for ( ActionTableMap::Iter at = actionTableMap; at.lte(); at++ ) tables[at->id] = at; out << " <action_table_list length=\"" << numTables << "\">\n"; for ( int t = 0; t < numTables; t++ ) { out << " <action_table id=\"" << t << "\" length=\"" << tables[t]->key.length() << "\">"; for ( ActionTable::Iter atel = tables[t]->key; atel.lte(); atel++ ) { out << atel->value->actionId; if ( ! atel.last() ) out << " "; } out << "</action_table>\n"; } out << " </action_table_list>\n"; delete[] tables; }
/* Write out the array of actions. */ std::ostream &FsmCodeGen::ACTIONS_ARRAY() { out << "\t0, "; int totalActions = 1; for ( ActionTableMap::Iter act = redFsm->actionMap; act.lte(); act++ ) { /* Write out the length, which will never be the last character. */ out << act->key.length() << ", "; /* Put in a line break every 8 */ if ( totalActions++ % 8 == 7 ) out << "\n\t"; for ( ActionTable::Iter item = act->key; item.lte(); item++ ) { out << item->value->actionId; if ( ! (act.last() && item.last()) ) out << ", "; /* Put in a line break every 8 */ if ( totalActions++ % 8 == 7 ) out << "\n\t"; } } out << "\n"; return out; }