/* *********************************************************** * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * *********************************************************** */ convert_numeric_file: cnf: proc; /* This command converts a single precision random numeric file (basic or fortran) to a double precision random numeric file or vice versa. Usage: convert_numeric_file old_path new_path -control arg- 1) old_path is the pathname of the file to be converted 2) new_path is the pathname of the target file; . if it is not of 0 length, it is automatically truncated 3) control arg may be either . -double_precision,-dp convert from single to double precision; default . -single_precision,-sp convert from double to single precision */ /* coded 76.02.17 by M. Weaver */ dcl arg char (alng) based (aptr); dcl header_numbers (2) char (1) init ("1", "2"); dcl me char (20) aligned static init ("convert_numeric_file") options (constant); dcl path (2) char (168); dcl (alng, i, j, name_num, prec (2)) fixed bin; dcl (num_size (2), n_read) fixed bin (21); dcl (onum, tnum) float bin (63); dcl based_single float bin (27) based (bs_ptr); dcl code fixed bin (35); dcl (error_table_$badopt, error_table_$end_of_info, error_table_$incompatible_attach) fixed bin (35) ext; dcl sp_to_dp bit (1) aligned; dcl cleanup condition; dcl (aptr, iocb_ptr (2), onum_ptr, tnum_ptr, bs_ptr) ptr; dcl (addr, null, round, substr) builtin; dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin) returns (fixed bin (35)); dcl (com_err_, ioa_) entry options (variable); dcl iox_$attach_ioname entry (char (*), ptr, char (*), fixed bin (35)); dcl iox_$open entry (ptr, fixed bin, bit (1) aligned, fixed bin (35)); dcl iox_$get_chars entry (ptr, ptr, fixed bin (21), fixed bin (21), fixed bin (35)); dcl iox_$put_chars entry (ptr, ptr, fixed bin (21), fixed bin (35)); dcl iox_$close entry (ptr, fixed bin (35)); dcl iox_$detach_iocb entry (ptr, fixed bin (35)); dcl iox_$destroy_iocb entry (ptr, fixed bin (35)); dcl unique_chars_ entry (bit (*)) returns (char (15)); %include iox_modes; %include iocb; sp_to_dp = "1"b; /* initialize default */ name_num = 0; i = 1; do while (cu_$arg_ptr (i, aptr, alng) = 0); if substr (arg, 1, 1) = "-" then do; /* have control arg */ if arg = "dp" | arg = "-double_precision" then sp_to_dp = "1"b; else if arg = "-sp" | arg = "-single_precision" then sp_to_dp = "0"b; else do; call com_err_ (error_table_$badopt, me, arg); return; end; end; else do; /* must be pathname */ name_num = name_num + 1; if name_num > 2 then goto name_error; path (name_num) = arg; end; i = i + 1; end; if name_num ^= 2 then do; name_error: call com_err_ (0, me, "Exactly two pathnames must be given."); return; end; iocb_ptr (1), iocb_ptr (2) = null; on cleanup call clean_up; if sp_to_dp then do; prec (1) = 1; prec (2) = 2; bs_ptr = addr (onum); end; else do; prec (1) = 2; prec (2) = 1; bs_ptr = addr (tnum); end; /* open input file */ j = 1; call iox_$attach_ioname ((unique_chars_ ("0"b)), iocb_ptr (1), "vfile_ " || path (1) || " -ssf -no_trunc -header " || header_numbers (prec (1)), code); if code ^= 0 then goto finish; call iox_$open (iocb_ptr (1), Stream_input, "0"b, code); if code ^= 0 then goto finish; /* open output file */ j = 2; call iox_$attach_ioname ((unique_chars_ ("0"b)), iocb_ptr (2), "vfile_ " || path (2) || " -ssf -header " || header_numbers (prec (2)), code); if code ^= 0 then goto finish; call iox_$open (iocb_ptr (2), Stream_output, "0"b, code); if code ^= 0 then goto finish; onum_ptr = addr (onum); tnum_ptr = addr (tnum); do i = 1 to 2; num_size (i) = prec (i) * 4; /* get byte count for input, output */ end; /* copy numbers one at a time; double precision variables are used for the actual I/O but the appropriate one is referenced as single precision */ do while ("1"b); /* loop is terminated by end of info */ call iox_$get_chars (iocb_ptr (1), onum_ptr, num_size (1), n_read, code); if code ^= 0 then do; if code = error_table_$end_of_info then code = 0; /* normal termination */ j = 1; /* print first pathname */ goto finish; end; if sp_to_dp then tnum = based_single; else based_single = round (onum, 27); call iox_$put_chars (iocb_ptr (2), tnum_ptr, num_size (2), code); if code ^= 0 then goto finish; end; finish: call clean_up; if code ^= 0 then do; if (j = 1) & (code = error_table_$incompatible_attach) then call com_err_ (0, me, "File ^a does not need converting.", path (j)); else call com_err_ (code, me, path (j)); end; return; clean_up: proc; dcl ecode fixed bin (35); do i = 1 to 2; /* close, etc. all files */ if iocb_ptr (i) ^= null then do; ecode = -1; if iocb_ptr (i) -> iocb.open_descrip_ptr ^= null then call iox_$close (iocb_ptr (i), ecode); if ecode <= 0 then if iocb_ptr (i) -> iocb.attach_descrip_ptr ^= null then call iox_$detach_iocb (iocb_ptr (i), ecode); if ecode = 0 then call iox_$destroy_iocb (iocb_ptr (i), ecode); end; end; return; end; end; */ ----------------------------------------------------------- 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 */