commit 5bd42f24ced0d8b13eb37308b5b1ed8aa000a26b Author: Daniel Swanson Date: Thu Jun 17 13:18:56 2021 -0500 final elimination of wide strings diff --git a/lttoolbox/compiler.cc b/lttoolbox/compiler.cc index 554869a..d2ab234 100644 --- a/lttoolbox/compiler.cc +++ b/lttoolbox/compiler.cc @@ -146,7 +146,7 @@ Compiler::valid(UString const& dir) const { const char* side = dir == COMPILER_RESTRICTION_RL_VAL ? "right" : "left"; const set epsilonSymbols = alphabet.symbolsWhereLeftIs(0); - const set spaceSymbols = alphabet.symbolsWhereLeftIs(L' '); + const set spaceSymbols = alphabet.symbolsWhereLeftIs(' '); for (auto §ion : sections) { auto &fst = section.second; auto finals = fst.getFinals(); @@ -354,30 +354,30 @@ Compiler::readString(vector &result, UString const &name) requireEmptyError(name); if(keep_boundaries) { - result.push_back(static_cast(L'>')); + result.push_back(static_cast('>')); } } else if(name == COMPILER_BLANK_ELEM) { requireEmptyError(name); - result.push_back(static_cast(L' ')); + result.push_back(static_cast(' ')); } else if(name == COMPILER_JOIN_ELEM) { requireEmptyError(name); - result.push_back(static_cast(L'+')); + result.push_back(static_cast('+')); } else if(name == COMPILER_POSTGENERATOR_ELEM) { requireEmptyError(name); - result.push_back(static_cast(L'~')); + result.push_back(static_cast('~')); } else if(name == COMPILER_GROUP_ELEM) { int type=xmlTextReaderNodeType(reader); if(type != XML_READER_TYPE_END_ELEMENT) { - result.push_back(static_cast(L'#')); + result.push_back(static_cast('#')); } } else if(name == COMPILER_S_ELEM) @@ -485,7 +485,7 @@ Compiler::procIdentity(double const entry_weight, bool ig) } } - if(verbose && first_element && (both_sides.front() == (int)L' ')) + if(verbose && first_element && (both_sides.front() == (int)' ')) { cerr << "Error (" << xmlTextReaderGetParserLineNumber(reader); cerr << "): Entry begins with space." << endl; @@ -495,7 +495,7 @@ Compiler::procIdentity(double const entry_weight, bool ig) if(ig) { vector right; - right.push_back(static_cast(L'#')); + right.push_back(static_cast('#')); right.insert(right.end(), both_sides.begin(), both_sides.end()); e.setSingleTransduction(both_sides, right, entry_weight); } @@ -529,7 +529,7 @@ Compiler::procTransduction(double const entry_weight) } } - if(verbose && first_element && (lhs.front() == (int)L' ')) + if(verbose && first_element && (lhs.front() == (int)' ')) { cerr << "Error (" << xmlTextReaderGetParserLineNumber(reader); cerr << "): Entry begins with space." << endl; diff --git a/lttoolbox/fst_processor.cc b/lttoolbox/fst_processor.cc index 0e63a0a..732acc8 100644 --- a/lttoolbox/fst_processor.cc +++ b/lttoolbox/fst_processor.cc @@ -187,7 +187,7 @@ FSTProcessor::wblankPostGen(InputFile& input, UFILE *output) while(!input.eof()) { c = input.get(); - if(in_content && c == L'~') + if(in_content && c == '~') { if(result[result.size()-1] == ']') { // We just saw the end of a wblank, may want to merge @@ -2614,7 +2614,7 @@ FSTProcessor::bilingual(InputFile& input, UFILE *output, GenerationMode mode) symbol = tr.first; val = tr.second; - //fwprintf(stderr, "> %ls : %lc : %d\n", tr.first.c_str(), tr.second, tr.second); + //fprintf(stderr, "> %ls : %lc : %d\n", tr.first.c_str(), tr.second, tr.second); if(biltransSurfaceForms && !seensurface && !outOfWord) { while(val != '/' && val != 0x7fffffff) @@ -2624,7 +2624,7 @@ FSTProcessor::bilingual(InputFile& input, UFILE *output, GenerationMode mode) tr = readBilingual(input, output); symbol = tr.first; val = tr.second; - //fwprintf(stderr, " == %ls : %lc : %d => %ls\n", symbol.c_str(), val, val, surface.c_str()); + //fprintf(stderr, " == %ls : %lc : %d => %ls\n", symbol.c_str(), val, val, surface.c_str()); } seensurface = true; tr = readBilingual(input, output); diff --git a/lttoolbox/pattern_list.cc b/lttoolbox/pattern_list.cc index d8aa56b..810ecff 100644 --- a/lttoolbox/pattern_list.cc +++ b/lttoolbox/pattern_list.cc @@ -118,7 +118,7 @@ PatternList::insertOutOfSequence(UString const &lemma, UString const &tags, { for(unsigned int i = 0, limit = lemma.size(); i < limit; i++) { - if(lemma[i] == L'*') + if(lemma[i] == '*') { result.push_back(alphabet(ANY_CHAR)); } @@ -169,7 +169,7 @@ PatternList::insertIntoSequence(int const id, UString const &lemma, list >::iterator limit = sequence_data.end(); for(; it != limit; it++) { - it->push_back(L'+'); + it->push_back('+'); insertOutOfSequence(lemma, tags, *it); } } @@ -221,7 +221,7 @@ PatternList::insert(int const id, int const otherid) p.first != p.second; p.first++) { vector temp = *it; - temp.push_back(L'+'); + temp.push_back('+'); temp.insert(temp.end(), (p.first->second).begin(), (p.first->second).end()); new_sequence_data.push_back(temp); @@ -243,7 +243,7 @@ PatternList::tagCount(UString const &tags) { count++; } - else if(tags[i] == L'.') + else if(tags[i] == '.') { count++; } @@ -261,7 +261,7 @@ PatternList::tagAt(UString const &tags, int const index) for(unsigned int i = 0, limit = tags.size(); i < limit; i++) { - if(tags[i] == L'.') + if(tags[i] == '.') { count++; if(end == 0) @@ -331,9 +331,9 @@ PatternList::buildTransducer() // optional queue prevstate = state; - state = transducer.insertSingleTransduction(static_cast(L'_'), state, default_weight); - transducer.linkStates(prevstate, state, static_cast(L' '), default_weight); - transducer.linkStates(prevstate, state, static_cast(L'#'), default_weight); + state = transducer.insertSingleTransduction(static_cast('_'), state, default_weight); + transducer.linkStates(prevstate, state, static_cast(' '), default_weight); + transducer.linkStates(prevstate, state, static_cast('#'), default_weight); transducer.linkStates(state, state, alphabet(ANY_CHAR), default_weight); } else diff --git a/lttoolbox/transducer.cc b/lttoolbox/transducer.cc index 2944e48..e9e6454 100644 --- a/lttoolbox/transducer.cc +++ b/lttoolbox/transducer.cc @@ -816,7 +816,7 @@ Transducer::recognise(UString pattern, Alphabet &a, FILE *err) { set new_state; //Transducer::closure(int const state, int const epsilon_tag) // For each of the current alive states - //fwprintf(err, "step: %ls %lc (%d)\n", pattern.c_str(), *it, sym); + //fprintf(err, "step: %ls %lc (%d)\n", pattern.c_str(), *it, sym); for(auto& it2 : states) { auto& p = transitions[it2]; @@ -831,7 +831,7 @@ Transducer::recognise(UString pattern, Alphabet &a, FILE *err) //UString r; //a.getSymbol(r, t.second); - //fwprintf(err, " -> state: %d, trans: %ls:%ls, targ: %d\n", *it2, (l.empty()) ? "ε" : l.c_str(), (r.empty()) ? "ε" : r.c_str(), it3->second); + //fprintf(err, " -> state: %d, trans: %ls:%ls, targ: %d\n", *it2, (l.empty()) ? "ε" : l.c_str(), (r.empty()) ? "ε" : r.c_str(), it3->second); //if(l.find(*it) != UString::npos || l.empty() ) if(l.find(it) != UString::npos) {