gambas-source-code/c2help/mkhelp.gbs3
Tobias Boege ea6578d19b [C2HELP]
* NEW: Scripts to generate Gambas documentation files from C/C++ sources



git-svn-id: svn://localhost/gambas/trunk@6712 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-12-06 13:18:04 +00:00

42 lines
1,017 B
Text
Executable file

#!/usr/bin/gbs3
Private $cHelp As New Collection
Private $aCurrent As New String[]
Public Sub Main()
Dim sLine As String
Dim cClass As Collection, aHelp, aSyn As String[]
Dim iInd As Integer
For Each sLine in File.In.Lines
If Not sLine Then Continue
If sLine Begins "'" Then
$aCurrent.Add(sLine)
Else
With Scan(sLine, "* *") ' <Class> <Symbol-and-Synonym-List>
.[0] = Trim$(.[0])
.[1] = Trim$(.[1])
If .Count <> 2 Then
Error "Skipping malformed line:";; sLine
Continue
Endif
If Not $cHelp[.[0]] Then $cHelp[.[0]] = New Collection
$cHelp[.[0]][.[1]] = $aCurrent
$aCurrent = New String[]
End With
Endif
Next
For Each cClass In $cHelp
Print "#"; $cHelp.Key
For Each aHelp In cClass
aSyn = Split(cClass.Key, " ")
Print aSyn[0]
If aHelp.Count Then Print aHelp.Join("\n")
For iInd = 1 To aSyn.Max
Print aSyn[iInd]
Print "' A synonym for";; aSyn[0]; "."
Next
Next
Next
End