]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/rbbistbl.cpp
ICU-62107.0.1.tar.gz
[apple/icu.git] / icuSources / common / rbbistbl.cpp
index f8aae3262839ae03db89abc7a3a4b31eae712536..5303f7609698ec8fcc5bdab0e08c0dd6159428d4 100644 (file)
@@ -1,10 +1,12 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 //
 //  file:  rbbistbl.cpp    Implementation of the ICU RBBISymbolTable class
 //
 /*
 ***************************************************************************
-*   Copyright (C) 2002-2004 International Business Machines Corporation   *
-*   and others. All rights reserved.                                      *
+*   Copyright (C) 2002-2014 International Business Machines Corporation
+*   and others. All rights reserved.
 ***************************************************************************
 */
 
 #include "unicode/uchar.h"
 #include "unicode/parsepos.h"
 
-#include "umutex.h"
-
-#include "rbbirb.h"
+#include "cstr.h"
 #include "rbbinode.h"
+#include "rbbirb.h"
+#include "umutex.h"
 
 
 //
@@ -28,8 +30,8 @@
 //                                  when the hash table is deleted.
 //
 U_CDECL_BEGIN
-static void  U_EXPORT2 U_CALLCONV RBBISymbolTableEntry_deleter(void *p) {
-    RBBISymbolTableEntry *px = (RBBISymbolTableEntry *)p;
+static void U_CALLCONV RBBISymbolTableEntry_deleter(void *p) {
+    icu::RBBISymbolTableEntry *px = (icu::RBBISymbolTableEntry *)p;
     delete px;
 }
 U_CDECL_END
@@ -44,7 +46,7 @@ RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules
     fHashTable       = NULL;
     fCachedSetLookup = NULL;
     
-    fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, &status);
+    fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status);
     // uhash_open checks status
     if (U_FAILURE(status)) {
         return;
@@ -226,11 +228,11 @@ RBBISymbolTableEntry::~RBBISymbolTableEntry() {
 //
 #ifdef RBBI_DEBUG
 void RBBISymbolTable::rbbiSymtablePrint() const {
-    RBBIDebugPrintf("Variable Definitions\n"
-           "Name               Node Val     String Val\n"
-           "----------------------------------------------------------------------\n");
+    RBBIDebugPrintf("Variable Definitions Symbol Table\n"
+           "Name                  Node         serial  String Val\n"
+           "-------------------------------------------------------------------\n");
 
-    int32_t pos = -1;
+    int32_t pos = UHASH_FIRST;
     const UHashElement  *e   = NULL;
     for (;;) {
         e = uhash_nextElement(fHashTable,  &pos);
@@ -239,10 +241,8 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
         }
         RBBISymbolTableEntry  *s   = (RBBISymbolTableEntry *)e->value.pointer;
 
-        RBBI_DEBUG_printUnicodeString(s->key, 15);
-        RBBIDebugPrintf("   %8p   ", (void *)s->val);
-        RBBI_DEBUG_printUnicodeString(s->val->fLeftChild->fText);
-        RBBIDebugPrintf("\n");
+        RBBIDebugPrintf("%-19s   %8p %7d ", CStr(s->key)(), (void *)s->val, s->val->fSerialNum);
+        RBBIDebugPrintf(" %s\n", CStr(s->val->fLeftChild->fText)());
     }
 
     RBBIDebugPrintf("\nParsed Variable Definitions\n");
@@ -253,8 +253,9 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
             break;
         }
         RBBISymbolTableEntry  *s   = (RBBISymbolTableEntry *)e->value.pointer;
-        RBBI_DEBUG_printUnicodeString(s->key);
-        s->val->fLeftChild->printTree(TRUE);
+        RBBIDebugPrintf("%s\n", CStr(s->key)());
+        RBBINode::printTree(s->val, TRUE);
+        RBBINode::printTree(s->val->fLeftChild, FALSE);
         RBBIDebugPrintf("\n");
     }
 }