Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/FLINT/trans/translate.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/trans/translate.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 251, Mon Apr 19 02:55:26 1999 UTC revision 422, Sun Sep 5 22:49:38 1999 UTC
# Line 77  Line 77 
77    
78  (** sorting the record fields for record types and record expressions *)  (** sorting the record fields for record types and record expressions *)
79  fun elemgtr ((LABEL{number=x,...},_),(LABEL{number=y,...},_)) = (x>y)  fun elemgtr ((LABEL{number=x,...},_),(LABEL{number=y,...},_)) = (x>y)
80  fun sorted x = Sort.sorted elemgtr x  fun sorted x = ListMergeSort.sorted elemgtr x
81  fun sortrec x = Sort.sort elemgtr x  fun sortrec x = ListMergeSort.sort elemgtr x
82    
83  (** check if an access is external *)  (** check if an access is external *)
84  fun extern (DA.EXTERN _) = true  fun extern (DA.EXTERN _) = true
# Line 237  Line 237 
237  val persmap = ref (Map.empty : pidInfo Map.map)  val persmap = ref (Map.empty : pidInfo Map.map)
238    
239  fun mkPid (pid, t, l, nameOp) =  fun mkPid (pid, t, l, nameOp) =
240    (let val pinfo = Map.lookup (!persmap) pid      case Map.find (!persmap, pid)
241         val (npinfo, var) = mergePidInfo (pinfo, t, l, nameOp)        of NONE =>
     in persmap := Map.add(Map.delete(pid, !persmap), pid, npinfo); var  
    end handle Map.MapF =>  
242           let val (pinfo, var) = mkPidInfo (t, l, nameOp)           let val (pinfo, var) = mkPidInfo (t, l, nameOp)
243            in persmap := Map.add(!persmap, pid, pinfo); var             in persmap := Map.insert(!persmap, pid, pinfo);
244           end)                var
245              end
246           | SOME pinfo =>
247              let val (npinfo, var) = mergePidInfo (pinfo, t, l, nameOp)
248                  fun rmv (key, map) =
249                      let val (newMap, _) = Map.remove(map, key)
250                      in newMap
251                      end handle e => map
252               in persmap := Map.insert(rmv(pid, !persmap), pid, npinfo);
253                  var
254              end
255    
256  (** converting an access w. type into a lambda expression *)  (** converting an access w. type into a lambda expression *)
257  fun mkAccT (p, t, nameOp) =  fun mkAccT (p, t, nameOp) =
# Line 1153  Line 1161 
1161  val body = mkDec (rootdec, DI.top) exportLexp  val body = mkDec (rootdec, DI.top) exportLexp
1162    
1163  (** wrapping up the body with the imported variables *)  (** wrapping up the body with the imported variables *)
1164  val (plexp, imports) = wrapPidInfo (body, Map.members (!persmap))  val (plexp, imports) = wrapPidInfo (body, Map.listItemsi (!persmap))
1165    
1166  fun prGen (flag,printE) s e =  fun prGen (flag,printE) s e =
1167    if !flag then (say ("\n\n[After " ^ s ^ " ...]\n\n"); printE e) else ()    if !flag then (say ("\n\n[After " ^ s ^ " ...]\n\n"); printE e) else ()
# Line 1169  Line 1177 
1177  end (* structure Translate *)  end (* structure Translate *)
1178    
1179    
 (*  
  * $Log$  
  *)  

Legend:
Removed from v.251  
changed lines
  Added in v.422

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0