ICU-2924 RBBI rule builder, changes for safe point rules.

X-SVN-Rev: 13607
This commit is contained in:
Andy Heninger 2003-11-06 21:26:07 +00:00
parent 3a0f8e87ea
commit e034a12235
3 changed files with 27 additions and 16 deletions

View File

@ -201,6 +201,7 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
uint32_t s;
RBBIDebugPrintf(" %s\n", heading);
RBBIDebugPrintf("State | Acc LA Tag");
for (c=0; c<fHeader->fCatCount; c++) {RBBIDebugPrintf("%3d ", c);}
RBBIDebugPrintf("\n------|---------------"); for (c=0;c<fHeader->fCatCount; c++) {
@ -208,6 +209,10 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
}
RBBIDebugPrintf("\n");
if (table == NULL) {
RBBIDebugPrintf(" N U L L T A B L E\n\n");
return;
}
for (s=0; s<table->fNumStates; s++) {
RBBIStateTableRow *row = (RBBIStateTableRow *)
(table->fTableData + (table->fRowLen * s));

View File

@ -284,11 +284,15 @@ void RBBINode::print() {
"opLParen"
};
RBBIDebugPrintf("%10p %12s %10p %10p %10p %4d %6d %d ",
(void *)this, nodeTypeNames[fType], (void *)fParent, (void *)fLeftChild, (void *)fRightChild,
fSerialNum, fFirstPos, fVal);
if (fType == varRef) {
printUnicodeString(fText);
if (this==NULL) {
RBBIDebugPrintf("%10p", (void *)this);
} else {
RBBIDebugPrintf("%10p %12s %10p %10p %10p %4d %6d %d ",
(void *)this, nodeTypeNames[fType], (void *)fParent, (void *)fLeftChild, (void *)fRightChild,
fSerialNum, fFirstPos, fVal);
if (fType == varRef) {
printUnicodeString(fText);
}
}
RBBIDebugPrintf("\n");
#endif
@ -317,7 +321,7 @@ void RBBINode::printUnicodeString(const UnicodeString &s, int minWidth)
// print. Print out the tree of nodes rooted at "this"
//
//-------------------------------------------------------------------------
#ifdef RBBI_DEBUG
#ifndef RBBI_DEBUG
void RBBINode::printTree(UBool, UBool) {}
#else
void RBBINode::printTree(UBool printHeading, UBool doVars) {
@ -327,15 +331,17 @@ void RBBINode::printTree(UBool printHeading, UBool doVars) {
);
}
this->print();
// Only dump the definition under a variable reference if asked to.
// Unconditinally dump children of all other node types.
if (fType != varRef || doVars) {
if (fLeftChild != NULL) {
fLeftChild->printTree(FALSE);
}
if (fRightChild != NULL) {
fRightChild->printTree(FALSE);
if (this != NULL) {
// Only dump the definition under a variable reference if asked to.
// Unconditinally dump children of all other node types.
if (fType != varRef || doVars) {
if (fLeftChild != NULL) {
fLeftChild->printTree(FALSE);
}
if (fRightChild != NULL) {
fRightChild->printTree(FALSE);
}
}
}
}

View File

@ -150,7 +150,7 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
int32_t rulesSize = align8((strippedRules.length()+1) * sizeof(UChar));
int32_t totalSize = headerSize + forwardTableSize + reverseTableSize
+ trieSize + rulesSize;
+ safeFwdTableSize + safeRevTableSize + trieSize + rulesSize;
RBBIDataHeader *data = (RBBIDataHeader *)uprv_malloc(totalSize);
if (data == NULL) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;