vbox的更動 57353 路徑 trunk/src/bldprogs
- 時間撮記:
- 2015-8-14 下午02:31:09 (9 年 以前)
- 位置:
- trunk/src/bldprogs
- 檔案:
-
- 修改 16 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/bldprogs/VBoxCPP.cpp
r56310 r57353 26 26 27 27 28 /******************************************************************************* 29 * Header Files *30 ******************************************************************************* /28 /********************************************************************************************************************************* 29 * Header Files * 30 *********************************************************************************************************************************/ 31 31 #include <VBox/VBoxTpG.h> 32 32 … … 49 49 50 50 51 /******************************************************************************* 52 * Defined Constants And Macros *53 ******************************************************************************* /51 /********************************************************************************************************************************* 52 * Defined Constants And Macros * 53 *********************************************************************************************************************************/ 54 54 /** The bitmap type. */ 55 55 #define VBCPP_BITMAP_TYPE uint64_t … … 66 66 67 67 68 /******************************************************************************* 69 * Structures and Typedefs *70 ******************************************************************************* /68 /********************************************************************************************************************************* 69 * Structures and Typedefs * 70 *********************************************************************************************************************************/ 71 71 /** Pointer to the C preprocessor instance data. */ 72 72 typedef struct VBCPP *PVBCPP; … … 519 519 520 520 521 /******************************************************************************* 522 * Internal Functions *523 ******************************************************************************* /521 /********************************************************************************************************************************* 522 * Internal Functions * 523 *********************************************************************************************************************************/ 524 524 static PVBCPPMACRO vbcppMacroLookup(PVBCPP pThis, const char *pszDefine, size_t cchDefine); 525 525 static RTEXITCODE vbcppMacroExpandIt(PVBCPP pThis, PVBCPPMACROEXP pExp, size_t offMacro, PVBCPPMACRO pMacro, size_t offParameters); -
trunk/src/bldprogs/VBoxCmp.cpp
r56310 r57353 17 17 18 18 19 /******************************************************************************* 20 * Header Files*21 ******************************************************************************* /19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 22 22 #include <sys/types.h> 23 23 #include <sys/stat.h> -
trunk/src/bldprogs/VBoxCompilerPlugInsGcc.cpp
r57072 r57353 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 16 */ 17 17 18 18 19 /********************************************************************************************************************************* -
trunk/src/bldprogs/VBoxDef2LazyLoad.cpp
r54209 r57353 18 18 */ 19 19 20 /******************************************************************************* 21 * Header Files * 22 *******************************************************************************/ 20 21 /********************************************************************************************************************************* 22 * Header Files * 23 *********************************************************************************************************************************/ 23 24 #include <ctype.h> 24 25 #include <stdio.h> … … 28 29 29 30 30 /******************************************************************************* 31 * Structures and Typedefs *32 ******************************************************************************* /31 /********************************************************************************************************************************* 32 * Structures and Typedefs * 33 *********************************************************************************************************************************/ 33 34 typedef struct MYEXPORT 34 35 { … … 42 43 43 44 44 /******************************************************************************* 45 * Global Variables *46 ******************************************************************************* /45 /********************************************************************************************************************************* 46 * Global Variables * 47 *********************************************************************************************************************************/ 47 48 /** @name Options 48 49 * @{ */ -
trunk/src/bldprogs/VBoxPeSetVersion.cpp
r56310 r57353 17 17 18 18 19 /******************************************************************************* 20 * Header Files *21 ******************************************************************************* /19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 22 22 #include <Windows.h> 23 23 #include <stdio.h> -
trunk/src/bldprogs/VBoxTpG.cpp
r56310 r57353 17 17 18 18 19 /******************************************************************************* 20 * Header Files *21 ******************************************************************************* /19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 22 22 #include <VBox/VBoxTpG.h> 23 23 … … 42 42 43 43 44 /******************************************************************************* 45 * Structures and Typedefs *46 ******************************************************************************* /44 /********************************************************************************************************************************* 45 * Structures and Typedefs * 46 *********************************************************************************************************************************/ 47 47 48 48 typedef struct VTGATTRS … … 118 118 119 119 120 /******************************************************************************* 121 * Global Variables *122 ******************************************************************************* /120 /********************************************************************************************************************************* 121 * Global Variables * 122 *********************************************************************************************************************************/ 123 123 /** The string space organizing the string table strings. Each node is a VTGSTRING. */ 124 124 static RTSTRSPACE g_StrSpace = NULL; -
trunk/src/bldprogs/bin2c.c
r56310 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #include <ctype.h> 22 23 #include <stdio.h> -
trunk/src/bldprogs/filesplitter.cpp
r56310 r57353 17 17 18 18 19 /******************************************************************************* 20 * Header Files*21 ******************************************************************************* /19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 22 22 #include <sys/types.h> 23 23 #include <sys/stat.h> … … 30 30 31 31 32 /******************************************************************************* 33 * Defined Constants And Macros *34 ******************************************************************************* /32 /********************************************************************************************************************************* 33 * Defined Constants And Macros * 34 *********************************************************************************************************************************/ 35 35 #ifndef S_ISDIR 36 36 # define S_ISDIR(a_fMode) ( (S_IFMT & (a_fMode)) == S_IFDIR ) -
trunk/src/bldprogs/preload.cpp
r56310 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #ifdef RT_OS_WINDOWS 22 23 # include <Windows.h> -
trunk/src/bldprogs/scm.cpp
r57000 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #include <iprt/assert.h> 22 23 #include <iprt/ctype.h> … … 39 40 40 41 41 /******************************************************************************* 42 * Defined Constants And Macros *43 ******************************************************************************* /42 /********************************************************************************************************************************* 43 * Defined Constants And Macros * 44 *********************************************************************************************************************************/ 44 45 /** The name of the settings files. */ 45 46 #define SCM_SETTINGS_FILENAME ".scm-settings" 46 47 47 48 48 /******************************************************************************* 49 * Structures and Typedefs *50 ******************************************************************************* /49 /********************************************************************************************************************************* 50 * Structures and Typedefs * 51 *********************************************************************************************************************************/ 51 52 52 53 /** … … 72 73 SCMOPT_STRIP_TRAILING_LINES, 73 74 SCMOPT_NO_STRIP_TRAILING_LINES, 75 SCMOPT_FIX_FLOWER_BOX_MARKERS, 76 SCMOPT_NO_FIX_FLOWER_BOX_MARKERS, 77 SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS, 74 78 SCMOPT_ONLY_SVN_DIRS, 75 79 SCMOPT_NOT_ONLY_SVN_DIRS, … … 83 87 SCMOPT_DONT_SET_SVN_KEYWORDS, 84 88 SCMOPT_TAB_SIZE, 89 SCMOPT_WIDTH, 85 90 SCMOPT_FILTER_OUT_DIRS, 86 91 SCMOPT_FILTER_FILES, … … 102 107 103 108 104 /******************************************************************************* 105 * Global Variables *106 ******************************************************************************* /109 /********************************************************************************************************************************* 110 * Global Variables * 111 *********************************************************************************************************************************/ 107 112 const char g_szTabSpaces[16+1] = " "; 113 const char g_szAsterisks[255+1] = 114 "****************************************************************************************************" 115 "****************************************************************************************************" 116 "*******************************************************"; 117 const char g_szSpaces[255+1] = 118 " " 119 " " 120 " "; 108 121 static const char g_szProgName[] = "scm"; 109 122 static const char *g_pszChangedSuff = ""; … … 118 131 static SCMSETTINGSBASE const g_Defaults = 119 132 { 120 /* .fConvertEol = */ true, 121 /* .fConvertTabs = */ true, 122 /* .fForceFinalEol = */ true, 123 /* .fForceTrailingLine = */ false, 124 /* .fStripTrailingBlanks = */ true, 125 /* .fStripTrailingLines = */ true, 126 /* .fOnlySvnFiles = */ false, 127 /* .fOnlySvnDirs = */ false, 128 /* .fSetSvnEol = */ false, 129 /* .fSetSvnExecutable = */ false, 130 /* .fSetSvnKeywords = */ false, 131 /* .cchTab = */ 8, 132 /* .pszFilterFiles = */ (char *)"", 133 /* .pszFilterOutFiles = */ (char *)"*.exe|*.com|20*-*-*.log", 134 /* .pszFilterOutDirs = */ (char *)".svn|.hg|.git|CVS", 133 /* .fConvertEol = */ true, 134 /* .fConvertTabs = */ true, 135 /* .fForceFinalEol = */ true, 136 /* .fForceTrailingLine = */ false, 137 /* .fStripTrailingBlanks = */ true, 138 /* .fStripTrailingLines = */ true, 139 /* .fFixFlowerBoxMarkers = */ true, 140 /* .cMinBlankLinesBeforeFlowerBoxMakers = */ 2, 141 /* .fOnlySvnFiles = */ false, 142 /* .fOnlySvnDirs = */ false, 143 /* .fSetSvnEol = */ false, 144 /* .fSetSvnExecutable = */ false, 145 /* .fSetSvnKeywords = */ false, 146 /* .cchTab = */ 8, 147 /* .cchWidth = */ 130, 148 /* .pszFilterFiles = */ (char *)"", 149 /* .pszFilterOutFiles = */ (char *)"*.exe|*.com|20*-*-*.log", 150 /* .pszFilterOutDirs = */ (char *)".svn|.hg|.git|CVS", 135 151 }; 136 152 … … 150 166 { "--strip-trailing-lines", SCMOPT_STRIP_TRAILING_LINES, RTGETOPT_REQ_NOTHING }, 151 167 { "--strip-no-trailing-lines", SCMOPT_NO_STRIP_TRAILING_LINES, RTGETOPT_REQ_NOTHING }, 168 { "--fix-flower-box-markers", SCMOPT_FIX_FLOWER_BOX_MARKERS, RTGETOPT_REQ_NOTHING }, 169 { "--min-blank-lines-before-flower-box-makers", SCMOPT_FIX_FLOWER_BOX_MARKERS, RTGETOPT_REQ_UINT8 }, 170 { "--no-fix-flower-box-markers", SCMOPT_NO_FIX_FLOWER_BOX_MARKERS, RTGETOPT_REQ_NOTHING }, 152 171 { "--only-svn-dirs", SCMOPT_ONLY_SVN_DIRS, RTGETOPT_REQ_NOTHING }, 153 172 { "--not-only-svn-dirs", SCMOPT_NOT_ONLY_SVN_DIRS, RTGETOPT_REQ_NOTHING }, … … 161 180 { "--dont-set-svn-keywords", SCMOPT_DONT_SET_SVN_KEYWORDS, RTGETOPT_REQ_NOTHING }, 162 181 { "--tab-size", SCMOPT_TAB_SIZE, RTGETOPT_REQ_UINT8 }, 182 { "--width", SCMOPT_WIDTH, RTGETOPT_REQ_UINT8 }, 163 183 { "--filter-out-dirs", SCMOPT_FILTER_OUT_DIRS, RTGETOPT_REQ_STRING }, 164 184 { "--filter-files", SCMOPT_FILTER_FILES, RTGETOPT_REQ_STRING }, … … 193 213 rewrite_SvnNoExecutable, 194 214 rewrite_SvnKeywords, 215 rewrite_FixFlowerBoxMarkers, 195 216 rewrite_C_and_CPP 196 217 }; … … 328 349 if (pSettings) 329 350 { 330 Assert(pSettings->cchTab != ~(unsigned)0);331 pSettings->cchTab = ~(unsigned)0;351 Assert(pSettings->cchTab != UINT8_MAX); 352 pSettings->cchTab = UINT8_MAX; 332 353 333 354 RTStrFree(pSettings->pszFilterFiles); … … 386 407 return VINF_SUCCESS; 387 408 409 388 410 case SCMOPT_STRIP_TRAILING_BLANKS: 389 411 pSettings->fStripTrailingBlanks = true; … … 393 415 return VINF_SUCCESS; 394 416 417 case SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS: 418 pSettings->cMinBlankLinesBeforeFlowerBoxMakers = pValueUnion->u8; 419 return VINF_SUCCESS; 420 421 395 422 case SCMOPT_STRIP_TRAILING_LINES: 396 423 pSettings->fStripTrailingLines = true; … … 398 425 case SCMOPT_NO_STRIP_TRAILING_LINES: 399 426 pSettings->fStripTrailingLines = false; 427 return VINF_SUCCESS; 428 429 case SCMOPT_FIX_FLOWER_BOX_MARKERS: 430 pSettings->fFixFlowerBoxMarkers = true; 431 return VINF_SUCCESS; 432 case SCMOPT_NO_FIX_FLOWER_BOX_MARKERS: 433 pSettings->fFixFlowerBoxMarkers = false; 400 434 return VINF_SUCCESS; 401 435 … … 444 478 } 445 479 pSettings->cchTab = pValueUnion->u8; 480 return VINF_SUCCESS; 481 482 case SCMOPT_WIDTH: 483 if (pValueUnion->u8 < 20 || pValueUnion->u8 > 200) 484 { 485 RTMsgError("Invalid width size: %u - must be in {20..200} range\n", pValueUnion->u8); 486 return VERR_OUT_OF_RANGE; 487 } 488 pSettings->cchWidth = pValueUnion->u8; 446 489 return VINF_SUCCESS; 447 490 … … 1537 1580 case SCMOPT_STRIP_TRAILING_BLANKS: RTPrintf(" Default: %RTbool\n", g_Defaults.fStripTrailingBlanks); break; 1538 1581 case SCMOPT_STRIP_TRAILING_LINES: RTPrintf(" Default: %RTbool\n", g_Defaults.fStripTrailingLines); break; 1582 case SCMOPT_FIX_FLOWER_BOX_MARKERS: RTPrintf(" Default: %RTbool\n", g_Defaults.fFixFlowerBoxMarkers); break; 1583 case SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS: RTPrintf(" Default: %u\n", g_Defaults.cMinBlankLinesBeforeFlowerBoxMakers); break; 1539 1584 case SCMOPT_ONLY_SVN_DIRS: RTPrintf(" Default: %RTbool\n", g_Defaults.fOnlySvnDirs); break; 1540 1585 case SCMOPT_ONLY_SVN_FILES: RTPrintf(" Default: %RTbool\n", g_Defaults.fOnlySvnFiles); break; … … 1543 1588 case SCMOPT_SET_SVN_KEYWORDS: RTPrintf(" Default: %RTbool\n", g_Defaults.fSetSvnKeywords); break; 1544 1589 case SCMOPT_TAB_SIZE: RTPrintf(" Default: %u\n", g_Defaults.cchTab); break; 1590 case SCMOPT_WIDTH: RTPrintf(" Default: %u\n", g_Defaults.cchWidth); break; 1545 1591 case SCMOPT_FILTER_OUT_DIRS: RTPrintf(" Default: %s\n", g_Defaults.pszFilterOutDirs); break; 1546 1592 case SCMOPT_FILTER_FILES: RTPrintf(" Default: %s\n", g_Defaults.pszFilterFiles); break; 1547 1593 case SCMOPT_FILTER_OUT_FILES: RTPrintf(" Default: %s\n", g_Defaults.pszFilterOutFiles); break; 1594 default: AssertFailed(); 1548 1595 } 1549 1596 i += fAdvanceTwo; -
trunk/src/bldprogs/scm.h
r56310 r57353 106 106 FNSCMREWRITER rewrite_Makefile_kup; 107 107 FNSCMREWRITER rewrite_Makefile_kmk; 108 FNSCMREWRITER rewrite_FixFlowerBoxMarkers; 108 109 FNSCMREWRITER rewrite_C_and_CPP; 109 110 … … 141 142 bool fStripTrailingBlanks; 142 143 bool fStripTrailingLines; 144 145 /** Whether to fix C/C++ flower box section markers. */ 146 bool fFixFlowerBoxMarkers; 147 /** The minimum number of blank lines we want before flowerbox markers. */ 148 uint8_t cMinBlankLinesBeforeFlowerBoxMakers; 149 143 150 /** Only process files that are part of a SVN working copy. */ 144 151 bool fOnlySvnFiles; … … 151 158 /** Set svn:keyword if completely or partially missing. */ 152 159 bool fSetSvnKeywords; 153 /** */ 154 unsigned cchTab; 160 /** Tab size. */ 161 uint8_t cchTab; 162 /** Optimal source code width. */ 163 uint8_t cchWidth; 155 164 /** Only consider files matching these patterns. This is only applied to the 156 165 * base names. */ … … 220 229 221 230 extern const char g_szTabSpaces[16+1]; 231 extern const char g_szAsterisks[255+1]; 232 extern const char g_szSpaces[255+1]; 222 233 223 234 RT_C_DECLS_END -
trunk/src/bldprogs/scmdiff.cpp
r56310 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #include <iprt/assert.h> 22 23 #include <iprt/ctype.h> … … 28 29 29 30 30 /******************************************************************************* 31 * Global Variables *32 ******************************************************************************* /31 /********************************************************************************************************************************* 32 * Global Variables * 33 *********************************************************************************************************************************/ 33 34 static const char g_szTabSpaces[16+1] = " "; 34 35 -
trunk/src/bldprogs/scmrw.cpp
r56310 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #include <iprt/assert.h> 22 23 #include <iprt/ctype.h> … … 37 38 #include "scm.h" 38 39 40 41 /** 42 * Worker for isBlankLine. 43 * 44 * @returns true if blank, false if not. 45 * @param pchLine Pointer to the start of the line. 46 * @param cchLine The (encoded) length of the line, excluding EOL char. 47 */ 48 static bool isBlankLineSlow(const char *pchLine, size_t cchLine) 49 { 50 /* 51 * From the end, more likely to hit a non-blank char there. 52 */ 53 while (cchLine-- > 0) 54 if (!RT_C_IS_BLANK(pchLine[cchLine])) 55 return false; 56 return true; 57 } 58 59 /** 60 * Helper for checking whether a line is blank. 61 * 62 * @returns true if blank, false if not. 63 * @param pchLine Pointer to the start of the line. 64 * @param cchLine The (encoded) length of the line, excluding EOL char. 65 */ 66 DECLINLINE(bool) isBlankLine(const char *pchLine, size_t cchLine) 67 { 68 if (cchLine == 0) 69 return true; 70 /* 71 * We're more likely to fine a non-space char at the end of the line than 72 * at the start, due to source code indentation. 73 */ 74 if (pchLine[cchLine - 1]) 75 return false; 76 77 /* 78 * Don't bother inlining loop code. 79 */ 80 return isBlankLineSlow(pchLine, cchLine); 81 } 39 82 40 83 … … 420 463 { 421 464 return false; 465 } 466 467 468 static bool isFlowerBoxSectionMarker(PSCMSTREAM pIn, const char *pchLine, size_t cchLine, 469 const char **ppchText, size_t *pcchText) 470 { 471 *ppchText = NULL; 472 *pcchText = 0; 473 474 /* 475 * The first line. 476 */ 477 if (pchLine[0] != '/') 478 return false; 479 size_t offLine = 1; 480 while (offLine < cchLine && pchLine[offLine] == '*') 481 offLine++; 482 if (offLine < 20) 483 return false; 484 while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine])) 485 offLine++; 486 if (offLine != cchLine) 487 return false; 488 489 size_t const cchBox = cchLine; 490 491 /* 492 * The next line, extracting the text. 493 */ 494 SCMEOL enmEol; 495 pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol); 496 if (cchLine < cchBox - 3) 497 return false; 498 499 offLine = 0; 500 while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine])) 501 offLine++; 502 if (offLine + 5 > cchLine) 503 return false; 504 if (pchLine[offLine] != '*') 505 return false; 506 offLine++; 507 if (!RT_C_IS_BLANK(pchLine[offLine + 1])) 508 return false; 509 offLine++; 510 while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine])) 511 offLine++; 512 if (offLine >= cchLine) 513 return false; 514 if (!RT_C_IS_UPPER(pchLine[offLine])) 515 return false; 516 517 *ppchText = &pchLine[offLine]; 518 size_t const offText = offLine; 519 520 /* From the end now. */ 521 offLine = cchLine - 1; 522 while (RT_C_IS_BLANK(pchLine[offLine])) 523 offLine--; 524 525 if (pchLine[offLine] != '*') 526 return false; 527 offLine--; 528 if (!RT_C_IS_BLANK(pchLine[offLine])) 529 return false; 530 offLine--; 531 while (RT_C_IS_BLANK(pchLine[offLine])) 532 offLine--; 533 *pcchText = offLine - offText + 1; 534 535 /* 536 * Third line closes the box. 537 */ 538 pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol); 539 if (cchLine < cchBox - 3) 540 return false; 541 542 offLine = 0; 543 while (offLine < cchLine && pchLine[offLine] == '*') 544 offLine++; 545 if (offLine < cchBox - 4) 546 return false; 547 548 if (pchLine[offLine] != '/') 549 return false; 550 offLine++; 551 552 while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine])) 553 offLine++; 554 if (offLine != cchLine) 555 return false; 556 557 return true; 558 } 559 560 561 /** 562 * Flower box marker comments in C and C++ code. 563 * 564 * @returns true if modifications were made, false if not. 565 * @param pIn The input stream. 566 * @param pOut The output stream. 567 * @param pSettings The settings. 568 */ 569 bool rewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 570 { 571 if (!pSettings->fFixFlowerBoxMarkers) 572 return false; 573 574 /* 575 * Work thru the file line by line looking for flower box markers. 576 */ 577 bool fModified = false; 578 size_t cBlankLines = 0; 579 SCMEOL enmEol; 580 size_t cchLine; 581 const char *pchLine; 582 while ((pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol)) != NULL) 583 { 584 /* 585 * Get a likely match for a first line. 586 */ 587 if ( pchLine[0] == '/' 588 && cchLine > 20 589 && pchLine[1] == '*' 590 && pchLine[2] == '*' 591 && pchLine[3] == '*') 592 { 593 size_t const offSaved = ScmStreamTell(pIn); 594 char const *pchText; 595 size_t cchText; 596 if (isFlowerBoxSectionMarker(pIn, pchLine, cchLine, &pchText, &cchText)) 597 { 598 while (cBlankLines < pSettings->cMinBlankLinesBeforeFlowerBoxMakers) 599 { 600 ScmStreamPutEol(pOut, enmEol); 601 cBlankLines++; 602 } 603 604 ScmStreamPutCh(pOut, '/'); 605 ScmStreamWrite(pOut, g_szAsterisks, pSettings->cchWidth - 1); 606 ScmStreamPutEol(pOut, enmEol); 607 608 static const char s_szLead[] = "* "; 609 ScmStreamWrite(pOut, s_szLead, sizeof(s_szLead) - 1); 610 ScmStreamWrite(pOut, pchText, cchText); 611 size_t offCurPlus1 = sizeof(s_szLead) - 1 + cchText + 1; 612 ScmStreamWrite(pOut, g_szSpaces, offCurPlus1 < pSettings->cchWidth ? pSettings->cchWidth - offCurPlus1 : 1); 613 ScmStreamPutCh(pOut, '*'); 614 ScmStreamPutEol(pOut, enmEol); 615 616 ScmStreamWrite(pOut, g_szAsterisks, pSettings->cchWidth - 1); 617 ScmStreamPutCh(pOut, '/'); 618 ScmStreamPutEol(pOut, enmEol); 619 620 fModified = true; 621 cBlankLines = 0; 622 continue; 623 } 624 } 625 626 int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 627 if (RT_FAILURE(rc)) 628 return false; 629 630 /* Do blank line accounting so we can ensure at least two blank lines 631 before each section marker. */ 632 if (!isBlankLine(pchLine, cchLine)) 633 cBlankLines = 0; 634 else 635 cBlankLines++; 636 } 637 if (fModified) 638 ScmVerbose(pState, 2, " * Converted EOL markers\n"); 639 return fModified; 422 640 } 423 641 -
trunk/src/bldprogs/scmstream.cpp
r56310 r57353 16 16 */ 17 17 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 21 22 #include <iprt/assert.h> 22 23 #include <iprt/ctype.h> … … 1161 1162 1162 1163 /** 1164 * Puts an EOL marker to the stream. 1165 * 1166 * @returns IPRt status code. 1167 * @param pStream The stream. Must be in write mode. 1168 * @param enmEol The end-of-line marker to write. 1169 */ 1170 int ScmStreamPutEol(PSCMSTREAM pStream, SCMEOL enmEol) 1171 { 1172 if (enmEol == SCMEOL_LF) 1173 return ScmStreamWrite(pStream, "\n", 1); 1174 if (enmEol == SCMEOL_CRLF) 1175 return ScmStreamWrite(pStream, "\r\n", 2); 1176 if (enmEol == SCMEOL_NONE) 1177 return VINF_SUCCESS; 1178 AssertFailedReturn(VERR_INVALID_PARAMETER); 1179 } 1180 1181 /** 1163 1182 * Formats a string and writes it to the SCM stream. 1164 1183 * -
trunk/src/bldprogs/scmstream.h
r56310 r57353 123 123 int ScmStreamWrite(PSCMSTREAM pStream, const char *pchBuf, size_t cchBuf); 124 124 int ScmStreamPutCh(PSCMSTREAM pStream, char ch); 125 int ScmStreamPutEol(PSCMSTREAM pStream, SCMEOL enmEol); 125 126 ssize_t ScmStreamPrintf(PSCMSTREAM pStream, const char *pszFormat, ...); 126 127 ssize_t ScmStreamPrintfV(PSCMSTREAM pStream, const char *pszFormat, va_list va); -
trunk/src/bldprogs/scmsubversion.cpp
r57000 r57353 18 18 #define SCM_WITH_DYNAMIC_LIB_SVN 19 19 20 /******************************************************************************* 21 * Header Files * 22 *******************************************************************************/ 20 21 /********************************************************************************************************************************* 22 * Header Files * 23 *********************************************************************************************************************************/ 23 24 #include <iprt/assert.h> 24 25 #include <iprt/ctype.h> … … 48 49 49 50 50 /******************************************************************************* 51 * Defined Constants And Macros *52 ******************************************************************************* /51 /********************************************************************************************************************************* 52 * Defined Constants And Macros * 53 *********************************************************************************************************************************/ 53 54 #ifdef SCM_WITH_DYNAMIC_LIB_SVN 54 55 # if defined(RT_OS_WINDOWS) && defined(RT_ARCH_X86) … … 66 67 67 68 68 /******************************************************************************* 69 * Structures and Typedefs *70 ******************************************************************************* /69 /********************************************************************************************************************************* 70 * Structures and Typedefs * 71 *********************************************************************************************************************************/ 71 72 #if defined(SCM_WITH_DYNAMIC_LIB_SVN) && !defined(SCM_WITH_SVN_HEADERS) 72 73 typedef int apr_status_t; … … 124 125 125 126 126 /******************************************************************************* 127 * Global Variables *128 ******************************************************************************* /127 /********************************************************************************************************************************* 128 * Global Variables * 129 *********************************************************************************************************************************/ 129 130 static char g_szSvnPath[RTPATH_MAX]; 130 131 static enum
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器