Macro: OBJECT$PROPERTIES

Module location: FMAC line 11010 (view source)

  #DATA

  #IFDEF !2         // is message in a variable?
    #DPUSH !2           // yes, just push the value
  #ELSE
    #IFDEF !1_!2        // is this message defined?
      #DPUSH !1_!2      // yes, push the definition
    #ELSE
      // If there is no message defined, try matching with mangled symbol.
      #IFSAME !1 GET
        #MANG !1_!2 !4 !5 !6 !7 !8 !9
      #ELSE
        #MING !1_!2 !4 !5 !6 !7 !8 !9
      #ENDIF
      // Push it, if we can, or push a fref to the mangled name.
      // Fwd refs try to match without the syntactic sugar first.
      #IFDEF !?
      
        // Overloading does not allow File_Field, Field or Item (get only)
        #IFSAME FILE_FIELD !2 !3 !4 !5 !6 !7 !8 !9
          #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION "FILE_FIELD keyword not allowed in Overloaded messages"
        #ELSE
          #IFSAME FIELD !2 !3 !4 !5 !6 !7 !8 !9
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION "FIELD keyword not allowed in Overloaded messages"
          #ELSE
            #IFSAME !1 GET // GET's #mang does not test for ITEM so we disallow it here.
              #IFSAME ITEM !2 !3 !4 !5 !6 !7 !8 !9
                #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION "ITEM keyword not allowed or needed in GET Overloaded messages"
              #ENDIF  
            #ENDIF  
          #ENDIF
        #ENDIF
        
        #DPUSH !?
      #ELSE
        #DPUSH |CI0       // forward reference the message
        #FREF !? !a,0      // add the reference to be defined
      #ENDIF
    #ENDIF
  #ENDIF

  #PUSH !Zg
  #SET ZG$ 0

  #PUSH !Zh
  #SET ZH$ 2  // 3 unrestricted params following TO and TO is optional
  #IF (!Zl & 1)
    #SET ZH$ 3  // Its ok...no fancy checking
  #ELSE
    #IFSAME !1 GET
      #SET ZH$ 1  // 1 means 1 param following TO
    #ELSE
      #IFSAME DFLT$2$!2 __2__  // is this a complex set message? (more than 1 param)
      #ELSE
        #IFSAME DFLT$!2 __X__ __F__  // is this a item or form type message?
        //#IFSAME DFLT$!2 __F__  // is this a item or form type message?
          #SET ZH$ 1  // 1 means 1 param following TO
        #ENDIF
      #ENDIF
    #ENDIF
  #ENDIF

  PROPERTY$HELP !4 !5 !6 !7 !8 !9

  #POP ZH$
  #POP ZG$

  // Precedence of Object ID resolution
  // 1. If variable (hopefully local)
  // 2. if expression
  // 3. If .obj (old style, to be avoided)
  // 4. If object access id

  #IFDEF !3 // if a variable, constant or expression...it's defined
    OBJECT$DEFINE !1 !3
  #ELSE

    // remove object.OBJ check - must explicitly add .obj if you want it
    //#IFDEF !3.OBJ   // old style: If global object or defined w/ .obj (ugh)
    //  OBJECT$DEFINE !1 !3.OBJ
    //#ELSE

      #IFDEF GET_!3 // if defined as a function
        #IF (GET_!3>$40000000) // and an object access method
          // replace simple name with expression syntax
          OBJECT$DEFINE !1 (!3(Current_object))
        #ELSE // if defined as a function but not an access method. This is an error
          #ERROR DFERR_COMP_INVALID_OBJECT_REFERENCE "Already defined as a function"
        #ENDIF
      #ELSE
        // 12.0 change:
        // !3 is not defined but we will pass this on and allow the compiler to attempt to resolve it
        OBJECT$DEFINE !1 (!3(Current_object))

        //// not yet defined. We could either forward ref as object or
        //// declare an error. For now let's just do an error.
        //#ERROR DFERR_COMP_INVALID_OBJECT_REFERENCE Object .not. yet defined
        //// here is how we would forward ref as obj
        ////Register_object !3
        ////!A [] OBJ$!1 (!3(Current_object)) |VL
      #ENDIF

    //#ENDIF
  #ENDIF