cvs commit: hugs98/src connect.h input.c machdep.c

nordland@glass.cse.ogi.edu nordland@glass.cse.ogi.edu
Wed, 19 Sep 2001 12:14:07 -0700


nordland    2001/09/19 12:14:07 PDT

  Modified files:
    src                  connect.h input.c machdep.c 
  Log:
  Reimplemented the file search algorithm according to the following principle.
  I assume that the file found will be the first readable filename in the list
  produced by "find".
  
    find along nm hugspath = [ d++f++e | f <- files, d <- dirs, e <- exts ]
      where
        (pref,name) = rspan (/=slash) nm
        dirs        = if null pref then along : hugspath ++ [""] else [pref]
        files       = if isQModId name then [mod2dir name, name] else [name]
        exts        = ["",".hs",".lhs"]
  
        rspan p s   = let (a,b) = span p (reverse s) in (reverse b, reverse a)
        mod2dir s   = map (\c -> if c=='.' then slash else c) s
        isQModId s  = -- is s a valid qualified module identifier?
  
  The SEARCH_DIR option is still compatible with this principle, although it
  is turned off by default.
  
  Revision  Changes    Path
  1.23      +3 -2      hugs98/src/connect.h
  1.28      +18 -2     hugs98/src/input.c
  1.27      +90 -48    hugs98/src/machdep.c