*file member=add_warning library=snoman language=fortran77 date=16:Mar:1999 <<< subroutine add_warning( c_message ) * Utility: Add/report important warning messages. * Contact: N. West, Oxford. * Parameters:- * ========== * c_message in char*(*) message * Common Block Access:- * =================== * (ignoring internal and environmental access) * None. * ADD_WARNING Specification:- * ========================== * o Add message, ignoring duplicates, to message set ready for report_warning. * REPORT_WARNING Specification:- * ============================= * Report warning message set on specified unit number. * Program Notes:- * ============= * Important messages can be funnelled into this routine which will be * called to report them at the start of the execution phase and again * at the end of termination. ADD_WARNING ignores repeated warnings * allowing multiple software units to report the same problem without * duplication (so long as the messages are identical). * Revision History:- * ================ * 3.02 N. West First version. Ignore duplicates. Fix format: (add ,). implicit none * Argument Declarations:- * ===================== character*(*) c_message integer lun *endheader * Local Variable Declarations:- * =========================== integer MAX_MSG parameter (MAX_MSG = 20) character*130 c_msgs(MAX_MSG) integer num_msg, j_msg, + itrail save c_msgs, num_msg data num_msg / 0 / ** Store message if there is room, ignoring duplicates. do j_msg = 1, num_msg if ( c_message .eq. c_msgs(j_msg) ) return enddo num_msg = num_msg + 1 if ( num_msg .le. MAX_MSG ) c_msgs(num_msg) = c_message return <<< entry report_warning( lun ) * *************************** * Report warning on specified unit number. * Parameters:- * ========== * lun in Unit number if ( num_msg .eq. 0 ) return write(lun,90000) write(lun,90001) write(lun,90002) write(lun,90003) write(lun,90002) do j_msg = 1, min( num_msg, MAX_MSG ) if ( c_msgs(j_msg)(73:) .eq. ' ') c_msgs(j_msg)(73:74) = '!!' write(lun,90004) c_msgs(j_msg)(1:itrail(c_msgs(j_msg))) enddo if ( num_msg .gt. MAX_MSG ) then write(lun,90002) write(lun,90005) num_msg-MAX_MSG, num_msg endif write(lun,90002) write(lun,90001) return 90000 format(/) 90001 format(' ',78('!')) 90002 format(' !! ', + ' !!') 90003 format(' !! The following serious warnings were reported. Ignore' + , ' them at your peril !!',/ + ' !! (Further detail may have been written to the', + ' log file) !!') 90004 format(' !! ',a) 90005 format(' !! ',i5,' additional warnings lost. Set MAX_MSG = ', + i5,' in ADD_WARNING !!') end *endfile member=add_warning