From 52c03b20037ff02e3bde53ac6e5e20162dd40b75 Mon Sep 17 00:00:00 2001 From: sperber Date: Tue, 8 Jan 2002 15:26:02 +0000 Subject: [PATCH] Retrofit for 0.53. --- doc/src/command.tex | 80 +-- doc/src/manual.tex | 1 - doc/src/module.tex | 73 +-- doc/src/posix.tex | 1109 ------------------------------------ doc/src/utilities.tex | 707 ----------------------- doc/src/version-number.tex | 2 +- 6 files changed, 25 insertions(+), 1947 deletions(-) delete mode 100644 doc/src/posix.tex diff --git a/doc/src/command.tex b/doc/src/command.tex index fc9c9c8..c6463dc 100644 --- a/doc/src/command.tex +++ b/doc/src/command.tex @@ -88,9 +88,12 @@ The settings of all other switches are shared by all command levels. This is useful if the \code{auto-levels} switch has been used to disable the automatic pushing of new levels for errors and interrupts. -\item \code{,reset [\cvar{number}]}\\ +\item \code{,level [\cvar{number}]}\\ Pops down to a given level and restarts that level. - \cvar{Number} defaults to zero, \code{,reset} restarts the command + \cvar{Number} defaults to zero. + +\item \code{,reset}\\ + \code{,reset} restarts the command processor, discarding all existing levels. \end{description} @@ -228,25 +231,10 @@ If no \cvar{command} is given, the \code{config} package becomes the There are a number of binary switches that control the behavior of the command processor. -They can be set using the \code{,set} and \code{,unset} commands. - -\begin{description} -\item \code{,set \cvar{switch} [on | off | ?]}\\ - This sets the value of mode-switch \cvar{switch}. - The second argument defaults to \code{on}. - If the second argument is \code{?} the value of \cvar{switch} is - is displayed and not changed. - Doing \code{,set ?} will display a list of the switches and - their current values. - -\item \code{,unset \cvar{switch}}\\ - \code{,unset \cvar{switch}} is the same as - \code{,set \cvar{switch} off}. -\end{description} The switches are as follows: \begin{description} -\item \code{batch}\\ +\item \code{batch [on | off]}\\ In `batch mode' any error or interrupt that comes up will cause Scheme~48 to exit immediately with a non-zero exit status. Also, the command processor doesn't print prompts. Batch mode is @@ -254,7 +242,7 @@ The switches are as follows: % JAR says: disable auto-levels by default?? -\item \code{auto-levels}\\ +\item \code{,levels [on | off]}\\ Enables or disables the automatic pushing of a new command level when an error, interrupt, or other breakpoint occurs. When enabled (the default), breakpoints push a new command level, @@ -266,70 +254,28 @@ The switches are as follows: \item retention of the continuation in effect at the point of errors \item confusion among some newcomers \end{itemize} - With \code{auto-levels} disabled one must issue a + With \code{levels} disabled one must issue a \code{,push} command immediately following an error in order to retain the error continuation for debugging purposes; otherwise the continuation is lost as soon as the focus object changes. If you don't know anything about the available debugging tools, then levels might as well be disabled. -\item \code{inspect-focus-value}\\ - Enable or disable `inspection' mode, which is used for inspecting - data structures and continuations. - \link*{Inspection mode is desribed below} - [Inspection mode is described in section~\Ref] - {inspector}. - -\item \code{break-on-warnings}\\ +\item \code{break-on-warnings [on | off]}\\ Enter a new command level when a warning is produced, just as when an error occurs. Normally warnings only result in a displayed message and the program does not stop executing. - -\item \code{ask-before-loading} \\ - If on, the system will ask before loading modules that are arguments - to the \code{,open} command. \code{Ask-before-loading} is off by - default. -\begin{example} -> ,set ask-before-loading -will ask before loading modules -> ,open random -Load structure random (y/n)? y -> -\end{example} - -\item \code{load-noisily}\\ - When on, the system will print out the names of modules and files - as they are loaded. \code{load-noisily} is off by default. -\begin{example} -> ,set load-noisily -will notify when loading modules and files -> ,open random -[random /usr/local/lib/scheme48/big/random.scm] -> -\end{example} - -\item \code{inline-values}\\ -This controls whether or not the compiler is allowed to substitute - variables' values in-line. -When \code{inline-values} mode is on, -some Scheme procedures will be substituted in-line; when it is off, -none will. -\link*{The performance section}[Section~\Ref]{section:performance} -has more information. - \end{description} \section{Inspection mode} \label{inspector} There is a data inspector available via the \code{,inspect} and - \code{,debug} commands or by setting the \code{inspect-focus-value} switch. + \code{,debug} commands. The inspector is particularly useful with procedures, continuations, and records. The command processor can be taken out of inspection mode by - using the \code{q} command, by unsetting the \code{inspect-focus-value} switch, - or by going to a command level where the \code{inspect-focus-value} is not - set. + using the \code{q} command. When in inspection mode, input that begins with a letter or digit is read as a command, not as an expression. To see the value of a variable or number, do \code{(begin \cvar{exp})} @@ -551,10 +497,6 @@ When a command level is abandoned for a lower level, or when The following commands are useful when debugging multithreaded programs: \begin{description} -\item \code{,resume [\cvar{number}]}\\ - Pops out to a given level and resumes running all threads at that level. - \cvar{Number} defaults to zero. - \item \code{,threads}\\ Invokes the inspector on a list of the threads running at the next lower command level. diff --git a/doc/src/manual.tex b/doc/src/manual.tex index 5479280..aecff84 100644 --- a/doc/src/manual.tex +++ b/doc/src/manual.tex @@ -104,7 +104,6 @@ Thanks also to Deborah Tatar for providing the Yeats quotation. \include{module} \include{utilities} \include{external} -\include{posix} \include{ascii} \include{bibliography} diff --git a/doc/src/module.tex b/doc/src/module.tex index d4e1e0a..c8da646 100644 --- a/doc/src/module.tex +++ b/doc/src/module.tex @@ -132,14 +132,6 @@ The configuration language consists of top-level defining forms for \>\altz{}~ \tt(\syn{name} \syn{type}) \\ \>\altz{}~ \tt((\arbno{\syn{name}}) \syn{type}) \\ \syn{structure} \=\goesto{}~ \syn{name} \\ - \>\altz{}~ \tt(modify \syn{structure} \arbno{\syn{modifier}}) \\ - \>\altz{}~ \tt(subset \syn{structure} (\arbno{\syn{name}})) \\ - \>\altz{}~ \tt(with-prefix \syn{structure} \syn{name}) \\ - \syn{modifier} \=\goesto{}~ \tt(expose \arbno{\syn{name}}) \\ - \>\altz{}~ \tt(hide \arbno{\syn{name}}) \\ - \>\altz{}~ \tt(rename \arbno{(\syn{name}$_0$ \syn{name}$_1$)}) \\ - \>\altz{}~ \tt(alias \arbno{(\syn{name}$_0$ \syn{name}$_1$)}) \\ - \>\altz{}~ \tt(prefix \syn{name}) \\ \end{tabbing} \caption{The configuration language.} \end{figure} @@ -164,58 +156,19 @@ For building structures that export structures, there is a {\tt defpackage} Many other structures, such as record and hash table facilities, are also available in the \hack{} implementation. -The \codemainindex{{modify}}, \codemainindex{{subset}}, and - \codemainindex{{prefix}} forms produce new - views on existing structures by renaming or hiding exported names. -\code{Subset} returns a new structure that exports only the listed names - from its \syn{structure} argument. -\code{With-prefix} returns a new structure that adds \syn{prefix} - to each of the names exported by the \syn{structure} argument. -For example, if structure \code{s} exports \code{a} and \code{b}, - then -\begin{example} -(subset s (a)) -\end{example} - exports only \code{a} and -\begin{example} -(with-prefix s p/) -\end{example} -exports \code{a} as \code{p/a} and \code{b} as \code{p/b}. - -Both \code{subset} and \code{with-prefix} are simple macros that - expand into uses of \code{modify}, a more general renaming form. -In a \code{modify} structure specification the \syn{command}s are applied to - the names exported - by \syn{structure} to produce a new set of names for the \syn{structure}'s - bindings. -\code{Expose} makes only the listed names visible. -\code{Hide} makes all but the listed names visible. -\code{Rename} makes each \syn{name}$_0$ visible as \syn{name}$_1$ - name and not visible as \syn{name}$_0$ , while - \code{alias} makes each \syn{name}$_0$ visible as both \syn{name}$_0$ - and \syn{name}$_1$. -\code{Prefix} adds \syn{name} to the beginning of each exported name. -The modifiers are applied from right to left. Thus -\begin{example} -(modify scheme (prefix foo/) (rename (car bus)))) -\end{example} - makes \code{car} available as \code{foo/bus}.. - -% Use modify instead of structure-ref. -% -%An {\tt access} clause specifies which bindings of names to structures -%will be visible inside the package body for use in {\tt structure-ref} -%forms. {\tt structure-\ok{}ref} has the following syntax: -%\begin{tabbing} -%\qquad \syn{expression} \goesto{}~ -% \tt(structure-ref \syn{struct-name} \syn{name}) -%\end{tabbing} -%The \syn{struct-name} must be the name of an {\tt access}ed structure, -%and \syn{name} must be something that the structure exports. Only -%structures listed in an {\tt access} clause are valid in a {\tt -%structure-ref}. If a package accesses any structures, it should -%probably open the {\tt structure-refs} structure so that the {\tt -%structure-ref} operator itself will be available. +An {\tt access} clause specifies which bindings of names to structures +will be visible inside the package body for use in {\tt structure-ref} +forms. {\tt structure-\ok{}ref} has the following syntax: +\begin{tabbing} +\qquad \syn{expression} \goesto{}~ + \tt(structure-ref \syn{struct-name} \syn{name}) +\end{tabbing} +The \syn{struct-name} must be the name of an {\tt access}ed structure, +and \syn{name} must be something that the structure exports. Only +structures listed in an {\tt access} clause are valid in a {\tt +structure-ref}. If a package accesses any structures, it should +probably open the {\tt structure-refs} structure so that the {\tt +structure-ref} operator itself will be available. The package's body is specified by {\tt begin} and/or {\tt files} clauses. {\tt begin} and {\tt files} have the same semantics, except diff --git a/doc/src/posix.tex b/doc/src/posix.tex deleted file mode 100644 index f893b08..0000000 --- a/doc/src/posix.tex +++ /dev/null @@ -1,1109 +0,0 @@ - -\chapter{Access to POSIX} - -This chapter describes Scheme~48's interface to the POSIX C calls - \cite{POSIX}. -Scheme versions of most of the functions in POSIX are provided. -Both the interface and implementation are new and are likely to - change in future releases. -Section~\ref{function-correspondence} lists which Scheme functions - call which C functions. - -Scheme~48's POSIX interface will likely change significantly in the - future. -The implementation is new and may have significant bugs. - -The POSIX bindings are available in several structures: - -\begin{center} -\begin{tabular}{ll} - \code{posix-processes} & fork, exec, and friends \\ - \code{posix-process-data} & information about processes \\ - \code{posix-files} & files and directories \\ - \code{posix-i/o} & operations on ports \\ - \code{posix-time} & time functions \\ - \code{posix-users} & users and groups \\ - \code{posix-regexps} & regular expression matching \\ - \code{posix} & all of the above -\end{tabular} -\end{center} - -Scheme~48's POSIX interface differs from - Scsh's \cite{Shivers:Scsh-manual,Shivers:Scsh96} in several ways. -The interface here lacks Scsh's high-level constructs and utilities, - such as the process notation, \code{awk} procedure, and parsing - utilities. -Scheme~48 uses distinct types for some values that Scsh leaves - as symbols or unboxed integers; these include file types, file modes, - and user and group ids. -Many of the names and other interface details are different, as well. - -\section{Process primitives} - -The procedures described in this section control the creation of processes - and the execution of programs. -They are in the structures \code{posix-process} and \code{posix}. - -\subsection{Process creation and termination} -\label{processes} - -\begin{protos} -\proto{fork}{}{process-id or {\tt \#f}} -\protonoresult{fork-and-forget}{ thunk} -% Handler versions? -\end{protos} -\noindent -\code{Fork} creates a new child process and returns the child's process-id in - the parent and \code{\#f} in the child. -\code{Fork-and-forget} calls \cvar{thunk} in a new process; no process-id - is returned. -\code{Fork-and-forget} uses an intermediate process to avoid creating - a zombie process. - -\begin{protos} -\proto{process-id?}{ x}{boolean} -\proto{process-id=?}{ process-id0 process-id1}{boolean} -\proto{process-id->integer}{ process-id}{integer} -\proto{integer->process-id}{ integer}{process-id} -\end{protos} -\noindent -%A \cvar{process-id} is a around the actual integer id. -\code{Process-id?} is a predicate for process-ids, -\code{process-id=?} compares two to see if they are the same, - and \code{process-id-uid} returns the actual Unix id. -\code{Process-id->integer} and \code{integer->process-id} - convert process ids to and from integers. - -\begin{protos} -\proto{process-id-exit-status}{ process-id}{integer or {\tt \#f}} -\proto{process-id-terminating-signal}{ process-id}{signal or {\tt \#f}} -\protonoresult{wait-for-child-process}{ process-id} -\end{protos} -\noindent -If a process terminates normally - \code{process-id-exit-status} will return its exit status. -If the process is still running or was terminated by a signal then - \code{process-id-exit-status} will return \code{\#f}. -Similarly, if a child process was terminated by a signal - \code{process-id-terminating-signal} will return that signal and - will return \code{\#f} if the process is still running or terminated - normally. -\code{Wait-for-child-process} blocks until the child process terminates. -Scheme~48 may reap child processes before the user requests their - exit status, but it does not always do so. - -\begin{protos} -\protonoresult{exit}{ status} -\end{protos} -\noindent -Terminates the current process with the integer \cvar{status} - as its exit status. - -\subsection{{\tt Exec}} - -\begin{protos} -\protonoresult{exec}{ program-name arg0 \ldots} -\protonoresult{exec-with-environment}{ program-name env arg0 \ldots} -\protonoresult{exec-file}{ filename arg0 \ldots} -\protonoresult{exec-file-with-environment}{ filename env arg0 \ldots} -\protonoresult{exec-with-alias}{ name lookup? maybe-env arguments} -\end{protos} -\noindent -All of these replace the current program with a new one. -They differ in how the new program is found, what its environment is, - and what arguments it is passed. -\code{Exec} and \code{exec-with-environment} - look up the new program in the search path, - while \code{exec-file} and \code{exec-file-with-environment} - execute a particular file. -The environment is either inherited from the current process - (\code{exec} and \code{exec-file}) or given as an argument - (\code{\ldots{}-with-environment}). -\cvar{Program-name} and \cvar{filename} and any \cvar{arg$_i$} should be strings. - \cvar{Env} should be a list of strings of the form - \code{"\cvar{name}=\cvar{value}"}. -The first four procedures add their first argument, \cvar{program-name} or - \cvar{filename}, before the \cvar{arg0 \ldots} arguments. - -\code{Exec-with-alias} is an omnibus procedure that subsumes the other - four. -\cvar{Name} is looked up in the search path if \cvar{lookup?} is true - and is used as a filename otherwise. -\cvar{Maybe-env} is either a list of strings for the environment of the - new program or \code{\#f} in which case the new program inherits its - environment from the current one. -\cvar{Arguments} should be a list of strings; unlike with the other four - procedures, \cvar{name} is not added to this list (hence \code{-with-alias}). - -\section{Signals} - -There are two varieties of signals available, {\em named} and {\em anonymous}. -A named signal is one for which we have a symbolic name, such as \code{kill} - or \code{pipe}. -Anonymous signals, for which we only have the current operating system's - signal number, have no meaning in other operating systems. -Named signals preserve their meaning in image files. -Not all named signals are available from all OS's and - there may be multiple names for a single OS signal number. - -\begin{protos} -\proto{name->signal}{ symbol}{signal or {\tt \#f}} -\proto{integer->signal}{ integer}{signal} -\proto{signal?}{ x}{boolean} -\proto{signal-name}{ signal}{symbol or {\tt \#f}} -\proto{signal-os-number}{ signal}{integer} -\proto{signal=?}{ signal0 signal1}{boolean} -\end{protos} -\noindent -\code{Name->signal} returns a (named) signal or \code{\#f} if the - the signal \cvar{name} is not supported by the operating system. -The signal returned by \code{integer->signal} is a named signal if - \cvar{integer} corresponds to a named signal in the current operating - system; otherwise it returns an anonymous signal. -\code{Signal-name} returns a symbol if \cvar{signal} is named and - \code{\#f} if it is anonymous. -\code{Signal=?} returns \code{\#t} if \cvar{signal0} and \cvar{signal1} - have the same operating system number and \code{\#f} if they do not. - -\subsection{POSIX signals} -The following lists the names of the POSIX signals. -\begin{center} -\begin{tabular}{ll} -\code{abrt} & abort - abnormal termination (as by abort()) \\ -\code{alrm} & alarm - timeout signal (as by alarm()) \\ -\code{fpe } & floating point exception \\ -\code{hup } & hangup - hangup on controlling terminal or death of - controlling process \\ -\code{ill } & illegal instruction \\ -\code{int } & interrupt - interaction attention \\ -\code{kill} & kill - termination signal, cannot be caught or ignored \\ -\code{pipe} & pipe - write on a pipe with no readers \\ -\code{quit} & quit - interaction termination \\ -\code{segv} & segmentation violation - invalid memory reference \\ -\code{term} & termination - termination signal \\ -\code{usr1} & user1 - for use by applications \\ -\code{usr2} & user2 - for use by applications \\ -\code{chld} & child - child process stopped or terminated \\ -\code{cont} & continue - continue if stopped \\ -\code{stop} & stop - cannot be caught or ignored \\ -\code{tstp} & interactive stop \\ -\code{ttin} & read from control terminal attempted by background process \\ -\code{ttou} & write to control terminal attempted by background process \\ -\code{bus } & bus error - access to undefined portion of memory \\ -\end{tabular} -\end{center} - -\subsection{Other signals} -The following lists the names of the non-POSIX signals that the system is - currently aware of. -\begin{center} -\W\begin{tabular}{ll} -\T\setlongtables -\T\begin{longtable}{ll} -\code{trap } & trace or breakpoint trap \\ -\code{iot } & IOT trap - a synonym for ABRT \\ -\code{emt } & \\ -\code{sys } & bad argument to routine (SVID) \\ -\code{stkflt} & stack fault on coprocessor \\ -\code{urg } & urgent condition on socket (4.2 BSD) \\ -\code{io } & I/O now possible (4.2 BSD) \\ -\code{poll } & A synonym for SIGIO (System V) \\ -\code{cld } & A synonym for SIGCHLD \\ -\code{xcpu } & CPU time limit exceeded (4.2 BSD) \\ -\code{xfsz } & File size limit exceeded (4.2 BSD) \\ -\code{vtalrm} & Virtual alarm clock (4.2 BSD) \\ -\code{prof } & Profile alarm clock \\ -\code{pwr } & Power failure (System V) \\ -\code{info } & A synonym for SIGPWR \\ -\code{lost } & File lock lost \\ -\code{winch } & Window resize signal (4.3 BSD, Sun) \\ -\code{unused} & Unused signal \\ -\W\end{tabular} -\T\end{longtable} -\end{center} - -\subsection{Sending signals} - -\begin{protos} -\protonoresult{signal-process}{ process-id signal} -\end{protos} -\noindent -Send \cvar{signal} to the process corresponding to \cvar{process-id}. - -\subsection{Receiving signals} - -Signals received by the Scheme process can be obtained via one or more - signal-queues. -Each signal queue has a list of monitored signals and a queue of - received signals that have yet to be read from the signal-queue. -When the Scheme process receives a signal that signal is added to the - received-signal queues of all signal-queues which are currently monitoring - that particular signal. - -\begin{protos} -\proto{make-signal-queue}{ signals}{signal-queue} -\proto{signal-queue?}{ x}{boolean} -\proto{signal-queue-monitored-signals}{ signal-queue}{list of signals} -\proto{dequeue-signal!}{ signal-queue}{signal} -\proto{maybe-dequeue-signal!}{ queue-queue}{signal or {\tt \#f}} -\end{protos} -\noindent -\code{Make-signal-queue} returns a new signal-queue that will monitor - the signals in the list \cvar{signals}. -\code{Signal-queue?} is a predicate for signal queues. -\code{Signal-queue-monitored-signals} returns a list of the signals - currently monitored by \cvar{signal-queue}. -\code{Dequeue-signal!} and \code{maybe-dequeue-signal} both return - the next received-but-unread signal from \cvar{signal-queue}. -If \cvar{signal-queue}'s queue of signals is empty \code{dequeue-signal!} - blocks until an appropriate signal is received. -\code{Maybe-dequeue-signal!} does not block; it returns \code{\#f} instead. - -There is a bug in the current system that causes an erroneous deadlock - error if threads are blocked waiting for signals and no other threads - are available to run. -A work around is to create a thread that sleeps for a long time, which - prevents any deadlock errors (including real ones): -\begin{example} -> ,open threads -> (spawn (lambda () - ; Sleep for a year - (sleep (* 1000 60 60 24 365)))) -\end{example} - -\begin{protos} -\protonoresult{add-signal-queue-signal!}{ signal-queue signal} -\protonoresult{remove-signal-queue-signal!}{ signal-queue signal} -\end{protos} -\noindent -These two procedures can be used to add or remove signals from a - signal-queue's list of monitored signals. -When a signal is removed from a signal-queue's list of monitored signals - any occurances of the signal are removed from that signal-queue's pending - signals. -In other words, \code{dequeue-signal!} and \code{maybe-dequeue-signal!} - will only return signals that are currently on the signal-queue's list - of signals. - -\section{Process environment} - -These are in structures \code{posix-process-data} and \code{posix}. - -\subsection{Process identification} - -\begin{protos} -\proto{get-process-id}{}{ process-id} -\proto{get-parent-process-id}{}{ process-id} -\end{protos} -\noindent -These return the process ids of the current process and its parent. -See section~\ref{processes} for operations on process ids. - -\begin{protos} -\proto{get-user-id}{}{ user-id} -\proto{get-effective-user-id}{}{ user-id} -\protonoresult{set-user-id!}{ user-id} -\end{protos} - -\begin{protos} -\proto{get-group-id}{}{ group-id} -\proto{get-effective-group-id}{}{ group-id} -\protonoresult{set-group-id!}{ group-id} -\end{protos} -\noindent -Every process has both the original and effective user id and group id. -The effective values may be set, but not the original ones. - -\begin{protos} -\proto{get-groups}{}{ group-ids} -\proto{get-login-name}{}{ string} -\end{protos} -\noindent -\code{Get-groups} returns a list of the supplementary groups of the - current process. -\code{Get-login-name} returns a user name for the current process. - -% 4.5 Get Process Times - -% 4.6 Environment Variables - -\subsection{Environment variables} - -\begin{protos} -\proto{lookup-environment-variable}{ string}{string or {\tt \#f}} -\proto{environment-alist}{}{alist} -\end{protos} -\noindent -\code{Lookup-environment-variable} looks up its argument in the - environment list and returns the corresponding value or \code{\#f} - if there is none. -\code{Environment-alist} returns the entire environment as a list of - \code{(\cvar{name-string} . \cvar{value-string})} pairs. - -\section{Users and groups} - -\cvar{User-id}\/s and \cvar{group-id}\/s are boxed integers representing - Unix users and groups. -The procedures in this section are in structures \code{posix-users} and - \code{posix}. - -\begin{protos} -\proto{user-id?}{ x}{boolean} -\proto{user-id=?}{ user-id0 user-id1}{boolean} -\proto{user-id->integer}{ user-id}{integer} -\proto{integer->user-id}{ integer}{user-id} -\end{protos} - -\begin{protos} -\proto{group-id?}{ x}{boolean} -\proto{group-id=?}{ group-id0 group-id1}{boolean} -\proto{group-id->integer}{ group-id}{integer} -\proto{integer->group-id}{ integer}{group-id} -\end{protos} -\noindent -User-ids and group-ids have their own - own predicates and comparison, boxing, and unboxing functions. - -\begin{protos} -\proto{user-id->user-info}{ user-id}{user-info} -\proto{name->user-info}{ string}{user-info} -\end{protos} -\noindent -These return the user info for a user identified by user-id or name. - -\begin{protos} -\proto{user-info?}{ x}{ boolean} -\proto{user-info-name}{ user-info}{ string} -\proto{user-info-id}{ user-info}{ user-id} -\proto{user-info-group}{ user-info}{ group-id} -\proto{user-info-home-directory}{ user-info}{ string} -\proto{user-info-shell}{ user-info}{ string} -\end{protos} -\noindent -A \code{user-info} contains information about a user. -Available are the user's name, id, group, home directory, and shell. - -\begin{protos} -\proto{group-id->group-info}{ group-id}{group-info} -\proto{name->group-info}{ string}{group-info} -\end{protos} -\noindent -These return the group info for a group identified by group-id or name. - -\begin{protos} -\proto{group-info?}{ x}{ boolean} -\proto{group-info-name}{ group-info}{ string} -\proto{group-info-id}{ group-info}{ group-id} -\proto{group-info-members}{ group-info}{ user-ids} -\end{protos} -\noindent -A \code{group-info} contains information about a group. -Available are the group's name, id, and a list of members. - -\section{OS and machine identification} - -These procedures return strings that are supposed to identify the current - OS and machine. -The POSIX standard does not indicate the format of the strings. -The procedures are in structures \code{posix-platform-names} and \code{posix}. - -\begin{protos} -\proto{os-name}{}{string} -\proto{os-node-name}{}{string} -\proto{os-release-name}{}{string} -\proto{os-version-name}{}{string} -\proto{machine-name}{}{string} -\end{protos} - -% 4.8 Configurable System Variables - -\section{Files and directories} - -These procedures are in structures \code{posix-files} and \code{posix}. - -\subsection{Directory streams} - -Directory streams are like input ports, with each read operation - returning the next name in the directory. - -\begin{protos} -\proto{open-directory-stream}{ name}{directory} -\proto{directory-stream?}{ x}{boolean} -\proto{read-directory-stream}{ directory}{name or {\tt \#f}} -\protonoresult{close-directory-stream}{ directory} -\end{protos} -\noindent -\code{Open-directory-stream} opens a new directory stream. -\code{Directory-stream?} is a predicate that recognizes directory streams. -\code{Read-directory-stream} returns the next name in the directory or - \code{\#f} if all names have been read. -\code{Close-directory-stream} closes a directory stream. - -\begin{protos} -\proto{list-directory}{ name}{list of strings} -\end{protos} -\noindent -This is the obvious utility; it returns a list of the names in directory - \cvar{name}. - -% 5.2 Working Directory -\subsection{Working directory} - -\begin{protos} -\proto{working-directory}{}{string} -\protonoresult{set-working-directory!}{ string} -\end{protos} -\noindent -These return and set the working directory. - -% 5.3 File Creation -\subsection{File creation and removal} - -\begin{protos} -\proto{open-file}{ path file-options}{port} -\proto{open-file}{ path file-options file-mode}{port} -\end{protos} -\noindent -\code{Open-file} opens a port to the file named by string \cvar{path}. -The \cvar{file-options} argument determines various aspects of the - returned port. -The optional \cvar{file-mode} argument is used only if the file to be opened - does not already exist. -The returned port is an input port if \cvar{file-options} includes - \code{read-only}; otherwise it returns an output port. -\code{Dup-switching-mode} can be used to open an input port for - output ports opened with the \code{read/write} option. - -\begin{protos} -\syntaxproto{file-options}{ \cvar{file-option-name} \ldots}{file-options} -\proto{file-options-on?}{ file-options file-options}{boolean} -\end{protos} -\noindent -The syntax \code{file-options} returns a file-option with the - indicated options set. -\code{File-options-on?} returns true if its first argument includes all of - the options listed in the second argument. -The following file options may be used with \code{open-file}. - -\begin{center} -\begin{tabular}{llp{2.8in}} - & \code{create} & create file if it does not already exist; a file-mode argument - is required with this option \\ - & \code{exclusive} & an error will be raised if this option and \code{create} - are both set and the file already exists \\ - & \code{no-controlling-tty} & if \cvar{path} is a terminal device this option - causes the terminal to not become the controlling terminal of the process\\ - & \code{truncate} & file is truncated \\ - & \code{append} & writes are appended to existing contents \\ - & \code{nonblocking} & read and write operations do not block \\ - & \code{read-only} & port may not be written \\ - & \code{read-write} & file descriptor may be read or written \\ - & \code{write-only} & port may not be read -\end{tabular} -\end{center} -\noindent Only one of the last three options may be used. - -For example -\begin{example} -(open-file "some-file.txt" - (file-options create write-only) - (file-mode read owner-write)) -\end{example} - returns an output port that writes to a newly-created file that can be - read by anyone and written only by the owner. -Once the file exists, -\begin{example} -(open-file "some-file.txt" - (file-options append write-only)) -\end{example} -will open an output port that appends to the file. - -The \code{append} and \code{nonblocking} options and the read/write nature of - the port can be read using \code{i/o-flags}. -The \code{append} and \code{nonblocking} options can be set - using \code{set-i/o-flags!}. - -To keep port operations from blocking the Scheme~48 process, output - ports are set to be nonblocking at the time of creation (input ports - are managed using \code{select()}). -You can use \code{set-i/o-flags!} to make an output port blocking, for - example just before a fork, but care should be exercised. -The Scheme~48 runtime code may get confused if an I/O operation blocks. - -\begin{protos} -\protonoresult{set-file-creation-mask!}{ file-mode} -\end{protos} -\noindent -Sets the file creation mask to be \cvar{file-mode}. -Bits set in \cvar{file-mode} are cleared in the modes of any files or - directories created by the current process. - -\begin{protos} -\protonoresult{link}{ existing new} -\end{protos} -\noindent -\code{Link} makes path \cvar{new} be a new link to the file - pointed to by path \cvar{existing}. -The two paths must be in the same file system. - -% 5.4 Special File Creation - -\begin{protos} -\protonoresult{make-directory}{ name file-mode} -\protonoresult{make-fifo}{ file-mode} -\end{protos} -\noindent -These two procedures make new directories and fifo files. - -% 5.5 File Removal - -\begin{protos} -\protonoresult{unlink}{ path} -\protonoresult{remove-directory}{ path} -\protonoresult{rename}{ old-path new-path} -\end{protos} -\noindent -\code{Unlink} removes the link indicated by \cvar{path}. -\code{Remove-directory} removes the indicated (empty) directory. -\code{Rename} moves the file pointed to by \cvar{old-path} to the - location pointed to by \cvar{new-path} (the two paths must be in - the same file system). -Any other links to the file remain unchanged. - -% 5.6.3 (out of POSIX order) - -\begin{protos} -\proto{accessible?}{ path access-mode . more-modes}{boolean} -\syntaxproto{access-mode}{ \cvar{mode-name}}{access-mode} -\end{protos} -\noindent -\code{Accessible?} returns true if \cvar{path} is a file that - can be accessed in the listed mode. -If more than one mode is specified \code{accessible?} returns true - if all of the specified modes are permitted. -The \cvar{mode-name}\/s are: \code{read}, \code{write}, \code{execute}, - \code{exists}. - -% 5.6 File Characteristics -\subsection{File information} - -\begin{protos} -\proto{get-file-info}{ name}{file-info} -\proto{get-file/link-info}{ name}{file-info} -\proto{get-port-info}{ fd-port}{file-info} -\end{protos} -\noindent -\code{Get-file-info} and \code{get-file/link-info} both return - a file info record for the named file. -\code{Get-file-info} follows symbolic links while \code{get-file/link-info} - does not. -\code{Get-port-info} returns a file info record for the file - which \cvar{port} reads from or writes to. -An error is raised if \cvar{fd-port} does not read from or write to a - file descriptor. - -\begin{protos} -\proto{file-info?}{ x}{boolean} -\proto{file-info-name}{ file-info}{string} -\end{protos} -\noindent -\code{File-info?} is a predicate for file-info records. -\code{File-info-name} is the name which was used to get \code{file-info}, - either as passed to \code{get-file-info} or \code{get-file/link-info}, - or used to open the port passed to \code{get-port-info}. - -\begin{protos} -\proto{file-info-type}{ file-info}{file-type} -\proto{file-type?}{ x}{boolean} -\proto{file-type-name}{ file-type}{symbol} -\syntaxproto{file-type}{ \cvar{type}}{file-type} -\end{protos} -\noindent -%I need to add the rest - the procedure version of file-type, enum-case(?). -\code{File-info-type} returns the type of the file, as a file-type object -File types may be compared using \code{eq?}. -The valid file types are: - -\begin{center} -\begin{tabular}{l} - \code{regular} \\ - \code{directory} \\ - \code{character-device} \\ - \code{block-device} \\ - \code{fifo} \\ - \code{symbolic-link} \\ - \code{socket} \\ - \code{other} -\end{tabular} -\end{center} - -\noindent -\code{Symbolic-link} and \code{socket} are not required by POSIX. - -\begin{protos} -\proto{file-info-device}{ file-info}{integer} -\proto{file-info-inode}{ file-info}{integer} -\end{protos} -\noindent -The device and inode numbers uniquely determine a file. - -\begin{protos} -\proto{file-info-link-count}{ file-info}{integer} -\proto{file-info-size}{ file-info}{integer} -\end{protos} -\noindent -These return the number of links to a file and the file size in bytes. -The size is only meaningful for regular files. - -\begin{protos} -\proto{file-info-owner}{ file-info}{user-id} -\proto{file-info-group}{ file-info}{group-id} -\proto{file-info-mode}{ file-info}{file-mode} -\end{protos} -\noindent -These return the owner, group, and access mode of a file. - -\begin{protos} -\proto{file-info-last-access}{ file-info}{time} -\proto{file-info-last-modification}{ file-info}{time} -\proto{file-info-last-info-change}{ file-info}{time} -\end{protos} -\noindent -These return the time the file was last read, modified, or had its - status modified - -% Modes -\subsection{File modes} - -A file mode is a boxed integer representing a file protection mask. - -\begin{protos} -\syntaxproto{file-mode}{ permission-name \ldots}{file-mode} -\proto{file-mode?}{ x}{boolean} -\proto{file-mode+}{ file-mode \ldots}{file-mode} -\proto{file-mode-}{ file-mode0 file-mode1}{file-mode} -\end{protos} -\noindent -\code{File-mode} is syntax for creating file modes. -The mode-names are listed below. -\code{File-mode?} is a predicate for file modes. -\code{File-mode+} returns a mode that contains all of permissions of - its arguments. -\code{File-mode-} returns a mode that has all of the permissions of - \cvar{file-mode0} that are not in \cvar{file-mode1}. - -\begin{protos} -\proto{file-mode=?}{ file-mode0 file-mode1}{boolean} -\proto{file-mode<=?}{ file-mode0 file-mode1}{boolean} -\proto{file-mode>=?}{ file-mode0 file-mode1}{boolean} -\end{protos} -\noindent -\code{File-mode=?} returns true if the two modes are exactly the same. -\code{File-mode<=?} returns true if \cvar{file-mode0} has a subset - of the permissions of \cvar{file-mode1}. -\code{File-mode>=?} is \code{file-mode<=?} with the arguments reversed. - -\begin{protos} -\proto{file-mode->integer}{ file-mode}{integer} -\proto{integer->file-mode}{ integer}{file-mode} -\end{protos} -\noindent -\code{Integer->file-mode} and \code{file-mode->integer} translate file modes - to and from the classic Unix file mode masks. -These may not be the masks used by the underlying OS. - -\begin{center} -\begin{tabular}{lll} -Permission name & Bit mask \\ -\code{set-uid} & \code{\#o4000} & set user id when executing \\ -\code{set-gid} & \code{\#o2000} & set group id when executing \\ -\code{owner-read} & \code{\#o0400} & read by owner \\ -\code{owner-write} & \code{\#o0200} & write by owner \\ -\code{owner-exec} & \code{\#o0100} & execute (or search) by owner \\ -\code{group-read} & \code{\#o0040} & read by group \\ -\code{group-write} & \code{\#o0020} & write by group \\ -\code{group-exec} & \code{\#o0010} & execute (or search) by group \\ -\code{other-read} & \code{\#o0004} & read by others \\ -\code{other-write} & \code{\#o0002} & write by others \\ -\code{other-exec} & \code{\#o0001} & execute (or search) by others \\ -\end{tabular} -\end{center} - -\begin{center} -\begin{tabular}{lll} -\multicolumn{3}{l}{Names for sets of permissions} \\ -\code{owner} & \code{\#o0700} & read, write, and execute by owner \\ -\code{group} & \code{\#o0070} & read, write, and execute by group \\ -\code{other} & \code{\#o0007} & read, write, and execute by others \\ -\code{read} & \code{\#o0444} & read by anyone \\ -\code{write} & \code{\#o0222} & write by anyone \\ -\code{exec} & \code{\#o0111} & execute by anyone \\ -\code{all} & \code{\#o0777} & anything by anyone -\end{tabular} -\end{center} - -%---------------- -% Time - seconds since the epoch. -\section{Time} - -These procedures are in structures \code{posix-time} and \code{posix}. - -\begin{protos} -\proto{make-time}{ integer}{time} -\proto{current-time}{}{time} -\proto{time?}{ x}{boolean} -\proto{time-seconds}{ time}{integer} -\end{protos} -\noindent -A \code{time} record contains an integer that represents time as - the number of second since the Unix epoch (00:00:00 GMT, January 1, 1970). -\code{Make-time} and \code{current-time} return \code{time}\/s, with - \code{make-time}'s using its argument while \code{current-time}'s has - the current time. -\code{Time?} is a predicate that recognizes \code{time}\/s and - \code{time-seconds} returns the number of seconds \cvar{time} represents. - -\begin{protos} -\proto{time=?}{ time time}{boolean} -\proto{time?}{ time time}{boolean} -\proto{time>=?}{ time time}{boolean} -\end{protos} -\noindent -These perform various comparison operations on the \code{time}\/s. - -\begin{protos} -\proto{time->string}{ time}{string} -\end{protos} -\noindent -\code{Time->string} returns a string representation of \cvar{time} in the - following form. -\begin{example} -"Wed Jun 30 21:49:08 1993 -" -\end{example} - -%---------------- -% Dates - what a mess. -% -% This is not yet working. - -\section{I/O} - -These procedures are in structures \code{posix-i/o} and \code{posix}. - -% Rest of 5.6 - -% int chmod(char *path, mode_t mode) -% int fchmod(int fd, mode_t mode) - -% int chown(char *path, uid_t owner, gid_t group) -% int utime(char *path, struct utimbuf * times) - -% int ftruncate(int fd, off_t length) - -%---------------- -% 5.7 Configurable Pathname Variables -% -% long pathconf(char *path, int name) -% long fpathconf(int fd, int name) - -%---------------- -% 6.1 Pipes - -\begin{protos} -\proto{open-pipe}{}{input-port + output-port} -\end{protos} -\noindent -\code{Open-pipe} creates a new pipe and returns the two ends as an - input port and an output port. - -% 6.2 File descriptor manipulation. - -A {\em file descriptor} port (or \cvar{fd-port}) - is a port that reads to or writes from an OS file descriptor. -Fd-ports are returned by \code{open-input-file}, \code{open-output-file}, - \code{open-file}, \code{open-pipe}, and other procedures. -% Richard says: add an example of a non-fd port once the extended ports -% are described in the manual. - -\begin{protos} -\proto{fd-port?}{ port}{boolean} -\proto{port->fd}{ port}{integer or {\tt \#f}} -\end{protos} -\noindent -\code{Fd-port?} returns true if its argument is an fd-port. -\code{Port->fd} returns the file descriptor associated with - or \code{\#f} if \cvar{port} is not an fd-port. - -\begin{protos} -\protonoresult{remap-file-descriptors}{ fd-spec \ldots} -\end{protos} -\noindent -\code{Remap-file-descriptors} reassigns file descriptors to ports. -The \cvar{fd-specs} indicate which port is to be mapped to each - file descriptor: the first gets file descriptor \code{0}, the second gets - \code{1}, and so forth. -A \cvar{fd-spec} is either a port that reads from or writes to - a file descriptor, - or \code{\#f}, with \code{\#f} indicating that the corresponding file - descriptor is not used. -Any open ports not listed are marked `close-on-exec'. -The same port may be moved to multiple new file descriptors. - -For example, -\begin{example} -(remap-file-descriptors (current-output-port) - \#f - (current-input-port)) -\end{example} -moves the current output port to file descriptor \code{0} and the -current input port to file descriptor \code{2}. - -\begin{protos} -\proto{dup}{ fd-port}{fd-port} -\proto{dup-switching-mode}{ fd-port}{fd-port} -\proto{dup2}{ fd-port file-descriptor}{fd-port} -\end{protos} -\noindent -These change \cvar{fd-port}'s file descriptor and return a new port - that uses \cvar{ports}'s old file descriptor. -\code{Dup} uses the lowest unused file descriptor and \code{dup2} uses the - one provided. -\code{Dup-switching-mode} is the same as \code{dup} except that the returned - port is an input port if the argument was an output port and vice - versa. -If any existing port uses the file descriptor passed to \code{dup2}, that - port is closed. - -\begin{protos} -\protonoresult{close-all-but}{ port \ldots} -\end{protos} -\noindent -\code{Close-all-but} closes all file descriptors whose associated ports - are not passed to it as arguments. - -% 6.3 File Descriptor Reassignment -% -% int close(int fd) % Use close-{input|output}-{port|channel} -% -% 6.4 Input and Output -% -% read() and write() ; Already available in various forms. - -% 6.5 Control Operations on Files - -%; fcntl(fd, F_DUPFD, target_fd) ; Use DUP instead. -% -%; Descriptor flags -%; fcntl(fd, F_GETFD) -%; fcntl(fd, F_SETFD, flags) -%; -%; The only POSIX flag is FD_CLOEXEC, so that's all we do. - -\begin{protos} -\proto{close-on-exec?}{ port}{boolean} -\protonoresult{set-close-on-exec?!}{ port boolean} -\end{protos} -\noindent -\code{Close-on-exec?} returns true if \code{port} will be closed - when a new program is exec'ed. -\code{Set-close-on-exec?!} sets \code{port}'s close-on-exec flag. - -%; Status flags -%; fcntl(fd, F_GETFL) -%; fcntl(fd, F_SETFL, flags) - -\begin{protos} -\proto{i/o-flags}{ port}{file-options} -\protonoresult{set-i/o-flags!}{ port file-options} -\end{protos} -\noindent -These two procedures read and write various options for \code{port}. -The options that can be read are \code{append}, \code{nonblocking}, - \code{read-only}, \code{write-only}, and \code{read/write}. -Only the \code{append} and \code{nonblocking} can be written. - -% off_t lseek(int fd, off_t offset, int whence) - -%\subsection{Terminals} - -\begin{protos} -\proto{port-is-a-terminal?}{ port}{boolean} -\proto{port-terminal-name}{ port}{string} -\end{protos} -\noindent -\code{Port-is-a-terminal?} returns true if \cvar{port} has an underlying - file descriptor that is associated with a terminal. -For such ports \code{port-terminal-name} returns the name of the - terminal, for all others it returns \code{\#f}. - -% 6. File Synchronization -% -% int fsync(int fd) % optional -% int fdatasync(int fd) % optional -% -% 7. Asynchronous Input and Output -% -% All optional - -\section{Regular expressions} -% Regexps - where is the C interface defined? (In part 2, the shell book) - -The procedures in this section provide access to POSIX regular expression - matching. -The regular expression syntax and semantics are far too complex to - be described here. -Because the C interface uses zero bytes for marking the ends of strings, - patterns and strings that contain zero bytes will not work correctly. - -These procedures are in structures \code{posix-regexps} and \code{posix}. - -An abstract data type for creating POSIX regular expressions is - described in section~\ref{regexp-adt}. - -\begin{protos} -\proto{make-regexp}{ string . regexp-options}{regexp} -\syntaxproto{regexp-option}{ \cvar{option-name}}{regexp-option} -\end{protos} -\noindent -\code{Make-regexp} makes a new regular expression, using \cvar{string} - as the pattern. -The possible option names are: - -\begin{center} -\begin{tabular}{ll} -\code{extended} & use the extended patterns \\ -\code{ignore-case} & ignore case when matching \\ -\code{submatches} & report submatches \\ -\code{newline} & treat newlines specially -\end{tabular} -\end{center} - -The regular expression is not compiled until it matched against a string, - so any errors in the pattern string will not be reported until that - point. - -\begin{protos} -\proto{regexp?}{ x}{boolean} -\end{protos} -\noindent -This is a predicate for regular expressions. - -\begin{protos} -\protonoresult{regexp-match}{ regexp string submatches? starts-line? ends-line?} -\protoresult{boolean or list of matches} -\proto{match?}{ x}{boolean} -\proto{match-start}{ match}{integer} -\proto{match-end}{ match}{integer} -\end{protos} -\noindent -\code{Regexp-match} matches the regular expression against the characters - in \cvar{string}. -If the string does not match the regular expression, \code{regexp-match} - returns \code{\#f}. -If the string does match, then a list of match records is returned - if \cvar{submatches?} is true, or \code{\#t} is returned if it is not. -Each match record contains the index of the character at the beginning - of the match and one more than the index of the character at the end. -The first match record gives the location of the substring that matched - \cvar{regexp}. -If the pattern in \cvar{regexp} contained submatches, then the results - of these are returned in order, with a match records reporting submatches - that succeeded and \code{\#f} in place of those that did not. - -\cvar{Starts-line?} should be true if \cvar{string} starts at the beginning - of a line and \cvar{ends-line?} should be true if it ends one. - -\section{C to Scheme correspondence} -\label{function-correspondence} - -The following table lists the Scheme procedures that correspond to - particular C procedures. -Not all of the Scheme procedures listed are part of the POSIX interface. - -\W\begin{tabular}{ll} -\T\setlongtables -\T\begin{longtable}{ll} -C procedure & Scheme procedure(s) \\ -\T\endfirsthead -\T C procedure & Scheme procedure(s) \\ -\T\endhead -\code{access}&\code{accessible?}\\ -\code{chdir}&\code{set-working-directory!}\\ -\code{close}&\code{close-input-port, close-output-port,}\\ - &\code{\ \ close-channel, close-socket}\\ -\code{closedir}&\code{close-directory-stream}\\ -\code{creat}&\code{open-file}\\ -\code{ctime}&\code{time->string}\\ -\code{dup}&\code{dup, dup-switching-mode}\\ -\code{dup2}&\code{dup2}\\ -\code{exec[l|v][e|p|$\epsilon$]} - &\code{exec, exec-with-environment,} \\ - &\code{\ \ exec-file, exec-file-with-environment,} \\ - &\code{\ \ exec-with-alias}\\ -\code{\_exit}&\code{exit}\\ -\code{fcntl}&\code{io-flags, set-io-flags!,}\\ - &\code{\ \ close-on-exec, set-close-on-exec!}\\ -\code{fork}&\code{fork, fork-and-forget}\\ -\code{fstat}&\code{get-port-info}\\ -\code{getcwd}&\code{working-directory}\\ -\code{getegid}&\code{get-effective-group-id}\\ -\code{getenv}&\code{lookup-environment-variable,} \\ - &\code{\ \ environment-alist}\\ -\code{geteuid}&\code{get-effective-user-id}\\ -\code{getgid}&\code{get-group-id}\\ -\code{getgroups}&\code{get-groups}\\ -\code{getlogin}&\code{get-login-name}\\ -\code{getpid}&\code{get-process-id}\\ -\code{getppid}&\code{get-parent-process-id}\\ -\code{getuid}&\code{get-user-id}\\ -\code{isatty}&\code{port-is-a-terminal?}\\ -\code{link}&\code{link}\\ -\code{lstat}&\code{get-file/link-info}\\ -\code{mkdir}&\code{make-directory}\\ -\code{mkfifo}&\code{make-fifo}\\ -\code{open}&\code{open-file}\\ -\code{opendir}&\code{open-directory-stream}\\ -\code{pipe}&\code{open-pipe}\\ -\code{read}&\code{read-char, read-block}\\ -\code{readdir}&\code{read-directory-stream}\\ -\code{rename}&\code{rename}\\ -\code{rmdir}&\code{remove-directory}\\ -\code{setgid}&\code{set-group-id!}\\ -\code{setuid}&\code{set-user-id!}\\ -\code{stat}&\code{get-file-info}\\ -\code{time}&\code{current-time}\\ -\code{ttyname}&\code{port-terminal-name}\\ -\code{umask}&\code{set-file-creation-mask!}\\ -\code{uname}&\code{os-name, os-node-name,} \\ - &\code{\ \ os-release-name, os-version-name,} \\ - &\code{\ \ machine-name}\\ -\code{unlink}&\code{unlink}\\ -\code{waitpid}&\code{wait-for-child-process}\\ -\code{write}&\code{write-char, write-block}\\ -% The ones that aren't there yet. -%wait \\ -%kill \\ -%sigemptyset, sigfillset, sigaddset, digdelset, sigismember \\ -%sigaction \\ -%sigsuspend \\ -%alarm \\ -%pause \\ -%sleep \\ -%getpgrp \\ -%setsid \\ -%times \\ -%ctermid \\ -%sysconf \\ -%rewinddir \\ -%chmod \\ -%chown \\ -%utime \\ -%ftruncate \\ -%pathconf, fpathconf \\ -%lseek \\ -%fsync \\ -\W\end{tabular} -\T\end{longtable} diff --git a/doc/src/utilities.tex b/doc/src/utilities.tex index 972e2ce..f7cf77d 100644 --- a/doc/src/utilities.tex +++ b/doc/src/utilities.tex @@ -725,713 +725,6 @@ Structure \code{c-system-function} provides access to the C \code{system()} \evalsto 'foo \end{example} -\section{Sockets} -% Richard says: add UDP documentation. - -Structure \code{sockets} provides access to TCP/IP sockets for interprocess - and network communication. - -\begin{protos} -\proto{open-socket}{}{socket} -\proto{open-socket}{ port-number}{socket} -\proto{socket-port-number}{ socket}{integer} -\protonoresult{close-socket}{ socket} -\proto{socket-accept}{ socket}{input-port output-port} -\proto{get-host-name}{}{string} -\end{protos} -\noindent -\code{Open-socket} creates a new socket. -If no \cvar{port-number} is supplied the system picks one at random. -\code{Socket-port-number} returns a socket's port number. -\code{Close-socket} closes a socket, preventing any further connections. -\code{Socket-accept} accepts a single connection on \cvar{socket}, returning - an input port and an output port for communicating with the client. -If no client is waiting \code{socket-accept} blocks until one appears. -\code{Get-host-name} returns the network name of the machine. - -\begin{protos} -\proto{socket-client}{ host-name port-number}{input-port output-port} -\end{protos} -\noindent -\code{Socket-client} connects to the server at \cvar{port-number} on - the machine named \cvar{host-name}. -\code{Socket-client} blocks until the server accepts the connection. - -The following simple example shows a server and client for a centralized UID - service. -\begin{example} -(define (id-server) - (let ((socket (open-socket))) - (display "Waiting on port ") - (display (socket-port-number socket)) - (newline) - (let loop ((next-id 0)) - (call-with-values - (lambda () - (socket-accept socket)) - (lambda (in out) - (display next-id out) - (close-input-port in) - (close-output-port out) - (loop (+ next-id 1))))))) - -(define (get-id machine port-number) - (call-with-values - (lambda () - (socket-client machine port-number)) - (lambda (in out) - (let ((id (read in))) - (close-input-port in) - (close-output-port out) - id)))) -\end{example} - -\section{Macros for writing loops} -% JAR says: origin? history? - -\code{Iterate} and \code{reduce} are extensions of named-\code{let} for - writing loops that walk down one or more sequences, - such as the elements of a list or vector, the - characters read from a port, or an arithmetic series. -Additional sequences can be defined by the user. -\code{Iterate} and \code{reduce} are in structure \code{reduce}. - -\subsection{{\tt Iterate}} - -The syntax of \code{iterate} is: -\begin{example} - (iterate \cvar{loop-name} - ((\cvar{sequence-type} \cvar{element-variable} \cvar{sequence-data} \ldots) - \ldots) - ((\cvar{state-variable} \cvar{initial-value}) - \ldots) - \cvar{body-expression} - [\cvar{final-expression}]) -\end{example} - -\code{Iterate} steps the \cvar{element-variable}s in parallel through the - sequences, while each \cvar{state-variable} has the corresponding - \cvar{initial-value} for the first iteration and have later values - supplied by \cvar{body-expression}. -If any sequence has reached its limit the value of the \code{iterate} - expression is - the value of \cvar{final-expression}, if present, or the current values of - the \cvar{state-variable}s, returned as multiple values. -If no sequence has reached - its limit, \cvar{body-expression} is evaluated and either calls \cvar{loop-name} with - new values for the \cvar{state-variable}s, or returns some other value(s). - -The \cvar{loop-name} and the \cvar{state-variable}s and \cvar{initial-value}s behave -exactly as in named-\code{let}. The named-\code{let} expression -\begin{example} - (let loop-name ((state-variable initial-value) ...) - body ...) -\end{example} -is equivalent to an \code{iterate} expression with no sequences - (and with an explicit - \code{let} wrapped around the body expressions to take care of any - internal \code{define}s): -\begin{example} - (iterate loop-name - () - ((state-variable initial-value) ...) - (let () body ...)) -\end{example} - -The \cvar{sequence-type}s are keywords (they are actually macros of a particular - form; it is easy to add additional types of sequences). -Examples are \code{list*} which walks down the elements of a list and - \code{vector*} which does the same for vectors. -For each iteration, each \cvar{element-variable} is bound to the next - element of the sequence. -The \cvar{sequence-data} gives the actual list or vector or whatever. - -If there is a \cvar{final-expression}, it is evaluated when the end of one or more - sequences is reached. -If the \cvar{body-expression} does not call \cvar{loop-name} the - \cvar{final-expression} is not evaluated. -The \cvar{state-variable}s are visible in - \cvar{final-expression} but the \cvar{sequence-variable}s are not. - -The \cvar{body-expression} and the \cvar{final-expression} are in tail-position within - the \code{iterate}. -Unlike named-\code{let}, the behavior of a non-tail-recursive call to - \cvar{loop-name} is unspecified (because iterating down a sequence may involve side - effects, such as reading characters from a port). - -\subsection{{\tt Reduce}} - -If an \code{iterate} expression is not meant to terminate before a sequence - has reached its end, - \cvar{body-expression} will always end with a tail call to \cvar{loop-name}. -\code{Reduce} is a macro that makes this common case explicit. -The syntax of \code{reduce} is - the same as that of \code{iterate}, except that there is no \cvar{loop-name}. -The \cvar{body-expression} returns new values of the \cvar{state-variable}s - instead of passing them to \cvar{loop-name}. -Thus \cvar{body-expression} must return as many values as there are state - variables. -By special dispensation, if there are - no state variables then \cvar{body-expression} may return any number of values, - all of which are ignored. - -The syntax of \code{reduce} is: -\begin{example} - (reduce ((\cvar{sequence-type} \cvar{element-variable} \cvar{sequence-data} \ldots) - \ldots) - ((\cvar{state-variable} \cvar{initial-value}) - \ldots) - \cvar{body-expression} - [\cvar{final-expression}]) -\end{example} - -The value(s) returned by an instance of \code{reduce} is the value(s) returned - by the \cvar{final-expression}, if present, or the current value(s) of the state -variables when the end of one or more sequences is reached. - -A \code{reduce} expression can be rewritten as an equivalent \code{iterate} - expression by adding a \cvar{loop-var} and a wrapper for the - \cvar{body-expression} that calls the \cvar{loop-var}. -\begin{example} -(iterate loop - ((\cvar{sequence-type} \cvar{element-variable} \cvar{sequence-data} \ldots) - \ldots) - ((\cvar{state-variable} \cvar{initial-value}) - \ldots) - (call-with-values (lambda () - \cvar{body-expression}) - loop) - [\cvar{final-expression}]) -\end{example} - -\subsection{Sequence types} - -The predefined sequence types are: -\begin{protos} -\syntaxprotonoresultnoindex{list*}{ \cvar{elt-var} \cvar{list}} -\syntaxprotonoresultnoindex{vector*}{ \cvar{elt-var} \cvar{vector}} -\syntaxprotonoresultnoindex{string*}{ \cvar{elt-var} \cvar{string}} -\syntaxprotonoresultnoindex{count*} - { \cvar{elt-var} \cvar{start} [\cvar{end} [\cvar{step}]]} -\syntaxprotonoresultnoindex{input*} - { \cvar{elt-var} \cvar{input-port} \cvar{read-procedure}} -\syntaxprotonoresultnoindex{stream*} - { \cvar{elt-var} \cvar{procedure} \cvar{initial-data}} -\end{protos} - -For lists, vectors, and strings the element variable is bound to the - successive elements of the list or vector, or the characters in the - string. - -For \code{count*} the element variable is bound to the elements of the sequence -\begin{example} - \cvar{start}, \cvar{start} + \cvar{step}, \cvar{start} + 2\cvar{step}, \ldots, \cvar{end} -\end{example} - inclusive of \cvar{start} and exclusive of \cvar{end}. -The default \cvar{step} is 1. -The sequence does not terminate if no \cvar{end} is given or if there - is no $N > 0$ such that \cvar{end} = \cvar{start} + N\cvar{step} - (\code{=} is used to test for termination). -For example, \code{(count* i 0 -1)} doesn't terminate - because it begins past the \cvar{end} value and \code{(count* i 0 1 2)} doesn't - terminate because it skips over the \cvar{end} value. - -For \code{input*} the elements are the results of successive applications - of \cvar{read-procedure} to \cvar{input-port}. -The sequence ends when \cvar{read-procedure} returns an end-of-file object. - -For a stream, the \cvar{procedure} takes the current data value as an argument - and returns two values, the next value of the sequence and a new data value. -If the new data is \code{\#f} then the previous element was the last - one. For example, -\begin{example} - (list* elt my-list) -\end{example} - is the same as -\begin{example} - (stream* elt list->stream my-list) -\end{example} - where \code{list->stream} is -\begin{example} - (lambda (list) - (if (null? list) - (values 'ignored \#f) - (values (car list) (cdr list)))) -\end{example} - -\subsection{Synchronous sequences} - -When using the sequence types described above, a loop terminates when any of -its sequences reaches its end. To help detect bugs it is useful to have -sequence types that check to see if two or more sequences end on the same -iteration. For this purpose there is second set of sequence types called -synchronous sequences. These are identical to the ones listed above except -that they cause an error to be signalled if a loop is terminated by a -synchronous sequence and some other synchronous sequence did not reach its -end on the same iteration. - -Sequences are checked for termination in order, from left to right, and -if a loop is terminated by a non-synchronous sequence no further checking -is done. - -The synchronous sequences are: - -\begin{protos} -\syntaxprotonoresultnoindex{list\%}{ \cvar{elt-var} \cvar{list}} -\syntaxprotonoresultnoindex{vector\%}{ \cvar{elt-var} \cvar{vector}} -\syntaxprotonoresultnoindex{string\%}{ \cvar{elt-var} \cvar{string}} -\syntaxprotonoresultnoindex{count\%} - { \cvar{elt-var} \cvar{start} \cvar{end} [\cvar{step}]} -\syntaxprotonoresultnoindex{input\%} - { \cvar{elt-var} \cvar{input-port} \cvar{read-procedure}} -\syntaxprotonoresultnoindex{stream\%} - { \cvar{elt-var} \cvar{procedure} \cvar{initial-data}} -\end{protos} - -Note that the synchronous \code{count\%} must have an \cvar{end}, unlike the - nonsynchronous \code{count\%}. - -\subsection{Examples} - -\noindent -Gathering the indexes of list elements that answer true to some -predicate. -\begin{example} -(lambda (my-list predicate) - (reduce ((list* elt my-list) - (count* i 0)) - ((hits '())) - (if (predicate elt) - (cons i hits) - hits) - (reverse hits)) -\end{example} - -\noindent -Looking for the index of an element of a list. -\begin{example} -(lambda (my-list predicate) - (iterate loop - ((list* elt my-list) - (count* i 0)) - () ; no state - (if (predicate elt) - i - (loop)))) -\end{example} - -\noindent -Reading one line. -\begin{example} -(define (read-line port) - (iterate loop - ((input* c port read-char)) - ((chars '())) - (if (char=? c \#\verb2\2newline) - (list->string (reverse chars)) - (loop (cons c chars))) - (if (null? chars) - (eof-object) - ; no newline at end of file - (list->string (reverse chars))))) -\end{example} - -\noindent -Counting the lines in a file. We can't use \code{count*} because we -need the value of the count after the loop has finished. -\begin{example} -(define (line-count name) - (call-with-input-file name - (lambda (in) - (reduce ((input* l in read-line)) - ((i 0)) - (+ i 1))))) -\end{example} - -\subsection{Defining sequence types} - -The sequence types are object-oriented macros similar to enumerations. -A non-synchronous sequence macro needs to supply three values: - \code{\#f} to indicate that it isn't synchronous, a list of state variables - and their initializers, and the code for one iteration. -The first - two methods are CPS'ed: they take another macro and argument to - which to pass their result. -The \code{synchronized?} method gets no additional arguments. -The \code{state-vars} method is passed a list of names which - will be bound to the arguments to the sequence. -The final method, for the step, is passed the list of names bound to - the arguments and the list of state variables. -In addition there is - a variable to be bound to the next element of the sequence, the - body expression for the loop, and an expression for terminating the - loop. - -The definition of \code{list*} is -\begin{example} -(define-syntax list* - (syntax-rules (synchronized? state-vars step) - ((list* synchronized? (next more)) - (next \#f more)) - ((list* state-vars (start-list) (next more)) - (next ((list-var start-list)) more)) - ((list* step (start-list) (list-var) - value-var loop-body final-exp) - (if (null? list-var) - final-exp - (let ((value-var (car list-var)) - (list-var (cdr list-var))) - loop-body))))) -\end{example} - -Synchronized sequences are the same, except that they need to - provide a termination test to be used when some other synchronized - method terminates the loop. -\begin{example} -(define-syntax list\% - (syntax-rules (sync done) - ((list\% sync (next more)) - (next \#t more)) - ((list\% done (start-list) (list-var)) - (null? list-var)) - ((list\% stuff ...) - (list* stuff ...)))) -\end{example} - -\subsection{Expanded code} - -The expansion of -\begin{example} - (reduce ((list* x '(1 2 3))) - ((r '())) - (cons x r)) -\end{example} -is -\begin{example} - (let ((final (lambda (r) (values r))) - (list '(1 2 3)) - (r '())) - (let loop ((list list) (r r)) - (if (null? list) - (final r) - (let ((x (car list)) - (list (cdr list))) - (let ((continue (lambda (r) - (loop list r)))) - (continue (cons x r))))))) -\end{example} - -The only inefficiencies in this code are the \code{final} and \code{continue} - procedures, both of which could be substituted in-line. -The macro expander could do the substitution for \code{continue} when there - is no explicit proceed variable, as in this case, but not in general. - -\section{Regular expressions} -\label{regexp-adt} - -This section describes a functional interface for building regular - expressions and matching them against strings. -The matching is done using the POSIX regular expression package. -Regular expressions are in the structure \code{regexps}. - -A regular expression is either a character set, which matches any character -in the set, or a composite expression containing one or more subexpressions. -A regular expression can be matched against a string to determine success -or failure, and to determine the substrings matched by particular subexpressions. - -\subsection{Character sets} - -Character sets may be defined using a list of characters and strings, -using a range or ranges of characters, or by using set operations on -existing character sets. - -\begin{protos} -\proto{set}{ character-or-string \ldots}{char-set} -\proto{range}{ low-char high-char}{char-set} -\proto{ranges}{ low-char high-char \ldots}{char-set} -\proto{ascii-range}{ low-char high-char}{char-set} -\proto{ascii-ranges}{ low-char high-char \ldots}{char-set} -\end{protos} -\noindent -\code{Set} returns a set that contains the character arguments and the -characters in any string arguments. \code{Range} returns a character -set that contain all characters between \cvar{low-char} and \cvar{high-char}, -inclusive. \code{Ranges} returns a set that contains all characters in -the given ranges. \code{Range} and \code{ranges} use the ordering induced by -\code{char->integer}. \code{Ascii-range} and \code{ascii-ranges} use the - ASCII ordering. -It is an error for a \cvar{high-char} to be less than the preceding - \cvar{low-char} in the appropriate ordering. - -\begin{protos} -\proto{negate}{ char-set}{char-set} -\proto{intersection}{ char-set char-set}{char-set} -\proto{union}{ char-set char-set}{char-set} -\proto{subtract}{ char-set char-set}{char-set} -\end{protos} -\noindent -These perform the indicated operations on character sets. - -The following character sets are predefined: -\begin{center} -\W\begin{tabular}{ll} -\T\setlongtables -\T\begin{longtable}{ll} - \code{lower-case} & \code{(set "abcdefghijklmnopqrstuvwxyz")} \\ - \code{upper-case} & \code{(set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")} \\ - \code{alphabetic} & \code{(union lower-case upper-case)} \\ - \code{numeric} & \code{(set "0123456789")} \\ - \code{alphanumeric} & \code{(union alphabetic numeric)} \\ - \code{punctuation} & - \code{(set "}\verb2!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~2\code{")} \\ - \code{graphic} & \code{(union alphanumeric punctuation)} \\ - \code{printing} & \code{(union graphic (set \#}\verb2\2\code{space))} \\ - \code{control} & \code{(negate printing)} \\ - \code{blank} & - \code{(set \#}\verb2\2\code{space (ascii->char 9))} ; 9 is tab \\ - \code{whitespace} & - \code{(union (set \#}\verb2\2\code{space) (ascii-range 9 13))} \\ - \code{hexdigit} & \code{(set "0123456789abcdefABCDEF")} \\ -\W\end{tabular} -\T\end{longtable} -\end{center} -\noindent The above are taken from the default locale in POSIX. -The characters in \code{whitespace} are \cvar{space}, \cvar{tab}, - \cvar{newline} (= \cvar{line feed}), \cvar{vertical tab}, \cvar{form feed}, and - \cvar{carriage return}. - -\subsection{Anchoring} - -\begin{protos} -\proto{string-start}{}{reg-exp} -\proto{string-end}{}{reg-exp} -\end{protos} -\noindent -\code{String-start} returns a regular expression that matches the beginning - of the string being matched against; {string-end} returns one that matches - the end. - -\subsection{Composite expressions} - -\begin{protos} -\proto{sequence}{ reg-exp \ldots}{reg-exp} -\proto{one-of}{ reg-exp \ldots}{reg-exp} -\end{protos} -\noindent -\code{Sequence} matches the concatenation of its arguments, \code{one-of} matches -any one of its arguments. - -\begin{protos} -\proto{text}{ string}{reg-exp} -\end{protos} -\noindent -\code{Text} returns a regular expression that matches the characters in - \cvar{string}, in order. - -\begin{protos} -\proto{repeat}{ reg-exp}{reg-exp} -\proto{repeat}{ count reg-exp}{reg-exp} -\proto{repeat}{ min max reg-exp}{reg-exp} -\end{protos} -\noindent -\code{Repeat} returns a regular expression that matches zero or more -occurences of its \cvar{reg-exp} argument. With no count the result -will match any number of times (\cvar{reg-exp}*). With a single -count the returned expression will match - \cvar{reg-exp} exactly that number of times. -The final case will match from \cvar{min} to \cvar{max} - repetitions, inclusive. -\cvar{Max} may be \code{\#f}, in which case there - is no maximum number of matches. -\cvar{Count} and \cvar{min} should be exact, non-negative integers; - \cvar{max} should either be an exact non-negative integer or \code{\#f}. - -\subsection{Case sensitivity} - -Regular expressions are normally case-sensitive. -\begin{protos} -\proto{ignore-case}{ reg-exp}{reg-exp} -\proto{use-case}{ reg-exp}{reg-exp} -\end{protos} -\noindent -The value returned by - \code{ignore-case} is identical its argument except that case will be - ignored when matching. -The value returned by \code{use-case} is protected - from future applications of \code{ignore-case}. -The expressions returned - by \code{use-case} and \code{ignore-case} are unaffected by later uses of the - these procedures. -By way of example, the following matches \code{"ab"} but not \code{"aB"}, - \code{"Ab"}, or \code{"AB"}. -\begin{example} -\code{(text "ab")} -\end{example} -\noindent -while -\begin{example} -\code{(ignore-case (test "ab"))} -\end{example} -\noindent -matches \code{"ab"}, \code{"aB"}, - \code{"Ab"}, and \code{"AB"} and -\begin{example} -(ignore-case (sequence (text "a") - (use-case (text "b")))) -\end{example} -\noindent -matches \code{"ab"} and \code{"Ab"} but not \code{"aB"} or \code{"AB"}. - -\subsection{Submatches and matching} - -A subexpression within a larger expression can be marked as a submatch. -When an expression is matched against a string, the success or failure -of each submatch within that expression is reported, as well as the -location of the substring matched be each successful submatch. - -\begin{protos} -\proto{submatch}{ key reg-exp}{reg-exp} -\proto{no-submatches}{ reg-exp}{reg-exp} -\end{protos} -\noindent -\code{Submatch} returns a regular expression that matches its argument and - causes the result of matching its argument to be reported by the \code{match} - procedure. -\cvar{Key} is used to indicate the result of this particular submatch - in the alist of successful submatches returned by \code{match}. - Any value may be used as a \cvar{key}. -\code{No-submatches} returns an expression identical to its - argument, except that all submatches have been elided. - -\begin{protos} -\proto{any-match?}{ reg-exp string}{boolean} -\proto{exact-match?}{ reg-exp string}{boolean} -\proto{match}{ reg-exp string}{match or {\tt \#f}} -\proto{match-start}{ match}{index} -\proto{match-end}{ match}{index} -\proto{match-submatches}{ match}{alist} -\end{protos} -\noindent -\code{Any-match?} returns \code{\#t} if \cvar{string} matches \cvar{reg-exp} or - contains a substring that does, and \code{\#f} otherwise. -\code{Exact-match?} returns \code{\#t} if \cvar{string} matches - \cvar{reg-exp} and \code{\#f} otherwise. - -\code{Match} returns \code{\#f} if \cvar{reg-exp} does not match \cvar{string} - and a match record if it does match. -A match record contains three values: the beginning and end of the substring - that matched - the pattern and an a-list of submatch keys and corresponding match records - for any submatches that also matched. -\code{Match-start} returns the index of - the first character in the matching substring and \code{match-end} gives index - of the first character after the matching substring. -\code{Match-submatches} returns an alist of submatch keys and match records. -Only the top match record returned by \code{match} has a submatch alist. - -Matching occurs according to POSIX. -The match returned is the one with the lowest starting index in \cvar{string}. -If there is more than one such match, the longest is returned. -Within that match the longest possible submatches are returned. - -All three matching procedures cache a compiled version of \cvar{reg-exp}. -Subsequent calls with the same \cvar{reg-exp} will be more efficient. - -The C interface to the POSIX regular expression code uses ASCII \code{nul} - as an end-of-string marker. -The matching procedures will ignore any characters following an - embedded ASCII \code{nul}s in \cvar{string}. - -\begin{example} -(define pattern (text "abc")) -(any-match? pattern "abc") \evalsto #t -(any-match? pattern "abx") \evalsto #f -(any-match? pattern "xxabcxx") \evalsto #t - -(exact-match? pattern "abc") \evalsto #t -(exact-match? pattern "abx") \evalsto #f -(exact-match? pattern "xxabcxx") \evalsto #f - -(match pattern "abc") \evalsto (#\{match 0 3\}) -(match pattern "abx") \evalsto #f -(match pattern "xxabcxx") \evalsto (#\{match 2 5\}) - -(let ((x (match (sequence (text "ab") - (submatch 'foo (text "cd")) - (text "ef")) - "xxxabcdefxx"))) - (list x (match-submatches x))) - \evalsto (#\{match 3 9\} ((foo . #\{match 5 7\})) - -(match-submatches - (match (sequence - (set "a") - (one-of (submatch 'foo (text "bc")) - (submatch 'bar (text "BC")))) - "xxxaBCd")) - \evalsto ((bar . #\{match 4 6\})) -\end{example} - -\section{SRFIs} - -`SRFI' stands for `Scheme Request For Implementation'. -An SRFI is a description of an extension to standard Scheme. -Draft and final SRFI documents, a FAQ, and other information about SRFIs - can be found at the -\xlink{SRFI web site}[ at \code{http://srfi.schemers.org}] -{http://srfi.schemers.org}. - -Scheme~48 includes implementations of the following (final) SRFIs: -\begin{itemize} -\item SRFI 1 -- List Library -\item SRFI 2 -- \code{and-let*} -\item SRFI 5 -- \code{let} with signatures and rest arguments -\item SRFI 6 -- Basic string ports -\item SRFI 7 -- Program configuration -\item SRFI 8 -- \code{receive} -\item SRFI 9 -- Defining record types -\item SRFI 11 -- Syntax for receiving multiple values -\item SRFI 13 -- String Library -\item SRFI 14 -- Character-Set Library (see note below) -\item SRFI 16 -- Syntax for procedures of variable arity -\item SRFI 17 -- Generalized \code{set!} -\item SRFI 23 -- Error reporting mechanism -\end{itemize} -Documentation on these can be found at the web site mentioned above. - -SRFI~14 includes the procedure \code{->char-set} which is not a standard - Scheme identifier (in R$^5$RS the only required identifier starting - with \code{-} is \code{-} itself). -In the Scheme~48 version of SRFI~14 we have renamed \code{->char-set} - as \code{x->char-set}. - -The SRFI bindings can be accessed either by opening the appropriate structure - (the structure \code{srfi-}\cvar{n} contains SRFI \cvar{n}) - or by loading structure \code{srfi-7} and then using - the \code{,load-srfi-7-program} command to load an SRFI 7-style program. -The syntax for the command is -\begin{example} -\code{,load-srfi-7-program \cvar{name} \cvar{filename}} -\end{example} -This creates a new structure and associated package, binds the structure - to \cvar{name} in the configuration package, and then loads the program - found in \cvar{filename} into the package. - -As an example, if the file \code{test.scm} contains -\begin{example} -(program (code (define x 10))) -\end{example} -this program can be loaded as follows: -\begin{example} -> ,load-package srfi-7 -> ,load-srfi-7-program test test.scm -[test] -> ,in test -test> x -10 -test> -\end{example} - %\W \chapter*{Index} %\W \htmlprintindex %\T \input{doc.ind} diff --git a/doc/src/version-number.tex b/doc/src/version-number.tex index 9f8e9b6..40d00d2 100644 --- a/doc/src/version-number.tex +++ b/doc/src/version-number.tex @@ -1 +1 @@ -1.0 \ No newline at end of file +0.53 \ No newline at end of file