- Timestamp:
- Oct 25, 2017 3:02:31 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 118640
- Location:
- trunk/src/bldprogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scm.cpp
r69312 r69316 102 102 SCMOPT_TAB_SIZE, 103 103 SCMOPT_WIDTH, 104 SCMOPT_TREAT_AS, 104 105 SCMOPT_FILTER_OUT_DIRS, 105 106 SCMOPT_FILTER_FILES, … … 176 177 /* .cchTab = */ 8, 177 178 /* .cchWidth = */ 130, 179 /* .pszTreatAsName = */ NULL, 178 180 /* .pszFilterFiles = */ (char *)"", 179 181 /* .pszFilterOutFiles = */ (char *)"*.exe|*.com|20*-*-*.log", … … 225 227 { "--tab-size", SCMOPT_TAB_SIZE, RTGETOPT_REQ_UINT8 }, 226 228 { "--width", SCMOPT_WIDTH, RTGETOPT_REQ_UINT8 }, 229 { "--treat-as", SCMOPT_TREAT_AS, RTGETOPT_REQ_STRING }, 227 230 { "--filter-out-dirs", SCMOPT_FILTER_OUT_DIRS, RTGETOPT_REQ_STRING }, 228 231 { "--filter-files", SCMOPT_FILTER_FILES, RTGETOPT_REQ_STRING }, … … 518 521 rc = RTStrDupEx(&pSettings->pszFilterOutDirs, pSrc->pszFilterOutDirs); 519 522 if (RT_SUCCESS(rc)) 520 return VINF_SUCCESS; 521 523 { 524 if (pSrc->pszTreatAsName) 525 rc = RTStrDupEx(&pSettings->pszTreatAsName, pSrc->pszTreatAsName); 526 if (RT_SUCCESS(rc)) 527 return VINF_SUCCESS; 528 529 RTStrFree(pSettings->pszFilterOutDirs); 530 } 522 531 RTStrFree(pSettings->pszFilterOutFiles); 523 532 } … … 528 537 pSettings->pszFilterOutFiles = NULL; 529 538 pSettings->pszFilterOutDirs = NULL; 539 pSettings->pszTreatAsName = NULL; 530 540 return rc; 531 541 } … … 562 572 RTStrFree(pSettings->pszFilterOutDirs); 563 573 pSettings->pszFilterOutDirs = NULL; 574 575 RTStrFree(pSettings->pszTreatAsName); 576 pSettings->pszTreatAsName = NULL; 564 577 } 565 578 } … … 735 748 } 736 749 pSettings->cchWidth = pValueUnion->u8; 750 return VINF_SUCCESS; 751 752 case SCMOPT_TREAT_AS: 753 if (pSettings->pszTreatAsName) 754 { 755 RTStrFree(pSettings->pszTreatAsName); 756 pSettings->pszTreatAsName = NULL; 757 } 758 if (*pValueUnion->psz) 759 { 760 pSettings->pszTreatAsName = RTStrDup(pValueUnion->psz); 761 if (!pSettings->pszTreatAsName) 762 return VERR_NO_MEMORY; 763 } 737 764 return VINF_SUCCESS; 738 765 … … 1510 1537 */ 1511 1538 PCSCMCFGENTRY pCfg = NULL; 1512 for (size_t iCfg = 0; iCfg < RT_ELEMENTS(g_aConfigs); iCfg++) 1513 if (RTStrSimplePatternMultiMatch(g_aConfigs[iCfg].pszFilePattern, RTSTR_MAX, pszBasename, cchBasename, NULL)) 1514 { 1515 pCfg = &g_aConfigs[iCfg]; 1516 break; 1517 } 1539 if (!pBaseSettings->pszTreatAsName) 1540 { 1541 for (size_t iCfg = 0; iCfg < RT_ELEMENTS(g_aConfigs); iCfg++) 1542 if (RTStrSimplePatternMultiMatch(g_aConfigs[iCfg].pszFilePattern, RTSTR_MAX, pszBasename, cchBasename, NULL)) 1543 { 1544 pCfg = &g_aConfigs[iCfg]; 1545 break; 1546 } 1547 } 1548 else 1549 { 1550 size_t cchTreatAsName = strlen(pBaseSettings->pszTreatAsName); 1551 for (size_t iCfg = 0; iCfg < RT_ELEMENTS(g_aConfigs); iCfg++) 1552 if (RTStrSimplePatternMultiMatch(g_aConfigs[iCfg].pszFilePattern, RTSTR_MAX, 1553 pBaseSettings->pszTreatAsName, cchTreatAsName, NULL)) 1554 { 1555 pCfg = &g_aConfigs[iCfg]; 1556 break; 1557 } 1558 } 1518 1559 if (!pCfg) 1519 1560 { … … 2032 2073 case SCMOPT_TAB_SIZE: RTPrintf(" Default: %u\n", g_Defaults.cchTab); break; 2033 2074 case SCMOPT_WIDTH: RTPrintf(" Default: %u\n", g_Defaults.cchWidth); break; 2075 2076 case SCMOPT_TREAT_AS: 2077 RTPrintf(" For files not using the default extension.\n"); 2078 break; 2079 2034 2080 case SCMOPT_FILTER_OUT_DIRS: RTPrintf(" Default: %s\n", g_Defaults.pszFilterOutDirs); break; 2035 2081 case SCMOPT_FILTER_FILES: RTPrintf(" Default: %s\n", g_Defaults.pszFilterFiles); break; -
trunk/src/bldprogs/scm.h
r69295 r69316 287 287 /** Optimal source code width. */ 288 288 uint8_t cchWidth; 289 /** Treat the file as if it had the given name (for finding SCMCFGENTRY). */ 290 char *pszTreatAsName; 289 291 /** Only consider files matching these patterns. This is only applied to the 290 292 * base names. */
Note:
See TracChangeset
for help on using the changeset viewer.