Macro: DF$OBJECT

Module location: FMAC line 10813 (view source)

  #IF (!b & 2) // if within a class
    #IF ( (!b & 4)=0 ) // should be within a method
      #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Objects in classes should be within a method
    #ENDIF
  #ENDIF

  // if we are within a method we will keep track of the number of
  // nested objects. When the method ends we will verify that this is 0.
  // This lets us warn about mismathed object/end-object commands
  #IF ( !b & 4)   // if object within method
    #SET ZM$ !ZM  // increment
  #ENDIF


  #DATA                   // start up the data stream
  #PUSH !Zj               // save the unique object label
  #PUSH !b                // save current definition state

  #IF (!b > 0)            // if not global..we make no guesses about
                          // dependent numbers. Let the runtime assign
                          // dependent order.
  //#IF (!b = 4)          // if in procedure and not class
    #SET ZJ$ 0            // do not inc z
  #ELSE
    #SET ZJ$ !ZB          // assign the next object id
  #ENDIF
  #PUSH !Zb               // save this level on stack
  #IFDEF !4.AGG           // was this a class with sub objects?
    #SET ZB$ !4.AGG       // sub objects will begin at the
  #ELSE                   // next object after superclass
    #SET ZB$ 0            // base classes start at 0
  #ENDIF
  #SET ZI$ !ZI            // count this object at the current level
  #PUSH !Zi               // and push the level
  #IF (!b > 0)            // if (in_object | in_class)
    #IF (!b & 2)          // obj_flag == in_class?
      #IF (!b & 1)        // obj_flag == in_Object?
      #ELSE               // No Name for Subobject in constructor
        // don't define this anymore...
        //#REPLACE !$.!1.OBJ |CI-!Zj  // object_name = -current_object
      #ENDIF
    #ENDIF
    // (LS) removed setting of ZJ; it is NOT being used.
    // (Removed when max lines increased > 32k)
    //      #SET ZJ$ (32766-!a)           // a very unique label for this object
    #DPUSH |CS".!1"           // make name from parent and child
  #ELSE               // global object name
    #DPUSH |CS"!1"            // assign an absolute name to object
  #ENDIF
  #CHECK U_!4 _U          // does class exist?
  #DPUSH U_!4             // define then class the class id
  GET$OBJ$IMAGE !5            // define the objects image
  #IF ((!b & 3) = 2)          // if in_class & !in_object
    // don't assign dep nums anymore
    //#DPUSH !$.!1.OBJ          // pick the assigned dependant number
    // New code just sets 0
    #DPUSH |CI0           // pick the next dependant number
  #ELSE               //
    #IF (!b = 0)          // A global object must assign #
      #IFDEF !1.OBJ           // Is the symbol defined, name_object?
        #DPUSH |CI0           // pick the next dependant number
      #ELSE
        #DPUSH |CI!Zj         // force the dependant number
//        #SET ZJ$ ($1000+!Zj)       // mark as global object
        #SET ZJ$ ($10000000+!Zj)   // using 32-bit ids now
        // as of 8.3 we no longer use dependent lists so we cannot create the ObjName.obj symbol anymore. This method of ussage has
        // been deprecated since early framework days and it is now no longer suppoted. The only way you can use the .obj method is to
        // use name_object, which moves this into a global integer variable. Developers are advised to change the ObjName.obj to
        // (ObjName(desktop)).
        // Also I don't think the above Zj is even needed, but for now they remain.
        //#REPLACE !1.OBJ |CI!Zj        // Assign an ID to this object
      #ENDIF
    #ELSE
      #DPUSH |CI0         // pick the next dependant number
    #ENDIF
  #ENDIF
  REGISTER_OBJECT !1
  #DPUSH GET_!1
  #SET B$ (!b | 1)            // we are in a object definition
  !A [] OBJ$CREATE |VL        // create the object now

  #IFDEF !1.OBJ
    #IFCLASS !1.OBJ V$        // does this object have a global?
      MOVE CURRENT_OBJECT TO !1.OBJ   // Move the object id to its global
    #ENDIF
  #ENDIF

  #SPUSH   //save the old class name
  #SET $$ !4
  #IFSUB '!$$SC' // if flex-defined class
    #IFSUB '!$$SM' // if begin-instance macro exists
      #IFDEF IS$WINDOWS
        // in windows we know that an image is always passed (object creates one if needed)
        // and that images are never used. Therefore replace image argument with 0.
        !$$SM !$ 0 !6 !7 !8 !9
      #ELSE
        // character might be passing an image and it might not. We must pass the value
        !$$SM !$ !5 !6 !7 !8 !9
      #ENDIF
    #ELSE
      FORWARD_BEGIN_CONSTRUCT !$ !5 !6 !7 !8 !9
    #ENDIF
  #ELSE
    ADD$IMAGE$ARGS MSG_CONSTRUCT_OBJECT !5 !6 !7 !8 !9  //else use default
  #ENDIF