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

SCM Repository

[smlnj] View of /sml/trunk/src/compiler/MiscUtil/util/pathnames.sml
ViewVC logotype

View of /sml/trunk/src/compiler/MiscUtil/util/pathnames.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 114 - (download) (annotate)
Fri Jun 5 19:41:21 1998 UTC (22 years, 3 months ago) by monnier
File size: 1181 byte(s)
This commit was generated by cvs2svn to compensate for changes in r113,
which included commits to RCS files with non-trunk default branches.
(* Copyright 1989 by AT&T Bell Laboratories *)

structure Pathnames : PATHNAMES =

  fun findChr (ch :string) ((i,s) :int * string) :int =
    let val len = String.size s
        fun find j =
          if j=len
          then 0
          else if ch = substring(s,j,1)
                 then j+1
                 else find (j+1)
    in if (size ch) = 0 then 0 else find i end;
  fun explodePath (path:string) :string list =
    let val slash = findChr "/" (0,path)
        val len = size path
      if slash = 0
        then [path]
        else ((substring (path, 0, slash-1)) ::
              (explodePath (substring (path, slash, len - slash))))

  fun implodePath (pathlist :string list) :string =
    let fun merge (x,y) = if y = "" then x else (x ^ "/" ^ y) in
      foldr merge "" pathlist

  fun trim (path:string) :string = path
(*    let val parts = explodePath path
        val len = length parts
        val strip = if len<=2 then 0 else len-1
        val showParts' = nthtail (parts, strip)
        val showParts = if strip>0 then ("..."::showParts') else showParts'
      implodePath showParts

 * $Log$

ViewVC Help
Powered by ViewVC 1.0.0