File:  [Research Unix] / researchv10no / cmd / sml / src / util / errormsg.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* Copyright 1989 by AT&T Bell Laboratories *)
structure ErrorMsg : ERRORMSG = struct

    exception Syntax

    val anyErrors = ref false
    val lineNum = ref 1
    val fileName = ref ""
    val debugging = System.Control.debugging

    fun say (msg: string) =
	(if !System.interactive then ()
	 else (print (!fileName); print ", "; print "line ";
               print (makestring(!lineNum)); print ": ");
         print msg;
	 print "\n";
         ())

    fun warn msg = say ("Warning: " ^ msg)

    fun complain (msg: string) =
	(say ("Error: " ^ msg); anyErrors := true)
 
    fun condemn msg = (complain msg; raise Syntax)
    fun impossible msg = condemn("Compiler bug: " ^ msg)

    fun flaggedmsg (flg : bool ref) (msg : string) =
	let val printit = !flg
	in  if printit then (print msg; print "\n")
	    else ();
	    printit
	end
    val debugmsg = flaggedmsg debugging

end  (* structure ErrorMsg *)


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.