#DEFINE ccSourcePath 'C:\Program Files\Microsoft Visual Studio\VC98\Include' CREATE CURSOR csTmp (name C(100), cexpr C(200), comment C(200)) = ParseFolder(ccSourcePath, 'h') = ParseFolder(ccSourcePath + '\gl', 'h') = ParseFolder(ccSourcePath + '\objmodel', 'h') = ParseFolder(ccSourcePath + '\sys', 'h') SELECT DISTINCT name, cexpr FROM csTmp; WHERE Len(alltrim(cexpr)) < 50; ORDER BY 1,2 INTO CURSOR csResult PROCEDURE ParseFolder(lcPath, lcExt) LOCAL lnFiles, ii, lcFile lnFiles = ADIR(arr, lcPath + '\*.' + lcExt) FOR ii=1 TO lnFiles lcFile = lcPath + '\' + arr[ii,1] = ParseFile (lcFile) ENDFOR PROCEDURE ParseFile(lcFile) LOCAL hFile, lcLine, lcTotalLine hFile = FOPEN(lcFile) IF hFile = -1 ? 'Error opening file ' + lcFile RETURN ENDIF DO WHILE Not FEOF(hFile) lcTotalLine = '' DO WHILE .T. IF Not FEOF(hFile) lcLine = ALLTRIM(FGETS(hFile)) ELSE EXIT ENDIF IF EMPTY(lcLine) EXIT ENDIF IF RIGHT(lcLine, 1) <> '\' lcTotalLine = lcTotalLine + lcLine EXIT ELSE lcTotalLine = lcTotalLine + ' ' + lcLine ENDIF ENDDO IF Not EMPTY(lcTotalLine) = ParseLine(lcTotalLine) ENDIF ENDDO = FCLOSE(hFile) PROCEDURE ParseLine(lcLine) LOCAL lnStartPos, lnNamePos, lnCommentPos,; lnCommentPos1, lnCommentPos2,; lcName, lcChar, lcExpr, lcComment lcLine = STRTRAN(lcLine, Chr(9), ' ') DO WHILE AT(' ', lcLine) <> 0 lcLine = STRTRAN(lcLine, ' ', ' ') ENDDO lcLine = ALLTRIM(lcLine) lnStartPos = AT('#DEFINE ', UPPER(lcLine)) IF lnStartPos <> 0 lcName = '' lnNamePos = lnStartPos + 8 DO WHILE .T. lcChar = SUBSTR(lcLine, lnNamePos, 1) DO CASE CASE lcChar = '(' lcName = '' EXIT CASE lcChar = ' ' EXIT OTHER lcName = lcName + lcChar ENDCASE IF lnNamePos < Len(lcLine) lnNamePos = lnNamePos + 1 ELSE EXIT ENDIF ENDDO IF Not EMPTY(lcName) lnNamePos = lnNamePos + 1 lcName = ALLTRIM(lcName) lnCommentPos1 = AT('//', lcLine) lnCommentPos2 = AT('/*', lcLine) DO CASE CASE lnCommentPos1=0 And lnCommentPos2=0 lnCommentPos = 0 CASE lnCommentPos1=0 lnCommentPos = lnCommentPos2 CASE lnCommentPos2=0 lnCommentPos = lnCommentPos1 OTHER lnCommentPos = MIN(lnCommentPos1, lnCommentPos2) ENDCASE IF lnCommentPos <> 0 lcExpr = ALLTRIM(SUBSTR(lcLine,; lnNamePos, lnCommentPos-lnNamePos)) lcComment = ALLTRIM(SUBSTR(lcLine,; lnCommentPos)) ELSE lcExpr = ALLTRIM(SUBSTR(lcLine, lnNamePos)) lcComment = '' ENDIF IF Not EMPTY(lcExpr) IF lcExpr = 'L"' lcExpr = SUBSTR(lcExpr, 3) ENDIF IF AT(m.lcName, m.lcExpr) <> 1 INSERT INTO csTmp; (name, cexpr, comment); VALUES (m.lcName, m.lcExpr, m.lcComment) ENDIF ENDIF ENDIF ENDIF