Macro: SCALAR$PROPERTY

Module location: FMAC line 12689 (view source)

  #IFSAME !3 PRIVATE
    PROPERTY !1 !$.!2 PUBLIC !4
  #ELSE
    #IFSAME !3 PUBLIC

      // Check property for proper placement
      // 1. Must be in class or object
      // 2. Cannot be in a child object defined by a class
      // 3. If in class, must be in procedure (constructor)
      // 4. If in object, must not be in procedure.

      #IF ((!Zl & 1) = 0)
        #IF (!b & 3 ) // Within class or object? It should be
          #IF ((!b & 3)=3 ) // but not both....Error
            #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Property cannot be defined in an object within a class
          #ELSE
            #IF (!b & 2)        // in-class: Must be within a method (constructor)
              #IF ( (!b & 4)=0) // in-class and not in method...bad
                #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Class Property must be defined within a constructor procedure
              #ENDIF
            #ELSE // in-object: Cannot be in method
              #IF (!b & 4)  // if within object and within method...an error
                #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Object Property cannot be in a method
              #ENDIF
            #ENDIF
          #ENDIF
        #ELSE
          #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Property can only be defined within a class or object
        #ENDIF
      #ENDIF

      #IF (!b & 1 ) // if within object
        !A [] CLONE$CLASS     // Create a new class
      #ENDIF

      #IF ( (!Zl & 1)=0)
        #IFSAME FN$!2  __F__
          #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION !2 is an internal function name
        #ENDIF
      #ENDIF

      // Check for GET_ name conflicts as follows:
      //  1. If defined as an overloaded message - error
      //  2. If defined as object access - error
      //  3. If defined as global method - error

      #IFDEF GET_!2_OVERLOADED
        #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION This GET Method Was Previously Defined As Overloaded
      #ELSE
        #IFDEF GET_!2
          #IF (GET_!2>$40000000)
            #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION GET !2 is already defined as an object name
          #ELSE
            #IF (GET_!2<0)
              #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION GET !2 is already defined as a global function
            #ENDIF // note else condition...defined as proeprty or class function...this is ok
          #ENDIF
        #ELSE
          MESSAGE$ADDRESS GET_!2
        #ENDIF
      #ENDIF

      #DATA           // Start the property

      #DPUSH GET_!2       // Push the get property id
      #FREG GET_!2 RETURNS !1

      // Make sure Set message not defined as overloaded or global
      #IFDEF SET_!2_OVERLOADED
        #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION This SET Method Was Previously Defined As Overloaded
      #ELSE
        #IFDEF SET_!2
          #IF (SET_!2<0)
            #ERROR DFERR_COMP_ILLEGAL_PROPERTY_DEFINTION SET !2 is already defined as a global message
          #ENDIF
        #ELSE
           MESSAGE$ADDRESS SET_!2
        #ENDIF
      #ENDIF

      #DPUSH SET_!2       // Push the set property id
      #PREG SET_!2 !1
      #DTYPE Q$ !1        // get the property type in q
      #DPUSH |CI!q        // push the type
      #IF (!q=19)
        //It's a struct, so we must push the struct metadata as well
        #PUSH !h
        #STRG H$ !1
        #DPUSH |CI!h
        #POP H$
      #ENDIF
      #IF (!0 > 3)
        #DPUSH !4
      //#ELSE                // 10/30/1997: If no default param is passed force
        //SF - This has been moved to the runtime now
        //SF - We may want to change this logic and not provide a default value at all.
        //The runtime can easily be changed to handle this better.
        //#IFSAME !1 ROWID
        //  //Do nothing, RowID should not have a default value
        //  //i.e. there are no constant RowIDs, and string to RowID conversion is illegal
        //#ELSE
        //  #IFSAME !1 STRING DATETIME TIME TIMESPAN  // a default value. String types require
        //    #DPUSH |CS''     // a string, all others are numeric. This
        //  #ELSE              // fixes a problem in the runtime where
        //    #DPUSH |CI0      // dates and numbers did not initialize properly
        //  #ENDIF             // when no initial param was passed in the command
        //#ENDIF
      #ENDIF
      !A [] CREATE$PROPERTY |CI0 |VL
    #ELSE
      // this supports syntax of "property Integer Prop 10"
      PROPERTY !1 !2 PUBLIC !3
    #ENDIF
  #ENDIF