diff options
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/algebra/fname.spad.pamphlet | 17 | ||||
-rw-r--r-- | src/interp/sys-os.boot | 22 | ||||
-rw-r--r-- | src/lib/cfuns-c.c | 4 |
4 files changed, 39 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4468c566..4b9e32f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-09-14 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/sys-os.boot (readablep): Import. + (writeablep): Document. + * algebra/fname.spad.pamphlet (exists?$FileName): Use existingFile? + (readable?$FileName): Use readablep. + (writeable?$FileName): Use writeable. + 2008-09-13 Gabriel Dos Reis <gdr@cs.tamu.edu> * lisp/core.lisp.in (TRANSLATE-OPTION-VALUE): New. diff --git a/src/algebra/fname.spad.pamphlet b/src/algebra/fname.spad.pamphlet index 1a66d427..bfc9dc11 100644 --- a/src/algebra/fname.spad.pamphlet +++ b/src/algebra/fname.spad.pamphlet @@ -1,15 +1,18 @@ \documentclass{article} \usepackage{axiom} \begin{document} -\title{\$SPAD/src/algebra fname.spad} + +\title{src/algebra fname.spad} \author{Stephen M. Watt} \maketitle + \begin{abstract} \end{abstract} -\eject \tableofcontents \eject + \section{category FNCAT FileNameCategory} + <<category FNCAT FileNameCategory>>= )abbrev category FNCAT FileNameCategory ++ Author: Stephen M. Watt @@ -70,7 +73,7 @@ FileNameCategory(): Category == SetCategory with )abbrev domain FNAME FileName ++ Author: Stephen M. Watt ++ Date Created: 1985 -++ Date Last Updated: June 20, 1991 +++ Date Last Updated: September 14, 2008 ++ Basic Operations: ++ Related Domains: ++ Also See: @@ -95,14 +98,16 @@ FileName(): FileNameCategory == add name(f:%): String == fnameName(f)$Lisp extension(f:%): String == fnameType(f)$Lisp - exists? f == fnameExists?(f)$Lisp - readable? f == fnameReadable?(f)$Lisp - writable? f == fnameWritable?(f)$Lisp + exists? f == existingFile?(f::String)$Lisp + readable? f == readablep(f::String)$Lisp : Integer = 1 + writable? f == writeablep(f::String)$Lisp : Integer = 1 new(d,pref,e) == fnameNew(d,pref,e)$Lisp @ + \section{License} + <<license>>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. diff --git a/src/interp/sys-os.boot b/src/interp/sys-os.boot index 3d3ecc6d..3ab992a8 100644 --- a/src/interp/sys-os.boot +++ b/src/interp/sys-os.boot @@ -45,6 +45,8 @@ module sys_-os loadSystemRuntimeCore() +--% File System Support + ++ change current working directory. import oa__chdir: string -> int for changeDirectory -- 0: success, -1: failure @@ -61,6 +63,22 @@ import oa__rename: (string,string) -> int for renameFile import oa__mkdir: string -> int for mkdir -- 0: sucess, -1: failure. +++ Test whether a path names a directory. +import directoryp: string -> int for directoryp + +++ Test whether a file exists and is accessible for read. +import readablep: string -> int for readablep + -- -1: inexistent. + -- 0: exist but read access denied. + -- 1: exist and read accress granted. + +++ Test whether a file exists and is accessible for write. +import writeablep: string -> int for writeablep + -- -1: inexistent. + -- 0: exists but write access denied + -- 1: exists and write access granted + -- 2: inexistent but write access to parent directory granted. + import oa__filedesc__read: (int,buffer,int) -> int for readFromFileHandle -- -1: failure; otherwise -- actual read bytes count @@ -124,10 +142,6 @@ import sock__send__signal: (int,int) -> int for sockSendSignal import print__line: string -> int for printLine --% -import directoryp: string -> int for directoryp - - -import writeablep: string -> int for writeablep import oa__system: string -> int for runCommand diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index b57f77ad..4fbf48de 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -184,7 +184,7 @@ axiom_has_write_access(const struct stat* file_info) /* Return -1 if the file designated by PATH is inexistent. - 0 if the file exists but wirte access is denied. + 0 if the file exists but write access is denied. 1 if the file exists and process has write access. 2 if the file does not exists but process has write has write access to the dirname of path. */ @@ -291,7 +291,7 @@ std_stream_is_terminal(int fd) } /* The MS documentation suggests `GetFileType' for determining the nature of the file handle. The return value, in our case, - is an over approximation of what we are interested int: Are we + is an over approximation of what we are interested in: Are we dealing with a stream connected to a terminal? The constant FILE_TYPE_CHAR characterises character files; in particular a console terminal, or a printer. There is an undocumented |