From 325530e630c68c7c10a2f4339f5b43434fcd0329 Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 14:19:35 +0000 Subject: Incorporation into IvyLeague Ccu -> Ivl ccu -> ivl Smart pointers disappear (too dangerous) Imakefile disappears (Makefile now) An empty cplus_bugs.h has been created locally --- utils/DirPath.cc | 59 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'utils/DirPath.cc') diff --git a/utils/DirPath.cc b/utils/DirPath.cc index 0536eb2..c8c3d3f 100644 --- a/utils/DirPath.cc +++ b/utils/DirPath.cc @@ -20,20 +20,19 @@ #include #include -/*?class CcuDirPath -\typ{CcuDirPath}s generalize the idea contained in the \com{PATH} environment variable +/*?class IvlDirPath +\typ{IvlDirPath}s generalize the idea contained in the \com{PATH} environment variable of UNIX. -A \typ{CcuDirPath} is a list of strings, which are thought of as directory names. +A \typ{IvlDirPath} is a list of strings, which are thought of as directory names. When looking for a file, each directory in the list is scanned, until the file is found or the end of the list is reached. ?*/ - /*? Construct an empty directory path. ?*/ -CcuDirPath :: CcuDirPath () -: CcuList (), +IvlDirPath :: IvlDirPath () +: IvlList (), Alloc (DontAllocNames) { } @@ -43,29 +42,29 @@ Construct an empty directory path. The default allocation mode is set to \var{alloc} (see function \fun{FindFile}). All other constructors initialize it to 0. ?*/ -CcuDirPath :: CcuDirPath (alloc_mode alloc) -: CcuList (), +IvlDirPath :: IvlDirPath (alloc_mode alloc) +: IvlList (), Alloc (alloc) { } /*? -Construct a \typ{CcuDirPath} which has one element \var{name}. The string \var{name} +Construct a \typ{IvlDirPath} which has one element \var{name}. The string \var{name} is copied. ?*/ -CcuDirPath :: CcuDirPath (const char* name) -: CcuList (NewString (name)), +IvlDirPath :: IvlDirPath (const char* name) +: IvlList (NewString (name)), Alloc (DontAllocNames) { } /*? -Construct a \typ{CcuDirPath} with two or more elements (\var{first}, \var{second}, +Construct a \typ{IvlDirPath} with two or more elements (\var{first}, \var{second}, and so on). All strings (\var{first} and the following ones) are copied. {\bf The argument list must be null-terminated.} ?*/ -CcuDirPath :: CcuDirPath (const char* first, const char*, ...) -: CcuList (), +IvlDirPath :: IvlDirPath (const char* first, const char*, ...) +: IvlList (), Alloc (DontAllocNames) { @@ -83,18 +82,18 @@ CcuDirPath :: CcuDirPath (const char* first, const char*, ...) } /*?nodoc?*/ -CcuDirPath :: ~CcuDirPath () +IvlDirPath :: ~IvlDirPath () { - CcuListIter li (*this); + IvlListIter li (*this); while (++li) FreeString ((char*) (*li)); } /*?nextdoc?*/ void -CcuDirPath :: Append (const char* dir) +IvlDirPath :: Append (const char* dir) { - CcuList::Append (NewString (dir)); + IvlList::Append (NewString (dir)); } /*? @@ -102,18 +101,18 @@ Append (resp. prepend) a directory name to a search path. A copy of the string \var{dir} is created. ?*/ void -CcuDirPath :: Prepend (const char* dir) +IvlDirPath :: Prepend (const char* dir) { - CcuList::Prepend (NewString (dir)); + IvlList::Prepend (NewString (dir)); } /*?nodoc?*/ int -CcuDirPath :: Remove (const char* d) +IvlDirPath :: Remove (const char* d) { int removed = 0; - CcuListIter li (*this); - CcuListIter lj (*this); + IvlListIter li (*this); + IvlListIter lj (*this); while (++li) { int remove = (strcmp (d, (const char*) *li) == 0); if (remove) { @@ -138,7 +137,7 @@ A pathname is considered a full pathname (and hence is not looked up in the search path) if it begins with ``\com{/}'', ``\com{./}'' or ``\com{../}''. ?*/ const char* -CcuDirPath :: FindFile (const char* fn, alloc_mode alloc) +IvlDirPath :: FindFile (const char* fn, alloc_mode alloc) { if (!fn) return 0; @@ -157,7 +156,7 @@ CcuDirPath :: FindFile (const char* fn, alloc_mode alloc) /* Else, look through search path */ - CcuListIter it (*this) ; + IvlListIter it (*this) ; while (++it) { dir = (char*) (*it); strcpy (absfn, dir); @@ -177,11 +176,11 @@ CcuDirPath :: FindFile (const char* fn, alloc_mode alloc) /*? This function is similar to the previous one. -It uses the allocation mode of this \typ{CcuDirPath} to decide whether to allocate +It uses the allocation mode of this \typ{IvlDirPath} to decide whether to allocate the returned string or not. ?*/ const char* -CcuDirPath :: FindFile (const char* fn) +IvlDirPath :: FindFile (const char* fn) { } @@ -189,7 +188,7 @@ CcuDirPath :: FindFile (const char* fn) Set the allocation mode of this dir path to \var{alloc}. ?*/ void -CcuDirPath :: SetAlloc (alloc_mode alloc) +IvlDirPath :: SetAlloc (alloc_mode alloc) { } @@ -201,14 +200,14 @@ i.e. dir1:dir2:\ldots:dirN. \var{sep} is the character separating the different Its default value is ``:''. ?*/ void -CcuDirPath :: AppendEnvPath (const char* path, char sep) +IvlDirPath :: AppendEnvPath (const char* path, char sep) { const char *dir, *next = path; for (dir = path; next; dir = next+1) { next = strchr (dir, sep); if (next != dir) - CcuList::Append (next ? NewString (dir, next-dir) : NewString (dir)); + IvlList::Append (next ? NewString (dir, next-dir) : NewString (dir)); } } -- cgit v1.1