Commit of 3.1.1 version

This commit is contained in:
Erick Gallesio
2019-10-31 11:29:02 +01:00
commit 831a9f5c47
1036 changed files with 313127 additions and 0 deletions
+186
View File
@@ -0,0 +1,186 @@
%
% STk Reference manual (Appendix: Using the Tk toolkit)
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: ??-Nov-1993 ??:??
% Last file update: 21-Jan-1996 18:29
%
When {\stk} detects that a \var{tk-command} must be called, parameters are
processed to be recognized by the corresponding toolkit function. Since the Tk
toolkit is left (mostly) unmodified, all its primitives ``think'' there is a
running Tcl interpreter behind the scene. Consequently, to work with the Tk
toolkit, a little set of rewriting rules must be known. These rules are
described hereafter.
\begin{note}
This appendix is placed here to permit an {\stk} user to make programs with
the original Tcl/Tk documentation by hand. In no case will it substitute to
the abundant Tcl/Tk manual pages nor to the excellent book by
J.~Ousterhout\cite{Ouster-book}
\end{note}
\section{Calling a Tk-command}
Since Tcl uses strings to communicate with the Tk toolkit, parameters to a
\var{Tk-command} must be translated to strings before calling the C function
which implement it. The following conversions are done, depending on the type
of the parameter that {\stk} must give to the toolkit:
\begin{quote}
\begin{description}
\item[symbol:] the print name of the symbol;
\item[number:] the external representation of the number expressed in radix 10;
\item[string:] no conversion;
\item[keyword:] the print name of the keyword where the initial semicolon has
been replaced by a dash (``-'');
\item[boolean:] the string "0" if {\schfalse} and "1" if \schtrue
\item[tk-command:] the name of the \var{tk-command}
\item[closure:] the address of the closure using the representation
shown in \ref{addresses}.
\item[otherwise:] the external ``slashified'' version of the object.
\end{description}
\end{quote}
As an example, let us make a button with a label containing the
string {\tt "Hello, word"}. According the original Tk/Tcl documentation,
this can be done in Tcl with
\begin{scheme}
button .hello -text "Hello, world"
\end{scheme}
Following the rewriting rules expressed above, this can be done in {\stk} with
\begin{scheme}
(button '.hello '-text "Hello, world")
\end{scheme}
This call defines a new widget object which is stored in the {\stk} variable {\tt
.hello}. This object can be used as a procedure to customize our button.
For instance, setting the border of this button to 5 pixels wide and its
background to gray would be done in Tcl with
\begin{scheme}
.hello configure -border 5 -background gray
\end{scheme}
In {\stk} this would be expressed as
\begin{scheme}
(.hello 'configure '-border 5 '-background "gray")
\end{scheme}
Since keyword colon is replaced by a dash when a \ide{Tk-command} is called, this
expression could also have been written as:
\begin{scheme}
(.hello 'configure{\bf :border} 5{\bf :background} "gray")
\end{scheme}
\section{Associating Callbacks to Tk-commands}
Starting with version 3.0, {\stk} callbacks are Scheme
closures\footnote{Old syntax for callbacks (i.e. strings) is always
supported but its use is deprecated.}. Apart scroll commands, callbacks are
Schemes procedures without parameter. Suppose for example, that we want to
associate a command with the previous {\tt .hello} button. In
Tcl, such a command can be expressed as
\begin{scheme}
.hello configure -command \{puts stdout "Hello, world"; destroy .\}
\end{scheme}
In {\stk}, we can write
\begin{scheme}
(.hello 'configure{\bf :command} (lambda ()
(display "Hello, world\backwhack{}n")
(destroy *root*)))
\end{scheme}
When the user will press the mouse left button, the closure associated
to the {\tt :command} option will be evaluated in the global
environment. Evaluation of the given closure will display the message
and call the {\tt destroy} {\em Tk-command}.
\begin{note}
\label{root window}\mainindex{root window}
The root widget is denoted ``.'' in Tcl. This convention is ambiguous with the
dotted pair convention and the dot must be quoted to avoid problems. Since
this problem arises so often, the variable \ide{*root*} has been introduced in
{\stk} to denote the Tk main window.
\end{note}
\subsection*{Managing Widget Scrollbars}
When using scrollbars, Tk library passes parameters to the widget
associated to the scrollbar (and {\em vice versa}). Let us look at a
text widget with an associated scrollbar. When the scrollbar is moved,
the command of the associated widget is invoked to change its view.
On the other side, when browsing the content of the text widget (with
arrows for example), the scrollbar is updated by calling it's
associated closure. Tk library passes position informations to
scrolling closures. This informations are the parameters of the
closure. Hereafter is an example implementing a text widget with a
scrollbar (see the help pages for details):
\begin{scheme}
(text '.txt :yscrollcommand (lambda l (apply .scroll 'set l)))
(scrollbar '.scroll :command (lambda l (apply .txt 'yview l)))
(pack .txt :side "left")
(pack .scroll :fill "y" :expand \schtrue :side "left")
\end{scheme}
\section{Tk bindings}
\subsection*{Bindings are Scheme closures}
The Tk \ide{bind} command associates Scheme scripts with X events.
Starting with version 3.0 those scripts must be Scheme
closures\footnote{Old syntax for bindings (i.e. strings) is no more
supported. Old bindings scripts must hence be rewritten.}. Binding
closures can have parameters. Those parameters are one char symbols
(with the same conventions than the Tcl \% char, see the \texttt{bind}
help page for details). For instance, the following Tcl script
\begin{scheme}
bind .w <ButtonPress-3> \{puts "Press on widget \%W at position \%x \%y"\}
\end{scheme}
can be translated into
\begin{scheme}
(bind .w "<ButtonPress-3>"
(lambda (|W| x y)
(format \schtrue "Press on widget \verb+~+A at position \verb+~+A \verb+~+A\verb+\+n" |W| x y)))
\end{scheme}
\begin{note}
Usage of verticals bars for the \texttt{W} symbol is necessary here
because the Tk toolkit is case sensitive ({\em e.g.}~\texttt{W}~in
bindings is the path name of the window to which the event was
reported, whereas \texttt{w} is the width field from the event.
\end{note}
\subsection*{Bindings are chained}
In Tk4.0 and later, bindings are chained since it is possible for
several bindings to match a given X event. If the bindings are
associated with different tags, then each of the bindings will be
executed, in order. By default, a class binding will be executed
first, followed by a binding for the widget, a binding for its
toplevel, and an \texttt{all} binding. The \ide{bindtags} command may
be used to change this order for a particular window or to associate
additional binding tags with the window (see corresponding help page
for details). If the result of closure in the bindings chain is the symbol
\ide{break}, the next closures of the chain are not executed. The example below
illustrates this:
\begin{scheme}
(pack (entry '.e))
(bind .e "<KeyPress>" (lambda (|A|)
(unless (string->number |A|) 'break)))
\end{scheme}
Bindings for the entry \texttt{.e} are executed before those for its
class (i.e. \texttt{Entry}). This allows us to filter the characters
which are effectively passed to the \texttt{.e} widget. The test in this
binding closure breaks the chain of bindings if the typed character is
not a digit. Otherwise, the following binding, the one for the
\texttt{Entry} class, is executed and inserts the character typed (a
digit).
Consequently, the simple previous binding makes \texttt{.e} a
controlled entry which only accepts integer numbers.
% LocalWords: tk Ousterhout slashified stdout
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "manual"
%%% End:
+137
View File
@@ -0,0 +1,137 @@
%
% STk Reference manual (Appendix: Using the Tk toolkit)
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: ??-Nov-1993 ??:??
% Last file update: 8-Jul-1996 21:52
%
\newcommand{\schglob}[1]{*#1*}
This appendix summarizes the main differences between the {\stk} Scheme
implementation and the language described in {\rrrr}.
\section{Symbols}
{\stk} symbol syntax has been augmented to allow case significant symbols.
This extension is discussed in \ref{symbolsection}.
The following symbols are defined in the global environment.
\begin{itemize}
\item {\tt\schglob{debug}}\schindex{\schglob{debug}}. Setting
{\tt \schglob{debug}} to {\schtrue} prevents macro inlining and
expression recoding (see~\ref{uncode}).
\item {\tt\schglob{gc-verbose}}\schindex{\schglob{gc-verbose}}. If
{\tt\schglob{gc-verbose}} is {\schtrue}, a message will be printed before
and after each run of garbage collector. The message is printed on the
standard error stream.
\item {\tt\schglob{load-verbose}}\schindex{\schglob{load-verbose}}. If
{\tt\schglob{load-verbose}} is {\schtrue}, the absolute path name of
each loaded file is printed before its effective reading. File names
are printed on the standard error stream.
\item {\tt\schglob{load-path}}\schindex{\schglob{load-path}} must
contain a list of strings. Each string is taken as a directory
path name in which a file will be searched for loading. This
variable can be set automatically from the {\tt STK\_LOAD\_PATH}
shell variable. See {\tt stk(1)} for more details.
\item {\tt\schglob{load-suffixes}}\schindex{\schglob{load-suffixes}}
must contain a list of strings. When the system try to load a
file in a given directory (according to {\tt\schglob{load-path}}
value), it will first try to load it without suffix. If this
file does not exist, the system will sequentially try to find the file by
appending each suffix of this list. A typical value for this
variable may be {\tt ("stk" "stklos" "scm" "so")}.
\item {\tt\schglob{help-path}}\schindex{help,
getting}\schindex{\schglob{help-path}} must contain a list of
strings. Each string is taken as a directory path name in which
documentation files are searched. This variable can be set
automatically from the {\tt STK\_HELP\_PATH} shell variable. See
{\tt stk(1)} for more details.
\item {\tt\schglob{argc}}\schindex{\schglob{argc}} contains the
number of arguments (0 if none), not including interpreter
options. See {\tt stk(1)} for more details.
\item {\tt\schglob{argv}}\schindex{\schglob{argv}} contains a Scheme
list whose elements are the arguments (not including the interpreter
options), in order, or an empty list if there are no arguments.
See {\tt stk(1)} for more details.
\item {\tt\schglob{program-name}}\schindex{\schglob{program-name}} contains
the file name specified with the {\tt -file} option, if present.
Otherwise, it contains the name through which the interpreter was invoked.
See {\tt stk(1)} for more details.
\item {\tt\schglob{print-banner}}\schindex{\schglob{print-banner}}. If
{\tt\schglob{print-verbose}} is {\schfalse}, the usual copyright
message is not displayed when the interpreter is started.
\item {\tt\schglob{root}}\schindex{\schglob{root}} designates the Tk main
window (see~A-\ref{root window}). This variable is not set if
the Tk toolkit is not initialized.
\end{itemize}
\section{Types}
{\stk} implements all the types defined as mandatory in {\rrrr}. However, complex
numbers and rational numbers (which are defined but not required in \rrrr) are
not implemented. The lack of these types implies that some functions of
{\rrrr} are not defined.
Some types which are not defined in {\rrrr} are implemented in {\stk}. Those
types are listed below:
\begin{itemize}
\item input string port type (\ref{inputoutput})
\item output string port type (\ref{inputoutput})
\item keyword type (\ref{keywords})
\item Tk command type (\ref{tkcommand})
\item environment type (\ref{environment})
\item macro type (\ref{macros})
\item address type (\ref{addresses})
\item hash table type (\ref{hashtables})
\item Regular expression type (\ref{regexp-type})
\item process type (\ref{process-type})
\item socket type (\ref{socket-type})
\end{itemize}
\section{Procedures}
The following procedures are required by {\rrrr} and are not implemented in the
{\stk} interpreter.
\begin{itemize}
\item{transcript-off}\schindex{transcript-off}
\item{transcript-on}\schindex{transcript-on}
\end{itemize}
\ide{Transcript-off} and \ide{transcript-on} can be simulated with
various Unix tools such as {\tt script} or {\tt fep}.
\vskip3mm
The following procedures are not implemented in the {\stk} interpreter whereas
they are defined in {\rrrr} (but not required). They are all
related to complex or rational numbers.
\begin{itemize}
\item{numerator}\schindex{numerator}
\item{denominator}\schindex{denominator}
\item{rationalize}\schindex{rationalize}
\item{make-rectangular}\schindex{make-rectangular}
\item{make-polar}\schindex{make-polar}
\item{real-part}\schindex{real-part}
\item{imag-part}\schindex{imag-part}
\item{magnitude}\schindex{magnitude}
\item{angle}\schindex{angle}
\end{itemize}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "manual"
%%% End:
+623
View File
@@ -0,0 +1,623 @@
%
% STk Reference manual (Appendix: An Introdution to STklos)
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: 22-May-1994 22:13
% Last file update: 21-Jan-1996 17:35
%
\section{Introduction}
{\stklos} is the object oriented layer of {\stk}. Its implementation is
derived from version 1.3 of the Gregor Kickzales Tiny Clos
package~\cite{Tiny-Clos}. However, it has been extended to be as close as
possible to CLOS, the Common Lisp Object System{\cite{CLtL2}}. Some features
of {\stklos} are also issued from Dylan{\cite{Dylan}} or SOS{\cite{SOS}}.
Briefly stated, the {\stklos} extension gives the user a full object
oriented system with meta-classes, multiple inheritance, generic
functions and multi-methods. Furthermore, the whole implementation
relies on a true meta object protocol, in the spirit of the one
defined for CLOS\cite{AMOP}. This model has also been used to embody
the predefined Tk widgets in a hierarchy of {\stklos} classes. This
set of classes permits to simplify the core Tk usage by providing
homogeneous accesses to widget options and by hiding the low level
details of Tk widgets, such as naming conventions. Furthermore, as
expected, using of objects facilitates code reuse and definition
of new widgets classes.
The purpose of this appendix is to introduce briefly the {\stklos}
package and in no case will it replace the {\stklos} reference manual (which
needs to be urgently written now~\ldots).
In particular, methods relative to the meta object
protocol and access to the Tk toolkit will not be described here.
\section{Class definition and instantiation}
\subsection {Class definition}
A new class\mainindex{class} is defined with the {\tt
define-class}{\schindex{define-class} macro. The syntax of {\tt define-class}
is close to CLOS {\tt defclass}:
\begin{scheme}
(define-class \var{class} (\hyperi{superclass} \hyperii{superclass}...)
(\hyperi{slot description} \hyperii{slot description}...)
\hyper{metaclass option})
\end{scheme}
The \hyper{metaclass option} will not be discussed in this appendix.
The \hyper{superclass}es list specifies the super classes of \var{class} (see
\ref{inheritance} for more details).
A \hyper{slot description} gives the name of a slot\mainindex{slot} and,
eventually, some ``properties'' of this slot (such as its initial value, the
function which permit to access its value, \ldots). Slot descriptions will be
discussed in
\ref{slot-description}.
As an exemple, consider now that we have to define a complex number. This can
be done with the following class definition:
\begin{scheme}
(define-class <complex> (<number>)
(r i))
\end{scheme}
This binds the symbol {\tt <complex>} to a new class whose instances contain
two slots. These slots are called {\tt r} an {\tt i} and we suppose here
that they contain respectively the real part and the imaginary part of a
complex number. Note that this class inherits from {\tt <number>} which is a
pre-defined class ({\tt <number>} is the super class of the {\tt <real>} and
{\tt <integer>} pre-defined classes).\footnote{With this definition, a {\tt
<real>} is not a {\tt <complex>} since {\tt <real>} inherits from {\tt
<number>} rather than {\tt <complex>}. In practice, inheritance could be
modified {\em a posteriori}, if needed. However, this necessitates some
knowledge of the meta object protocol and it will not be shown in this
document}.
\section{Inheritance}
\label{inheritance}
\subsection{Class hierarchy and inheritance of slots}
Inheritance is specified upon class
definition. As said in the introduction, {\stklos} supports multiple inheritance.
Hereafter are some classes definition:
\begin{scheme}
(define-class A () (a))
(define-class B () (b))
(define-class C () (c))
(define-class D (A B) (d a))
(define-class E (A C) (e c))
(define-class F (D E) (f))
\end{scheme}
{\tt A}, {\tt B}, {\tt C} have a null list of super classes. In this case, the
system will replace it by the list which only contains \ide{<object>}, the
root of all the classes defined by \ide{define-class}. {\tt D}, {\tt E}, {\tt
F} use multiple inheritance: each class inherits from two previously
defined classes. Those class definitions define a hierarchy which is
shown in Figure~1. In this figure, the class \ide{<top>} is also shown; this
class is the super class of all Scheme objects. In particular,
\ide{<top>} is the super class of all standard Scheme types.
\begin{figure}
\centerline{\psfig{figure={hierarchy.eps}}}
\caption{A class hierarchy}
\end{figure}
The set of slots of a given class is calculated by ``unioning'' the slots of
all its super class. For instance, each instance of the class D, defined
before will have three slots ({\tt a}, {\tt b} and {\tt d}). The slots of a class
can be obtained by the \ide{class-slots} primitive.
For instance,
\begin{scheme}
(class-slots A) \lev (a)
(class-slots E) \lev (a e c)
(class-slots F) \lev (d a b c f)
\end{scheme}
\begin{note}
The order of slots is not significant.
\end{note}
\subsection {Instance creation and slot access}
Creation of an instance\mainindex{instance} of a previously defined
class can be done with the {\tt make}\schindex{make} procedure. This
procedure takes one mandatory parameter which is the class of the
instance which must be created and a list of optional
arguments. Optional arguments are generally used to initialize some
slots of the newly created instance. For instance, the following form
\begin{scheme}
(define c (make <complex>))
\end{scheme}
will create a new {\tt <complex>} object and will bind it to the {\tt c}
Scheme variable.
Accessing the slots of the new complex number can be done with the {\tt
slot-ref}\schindex{slot-ref} and the {\tt slot-set!}\schindex{slot-set!}
primitives. {\tt Slot-set!} primitive permits to set the value of an object
slot and {\tt slot-ref} permits to get its value.
\begin{scheme}
(slot-set! c 'r 10)
(slot-set! c 'i 3)
(slot-ref c 'r) \lev 10
(slot-ref c 'i) \lev 3
\end{scheme}
Using the \ide{describe} generic function is a simple way to see all
the slots of an object at one time: this function prints all the slots
of an object on the standard output. For instance, the expression
\begin{scheme}
(describe c)
\end{scheme}
will print the following informations on the standard output:
\begin{scheme}
\sharpsign[<complex> 122398] is an instance of class <complex>
Slots are:
r = 10
i = 3
\end{scheme}
\subsection{Slot description}
\label{slot-description}
When specifying a slot, a set of options can be given to the system. Each option
is specified with a keyword{\mainindex{keyword}}. The list of authorised keywords is
given below:
\begin{itemize}
\item {\tt :initform}\schindex{:initform}\schindex{default slot value}
permits to supply a default value for the slot. This default value is obtained
by evaluating the form given after the {\tt :initform} in the global
environment\mainindex{top level environment}.
\item{\tt :init-keyword}\schindex{:init-keyword} permits to specify the
keyword for initializing a slot. The init-keyword may be provided
during instance creation (i.e. in the make optional parameter list). Specifying
such a keyword during instance initialization will supersede the
default slot initialization possibly given with {\tt :initform}.
\item {\tt :getter}{\schindex{:getter}} permits to supply the name for the
slot getter\mainindex{getter}. The name binding is done in the global
environment\mainindex{top level environment}.
\item {\tt :setter}{\schindex{:setter}} permits to supply the name for the
slot setter\mainindex{setter}. The name binding is done in the global
environment\mainindex{top level environment}.
\item {\tt :accessor}\schindex{:accessor} permits to supply the name for the
slot accessor\mainindex{accessor}. The name binding is done in the global
environment\mainindex{top level environment}. An accessor permits to get and
set the value of a slot. Setting the value of a slot is done with the extended
version of {\tt set!}\schindex{set!}.
\item {\tt :allocation}\schindex{:allocation} permits to specify how storage for
the slot is allocated. Three kinds of allocation are provided.
They are described below:
\begin{itemize}
\item {\tt :instance}\schindex{:instance} indicates that each instance gets
its own storage for the slot. This is the default.
\item {\tt :class}\schindex{:class} indicates that there is one storage
location used by all the direct and indirect instances of the class. This
permits to define a kind of global variable which can be accessed only
by (in)direct instances of the class which defines this slot.
\item {\tt :virtual}\schindex{:virtual} indicates that no storage will
be allocated for this slot. It is up to the user to define a getter
and a setter function for this slot. Those functions must be defined with the
{\tt :slot-ref}\schindex{:slot-ref}
and {\tt :slot-set!}\schindex{:slot-set!} options. See the example below.
\end{itemize}
\end{itemize}
To illustrate slot description, we shall redefine the {\tt <complex>} class
seen before. A definition could be:
\begin{scheme}
(define-class <complex> (<number>)
((r :initform 0 :getter get-r :setter set-r! :init-keyword :r)
(i :initform 0 :getter get-i :setter set-i! :init-keyword :i)))
\end{scheme}
With this definition, the {\tt r} and {\tt i} slot are set to 0 by default.
Value of a slot can also be specified by calling {\tt make} with
the {\tt :r} and {\tt :i} keywords. Furthermore, the generic functions {\tt get-r}
and {\tt set-r!} (resp. {\tt get-i} and {\tt set-i!}) are automatically defined
by the system to read and write the {\tt r} (resp. {\tt i}) slot.
\begin{scheme}
(define c1 (make <complex> :r 1 :i 2))
(get-r c1) \lev 1
(set-r! c1 12)
(get-r c1) \lev 12
(define c2 (make <complex> :r 2))
(get-r c2) \lev 2
(get-i c2) \lev 0
\end{scheme}
Accessors provide an uniform access for reading and writing an object slot.
Writing a slot is done with an extended form of {\tt set!}\schindex{set!}
which is close to the Common Lisp {\tt setf} macro. So, another definition of the
previous {\tt <complex>} class, using the {\tt :accessor} option, could be:
\begin{scheme}
(define-class <complex> (<number>)
((r :initform 0 :accessor real-part :init-keyword :r)
(i :initform 0 :accessor imag-part :init-keyword :i)))
\end{scheme}
Using this class definition, reading the real part of the {\tt c} complex can
be done with:
\begin{scheme}
(real-part c)
\end{scheme}
and setting it to the value contained in the {\tt new-value} variable
can be done using the extended form of {\tt set!}.
\begin{scheme}
(set! (real-part c) new-value)
\end{scheme}
Suppose now that we have to manipulate complex numbers with rectangular
coordinates as well as with polar coordinates. One solution could be to
have a definition of complex numbers which uses one particular representation
and some conversion functions to pass from one representation to the other.
A better solution uses virtual slots. A complete definition of the {\tt <complex>}
class using virtual slots is given in Figure~2.
\begin{figure}
{\footnotesize
\begin{quote}
\begin{quote}
\begin{verbatim}
(define-class <complex> (<number>)
(;; True slots use rectangular coordinates
(r :initform 0 :accessor real-part :init-keyword :r)
(i :initform 0 :accessor imag-part :init-keyword :i)
;; Virtual slots access do the conversion
(m :accessor magnitude :init-keyword :magn
:allocation :virtual
:slot-ref (lambda (o)
(let ((r (slot-ref o 'r)) (i (slot-ref o 'i)))
(sqrt (+ (* r r) (* i i)))))
:slot-set! (lambda (o m)
(let ((a (slot-ref o 'a)))
(slot-set! o 'r (* m (cos a)))
(slot-set! o 'i (* m (sin a))))))
(a :accessor angle :init-keyword :angle
:allocation :virtual
:slot-ref (lambda (o)
(atan (slot-ref o 'i) (slot-ref o 'r)))
:slot-set! (lambda(o a)
(let ((m (slot-ref o 'm)))
(slot-set! o 'r (* m (cos a)))
(slot-set! o 'i (* m (sin a))))))))
\end{verbatim}
\caption{\em A {\tt <complex>} number class definition using virtual slots}
\end{quote}
\end{quote}
}
\end{figure}
\bigskip
This class definition implements two real slots ({\tt r} and {\tt i}). Values
of the {\tt m} and {\tt a} virtual slots are calculated from real slot
values. Reading a virtual slot leads to the application of the function
defined in the {\tt :slot-ref}\schindex{:slot-ref} option. Writing such a slot
leads to the application of the function defined in the {\tt :slot-set!}\schindex{:slot-set!} option.
For instance, the following expression
\begin{scheme}
(slot-set! c 'a 3)
\end{scheme}
permits to set the angle of the {\tt c} complex number. This expression
conducts, in fact, to the evaluation of the following expression
\begin{scheme}
((lambda o m)
(let ((m (slot-ref o 'm)))
(slot-set! o 'r (* m (cos a)))
(slot-set! o 'i (* m (sin a))))
c 3)
\end{scheme}
A more complete example is given below:
\begin{scheme}
(define c (make <complex> :r 12 :i 20))
(real-part c) \lev 12
(angle c) \lev 1.03037682652431
(slot-set! c 'i 10)
(set! (real-part c) 1)
(describe c) \lev
\sharpsign[<complex> 128bf8] is an instance of class <complex>
Slots are:
r = 1
i = 10
m = 10.0498756211209
a = 1.47112767430373
\end{scheme}
Since initialization keywords have been defined for the four slots, we
can now define the \ide{make-rectangular} and \ide{make-polar}
standard Scheme primitives.
\begin{scheme}
(define make-rectangular
(lambda (x y) (make <complex> :r x :i y)))
(define make-polar
(lambda (x y) (make <complex> :magn x :angle y)))
\end{scheme}
\subsection{Class precedence list}
A class may have more than one superclass.{\footnote{
This section is an adaptation of Jeff Dalton's (J.Dalton@ed.ac.uk)
Brief introduction to CLOS)}}
With single inheritance (one superclass), it is easy to order the super classes
from most to least specific. This is the rule:
\begin{quote}
\begin{quote}
{\bf Rule 1: Each class is more specific than its superclasses.
}
\end{quote}
\end{quote}
With multiple inheritance, ordering is harder. Suppose we have
\begin{scheme}
(define-class X ()
((x :initform 1)))
(define-class Y ()
((x :initform 2)))
(define-class Z (X Y)
(...))
\end{scheme}
In this case, the {\tt Z} class is more specific than the {\tt X} or
{\tt Y} class for instances of {\tt Z}. However, the {\tt :initform}
specified in {\tt X} and {\tt Y} leads to a problem: which one
overrides the other? The rule in {\stklos}, as in CLOS,
is that the superclasses listed earlier are more specific than those listed later.
So:
\begin{quote}
\begin{quote}
{\bf Rule 2: For a given class, superclasses listed earlier are more
specific than those listed later.
}
\end{quote}
\end{quote}
These rules are used to compute a linear order for a class and all its
superclasses, from most specific to least specific. This order is called the
``class precedence list'' of the class. Given those two rules, we can claim
that the initial form for the {\tt x} slot of previous example is 2 since the
class {\tt X} is placed before {\tt Y} in class precedence list of {\tt Z}.
This two rules are not always enough to determine a unique order, however, but
they give an idea of how things work. {\stklos} algorithm for calculating the
precedence list is a little simpler than the CLOS one described in
\cite{AMOP} for breaking ties. Consequently the calculated class precedence
list could be different. Taking the {\tt F} class shown in Figure~1, the {\stklos}
calculated class precedence list is
\begin{quote}
{\tt
(f d e a b c <object> <top>)
}
\end{quote}
whereas it would be the following list with a CLOS-like algorithm:
\begin{quote}
{\tt
(f d e a c b <object> <top>)
}
\end{quote}
However, it is usually considered a bad idea for programmers to rely on
exactly what the order is. If the order for some superclasses is important,
it can be expressed directly in the class definition.
The precedence list of a class can be obtained by the function
\ide{class-precedence-list}. This function returns a ordered
list whose first element is the most specific class. For instance,
\begin{scheme}
(class-precedence-list B) \lev (\sharpsign[<class> 12a248] \sharpsign[<class> 1074e8] \sharpsign[<class> 107498])
\end{scheme}
However, this result is not too much readable; using the function class-name
yields a clearer result:
\begin{scheme}
(map class-name (class-precedence-list B)) \lev (b <object> <top>)
\end{scheme}
\section{Generic functions}
\subsection{Generic functions and methods}
\label{gf-n-methods}
Neither {\stklos} nor CLOS use the message mechanism for methods as
most Object Oriented language do. Instead, they use the notion of
generic function. A generic function can be seen as a methods
``tanker''. When the evaluator requestd the application of a generic
function, all the methods of this generic function will be grabbed and
the most specific among them will be applied. We say that a method
{\em M} is {\em more specific} than a method {\em M'} if the class of
its parameters are more specific than the {\em M'} ones. To be more
precise, when a generic funtion must be ``called'' the system will
\begin{enumerate}
\item search among all the generic function those which are applicable
\item sort the list of applicable methods in the ``most specific'' order
\item call the most specific method of this list (i.e. the first method of
the sorted methods list).
\end{enumerate}
The definition of a generic function is done with the \ide{define-generic}
macro. Definition of a new method is done with the \ide{define-method} macro.
Note that \ide{define-method} automatically defines the generic function if it
has not been defined before. Consequently, most of the time, the
\ide{define-generic} needs not be used.
Consider the following definitions:
\begin{scheme}
(define-generic M)
(define-method M((a <integer>) b) 'integer)
(define-method M((a <real>) b) 'real)
(define-method M(a b) 'top)
\end{scheme}
The \ide{define-generic} call defines {\tt M} as a generic
function. Note that the signature of the generic function is not given
upon definition, contrarily to CLOS. This will permit methods with
different signatures for a given generic function, as we shall see
later. The three next lines define methods for the {\tt M} generic
function. Each method uses a sequence of {\em parameter specializers}
that specify when the given method is applicable. A specializer
permits to indicate the class a parameter must belong to (directly or
indirectly) to be applicable. If no speciliazer is given, the system
defaults it to \ide{<top>}. Thus, the first method definition
is equivalent to
\begin{scheme}
(define-method M((a <integer>) (b <top>)) 'integer)
\end{scheme}
Now, let us look at some possible calls to generic function {\tt M}:
\begin{scheme}
(M 2 3) \lev integer
(M 2 \schtrue) \lev integer
(M 1.2 'a) \lev real
(M {\sharpsign}3 'a) \lev real
(M {\schtrue} {\schfalse}) \lev top
(M 1 2 3) \lev error (since no method exists for 3 parameters)
\end{scheme}
The preceding methods use only one specializer per parameter list. Of course,
each parameter can use a specializer. In this case, the parameter list is scanned
from left to right to determine the applicability of a method. Suppose we declare
now
\begin{scheme}
(define-method M ((a <integer>) (b <number>)) 'integer-number)
(define-method M ((a <integer>) (b <real>)) 'integer-real)
(define-method M (a (b <number>)) 'top-number)
\end{scheme}
In this case,
\begin{scheme}
(M 1 2) \lev integer-integer
(M 1 1.0) \lev integer-real
(M 1 {\schtrue}) \lev integer
(M 'a 1) \lev 'top-number
\end{scheme}
\subsection{Next-method}
When a generic function is called, the list of applicable methods is built. As
mentioned before, the most specific method of this list is applied
(see~\ref{gf-n-methods}). This method may call the next method in
the list of applicable methods. This is done by using the special form
\ide{next-method}. Consider the following definitions
\begin{scheme}
(define-method Test((a <integer>)) (cons 'integer (next-method)))
(define-method Test((a <number>)) (cons 'number (next-method)))
(define-method Test(a) (list 'top))
\end{scheme}
With those definitions,
\begin{scheme}
(Test 1) \lev (integer number top)
(Test 1.0) \lev (number top)
(Test \schtrue) \lev (top)
\end{scheme}
\subsection{Example}
In this section we shall continue to define operations on the {\tt <complex>}
class defined in Figure~2. Suppose that we want to use it to implement
complex numbers completely. For instance a definition for the addition of
two complexes could be
\begin{scheme}
(define-method new-+ ((a <complex>) (b <complex>))
(make-rectangular (+ (real-part a) (real-part b))
(+ (imag-part a) (imag-part b))))
\end{scheme}
To be sure that the {\tt +} used in the method {\tt new-+} is the standard
addition we can do:
\begin{scheme}
(define-generic new-+)
(let ((+ +))
(define-method new-+ ((a <complex>) (b <complex>))
(make-rectangular (+ (real-part a) (real-part b))
(+ (imag-part a) (imag-part b)))))
\end{scheme}
The {\tt define-generic} ensures here that {\tt new-+} will be defined in the global
environment. Once this is done, we can add methods to the generic function
{\tt new-+} which make a closure on the {\tt +} symbol.
A complete writing of the {\tt new-+} methods is shown in Figure~3.
\begin{figure}
{\footnotesize
\begin{quote}
\begin{quote}
\begin{verbatim}
(define-generic new-+)
(let ((+ +))
(define-method new-+ ((a <real>) (b <real>)) (+ a b))
(define-method new-+ ((a <real>) (b <complex>))
(make-rectangular (+ a (real-part b)) (imag-part b)))
(define-method new-+ ((a <complex>) (b <real>))
(make-rectangular (+ (real-part a) b) (imag-part a)))
(define-method new-+ ((a <complex>) (b <complex>))
(make-rectangular (+ (real-part a) (real-part b))
(+ (imag-part a) (imag-part b))))
(define-method new-+ ((a <number>)) a)
(define-method new-+ () 0)
(define-method new-+ args (new-+ (car args) (apply new-+ (cdr args)))))
(set! + new-+)
\end{verbatim}
\caption{\em Extending {\tt +} for dealing with complex numbers}
\end{quote}
\end{quote}
}
\end{figure}
\bigskip
We use here the fact that generic function are not obliged to have the same
number of parameters, contrarily to CLOS. The four first methods
implement the dyadic addition. The fifth method says that the addition of a single
element is this element itself. The sixth method says that using the addition with
no parameter always return 0. The last method takes an arbitrary number of
parameters\footnote{The third parameter of a define-method is a parameter list
which follow the conventions used for lambda expressions. In particular it can
use the dot notation or a symbol to denote an arbitrary number of parameters}.
This method acts as a kind of {\tt reduce}: it calls the dyadic addition on
the {\em car} of the list and on the result of applying it on its rest. To
finish, the {\tt set!} permits to redefine the {\tt + symbol} to our extended
addition.
\bigskip
To terminate our implementation (integration?) of complex numbers, we can
redefine standard Scheme predicates in the following manner:
\begin{scheme}
(define-method complex? (c <complex>) \schtrue)
(define-method complex? (c) \schfalse)
(define-method number? (n <number>) \schtrue)
(define-method number? (n) \schfalse)
...
...
\end{scheme}
Standard primitives in which complex numbers are involved could also be redefined
in the same manner.
This ends this brief presentation of the {\stklos} extension.
+280
View File
@@ -0,0 +1,280 @@
%
% STk Reference manual (Appendix: Miscellaneous Informations)
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: 21-Dec-1994 12:05
% Last file update: 8-Jul-1996 22:18
%
\section{Introduction}
This appendix list a number of things which cannot go elsewhere in this
document. The only link between the items listed her is that they should
ease your life when using {\stk}.
\section{About \stk}
\subsection{Last release}
{\stk} distribution is available on various sites. The original distribution
site is {\tt kaolin.unice.fr} {\tt (193.48.229.225)}. Files are available
through anonymous ftp and are located in the {\tt /pub}
directory. Distribution file names have the form {\tt STk-x.y.tar.gz}, where {\tt
x} and {\tt y} represent the version and the release of the package. You can
also find interim releases of {\stk}. Interim releases are stored in file
whose name have the form {\tt STk-x.y.z.tar.gz} where {\tt z} is the interim
release number.
David Fox maintains a mirror site of {\tt kaolin.unice.fr}. This site is
located in the USA and is available at the following URL:
{\tt ftp://cs.nyu.edu/pub/local/fox/stk}.
\subsection{Sharing Code}
If you have written code that you want to share with the (small) {\stk}
community, you can deposit it in the directory {\tt /pub/Incoming} of {\tt
kaolin.unice.fr}. Mail me a small note when you deposit a file in this
directory so I can put in in its definitive place ({\tt /pub/Contrib}
directory contains the contributed code).
\subsection{{\stk} Mailing list}
There is a mailing list for {\stk} located on {\tt kaolin.unice.fr}. The
intent of this mailing list is to permit to {\stk} users to share experiences,
expose problems, submit ideas and \ldots everything which you find interesting
(and which is related to \stk).
To subscribe to the mailing list, simply send a message with the word {\tt
subscribe} in the {\tt Subject:} field of you mail. Mail must be sent to the
following address: {\tt stk-request@kaolin.unice.fr}
To unsubscribe from the mailing list, send a mail at previous email address with the word {\tt unsubscribe} in the {\tt Subject:} field.
For more information on the mailing list management send a message with the
word {\tt help} in the {\tt Subject:} field of your mail. In particular, it
is possible to find all the messages which have already been sent on the {\stk}
mailing list.
Subscription/un-subscription/information requests are processed
automatically without human intervention. If you something goes wrong, send a
mail to {\tt eg@unice.fr}.
Once you have properly subscribe to the mailing list,
\begin{itemize}
\item you can send your messages about {\stk} to {\tt stk@kaolin.unice.fr},
\item you will receive all the messages of the mailing list to the email
address you used when you subscribed to the list.
\end{itemize}
\subsection{{\stk} FAQ}
Marc Furrer has set up a FAQ{\index{FAQ} for {\stk}.
This FAQ is regularly posted on the {\stk} mailing list. It can
also be accessed through {\tt
http://ltiwww.epfl.ch/~furrer/STk/FAQ.html}. ASCII version of the FAQ is
available from {\tt http://ltiwww.epfl.ch/~furrer/STk/FAQ.txt}.
\subsection{Reporting a bug}
When you find a bug in {\stk}, please send its description to the following
address {\tt stk-bugs@kaolin.unice.fr}. Don't forget to indicate the version
you use and the architecture the system is compiled on. {\stk} version and
architecture can be found by using the {\tt version} and {\tt machine-type}
Scheme primitives. If possible, try to find a small program which exhibit the bug.
\section{{\stk} and Emacs}
The Emacs family editors\index{Emacs editor} can be customized to ease
viewing and editing programs of a particular sort. Hints given below
enable a fine ``integration'' of {\stk} in Emacs.
\subsection*{Automatic scheme-mode setting}
Emacs mode can be chosen automatically on the file's name. To edit file
ended by {\tt .stk }or {\tt .stklos} in Scheme mode, you have to set the
Elisp variable {\tt auto-mode-alist} to control the correspondence between
those suffixes and the scheme mode. The simpler way to set this variable
consists to add the following lines in your .{\tt emacs} startup file.
\begin{quote}
\begin{verbatim}
;; Add the '.stk' and '.stklos' suffix in the auto-mode-alist Emacs
;; variable. Setting this variable permits to automagically place the
;; buffer in scheme-mode.
(setq-default auto-mode-alist (append auto-mode-alist
("\\.stk$" . scheme-mode)
("\\.stklos$" . scheme-mode)))
\end{verbatim}
\end{quote}
\subsection*{Using Emacs and {\em CMU Scheme}}
{\em CMU Scheme} package\index{CMU Scheme} package} permits to run the {\stk} interpreter in an Emacs
window. Once the package is loaded, you can send text to the inferior
{\stk} interpreter from other buffers containing Scheme source.
The {\em CMU Scheme} package is distributed with Emacs (both FSF-Emacs and
Xemacs) and you should have it if you are running this editor.
To use the {\em CMU Scheme} package with {\stk}, place the following lines in
your {\tt .emacs} startup file.
\begin{quote}
\begin{verbatim}
;; Use cmu-scheme rather than xscheme which is launched by default
;; whence running 'run-scheme' (xscheme is wired with CScheme)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme" t)
(setq scheme-program-name "stk")
(setq inferior-scheme-mode-hook '(lambda() (split-window)))
\end{verbatim}
\end{quote}
After having entered those lines in your {\tt .emacs} file, you can simply
run the {\stk} interpreter by typing
\begin{quote}
\begin{verbatim}
M-x run-scheme
\end{verbatim}
\end{quote}
Read the {\em CMU Scheme} documentation (or use the describe-mode Elisp command)
for a complete description of this package.
\subsection*{Using Emacs and the {\em Ilisp} package}
{\em Ilisp}\index{Ilisp package} is another scheme package which allows to
run the {\stk} interpreter in an Emacs window. This is a rich package with
a lot of nice features. {\em Ilisp} comes pre-installed with Xemacs; it
has to be installed with FSF Emacs (the last version of {\em Ilisp} can be
ftp'ed anonymously from {\tt ftp.cs.cmu.edu} (128.2.206.173) in the {\tt
/user/ai/lang/lisp/util/emacs/ilisp} directory).
To use the {\em Ilisp} package with {\stk}, place the following lines in
your {\tt .emacs} startup file.
\begin{quote}
\begin{verbatim}
(autoload 'run-ilisp "ilisp" "Select a new inferior LISP." t)
(autoload 'stk "ilisp" "Run stk in ILISP." t)
(add-hook 'ilisp-load-hook
'(lambda ()
(require 'completer)
;; Define STk dialect characteristics
(defdialect stk "STk Scheme"
scheme
(setq comint-prompt-regexp "^STk> ")
(setq ilisp-program "stk -interactive")
(setq comint-ptyp t)
(setq comint-always-scroll t)
(setq ilisp-last-command "*"))))
\end{verbatim}
\end{quote}
After having entered those lines in your {\tt .emacs} file, you can simply
run the {\stk} interpreter by typing
\begin{quote}
\begin{verbatim}
M-x stk
\end{verbatim}
\end{quote}
The Ilisp package comes with a rich documentation which describe how to
customize the package.
\subsection*{Other packages}
Another way to use {\stk} and Emacs consists to use a special purpose
{\stk} mode. You can find two such modes in the {\tt /pub/Contrib}
directory of {\tt kaolin.unice.fr}.
\subsection {Using the SLIB package with \stk}
Aubrey Jaffer maintains a package called {\em SLIB}\index{SLIB package}
which is a portable Scheme library which provides compatibility and utility
functions for all standard Scheme implementations. To use this package, you
have just to type
\begin{quote}
\begin{verbatim}
(require "slib")
\end{verbatim}
\end{quote}
and follow the instructions given in the {\em SLIB} library to use a
particular package.
\begin{note}
{\em SLIB} uses also the {\em require/provide} mechanism to load components
of the library. Once {\em SLIB} has been loaded, the standard {\stk}
{\tt require}\schindex{require} and {\tt provide}\schindex{provide}
are overloaded such as if their parameter
is a string this is the old {\stk} procedure which is called, and if their
parameter is a symbol, this is the {\em SLIB} one which is called.
\end{note}
\section{Getting information about Scheme}
\subsection{The {\rrrr} document}
{\rrrr}{\index{R4RS}} is the document which fully describe the Scheme
Programming Language, it can be found in the Scheme repository
(see~\ref{scheme-repository}) in the directory:
\begin{quote}
{\tt ftp.cs.indiana.edu:/pub/scheme-repository/doc}
\end{quote}
Aubrey Jaffer has also translated this document in HTML. A version of this
document is available at
\begin{quote}
{\tt file://swiss-ftp.ai.mit.edu/pub/scm/HTML/r4rs\_toc.html}
\end{quote}
\subsection{The Scheme Repository}
The main site where you can find (many) informations about Scheme is
located in the University of Indiana. The Scheme repository\index{Scheme
Repository} is maintained by David Eby. The repository currently consists
of the following areas:
\begin{itemize}
\item Lots of scheme code meant for benchmarking, library/support, research, education, and fun.
\item On-line documents: Machine readable standards documents, standards proposals, various Scheme-related tech reports, conference papers, mail archives, etc.
\item Most of the publicly distributable Scheme Implementations.
\item Material designed primarily for instruction.
\item Freely-distributable promotional or demonstration material for Scheme-related products.
\item Utilities (e.g., Schemeweb, SLaTeX).
\item Extraneous stuff, extensions, etc.
\end{itemize}
You can access the Scheme repository with
{\tt
\begin{itemize}
\item ftp.cs.indiana.edu:/pub/scheme-repository
\item http://www.cs.indiana.edu/scheme-repository/SRhome.html
\end{itemize}
}
The Scheme Repository is mirrored in Europe:
{\tt
\begin{itemize}
\item ftp.inria.fr:/lang/Scheme
\item faui80.informatik.uni-erlangen.de:/pub/scheme/yorku
\item ftp.informatik.uni-muenchen.de:/pub/comp/programming/languages/scheme/scheme-repository
\end{itemize}
}
\subsection{Usenet newsgroup and other addresses}
There is a usenet newsgroup about the Scheme Programming language: {\tt
comp.lang.scheme}.
Following addresses contains also material about the Scheme language
\begin{itemize}
\item {\tt http://www.cs.cmu.edu:8001/Web/Groups/AI/html/faqs/lang/scheme/top.html}
contains the Scheme FAQ.
\item {\tt http://www-swiss.ai.mit.edu/scheme-home.html} is the Scheme Home page
at MIT
\item {\tt http://www.ai.mit.edu/projects/su/su.html} is the Scheme Underground
web page
\end{itemize}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
# Makefile for Manual building
TEX= manual.tex commands.tex Reference1.tex Reference2.tex \
Appendix-A.tex Appendix-B.tex Appendix-C.tex Appendix-D.tex
all: dvi ps
dvi: manual.dvi
ps: manual.ps
manual.dvi: $(TEX)
echo -n > index.tex
latex manual.tex
tr A-Z a-z < manual.idx> manual2.idx
mv manual2.idx manual.idx
STK_LIBRARY=../../Lib ../../Src/stk -no -file index.stk
bibtex manual
latex manual.tex
latex manual.tex
manual.ps: manual.dvi
dvips -t a4 -f manual.dvi > manual.ps
clean:
rm -f *.aux *.idx *.log *.aux *.bbl *.blg *.idx *.toc *~ index.tex
very-clean: clean
rm -f manual.ps manual.dvi
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
../bibliography.bib
+203
View File
@@ -0,0 +1,203 @@
% Macros for R^nRS.
\makeatletter
% Chapters, sections, etc.
\newcommand{\extrapart}[1]{
\chapter*{#1}
\markboth{#1}{#1}
\vskip 1ex
\addcontentsline{toc}{chapter}{#1}}
\newcommand{\clearchapterstar}[1]{
\clearpage
\topnewpage[
\centerline{\large\bf\uppercase{#1}}
\bigskip]}
\newcommand{\clearextrapart}[1]{
\clearchapterstar{#1}
\markboth{#1}{#1}
\addcontentsline{toc}{chapter}{#1}}
\newcommand{\vest}{}
\newcommand{\dotsfoo}{$\ldots\,$}
\newcommand{\sharpfoo}[1]{{\tt\##1}}
\newcommand{\schfalse}{\sharpfoo{f}}
\newcommand{\schtrue}{\sharpfoo{t}}
\newcommand{\singlequote}{{\tt'}} %\char19
\newcommand{\doublequote}{{\tt"}}
\newcommand{\backquote}{{\tt\char18}}
\newcommand{\backwhack}{{\tt\char`\\}}
\newcommand{\atsign}{{\tt\char`\@}}
\newcommand{\sharpsign}{{\tt\#}}
\newcommand{\verticalbar}{{\tt|}}
\newcommand{\coerce}{\discretionary{->}{}{->}}
% Knuth's \in sucks big boulders
\def\elem{\hbox{\raise.13ex\hbox{$\scriptstyle\in$}}}
\newcommand{\meta}[1]{{\noindent\hbox{\rm$\langle$#1$\rangle$}}}
\let\hyper=\meta
\newcommand{\hyperi}[1]{\hyper{#1$_1$}}
\newcommand{\hyperii}[1]{\hyper{#1$_2$}}
\newcommand{\hyperj}[1]{\hyper{#1$_i$}}
\newcommand{\hypern}[1]{\hyper{#1$_n$}}
\newcommand{\var}[1]{\noindent\hbox{\it{}#1\/}} % Careful, is \/ always the right thing?
\newcommand{\vari}[1]{\var{#1$_1$}}
\newcommand{\varii}[1]{\var{#1$_2$}}
\newcommand{\variii}[1]{\var{#1$_3$}}
\newcommand{\variv}[1]{\var{#1$_4$}}
\newcommand{\varj}[1]{\var{#1$_j$}}
\newcommand{\varn}[1]{\var{#1$_n$}}
\newcommand{\vr}[1]{{\noindent\hbox{$#1$\/}}} % Careful, is \/ always the right thing?
\newcommand{\vri}[1]{\vr{#1_1}}
\newcommand{\vrii}[1]{\vr{#1_2}}
\newcommand{\vriii}[1]{\vr{#1_3}}
\newcommand{\vriv}[1]{\vr{#1_4}}
\newcommand{\vrj}[1]{\vr{#1_j}}
\newcommand{\vrn}[1]{\vr{#1_n}}
\newcommand{\defining}[1]{\mainindex{#1}{\em #1}}
\newcommand{\ide}[1]{{\schindex{#1}\frenchspacing\tt#1}}
\newcommand{\lambdaexp}{lambda expression}
\newcommand{\Lambdaexp}{Lambda expression}
% \reallyindex{SORTKEY}{HEADCS}{TYPE}
% writes (index-entry "SORTKEY" "HEADCS" TYPE PAGENUMBER)
% which becomes \item \HEADCS{SORTKEY} mainpagenumber ; auxpagenumber ...
\global\def\reallyindex#1#2#3{%
\write\@indexfile{(index-entry "#1" "#2" #3 \thepage)}}
\newcommand{\mainschindex}[1]{\label{#1}\reallyindex{#1}{tt}{main}}
\newcommand{\mainindex}[1]{\reallyindex{#1}{rm}{main}}
\newcommand{\schindex}[1]{\reallyindex{#1}{tt}{aux}}
\newcommand{\sharpindex}[1]{\reallyindex{#1}{sharpfoo}{aux}}
\renewcommand{\index}[1]{\reallyindex{#1}{rm}{aux}}
\newcommand{\domain}[1]{#1}
\newcommand{\nodomain}[1]{}
%\newcommand{\todo}[1]{{\rm$[\![$!!~#1$]\!]$}}
\newcommand{\todo}[1]{}
% \frobq will make quote and backquote look nicer.
\def\frobqcats{%\catcode`\'=13
\catcode`\`=13{}}
{\frobqcats
\gdef\frobqdefs{%\def'{\singlequote}
\def`{\backquote}}}
\def\frobq{\frobqcats\frobqdefs}
% \cf = code font
% Unfortunately, \cf \cf won't work at all, so don't even attempt to
% next constructions which use them...
\newcommand{\cf}{\frenchspacing\frobq\tt}
% Same as \obeycr, but doesn't do a \@gobblecr.
{\catcode`\^^M=13 \gdef\myobeycr{\catcode`\^^M=13 \def^^M{\\}}%
\gdef\restorecr{\catcode`\^^M=5 }}
{\catcode`\^^I=13 \gdef\obeytabs{\catcode`\^^I=13 \def^^I{\hbox{\hskip 4em}}}}
{\obeyspaces\gdef {\hbox{\hskip0.5em}}}
\gdef\gobblecr{\@gobblecr}
\def\setupcode{\@makeother\^}
% Scheme example environment
% At 11 points, one column, these are about 56 characters wide.
% That's 32 characters to the left of the => and about 20 to the right.
\newenvironment{schemenoindent}{
% Commands for scheme examples
\newcommand{\ev}{\>\>\evalsto}
\newcommand{\lev}{\\\>\evalsto}
\newcommand{\unspecified}{{\em{}unspecified}}
\newcommand{\scherror}{{\em{}error}}
\setupcode
\small \cf \obeytabs \obeyspaces \myobeycr
\begin{tabbing}%
\qquad\=\hspace*{5em}\=\hspace*{9em}\=\kill% was 16em
\gobblecr}{\unskip\end{tabbing}}
%\newenvironment{scheme}{\begin{schemenoindent}\+\kill}{\end{schemenoindent}}
\newenvironment{scheme}{
% Commands for scheme examples
\newcommand{\ev}{\>\>\evalsto}
\newcommand{\lev}{\\\>\evalsto}
\newcommand{\unspecified}{{\em{}unspecified}}
\newcommand{\scherror}{{\em{}error}}
\setupcode
\small \cf \obeyspaces \myobeycr
\begin{tabbing}%
\qquad\=\hspace*{5em}\=\hspace*{9em}\=\+\kill% was 16em
\gobblecr}{\unskip\end{tabbing}}
\newcommand{\evalsto}{$\Longrightarrow$}
% Rationale
\newenvironment{rationale}{%
\bgroup\small\noindent{\em Rationale:}\space}{%
\egroup}
% Notes
\newenvironment{note}{%
\bgroup\small\noindent{\em Note:}\space}{%
\egroup}
% Manual entries
\newenvironment{entry}[1]{
\vspace{3.1ex plus .5ex minus .3ex}\noindent#1%
\unpenalty\nopagebreak}{\vspace{0ex plus 1ex minus 1ex}}
\newcommand{\exprtype}{syntax}
% Primitive prototype
\newcommand{\pproto}[2]{\unskip%
\hbox{\cf\spaceskip=0.5em#1}\hfill\penalty 0%
\hbox{ }\nobreak\hfill\hbox{\rm #2}\break}
% Parenthesized prototype
\newcommand{\proto}[3]{\pproto{(\mainschindex{#1}\hbox{#1}{\it#2\/})}{#3}}
% Variable prototype
\newcommand{\vproto}[2]{\mainschindex{#1}\pproto{#1}{#2}}
% Random prototype
\newcommand{\rproto}[3]{\proto{#1}{#2}{#3}}
% Grammar environment
\newenvironment{grammar}{
\def\:{\goesto{}}
\def\|{$\vert$}
\cf \myobeycr
\begin{tabbing}
%\qquad\quad \=
\qquad \= $\vert$ \= \kill
}{\unskip\end{tabbing}}
%\newcommand{\unsection}{\unskip}
\newcommand{\unsection}{{\vskip -2ex}}
% Commands for grammars
\newcommand{\arbno}[1]{#1\hbox{\rm*}}
\newcommand{\atleastone}[1]{#1\hbox{$^+$}}
\newcommand{\goesto}{$\longrightarrow$}
\makeatother
+80
View File
@@ -0,0 +1,80 @@
% -*- LaTeX -*-
% e g c o m m a n d . s t y
%
% Various commands which I often used in my documents
% Code is most of the time stolen from ``The LaTeX Companion''
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: 4-Jun-1995 18:13
% Last file update: 15-Jul-1995 13:23
%
% Some useful packages
%
\usepackage{calc}
\usepackage{ifthen}
\usepackage{alltt}
\usepackage{moreverb}
\usepackage[dvips]{epsfig}
%
% Entry
%
\newcommand{\Entryfont}{\textbf}
\newcommand{\Entrylabel}[1]{\mbox{\Entryfont{#1:}}\hfil}
\newenvironment{Entry}%
{\begin{list}{}%
{\renewcommand{\makelabel}{\Entrylabel}%
\setlength{\labelwidth}{35pt}%
\setlength{\leftmargin}{\labelwidth+\labelsep}%
}%
}%
{\end{list}}
%
% Ventry
%
\newenvironment{Ventry}[1]%
{\begin{list}{}%
{\renewcommand{\makelabel}{\makelabel}[1]{\Entryfont{##1:}\hfil}%
\settowidth{\labelwidth}{\Entryfont{#1:}}%
\setlength{\leftmargin}{\labelwidth+\labelsep}%
}%
}%
{\end{list}}
%
% Lentry
%
\newlength{\lentrylen}
\newcommand{\Lentrylabel}[1]{%
\settowidth{\lentrylen}{\Entryfont{#1:}}%
\ifthenelse{\lengthtest{\lentrylen > \labelwidth}}%
{\parbox[b]{\labelwidth}% term > labelwidth
{\makebox[0pt][l]{\Entryfont{#1:}}\\}}%
{\Entryfont{#1:}}% term < labelwidth
\hfil\relax}
\newenvironment{Lentry}%
{\renewcommand{\Entrylabel}{\Lentrylabel}\begin{Entry}}%
{\end{Entry}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% STk stuff
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\stk}{{\sc STk}}
\newcommand{\stklos}{{\sc STklos}}
\newcommand{\Indextt}[1]{{\tt{#1}}\index{#1}}
\newcommand{\Index}[1]{{#1}\index{#1}}
\newcommand{\rrrr}{{\em R$^{4}\!RS$}}
\newcommand{\codesize}{\small}
\newenvironment{Code}{\begin{quote}\begin{minipage}{12cm}\codesize}{\end{minipage}\end{quote}}
+127
View File
@@ -0,0 +1,127 @@
%!PS-Adobe-2.0 EPSF
%%Title: /tmp/xfig-fig016295
%%Creator: fig2dev
%%CreationDate: Fri Jun 10 23:18:16 1994
%%For: eg@kaolin (Erick Gallesio)
%%BoundingBox: 0 0 361 217
%%Pages: 0
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/l {lineto} bind def
/m {moveto} bind def
/s {stroke} bind def
/n {newpath} bind def
/gs {gsave} bind def
/gr {grestore} bind def
/clp {closepath} bind def
/graycol {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
4 -2 roll mul setrgbcolor} bind def
/col-1 {} def
/col0 {0 0 0 setrgbcolor} bind def
/col1 {0 0 1 setrgbcolor} bind def
/col2 {0 1 0 setrgbcolor} bind def
/col3 {0 1 1 setrgbcolor} bind def
/col4 {1 0 0 setrgbcolor} bind def
/col5 {1 0 1 setrgbcolor} bind def
/col6 {1 1 0 setrgbcolor} bind def
/col7 {1 1 1 setrgbcolor} bind def
end
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def
%%EndProlog
$F2psBegin
0 setlinecap 0 setlinejoin
-216.0 288.0 translate 0.900 -0.900 scale
0.500 setlinewidth
n 309 159 m 309 159 l gs col-1 s gr
n 246.401 216.889 m 244.000 209.000 l 249.831 214.831 l gs 2 setlinejoin col-1 s gr
% Polyline
n 244 209 m 274 259 l gs col-1 s gr
n 298.169 214.831 m 304.000 209.000 l 301.599 216.889 l gs 2 setlinejoin col-1 s gr
% Polyline
n 304 209 m 274 259 l gs col-1 s gr
n 255.721 213.778 m 249.000 209.000 l 257.179 210.053 l gs 2 setlinejoin col-1 s gr
% Polyline
n 249 209 m 364 254 l gs col-1 s gr
n 370.312 216.376 m 374.000 209.000 l 374.217 217.243 l gs 2 setlinejoin col-1 s gr
% Polyline
n 374 209 m 364 254 l gs col-1 s gr
n 283.772 280.725 m 279.000 274.000 l 286.376 277.688 l gs 2 setlinejoin col-1 s gr
% Polyline
n 279 274 m 314 304 l gs col-1 s gr
n 351.457 272.333 m 359.000 269.000 l 353.913 275.490 l gs 2 setlinejoin col-1 s gr
% Polyline
n 359 269 m 314 304 l gs col-1 s gr
n 300.950 165.789 m 309.000 164.000 l 302.739 169.367 l gs 2 setlinejoin col-1 s gr
% Polyline
n 309 164 m 249 194 l gs col-1 s gr
n 307.000 172.000 m 309.000 164.000 l 311.000 172.000 l gs 2 setlinejoin col-1 s gr
% Polyline
n 309 164 m 309 199 l gs col-1 s gr
n 315.261 169.367 m 309.000 164.000 l 317.050 165.789 l gs 2 setlinejoin col-1 s gr
% Polyline
n 309 164 m 379 199 l gs col-1 s gr
n 406.949 101.701 m 404.000 94.000 l 410.226 99.407 l gs 2 setlinejoin col-1 s gr
% Polyline
n 404 94 m 439 144 l gs col-1 s gr
n 410.363 99.245 m 404.000 94.000 l 412.083 95.634 l gs 2 setlinejoin col-1 s gr
% Polyline
n 404 94 m 509 144 l gs col-1 s gr
n 411.173 98.068 m 404.000 94.000 l 412.243 94.214 l gs 2 setlinejoin col-1 s gr
% Polyline
n 404 94 m 584 144 l gs col-1 s gr
n 396.075 96.277 m 404.000 94.000 l 398.079 99.739 l gs 2 setlinejoin col-1 s gr
% Polyline
n 404 94 m 309 149 l gs col-1 s gr
% Polyline
n 584 229 m 584 204 l gs col-1 s gr
n 582.000 212.000 m 584.000 204.000 l 586.000 212.000 l gs 2 setlinejoin col-1 s gr
% Polyline
n 584 189 m 584 159 l gs col-1 s gr
n 582.000 167.000 m 584.000 159.000 l 586.000 167.000 l gs 2 setlinejoin col-1 s gr
/Times-Bold findfont 12.00 scalefont setfont
239 209 m
gs 1 -1 scale (A) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
274 274 m
gs 1 -1 scale (D) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
359 269 m
gs 1 -1 scale (E) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
304 209 m
gs 1 -1 scale (B) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
374 209 m
gs 1 -1 scale (C) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
314 319 m
gs 1 -1 scale (F) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
289 159 m
gs 1 -1 scale (<object>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
389 89 m
gs 1 -1 scale (<top>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
424 154 m
gs 1 -1 scale (<pair>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
474 154 m
gs 1 -1 scale (<procedure>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
559 154 m
gs 1 -1 scale (<number>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
629 154 m
gs 1 -1 scale (...) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
569 199 m
gs 1 -1 scale (<real>) col-1 show gr
/Times-Bold findfont 12.00 scalefont setfont
559 239 m
gs 1 -1 scale (<integer>) col-1 show gr
$F2psEnd
+63
View File
@@ -0,0 +1,63 @@
#FIG 2.1
80 2
2 1 0 1 -1 0 0 0 0.000 -1 0 0
309 159 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
244 209 274 259 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
304 209 274 259 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
249 209 364 254 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
374 209 364 254 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
279 274 314 304 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
359 269 314 304 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
309 164 249 194 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
309 164 309 199 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
309 164 379 199 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
404 94 439 144 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
404 94 509 144 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
404 94 584 144 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 0 1
0 0 1.000 4.000 8.000
404 94 309 149 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 1 0
0 0 1.000 4.000 8.000
584 229 584 204 9999 9999
2 1 0 1 -1 0 0 0 0.000 -1 1 0
0 0 1.000 4.000 8.000
584 189 584 159 9999 9999
4 0 2 12 0 -1 0 0.00000 4 9 9 239 209 A
4 0 2 12 0 -1 0 0.00000 4 9 9 274 274 D
4 0 2 12 0 -1 0 0.00000 4 9 8 359 269 E
4 0 2 12 0 -1 0 0.00000 4 9 9 304 209 B
4 0 2 12 0 -1 0 0.00000 4 9 8 374 209 C
4 0 2 12 0 -1 0 0.00000 4 9 8 314 319 F
4 0 2 12 0 -1 0 0.00000 4 12 48 289 159 <object>
4 0 2 12 0 -1 0 0.00000 4 11 32 389 89 <top>
4 0 2 12 0 -1 0 0.00000 4 12 36 424 154 <pair>
4 0 2 12 0 -1 0 0.00000 4 12 70 474 154 <procedure>
4 0 2 12 0 -1 0 0.00000 4 9 54 559 154 <number>
4 0 2 12 0 -1 0 0.00000 4 2 12 629 154 ...
4 0 2 12 0 -1 0 0.00000 4 9 37 569 199 <real>
4 0 2 12 0 -1 0 0.00000 4 12 53 559 239 <integer>
+129
View File
@@ -0,0 +1,129 @@
(define main 0)
(define aux 1)
(define pretty-print (lambda (expr) (format #t "Pretty: ~S\n" expr) expr))
(define every?
(lambda (test . lists)
(let scan ((tails lists))
(if (member #t (map null? tails)) ;(any null? lists)
#t
(and (apply test (map car tails))
(scan (map cdr tails)))))))
(define (make-entry key font main/aux page)
(list key font main/aux page))
(define (entry-key x) (car x))
(define (entry-font x) (cadr x))
(define (entry-main/aux x) (caddr x))
(define (entry-page x) (cadddr x))
(define *database* '())
(define (index-entry key font main/aux page)
(set! *database*
(cons (make-entry (string-lower key)
font
main/aux
page)
*database*))
#t)
(define (create-index p)
(define (loop)
(if (null? *database*)
'done
(begin (process-key (collect-entries) p)
(loop))))
(set! *database*
(sort *database*
(lambda (x y)
(string<? (entry-key x)
(entry-key y)))))
(loop))
(define (collect-entries)
(define (loop key entries)
(cond ((null? *database*) entries)
((string=? key (entry-key (car *database*)))
(let ((x (car *database*)))
(set! *database* (cdr *database*))
(loop key (cons x entries))))
(else entries)))
(loop (caar *database*) '()))
(define (process-key entries p)
(let ((entries (sort entries entry<?)))
(if (not (consistent? entries))
(begin (display "Inconsistent entries:")
(newline)
(pretty-print entries)
(newline)
(newline)))
(let ((key (entry-key (car entries)))
(font (entry-font (car entries)))
(main? (entry-main/aux (car entries)))
(pages (remove-duplicates (map entry-page entries))))
(if main?
(write-entries key font (car pages) (cdr pages) p)
(write-entries key font #f pages p)))))
(define (entry<? x y)
(let ((x1 (entry-main/aux x))
(y1 (entry-main/aux y)))
(or (< x1 y1)
(and (eq? x1 y1)
(< (entry-page x) (entry-page y))))))
(define (consistent? entries)
(let ((x (car entries)))
(let ((key (entry-key x))
(font (entry-font x)))
(every? (lambda (x)
(and (string=? key (entry-key x))
(string=? font (entry-font x))
;(eq? aux (entry-main/aux x))
))
(cdr entries)))))
(define (remove-duplicates x)
(define (loop x y)
(cond ((null? x) (reverse y))
((memq (car x) y) (loop (cdr x) y))
(else (loop (cdr x) (cons (car x) y)))))
(loop (cdr x) (list (car x))))
(define *last-key* "%")
(define *s1* (string-append "\\item{" (list->string '(#\\))))
(define *s2* "{")
(define *s3* "}}\\dotfill\\ ")
(define *semi* "\; ")
(define *comma* ", ")
(define (write-entries key font main pages p)
(if (and (char-alphabetic? (string-ref key 0))
(not (char=? (string-ref *last-key* 0)
(string-ref key 0))))
(begin (display "\\indexspace" p)
(newline p)
(display "{\\vskip3mm\\LARGE " p)
(display (string-upper (substring key 0 1)) p)
(display "\\nopagebreak}\\" p)
(newline p)))
(set! *last-key* key)
(display (string-append *s1* font *s2* key *s3*) p)
(if main
(begin (write main p)
(if (not (null? pages))
(display *semi* p))))
(if (not (null? pages))
(begin (write (car pages) p)
(for-each (lambda (page)
(display *comma* p)
(write page p))
(cdr pages))))
(newline p))
(load "manual.idx")
(define p (open-output-file "index.tex"))
(create-index p)
File diff suppressed because it is too large Load Diff
+149
View File
@@ -0,0 +1,149 @@
%
% STk Reference manual (Main file)
%
% Copyright (C) 1993,1994,1995 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
%
% Permission to use, copy, and/or distribute this software and its
% documentation for any purpose and without fee is hereby granted, provided
% that both the above copyright notice and this permission notice appear in
% all copies and derived works. Fees for distribution or use of this
% software or derived works may only be charged with express written
% permission of the copyright holder.
% This software is provided ``as is'' without express or implied warranty.
%
% Author: Erick Gallesio [eg@unice.fr]
% Creation date: ??-Nov-1993 ??:??
% Last file update: 24-Jul-1996 13:53
%
\documentclass[10pt,a4paper]{book}
\usepackage{a4wide}
\usepackage{fancyheadings}
\pagestyle{fancy}
\setlength{\headheight}{15pt}
\makeindex % Build Index
\begin{document}
\input{commands} % Stolen macros from R4RS
\input{psfig} % Postscript stuff
\parindent 0pt % No indentation at paragraph
% beginning
\bibliographystyle{unsrt} % Unsorted bibliography
% \showboxdepth=0
%
% Some changes in standard commands
%
\renewcommand{\thechapter}{} % No chapter number
\renewcommand{\thesection}{\arabic{section}} % Subsection inherits from this
%
% Some new commands
%
\newcommand{\stkversion}{3.1}
\newcommand{\stk}{{\sc STk}}
\newcommand{\stklos}{{\sc STklos}}
\newcommand{\doc}{{\em Identical to R$^{4}$RS.}}
\newcommand{\rrrr}{{\em R$^{4}\!RS$}}
\newcommand{\saut}{\vskip2mm}
\newcommand{\tilda}{{\tt\char126}}
\newcommand{\etoile}{{\tt\char42}}
\newcommand{\leftbracket}{{\tt\char91}}
\newcommand{\rightbracket}{{\tt\char93}}
\newcommand{\hyperiii}[1]{\hyper{#1$_3$}}
\newcommand{\clearemptydoublepage}{\newpage{\thispagestyle{empty}\cleardoublepage}}
%
% Title page
%
\thispagestyle{empty}
\begin{center}
\ \\[3cm]
{\huge\bf ST{\large\bf{K}} Reference manual}\\[3mm]
{\Large Version \stkversion}\\[3cm]
{\large Erick Gallesio \\
Universit\'e de Nice~-~Sophia Antipolis \\
Laboratoire I3S - CNRS URA 1376 - ESSI. \\
Route des Colles\\
B.P. 145\\
06903 Sophia-Antipolis Cedex - FRANCE\\[3mm]
email: eg@unice.fr}
\end{center}
\vskip8cm
\begin{flushright}
July 1996
\end{flushright}
\newpage
\thispagestyle{empty}
{\ }
\vskip2cm
{\bf Document Reference}
\begin{quote}
Erick Gallesio, {\em STk Reference Manual}, RT 95-31b,
I3S-CNRS~/~Universit\'e de Nice - Sophia Antipolis, juillet 1995.
\end{quote}
%\renewcommand{\sectionmark}[1]{\markboth{\bf #1}{}}
%\renewcommand{\subsectionmark}[1]{\markright{\bf\thesubsection~~#1}}
%\lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\rightmark}}
%\chead{}
%\rhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\bf\thepage}}
\lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\bf{\stk} Reference Manual}}
\chead{}
\rhead[\fancyplain{}{\bf{\stk} Reference Manual}]{\fancyplain{}{\bf\thepage}}
\lfoot{}
\cfoot{\fancyplain{\bf\thepage}{}}
\rfoot{}
%
% Table of content
%
\tableofcontents
%
% Part 1: Reference manual
%
\part{Reference Manual}
\pagestyle{fancy}
\thispagestyle{plain}
\input{Reference1.tex}
\input{Reference2.tex}
%
% Annexes
%
\part{Annexes}
\appendix
\chapter{Using the Tk toolkit}
\input{Appendix-A}
\chapter{Differences with R4RS}
\input{Appendix-B}
\chapter{An introduction to {\stklos}}
\input{Appendix-C}
\chapter{Miscellaneous Informations}
\input{Appendix-D}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliography{bibliography}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{theindex}
\bigskip
\input{index}
\end{theindex}
\end{document}