home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 11.ddi / SSCOPE.LIF / PMAIN.LST < prev    next >
Encoding:
File List  |  1992-07-02  |  10.1 KB  |  228 lines

  1. PL/M-386 COMPILER    psamp                                                                   09/05/90 12:14:15  PAGE   1
  2.  
  3.  
  4. iRMX III PL/M-386 V3.1  COMPILATION OF MODULE PMAIN
  5. OBJECT MODULE PLACED IN PMAIN.obj
  6. COMPILER INVOKED BY:  :LANG:PLM386 PMAIN.P38
  7.  
  8.  
  9.  
  10.               $title ('psamp')
  11.               $optimize(0) word16
  12.               $large( -CONST IN CODE- EXPORTS process_task,
  13.               $                               count_task)
  14.               $debug
  15.  
  16.    1          pmain: do;
  17.               $include(/rmx386/inc/common.lit)
  18.           =   $SAVE NOLIST
  19.               $include(/rmx386/inc/rmxplm.ext)
  20.           =   $Save Nolist
  21.               $include(putils.ext)
  22.           =   $save nolist
  23.  
  24.  675   1      declare UINT_8      literally 'byte';
  25.  676   1      declare UINT_16     literally 'dword';
  26.  677   1      declare UINT_32     literally 'word';
  27.  678   1      declare NIL_SEL     literally 'selectorof(NIL)';
  28.  
  29.  679   1      declare     COUNT_PRIORITY      literally '200';  /* Priority of count task  */
  30.  680   1      declare     PROCESS_PRIORITY    literally '200';  /* Priority of process task*/
  31.  681   1      declare     BUFF_LEN            literally '125';  /* Buffer len in MSG_STRUC */
  32.  682   1      declare     DATA_MBOX           literally '20h';  /* Data mailbox code.      */
  33.  683   1      declare     MAX_COUNT           literally '65535';/* UI16_MAX                */
  34.  
  35.  684   1      declare MSG_STRUC literally 'structure (
  36.                   count               byte,
  37.                   fillchar            byte,
  38.                   buffer(BUFF_LEN)    byte)';
  39.  
  40.  685   1      declare proc_msg    MSG_STRUC public;   /* Message processed by process task */
  41.  
  42.  686   1      declare counter         word public;    /* Counter used by count task.       */
  43.  687   1      declare count_token     TOKEN public;   /* Token for count task.             */
  44.  688   1      declare process_token   TOKEN public;   /* Token for process task.           */
  45.  
  46.  
  47.  689   1      declare module_data UINT_32;          /* Used in the create task system call */
  48.                                                     /* Identifies the data segment         */
  49.  
  50.  690   1      process_task: procedure public reentrant;
  51.                
  52.  691   2          declare exception   WORD;       /* Status returned from system calls     */
  53.  692   2          declare main_mbox   TOKEN;      /* Token for main task's mailbox         */
  54.  693   2          declare proc_mbox   TOKEN;      /* Process task's mailbox token          */
  55.  694   2          declare msg_length  UINT_32;    /* Actual length of received message     */
  56.  695   2          declare i           byte;
  57.                   
  58.                   /*
  59.                    *  Lookup the process task mailbox token from the object
  60.                    *  directory.
  61. PL/M-386 COMPILER    psamp                                                                   09/05/90 12:14:15  PAGE   2
  62.  
  63.  
  64.                    */
  65.  696   2          proc_mbox = rqlookupobject (NIL_SEL, @(11,'Process Box'), 0ffffh, @exception);
  66.                   /*
  67.                    *  Lookup the main task mailbox token from the object
  68.                    *  directory.
  69.                    */
  70.  697   2          main_mbox = rqlookupobject (NIL_SEL, @(8,'Main Box'), 0ffffh, @exception);
  71.  
  72.                   /*
  73.                    *  Loop forever responding to requests.
  74.                    */ 
  75.  698   2          do FOREVER;
  76.                       /*
  77.                        *  Receive the next request 
  78.                        */
  79.  699   3              msg_length = rqreceivedata (main_mbox,
  80.                                                     @proc_msg,
  81.                                                     0ffffh,
  82.                                                     @exception);
  83.  
  84.                       /*
  85.                        *  Take action on the received message (fill msg.buffer)
  86.                        */
  87.  700   3              do i = 0 to (BUFF_LEN - 1);
  88.  701   4                  msg.buffer(i) = msg.fillchar;
  89.  702   4              end;        
  90.  
  91.                       /*
  92.                        *  Send response
  93.                        */
  94.  703   3              call rqsenddata (proc_mbox, 
  95.                                         @proc_msg, 
  96.                                         size (proc_msg), 
  97.                                         @exception);  
  98.  
  99.  704   3              call delay (1000);      /*  Sleep for about 1 sec. so others can run.*/
  100.  705   3              end;
  101.  706   2          end process_task;
  102.  
  103.  707   1      count_task: procedure public reentrant;
  104.  
  105.  708   2          declare exception   WORD;     /* Status returned from system calls */
  106.  
  107.  709   2          counter = 0;
  108.  
  109.  710   2          do FOREVER;
  110.  
  111.  711   3              counter = counter + 1;
  112.  712   3              call delay(1000);                  /* Approx. 1 second. */
  113.  713   3              call plm_data;
  114.  
  115.  714   3              end;
  116.  715   2          end count_task;
  117.  
  118.               /**********************************************************************/
  119.               /*  Entry point for Soft-Scope demo program                           */
  120.               /**********************************************************************/
  121. PL/M-386 COMPILER    psamp                                                                   09/05/90 12:14:15  PAGE   3
  122.  
  123.  
  124.  716   1          declare actual          WORD;
  125.  717   1          declare co_conn         TOKEN;
  126.  718   1          declare exception       WORD;   /* Status returned from system calls.    */
  127.  719   1          declare main_mbox       TOKEN;  /* Token for main task's mailbox.        */
  128.  720   1          declare proc_mbox       TOKEN;  /* Process task's mailbox token.         */
  129.  721   1          declare msg_length      UINT_32;/* Actual length of received message.    */
  130.  722   1          declare msg             MSG_STRUC;/* Message to be sent/received.        */
  131.  723   1          declare msg_count       UINT_16;
  132.  724   1          declare i               UINT_16;
  133.                   
  134.  725   1          co_conn = rqsattachfile(@(4,':CO:'),@exception);
  135.  726   1          call rqsopen(co_conn,3,0,@exception);
  136.  727   1          actual = rqswritemove(co_conn,
  137.                                         @('Soft-Scope III PLM Sample Program',0dh,0ah), 35,
  138.                                         @exception);
  139.  
  140.                   /*
  141.                    *  Create the mailbox for main task
  142.                    */
  143.  728   1          main_mbox = rqcreatemailbox (DATA_MBOX, @exception);
  144.                   /*
  145.                    *  Catalog the mailbox token in the object directory
  146.                    */
  147.  729   1          call rqcatalogobject (NIL_SEL, main_mbox, @(8,'Main Box'), @exception);
  148.  
  149.                   /*
  150.                    *  Create the process mailbox 
  151.                    */
  152.  730   1          proc_mbox = rqcreatemailbox (DATA_MBOX, @exception);
  153.                   /*
  154.                    *  Catalog the mailbox token in the object directory
  155.                    */
  156.  731   1          call rqcatalogobject (NIL_SEL, proc_mbox, @(11,'Process Box'),@exception);
  157.  
  158.                   /*
  159.                    *  Create tasks...
  160.                    */
  161.  732   1          count_token = rqcreatetask (
  162.                               COUNT_PRIORITY,                 /* priority.         */
  163.                               @count_task,                    /* start address.    */
  164.                               selectorof (@module_data),      /* data segment.     */
  165.                               NIL,                            /* stack pointer.    */
  166.                               4096,                           /* stack size.       */
  167.                               0,                              /* flags (no NPX).   */
  168.                               @exception);                    /* exception ptr.    */
  169.  
  170.  733   1          process_token = rqcreatetask (
  171.                               COUNT_PRIORITY,                 /* priority.         */
  172.                               @process_task,                  /* start address.    */
  173.                               selectorof (@module_data),      /* data segment.     */
  174.                               NIL,                            /* stack pointer.    */
  175.                               4096,                           /* stack size.       */
  176.                               0,                              /* flags (no NPX).   */
  177.                               @exception);                    /* exception ptr.    */
  178.  
  179.  734   1          msg_count = 0;
  180.  735   1          do FOREVER;
  181. PL/M-386 COMPILER    psamp                                                                   09/05/90 12:14:15  PAGE   4
  182.  
  183.  
  184.  736   2              msg.fillchar = '*';
  185.  737   2              if (msg_count >= MAX_COUNT) then
  186.  738   2                  msg_count = 0;
  187.  739   2              else
  188.                           msg.count = msg_count + 1;
  189.  740   2              call setb (0, @msg.buffer, size (msg.buffer));
  190.                       /*
  191.                        *  Send data to process task to fill msg.buffer with fillchar
  192.                        */
  193.  741   2              call rqsenddata (main_mbox, 
  194.                                           @msg, 
  195.                                           size (msg), 
  196.                                           @exception);    
  197.  
  198.                       /*
  199.                        *  Receive data back from process task 
  200.                        */
  201.  742   2              msg_length = rqreceivedata (proc_mbox,
  202.                                                     @msg,
  203.                                                     0ffffh,
  204.                                                     @exception);
  205.  743   2              end;
  206.  
  207.  744   1      end pmain;
  208.  
  209.  
  210.  
  211. MODULE INFORMATION:
  212.  
  213.      CODE AREA SIZE     = 000002E3H        739D
  214.      CONSTANT AREA SIZE = 00000052H         82D
  215.      VARIABLE AREA SIZE = 0000011AH        282D
  216.      MAXIMUM STACK SIZE = 0000002CH         44D
  217.      2822 LINES READ
  218.      0 PROGRAM WARNINGS
  219.      0 PROGRAM ERRORS
  220.  
  221. DICTIONARY SUMMARY:
  222.  
  223.      1412KB MEMORY AVAILABLE
  224.      58KB MEMORY USED   (4%)
  225.      0KB DISK SPACE USED
  226.  
  227. END OF PL/M-386 COMPILATION
  228.