Announcement

Collapse
No announcement yet.

PB Error Codes

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

  • PB Error Codes

    Is there a list somewhere (besides the Help file) that lists all the PB Error codes?

    I have run into a couple that I am unsure what the reply code is???? or if the reply is an error code???

    My best guess is because one code = 9 = "Array out of bounds" and I happen to be working with arrays in that scope, wondering if I am on the right or wrong track, but just guessing at the moment
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    IN the help file type in error and it will list the errors pb will give you.
    KS

    Comment


    • #3
      Code:
      OPEN "ECodes.txt" FOR OUTPUT AS #1
      FOR Z = 1 To about 600, I think
         IF ERROR$(Z) <> "" THEN 
            PRINT #1, USING$("###  &", Z, ERROR$(Z))
         END IF
      NEXT
      PRINT #1, 
      PRINT #1, "END OF REPORT"
      CLOSE #1
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Thanks MCM,
        I guess the ole adage holds true "When the tool does not exist for the job, build the tool"

        I did a quick modification to list PB and API Error Codes
        Code:
        #COMPILE EXE
        #DIM ALL
        #INCLUDE "Win32Api.inc"
        
        FUNCTION PBMAIN () AS LONG
             LOCAL z AS LONG
             LOCAL LastErrorValue AS LONG
             LOCAL ErrorBuff AS ASCIIZ * %MAX_PATH
             OPEN "ECodes.txt" FOR OUTPUT AS #1
                  FOR Z = 0 TO 600'about 600, I think
                       LastErrorValue = z
                       FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, LastErrorValue, %NULL, ErrorBuff, SIZEOF(ErrorBuff), BYVAL %NULL     'Format the message
                       IF ERROR$(Z) <> "" THEN                                     '<--- PB Error
                            PRINT #1, "PB Error: " + USING$("###  &", Z, ERROR$(Z))
                       END IF
                       IF ErrorBuff <> "" THEN                                     '<--- API Error
                            PRINT #1, "API Error: " + USING$("###  &", Z, ErrorBuff)
                       END IF
                  NEXT
                  PRINT #1,
                  PRINT #1, "END OF REPORT"
             CLOSE #1
        END FUNCTION
        Which kind of helps, but looks like I am barking up the wrong tree.

        In my case I am using "SELECT CASE ARRAYATTR(MyArray(), %IsArrayDataType)" where I declared %IsArrayDataType = 1 so to PB the line of code would really be "SELECT CASE ARRAYATTR(MyArray(), 1)"

        My reply back is the datatype = 9 (Which is not documented, so wondering if its an error code?....I am working on a "GetLastError" to find out)

        While building my list I noticed the following values are not documented for ArrayAttr.
        3,9,15,16, and if any values above 24?

        Now that you gave me the idea for listing all the Errors possible, I will have to find the document (MSDN or otherwise) that tells me the possible range(s) of error codes that could be returned no matter what it is that you are doing.
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

        Comment


        • #5
          Error 9 - Subscript / Pointer out of range
          Subscript / Pointer out of range - (%ERR_SUBSCRIPTPOINTEROUTOFRANGE) - You attempted to use a subscript smaller than the minimum or larger than the maximum value established when the array was dimensioned. Attempting to use a null or invalid pointer may also cause this error. Error 9 will only be generated if you have specified #DEBUG ERROR ON.

          From the PB Help under Error 9
          Perhaps?
          Last edited by Rodney Hicks; 17 Dec 2008, 02:57 PM.
          Rod
          I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

          Comment


          • #6
            Thanks Rodney, but in this case with Debug on or off, no error 9 but just a coincidence that I can repeatedly get an ArrayAttr = 9 and it act like an array out of bounds, but not give me that error.

            (By the way, only repeatable in Vista, XP you may as well flip a coin to get an error to show up using #DEBUG DISPLAY ON)

            I am hoping tonight I can finish up a demo to demonstrate the concept in a repeatable manner for debugging.
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              My reply back is the datatype = 9 (Which is not documented, so wondering if its an error code?....I am working on a "GetLastError" to find out)
              What is ERR at this time? If array was undimensioned, an error results, meaning any value you get back from ARRAYATTR is "undefined" (aka "pot luck") (aka "meaningless")
              (GetLastError is ONLY valid for WinAPI calls, not intrinsic calls)

              Restructure your code
              Code:
              AA = ARRAYATTR (myArray(), 1) 
              IF ISFALSE ERR THEN 
                  SELECT CASE AA 
                      read datatype here
              ELSE 
                 PRINT USING$("Can't get ARRAYATRR, ERROR CODE # &", ERR, ERROR$(ERR)) 
              END IF 
              ....
              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                A shot in the dark here.
                SELECT CASE ARRAYATTR(MyArray(), %IsArrayDataType)
                Does MyArray() contain pointers?
                I realize that ARRAYATTR is used to get info about the array, but I'm wondering if because the array contains an null or invalid pointer that you're getting the error value instead of what you want to know.(In other words, the problem lay elsewhere.)
                Rod
                I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

                Comment


                • #9
                  I almost have a demo together but MCM reminded me of another case of "CNDS" which thankfully this time did not follow (MSGBOX STR$(ERR) + ERROR$(ERR) came up with no error)

                  Unthankfully, no closer to figuring out how ArrayAttr gives a value that koinki-dink happens to be "Array out of bounds")

                  I looked at DDT vs API error checks hoping to find a clue, but no good (and a last second check from your post hoping I missed something)

                  Hopefully I have something in a few, but in the meanwhile I have to ask....

                  What would be the easiest to follow???
                  1.) Pb Exe calling the Dll
                  2.) Vb Exe calling the Dll
                  3..... Oh forget it....I will make 1 of each and let the user pick what they can read best because I am on the verge of submitting to PB, but the problem is not really a "Bug" but more something I am missing from my gut feeling
                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment


                  • #10
                    WOW....even prepping to post, I find what MCM would call "Verb for Verb" kind of concept is not viable, but just prepping to post I find another anomaly of "EXE compiled....causes different ArrayAttr responses"

                    Hopefully tonight if not tomorrow I can make enough sense of it to show all the confusion (GAHHHHHH isnt it puzzling when multi-language, multi-OS, Multi-System even possibly and try to make sense of "Toooooo many Unknowns???? )

                    (Good news is at least I am getting close to knowing how to ask, bad is, when I ask, will anyone know how to explain it???)
                    Engineer's Motto: If it aint broke take it apart and fix it

                    "If at 1st you don't succeed... call it version 1.0"

                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                    Comment


                    • #11
                      Unthankfully, no closer to figuring out how ArrayAttr gives a value that koinki-dink happens to be "Array out of bounds")
                      I told you above: if there was an ERR on that call, the value you got back don't mean squat!

                      If there was no ERR and ARRAYATTR returns an undocumented value you have bug report to file.
                      Michael Mattias
                      Tal Systems (retired)
                      Port Washington WI USA
                      [email protected]
                      http://www.talsystems.com

                      Comment


                      • #12
                        but I'm wondering if because the array contains an null or invalid pointer that you're getting the error value instead of what you want to know.(In other words, the problem lay elsewhere.)
                        Data content is moot when calling ARRAYATTR, which only (only?) has to read the array descriptor.

                        However, you may be on to something. Corruption ELSEWHERE in your program (e.g., proceeding willy-nilly after an error, overruning a buffer) can corrupt that descriptor. This will NOT be fun to find.

                        MCM
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Ok, this is what I have so far.

                          PB call PbDll
                          Executable
                          Code:
                          '*** Stripped down to just Test Executable
                          #COMPILE EXE   "PB9 Test Array Global Memory Corrupt"  'Keep PB9 for Demo of DataType changes
                          #DIM ALL                                               'Declare EVERYTHING
                          
                          #DEBUG ERROR OFF                                       'To trap runtime errors and buffer overflows
                          ''#DEBUG ERROR ON                                       'To not execute runtime errors and buffer overflows but show in debugger
                          #DEBUG DISPLAY ON                                      'Enable runtime error display mode within a compiled PowerBASIC program
                          #INCLUDE "Win32Api.inc"                                'Windows Includes
                          
                          TYPE HardDriveInformation
                               HardDriveName AS ASCIIZ * %MAX_PATH
                          END TYPE
                          
                          DECLARE FUNCTION TestFunction LIB "ArrayGlobalMemoryCorrupt.dll" ALIAS "TestFunction"(MyArray() AS HardDriveInformation)AS LONG
                          
                          FUNCTION PBMAIN () AS LONG
                               LOCAL TempArray() AS HardDriveInformation
                               TestFunction TempArray()
                          END FUNCTION
                          Dll
                          Code:
                          '*** Stripped down to only compile DLL
                          #COMPILE DLL                                           'Uncomment for Dll
                          #DIM ALL                                               'Declare EVERYTHING
                          
                          #DEBUG ERROR OFF                                       'To trap runtime errors and buffer overflows
                          '#DEBUG ERROR ON                                       'To not execute runtime errors and buffer overflows but show in debugger
                          #DEBUG DISPLAY ON                                      'Enable runtime error display mode within a compiled PowerBASIC program
                          
                          #INCLUDE "Win32Api.inc"                                'Windows Includes
                          
                          '*** Equates for ARRAYATTR
                          %IsArrayDimensioned           = 0
                          %IsArrayDataType              = 1
                          %IsArrayPointers              = 2
                          %IsArrayTotalDimensions       = 3
                          %IsArrayTotalElements         = 4
                          %IsArrayElementSize           = 5
                          
                          '*** Bogus Equates for ARRAYATTR just so happens to return values not documented but Kowinky-Dink match error codes????
                          %VARCLASS_PathNotFound        = 3                      '<--- Undefined equates but guessing at error code?
                          %VARCLASS_ArrayOutOfBounds    = 9                      '<--- Undefined equates but guessing at error code?
                          %VARCLASS_DriveNotFound       = 15                     '<--- Undefined equates but guessing at error code?
                          %VARCLASS_CantRemoveDirectory = 16                     '<--- Undefined equates but guessing at error code?
                          
                          'Return values from %IsArrayDataType, 1
                          'Type      Array     Keyword           Equate
                          '          type
                          '-----     -----     -------        -------------
                          ' 0        Byte      BYTE           %VARCLASS_BYT
                          ' 1        Word      WORD           %VARCLASS_WRD
                          ' 2        Double    DWORD          %VARCLASS_DWD
                          '          Word
                          ' 3                                 %VARCLASS_PathNotFound            '<--- Not Documented, (but guessing value = Error Value???)
                          ' 4        Integer   INTEGER        %VARCLASS_INT
                          ' 5        Long      LONG           %VARCLASS_LNG
                          '          Integer
                          ' 6        Unsigned  n/a            %VARCLASS_BIT
                          '          Bit
                          ' 7        Signed    n/a            %VARCLASS_SBT
                          '          Bit
                          ' 8        Quad      QUAD           %VARCLASS_QUD
                          '          Integer
                          ' 9                                 %VARCLASS_ArrayOutOfBounds        '<--- Not Documented, (but guessing value = Error Value???)
                          ' 10       Single    SINGLE         %VARCLASS_SNG
                          '          Precision
                          ' 11       Double    DOUBLE         %VARCLASS_DBL
                          '          Precision
                          ' 12       Extended  EXT            %VARCLASS_EXT
                          '          Precision
                          ' 13       Currency  CURRENCY       %VARCLASS_CUR
                          ' 14       Extended  CURRENCYX      %VARCLASS_CUX
                          '          Currency
                          ' 15                                %VARCLASS_DriveNotFound           '<--- Not Documented, (but guessing value = Error Value???)
                          ' 16                                %VARCLASS_CantRemoveDirectory     '<--- Not Documented, (but guessing value = Error Value???)
                          ' 17       Variant   VARIANT        %VARCLASS_VRNT
                          ' 18       Interface INTERFACE      %VARCLASS_IFAC
                          ' 19       GUID      GUID           %VARCLASS_GUID
                          ' 20       UDT       TYPE/UNION     %VARCLASS_TYPE
                          '          Or Union
                          ' 21       ASCIIZ    ASCIIZ/ASCIZ   %VARCLASS_ASC
                          '          String
                          ' 22       Fixed     STRING * n     %VARCLASS_FIX
                          '          Length
                          '          String
                          ' 23       Dynamic   STRING         %VARCLASS_STR
                          '          String
                          ' 24       Field     FIELD          %VARCLASS_FLD
                          '          String
                          
                          TYPE HardDriveInformation
                               HardDriveName AS ASCIIZ * %MAX_PATH
                          END TYPE
                          
                          DECLARE FUNCTION TestFunction ALIAS "TestFunction"(MyArray() AS HardDriveInformation)AS LONG
                          
                          '-------------------------------------------------------------------------------
                          ' Main DLL entry point called by Windows...
                          '
                          FUNCTION LIBMAIN (BYVAL hInstance AS LONG, BYVAL fwdReason AS LONG, BYVAL lpvReserved AS LONG) AS LONG
                               SELECT CASE fwdReason
                                    CASE %DLL_PROCESS_ATTACH
                                         FUNCTION = 1   'success!
                                         'FUNCTION = 0   'failure!  This will prevent the EXE from running.
                                    CASE %DLL_PROCESS_DETACH
                                         FUNCTION = 1   'success!
                                         'FUNCTION = 0   'failure!  This will prevent the EXE from running.
                                    CASE %DLL_THREAD_ATTACH
                                         FUNCTION = 1   'success!
                                         'FUNCTION = 0   'failure!  This will prevent the EXE from running.
                                    CASE %DLL_THREAD_DETACH
                                         FUNCTION = 1   'success!
                                         'FUNCTION = 0   'failure!  This will prevent the EXE from running.
                               END SELECT
                          END FUNCTION
                          
                          FUNCTION TestFunction ALIAS "TestFunction"(MyArray() AS HardDriveInformation) EXPORT AS LONG
                               LOCAL MyTest1 AS CURRENCY
                               LOCAL MyTest2 AS CURRENCY
                               LOCAL i AS LONG
                               LOCAL msg AS STRING
                               LOCAL LastErrorValue AS LONG
                               LOCAL ErrorBuff AS ASCIIZ * %MAX_PATH
                               LOCAL ModuleHandle AS LONG
                               LOCAL ExePath AS ASCIIZ * %MAX_PATH
                          '*** Works whether compiled or interpreted
                          0                                            'Line Number Marker for #DEBUG DISPLAY
                               SELECT CASE ARRAYATTR(MyArray(), %IsArrayDimensioned)
                                    CASE 0         'False/0
                                         msg = msg + "Array Not Dimensioned" + $CR
                                    CASE ELSE         'True = -1 or some NON-Zero value
                                         msg = msg + "Array Dimensioned" + $CR
                               END SELECT
                               SELECT CASE ARRAYATTR(MyArray(), %IsArrayPointers)
                                    CASE 0         'False/0
                                         msg = msg + "Array of Non - Pointers" + $CR
                                         SELECT CASE ARRAYATTR(MyArray(), %IsArrayDataType)          'Get the Array Data Type
                          '*** PB calling PB causes this so I have to investigate cause core concept was why VB returns an invalid type
                                              CASE %VARCLASS_BYT, 0
                                                   msg = msg + $CR
                                                   msg = msg + STRING$(30, "-") + " QUESTION POINT " + STRING$(30, "-") + $CR
                                                   msg = msg + "Array DataType = %VARCLASS_BYT" + $CR
                                                   msg = msg + "Vb calls '%VARCLASS_ArrayOutOfBounds, 9'" + $CR
                                                   msg = msg + "Pb calls %VARCLASS_BYT, 0" + $CR
                                                   msg = msg + "Why the difference?????" + $CR
                                                   msg = msg + STRING$(28, "-") + " END QUESTION POINT " + STRING$(28, "-") + $CR
                                              CASE %VARCLASS_WRD, 1
                                                   msg = msg + "Array DataType = %VARCLASS_WRD" + $CR
                                              CASE %VARCLASS_DWD, 2
                                                   msg = msg + "Array DataType = %VARCLASS_DWD" + $CR
                                              CASE %VARCLASS_PathNotFound, 3
                                                   msg = msg + "Array DataType = %VARCLASS_PathNotFound" + $TAB + "(BOGUS value)" + $CR
                                              CASE %VARCLASS_INT, 4
                                                   msg = msg + "Array DataType = %VARCLASS_INT" + $CR
                                              CASE %VARCLASS_LNG, 5
                                                   msg = msg + "Array DataType = %VARCLASS_LNG" + $CR
                                              CASE %VARCLASS_BIT, 6
                                                   msg = msg + "Array DataType = %VARCLASS_BIT" + $CR
                                              CASE %VARCLASS_SBT, 7
                                                   msg = msg + "Array DataType = %VARCLASS_SBT" + $CR
                                              CASE %VARCLASS_QUD, 8
                                                   msg = msg + "Array DataType = %VARCLASS_QUD" + $CR
                                              CASE %VARCLASS_ArrayOutOfBounds, 9                          '<--- Not sure but guessing Array out of bounds due to asking the type???
                          MSGBOX STR$(ERR) + ERROR$(ERR)
                                                   msg = msg + "Array DataType = %VARCLASS_ArrayOutOfBounds" + $TAB + "(BOGUS value)" + $CR
                                              CASE %VARCLASS_SNG, 10
                                                   msg = msg + "Array DataType = %VARCLASS_SNG" + $CR
                                              CASE %VARCLASS_DBL, 11
                                                   msg = msg + "Array DataType = %VARCLASS_DBL" + $CR
                                              CASE %VARCLASS_EXT, 12
                                                   msg = msg + "Array DataType = %VARCLASS_EXT" + $CR
                                              CASE %VARCLASS_CUR, 13
                                                   msg = msg + "Array DataType = %VARCLASS_CUR" + $CR
                                              CASE %VARCLASS_CUX, 14
                                                   msg = msg + "Array DataType = %VARCLASS_CUX" + $CR
                                              CASE %VARCLASS_DriveNotFound, 15
                                                   msg = msg + "Array DataType = %VARCLASS_DriveNotFound" + $TAB + "(BOGUS value)" + $CR
                                              CASE %VARCLASS_CantRemoveDirectory, 16
                                                   msg = msg + "Array DataType = %VARCLASS_CantRemoveDirectory" + $TAB + "(BOGUS value)" + $CR
                                              CASE %VARCLASS_VRNT, 17
                                                   msg = msg + "Array DataType = %VARCLASS_VRNT" + $CR
                                              CASE %VARCLASS_IFAC, 18
                                                   msg = msg + "Array DataType = %VARCLASS_IFAC" + $CR
                                              CASE %VARCLASS_GUID, 19
                                                   msg = msg + "Array DataType = %VARCLASS_GUID" + $CR
                                              CASE %VARCLASS_TYPE, 20
                                                   msg = msg + "Array DataType = %VARCLASS_TYPE" + $CR
                                              CASE %VARCLASS_ASC, 21
                                                   msg = msg + "Array DataType = %VARCLASS_ASC" + $CR
                                              CASE %VARCLASS_FIX, 22
                                                   msg = msg + "Array DataType = %VARCLASS_FIX" + $CR
                                              CASE %VARCLASS_STR, 23
                                                   msg = msg + "Array DataType = %VARCLASS_STR" + $CR
                                              CASE %VARCLASS_FLD,24
                                                   msg = msg + "Array DataType = %VARCLASS_FLD" + $CR
                                              CASE ELSE
                                                   msg = msg + "Array DataType = %Unknown Value = " + STR$(ARRAYATTR(MyArray(), %IsArrayDataType)) + $CR
                                         END SELECT
                                    CASE ELSE         'True = -1 or some NON-Zero value
                                         msg = msg + "Array of Pointers" + $CR
                               END SELECT
                               msg = msg + $CR
                               ModuleHandle = GetModuleHandle($NUL)                        'Get Module Handle
                               GetModuleFileName(ModuleHandle, ExePath, %MAX_PATH)         'Get Parent Path and Name
                               ExePath = UCASE$(ExePath)
                               msg = msg + "Parent Executable = " + ExePath + $CR
                               msg = msg + $CR
                               SELECT CASE INSTR(ExePath, UCASE$("VB6.exe"))
                                    CASE 0                                                 'Demo is being run as compiled and works correctly
                                         msg = msg + "lBound = " + STR$(LBOUND(MyArray)) + $CR       '<--- Vista reports pointer location instead of LBOUND?????
                                         msg = msg + "uBound = " + STR$(UBOUND(MyArray)) + $CR       '<--- Vista reports pointer location instead of UBOUND?????
                                         msg = msg + "Array Size = " + STR$(UBOUND(MyArray) - LBOUND(MyArray)) + $CR
                                         msg = msg + $CR
                                    CASE ELSE                                              'Demo is Interpreted and works, but pointers used instead of bounds and size????
                                         msg = msg + "lBound XP = " + STR$(0) + $CR                  '<--- Bogus value because example on Vista, but XP always reported correctly
                                         msg = msg + "lBound = " + STR$(LBOUND(MyArray)) + $TAB + "(Vista Pointer and not LBOUND???)" + $CR       '<--- Vista reports pointer location instead of LBOUND?????
                                         msg = msg + $CR
                                         msg = msg + "uBound XP = " + STR$(-1) + $CR                 '<--- Bogus value because example on Vista, but XP always reported correctly
                                         msg = msg + "uBound = " + STR$(UBOUND(MyArray)) + $TAB + "(Vista Pointer and not UBOUND???)" + $CR       '<--- Vista reports pointer location instead of UBOUND?????
                                         msg = msg + $CR
                                         msg = msg + "Array Size XP = " + STR$(0 - 1) + $TAB + "(XP valid only, Vista pointer - pointer <> arraysize)" + $CR
                                         msg = msg + "Array Size = " + STR$(UBOUND(MyArray) - LBOUND(MyArray)) + $TAB + "(XP only, Vista pointer - pointer <> arraysize)" + $CR
                                         msg = msg + $CR
                               END SELECT
                               LastErrorValue = GetLastError()
                               FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, LastErrorValue, %NULL, ErrorBuff, SIZEOF(ErrorBuff), BYVAL %NULL     'Format the message
                               msg = msg + "Last Error = " + STR$(LastErrorValue) + " " + ErrorBuff + $CR
                               msg = msg + "Array Element = " + STR$(i)
                               MSGBOX msg
                          '*** Passes if I preserve memory location
                          1                                            'Line Number Marker for #DEBUG DISPLAY
                               REDIM PRESERVE MyArray(i)          '<--- Demo Error with Redim PRESERVE
                          '*** Commands for steps 2 and 3 are the same as just shortcut of "REDIM" so commented out for demo purpose
                          '2                                            'Line Number Marker for #DEBUG DISPLAY
                          '     erase MyArray()                    '<--- Demo Error with Erase/Dim = ReDim
                          '3                                            'Line Number Marker for #DEBUG DISPLAY
                          '     DIM MyArray(i)                     '<--- Demo Error with Erase/Dim = ReDim
                          '*** Fails because Memory Location changes????
                          4                                            'Line Number Marker for #DEBUG DISPLAY
                                REDIM MyArray(i)                   '<--- Demo Error with Redim
                          '*** Interpreted never gets this far
                          5                                            'Line Number Marker for #DEBUG DISPLAY
                               Msg = "VB Compiled makes it this far with VarPtr = " + STR$(VARPTR(MyArray())) + $CR
                               msg = Msg + $TAB + "and THENNNNN crashes, after the corruption" + $CR + "But Interpreted does not???" + $CR + $CR
                               Msg = Msg + "PB Compiled makes it this far with VarPtr = " + STR$(VARPTR(MyArray())) + $CR
                               Msg = Msg + $TAB + "and no crash (probably because I 'OWN' the memory used and released????"
                               MSGBOX Msg
                          END FUNCTION
                          I know this is still rough, but figuring it out.
                          Engineer's Motto: If it aint broke take it apart and fix it

                          "If at 1st you don't succeed... call it version 1.0"

                          "Half of Programming is coding"....."The other 90% is DEBUGGING"

                          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                          Comment


                          • #14
                            This will NOT be fun to find.
                            Time for the forensic experts.
                            Rod
                            I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

                            Comment


                            • #15
                              If you look in the pbwin.cnt file in the bin directory, all of the compile time and run time errors are under section 3.
                              KS
                              p.s. Sorry I did'nt notice the "in the help file" when I first read the message"

                              Comment


                              • #16
                                CLiff you are so close...
                                Code:
                                SELECT CASE ARRAYATTR(MyArray(), %IsArrayDimensioned)
                                          CASE 0         'False/0
                                               msg = msg + "Array Not Dimensioned" + $CR
                                          CASE ELSE         'True = -1 or some NON-Zero value
                                               msg = msg + "Array Dimensioned" + $CR
                                     END SELECT
                                     SELECT CASE ARRAYATTR(MyArray(), %IsArrayPointers)
                                Maybe you want to Exit your function with an error code if the array is not dimensioned, instead of continuing to use the invalid descriptor which was passed?

                                Any other calls to ARRAYATTR should be returing some kind of error, meaning any "values" it returns may as well be the product of this week's "Pick Three" drawing.

                                MCM
                                Michael Mattias
                                Tal Systems (retired)
                                Port Washington WI USA
                                [email protected]
                                http://www.talsystems.com

                                Comment


                                • #17
                                  Thanks MCM, I thought of that too, but the original code intent was to dimension the array if it was not dimensioned, and then fill it.

                                  The other thing I still can not figure out is why calling the same function from different languages shows different array types when passed the same type from each language?
                                  Engineer's Motto: If it aint broke take it apart and fix it

                                  "If at 1st you don't succeed... call it version 1.0"

                                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                  Comment


                                  • #18
                                    OK fine - if not allocated, REDIM and fill - but your example code does not do that, meaning you are using an invalid descriptor meaning all your output is crap.

                                    The other thing I still can not figure out is why calling the same function from different languages shows different array types when passed the same type from each language
                                    TOP TEN... well, that will keep.

                                    "Array" (capitalized) is a PowerBASIC-proprietary entity. It is provided to facilitate table handling. The proprietary entity uses a proprietary array descriptor to support all Array (capitalized) access and operations.

                                    "array" (small letters) is a generic term, generally meaning "multiple discrete data items organized within a contiguous block of memory."

                                    So of course another language product is not going to recognize PB "Arrays" as whatever that language thinks of when it does "arrays."

                                    BTW look on the bright side: there was once a time when PB did not recognize its own array datatypes. (6x and 7x UDT arrays used a different datatype value).

                                    MCM
                                    Michael Mattias
                                    Tal Systems (retired)
                                    Port Washington WI USA
                                    [email protected]
                                    http://www.talsystems.com

                                    Comment

                                    Working...
                                    X