home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 1.ddi / SUPP.LIF / RCVMSG.PLM < prev    next >
Encoding:
Text File  |  1992-07-06  |  1.6 KB  |  48 lines

  1. $title('rcvmsg - receive a simple message')
  2. $compact
  3. rcvmsg: DO;
  4.  
  5. $include(:rmx:inc/rmxplm.ext)
  6. $include(dcom.ext)
  7. $include(dcom.lit)
  8. $include(:rmx:inc/error.lit)
  9. $include(err.ext)
  10.  
  11. /********************************************************************
  12.  *
  13.  *     MODULE NAME: rcvmsg    
  14.  *
  15.  *     DESCRIPTION: Create a well-known port and wait for a message in rmx string
  16.  *                  format.  Write the message to the console, release the buffer
  17.  *                  associated with the message and exit. 
  18.  *
  19.  *********************************************************************/
  20.  
  21. DECLARE                /* Literals */
  22.  
  23.     TSTPORT     LITERALLY '801H',    /* well-known port */
  24.     NOEXCEPT    LITERALLY    '0';    /* no exception handling by system */
  25.  
  26.     DECLARE        /* Global vars */
  27.  
  28.         status      WORD,
  29.         port_t      TOKEN,             /* Token for local port */
  30.         info        rec_info,          /* info block on message received */
  31.         bpool       TOKEN,             /* buffer pool */
  32.         b_sel       SELECTOR,
  33.         buf_tok     TOKEN AT (@b_sel), /* token for buffer holding message */
  34.         msg_ptr     POINTER;           /* pointer to received message */
  35.  
  36.     CALL set$exception(NOEXCEPT);
  37.     port_t = get$dport(TSTPORT, @bpool, CHAIN, @status);
  38.     msg_ptr = rq$receive(port_t, WAITFOREVER, @info, @status);
  39.     CALL error$check(120, status);
  40.     call rqc$send$eo$response(NIL, 0, msg_ptr, @status);
  41.     CALL error$check(130, status);
  42.     b_sel = selector$of(msg_ptr);
  43.     CALL rq$release$buffer(bpool, buf_tok, (info.flags AND 3), @status);         
  44.     CALL error$check(140, status);
  45.     CALL rq$exit$io$job(0,NIL,@status);
  46.  
  47. END rcvmsg;
  48.