home *** CD-ROM | disk | FTP | other *** search
File List | 1992-07-02 | 10.1 KB | 228 lines |
- PL/M-386 COMPILER psamp 09/05/90 12:14:15 PAGE 1
-
-
- iRMX III PL/M-386 V3.1 COMPILATION OF MODULE PMAIN
- OBJECT MODULE PLACED IN PMAIN.obj
- COMPILER INVOKED BY: :LANG:PLM386 PMAIN.P38
-
-
-
- $title ('psamp')
- $optimize(0) word16
- $large( -CONST IN CODE- EXPORTS process_task,
- $ count_task)
- $debug
-
- 1 pmain: do;
- $include(/rmx386/inc/common.lit)
- = $SAVE NOLIST
- $include(/rmx386/inc/rmxplm.ext)
- = $Save Nolist
- $include(putils.ext)
- = $save nolist
-
- 675 1 declare UINT_8 literally 'byte';
- 676 1 declare UINT_16 literally 'dword';
- 677 1 declare UINT_32 literally 'word';
- 678 1 declare NIL_SEL literally 'selectorof(NIL)';
-
- 679 1 declare COUNT_PRIORITY literally '200'; /* Priority of count task */
- 680 1 declare PROCESS_PRIORITY literally '200'; /* Priority of process task*/
- 681 1 declare BUFF_LEN literally '125'; /* Buffer len in MSG_STRUC */
- 682 1 declare DATA_MBOX literally '20h'; /* Data mailbox code. */
- 683 1 declare MAX_COUNT literally '65535';/* UI16_MAX */
-
- 684 1 declare MSG_STRUC literally 'structure (
- count byte,
- fillchar byte,
- buffer(BUFF_LEN) byte)';
-
- 685 1 declare proc_msg MSG_STRUC public; /* Message processed by process task */
-
- 686 1 declare counter word public; /* Counter used by count task. */
- 687 1 declare count_token TOKEN public; /* Token for count task. */
- 688 1 declare process_token TOKEN public; /* Token for process task. */
-
-
- 689 1 declare module_data UINT_32; /* Used in the create task system call */
- /* Identifies the data segment */
-
- 690 1 process_task: procedure public reentrant;
-
- 691 2 declare exception WORD; /* Status returned from system calls */
- 692 2 declare main_mbox TOKEN; /* Token for main task's mailbox */
- 693 2 declare proc_mbox TOKEN; /* Process task's mailbox token */
- 694 2 declare msg_length UINT_32; /* Actual length of received message */
- 695 2 declare i byte;
-
- /*
- * Lookup the process task mailbox token from the object
- * directory.
- PL/M-386 COMPILER psamp 09/05/90 12:14:15 PAGE 2
-
-
- */
- 696 2 proc_mbox = rqlookupobject (NIL_SEL, @(11,'Process Box'), 0ffffh, @exception);
- /*
- * Lookup the main task mailbox token from the object
- * directory.
- */
- 697 2 main_mbox = rqlookupobject (NIL_SEL, @(8,'Main Box'), 0ffffh, @exception);
-
- /*
- * Loop forever responding to requests.
- */
- 698 2 do FOREVER;
- /*
- * Receive the next request
- */
- 699 3 msg_length = rqreceivedata (main_mbox,
- @proc_msg,
- 0ffffh,
- @exception);
-
- /*
- * Take action on the received message (fill msg.buffer)
- */
- 700 3 do i = 0 to (BUFF_LEN - 1);
- 701 4 msg.buffer(i) = msg.fillchar;
- 702 4 end;
-
- /*
- * Send response
- */
- 703 3 call rqsenddata (proc_mbox,
- @proc_msg,
- size (proc_msg),
- @exception);
-
- 704 3 call delay (1000); /* Sleep for about 1 sec. so others can run.*/
- 705 3 end;
- 706 2 end process_task;
-
- 707 1 count_task: procedure public reentrant;
-
- 708 2 declare exception WORD; /* Status returned from system calls */
-
- 709 2 counter = 0;
-
- 710 2 do FOREVER;
-
- 711 3 counter = counter + 1;
- 712 3 call delay(1000); /* Approx. 1 second. */
- 713 3 call plm_data;
-
- 714 3 end;
- 715 2 end count_task;
-
- /**********************************************************************/
- /* Entry point for Soft-Scope demo program */
- /**********************************************************************/
- PL/M-386 COMPILER psamp 09/05/90 12:14:15 PAGE 3
-
-
- 716 1 declare actual WORD;
- 717 1 declare co_conn TOKEN;
- 718 1 declare exception WORD; /* Status returned from system calls. */
- 719 1 declare main_mbox TOKEN; /* Token for main task's mailbox. */
- 720 1 declare proc_mbox TOKEN; /* Process task's mailbox token. */
- 721 1 declare msg_length UINT_32;/* Actual length of received message. */
- 722 1 declare msg MSG_STRUC;/* Message to be sent/received. */
- 723 1 declare msg_count UINT_16;
- 724 1 declare i UINT_16;
-
- 725 1 co_conn = rqsattachfile(@(4,':CO:'),@exception);
- 726 1 call rqsopen(co_conn,3,0,@exception);
- 727 1 actual = rqswritemove(co_conn,
- @('Soft-Scope III PLM Sample Program',0dh,0ah), 35,
- @exception);
-
- /*
- * Create the mailbox for main task
- */
- 728 1 main_mbox = rqcreatemailbox (DATA_MBOX, @exception);
- /*
- * Catalog the mailbox token in the object directory
- */
- 729 1 call rqcatalogobject (NIL_SEL, main_mbox, @(8,'Main Box'), @exception);
-
- /*
- * Create the process mailbox
- */
- 730 1 proc_mbox = rqcreatemailbox (DATA_MBOX, @exception);
- /*
- * Catalog the mailbox token in the object directory
- */
- 731 1 call rqcatalogobject (NIL_SEL, proc_mbox, @(11,'Process Box'),@exception);
-
- /*
- * Create tasks...
- */
- 732 1 count_token = rqcreatetask (
- COUNT_PRIORITY, /* priority. */
- @count_task, /* start address. */
- selectorof (@module_data), /* data segment. */
- NIL, /* stack pointer. */
- 4096, /* stack size. */
- 0, /* flags (no NPX). */
- @exception); /* exception ptr. */
-
- 733 1 process_token = rqcreatetask (
- COUNT_PRIORITY, /* priority. */
- @process_task, /* start address. */
- selectorof (@module_data), /* data segment. */
- NIL, /* stack pointer. */
- 4096, /* stack size. */
- 0, /* flags (no NPX). */
- @exception); /* exception ptr. */
-
- 734 1 msg_count = 0;
- 735 1 do FOREVER;
- PL/M-386 COMPILER psamp 09/05/90 12:14:15 PAGE 4
-
-
- 736 2 msg.fillchar = '*';
- 737 2 if (msg_count >= MAX_COUNT) then
- 738 2 msg_count = 0;
- 739 2 else
- msg.count = msg_count + 1;
- 740 2 call setb (0, @msg.buffer, size (msg.buffer));
- /*
- * Send data to process task to fill msg.buffer with fillchar
- */
- 741 2 call rqsenddata (main_mbox,
- @msg,
- size (msg),
- @exception);
-
- /*
- * Receive data back from process task
- */
- 742 2 msg_length = rqreceivedata (proc_mbox,
- @msg,
- 0ffffh,
- @exception);
- 743 2 end;
-
- 744 1 end pmain;
-
-
-
- MODULE INFORMATION:
-
- CODE AREA SIZE = 000002E3H 739D
- CONSTANT AREA SIZE = 00000052H 82D
- VARIABLE AREA SIZE = 0000011AH 282D
- MAXIMUM STACK SIZE = 0000002CH 44D
- 2822 LINES READ
- 0 PROGRAM WARNINGS
- 0 PROGRAM ERRORS
-
- DICTIONARY SUMMARY:
-
- 1412KB MEMORY AVAILABLE
- 58KB MEMORY USED (4%)
- 0KB DISK SPACE USED
-
- END OF PL/M-386 COMPILATION
-