/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DebuggerNames.hpp" #include #include #include #include #include #include static const char * localSignalNames[MAX_GSN+1]; static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1]; static const char * localBlockNames[NO_OF_BLOCKS]; static int initSignalNames(const char * dst[], const GsnName src[], unsigned short len){ for(int i = 0; i<=MAX_GSN; i++) dst[i] = 0; for(int i = 0; i= NO_OF_BLOCKS || dst[index] != 0){ fprintf(stderr, "Invalid block name definition: %d %s\n", src[i].number, src[i].name); exit(0); } dst[index] = src[i].name; } return 0; } /** * Run static initializer */ static const int xxx_DUMMY_SIGNAL_NAMES_xxx = initSignalNames(localSignalNames, SignalNames, NO_OF_SIGNAL_NAMES); static const int xxx_DUMMY_PRINT_FUNCTIONS_xxx = initSignalPrinters(localPrintFunctions, SignalDataPrintFunctions, NO_OF_PRINT_FUNCTIONS); static const int xxx_DUMMY_BLOCK_NAMES_xxx = initBlockNames(localBlockNames, BlockNames, NO_OF_BLOCK_NAMES); const char * getSignalName(unsigned short gsn, const char * defVal){ if(gsn > 0 && gsn <= MAX_GSN) return (localSignalNames[gsn] ? localSignalNames[gsn] : defVal); return defVal; } unsigned short getGsn(const char * signalName){ return 0; } const char * getBlockName(unsigned short blockNo, const char * ret){ if(blockNo >= MIN_BLOCK_NO && blockNo <= MAX_BLOCK_NO) return localBlockNames[blockNo-MIN_BLOCK_NO]; if (ret == 0) { static char buf[20]; snprintf(buf, sizeof(buf), "BLOCK#%d", (int)blockNo); return buf; } return ret; } unsigned short getBlockNo(const char * blockName){ for(int i = 0; i 0 && gsn <= MAX_GSN) return localPrintFunctions[gsn]; return 0; }