|
|
1.1 ! root 1: (* Copyright 1989 by AT&T Bell Laboratories *) ! 2: structure ErrorMsg : ERRORMSG = struct ! 3: ! 4: exception Syntax ! 5: ! 6: val anyErrors = ref false ! 7: val lineNum = ref 1 ! 8: val fileName = ref "" ! 9: val debugging = System.Control.debugging ! 10: ! 11: fun say (msg: string) = ! 12: (if !System.interactive then () ! 13: else (print (!fileName); print ", "; print "line "; ! 14: print (makestring(!lineNum)); print ": "); ! 15: print msg; ! 16: print "\n"; ! 17: ()) ! 18: ! 19: fun warn msg = say ("Warning: " ^ msg) ! 20: ! 21: fun complain (msg: string) = ! 22: (say ("Error: " ^ msg); anyErrors := true) ! 23: ! 24: fun condemn msg = (complain msg; raise Syntax) ! 25: fun impossible msg = condemn("Compiler bug: " ^ msg) ! 26: ! 27: fun flaggedmsg (flg : bool ref) (msg : string) = ! 28: let val printit = !flg ! 29: in if printit then (print msg; print "\n") ! 30: else (); ! 31: printit ! 32: end ! 33: val debugmsg = flaggedmsg debugging ! 34: ! 35: end (* structure ErrorMsg *) ! 36:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.