1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1986 *
  6         *                                                         *
  7         *********************************************************** */
  8 
  9 /****^  HISTORY COMMENTS:
 10   1) change(86-05-15,Flegel), approve(87-07-15,MCR7580),
 11      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 12      Created.
 13   2) change(86-07-12,Smith), approve(87-07-15,MCR7580),
 14      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 15      Minor revisions.
 16   3) change(86-11-27,Flegel), approve(86-11-27,MCR7580),
 17      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 18      Approved.
 19                                                    END HISTORY COMMENTS */
 20 /* format: style4,indattr,ifthen,^indcomtxt,thendo,^indproc,^indblkcom,initcol1,declareind8,dclind4,struclvlind3,comcol55 */
 21 capability_:
 22      proc ();
 23 
 24 /* : PROGRAM FUNCTION
 25 
 26 Contains two entry points:
 27 
 28           pack:   Converts a MOWSE system id and a capability number
 29                   into a single fixed bin value (major_capability).
 30           unpack: Convert a major_capability back into the system id
 31                   and the capability number.
 32 */
 33 
 34 /* : NOTES
 35 */
 36 
 37 /* INPUT PARAMETERS */
 38 dcl p_system_id            fixed bin parameter;       /* MOWSE sytem id */
 39 dcl p_major_capability     fixed bin parameter;       /* Major capability id */
 40 dcl p_major_number         fixed bin parameter;       /* CAT index of capability */
 41 
 42 
 43 /* OUTPUT PARAMETERS */
 44 dcl p_code                 fixed bin (35);
 45 
 46 
 47 /* MISC VARIABLES */
 48 dcl fixed8                 fixed bin (8) based;       /* Dummy for convert */
 49 dcl fixed17                fixed bin (17) based;      /* Dummey for convert */
 50 dcl major_ptr              ptr;                       /* Pointer to p_major_capability */
 51 dcl major                  fixed bin (35);            /* Temporary major_capability (packed) */
 52 
 53 
 54 /* SYSTEM CALL SUPPORT */
 55 dcl ws_error_$invalid_system_id
 56                            fixed bin (35) ext static;
 57 dcl ws_error_$invalid_capability_number
 58                            fixed bin (35) ext static;
 59 
 60 /* STRUCTURES */
 61 dcl 01 major_overlay       unaligned based (major_ptr),
 62        02 pad              bit (18),
 63        02 system           fixed bin (8),
 64        02 index            fixed bin (8);
 65 
 66 /* BUILTINS */
 67 dcl addr                   builtin;
 68 dcl convert                builtin;
 69 
 70 /* MAIN */
 71           return;
 72 
 73 /*^L*/
 74 
 75 /* : Pack: */
 76 pack:
 77      entry (p_system_id, p_major_number, p_major_capability, p_code);
 78 
 79           p_code = 0;
 80           major = 0;
 81           major_ptr = addr (major);
 82 
 83 /* : If major_capability_number is invalid */
 84 
 85           if (p_major_number < INTERNAL)
 86                | (p_major_number > MAXIMUM_CAT_ENTRY) then do;
 87 
 88                p_code = ws_error_$invalid_capability_number;
 89                return;
 90           end;
 91 
 92 /* : If p_system_id is invalid */
 93 
 94           if (p_system_id ^= REMOTE_SYSTEM) & (p_system_id ^= LOCAL_SYSTEM)
 95           then do;
 96                p_code = ws_error_$invalid_system_id;
 97                return;
 98           end;
 99 
100 /* : pack the system id and major number */
101 
102           major_overlay.system = convert (fixed8, p_system_id);
103           major_overlay.index = convert (fixed8, p_major_number);
104           p_major_capability = convert (fixed17, major);
105           return;
106 
107 /*^L*/
108 
109 /* : Unpack: */
110 unpack:
111      entry (p_system_id, p_major_number, p_major_capability, p_code);
112 
113           p_code = 0;
114           major = p_major_capability;
115           major_ptr = addr (major);
116 
117 /* : Check that the unpacked fields are correct */
118 
119           if (major_overlay.system ^= LOCAL_SYSTEM
120                & major_overlay.system ^= REMOTE_SYSTEM)
121                | (major_overlay.index < INTERNAL
122                | major_overlay.index > MAXIMUM_CAT_ENTRY) then
123 
124                p_code = ws_error_$invalid_capability_number;
125 
126           else do;
127                p_major_number = major_overlay.index;
128                p_system_id = major_overlay.system;
129           end;
130           return;
131 
132 %page;
133 /* INCLUDE FILES */
134 %include "mowse";
135 %include "mowse_info";
136 
137 /* : END */
138      end capability_;