Announcement

Collapse
No announcement yet.

Equates & PBCC5.0

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

  • Equates & PBCC5.0

    Hi All,

    I’m sure I am missing something obvious here, but for the life of me I can’t see what it is. I recently upgraded from PBCC4.0 to PCBB5.0 and have a curious problem with equates.

    My program is quite large and has been broken down into several smaller files with common numeric and string equates being defined in their own file and ‘INCLUDED’ at the top of the main source code.

    The program structure is a little like this …

    Main Source File <-- Main File
    ..
    ..
    #INCLUDE “Myfile1.Inc” <-- First (Nested) Include File
    ..
    ..
    #INCLUDE “Myfile2.Inc” <-- Second (Nested) Include File
    ..
    ..
    #INCLUDE “Myfile3.Inc” <--Third (Nested) Include File
    ..
    %MyNumericEquate = 1
    ..
    <EOF>
    <EOF>
    <EOF>
    ..
    PRINT “My Equate =”+STR$(%MyNumericEquate) <-- Main File
    END

    ‘MyNumericEquate’ is defined in a nested include file (Max nesting level = 4 including the main source file), the result when printed is ‘My Equate = 1’ as you would expect.

    My problem is this, if I change %MyNumericEquate=0, then run the program again, I still get the same result, i.e. ‘My Equate = 1’ ???

    This works fine in PBCC4.0, what new about equates in PBCC5.0? Anyone have any ideas?
    Richard

  • #2
    It's in the doc...somewhere. Equates can now be redefined with a different value without error as long as that equate has not yet been used.

    Sounds like your nesting has inadvertently redefined "%myequate" somewhere.

    You may want to look at two additional options, two old, one new

    Old option %DEF ... #IF [NOT] %DEF (%myequate) .... %myequate = value ...#ENDIF
    Old option, additional control at the #INCLUDE file level... eg #IF NOT %DEF(%WINAPI) < remainder of file contents)..... #ENDIF
    New option #INCLUDE ONCE
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      It's in the doc...somewhere.
      Under Additional Changes:
      Any numeric equate or string equate which is pre-defined in the compiler may be assigned a revised value if the new assignment is performed before the equate is referenced in the program.
      Rod
      I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

      Comment


      • #4
        BTW as shown your includes are only 2nd level nested. They look like they're all in Main Source file.

        If "#INCLUDE “Myfile1.Inc" statement is in the Main Source File, and the
        #INCLUDE “Myfile2.Inc” statement is in Myfile1.inc file, and the "#INCLUDE “Myfile3.Inc" statement is in Myfile2.Inc file, then you have four levels of nesting.

        In PB 8 Help I don't see a limit on the number of #INCLUDES that can be in a file, just the nesting level.

        In PB 8 the max nesting, including macros, is six levels. Decreased in PB 9?

        Cheers,
        Last edited by Dale Yarker; 28 Oct 2008, 11:23 AM.
        Dale

        Comment


        • #5
          I thank you for your comments, however the very same program compiled on PBCC4.03 worked fine? I have changed nothing since other than to upgrade to the new compiler PBCC5.0

          I'm sure it's just finger trouble, I will do some more investigating when I get time.
          Richard

          Comment


          • #6
            [email protected]?

            That's what they are there for!
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Did you find the problem?
              How long is an idea? Write it down.

              Comment

              Working...
              X