/* BEGIN fort_utilities.incl.pl1 */ /* Created: October 1977, Richard Barnes Modified: 22 May 1978, DSL - add create_constant. 09 Oct 1978, PES - make create_(constant node) return fixed bin(18) unsigned. 13 Dec 1978, PES - Get create_node from include file, rather than copy. */ %include fort_create_node; create_constant: proc(data_type,value) returns(fixed bin (18)); dcl (data_type,a_data_type) fixed bin(4); /* data type of constant */ dcl (value,a_value) bit(72) aligned; /* value of constant */ dcl addr builtin; dcl binary builtin; dcl bool builtin; dcl char builtin; dcl data_size fixed bin(17); dcl decimal builtin; dcl hash_index fixed bin; dcl hash_table(0:hash_table_size-1) fixed bin(35) aligned based(operand_base); dcl hash_table_size fixed bin int static options(constant) init(211); dcl hbound builtin; dcl ltrim builtin; dcl mod builtin; dcl mod_2_sum bit(36) aligned; dcl node_offset fixed bin; dcl node_ptr pointer; dcl size builtin; dcl v_array(2) bit(36) aligned based(addr(a_value)); dcl x(0:operand_max_len-1) fixed bin(35) aligned based(operand_base); %include relocation_bits; a_data_type = data_type; a_value = value; if a_data_type = char_mode | a_data_type <= 0 | a_data_type > hbound(data_type_size,1) then do; call print_message(452, ltrim(char(decimal(a_data_type,12)))); /* cannot create the node */ end; else data_size = data_type_size(a_data_type); if data_size = 1 then do; mod_2_sum = v_array(1); v_array(2) = "0"b; end; else mod_2_sum = bool(v_array(1),v_array(2),"0110"b); hash_index = mod(binary(mod_2_sum,35),hash_table_size); /* Search the hash table for the constant. */ node_offset = hash_table(hash_index); do while(node_offset > 0); /* search the entire bucket */ node_ptr = addr(x(node_offset)); if node_ptr -> constant.value = a_value /* must be same value */ then if node_ptr -> node.data_type = a_data_type /* and same data type */ then return(node_offset); node_offset = node_ptr -> node.hash_chain; /* NB - pointer remains pointing at last item in bucket */ end; /* a new constant node must be created */ node_offset = create_node(constant_node, size(constant)); if hash_table(hash_index) = 0 /* Is this the first item in the bucket? */ then hash_table(hash_index) = node_offset; /* yes */ else node_ptr -> node.hash_chain = node_offset; /* no, add it to the end */ node_ptr = addr(x(node_offset)); node_ptr -> constant.data_type = a_data_type; node_ptr -> constant.operand_type = constant_type; node_ptr -> constant.is_addressable = "1"b; node_ptr -> constant.reloc = rc_t; node_ptr -> constant.value = a_value; constant_info(data_size).constant_count = constant_info(data_size).constant_count + 1; if constant_info(data_size).first_constant = 0 /* Is this the first item of this size? */ then constant_info(data_size).first_constant = node_offset; /* yes */ else addr(x(constant_info(data_size).last_constant)) -> constant.next_constant = node_offset; /* no, add it */ constant_info(data_size).last_constant = node_offset; return(node_offset); end create_constant; /* END fort_utilities.incl.pl1 */ */ ----------------------------------------------------------- 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 */