Macro: END_OBJECT

Module location: FMAC line 10419 (view source)

changes: declare an error if not within an object if within a class, this should be inside of a method

  #IF (!b & 1)  // if not within an object..error
    // if within a class (2) but not within a procedure (4) we have an error
    // you should not place objects in classes outside of methods
    #IF (!b = 3) // 3 = in class and in object, not in method
      #IF (!Zl & 1)
        #REM WARNING 4391: Object/End_object within class is .NOT. in a method
      #ELSE
        #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Object/End_object within class should be in a method
      #ENDIF
    #ENDIF

    // If within method, we count number of nested objects.
    // If lt 0, declare an error, End_procedure will check for >0
    #IF ( !b & 4 )   // if object within method
      #SET ZM$ !Zm-1 // decrement count
      #IF (!Zm < 0)  // if lt 0, declare error
        #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT End_Object without Object in Method
      #ENDIF
    #ENDIF

    // if here we are within a object.
    // if we are within a class we are also within a procedure

    //
    // The following section was added 01-08-90 by SAL to support inheritable
    // end-instance macros for classes
    //
    #IFSUB '!$$SC'  //if flex-defined class
    #IFSUB '!$$EM'  //if end-instance macro defined for class,
      !$$EM !$ !1 !2 !3 !4 !5 !6 !7 !8 !9
    #ELSE
      FORWARD_END_CONSTRUCT !$ !1 !2 !3 !4 !5 !6 !7 !8 !9
    #ENDIF
    #ELSE
      DEFAULT_END_OBJECT  //else use default
    #ENDIF
    #SPOP           //restore old class name
    //
    // end of addition 01-08-90 by SAL
    //
  #ELSE
    #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT End_Object without Object
  #ENDIF