mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-12648 Remove several compiler warnings in RBBI code.
X-SVN-Rev: 39015
This commit is contained in:
parent
0f403155dc
commit
306234755f
6 changed files with 34 additions and 40 deletions
|
@ -25,6 +25,8 @@
|
|||
#include "unicode/uniset.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/parsepos.h"
|
||||
|
||||
#include "cstr.h"
|
||||
#include "uvector.h"
|
||||
|
||||
#include "rbbirb.h"
|
||||
|
@ -286,7 +288,7 @@ static int32_t serial(const RBBINode *node) {
|
|||
}
|
||||
|
||||
|
||||
void RBBINode::printNode() {
|
||||
void RBBINode::printNode(const RBBINode *node) {
|
||||
static const char * const nodeTypeNames[] = {
|
||||
"setRef",
|
||||
"uset",
|
||||
|
@ -306,15 +308,16 @@ void RBBINode::printNode() {
|
|||
"opLParen"
|
||||
};
|
||||
|
||||
if (this==NULL) {
|
||||
RBBIDebugPrintf("%10p", (void *)this);
|
||||
if (node==NULL) {
|
||||
RBBIDebugPrintf("%10p", (void *)node);
|
||||
} else {
|
||||
RBBIDebugPrintf("%10p %5d %12s %c%c %5d %5d %5d %6d %d ",
|
||||
(void *)this, fSerialNum, nodeTypeNames[fType], fRuleRoot?'R':' ', fChainIn?'C':' ',
|
||||
serial(fLeftChild), serial(fRightChild), serial(fParent),
|
||||
fFirstPos, fVal);
|
||||
if (fType == varRef) {
|
||||
RBBI_DEBUG_printUnicodeString(fText);
|
||||
(void *)node, node->fSerialNum, nodeTypeNames[node->fType],
|
||||
node->fRuleRoot?'R':' ', node->fChainIn?'C':' ',
|
||||
serial(node->fLeftChild), serial(node->fRightChild), serial(node->fParent),
|
||||
node->fFirstPos, node->fVal);
|
||||
if (node->fType == varRef) {
|
||||
RBBI_DEBUG_printUnicodeString(node->fText);
|
||||
}
|
||||
}
|
||||
RBBIDebugPrintf("\n");
|
||||
|
@ -323,16 +326,8 @@ void RBBINode::printNode() {
|
|||
|
||||
|
||||
#ifdef RBBI_DEBUG
|
||||
U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<s.length(); i++) {
|
||||
RBBIDebugPrintf("%c", s.charAt(i));
|
||||
// putc(s.charAt(i), stdout);
|
||||
}
|
||||
for (i=s.length(); i<minWidth; i++) {
|
||||
RBBIDebugPrintf(" ");
|
||||
}
|
||||
U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth) {
|
||||
RBBIDebugPrintf("%*s", minWidth, CStr(s)());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -347,21 +342,21 @@ void RBBINode::printNodeHeader() {
|
|||
RBBIDebugPrintf(" Address serial type LeftChild RightChild Parent position value\n");
|
||||
}
|
||||
|
||||
void RBBINode::printTree(UBool printHeading) {
|
||||
void RBBINode::printTree(const RBBINode *node, UBool printHeading) {
|
||||
if (printHeading) {
|
||||
printNodeHeader();
|
||||
}
|
||||
this->printNode();
|
||||
if (this != NULL) {
|
||||
printNode(node);
|
||||
if (node != NULL) {
|
||||
// Only dump the definition under a variable reference if asked to.
|
||||
// Unconditinally dump children of all other node types.
|
||||
if (fType != varRef) {
|
||||
if (fLeftChild != NULL) {
|
||||
fLeftChild->printTree(FALSE);
|
||||
if (node->fType != varRef) {
|
||||
if (node->fLeftChild != NULL) {
|
||||
printTree(node->fLeftChild, FALSE);
|
||||
}
|
||||
|
||||
if (fRightChild != NULL) {
|
||||
fRightChild->printTree(FALSE);
|
||||
if (node->fRightChild != NULL) {
|
||||
printTree(node->fRightChild, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ class RBBINode : public UMemory {
|
|||
|
||||
#ifdef RBBI_DEBUG
|
||||
static void printNodeHeader();
|
||||
void printNode();
|
||||
void printTree(UBool withHeading);
|
||||
static void printNode(const RBBINode *n);
|
||||
static void printTree(const RBBINode *n, UBool withHeading);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
@ -1139,16 +1139,15 @@ void RBBIRuleScanner::parse() {
|
|||
//
|
||||
#ifdef RBBI_DEBUG
|
||||
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "symbols")) {fSymbolTable->rbbiSymtablePrint();}
|
||||
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree"))
|
||||
{
|
||||
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree")) {
|
||||
RBBIDebugPrintf("Completed Forward Rules Parse Tree...\n");
|
||||
fRB->fForwardTree->printTree(TRUE);
|
||||
RBBINode::printTree(fRB->fForwardTree, TRUE);
|
||||
RBBIDebugPrintf("\nCompleted Reverse Rules Parse Tree...\n");
|
||||
fRB->fReverseTree->printTree(TRUE);
|
||||
RBBINode::printTree(fRB->fReverseTree, TRUE);
|
||||
RBBIDebugPrintf("\nCompleted Safe Point Forward Rules Parse Tree...\n");
|
||||
fRB->fSafeFwdTree->printTree(TRUE);
|
||||
RBBINode::printTree(fRB->fSafeFwdTree, TRUE);
|
||||
RBBIDebugPrintf("\nCompleted Safe Point Reverse Rules Parse Tree...\n");
|
||||
fRB->fSafeRevTree->printTree(TRUE);
|
||||
RBBINode::printTree(fRB->fSafeRevTree, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1163,7 +1162,7 @@ void RBBIRuleScanner::parse() {
|
|||
void RBBIRuleScanner::printNodeStack(const char *title) {
|
||||
int i;
|
||||
RBBIDebugPrintf("%s. Dumping node stack...\n", title);
|
||||
for (i=fNodeStackPtr; i>0; i--) {fNodeStack[i]->printTree(TRUE);}
|
||||
for (i=fNodeStackPtr; i>0; i--) {RBBINode::printTree(fNodeStack[i], TRUE);}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ void RBBISetBuilder::printSets() {
|
|||
RBBI_DEBUG_printUnicodeString(usetNode->fText);
|
||||
RBBIDebugPrintf("\n");
|
||||
if (usetNode->fLeftChild != NULL) {
|
||||
usetNode->fLeftChild->printTree(TRUE);
|
||||
RBBINode::printTree(usetNode->fLeftChild, TRUE);
|
||||
}
|
||||
}
|
||||
RBBIDebugPrintf("\n");
|
||||
|
|
|
@ -256,7 +256,7 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
|
|||
}
|
||||
RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer;
|
||||
RBBI_DEBUG_printUnicodeString(s->key);
|
||||
s->val->fLeftChild->printTree(TRUE);
|
||||
RBBINode::printTree(s->val->fLeftChild, TRUE);
|
||||
RBBIDebugPrintf("\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ void RBBITableBuilder::build() {
|
|||
#ifdef RBBI_DEBUG
|
||||
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ftree")) {
|
||||
RBBIDebugPuts("\nParse tree after flattening variable references.");
|
||||
fTree->printTree(TRUE);
|
||||
RBBINode::printTree(fTree, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -139,7 +139,7 @@ void RBBITableBuilder::build() {
|
|||
#ifdef RBBI_DEBUG
|
||||
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "stree")) {
|
||||
RBBIDebugPuts("\nParse tree after flattening Unicode Set references.");
|
||||
fTree->printTree(TRUE);
|
||||
RBBINode::printTree(fTree, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ void RBBITableBuilder::printPosSets(RBBINode *n) {
|
|||
}
|
||||
printf("\n");
|
||||
RBBINode::printNodeHeader();
|
||||
n->printNode();
|
||||
RBBINode::printNode(n);
|
||||
RBBIDebugPrintf(" Nullable: %s\n", n->fNullable?"TRUE":"FALSE");
|
||||
|
||||
RBBIDebugPrintf(" firstpos: ");
|
||||
|
|
Loading…
Add table
Reference in a new issue