?? modmain.bas
字號:
GetEntity ' Lib
ReadChar
StripBlank
GetLitString
ReadChar
CurrentDll = Replace(Trim(CurrentEntity), Chr(34), "")
If Right(UCase(CurrentDll), 4) = ".DLL" Then CurrentDll = Mid(CurrentDll, 1, Len(CurrentDll) - 4)
If GetExpressionDeclare(" ALIAS") = True Then
ReadChar
StripBlank
ReadChar
GetEntity
ReadChar
StripBlank
ReadChar
CurrentAlias = CurrentEntity
ConvertLocalResult = StoreSub(True, CurrentAlias)
Else
ReadChar
ConvertLocalResult = StoreSub(True, "")
End If
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
Case "FUNCTION"
StripBlank
GetEntity
SavedEntity = CurrentEntity
StripBlank
GetEntity ' Lib
ReadChar
StripBlank
GetLitString
ReadChar
CurrentDll = Replace(Trim(CurrentEntity), Chr(34), "")
If Right(UCase(CurrentDll), 4) = ".DLL" Then CurrentDll = Mid(CurrentDll, 1, Len(CurrentDll) - 4)
If GetExpressionDeclare(" ALIAS") = True Then
ReadChar
StripBlank
ReadChar
GetEntity
ReadChar
StripBlank
ReadChar
CurrentAlias = CurrentEntity
ConvertLocalResult = StoreFunction(True, CurrentAlias)
Else
ReadChar
ConvertLocalResult = StoreFunction(True, "")
End If
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
End Select
Case "DIM"
StoreNextLocVariable: StripBlank
GetEntity
StoreStaticVariable: ConvertLocalResult = StoreVariable(False, True)
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
If IsEOL(CurrentChar) = False Then
' Another variable ?
StripBlank
If IsComma(CurrentChar) Then
ReadChar
GoTo StoreNextLocVariable
End If
End If
Case "END"
StripBlank
GetEntity
Select Case UCase(CurrentEntity)
Case "SUB"
Nested = Nested - 1
StaticContainer = False
CurrentNested = ""
CurrentSub = ""
Case "TYPE"
InTypeDef = False
Nested = Nested - 1
WriteStructFoot CurrentType
CurrentType = ""
Case "ENUM"
InEnumDef = False
Nested = Nested - 1
WriteEnumFoot
CurrentEnum = ""
Case "FUNCTION"
Nested = Nested - 1
StaticContainer = False
CurrentNested = ""
CurrentSub = ""
End Select
Case Else
If InTypeDef = True Then
ConvertLocalResult = StoreVariable(True, False)
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
Else
If InEnumDef = True Then
ConvertLocalResult = StoreEnum
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
Else
' Handle line numbers
If IsNumeric(CurrentEntity) Then
StripBlank
If IsEOL(CurrentChar) Then GoTo PassLine1
' Check for commented line
If IsColon(CurrentChar) Then ReadChar
If IsComment(CurrentChar) Then GoTo PassLine1
GoTo ProceedLine1
End If
' Is it a label
If IsColon(CurrentChar) Then
ReadChar
StripBlank
If IsEOL(CurrentChar) Then GoTo PassLine1
' Check for commented line
If IsComment(CurrentChar) Then GoTo PassLine1
GoTo ProceedLine1
End If
' Create a variable only if outside a procedure
If Nested = 0 Then
StoreNextPubVariable: ConvertLocalResult = StoreVariable(False, False)
If lstrlen(ConvertLocalResult) <> 0 Then
If StopAtError = True Then
Panic "*** Error: " & ConvertLocalResult & " at line: " & CurrentModLine & ".\n"
WriteText "*** " & CurrentModuleLine & "\n"
GoTo StopAll
Else
DisplayError ConvertLocalResult
GoTo PassLine1
End If
End If
If IsEOL(CurrentChar) = False Then
' Another variable ?
StripBlank
If IsComma(CurrentChar) Then
ReadChar
StripBlank
GetEntity
GoTo StoreNextPubVariable
End If
End If
Else
If StaticLine = True Then GoTo StoreStaticVariable
End If
End If
End If
End Select
End If
End If
PassLine1: Next
CloseOutFile
CloseInFile
End If
Next
' Second pass: check syntax and produce output files
WriteText "\nPass 2...\n"
CurrentNested = ""
Nested = 0
For i = 0 To UBound(IncludeVBModules()) Step 1
If IncludeVBModules(i) <> "" Then
CurrentModuleName = IncludeVBModules(i)
CurrentModuleHandle = OpenFileR(CurrentModuleName)
OutModuleName = CurrentModuleName
OutModuleName = Mid(OutModuleName, 1, Len(OutModuleName) - 3) & "cpp"
CurrentModuleMem = LoadFileIntoMemory(CurrentModuleHandle)
CurrentModuleString = String(FileLength, " ")
CopyMemory ByVal CurrentModuleString, ByVal CurrentModuleMem, FileLength
CurrentModuleArray() = Split(CurrentModuleString, vbNewLine)
If ModulesArrayConversion(i) = False Then
WriteText "Module: " & ModulesArray(i) & " ignored.\n"
GoTo PassFile
End If
OutModuleHandle = OpenFileW(OutModuleName)
CurrentModLine = 0
Nested = 0
WriteText "Converting " & ModulesArray(i) & "...\n"
BrokeLine = ""
For j = 1 To UBound(CurrentModuleArray()) Step 1
CurrentModLine = CurrentModLine + 1
CurrentModuleLine = Trim(CurrentModuleArray(j))
OutModuleString = BrokeLine & Trim(CurrentModuleLine)
If lstrlen(OutModuleString) <> 0 Then
If IsUnderLine(Right(OutModuleString, 1)) Then
BrokeLine = Mid(OutModuleString, 1, Len(OutModuleString) - 1)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -