19 #include <ndb_global.h>
20 #include <BaseString.hpp>
22 #include "DebuggerNames.hpp"
24 #include <BlockNumbers.h>
25 #include <GlobalSignalNumbers.h>
26 #include <signaldata/SignalDataPrint.hpp>
28 static const char * localSignalNames[MAX_GSN+1];
29 static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1];
30 static const char * localBlockNames[NO_OF_BLOCKS];
34 initSignalNames(
const char * dst[],
const GsnName src[],
unsigned short len){
36 for(i = 0; i<=MAX_GSN; i++)
39 for(i = 0; i<len; i++){
40 unsigned short gsn = src[
i].gsn;
41 const char *
name = src[
i].name;
43 if(dst[gsn] != 0 && name != 0){
44 if(strcmp(dst[gsn], name) != 0){
46 "Multiple definition of signal name for gsn: %d (%s, %s)\n",
58 initSignalPrinters(SignalDataPrintFunction dst[],
61 for(i = 0; i<=MAX_GSN; i++)
65 for(i = 0; (gsn = src[
i].gsn) > 0; i++){
66 SignalDataPrintFunction fun = src[
i].function;
68 if(dst[gsn] != 0 && fun != 0){
71 "Multiple definition of signal print function for gsn: %d\n",
83 initBlockNames(
const char * dst[],
87 for(i = 0; i<NO_OF_BLOCKS; i++)
90 for(i = 0; i<len; i++){
91 const int index = src[
i].number - MIN_BLOCK_NO;
92 if((index < 0 && index >= NO_OF_BLOCKS) || dst[index] != 0){
94 "Invalid block name definition: %d %s\n",
95 src[i].number, src[i].name);
107 xxx_DUMMY_SIGNAL_NAMES_xxx = initSignalNames(localSignalNames,
111 xxx_DUMMY_PRINT_FUNCTIONS_xxx = initSignalPrinters(localPrintFunctions,
112 SignalDataPrintFunctions);
115 xxx_DUMMY_BLOCK_NAMES_xxx = initBlockNames(localBlockNames,
120 getSignalName(
unsigned short gsn,
const char * defVal){
121 if(gsn > 0 && gsn <= MAX_GSN)
122 return (localSignalNames[gsn] ? localSignalNames[gsn] : defVal);
127 getGsn(
const char * signalName){
132 getBlockName(
unsigned short blockNo,
const char *
ret){
133 if(blockNo >= MIN_BLOCK_NO && blockNo <= MAX_BLOCK_NO)
134 return localBlockNames[blockNo-MIN_BLOCK_NO];
144 getBlockNo(
const char * blockName){
145 for(
int i = 0; i<NO_OF_BLOCKS; i++)
146 if(localBlockNames[i] != 0 && strcmp(localBlockNames[i], blockName) == 0)
147 return i + MIN_BLOCK_NO;
151 SignalDataPrintFunction
152 findPrintFunction(
unsigned short gsn){
153 if(gsn > 0 && gsn <= MAX_GSN)
154 return localPrintFunctions[gsn];