// file: $isip/class/io/SofSymbolTable/sofs_01.cc
// version: $Id: sofs_01.cc 4893 2000-09-20 15:45:04Z duncan $
//

// isip include files
//
#include "SofSymbolTable.h"
#include <Console.h>

// method: debug
//
// arguments:
//  const unichar* msg: (input) debug message
//
// return: a boolean value indicating status
//
// this method displays the values of all internal data
//
boolean SofSymbolTable::debug(const unichar* msg_a) const {

  SysString output;
  SysString value;
  SysString vec_name;
			
  // output the table size and capacity
  //
  value.assign((long)table_size_d);
  output.debugStr(name(), msg_a, L"table_size_d", value);
  Console::put(output);
  
  value.assign((long)table_capacity_d);
  output.debugStr(name(), msg_a, L"table_capacity_d", value);
  Console::put(output);

  // output the number of symbols
  //
  value.assign((long)num_syms_d);
  output.debugStr(name(), msg_a, L"num_syms_d", value);
  Console::put(output);
  
  // output the symbols
  //
  for (long i = 0; i <= table_size_d; i++) {
    
    // if this entry is referenced
    //
    if (ref_count_d[i] > 0) {
      
      // build the variable name for this entry
      //
      vec_name.assign((long)i);
      vec_name.insert(L"table_d[", 0);
      vec_name.concat(L"]");
      
      // build a value string which contains the symbol & ref_count
      //
      value.assign((long)ref_count_d[i]);
      value.insert(L"(", (long)0);
      value.concat(L") ");
      value.concat(table_d[i]);
      
      // output the ith element of the symbol table
      //
      output.debugStr(name(), msg_a, vec_name, value);
      Console::put(output);
    }
  }
  
  // output the transform size
  //
  value.assign((long)transform_size_d);
  output.debugStr(name(), msg_a, L"transform_size_d", value);
  Console::put(output);

  // output the transform, if it exists
  //
  for (long i = 0; i < transform_size_d; i++) {

    // build the variable name for this transform vector entry
    //
    vec_name.assign((long)i);
    vec_name.insert(L"transform_d[", 0);
    vec_name.concat(L"]");

    // output the ith element of the transform vector
    //
    value.assign((long)transform_d[i]);
    output.debugStr(name(), msg_a, vec_name, value);
    Console::put(output);
  }

  // output the debug level
  //
  value.assign(debug_level_d);
  output.debugStr(name(), msg_a, L"debug_level_d", value);
  Console::put(output);

  // exit gracefully
  //
  return true;
}
