SUB IDE_GenDeclares(ListIn AS QSTRINGLIST, SortIt AS INTEGER)
DIM TheLine AS STRING
DIM APIname AS STRING
DIM UpLine AS STRING
DIM ListOut AS QSTRINGLIST
IF ListIn.ItemCount < 1 THEN EXIT SUB
DEFINT i = 0, ApiN = 0, ConstN = 0, LimitEnder = 0, JmpLoop
WHILE (i < ListIn.ItemCount)
TheLine = TRIM$(ListIn.Item(i))
LimitEnder = INSTR(TheLine, sQuot)
IF LimitEnder THEN TheLine = RTRIM$(LEFT$(TheLine, LimitEnder-1))
TheLine = StripTabs(TheLine)
UpLine = UCASE$(TheLine)
DO
JmpLoop = False
IF RIGHT$(TheLine, 1) = CHR$(95) THEN
LimitEnder = LEN(TheLine) - 1
ELSE
LimitEnder = INSTR(TheLine, (CHR$(32)+CHR$(95)))
END IF
IF LimitEnder THEN
TheLine = RTRIM$(LEFT$(TheLine, LimitEnder))
IF i <ListIn.ItemCount THEN i++ :TheLine = TheLine + " " + StripTabs(TRIM$(ListIn.Item(i)))
UpLine = UCASE$(TheLine)
ELSE
JmpLoop = True
END IF
LOOP UNTIL JmpLoop
IF (LEFT$(UpLine, 5) = "TYPE " AND INSTR(7, UpLine," EXTENDS ")) THEN
JmpLoop = 0
DO
IF i <ListIn.ItemCount THEN
i++
TheLine = TRIM$(StripTabs(ListIn.Item(i)))
IF UCASE$(LEFT$(TheLine, 9)) = "END TYPE" THEN JmpLoop = 1
ELSE
JmpLoop = True
END IF
LOOP UNTIL JmpLoop
END IF
IF LEFT$(UpLine, 4) = "SUB " THEN ListOut.AddItems "DECLARE " + TheLine
IF LEFT$(UpLine, 9) = "FUNCTION " THEN ListOut.AddItems "DECLARE " + TheLine
IF LEFT$(UpLine, 5) = "SUBI " THEN ListOut.AddItems "DECLARE " + TheLine
IF LEFT$(UpLine, 10) = "FUNCTIONI " THEN ListOut.AddItems "DECLARE " + TheLine
i++
WEND
IF SortIt THEN ListOut.Sort
ListIn.Clear
ListIn.Text = ListOut.Text
ListOut.Clear
END SUB
|