From 8066655515d9d875e5de34eb0c459fdebccad242 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Wed, 15 Sep 2004 17:11:47 +0000 Subject: [PATCH] ICU-4078 Remove unused strings. X-SVN-Rev: 16329 --- icu4c/source/common/rbbi.cpp | 60 ++++++++++++++++++-------------- icu4c/source/common/rbbicst.pl | 4 ++- icu4c/source/common/rbbirb.h | 2 ++ icu4c/source/common/rbbirpt.h | 2 ++ icu4c/source/common/rbbiscan.cpp | 23 +++++++----- icu4c/source/common/rbbitblb.cpp | 6 ++-- 6 files changed, 57 insertions(+), 40 deletions(-) diff --git a/icu4c/source/common/rbbi.cpp b/icu4c/source/common/rbbi.cpp index 2baeb0bcea2..50a9f0d6617 100644 --- a/icu4c/source/common/rbbi.cpp +++ b/icu4c/source/common/rbbi.cpp @@ -674,7 +674,7 @@ int32_t RuleBasedBreakIterator::handleNext() { int32_t RuleBasedBreakIterator::handleNext(const RBBIStateTable *statetable) { if (fTrace) { - RBBIDebugPrintf("Handle Next pos char state category \n"); + RBBIDebugPuts("Handle Next pos char state category"); } // No matter what, handleNext alway correctly sets the break tag value. @@ -753,15 +753,17 @@ int32_t RuleBasedBreakIterator::handleNext(const RBBIStateTable *statetable) { category &= ~0x4000; } - if (fTrace) { - RBBIDebugPrintf(" %4d ", fText->getIndex()); - if (0x20<=c && c<0x7f) { - RBBIDebugPrintf("\"%c\" ", c); - } else { - RBBIDebugPrintf("%5x ", c); + #ifdef RBBI_DEBUG + if (fTrace) { + RBBIDebugPrintf(" %4d ", fText->getIndex()); + if (0x20<=c && c<0x7f) { + RBBIDebugPrintf("\"%c\" ", c); + } else { + RBBIDebugPrintf("%5x ", c); + } + RBBIDebugPrintf("%3d %3d\n", state, category); } - RBBIDebugPrintf("%3d %3d\n", state, category); - } + #endif // look up a state transition in the state table state = row->fNextState[category]; @@ -875,7 +877,7 @@ int32_t RuleBasedBreakIterator::handlePrevious(void) { } if (fTrace) { - RBBIDebugPrintf("Handle Prev pos char state category \n"); + RBBIDebugPuts("Handle Prev pos char state category"); } // loop until we reach the beginning of the text or transition to state 0 @@ -897,15 +899,17 @@ int32_t RuleBasedBreakIterator::handlePrevious(void) { category &= ~0x4000; } - if (fTrace) { - RBBIDebugPrintf(" %4d ", fText->getIndex()); - if (0x20<=c && c<0x7f) { - RBBIDebugPrintf("\"%c\" ", c); - } else { - RBBIDebugPrintf("%5x ", c); + #ifdef RBBI_DEBUG + if (fTrace) { + RBBIDebugPrintf(" %4d ", fText->getIndex()); + if (0x20<=c && c<0x7f) { + RBBIDebugPrintf("\"%c\" ", c); + } else { + RBBIDebugPrintf("%5x ", c); + } + RBBIDebugPrintf("%3d %3d\n", state, category); } - RBBIDebugPrintf("%3d %3d\n", state, category); - } + #endif // look up a state transition in the backwards state table state = row->fNextState[category]; @@ -1020,7 +1024,7 @@ int32_t RuleBasedBreakIterator::handlePrevious(const RBBIStateTable *statetable) } if (fTrace) { - RBBIDebugPrintf("Handle Prev pos char state category \n"); + RBBIDebugPuts("Handle Prev pos char state category"); } // loop until we reach the beginning of the text or transition to state 0 @@ -1047,15 +1051,17 @@ int32_t RuleBasedBreakIterator::handlePrevious(const RBBIStateTable *statetable) category &= ~0x4000; } - if (fTrace) { - RBBIDebugPrintf(" %4d ", fText->getIndex()); - if (0x20<=c && c<0x7f) { - RBBIDebugPrintf("\"%c\" ", c); - } else { - RBBIDebugPrintf("%5x ", c); + #ifdef RBBI_DEBUG + if (fTrace) { + RBBIDebugPrintf(" %4d ", fText->getIndex()); + if (0x20<=c && c<0x7f) { + RBBIDebugPrintf("\"%c\" ", c); + } else { + RBBIDebugPrintf("%5x ", c); + } + RBBIDebugPrintf("%3d %3d\n", state, category); } - RBBIDebugPrintf("%3d %3d\n", state, category); - } + #endif // look up a state transition in the backwards state table state = row->fNextState[category]; diff --git a/icu4c/source/common/rbbicst.pl b/icu4c/source/common/rbbicst.pl index ad72431f411..4b33fb1f041 100755 --- a/icu4c/source/common/rbbicst.pl +++ b/icu4c/source/common/rbbicst.pl @@ -389,6 +389,7 @@ else # # This array is used for producing debugging output from the rule parser. # + print "#ifndef RBBI_DEBUG\n"; print "static const char * const RBBIRuleStateNames[] = {"; for ($state=0; $state<$num_states; $state++) { if ($stateNames[$state] ne "") { @@ -397,7 +398,8 @@ else print " 0,\n"; } } - print " 0};\n\n"; + print " 0};\n"; + print "#endif\n\n"; print "U_NAMESPACE_END\n"; print "#endif\n"; diff --git a/icu4c/source/common/rbbirb.h b/icu4c/source/common/rbbirb.h index 3634ecf0eab..0e0aba0ae16 100644 --- a/icu4c/source/common/rbbirb.h +++ b/icu4c/source/common/rbbirb.h @@ -198,8 +198,10 @@ struct RBBISetTableEl { #ifdef RBBI_DEBUG #include #define RBBIDebugPrintf printf +#define RBBIDebugPuts puts #else inline void RBBIDebugPrintf(...) {} +#define RBBIDebugPuts(arg) #endif U_NAMESPACE_END diff --git a/icu4c/source/common/rbbirpt.h b/icu4c/source/common/rbbirpt.h index 54360e7310a..77122f00b29 100644 --- a/icu4c/source/common/rbbirpt.h +++ b/icu4c/source/common/rbbirpt.h @@ -171,6 +171,7 @@ static const struct RBBIRuleTableEl gRuleParseStateTable[] = { , {doRuleErrorAssignExpr, 255, 95,0, FALSE} // 94 , {doExit, 255, 95,0, TRUE} // 95 errorDeath }; +#ifndef RBBI_DEBUG static const char * const RBBIRuleStateNames[] = { 0, "start", 0, @@ -268,6 +269,7 @@ static const char * const RBBIRuleStateNames[] = { 0, 0, "errorDeath", 0}; +#endif U_NAMESPACE_END #endif diff --git a/icu4c/source/common/rbbiscan.cpp b/icu4c/source/common/rbbiscan.cpp index ebaee917d28..3953329623b 100644 --- a/icu4c/source/common/rbbiscan.cpp +++ b/icu4c/source/common/rbbiscan.cpp @@ -598,7 +598,7 @@ void RBBIRuleScanner::fixOpStack(RBBINode::OpPrecedence p) { for (;;) { n = fNodeStack[fNodeStackPtr-1]; // an operator node if (n->fPrecedence == 0) { - RBBIDebugPrintf("RBBIRuleScanner::fixOpStack, bad operator node\n"); + RBBIDebugPuts("RBBIRuleScanner::fixOpStack, bad operator node"); error(U_BRK_INTERNAL_ERROR); return; } @@ -931,10 +931,12 @@ void RBBIRuleScanner::parse() { // the search will stop there, if not before. // tableEl = &gRuleParseStateTable[state]; - if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { - RBBIDebugPrintf("char, line, col = (\'%c\', %d, %d) state=%s ", - fC.fChar, fLineNum, fCharNum, RBBIRuleStateNames[state]); - } + #ifdef RBBI_DEBUG + if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { + RBBIDebugPrintf("char, line, col = (\'%c\', %d, %d) state=%s ", + fC.fChar, fLineNum, fCharNum, RBBIRuleStateNames[state]); + } + #endif for (;;) { if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { RBBIDebugPrintf(".");} @@ -993,7 +995,7 @@ void RBBIRuleScanner::parse() { fStackPtr++; if (fStackPtr >= kStackSize) { error(U_BRK_INTERNAL_ERROR); - RBBIDebugPrintf("RBBIRuleScanner::parse() - state stack overflow.\n"); + RBBIDebugPuts("RBBIRuleScanner::parse() - state stack overflow."); fStackPtr--; } fStack[fStackPtr] = tableEl->fPushState; @@ -1012,7 +1014,7 @@ void RBBIRuleScanner::parse() { fStackPtr--; if (fStackPtr < 0) { error(U_BRK_INTERNAL_ERROR); - RBBIDebugPrintf("RBBIRuleScanner::parse() - state stack underflow.\n"); + RBBIDebugPuts("RBBIRuleScanner::parse() - state stack underflow."); fStackPtr++; } } @@ -1037,6 +1039,7 @@ void RBBIRuleScanner::parse() { // We now have a parse tree for the rule expressions // and a list of all UnicodeSets that are referenced. // +#ifdef RBBI_DEBUG if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "symbols")) {fSymbolTable->rbbiSymtablePrint();} if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree")) { @@ -1049,7 +1052,7 @@ void RBBIRuleScanner::parse() { RBBIDebugPrintf("\nCompleted Safe Point Reverse Rules Parse Tree...\n"); fRB->fSafeRevTree->printTree(TRUE); } - +#endif } @@ -1059,9 +1062,11 @@ void RBBIRuleScanner::parse() { // //--------------------------------------------------------------------------------- void RBBIRuleScanner::printNodeStack(const char *title) { +#ifdef RBBI_DEBUG int i; RBBIDebugPrintf("%s. Dumping node stack...\n", title); for (i=fNodeStackPtr; i>0; i--) {fNodeStack[i]->printTree(TRUE);} +#endif } @@ -1077,7 +1082,7 @@ RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) { fNodeStackPtr++; if (fNodeStackPtr >= kStackSize) { error(U_BRK_INTERNAL_ERROR); - RBBIDebugPrintf("RBBIRuleScanner::pushNewNode - stack overflow.\n"); + RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow."); *fRB->fStatus = U_BRK_INTERNAL_ERROR; return NULL; } diff --git a/icu4c/source/common/rbbitblb.cpp b/icu4c/source/common/rbbitblb.cpp index e45589a12f5..b979c92ac63 100644 --- a/icu4c/source/common/rbbitblb.cpp +++ b/icu4c/source/common/rbbitblb.cpp @@ -76,7 +76,7 @@ void RBBITableBuilder::build() { // fTree = fTree->flattenVariables(); if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ftree")) { - RBBIDebugPrintf("Parse tree after flattening variable references.\n"); + RBBIDebugPuts("Parse tree after flattening variable references."); fTree->printTree(TRUE); } @@ -98,7 +98,7 @@ void RBBITableBuilder::build() { // fTree->flattenSets(); if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "stree")) { - RBBIDebugPrintf("Parse tree after flattening Unicode Set references.\n"); + RBBIDebugPuts("Parse tree after flattening Unicode Set references."); fTree->printTree(TRUE); } @@ -115,7 +115,7 @@ void RBBITableBuilder::build() { calcLastPos(fTree); calcFollowPos(fTree); if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "pos")) { - RBBIDebugPrintf("\n\n"); + RBBIDebugPuts("\n"); printPosSets(fTree); }