Message Processing Functions

Each MFM contains one or more Message Processing Functions [MPFs]. Each MPF may, in addition to processing a received message, invoke a change of state in the MFM of which it is part.

Naming Convention For MPFs

The name of a message processing function begins with the letters MPF. These are followed by 5 digits. The first 3 of these identify the MPF's parent MFM. The remaining 2 identify the parent MFM's state for which the MPF concerned does the processing. This is clarified below:
MPF00000
MPF        Stands for 'Message Processor Function'
   000     Identification Number of the MPF's parent MFM
      00   State of parent MFM for which the MPF concerned
           processes messages

Structure of an MPF

The general form of an MFM message processing function is as follows:
int _far MPF00000(void _far *pd_in) {
  int inst;                          //MFM Data-Instance Number
  void _far *pa_out,                 //Output message's action
       _far *pd_out;                 //Output message's data
  size_t  in_msg_len;                //length of input message
         out_msg_len;                //length of output message
  if(cannot_process_it_this_pass) {  //EXAMINE INPUT MESSAGE
    pa_out = MPF00000;               //Set new message entry to
    pd_out = pd_in;                  //point to old message.
  } else {
    pd_out = (void _far *)_fmalloc((size_t)out_msg_len);
    PROCESS THE INPUT MESSAGE
    UPDATE THE INSTANCE DATA
    BUILD THE OUTPUT MESSAGE
    pa_out = MPF?????;               //Output message's action
    _ffree(*pd_in);                  //Free old msg's storage
  }
  int Result = PutMsg(pa_out, pd_out);
}

This page's parent within this Web Site. About this Web Site. Its home page. Email its Author.