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/cm/smlfile/skel-io.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/smlfile/skel-io.sml

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

revision 353, Thu Jun 24 09:43:28 1999 UTC revision 354, Fri Jun 25 08:36:12 1999 UTC
# Line 6  Line 6 
6   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7   *)   *)
8  signature SKELIO = sig  signature SKELIO = sig
9      val read : AbsPath.t * TStamp.t -> Skeleton.decl option      val read : string * TStamp.t -> Skeleton.decl option
10      val write : AbsPath.t * Skeleton.decl * TStamp.t -> unit      val write : string * Skeleton.decl * TStamp.t -> unit
11  end  end
12    
13  structure SkelIO :> SKELIO = struct  structure SkelIO :> SKELIO = struct
# Line 129  Line 129 
129          if nl = SOME #"\n" then r else raise FormatError          if nl = SOME #"\n" then r else raise FormatError
130      end      end
131    
132      fun read (ap, ts) =      fun read (s, ts) =
133          if TStamp.needsUpdate { target = AbsPath.tstamp ap, source = ts } then          if TStamp.needsUpdate { target = TStamp.fmodTime s, source = ts } then
134              NONE              NONE
135          else          else
136              SOME (SafeIO.perform { openIt = fn () => AbsPath.openBinIn ap,              SOME (SafeIO.perform { openIt = fn () => BinIO.openIn s,
137                                     closeIt = BinIO.closeIn,                                     closeIt = BinIO.closeIn,
138                                     work = read_decl,                                     work = read_decl,
139                                     cleanup = fn () => () })                                     cleanup = fn () => () })
140              handle _ => NONE              handle _ => NONE
141    
142      fun write (ap, sk, ts) = let      fun write (s, sk, ts) = let
143          fun cleanup () =          fun cleanup () =
144              (AbsPath.delete ap;              (OS.FileSys.remove s handle _ => ();
145               Say.say ["[writing ", AbsPath.name ap, " failed]\n"])               Say.say ["[writing ", s, " failed]\n"])
146      in      in
147          SafeIO.perform { openIt = fn () => AbsPath.openBinOut ap,          SafeIO.perform { openIt = fn () => AutoDir.openBinOut s,
148                           closeIt = BinIO.closeOut,                           closeIt = BinIO.closeOut,
149                           work = fn s => write_decl (s, sk),                           work = fn s => write_decl (s, sk),
150                           cleanup = cleanup };                           cleanup = cleanup };
151          AbsPath.setTime (ap, ts)          TStamp.setTime (s, ts)
152      end      end
153  end  end

Legend:
Removed from v.353  
changed lines
  Added in v.354

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