Changeset 69460 in vbox for trunk/src/bldprogs
- Timestamp:
- Oct 27, 2017 5:28:22 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 118795
- Location:
- trunk/src/bldprogs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scm.cpp
r69442 r69460 524 524 }; 525 525 526 static PFNSCMREWRITER const g_aRewritersFor_SqlFiles[] = 527 { 528 rewrite_ForceNativeEol, 529 rewrite_ExpandTabs, 530 rewrite_StripTrailingBlanks, 531 rewrite_AdjustTrailingLines, 532 rewrite_SvnKeywords, 533 rewrite_SvnNoExecutable, 534 rewrite_Copyright_SqlComment, 535 }; 526 536 527 537 static PFNSCMREWRITER const g_aRewritersFor_FileLists[] = /* both makefile and shell script */ … … 568 578 SCM_CFG_ENTRY(g_aRewritersFor_QtUiFiles, false, "*.ui" ), 569 579 SCM_CFG_ENTRY(g_aRewritersFor_SifFiles, false, "*.sif" ), 580 SCM_CFG_ENTRY(g_aRewritersFor_SqlFiles, false, "*.pgsql|*.sql" ), 570 581 /* Should be last. */ 571 582 SCM_CFG_ENTRY(g_aRewritersFor_OtherMakefiles, false, "Makefile|makefile|GNUmakefile|SMakefile" ), … … 1287 1298 { 1288 1299 RTStrFree(pszFreeLine); 1289 rc = RTMsgErrorRc(VERR_NO_MEMORY, "%s: Ran out of memory deal with escaped newlines" );1300 rc = RTMsgErrorRc(VERR_NO_MEMORY, "%s: Ran out of memory deal with escaped newlines", pszFilename); 1290 1301 break; 1291 1302 } -
trunk/src/bldprogs/scm.h
r69442 r69460 80 80 kScmCommentStyle_Rem_Lower, 81 81 kScmCommentStyle_Rem_Camel, 82 kScmCommentStyle_Sql, 82 83 kScmCommentStyle_Tick, 83 84 kScmCommentStyle_End … … 206 207 FNSCMREWRITER rewrite_Copyright_RemComment; 207 208 FNSCMREWRITER rewrite_Copyright_SemicolonComment; 209 FNSCMREWRITER rewrite_Copyright_SqlComment; 208 210 FNSCMREWRITER rewrite_Copyright_TickComment; 209 211 FNSCMREWRITER rewrite_Makefile_kup; -
trunk/src/bldprogs/scmparser.cpp
r69422 r69460 105 105 106 106 /** 107 * Callback for checking if comment.107 * Callback for checking if batch comment. 108 108 */ 109 109 static size_t isBatchComment(const char *pchLine, size_t cchLine, bool fSecond) … … 121 121 && IS_REM(pchLine, 1, cchLine)) 122 122 return 4; 123 } 124 return 0; 125 } 126 127 /** 128 * Callback for checking if SQL comment. 129 */ 130 static size_t isSqlComment(const char *pchLine, size_t cchLine, bool fSecond) 131 { 132 if ( cchLine >= 2 133 && pchLine[0] == '-' 134 && pchLine[1] == '-') 135 { 136 if (!fSecond) 137 return 2; 138 if ( cchLine >= 3 139 && pchLine[2] == '-') 140 return 3; 123 141 } 124 142 return 0; … … 850 868 851 869 /** 870 * Deals with comments in SQL files. 871 * 872 * @returns VBox status code / callback return code. 873 * @param pIn The stream to parse. 874 * @param pfnCallback The callback. 875 * @param pvUser The user parameter for the callback. 876 */ 877 static int enumerateSqlComments(PSCMSTREAM pIn, PFNSCMCOMMENTENUMERATOR pfnCallback, void *pvUser) 878 { 879 int rcRet = VINF_SUCCESS; 880 uint32_t iLine = 0; 881 SCMEOL enmEol; 882 size_t cchLine; 883 const char *pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol); 884 while (pchLine != NULL) 885 { 886 /* 887 * Skip leading blanks and check for '--'. 888 */ 889 size_t off = 0; 890 while (off + 3 < cchLine && RT_C_IS_SPACE(pchLine[off])) 891 off++; 892 if ( cchLine < 2 893 || pchLine[0] != '-' 894 || pchLine[1] != '-') 895 { 896 iLine++; 897 pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol); 898 } 899 else 900 { 901 int rc = handleLineComment(pIn, isSqlComment, pfnCallback, pvUser, 902 &pchLine, &cchLine, &enmEol, &iLine, &off); 903 if (RT_FAILURE(rc)) 904 return rc; 905 if (rcRet == VINF_SUCCESS) 906 rcRet = rc; 907 } 908 } 909 910 int rcStream = ScmStreamGetStatus(pIn); 911 if (RT_SUCCESS(rcStream)) 912 return rcRet; 913 return rcStream; 914 } 915 916 917 /** 852 918 * Deals with simple line comments. 853 919 * … … 930 996 return enumerateBatchComments(pIn, pfnCallback, pvUser); 931 997 998 case kScmCommentStyle_Sql: 999 return enumerateSqlComments(pIn, pfnCallback, pvUser); 1000 932 1001 case kScmCommentStyle_Tick: 933 1002 return enumerateSimpleLineComments(pIn, '\'', isTickComment, pfnCallback, pvUser); -
trunk/src/bldprogs/scmrw.cpp
r69344 r69460 363 363 { RT_STR_TUPLE("rem") }, 364 364 { RT_STR_TUPLE("Rem") }, 365 { RT_STR_TUPLE("--") }, 365 366 { RT_STR_TUPLE("'") }, 366 367 { RT_STR_TUPLE("<end>") }, … … 378 379 { RT_STR_TUPLE("rem ") }, 379 380 { RT_STR_TUPLE("Rem ") }, 381 { RT_STR_TUPLE("-- ") }, 380 382 { RT_STR_TUPLE("' ") }, 381 383 { RT_STR_TUPLE("<end>") }, … … 393 395 { RT_STR_TUPLE("rem") }, 394 396 { RT_STR_TUPLE("Rem") }, 397 { RT_STR_TUPLE("--") }, 395 398 { RT_STR_TUPLE("'") }, 396 399 { RT_STR_TUPLE("<end>") }, … … 408 411 { RT_STR_TUPLE("rem") }, 409 412 { RT_STR_TUPLE("Rem") }, 413 { RT_STR_TUPLE("--") }, 410 414 { RT_STR_TUPLE("'") }, 411 415 { RT_STR_TUPLE("<end>") }, … … 1692 1696 } 1693 1697 1698 /** Copyright updater for sql comments. */ 1699 bool rewrite_Copyright_SqlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1700 { 1701 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Sql); 1702 } 1703 1694 1704 /** Copyright updater for tick-prefixed comments. */ 1695 1705 bool rewrite_Copyright_TickComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
Note:
See TracChangeset
for help on using the changeset viewer.