- Added warning to DATE doc about mktime() lossage.
- Documented behavior of delete-{file,directory,filesys-object} when the named thing doesn't exist. - Documented new regexp-substitute procedures.
This commit is contained in:
parent
f30435d56f
commit
b352d0e825
|
@ -89,6 +89,59 @@ to all the special regexp characters in \var{str}.
|
||||||
{\evalto}"\\\\*Hello\\\\* world\\\\."\end{code}
|
{\evalto}"\\\\*Hello\\\\* world\\\\."\end{code}
|
||||||
\end{desc}
|
\end{desc}
|
||||||
|
|
||||||
|
\defun{regexp-substitute}{port match . items}{{\str} or \undefined}
|
||||||
|
\begin{desc}
|
||||||
|
This procedure can be used to perform string substitutions based on
|
||||||
|
regular expression matches.
|
||||||
|
The results of the substitution can be either output to a port or
|
||||||
|
returned as a string.
|
||||||
|
|
||||||
|
The \var{match} argument is a regular expression match structure
|
||||||
|
that controls the substitution.
|
||||||
|
If \var{port} is an output port, the \var{items} are written out to
|
||||||
|
the port:
|
||||||
|
\begin{itemize}
|
||||||
|
\item If an item is a string, it is copied directly to the port.
|
||||||
|
\item If an item is an integer, the corresponding submatch from \var{match}
|
||||||
|
is written to the port.
|
||||||
|
\item If an item is \ex{'pre},
|
||||||
|
the prefix of the matched string (the text preceding the match)
|
||||||
|
is written to the port.
|
||||||
|
\item If an item is \ex{'post},
|
||||||
|
the suffix of the matched string is written.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
If \var{port} is {\sharpf}, nothing is written, and a string is constructed
|
||||||
|
and returned instead.
|
||||||
|
\end{desc}
|
||||||
|
|
||||||
|
\defun{regexp-substitute/global}{port regexp string . items}
|
||||||
|
{{\str} or \boolean}
|
||||||
|
\begin{desc}
|
||||||
|
This procedure is similar to \ex{regexp-substitute},
|
||||||
|
but can be used to perform multiple match/substitute operations over
|
||||||
|
a string.
|
||||||
|
It has the following differences with \ex{regexp-substitute}:
|
||||||
|
\begin{itemize}
|
||||||
|
\item It takes a regular expression and string to be matched as
|
||||||
|
parameters, instead of a completed match structure.
|
||||||
|
\item If an item is \ex{'post}, the procedure recurses on the suffix string
|
||||||
|
(the text from \var{string} following the match).
|
||||||
|
\item If \var{port} is an output port:
|
||||||
|
\begin{itemize}
|
||||||
|
\item There was at least one match: return true.
|
||||||
|
\item No match: return false.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\item \var{port} is \sharpf:
|
||||||
|
\begin{itemize}
|
||||||
|
\item There was at least one match: construct and return a string.
|
||||||
|
\item No match: return false.
|
||||||
|
\end{itemize}
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\end{desc}
|
||||||
|
|
||||||
\subsection{Other string manipulation facilities}
|
\subsection{Other string manipulation facilities}
|
||||||
|
|
||||||
\defun {index} {string char [start]} {{\fixnum} or false}
|
\defun {index} {string char [start]} {{\fixnum} or false}
|
||||||
|
|
|
@ -1108,6 +1108,10 @@ These procedures delete objects from the file system.
|
||||||
The {\ttt delete\=filesys\=object} procedure will delete an object
|
The {\ttt delete\=filesys\=object} procedure will delete an object
|
||||||
of any type from the file system: files, (empty) directories, symlinks, fifos,
|
of any type from the file system: files, (empty) directories, symlinks, fifos,
|
||||||
\etc.
|
\etc.
|
||||||
|
|
||||||
|
If the object being deleted doesn't exist, \ex{delete-directory} and
|
||||||
|
\ex{delete-file} raise an error,
|
||||||
|
while \ex{delete-filesys-object} simply returns.
|
||||||
\end{defundescx}
|
\end{defundescx}
|
||||||
|
|
||||||
\begin{defundescx}{read-symlink}{fname} \str
|
\begin{defundescx}{read-symlink}{fname} \str
|
||||||
|
@ -2758,6 +2762,14 @@ String & A {\Posix} time zone string understood by the OS
|
||||||
field is a {\Posix} time zone of the form
|
field is a {\Posix} time zone of the form
|
||||||
``\ex{UTC+\emph{hh}:\emph{mm}:\emph{ss}}'';
|
``\ex{UTC+\emph{hh}:\emph{mm}:\emph{ss}}'';
|
||||||
the trailing \ex{:\emph{mm}:\emph{ss}} portion is deleted if it is zeroes.
|
the trailing \ex{:\emph{mm}:\emph{ss}} portion is deleted if it is zeroes.
|
||||||
|
|
||||||
|
\oops{The Posix facility for converting dates to times, \ex{mktime()},
|
||||||
|
has a broken design: it indicates an error by returning -1, which
|
||||||
|
is also a legal return value (for date 23:59:59 UCT, 12/31/1969).
|
||||||
|
Scsh resolves the ambiguity in a paranoid fashion: it always
|
||||||
|
reports an error if the underlying Unix facility returns -1.
|
||||||
|
We feel your pain.
|
||||||
|
}
|
||||||
\end{desc}
|
\end{desc}
|
||||||
|
|
||||||
\defun {time} {} \integer
|
\defun {time} {} \integer
|
||||||
|
|
Loading…
Reference in New Issue