/****^ ***************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright (C) 1986 by Massachusetts Institute of * * Technology and Honeywell Information Systems Inc. * * * ***************************************************** */ /****^ HISTORY COMMENTS: 1) change(86-08-19,JSLove), approve(86-08-19,MCR7518), audit(86-08-20,Parisek), install(86-10-02,MR12.0-1175): Created as a tool to verify that the current and future versions of match_star_name_ and check_star_name_ work properly. 2) change(87-06-01,GDixon), approve(87-07-08,MCR7740), audit(87-07-15,Hartogs), install(87-08-04,MR12.1-1055): A) Modified to properly declare check_star_name_. END HISTORY COMMENTS */ /* format: style3,ifthenstmt,indcomtxt,indproc,idind30 */ test_match_star_name: procedure () options (variable); declare (addcharno, character, index, ltrim, rtrim, substr) builtin; declare arg_count fixed bin (17), arg_len fixed bin (21), arg_ptr ptr, argx fixed bin (17), charx fixed bin (17), check_star_type fixed bin (2), check_status fixed bin (35), entry_star_type fixed bin (2), entry_status fixed bin (35), idx fixed bin (17), invert bit (1) aligned, mask bit (36), match_status fixed bin (35), path_star_type fixed bin (2), path_status fixed bin (35), self_status fixed bin (35), star_mask bit (36) aligned, star_type fixed bin (2), status fixed bin (35), star_len fixed bin (21), star_ptr ptr, whoami char (32); declare arg char (arg_len) based (arg_ptr), star char (star_len) based (star_ptr); declare ( error_table_$archive_pathname, error_table_$bad_arg, error_table_$bad_file_name, error_table_$badequal, error_table_$badpath, error_table_$badstar, error_table_$entlong, error_table_$inconsistent, error_table_$invalid_ascii, error_table_$nomatch, error_table_$nostars, error_table_$null_name_component ) fixed bin (35) external; declare check_star_name_ entry (char (*), bit (36), fixed bin (2), fixed bin (35)), check_star_name_$entry entry (char (*), fixed bin (35)), check_star_name_$path entry (char (*), fixed bin (35)), com_err_ entry () options (variable), com_err_$suppress_name entry () options (variable), convert_status_code_ entry (fixed bin (35), char (8) aligned, char (100) aligned), cu_$arg_count entry (fixed bin (17), fixed bin (35)), cu_$arg_ptr entry (fixed bin (17), ptr, fixed bin (21), fixed bin (35)), ioa_ entry () options (variable), match_star_name_ entry (char (*), char (*), fixed bin (35)), requote_string_ entry (char (*)) returns (char (*)); %page; %include check_star_name; %page; whoami = "test_match_star_name"; call cu_$arg_count (arg_count, status); if status ^= 0 then do; call com_err_ (status, whoami); return; end; if arg_count < 2 then do; call com_err_$suppress_name (0, whoami, "Usage: ^a key starname {matchnames}", whoami); return; end; call cu_$arg_ptr (1, arg_ptr, arg_len, (0)); if arg_len = 0 then go to INVALID_KEYWORD; idx = index ("012", substr (arg, 1, 1)) - 1; if idx >= 0 then do; check_star_type, entry_star_type, path_star_type = idx; check_status, entry_status, match_status, path_status, self_status = 0; end; else if substr (arg, 1, 1) = "b" then do; check_star_type, entry_star_type, path_star_type = 0; check_status, entry_status, match_status, path_status, self_status = error_table_$badstar; end; else go to INVALID_KEYWORD; if arg_len = 1 then go to DO_TEST; charx = 2; idx = index ("012", substr (arg, charx, 1)) - 1; if idx >= 0 then do; entry_star_type = idx; entry_status = 0; end; else if substr (arg, charx, 1) = "b" then do; entry_star_type = 0; entry_status = error_table_$badstar; end; else go to CHECK_NOMATCH; if arg_len = charx then go to DO_TEST; charx = charx + 1; idx = index ("012", substr (arg, charx, 1)) - 1; if idx >= 0 then do; path_star_type = idx; path_status = 0; end; else if substr (arg, charx, 1) = "b" then do; path_star_type = 0; path_status = error_table_$badstar; end; else go to CHECK_NOMATCH; if charx = arg_len then go to DO_TEST; charx = charx + 1; CHECK_NOMATCH: if substr (arg, charx) = "n" then match_status = error_table_$nomatch; else do; INVALID_KEYWORD: call com_err_ (0, whoami, "Invalid key ^a.", requote_string_ (rtrim (arg))); return; end; DO_TEST: call cu_$arg_ptr (2, star_ptr, star_len, (0)); call check_star_name_ (star, CHECK_STAR_IGNORE_ALL, star_type, status); if star_type ^= check_star_type | status ^= check_status then call error ("CHECK", check_star_type, check_status); call check_star_name_$entry (star, status); if status >= 0 & status <= 2 then do; star_type = status; status = 0; end; else star_type = 0; if star_type ^= entry_star_type | status ^= entry_status then call error ("ENTRY", entry_star_type, entry_status); call check_star_name_$path (star, status); if status >= 0 & status <= 2 then do; star_type = status; status = 0; end; else star_type = 0; if star_type ^= path_star_type | status ^= path_status then call error ("PATH", path_star_type, path_status); star_type = -1; call match_star_name_ (star, star, status); if status ^= self_status then call error ("SELF", -1, self_status); do argx = 3 to arg_count; call cu_$arg_ptr (argx, arg_ptr, arg_len, (0)); call match_star_name_ (arg, star, status); if status ^= match_status then call error ("MATCH", -1, match_status); end; return; %page; error: procedure (test, expected_star_type, expected_status); declare test char (*) parameter, expected_star_type fixed bin (2) parameter, expected_status fixed bin (35) parameter; declare actual_message char (256) varying, expected_message char (256) varying; call classify_status (star_type, expected_star_type, status, expected_status, actual_message); if expected_star_type = -1 then call classify_status (expected_star_type, expected_star_type, expected_status, expected_status + 1, expected_message); else call classify_status (expected_star_type, expected_star_type + 1, expected_status, expected_status + 1, expected_message); if test = "MATCH" then call ioa_ ("^a:^9t^a expected ^a got ^a with ^a.", test, requote_string_ (star), expected_message, actual_message, requote_string_ (arg)); else call ioa_ ("^a:^9t^a expected ^a got ^a.", test, requote_string_ (star), expected_message, actual_message) ; return; end error; classify_status: procedure (star_type, expected_star_type, status, expected_status, message); declare star_type fixed bin (2) parameter, expected_star_type fixed bin (2) parameter, status fixed bin (35) parameter, expected_status fixed bin (35) parameter, message char (256) varying parameter; declare buffer char (100) aligned; if star_type = expected_star_type then message = ""; else do; if star_type = 0 then message = "type 0"; else if star_type = 1 then message = "type 1"; else if star_type = 2 then message = "type 2"; else message = "invalid type " || ltrim (character (star_type)); if status = expected_status then return; message = message || " with "; end; if status = 0 then message = message || "NO_ERROR"; else if status = error_table_$archive_pathname then message = message || "ARCHIVE_PATHNAME"; else if status = error_table_$bad_arg then message = message || "BAD_ARG"; else if status = error_table_$bad_file_name then message = message || "BAD_FILE_NAME"; else if status = error_table_$badequal then message = message || "BADEQUAL"; else if status = error_table_$badpath then message = message || "BADPATH"; else if status = error_table_$badstar then message = message || "BADSTAR"; else if status = error_table_$entlong then message = message || "ENTLONG"; else if status = error_table_$inconsistent then message = message || "INCONSISTENT"; else if status = error_table_$invalid_ascii then message = message || "INVALID_ASCII"; else if status = error_table_$nomatch then message = message || "NOMATCH"; else if status = error_table_$nostars then message = message || "NOSTARS"; else if status = error_table_$null_name_component then message = message || "NULL_NAME_COMPONENT"; else do; call convert_status_code_ (status, (""), buffer); message = message || "unexpected "; message = message || requote_string_ (rtrim (buffer)); end; return; end classify_status; %page; test_check_star_name: entry () options (variable); whoami = "test_check_star_name"; call cu_$arg_count (arg_count, status); if status ^= 0 then do; call com_err_ (status, whoami); return; end; if arg_count ^= 4 then do; call com_err_$suppress_name (0, whoami, "Usage: ^a starname mask_list type code", whoami); return; end; call cu_$arg_ptr (2, arg_ptr, arg_len, (0)); mask = ""b; do while (arg_len > 0); star_len = index (arg, ",") - 1; if star_len < 0 then star_len = arg_len; if star_len = 0 then do; call com_err_ (0, whoami, "Bad syntax in mask_list ^a.", requote_string_ (arg)); return; end; star_ptr = arg_ptr; arg_len = arg_len - star_len - 1; arg_ptr = addcharno (arg_ptr, star_len + 1); invert = "0"b; if substr (star, 1, 1) = "^" then do; invert = "1"b; star_len = star_len - 1; star_ptr = addcharno (star_ptr, 1); end; if star = "entry_default" then star_mask = CHECK_STAR_ENTRY_DEFAULT; else if star = "ignore_all" then star_mask = CHECK_STAR_IGNORE_ALL; else if star = "ignore_archive" then star_mask = CHECK_STAR_IGNORE_ARCHIVE; else if star = "ignore_entrypoint" then star_mask = CHECK_STAR_IGNORE_ENTRYPOINT; else if star = "ignore_equal" then star_mask = CHECK_STAR_IGNORE_EQUAL; else if star = "ignore_length" then star_mask = CHECK_STAR_IGNORE_LENGTH; else if star = "ignore_nonascii" then star_mask = CHECK_STAR_IGNORE_NONASCII; else if star = "ignore_null" then star_mask = CHECK_STAR_IGNORE_NULL; else if star = "ignore_path" then star_mask = CHECK_STAR_IGNORE_PATH; else if star = "process_archive" then star_mask = CHECK_STAR_PROCESS_ARCHIVE; else if star = "path_default" then star_mask = CHECK_STAR_PATH_DEFAULT; else if star = "process_entrypoint" then star_mask = CHECK_STAR_PROCESS_ENTRYPOINT; else if star = "process_path" then star_mask = CHECK_STAR_PROCESS_PATH; else if star = "reject_wild" then star_mask = CHECK_STAR_REJECT_WILD; else if star = "unimplemented" then star_mask = CHECK_STAR_UNIMPLEMENTED; else do; call com_err_ (0, whoami, "Invalid mask keyword ^a.", requote_string_ (star)); return; end; if invert then mask = mask & ^star_mask; else mask = mask | star_mask; end; call cu_$arg_ptr (3, arg_ptr, arg_len, (0)); if arg = "0" | arg = "pl1" | arg = "pl/1" | arg = "PL1" | arg = "PL/I" then check_star_type = STAR_TYPE_USE_PL1_COMPARE; else if arg = "1" | arg = "match" | arg = "MATCH" then check_star_type = STAR_TYPE_USE_MATCH_PROCEDURE; else if arg = "2" | arg = "any" | arg = "ANY" | arg = "every" | arg = "EVERY" then check_star_type = STAR_TYPE_MATCHES_EVERYTHING; else do; call com_err_ (0, whoami, "Invalid star type keyword ^a.", requote_string_ (arg)); return; end; call cu_$arg_ptr (4, arg_ptr, arg_len, (0)); if arg = "0" | arg = "no_error" | arg = "NO_ERROR" then check_status = 0; else if arg = "archive_pathname" | arg = "ARCHIVE_PATHNAME" then check_status = error_table_$archive_pathname; else if arg = "bad_arg" | arg = "BAD_ARG" then check_status = error_table_$bad_arg; else if arg = "bad_file_name" | arg = "BAD_FILE_NAME" then check_status = error_table_$bad_file_name; else if arg = "badequal" | arg = "BADEQUAL" then check_status = error_table_$badequal; else if arg = "badpath" | arg = "BADPATH" then check_status = error_table_$badpath; else if arg = "badstar" | arg = "BADSTAR" then check_status = error_table_$badstar; else if arg = "entlong" | arg = "ENTLONG" then check_status = error_table_$entlong; else if arg = "inconsistent" | arg = "INCONSISTENT" then check_status = error_table_$inconsistent; else if arg = "invalid_ascii" | arg = "INVALID_ASCII" then check_status = error_table_$invalid_ascii; else if arg = "nostars" | arg = "NOSTARS" then check_status = error_table_$nostars; else if arg = "null_name_component" | arg = "NULL_NAME_COMPONENT" then check_status = error_table_$null_name_component; else do; call com_err_ (0, whoami, "Invalid error keyword ^a.", requote_string_ (arg)); return; end; call cu_$arg_ptr (1, star_ptr, star_len, (0)); call check_star_name_ (star, mask, star_type, status); if star_type ^= check_star_type | status ^= check_status then call error ("CHECK", check_star_type, check_status); return; end test_match_star_name; */ ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull and Bull HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by Bull HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved */