Announcement

Collapse
No announcement yet.

Statment too complex

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Statment too complex

    Whats wrong with this?
    Code:
    Function OPT_BarrLogg(ByVal hWnd&)Export As Long
    Local ThreadId As Long
    Local Tmp$,Cnt&,IniFil$
    
      IniFil$=FSO_AppIniFile()
    '--om inget Window så skapa den-------
      If ghBarrLog = 0 Then
       Thread Create CreateBarrForm(hWnd&) To ThreadId
       Thread Close ThreadId To ThreadId
    '--Vänta på att det skapas------------
      End If
    '--om ingen inifil så skapa den------------
    Local X%
      If IsFalse FSO_FileExists(Inifil$) Then
        X%=FreeFile
        Open IniFil For Append Shared As #X%
        Close X%
      End If
    '--läs in från Inifilen---------------
       Sleep 100
    Local i&
      For i& = 1 To 10
       Tmp$ = INI_GetSetting(IniFil$,"BARRLOGG",Format$(i&),"")
       Control Set Text ghBarrLog,100+i&,Tmp$
      Next i&
      Function = %True
    End Function
    Error 402 in LOGGAR.BAS(33:1): Statement too complex
    Line 33: Next i&
    -------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

  • #2
    Fred --
    with "this" nothing wrong
    Code:
    #Compile Exe
    #Register None
    #Dim All
    #Include "Win32Api.Inc"
    
    Global ghBarrLog As Long
    Function FSO_AppIniFile() As String: End Function
    Function CreateBarrForm(ByVal x As Long) As Long: End Function
    Function FSO_FileExists(Nm As String) As Long: End Function
    Function INI_GetSetting(S1 As String, S2 As String, S3 As String, S4 As String) As String: End Function
    
    Function OPT_BarrLogg(ByVal hWnd&)Export As Long
    Local ThreadId As Long
    Local Tmp$,Cnt&,IniFil$
    
      IniFil$=FSO_AppIniFile()
    '--om inget Window så skapa den-------
      If ghBarrLog = 0 Then
       Thread Create CreateBarrForm(hWnd&) To ThreadId
       Thread Close ThreadId To ThreadId
    '--Vänta på att det skapas------------
      End If
    '--om ingen inifil så skapa den------------
    Local X%
      If IsFalse FSO_FileExists(Inifil$) Then
        X%=FreeFile
        Open IniFil For Append Shared As #X%
        Close X%
      End If
    '--läs in från Inifilen---------------
       Sleep 100
    Local i&
      For i& = 1 To 10
       Tmp$ = INI_GetSetting(IniFil$,"BARRLOGG",Format$(i&),"")
       Control Set Text ghBarrLog,100+i&,Tmp$
      Next i&
      Function = %True
    End Function
    
    Function PbMain
       MsgBox "Ok"
    End Function
    But sometimes messages of compiler are enough strange. Look around.

    ------------------

    Comment


    • #3
      This is code in a dll.
      I have six "identical" modules (only globals and function-names differ)
      They all read diffrent sections of a INI-file to the screen
      and after editing saves them back to the Inifile.
      Using 3 modules is OK
      adding the 4th gives this error.
      It does not matter witch module is no4.
      You get the error in "same" function on "same" statment.
      This code is small in size...
      But every module has a DDT-form with 10 labels,10 editbox and 3 buttons. Thats it.


      ------------------
      Fred
      mailto:[email protected][email protected]</A>
      http://www.oxenby.se

      Fred
      mailto:[email protected][email protected]</A>
      http://www.oxenby.se

      Comment


      • #4
        Fred --
        As you understand, without full fragment, which really generates a mistake, it's not possible to say something.

        ------------------

        Comment


        • #5
          This is the complete skeleton-code
          In my first posting I used DDT-code.
          Here I use a resourcefile with dialogs.
          In the forth include-file I get the message from compiler
          I have removed some code with copyright in FOXRUN32.INC
          PBCOMP.EXE (c)F Oxenby AB 1999 http://www.oxenby.se email [email protected]
          -----------------------------------------
          Error 402 in OPT_BARR.BAS(32:1): Statement too complex
          Line 32: For i& = 1 To 10
          ------------------
          <snipped by Administrator>
          ------------------

          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se


          [This message has been edited by Fred Oxenby (edited March 30, 2000).]
          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se

          Comment


          • #6
            Fred, I deleted your code because it's huge size is not appropriate for this forum, given that the code is not in "working order"!

            However, my initial examination is that there does appear to be a problem with the compiler. I'll investigate this further and pass on what I can discover to R&D, and let you know.

            Thanks again!



            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              I just found that adding #REGISTER NONE to the code 'solves' the problem. I'll let R&D know.




              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Thanks Lance,
                #Register None did the trick.
                I had been working with that code too long, but now it is up and running.
                I noticed a cool "optimation-effect" when debugging the code.
                My for/next loops were counting backwards


                ------------------
                Fred
                mailto:[email protected][email protected]</A>
                http://www.oxenby.se

                Fred
                mailto:[email protected][email protected]</A>
                http://www.oxenby.se

                Comment

                Working...
                X