Macro: SEND

Module location: FMAC line 11338 (view source)

//old #COMMAND PROPERTY$HELP #IF (!0>0) #IFSAME !1 OF // "of" should have already been processed. This is an error #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX INVALID USE OF 'OF' #SET ZH$ 4 // 4 means error occurred #ELSE // Check that TO is used properly. #IFSAME !1 TO #IF (!Zl & 1) #ELSE #IF (!Zh=3) // TO already encountered. TOO many Tos #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX TOO MANY 'TO' #SET ZH$ 4 // 4 means error occurred #ELSE #IF (!0=1) // missing param after to #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX NO VALUE FOLLOWING 'TO' #SET ZH$ 4 // 4 means error occurred #ELSE #IF (!Zh=1) // A GET or ITEM SET without a TO yet #IF (!0>2) // too many params after the to #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX TOO MANY PARAMS AFTER 'TO' #SET ZH$ 4 // 4 means error occurred #ELSE #SET ZH$ 3 // Mark as found a to #ENDIF #ELSE // If here a non-item SET #SET ZH$ 3 // Mark as found a to #ENDIF #ENDIF #ENDIF #ENDIF #ELSE #IFSAME !1 ITEM #ELSE #SET ZG$ !ZG #IFDEF !1 #DPUSH !1 #ELSE #IFCLASS !1 0123456789ABCDEF #DPUSH !1 #ELSE //#IFDEF MSG_!1 // #DPUSH MSG_!1 //#ELSE // #DPUSH |CI0 // #FREF MSG_!1 !a,!Zg //#ENDIF #IFDEF GET_!1 // if defined as a function // This would support passing of object names as parameters. Not supported // for now. #IF (GET_!1>$40000000) // and an object access method..we will help out // replace simple name with expression syntax DPUSH$EXP (!1(current_object)) #ELSE // if defined as a function but not an access method. This is an error #DPUSH !1 // will generate an Error #ENDIF #ELSE // If undefined // this could be msg_!1 but we will call than an error //#DPUSH !1 // will generate an Error #IFDEF MSG_!1 #DPUSH MSG_!1 #ELSE #DPUSH |CI0 #FREF MSG_!1 !a,!Zg #ENDIF #ENDIF #ENDIF #ENDIF #ENDIF #ENDIF #ENDIF #IF (!Zh<4) // 4 indicates an error occurred PROPERTY$HELP !2 !3 !4 !5 !6 !7 !8 !9 // as long as there is still no error #ENDIF #ELSE #IF (!Zh<3) // If 1 or 2, TO was never found #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX MISSING 'TO' KEYWORD #ENDIF #ENDIF #ENDCOMMAND Changes: 1. support "OF" as well as "TO". OF is preferred 2. Check location of "OF" keyword 3. Check for improper message type (expression) 4. If sent directly within class (not method)...error

  #IF ( (!Zl & 1)=0)
    // we expect message to be msg_xxx, constant or local var.
    // Actually locals are weird, but much more acceptable
    #IFCLASS !1 "EFWV" // if exp, file, window or global...weird
      #ERROR DFERR_COMP_INVALID_MESSAGE_SYNTAX Unusual Usage: Variable or Expression used as message
    #ENDIF

    #IF (!b = 2) // within class but not in object or method
      #ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT Messages in class should be in method
    #ENDIF
  #ENDIF

  #DATA
  #IFDEF !1
    #DPUSH !1
  #ELSE

    #IFNDEF MANGLE_NAMES

      #IFDEF MSG_!1
        #DPUSH MSG_!1
      #ELSE
        #DPUSH |CI0
        #FREF MSG_!1 !a,0
      #ENDIF

    #ELSE

      #IFSAME !2 TO OF
        #IFDEF MSG_!1
          #DPUSH MSG_!1
        #ELSE
          #MANG MSG_!1 !4 !5 !6 !7 !8 !9
          #IFDEF !?
            #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"
              #ENDIF
            #ENDIF
            #DPUSH !?
          #ELSE  // message undefined. push obj function fixup.
            #DPUSH |CI0
            #FREF !? !a,0
          #ENDIF
        #ENDIF
      #ELSE
        #IFDEF MSG_!1
          #DPUSH MSG_!1
        #ELSE
          #MANG MSG_!1 !2 !3 !4 !5 !6 !7 !8 !9
          #IFDEF !?
            #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"
              #ENDIF
            #ENDIF
            #DPUSH !?
          #ELSE
            #DPUSH |CI0   // can't tell if it's object or global. push object.
            #FREF !? !a,0
          #ENDIF
        #ENDIF
      #ENDIF

    #ENDIF  // Name Mangling Case

  #ENDIF
  #IFSAME !2 TO OF // support both OF (suggested) and TO (old)
    SEND$HELP !4 !5 !6 !7 !8 !9
    SEND$CMD TO TO !3
  #ELSE
    SEND$HELP !2 !3 !4 !5 !6 !7 !8 !9
    SEND$CMD TO TO CURRENT_OBJECT
  #ENDIF