Macro: REGISTER_PROCEDURE

Module location: FMAC line 6453 (view source)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Command: Register_Procedure Message {FOR Class} {{Type Argument} ...} Parameters: Description: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  #IFDEF UI.EXISTS
  #ELSE
    USE UI
  #ENDIF
  #IFSAME GLOBAL !2 !3 // procedure or procedure set
    #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION GLOBAL PROCEDURES CANNOT BE REGISTERED
  #ELSE
    #IFSAME !1 SET
      // Error if already defined as global
      #IFDEF SET_!2
        #IF (SET_!2<0)
          #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION Set !2 is already defined as a global message
        #ENDIF
      #ENDIF

      // Make sure the argument list is correct
      CHECK$METHOD$ARGUMENT$LIST !3 !4 !5 !6 !7 !8 !9
      // Even if there were errors parsing the argument list, try to make the symbol so that we resolve fwd refs correctly.
      #IFDEF MANGLE_NAMES
        // For mangling, #MARG is used to read the line and parse the argument list.
        #IFSAME OVERLOADED !3 !4 !5 !6 !7 !8 !9
          #IFDEF SET_!2
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION This Method Was Previously Defined As Non-Overloaded
          #ENDIF
          // #MARG returns the mangled name in !? which gets new message number.
          // we don't support Byref with overloading
          #IFSAME BYREF !3 !4 !5 !6 !7 !8 !9
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION "BYREF not allowed in overloaded methods"
          #ENDIF
          #MARG SET_!2 !3 !4 !5 !6 !7 !8 !9
          MESSAGE$ADDRESS !?
          // only create overloaded symbol if first time
          #IFNDEF SET_!2_OVERLOADED
            #REPLACE SET_!2_OVERLOADED   |CI1
          #ENDIF
        #ELSE
          #IFDEF SET_!2_OVERLOADED
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION This Method Was Previously Defined As Overloaded
          #ENDIF
          MESSAGE$ADDRESS SET_!2
        #ENDIF
      #ELSE
        MESSAGE$ADDRESS SET_!2
      #ENDIF
    #ELSE
      // check for already defined as global
      #IFDEF MSG_!1
        #IF (MSG_!1<0)
          #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION MSG !1 is already defined as a global message
        #ENDIF
      #ENDIF
      // Check the argument list first
      CHECK$METHOD$ARGUMENT$LIST !2 !3 !4 !5 !6 !7 !8 !9
      // Likewise for messages with MSG prefix. #MARG is again used to parse the register_procedure line.
      #IFDEF MANGLE_NAMES
        #IFSAME OVERLOADED !2 !3 !4 !5 !6 !7 !8 !9
          #IFDEF MSG_!1
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION This Method Was Previously Defined As Non-Overloaded
          #ENDIF
          // #MARG returns the mangled name in !? which gets new message number.
          // we don't support Byref with overloading
          #IFSAME BYREF !2 !3 !4 !5 !6 !7 !8 !9
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION "BYREF not allowed in overloaded methods"
          #ENDIF
          #MARG MSG_!1 !2 !3 !4 !5 !6 !7 !8 !9
          MESSAGE$ADDRESS !?
          // only create overloaded symbol if first time
          #IFNDEF MSG_!1_OVERLOADED
            #REPLACE MSG_!1_OVERLOADED   |CI1
          #ENDIF
        #ELSE
          #IFDEF MSG_!1_OVERLOADED
            #ERROR DFERR_COMP_ILLEGAL_METHOD_DEFINTION This Method Was Previously Defined As Overloaded
          #ENDIF
          MESSAGE$ADDRESS MSG_!1
        #ENDIF
      #ELSE
        MESSAGE$ADDRESS MSG_!1
      #ENDIF
    #ENDIF
  #ENDIF