1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6         *                                                         *
  7         * Copyright (c) 1972 by Massachusetts Institute of        *
  8         * Technology and Honeywell Information Systems, Inc.      *
  9         *                                                         *
 10         *********************************************************** */
 11 
 12 
 13 /****^  HISTORY COMMENTS:
 14   1) change(76-01-01,Kobziar), approve(), audit(), install():
 15      Pre-hcom comments.
 16      written 1-76 by Kobziar
 17      Rewritten 7/77 by S.E. Barr
 18      Modified 16 August, 1981, W. Olin Sibert, to eliminate use of
 19         online_salvager_output
 20      Modified July 1982 by J. Bongiovanni to eliminate salv_data$console
 21      Modified 831111 BIM to not drop 4,5 on the floor
 22   2) change(86-11-11,Lippard), approve(86-12-08,MCR7590),
 23      audit(87-04-16,Dickson), install(87-04-28,MR12.1-1028):
 24      Stop going OOSB when given a standard (error_table_) error code.
 25                                                    END HISTORY COMMENTS */
 26 
 27 
 28 /* format: style4 */
 29 
 30 salv_err_msg: proc (a_severity);
 31 
 32 
 33 /* * Logs messages in the syserr log. Translates salvager severity to
 34    * syserr severity.
 35    *
 36    *    Salv  Sys   Interpretation
 37    *    ---------------------------
 38    *      1 CRASH    After printing the message on the operator's console, crash the system.
 39    *      2 ANNOUNCE Print message on salvager output and operators's console.
 40    *      4,5 LOG    Print on console if log is full, else just log.
 41    *      6 JUST_LOG As the man said ...
 42 */
 43 
 44 /* PARAMETERS */
 45 
 46 dcl  a_severity fixed bin;                                  /* severity level for message */
 47 dcl  a_path char (*);                                       /* pathname assoc. with message */
 48 dcl  arg_msg_ptr ptr unal;                                  /* Multics standard error code */
 49 
 50 /* AUTOMATIC */
 51 
 52 dcl  severity fixed bin;                                    /* copy of severity level */
 53 dcl  syserr_severity fixed bin;                             /* correct syserr message code */
 54 dcl  code fixed bin (35);
 55 dcl  have_code bit (1) aligned;                             /* ON, for code entry point. */
 56 dcl  path char (170);                                       /* <path>:<new_line> */
 57 dcl  line_len fixed bin;                                    /* number of characters in message */
 58 dcl  line char (303);                                       /* 168 (path) +2 (:nl) +132 (message) +1 (nl) */
 59 dcl  start fixed bin;                                       /* number of first argument for formline_ */
 60 dcl  msg_ptr ptr unal;                                      /* packed ptr into error table */
 61 dcl  msg_len fixed bin;                                     /* number of characters remaining in line for message. */
 62 
 63 dcl  (addr, length, substr, rtrim, min, ptr, rel, unspec) builtin;
 64 
 65 dcl  1 et aligned based (msg_ptr),                          /* An error table message */
 66        2 len fixed bin (8) unal,                            /* Length of the message */
 67        2 msg char (et.len) unal;                            /* The message */
 68 
 69 /* EXTERNAL */
 70 
 71 dcl  error_table_$ fixed bin ext;
 72 dcl  syserr entry options (variable);
 73 dcl  formline_ entry (fixed bin, fixed bin, ptr, fixed bin, fixed bin);
 74 dcl  utility_print entry (fixed bin, char (*));
 75 
 76 /* CONSTANTS */
 77 
 78 dcl  COLON_NEW_LINE char (2) int static options (constant) init (":
 79 ");
 80 dcl  NEW_LINE int static options (constant) char (1) init ("
 81 ");
 82 
 83 /* INTERNAL STATIC */
 84 
 85 dcl  sys_last_path char (170) int static init ("");         /* Last path printed on console. */
 86 
 87 /*^L*/
 88           start = 2;
 89           path = "";
 90           have_code = "0"b;
 91           goto START;
 92 
 93 
 94 path: entry (a_severity, a_path);
 95 
 96           start = 3;
 97           path = a_path;
 98           have_code = "0"b;
 99           goto START;
100 
101 
102 code: entry (a_severity, a_path, arg_msg_ptr);
103 
104           start = 4;
105           path = a_path;
106           have_code = (unspec (arg_msg_ptr) ^= "0"b);
107           goto START;
108 
109 START:
110 
111 /* Format line and path */
112 
113           severity = a_severity;
114           line_len = length (line);
115           call formline_ (start, start + 1, addr (line), line_len, (0));
116 
117 /* Get error table message. */
118 
119           if have_code then do;
120                msg_ptr = arg_msg_ptr;
121                if baseno (msg_ptr) = "007777"b3 then msg_ptr = ptr (addr (error_table_$), rel (msg_ptr));
122                msg_len = length (line) - line_len;
123                if msg_len > 0 then do;
124                     substr (line, line_len + 1, msg_len) = et.msg;
125                     line_len = line_len + et.len;
126                end;
127           end;
128           line_len = min (line_len + 1, length (line));     /* Make sure there is space for new-line */
129           substr (line, line_len, 1) = NEW_LINE;
130 
131           if path ^= "" then path = rtrim (path) || COLON_NEW_LINE;
132 
133 /* Online salvage already has pathname */
134 
135           if severity < 0 then severity = 0;
136           if severity > 6 then severity = 6;
137           if salv_data$rpv then if severity < 4 then severity = 2;
138 
139           go to SALV_SEVERITY (severity);
140 
141 SALV_SEVERITY (1):
142           syserr_severity = CRASH;
143           go to SYSERR;
144 SALV_SEVERITY (3):                                          /* supposedly unused */
145 SALV_SEVERITY (0):
146 SALV_SEVERITY (2):
147           syserr_severity = ANNOUNCE;
148           go to SYSERR;
149 SALV_SEVERITY (4):
150 SALV_SEVERITY (5):
151           syserr_severity = LOG;
152           go to SYSERR;
153 SALV_SEVERITY (6):
154           syserr_severity = JUST_LOG;
155 
156 SYSERR:
157           if path ^= "" & path ^= sys_last_path then do;
158                call syserr (syserr_severity, "^a^a", path, substr (line, 1, line_len - 1));
159                sys_last_path = path;
160           end;
161           else call syserr (syserr_severity, substr (line, 1, line_len - 1));
162 
163           return;
164 
165 %page; %include salv_data;
166 %page; %include syserr_constants;
167 
168      end salv_err_msg;