⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modmain.bas

📁 一个把VB原代码转换为VC原代码的软件代码。
💻 BAS
📖 第 1 页 / 共 5 页
字号:
                        GoTo PassLine
                    End If
                    BrokeLine = ""
                    SingleIf = 0
                    If left(OutModuleString, 1) = "'" Then
                        ' Take original line and write it as comment
                        WriteTerm Replace(CurrentModuleArray(j), "'", GetSingleLineComment, 1, 1, vbBinaryCompare) & vbNewLine
                    Else
                        WriteVBLine OutModuleHandle
PushBack:               PushLine OutModuleString
ProceedLine:            StripBlank
                        If IsEOL(CurrentChar) Then GoTo PassLine
                        GetEntity
                        ' Conditional compilations commands
                        If IsDiese(CurrentChar) Then
                            ReadChar
                            StripBlank
                            GetEntity
                            Select Case UCase(CurrentEntity)
                                Case "IF"
                                    WriteTerm AddNested & GetSingleLineComment & " (Conditional)" & vbNewLine
                            End Select
                        End If
                        StaticLine = False
CheckHeadingPass2:      Select Case UCase(CurrentEntity)
                            Case "GLOBAL"
                                StripBlank
                                GetEntity
                                GoTo CheckHeadingPass2
                            Case "PUBLIC"
                                StripBlank
                                GetEntity
                                GoTo CheckHeadingPass2
                            Case "PRIVATE"
                                StripBlank
                                GetEntity
                                GoTo CheckHeadingPass2
                            Case "STATIC"
                                StripBlank
                                GetEntity
                                StaticLine = True
                        End Select
                        Select Case UCase(CurrentEntity)
                            ' Commands
                            Case "REM"
                                GetExpression
                                CurrentExpr = AddNested & GetSingleLineComment & CurrentExpr & vbNewLine
                                WriteTerm CurrentExpr
                            Case "ATTRIBUTE"        ' (Internal to VB files)
                            Case "DEBUG.PRINT"
                            Case "DEBUG.?"          ' (Shouldn't append)
                            Case "DEBUG.ASSERT"
                            Case "OPTION"
                            Case "CONST"
                            Case "ON"
                                If InTypeDef = True Then GoTo PassLine
                                If InEnumDef = True Then GoTo PassLine
                                StripBlank
                                GetEntity
                                ' Pass ON ERROR
                                If lstrcmpi(CurrentEntity, "ERROR") = 0 Then GoTo PassLine
                                StripBlank
                                If GetExpressionHunt("GOTO") = False Then
                                    If StopAtError = True Then
                                        Panic "*** Error: GOTO statement expected at line: " & CurrentModLine & ".\n"
                                        WriteText "*** " & CurrentModuleLine & "\n"
                                        GoTo StopAll
                                    Else
                                        DisplayError "GOTO statement expected"
                                        GoTo PassLine
                                    End If
                                End If
                                CurrentExpr = CurrentEntity & CurrentExpr
                                ArgumentsConversion = ""
                                InStringComp = 0
                                InStringSelectSave = InStringSelect
                                InStringSelect = 0
                                InStringSelectCase = False
                                WasStringCmp = False
                                FunctionParm = Parse("if", CurrentExpr, True, False, False, False, False, False, False, False, False, False, False)
                                InStringSelect = InStringSelectSave
                                ReadChar
                                StripBlank
                                GetEntity
                                WriteTerm ArgumentsConversion & AddNested & GetIfGoto(CorrectParentheses(FunctionParm), CurrentEntity) & vbNewLine
                                GoTo PassLine
                            Case "TYPE"
                                If InTypeDef = False Then
                                    StripBlank
                                    GetEntity
                                    ArrResult = IsUserType(CurrentEntity)
                                    CurrentType = CurrentEntity
                                    InTypeDef = True
                                    Nested = Nested + 1
                                End If
                            Case "ENUM"
                                If InEnumDef = False Then
                                    StripBlank
                                    GetEntity
                                    ArrResult = IsUserEnum(CurrentEntity)
                                    CurrentEnum = CurrentEntity
                                    InEnumDef = True
                                    Nested = Nested + 1
                                End If
                            Case "FUNCTION"
                                If InTypeDef = True Then GoTo PassLine
                                If InEnumDef = True Then GoTo PassLine
                                StripBlank
                                GetEntity
                                ArrResult = IsFunction(CurrentEntity)
                                CurrentSub = ""
                                CurrentNested = CurrentEntity
                                If ArrResult <> -1 Then
                                    WriteTerm FunctionsDeclare(ArrResult)
                                Else
                                    If StopAtError = True Then
                                        Panic "*** Error: function was invalid at line: " & CurrentModLine & ".\n"
                                        WriteText "*** " & CurrentModuleLine & "\n"
                                        GoTo StopAll
                                    Else
                                        DisplayError "function was invalid"
                                        GoTo PassLine
                                    End If
                                End If
                                ' Load default return value by return type
                                ' (empty string or 0)
                                Select Case FunctionsReturnType(ArrResult)
                                    Case VAR_STRING
                                        LastFunctionResult = CurrentNested & "ReturnValue"
                                    Case VAR_CUSTOM
                                        LastFunctionResult = "&" & CurrentNested & "ReturnStruct"
                                    Case Else
                                        LastFunctionResult = CurrentNested & "ReturnValue"
                                End Select
                                Nested = 1
                                ReDim OldGoSubLabel(0)
                                ReDim OldSelectCaseVar(0)
                                ReDim OldSelectCase(0)
                                ReDim VarToFree(0)
                                WriteFunctionLocalVars
                            Case "SUB"
                                If InTypeDef = True Then GoTo PassLine
                                If InEnumDef = True Then GoTo PassLine
                                StripBlank
                                GetEntity
                                ArrResult = IsFunction(CurrentEntity)
                                CurrentNested = CurrentEntity
                                If ArrResult <> -1 Then WriteTerm FunctionsDeclare(ArrResult)
                                CurrentSub = CurrentEntity
                                LastFunctionResult = Chr(34) & Chr(34)
                                If ArrResult <> -1 Then If FunctionsReturnType(ArrResult) <> VAR_STRING Then LastFunctionResult = "0"
                                Nested = 1
                                ReDim OldGoSubLabel(0)
                                ReDim OldSelectCaseVar(0)
                                ReDim OldSelectCase(0)
                                ReDim VarToFree(0)
                                WriteFunctionLocalVars
                            Case "FOR"
                                If InTypeDef = True Then GoTo PassLine
                                If InEnumDef = True Then GoTo PassLine
                                StripBlank
                                GetEntity
                                ArrResult = IsVariable(CurrentEntity, 0, VARSEARCH_LOCALGLOBAL)
                                If ArrResult = -1 Then
                                    If StopAtError = True Then
                                        Panic "*** Error: variable expected at line: " & CurrentModLine & ".\n"
                                        WriteText "*** " & CurrentModuleLine & "\n"
                                        GoTo StopAll
                                    Else
                                        DisplayError "variable expected"
                                        GoTo PassLine
                                    End If
                                End If
                                FunctionToExecute = CurrentEntity
                                StripBlank
                                ReadChar
                                StripBlank
                                If GetExpressionHunt(" TO") = False Then
                                    If StopAtError = True Then
                                        Panic "*** Error: TO statement expected at line: " & CurrentModLine & ".\n"
                                        WriteText "*** " & CurrentModuleLine & "\n"
                                        GoTo StopAll
                                    Else
                                        DisplayError "TO statement expected"
                                        GoTo PassLine
                                    End If
                                End If
                                ArgumentsConversion = ""
                                InStringComp = 0
                                InStringSelectCase = False
                                WasStringCmp = False
                                FunctionParm = Parse(FunctionToExecute, CurrentExpr, False, False, False, False, False, False, False, False, False, False, False)
                                SavedForConversion = ArgumentsConversion
                                SavedForBase = FunctionParm
                                ReadChar
                                StripBlank
                                ' Note: negative steps aren't handled yet
                                GetExpressionHunt " STEP"
                                ArgumentsConversion = ""
                                InStringComp = 0
                                InStringSelectCase = False
                                WasStringCmp = False
                                FunctionParm = Parse(FunctionToExecute, CurrentExpr, False, False, False, False, False, False, False, False, False, False, False)
                                SavedForConversion = SavedForConversion & ArgumentsConversion
                                StringToStore = SavedForConversion & GetFor(FunctionToExecute, SavedForBase, FunctionParm)
                                If CurrentChar = "" Then
                                    FunctionParm = 1
                                    GoTo NoStepStatement
                                End If
                                ReadChar
                                StripBlank
                                GetExpression
                                InStringComp = 0
                                InStringSelectCase = False
                                WasStringCmp = False
                                FunctionParm = Parse(FunctionToExecute, CurrentExpr, False, False, False, False, False, False, False, False, False, False, False)
NoStepStatement:                If IsNumeric(FunctionParm) Then
                                    Select Case Sgn(FunctionParm)
                                        Case 1
                                            If FunctionParm = 1 Then
                                                StringToStore = StringToStore & FunctionToExecute & "++"
                                            Else
                                                StringToStore = StringToStore & FunctionToExecute & "=" & FunctionToExecute + "+" & FunctionParm
                                            End If
                                        Case 0
                                            StringToStore = AddNested & "for(;;"
                                        Case -1
                                            If FunctionParm = -1 Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -