src/Tools/Compute_Oracle/am_ghc.ML
changeset 32740 9dd0a2f83429
parent 30161 c26e515f1c29
child 32952 aeb1e44fbc19
equal deleted inserted replaced
32739:31e75ad9ae17 32740:9dd0a2f83429
   142 	fold_rev add_rule rules Inttab.empty
   142 	fold_rev add_rule rules Inttab.empty
   143     end
   143     end
   144 
   144 
   145 fun haskell_prog name rules = 
   145 fun haskell_prog name rules = 
   146     let
   146     let
   147 	val buffer = ref ""
   147 	val buffer = Unsynchronized.ref ""
   148 	fun write s = (buffer := (!buffer)^s)
   148 	fun write s = (buffer := (!buffer)^s)
   149 	fun writeln s = (write s; write "\n")
   149 	fun writeln s = (write s; write "\n")
   150 	fun writelist [] = ()
   150 	fun writelist [] = ()
   151 	  | writelist (s::ss) = (writeln s; writelist ss)
   151 	  | writelist (s::ss) = (writeln s; writelist ss)
   152 	fun str i = Int.toString i
   152 	fun str i = Int.toString i
   198 	val _ = map list_group constants
   198 	val _ = map list_group constants
   199     in
   199     in
   200 	(arity, !buffer)
   200 	(arity, !buffer)
   201     end
   201     end
   202 
   202 
   203 val guid_counter = ref 0
   203 val guid_counter = Unsynchronized.ref 0
   204 fun get_guid () = 
   204 fun get_guid () = 
   205     let
   205     let
   206 	val c = !guid_counter
   206 	val c = !guid_counter
   207 	val _ = guid_counter := !guid_counter + 1
   207 	val _ = guid_counter := !guid_counter + 1
   208     in
   208     in
   212 fun tmp_file s = Path.implode (Path.expand (File.tmp_path (Path.make [s])));
   212 fun tmp_file s = Path.implode (Path.expand (File.tmp_path (Path.make [s])));
   213 fun wrap s = "\""^s^"\""
   213 fun wrap s = "\""^s^"\""
   214 
   214 
   215 fun writeTextFile name s = File.write (Path.explode name) s
   215 fun writeTextFile name s = File.write (Path.explode name) s
   216     
   216     
   217 val ghc = ref (case getenv "GHC_PATH" of "" => "ghc" | s => s)
   217 val ghc = Unsynchronized.ref (case getenv "GHC_PATH" of "" => "ghc" | s => s)
   218 
   218 
   219 fun fileExists name = ((OS.FileSys.fileSize name; true) handle OS.SysErr _ => false)
   219 fun fileExists name = ((OS.FileSys.fileSize name; true) handle OS.SysErr _ => false)
   220 
   220 
   221 fun compile cache_patterns const_arity eqs = 
   221 fun compile cache_patterns const_arity eqs = 
   222     let
   222     let