Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/nrrd/run-dnorm_sml.in
ViewVC logotype

Diff of /branches/vis12/src/compiler/nrrd/run-dnorm_sml.in

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

revision 1115, Thu May 5 04:42:18 2011 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 18  Line 18 
18      structure SS = Substring      structure SS = Substring
19    
20    (* search path for the dnorm executable *)    (* search path for the dnorm executable *)
21      val path = [      val paths = [
22              "@DIDEROT_ROOT@/bin/dnorm", "@prefix@/bin/dnorm"              "@DIDEROT_ROOT@/bin", "@prefix@/bin"
23            ]            ]
24    
25      fun findExe () = (  (* FIXME: with SML/NJ 110.73, we'll be able to use PathUtil.findExe *)
26            case List.find (fn p => OS.FileSys.access(p, [OS.FileSys.A_EXEC])) path      fun findExe () = let
27              fun isExe p = OS.FileSys.access(p, [OS.FileSys.A_EXEC])
28              in
29                case PathUtil.existsFile isExe paths "dnorm"
30             of SOME cmd => cmd             of SOME cmd => cmd
31              | NONE => raise Fail "unable to find dnorm executable"              | NONE => raise Fail "unable to find dnorm executable"
32            (* end case *))              (* end case *)
33              end
34    
35      fun run srcFile = let      fun run srcFile = if OS.FileSys.access(srcFile, [OS.FileSys.A_READ])
36              then let
37            val proc = Unix.execute (findExe(), ["-h", "-i", srcFile])            val proc = Unix.execute (findExe(), ["-h", "-i", srcFile])
38            val inS = Unix.textInstreamOf proc            val inS = Unix.textInstreamOf proc
39            fun stripWS ss = SS.string (SS.dropl Char.isSpace (SS.dropr Char.isSpace ss))            fun stripWS ss = SS.string (SS.dropl Char.isSpace (SS.dropr Char.isSpace ss))
# Line 55  Line 60 
60                then info                then info
61                else raise Fail "error running dnorm"                else raise Fail "error running dnorm"
62            end            end
63              else raise Fail(concat["image file \"", srcFile, "\" not found"])
64    end    end

Legend:
Removed from v.1115  
changed lines
  Added in v.1116

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