From 3614bdbf883c79c134bafe92dbcf3388d2f24604 Mon Sep 17 00:00:00 2001 From: Santiago Carot-Nemesio Date: Thu, 8 Mar 2018 13:16:10 +0100 Subject: [PATCH 1/3] Generator: Fixes a compiler warning with -Wnarrowing on generated files. --- Generator/Generator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Generator/Generator.c b/Generator/Generator.c index d3265bb..856a28a 100644 --- a/Generator/Generator.c +++ b/Generator/Generator.c @@ -300,7 +300,7 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, fprintf(spFile, "// The largest integer refers only to the grammar's data. Other Parser integer's may,\n"); fprintf(spFile, "// and likely will, have larger requirements. Parser may fail unpredictably.\n"); fprintf(spFile, "\n"); - fprintf(spFile, "static unsigned long int ulData[%lu] = {\n", (unsigned long int)uiVecSize(vpVecData)); + fprintf(spFile, "static signed long int ulData[%lu] = {\n", (unsigned long int)uiVecSize(vpVecData)); vWriteGrammarData(spFile, vpVecData); fprintf(spFile, "\n"); fprintf(spFile, "};\n"); @@ -735,7 +735,7 @@ void vGenerateCSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, ch fprintf(spFile, "// The largest integer refers only to the grammar's data. Other Parser integer's may,\n"); fprintf(spFile, "// and likely will, have larger requirements. Parser may fail unpredictably.\n"); fprintf(spFile, "\n"); - fprintf(spFile, "static unsigned long int ulData[%lu] = {\n", (unsigned long int)uiVecSize(vpVecData)); + fprintf(spFile, "static signed long int ulData[%lu] = {\n", (unsigned long int)uiVecSize(vpVecData)); vWriteGrammarData(spFile, vpVecData); fprintf(spFile, "\n"); fprintf(spFile, "};\n"); From 8c29fdde5bc6eb4259ad63df206686c40df028f5 Mon Sep 17 00:00:00 2001 From: Santiago Carot-Nemesio Date: Thu, 8 Mar 2018 13:27:14 +0100 Subject: [PATCH 2/3] Fix set but non used variable warnings [-Wunused-but-set-variable] --- ApgLib/Operators.c | 6 ------ ApgLib/Parser.c | 3 --- ApgLib/Stats.c | 3 +-- ApgLib/Tools.c | 2 -- ApgLib/Trace.c | 20 +++----------------- ApgUtilities/Utilities.c | 2 -- 6 files changed, 4 insertions(+), 32 deletions(-) diff --git a/ApgLib/Operators.c b/ApgLib/Operators.c index 6a3ea2a..37dc55d 100644 --- a/ApgLib/Operators.c +++ b/ApgLib/Operators.c @@ -31,21 +31,15 @@ //NOTE: returns phrase length on success, APG_UNDEFINED on failure apg_uint uiALT(struct parserctx* spCtx, struct opcode* spOp, apg_uint uiOffset){ - apg_uint uiHaveAst; - APG_AST_CTX* spAstCtx = (APG_AST_CTX*)spCtx->vpAstCtx; apg_uint uiPhraseLength = APG_UNDEFINED; - apg_uint uiAstRecord = APG_UNDEFINED; APG_OPCODE* spChildOp; apg_uint* uipChildList = spOp->sUnion.sAlt.uipChildList; apg_uint* uipEnd = uipChildList + spOp->sUnion.sAlt.uiChildCount; APG_TRACE(spCtx, spOp, TRACE_ACTION_DOWN, P_ALT, uiOffset, 0); - uiHaveAst = spAstCtx && !spAstCtx->uiIgnoreRecords; for(; uipChildList < uipEnd; uipChildList++){ - if(uiHaveAst){uiAstRecord = spAstCtx->uiRecordCount;} spChildOp = spCtx->spOpcodes + *uipChildList; uiPhraseLength = spChildOp->pfnOp(spCtx, spChildOp, uiOffset); if(uiPhraseLength != APG_UNDEFINED){break;} - if(uiHaveAst){uiAstRecord = spAstCtx->uiRecordCount;} } APG_TRACE(spCtx, spOp, TRACE_ACTION_UP, P_ALT, uiOffset, uiPhraseLength); APG_STATS(spCtx, STATS_ACTION_COLLECT, uiPhraseLength, P_ALT, 0); diff --git a/ApgLib/Parser.c b/ApgLib/Parser.c index 827ea07..b41178f 100644 --- a/ApgLib/Parser.c +++ b/ApgLib/Parser.c @@ -321,19 +321,16 @@ void vParserAstInitCallbacks(void* vpCtx, APG_CALLBACK* pfnRuleCallbacks, APG_CA vAstDtor(spCtx); vAstCtor(spCtx); spAstCtx = (APG_AST_CTX*)spCtx->vpAstCtx; - APG_CALLBACK pfnTemp; if(pfnRuleCallbacks){ for(i = 0; i < spCtx->uiRuleCount; i++){ if(pfnRuleCallbacks[i]){spAstCtx->pfnCallbacks[i] = pfnRuleCallbacks[i];} else{spAstCtx->pfnCallbacks[i] = NULL;} - pfnTemp = spAstCtx->pfnCallbacks[i]; } } if(spCtx->uiUdtCount && pfnUdtCallbacks){ for(i = 0; i < spCtx->uiUdtCount; i++){ if(pfnUdtCallbacks[i]){spAstCtx->pfnCallbacks[i + spCtx->uiRuleCount] = pfnUdtCallbacks[i];} else{spAstCtx->pfnCallbacks[i + spCtx->uiRuleCount] = NULL;} - pfnTemp = spAstCtx->pfnCallbacks[i + spCtx->uiRuleCount]; } } } diff --git a/ApgLib/Stats.c b/ApgLib/Stats.c index 6dcc5e5..e73fd1a 100644 --- a/ApgLib/Stats.c +++ b/ApgLib/Stats.c @@ -130,7 +130,7 @@ static void vStatsGetNameAddresses(APG_PARSER_CTX* spParserCtx, APG_PARSER_STATS static apg_uint uiStatsGetNames(APG_PARSER_CTX* spParserCtx, APG_PARSER_STATS* spPublicStats){ apg_uint uiSize = 0; - apg_uint i, j, uiLen; + apg_uint i,uiLen; char* cpNameBuffer = spPublicStats ? spPublicStats->cpNames : NULL; for(i = 0; i < spParserCtx->uiRuleCount; i++){ uiLen = strlen(spParserCtx->spRules[i].cpRuleName) + 1; @@ -145,7 +145,6 @@ static apg_uint uiStatsGetNames(APG_PARSER_CTX* spParserCtx, APG_PARSER_STATS* s uiSize += uiLen; if(cpNameBuffer){ strcpy(cpNameBuffer, spParserCtx->spUdts[i].cpUdtName); - j = i + spParserCtx->uiRuleCount; cpNameBuffer += uiLen; } } diff --git a/ApgLib/Tools.c b/ApgLib/Tools.c index ac0b77b..e8a6c5e 100644 --- a/ApgLib/Tools.c +++ b/ApgLib/Tools.c @@ -199,13 +199,11 @@ apg_uint uiACharToString(char* cpChars, apg_uint uiCLen, const apg_achar* acpACh apg_uint i = 0; apg_achar acChar; char* cpNextChar; - const apg_achar* cpBufferEnd; apg_uint uiCharLen, uiStrLen; apg_uint uiCLenMax; apg_uint uiSize = sizeof(apg_achar); cpNextChar = cpChars; if(acpAChars && uiALen && cpChars && uiCLen){ - cpBufferEnd = acpAChars + uiALen; uiCLenMax = uiCLen - 1; uiStrLen = 0; for(i = 0; i < uiALen && uiStrLen < uiCLenMax; i++){ diff --git a/ApgLib/Trace.c b/ApgLib/Trace.c index 4ede969..2b14fec 100644 --- a/ApgLib/Trace.c +++ b/ApgLib/Trace.c @@ -135,15 +135,8 @@ void vTraceAdmin(APG_PARSER_CTX* spParserCtx, apg_uint uiAction, apg_uint uiId, void vTrace(APG_PARSER_CTX* spParserCtx, APG_OPCODE* spOp, apg_uint uiAction, apg_uint uiId, apg_uint uiOffset, apg_uint uiPhraseLen){ APG_TRACE_CTX* spCtx = (APG_TRACE_CTX*)spParserCtx->vpTraceCtx; - apg_uint uiState, uiStrLen; - const apg_achar* acpPhrase; if(spParserCtx->vpTraceCtx){ - if(uiPhraseLen == APG_UNDEFINED){uiState = NOMATCH;} - else if(uiPhraseLen == 0){uiState = EMPTY;} - else{uiState = MATCH;} - uiStrLen = (uiOffset < spParserCtx->uiInputStringLen) ? spParserCtx->uiInputStringLen - uiOffset: 0; - acpPhrase = spParserCtx->acpInputString + uiOffset; switch(uiAction){ case TRACE_ACTION_BEGIN: vTraceBegin(spCtx); @@ -364,7 +357,7 @@ static void vTraceDown(APG_TRACE_CTX* spCtx, APG_OPCODE* spOp, apg_uint uiId, ap apg_uint uiIsTruncated = APG_FALSE; char caIndentBuf[APG_DISPLAY_MAX_LINE]; char caScratchBuf[2*APG_DISPLAY_MAX_LINE]; - apg_uint uiAChars, uiPrintChars; + apg_uint uiAChars; void* vpTest; const apg_achar* acpPhrase; apg_uint uiPhraseLen; @@ -416,10 +409,8 @@ static void vTraceDown(APG_TRACE_CTX* spCtx, APG_OPCODE* spOp, apg_uint uiId, ap TASSERT(APG_FALSE); break; } - uiPrintChars = uiStrBufCat(vpPrtBuf, ": :"); if(uiStrBufIsTruncated(vpPrtBuf)){uiIsTruncated = APG_TRUE;break;} uiAChars = uiACharToString(&caScratchBuf[0], sizeof(caScratchBuf), acpPhrase, uiPhraseLen); - uiPrintChars = uiStrBufCat(vpPrtBuf, &caScratchBuf[0]); if(uiAChars < uiPhraseLen){uiIsTruncated = APG_TRUE;break;} if(uiStrBufIsTruncated(vpPrtBuf)){uiIsTruncated = APG_TRUE;break;} spCtx->uiTreeDepth++; @@ -439,7 +430,7 @@ static void vTraceUp(APG_TRACE_CTX* spCtx, APG_OPCODE* spOp, apg_uint uiId, apg_ apg_uint uiIsTruncated = APG_FALSE; char caIndentBuf[APG_DISPLAY_MAX_LINE]; char caScratchBuf[2*APG_DISPLAY_MAX_LINE]; - apg_uint uiAChars, uiPrintChars; + apg_uint uiAChars; int uiState; const apg_achar* acpPhrase; apg_uint* uipOtherRecord; @@ -496,13 +487,8 @@ static void vTraceUp(APG_TRACE_CTX* spCtx, APG_OPCODE* spOp, apg_uint uiId, apg_ break; } if(uiStrBufIsTruncated(vpPrtBuf)){uiIsTruncated = APG_TRUE;break;} - if(uiPhraseLen == APG_UNDEFINED){ - uiPrintChars = uiStrBufCat(vpPrtBuf, ": :"); - } else{ - sprintf(&caScratchBuf[0], ":%lu:", (unsigned long int)uiPhraseLen); - uiPrintChars = uiStrBufCat(vpPrtBuf, &caScratchBuf[0]); + if(uiPhraseLen != APG_UNDEFINED){sprintf(&caScratchBuf[0], ":%lu:", (unsigned long int)uiPhraseLen); uiAChars = uiACharToString(&caScratchBuf[0], sizeof(caScratchBuf), acpPhrase, uiPhraseLen); - uiPrintChars = uiStrBufCat(vpPrtBuf, &caScratchBuf[0]); if(uiAChars < uiPhraseLen){uiIsTruncated = APG_TRUE;break;} if(uiStrBufIsTruncated(vpPrtBuf)){uiIsTruncated = APG_TRUE;break;} } diff --git a/ApgUtilities/Utilities.c b/ApgUtilities/Utilities.c index bc31d0e..fc33095 100644 --- a/ApgUtilities/Utilities.c +++ b/ApgUtilities/Utilities.c @@ -183,7 +183,6 @@ and one for the POST_AST or upward direction visit. void vDisplayAstRecords(FILE* spOut, void* vpParserCtx){ APG_PARSER_CTX* spParserCtx = (APG_PARSER_CTX*)vpParserCtx; if(spParserCtx->vpAstCtx){ - apg_uint uiCharLen; apg_uint uiBufLen = 128; char cpBuffer[uiBufLen]; @@ -225,7 +224,6 @@ void vDisplayAstRecords(FILE* spOut, void* vpParserCtx){ sprintf(&caScratchBuf[0], "%s%s:%lu:%lu:", cpBuffer, spUdt->cpUdtName, (printf_uint)spRecord->uiPhraseOffset, (printf_uint)spRecord->uiPhraseLength); uiStrBufCat(vpPrtBuf, &caScratchBuf[0]); - uiCharLen = uiACharToString(cpBuffer, uiBufLen, acpPhrase, uiPhraseLen); uiStrBufCat(vpPrtBuf, cpBuffer); } else{ APG_RULE* spRule= spParserCtx->spRules + spRecord->uiId; From 94aded779116fbea6e2dad34c6f3e789e7721e07 Mon Sep 17 00:00:00 2001 From: Santiago Carot-Nemesio Date: Sat, 10 Mar 2018 17:27:08 +0100 Subject: [PATCH 3/3] Generator: Do not use hyphens for function names --- Generator/Generator.c | 60 +++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/Generator/Generator.c b/Generator/Generator.c index 856a28a..35b99f6 100644 --- a/Generator/Generator.c +++ b/Generator/Generator.c @@ -38,6 +38,7 @@ static int iCompNames(const void* vpLhs, const void* vpRhs); static void vPrintOriginalGrammar(FILE* spFile, char* cpGrammar); static void vToUpper(char* cpString, char* cpToUpper, G_UINT uiLen); static G_UINT uiMinIntSize(G_UINT uiSize); +static void vNoHyphen(char* cpString, char* cpNoHyphen, G_UINT uiLen); void vGenerateCppHeader(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, char* cpGrammar, char* cpFileName, apg_uint uiFileNameLen){ char caHeaderDefine[1024]; @@ -183,24 +184,28 @@ void vGenerateCppHeader(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, fprintf(spOut, " // SYNTAX CALL BACK FUNCTIONS\n"); for(i = 0; i < uiRuleCount; i++){ cpName = spRuleSort[i].cpName; - fprintf(spFile, " static apg_uint uiSyn_%s(APG_CBDATA* spData);\n", cpName); + vNoHyphen(cpName, caBuffer2, sizeof(caBuffer2)); + fprintf(spFile, " static apg_uint uiSyn_%s(APG_CBDATA* spData);\n", caBuffer2); } if(uiUdtCount){ for(i = 0; i < uiUdtCount; i++){ cpName = spUdtSort[i].cpName; - fprintf(spFile, " static apg_uint uiSyn_%s(APG_CBDATA* spData);\n", cpName); + vNoHyphen(cpName, caBuffer2, sizeof(caBuffer2)); + fprintf(spFile, " static apg_uint uiSyn_%s(APG_CBDATA* spData);\n", caBuffer2); } } fprintf(spFile, "\n"); fprintf(spFile, " // AST CALL BACK FUNCTIONS\n"); for(i = 0; i < uiRuleCount; i++){ cpName = spRuleSort[i].cpName; - fprintf(spFile, " static apg_uint uiAst_%s(APG_CBDATA* spData);\n", cpName); + vNoHyphen(cpName, caBuffer2, sizeof(caBuffer2)); + fprintf(spFile, " static apg_uint uiAst_%s(APG_CBDATA* spData);\n", caBuffer2); } if(uiUdtCount){ for(i = 0; i < uiUdtCount; i++){ cpName = spUdtSort[i].cpName; - fprintf(spFile, " static apg_uint uiAst_%s(APG_CBDATA* spData);\n", cpName); + vNoHyphen(cpName, caBuffer2, sizeof(caBuffer2)); + fprintf(spFile, " static apg_uint uiAst_%s(APG_CBDATA* spData);\n", caBuffer2); } } fprintf(spFile, "};"); @@ -220,6 +225,7 @@ void vGenerateCppHeader(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, char* cpFileName, apg_uint uiFileNameLen){ char caBuffer[1024]; char caBuffer2[1024]; + char caBuffer3[1024]; FILE* spFile; FILE* spOut; G_UINT i; @@ -390,12 +396,13 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, for(i = 0; i < uiRuleCount; i++){ cpName = spRuleSort[i].cpName; vToUpper(cpName, caBuffer2, sizeof(caBuffer2)); + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); if(spRuleSort[i].uiIndex == 0){ fprintf(spFile, " sppRuleCallbacks[%s::RULEID_%s] = %s::uiSyn_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } else{ fprintf(spFile, "// sppRuleCallbacks[%s::RULEID_%s] = %s::uiSyn_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } } fprintf(spOut, " }\n"); @@ -404,12 +411,13 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, for(i = 0; i < uiUdtCount; i++){ cpName = spUdtSort[i].cpName; vToUpper(cpName, caBuffer2, sizeof(caBuffer2)); + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); if(spUdtSort[i].uiIndex == 0){ fprintf(spFile, " sppUdtCallbacks[%s::UDTID_%s] = %s::uiSyn_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } else{ fprintf(spFile, "// sppUdtCallbacks[%s::UDTID_%s] = %s::uiSyn_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } } fprintf(spOut, " }\n"); @@ -427,12 +435,13 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, for(i = 0; i < uiRuleCount; i++){ cpName = spRuleSort[i].cpName; vToUpper(cpName, caBuffer2, sizeof(caBuffer2)); + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); if(spRuleSort[i].uiIndex == 0){ fprintf(spFile, " sppRuleCallbacks[%s::RULEID_%s] = %s::uiAst_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } else{ fprintf(spFile, "// sppRuleCallbacks[%s::RULEID_%s] = %s::uiAst_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } } fprintf(spOut, " }\n"); @@ -441,12 +450,13 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, for(i = 0; i < uiUdtCount; i++){ cpName = spUdtSort[i].cpName; vToUpper(cpName, caBuffer2, sizeof(caBuffer2)); + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); if(spUdtSort[i].uiIndex == 0){ fprintf(spFile, " sppUdtCallbacks[%s::UDTID_%s] = %s::uiAst_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } else{ fprintf(spFile, "// sppUdtCallbacks[%s::UDTID_%s] = %s::uiAst_%s;\n", - cpProjectName, caBuffer2, cpProjectName, cpName); + cpProjectName, caBuffer2, cpProjectName, caBuffer3); } } fprintf(spOut, " }\n"); @@ -493,8 +503,9 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, break; } } + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); fprintf(spOut, "// template for Rule syntax callback functions\n"); - fprintf(spOut, "apg_uint %s::uiSyn_%s(APG_CBDATA* spData){\n", cpProjectName, cpName); + fprintf(spOut, "apg_uint %s::uiSyn_%s(APG_CBDATA* spData){\n", cpProjectName, caBuffer3); fprintf(spOut, " apg_uint uiRet = APG_FALSE;\n"); fprintf(spOut, "// uncomment to access the phrase to be parsed by this function\n"); fprintf(spOut, "// const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;\n"); @@ -520,10 +531,11 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, break; } } + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); fprintf(spOut, "\n"); fprintf(spOut, "// template for UDT syntax callback functions\n"); fprintf(spOut, "// Copy and override for each required UDT syntax callback functions\n"); - fprintf(spOut, "apg_uint %s::uiSyn_%s(APG_CBDATA* spData){\n", cpProjectName, cpName); + fprintf(spOut, "apg_uint %s::uiSyn_%s(APG_CBDATA* spData){\n", cpProjectName, caBuffer3); fprintf(spOut, "// uncomment to access the phrase to be parsed by this function\n"); fprintf(spOut, "// const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;\n"); fprintf(spOut, "// apg_uint uiMaxPhraseLength = spData->uiSrcLen - spData->uiPhraseOffset;\n"); @@ -541,8 +553,9 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, break; } } + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); fprintf(spOut, "// template for Rule AST callback functions\n"); - fprintf(spOut, "apg_uint %s::uiAst_%s(APG_CBDATA* spData){\n", cpProjectName, cpName); + fprintf(spOut, "apg_uint %s::uiAst_%s(APG_CBDATA* spData){\n", cpProjectName, caBuffer3); fprintf(spOut, "// uncomment to access the phrase to be parsed by this function\n"); fprintf(spOut, "// const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;\n"); fprintf(spOut, "// apg_uint uiMaxPhraseLength = spData->uiSrcLen - spData->uiPhraseOffset;\n"); @@ -563,8 +576,9 @@ void vGenerateCppSource(CALLBACK_CTX* spCtx, char* cpPath, char* cpProjectName, break; } } + vNoHyphen(cpName, caBuffer3, sizeof(caBuffer3)); fprintf(spOut, "// template for UDT AST callback functions\n"); - fprintf(spOut, "apg_uint %s::uiAst_%s(APG_CBDATA* spData){\n", cpProjectName, cpName); + fprintf(spOut, "apg_uint %s::uiAst_%s(APG_CBDATA* spData){\n", cpProjectName, caBuffer3); fprintf(spOut, "// uncomment to access the phrase to be parsed by this function\n"); fprintf(spOut, "// const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;\n"); fprintf(spOut, "// apg_uint uiMaxPhraseLength = spData->uiSrcLen - spData->uiPhraseOffset;\n"); @@ -854,6 +868,20 @@ static void vToUpper(char* cpString, char* cpToUpper, G_UINT uiLen){ *cpToUpper = 0; } +static void vNoHyphen(char* cpString, char* cpNoHyphen, G_UINT uiLen){ + GASSERT(cpString); + GASSERT(cpNoHyphen); + GASSERT(uiLen); + uiLen++; + uiLen = min(uiLen, (G_UINT)(strlen(cpString)+1)); + char* cpEnd = cpString + uiLen - 1; + for(; cpString < cpEnd; cpString++, cpNoHyphen++){ + if(*cpString == '-'){*cpNoHyphen = '_';} + else{*cpNoHyphen = *cpString;} + } + *cpNoHyphen = 0; +} + static G_UINT uiMinIntSize(G_UINT uiSize){ G_UINT uiRet = 0; G_UINT uiTest;