1 /* ***********************************************************
  2    *                                                         *
  3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  4    *                                                         *
  5    * Copyright (c) 1972 by Massachusetts Institute of        *
  6    * Technology and Honeywell Information Systems, Inc.      *
  7    *                                                         *
  8    *********************************************************** */
  9 
 10 
 11 enter_lss: procedure options (variable);
 12 
 13 /* This command forces the command processor to transform commands using
 14    a LSS command table.
 15 
 16    Usage: enter_lss {table path}
 17 
 18    Written by C. Hornig, October 1979
 19    Modified by C Spitzer. Jan 1984. attempt to verify the goodness of the
 20             command list.
 21 */
 22 
 23 dcl 1 lss_header based (lssp) aligned,
 24       2 ratio fixed bin (17),
 25       2 interval fixed bin (17),
 26       2 number_of_names fixed bin (71),
 27       2 names (lss_header.number_of_names) char (32) aligned,
 28       2 pointers (lss_header.number_of_names) aligned,
 29         3 where fixed bin (17),
 30         3 length fixed bin (17);
 31 
 32 dcl 1 lss based (lssp) aligned,
 33       2 ratio fixed bin (17),
 34       2 interval fixed bin (17),
 35       2 number_of_names fixed bin (71),
 36       2 names (lss.number_of_names) char (32) aligned,
 37       2 pointers (lss.number_of_names) aligned,
 38         3 where fixed bin (17),
 39         3 length fixed bin (17),
 40       2 paths char (path_length) aligned;
 41 
 42 dcl  ME char (9) init ("enter_lss") static options (constant);
 43 
 44 dcl  com_err_ entry options (variable);
 45 dcl  command_processor_$setup_lss entry (pointer);
 46 dcl  cu_$arg_count entry returns (fixed bin);
 47 dcl  cu_$arg_ptr entry (fixed bin, pointer, fixed bin (24), fixed bin (35));
 48 dcl  expand_pathname_ entry (char (*), char (*), char (*), fixed bin (35));
 49 dcl  initiate_file_ entry (char(*), char(*), bit(*), ptr, fixed bin(24), fixed bin(35));
 50 dcl  start_governor_ entry (fixed bin, fixed bin);
 51 dcl  pathname_ entry (char(*), char(*)) returns(char(168));
 52 
 53 dcl  fixedoverflow condition;
 54 
 55 dcl (currentsize, divide, null) builtin;
 56 
 57 dcl  bit_count fixed bin (24);
 58 dcl  path_length fixed bin (21);
 59 dcl  dirname char (168);
 60 dcl  ename char (32);
 61 dcl  ap ptr;
 62 dcl  al fixed bin (24);
 63 dcl  argument character (al) based (ap);
 64 dcl  code fixed bin (35);
 65 dcl  lssp ptr;
 66 dcl  i fixed bin;
 67 
 68 /* * * * * * * * * * ENTER_LSS * * * * * * * * * */
 69 
 70           if cu_$arg_count () ^= 1 then do;                 /* program misused */
 71                call com_err_ (0, ME, "Usage: enter_lss {table pathname}");
 72                return;
 73           end;
 74 
 75           call cu_$arg_ptr (1, ap, al, code);               /* get the taBle path */
 76           if code ^= 0 then do;
 77                call com_err_ (code, ME);
 78                return;
 79           end;
 80 
 81           call expand_pathname_ (argument, dirname, ename, code);
 82           if code ^= 0 then do;                             /* bad pathname */
 83                call com_err_ (code, ME, "^a.", argument);
 84                return;
 85           end;
 86           call initiate_file_ (dirname, ename,"100"b, lssp, bit_count, code); /* initiate the LSS */
 87           if lssp = null () then do;
 88                call com_err_ (code, ME, "Initiating ^a.", pathname_ (dirname, ename));
 89                return;
 90           end;
 91 
 92           on fixedoverflow goto bad_input_segment;
 93           if lss.number_of_names * 9 > divide (bit_count, 36, 21, 0)
 94           then goto bad_input_segment;                      /* 9 is the size in words of 1 entry in lss */
 95 
 96           path_length = divide (bit_count, 9, 21, 0) - (currentsize (lss_header)*4);
 97           do i = 1 to lss.number_of_names;
 98                if lss.where (i) + lss.length (i) > path_length + 1 then do;
 99 bad_input_segment:  call com_err_ (0, ME, "The input command list is not a validly compiled LSS table. ^a", pathname_ (dirname, ename));
100                     return;
101                end;
102           end;
103 
104           revert fixedoverflow;
105 
106           call command_processor_$setup_lss (lssp);         /* tell the CP */
107           call start_governor_ (lss.ratio, lss.interval);   /* enforce the governor */
108      end enter_lss;