From ce5580c209bb4b63511e59fab2ffd6d44b8f1aab Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:06:30 +0100 Subject: [PATCH 01/14] fix code indentations --- BasicClasses/BasicClasses.tex | 20 ++++++++++---------- Bibliography/LatexTemplates/st80demo.tex | 12 ++++++------ Morphic/Morphic.tex | 8 ++++---- Syntax/Syntax.tex | 6 +++--- commonDemo.tex | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/BasicClasses/BasicClasses.tex b/BasicClasses/BasicClasses.tex index 43846b93..35f0e10a 100644 --- a/BasicClasses/BasicClasses.tex +++ b/BasicClasses/BasicClasses.tex @@ -951,9 +951,9 @@ \section{Exceptions} Using \ct{pass}, you can design your exception handlers to only handle some exceptions based on their state and pass all others to the next handler: \begin{code}{NB: CANNOT TEST} - [self downloadData] - on: ConnectionRefused do: [:ex | - self cache at: ex host ifAbsent: [ex pass]]. +[self downloadData] + on: ConnectionRefused do: [:ex | + self cache at: ex host ifAbsent: [ex pass]]. \end{code} This example tries to download some data from a server, but if the connection is refused, it will try to fallback to an offline cache. @@ -968,11 +968,11 @@ \section{Exceptions} For instance, most dialogs in \sq signal a \clsind{ProvideAnswerNotification} before they show up to the user, which allows the code that eventually triggered the dialog to automatically answer the question: \begin{code}{NB: CANNOT TEST} - Morph new exportAsPNG. --> "a file dialog opens for entering a file name" +Morph new exportAsPNG. --> "a file dialog opens for entering a file name" - [Morph new exportAsPNG] - on: ProvideAnswerNotification - do: [:ex | ex resume: 'myMorph.png']. --> "no dialog opens, the file is saved as 'myMorph.png'" +[Morph new exportAsPNG] + on: ProvideAnswerNotification + do: [:ex | ex resume: 'myMorph.png']. --> "no dialog opens, the file is saved as 'myMorph.png'" \end{code} Note that specifically for handling \clsindplural{ProvideAnswerNotification}, there are the more convenient methods \cmind{BlockClosure}{valueSupplyingAnswers:} and \cmind{BlockClosure}{valueSuppressingMessages:}. @@ -986,9 +986,9 @@ \section{Exceptions} For instance, the following would be equivalent to the first example above: \begin{code}{@TEST} - [(-2 to:2) collect: [:i | 100 / i]] - on: ZeroDivide - do: [:ex | ex return: nil]. +[(-2 to:2) collect: [:i | 100 / i]] + on: ZeroDivide + do: [:ex | ex return: nil]. \end{code} \end{itemize} diff --git a/Bibliography/LatexTemplates/st80demo.tex b/Bibliography/LatexTemplates/st80demo.tex index fd0e11ee..f830c277 100644 --- a/Bibliography/LatexTemplates/st80demo.tex +++ b/Bibliography/LatexTemplates/st80demo.tex @@ -23,11 +23,11 @@ \section*{Code environments using the listings package} %============================================================= \subsection*{Listings environments and macros} -The code environments +The code environments \begin{verbatim} \begin{code} - ... +... \end{code} \end{verbatim} take plain, verbatim code, @@ -39,12 +39,12 @@ \subsection*{Listings environments and macros} true & false not & (nil isNil) ifFalse: [self halt]. y _ self size + super size. #($a #a 'a' 1 1.0) - do: [:each | Transcript - show: (each class name); + do: [:each | Transcript + show: (each class name); show: ' '; show: (each printString). { 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }. -^ x < y +^ x < y \end{code} QWERTY layout: @@ -70,7 +70,7 @@ \subsection*{Listings environments and macros} plain code and !\textbf{bolded text}! \end{code} -% ^ $ \\ % # ' +% ^ $ \\ % # ' In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code. diff --git a/Morphic/Morphic.tex b/Morphic/Morphic.tex index eb0ddd1b..a584c7a3 100644 --- a/Morphic/Morphic.tex +++ b/Morphic/Morphic.tex @@ -659,10 +659,10 @@ \subsection{Morphic animations} \dothis{Add the following code to \mthref{handleKeystroke}:} \begin{code}{} - keyValue = $+ asciiValue - ifTrue: [self startStepping]. - keyValue = $- asciiValue - ifTrue: [self stopStepping]. +keyValue = $+ asciiValue + ifTrue: [self startStepping]. +keyValue = $- asciiValue + ifTrue: [self stopStepping]. \end{code} % \on{You can also \menu{debug~\go{} inspect morph} and evaluate: \ct{self currentWorld startStepping: self}.} diff --git a/Syntax/Syntax.tex b/Syntax/Syntax.tex index 7f380861..f21b7077 100755 --- a/Syntax/Syntax.tex +++ b/Syntax/Syntax.tex @@ -157,9 +157,9 @@ \section{Syntactic elements} Nevertheless, you can also write any non-printing character verbatim after the dollar sign, but this is often hard to read: \begin{code}{@TEST} - $ = Character space --> true - $ - = Character cr --> true +$ = Character space --> true +$ + = Character cr --> true \end{code} \item[Strings.] diff --git a/commonDemo.tex b/commonDemo.tex index 141c5b35..8dbe46c6 100644 --- a/commonDemo.tex +++ b/commonDemo.tex @@ -83,7 +83,7 @@ \section*{Code environments using the listings package} \begin{verbatim} \begin{code}{} - ... +... \end{code} \end{verbatim} take plain, verbatim code, From 261d16f30c7c5ff82ea2cfe5e0470fc93f6544e3 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:07:38 +0100 Subject: [PATCH 02/14] remove first section header to assure text before first header (chapters collections and sunit) --- Collections/Collections.tex | 1 - SUnit/SUnit.tex | 2 -- 2 files changed, 3 deletions(-) diff --git a/Collections/Collections.tex b/Collections/Collections.tex index 02e71a80..4b69193c 100644 --- a/Collections/Collections.tex +++ b/Collections/Collections.tex @@ -34,7 +34,6 @@ \chapter{Collections} %\sd{Did a first pass: I should have a look at Xavier Briffault's book and at the material mentionned by andrew + lalonde book?} %\pre{Removed the abstract, high-level, number-heavy introduction on the collection hierarchy} %============================================================= -\section{Introduction} To make good use of the collection classes, \st programmers need at least an overview of the wide variety of collections and their commonalities and differences. % diff --git a/SUnit/SUnit.tex b/SUnit/SUnit.tex index c05f7eb1..32b94247 100644 --- a/SUnit/SUnit.tex +++ b/SUnit/SUnit.tex @@ -30,8 +30,6 @@ \chapter{SUnit} \label{cha:SUnit} %================================================================= -\section{Introduction} - \on{Would be nice to have an example of test-driven development with SUnit from beginning to end. Perhaps this is for another chapter?} \indmain{SUnit} is a minimal yet powerful framework that supports the creation and deployment of tests. From aab54f05ced31c06414df4c37751337575951e06 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:08:15 +0100 Subject: [PATCH 03/14] add missing dot and missing comma --- Environment/Environment.tex | 2 +- Syntax/Syntax.tex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Environment/Environment.tex b/Environment/Environment.tex index f16f117e..05da8734 100644 --- a/Environment/Environment.tex +++ b/Environment/Environment.tex @@ -1273,7 +1273,7 @@ \section{The process browser} \figref{processBrowser} shows a screenshot. The top-left pane lists all of the processes in \sq, in priority order, from the timer interrupt watcher at priority 80 to the idle process at priority 10. Of course, on a uniprocessor, when you look which program is running, the only process that can be running is the UI process, as it is currently displaying the information to you; all of the other will be waiting for some kind of event. -By default, the display of processes is static; it can be updated using the \ind{yellow button} menu, which also provides an option to \menu{turn on auto-update (a)} +By default, the display of processes is static; it can be updated using the \ind{yellow button} menu, which also provides an option to \menu{turn on auto-update (a)}. If you select a process in the top-left pane, its stack trace is displayed in the top-right pane, just as with the debugger. If you select a stack frame, the corresponding method is displayed in the bottom pane. diff --git a/Syntax/Syntax.tex b/Syntax/Syntax.tex index f21b7077..dd2ef1ec 100755 --- a/Syntax/Syntax.tex +++ b/Syntax/Syntax.tex @@ -587,7 +587,7 @@ \section{Primitives and pragmas} For example, the following are all implemented as primitives: memory allocation (\mthind{Behavior}{new}, \mthind{Behavior}{new:}), bit manipulation (\mthind{Integer}{bitAnd:}, \mthind{Integer}{bitOr:}, \mthind{Integer}{bitShift:}), -pointer and integer arithmetic (\ct{+}, \ct{-}, \ct{<}, \ct{>}, \ct{*}, \ct{/ }, \ct{=}, \ct{==}...), +pointer and integer arithmetic (\ct{+}, \ct{-}, \ct{<}, \ct{>}, \ct{*}, \ct{/ }, \ct{=}, \ct{==}, ...), and array access (\mthind{Object}{at:}, \mthind{Object}{at:put:}). \seeindex{new@{\ct{new}}}{\ct{Behavior>>>new}} From 0e0edeb31f9833d65811e74e5086d210bf699717 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:09:28 +0100 Subject: [PATCH 04/14] fix figure label Those are intended as technical keys and not for human reading. Don't challenge PDF viewers out there with handling quotes and spaces in such keys. Note that there are many further occurences of this pattern in several code environments. I didn't bother for them now. --- Environment/Environment.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Environment/Environment.tex b/Environment/Environment.tex index 05da8734..3dbd468d 100644 --- a/Environment/Environment.tex +++ b/Environment/Environment.tex @@ -1407,7 +1407,7 @@ \section{Other interesting tools} \begin{minipage}[t]{0.48\textwidth} \ifluluelse {\includegraphics[width=\textwidth]{SpaceTally}} - {\includegraphics[scale=0.7]{exploreWithLabel: 'SpaceTally'}} + {\includegraphics[scale=0.7]{SpaceTally}} \label{fig:SpaceTally} \end{minipage} \caption{A time profiler (left) and a space tally (right).} From 07ed523112baaee1623ed0adc6b924c71e4aa67f Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:11:20 +0100 Subject: [PATCH 05/14] fix urls: assure scheme Some readers (e.g., PDF.js) depend on this but otherwise treat the URL as relative. --- FAQ/FAQ.tex | 4 +- FirstApp/FirstApp.tex | 8 +- Preface/Preface.tex | 18 +- QuickTour/QuickTour.tex | 4 +- SUnit/SUnit.tex | 2 +- SourceControl/SourceControl.tex | 2 +- common.tex | 2 +- commonDemo.tex | 446 ++++++++++++++++---------------- 8 files changed, 243 insertions(+), 243 deletions(-) diff --git a/FAQ/FAQ.tex b/FAQ/FAQ.tex index 419dea83..b58bd266 100644 --- a/FAQ/FAQ.tex +++ b/FAQ/FAQ.tex @@ -302,7 +302,7 @@ \section{Using Monticello and SqueakSource} \end{faq} \answer \begin{enumerate} - \item Find the project you want in \url{squeaksource.com} + \item Find the project you want in \url{https://squeaksource.com} \item Copy the registration code snippet \item Select \menu{World docking bar~\go{} Tools~\go{} Monticello browser} \item Select \menu{+Repository~\go{} HTTP} @@ -316,7 +316,7 @@ \section{Using Monticello and SqueakSource} \end{faq} \answer \begin{enumerate} - \item Go to \url{squeaksource.com} + \item Go to \url{https://squeaksource.com} \item Register yourself as a new member \item Register a project (name = category) \item Copy the Registration code snippet diff --git a/FirstApp/FirstApp.tex b/FirstApp/FirstApp.tex index d1f92ac2..55cbfc06 100644 --- a/FirstApp/FirstApp.tex +++ b/FirstApp/FirstApp.tex @@ -786,7 +786,7 @@ \section{Saving and sharing Smalltalk code} \subsection{Monticello packages} Although fileouts are a convenient way of making a snapshot of the code you have written, they do not work well for long-running projects. -Just as most open-source projects find it much more convenient to maintain their code in a repository using \ind{Git}\footnote{\url{www.git-scm.com}} or \ind{Mercurial}\footnote{\url{www.mercurial-scm.org}}, so \squeak programmers find it more convenient to manage their code using \ind{Monticello} packages. +Just as most open-source projects find it much more convenient to maintain their code in a repository using \ind{Git}\footnote{\url{https://www.git-scm.com}} or \ind{Mercurial}\footnote{\url{https://www.mercurial-scm.org}}, so \squeak programmers find it more convenient to manage their code using \ind{Monticello} packages. These packages are represented as files with names ending in \ct{.mcz}; they are actually zip-compressed bundles that contain the complete code of your \ind{package}. Using the Monticello package browser, you can save packages to repositories on various types of servers, including FTP and HTTP servers; you can also just write the packages to a repository in a local file system directory. @@ -833,12 +833,12 @@ \subsection{Saving and loading code with Monticello} \subsection{\ind{SqueakSource}: a sharing platform for Monticello} We think that the best way to save your code and share it is to create an account for your project on a SqueakSource server. -SqueakSource is similar to GitHub\footnote{\url{www.github.com}}: +SqueakSource is similar to GitHub\footnote{\url{https://www.github.com}}: It is a web front-end to an HTTP Monticello server that lets you manage your projects. -There is a public SqueakSource server at \url{http://www.squeaksource.com}, and a copy of the code related to our game is stored there at \sbeSqueaksourceUrl. +There is a public SqueakSource server at \url{https://www.squeaksource.com}, and a copy of the code related to our game is stored there at \sbeSqueaksourceUrl. You can look at this project with a web browser, but it's a lot more productive to do so from inside \squeak, using the Monticello browser, which lets you manage your packages. -\dothis{Open a web browser to \url{www.squeaksource.com}. +\dothis{Open a web browser to \url{https://www.squeaksource.com}. Create an account for yourself and then create (\ie ``register'') a project for the Quinto game.} SqueakSource will show you the information that you should use when adding a repository using the Monticello browser. diff --git a/Preface/Preface.tex b/Preface/Preface.tex index a2a332ff..c7f20a43 100644 --- a/Preface/Preface.tex +++ b/Preface/Preface.tex @@ -77,7 +77,7 @@ \section*{An open book} \item The content of this book is released under the Creative Commons Attribution-ShareAlike (by-sa) license. In short, you are allowed to freely share and adapt this book, as long as you respect the conditions of the license available at the following URL: - \url{creativecommons.org/licenses/by-sa/3.0/}. + \url{https://creativecommons.org/licenses/by-sa/3.0/}. \item This book just describes the core of \sq. Ideally, we would like to encourage others to contribute chapters on the parts of \sq that we have not described. @@ -92,11 +92,11 @@ \section*{The \sq community} Here is a short list of resources that you may find useful: \begin{itemize} -\item \url{www.squeak.org} is the main web site of \sq. +\item \url{https://www.squeak.org} is the main web site of \sq. -\item \url{www.squeaksource.com} is the equivalent of GitHub for \sq projects. +\item \url{https://www.squeaksource.com} is the equivalent of GitHub for \sq projects. -\item \url{wiki.squeak.org/squeak} is a wiki with all kinds of information about \sq. +\item \url{https://wiki.squeak.org/squeak} is a wiki with all kinds of information about \sq. \item The \emphind{help browser} inside \sq gives you access to a lot of useful information. For example, it contains an overview of \ind{keyboard shortcuts} and documents several packages and tools. @@ -118,19 +118,19 @@ \section*{The \sq community} \paragraph{Group chats.} Have a question that you need to be answered quickly? Would you like to meet with other squeakers around the world? -The Slack instance at \url{squeak.slack.com} is a great place to participate in longer-term discussions. +The Slack instance at \url{https://squeak.slack.com} is a great place to participate in longer-term discussions. Stop by and say ``Hi!'' \paragraph{Other sites.} Several other websites support the \sq community today in various ways. Here are some of them: \begin{itemize} - \item \url{github.com/squeak-smalltalk} is the GitHub organization hosting new releases and the various \sq websites. + \item \url{https://github.com/squeak-smalltalk} is the GitHub organization hosting new releases and the various \sq websites. - \item \url{github.com/OpenSmalltalk/opensmalltalk-vm} is the repository of the virtual machine running \sq, the Open\-Smalltalk-VM. + \item \url{https://github.com/OpenSmalltalk/opensmalltalk-vm} is the repository of the virtual machine running \sq, the Open\-Smalltalk-VM. - \item \url{bugs.squeak.org} is the bug tracker where you can report any issues you encounter with the system. You can access debug information through \menu{World docking bar~\go{} Help~\go{} Send Feedback}. + \item \url{https://bugs.squeak.org} is the bug tracker where you can report any issues you encounter with the system. You can access debug information through \menu{World docking bar~\go{} Help~\go{} Send Feedback}. - \item \url{source.squeak.org} hosts the repositories for the base system. If you would like to contribute and want to learn about the community development process, you can learn about it directly in \Squeak under \menu{World docking bar~\go{} Help~\go{} Contributing to Squeak}. You can also learn about the community development process at \url{https://squeak.org/development_process/}. + \item \url{https://source.squeak.org} hosts the repositories for the base system. If you would like to contribute and want to learn about the community development process, you can learn about it directly in \Squeak under \menu{World docking bar~\go{} Help~\go{} Contributing to Squeak}. You can also learn about the community development process at \url{https://squeak.org/development_process/}. \end{itemize} diff --git a/QuickTour/QuickTour.tex b/QuickTour/QuickTour.tex index 71688f4d..3b688c83 100644 --- a/QuickTour/QuickTour.tex +++ b/QuickTour/QuickTour.tex @@ -43,7 +43,7 @@ \chapter{A quick tour of \sq} %================================================================= \section{Getting started} -\sq is available as a free \ind{download} from \url{www.squeak.org}. +\sq is available as a free \ind{download} from \url{https://www.squeak.org}. Your download will be an archive file that contents vary from platform to platform. However, there are two important components common to all versions (see \figref{download}). @@ -997,7 +997,7 @@ \section{Defining a new method} \end{method} The comma is the string concatenation operation, so the body of this method appends an exclamation mark to an upper-case version of whatever \ct{String} object the \ct{shout} message was sent to. -The \ct{^} tells \sq that the expression that follows is the answer to be returned from the method, in this case, the new concatenated string. +The \ct{^} tells \sq that the expression that follows is the answer to be returned from the method, in this case, the new concatenated string. \cmindex{String}{,} Does this method work? Let's run the tests and see. diff --git a/SUnit/SUnit.tex b/SUnit/SUnit.tex index 32b94247..1ea72684 100644 --- a/SUnit/SUnit.tex +++ b/SUnit/SUnit.tex @@ -319,7 +319,7 @@ \subsection{Step 5: interpret the results} %================================================================= \section{The \SUnit cook book} This section will give you more details on how to use \SUnit. -If you have used another testing framework such as \JUnit\footnote{\url{junit.org}}, much of this will be familiar, since all these frameworks have their roots in \SUnit. +If you have used another testing framework such as \JUnit\footnote{\url{https://junit.org}}, much of this will be familiar, since all these frameworks have their roots in \SUnit. Normally you will use \SUnit's GUI to run tests, but there are situations where you may not want to use it. %--------------------------------------------------------- \subsection{Other assertions} diff --git a/SourceControl/SourceControl.tex b/SourceControl/SourceControl.tex index 955da9a2..c8ad2a2b 100644 --- a/SourceControl/SourceControl.tex +++ b/SourceControl/SourceControl.tex @@ -403,7 +403,7 @@ \subsection{Basic Monticello} Once the package knows about a repository, you can save a new version by selecting the repository and the package in the Monticello Browser, and clicking \button{Save}. Of course, you must have permission to write to a repository. The \ct{SqueakByExample} repository on \emphind{SqueakSource} is world-readable but not world-writable, so if you try and save there, you will see an error message. -However, you can create your own repository on \emph{SqueakSource} by using the web interface at \url{http://www.squeaksource.com}, and use this to save your work. +However, you can create your own repository on \emph{SqueakSource} by using the web interface at \url{https://www.squeaksource.com}, and use this to save your work. This is especially useful as a mechanism to share your code with friends, or if you use multiple computers. \begin{ExecuteSmalltalkScript} diff --git a/common.tex b/common.tex index 225cec89..667330bb 100644 --- a/common.tex +++ b/common.tex @@ -119,7 +119,7 @@ \newcommand{\squeak}{Squeak\xspace} \newcommand{\sbeRepoUrl}{\url{https://github.com/hpi-swa-lab/SqueakByExample-english}\xspace} \newcommand{\sbeSqueaksourceUrl}{\url{http://www.squeaksource.com/SqueakByExample60}\xspace} % FOR LATER: use \SqVersionSwitch here -\newcommand{\hpiswa}{\url{hpi.de/swa}\xspace} +\newcommand{\hpiswa}{\url{https://hpi.de/swa}\xspace} %============================================================= %:Markup macros for proof-reading \usepackage[normalem]{ulem} % for \sout diff --git a/commonDemo.tex b/commonDemo.tex index 8dbe46c6..c5906cdf 100644 --- a/commonDemo.tex +++ b/commonDemo.tex @@ -1,224 +1,224 @@ -% $Author$ -% $Date: 2007-06-06 15:10:38 +0200 (Wed, 06 Jun 2007) $ -% $Revision$ -%============================================================= -% Demo and test the common macros -%================================================================= -\documentclass[a4paper,10pt,twoside]{book} -%============================================================= -\input{common.tex} -\graphicspath{{figures/}} % for \dothis -%============================================================= -\begin{document} -\sloppy -\mainmatter -%============================================================= -\section*{Code environments using the listings package} -%============================================================= -\paragraph{Sample code environment} -Use the script, method, classdef and example environments. -Each takes a name and an optional label. -With labels we can have cross references to -\verb|\egref{history}| \egref{history}, -\verb|\scrref{helloworld}| \scrref{helloworld}, -\verb|\clsref{myclass}| \clsref{myclass}, -and \verb|\mthref{doit}| \mthref{doit}. - -\begin{verbatim} -\begin{example}[history]{The first thing that Smalltalk could do}{} -3 + 4 --> 7 -\end{example} -\end{verbatim} -\begin{example}[history]{The first thing that Smalltalk could do}{} -3 + 4 --> 7 -\end{example} - -\begin{verbatim} -\begin{script}[helloworld]{The first thing you should try} -Transcript show: 'hello world' -\end{script} -\end{verbatim} -\begin{script}[helloworld]{The first thing you should try} -Transcript show: 'hello world' -\end{script} - -\begin{verbatim} -\begin{classdef}[myclass]{MyClass is defined} -Object subclass: #MyClass - instancevariables: '...' - ... -\end{classdef} -\end{verbatim} -\begin{classdef}[myclass]{MyClass is defined} -Object subclass: #MyClass - instancevariables: '...' - ... -\end{classdef} - -\begin{verbatim} -\begin{method}[doit]{A doit method} -MyClass>>>doit -^ super doit -\end{method} -\end{verbatim} -\begin{method}[doit]{A doit method} -MyClass>>>doit - ^ super doit -\end{method} - -The plain code environment has no title, label or numbering: - -\begin{verbatim} -\begin{code}{} -just some plain code -\end{code} -\end{verbatim} -\begin{code}{} -just some plain code -\end{code} - -%============================================================= -\paragraph{Listings environments and macros} -The code environments - -\begin{verbatim} -\begin{code}{} +% $Author$ +% $Date: 2007-06-06 15:10:38 +0200 (Wed, 06 Jun 2007) $ +% $Revision$ +%============================================================= +% Demo and test the common macros +%================================================================= +\documentclass[a4paper,10pt,twoside]{book} +%============================================================= +\input{common.tex} +\graphicspath{{figures/}} % for \dothis +%============================================================= +\begin{document} +\sloppy +\mainmatter +%============================================================= +\section*{Code environments using the listings package} +%============================================================= +\paragraph{Sample code environment} +Use the script, method, classdef and example environments. +Each takes a name and an optional label. +With labels we can have cross references to +\verb|\egref{history}| \egref{history}, +\verb|\scrref{helloworld}| \scrref{helloworld}, +\verb|\clsref{myclass}| \clsref{myclass}, +and \verb|\mthref{doit}| \mthref{doit}. + +\begin{verbatim} +\begin{example}[history]{The first thing that Smalltalk could do}{} +3 + 4 --> 7 +\end{example} +\end{verbatim} +\begin{example}[history]{The first thing that Smalltalk could do}{} +3 + 4 --> 7 +\end{example} + +\begin{verbatim} +\begin{script}[helloworld]{The first thing you should try} +Transcript show: 'hello world' +\end{script} +\end{verbatim} +\begin{script}[helloworld]{The first thing you should try} +Transcript show: 'hello world' +\end{script} + +\begin{verbatim} +\begin{classdef}[myclass]{MyClass is defined} +Object subclass: #MyClass + instancevariables: '...' + ... +\end{classdef} +\end{verbatim} +\begin{classdef}[myclass]{MyClass is defined} +Object subclass: #MyClass + instancevariables: '...' + ... +\end{classdef} + +\begin{verbatim} +\begin{method}[doit]{A doit method} +MyClass>>>doit +^ super doit +\end{method} +\end{verbatim} +\begin{method}[doit]{A doit method} +MyClass>>>doit + ^ super doit +\end{method} + +The plain code environment has no title, label or numbering: + +\begin{verbatim} +\begin{code}{} +just some plain code +\end{code} +\end{verbatim} +\begin{code}{} +just some plain code +\end{code} + +%============================================================= +\paragraph{Listings environments and macros} +The code environments + +\begin{verbatim} +\begin{code}{} ... -\end{code} -\end{verbatim} -take plain, verbatim code, -and translate some special characters like $\wedge$ to \ct{^}. Even tabs are handled, (which is not true for verbatim). -\begin{code}{} -"All handled correctly: ^ $ ' % \\ << >> _ { }" -"NB: If you !{\bf really}! want an exclamation mark you must spell it BANG" -" -If you really want a caret to look like this: CARET instead of this: ^, you must spell it out." -| y | -true & false not & (nil isNil) ifFalse: [self halt]. -y _ self size + super size. -#($a #a 'a' 1 1.0) - do: [:each | Transcript - show: (each class name); - show: ' '; - show: (each printString). -{ 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }. -^ x < y -\end{code} - -QWERTY layout: -\begin{code}{} -BANG @ # $ % ^ & * ( ) UNDERSCORE + -1 2 3 4 5 6 7 8 9 0 - = - Q W E R T Y U I O P { } - q w e r t y u i o p [ ] - A S D F G H J K L : "" | (twice " to turn off italics") - a s d f g h j k l ; ' \ - Z X C V B N M < > ? - z x c v b n m , . / -\end{code} - -LaTeX escape: -\begin{verbatim} -\begin{code}{} -plain code and !\textbf{bolded text}! -\end{code} -\end{verbatim} - -\begin{code}{} -plain code and !\textbf{bolded text}! -\end{code} - -% ^ $ \\ % # ' - -In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code. - -\subsection{Special chars with $\backslash$ct} -\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =\\ -\verb|\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =| - -\subsection{Special conventions} - -\verb$\ct{Class>>>method}$ prints as \ct{Class>>>method}.\\ -\verb$\ct{3 + 4 - 5 --> 2}$ prints as \ct{3 + 4 - 5 --> 2}. - -Use \verb$@TEST$ to include the code in the automatic tests and use \verb$-->$ to represent the expected result -\begin{verbatim} -\begin{code}{@TEST} -true --> true -3@4 --> 3@4 -$a --> $a -#(1 2 3) --> #(1 2 3) -\end{code} -\end{verbatim} - -%============================================================= -%\paragraph{New code environment} - -%Experiment: - -%\begin{testenv}{testing} -%self doit -%\end{testenv} - -%============================================================= -\section*{Other macros} -%============================================================= -\paragraph{url} -\url{SqueakByExample.org} -%============================================================= -\paragraph{names} -\SUnit -\xUnit -\st -\Squeak -\sq -\squeak -%============================================================= -\paragraph{editorial} -\ugh{please rephrase this} -\ins{please insert this text} -\del{delete this} -and -\chg{change this}{to this} -\ab{...} -%============================================================= -\paragraph{abbreviation} -\ie -\eg -\etc -%============================================================= -\paragraph{Smalltalk macros} -sep: \sep -%============================================================= -\paragraph{scat and prot} -System category \scat{Kernel-Objects} and protocol \prot{accessing}. -%============================================================= -\paragraph{menu} -\menu{World menu~\go{} open ...} -%============================================================= -\paragraph{button} -\button{Create} -%============================================================= -\paragraph{do this} -\verb|\dothis| -\ct{-->} -\dothis{Download and install \Squeak.} -%============================================================= -\paragraph{Keyboard shortcut} -\verb|\short{d}| -\ct{-->} -\short{d} -%============================================================= -\section*{Footnote citations} -There is a great book on \sq by Ducasse\cite{Duca05j}. -%============================================================= -\section*{Important stuff} -\important{This is really important} -%============================================================= -% \bibliographystyle{plain} -\bibliographystyle{jurabib} -\nobibliography{scg} - -%============================================================= -\end{document} -%============================================================= +\end{code} +\end{verbatim} +take plain, verbatim code, +and translate some special characters like $\wedge$ to \ct{^}. Even tabs are handled, (which is not true for verbatim). +\begin{code}{} +"All handled correctly: ^ $ ' % \\ << >> _ { }" +"NB: If you !{\bf really}! want an exclamation mark you must spell it BANG" +" +If you really want a caret to look like this: CARET instead of this: ^, you must spell it out." +| y | +true & false not & (nil isNil) ifFalse: [self halt]. +y _ self size + super size. +#($a #a 'a' 1 1.0) + do: [:each | Transcript + show: (each class name); + show: ' '; + show: (each printString). +{ 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }. +^ x < y +\end{code} + +QWERTY layout: +\begin{code}{} +BANG @ # $ % ^ & * ( ) UNDERSCORE + +1 2 3 4 5 6 7 8 9 0 - = + Q W E R T Y U I O P { } + q w e r t y u i o p [ ] + A S D F G H J K L : "" | (twice " to turn off italics") + a s d f g h j k l ; ' \ + Z X C V B N M < > ? + z x c v b n m , . / +\end{code} + +LaTeX escape: +\begin{verbatim} +\begin{code}{} +plain code and !\textbf{bolded text}! +\end{code} +\end{verbatim} + +\begin{code}{} +plain code and !\textbf{bolded text}! +\end{code} + +% ^ $ \\ % # ' + +In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code. + +\subsection{Special chars with $\backslash$ct} +\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =\\ +\verb|\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =| + +\subsection{Special conventions} + +\verb$\ct{Class>>>method}$ prints as \ct{Class>>>method}.\\ +\verb$\ct{3 + 4 - 5 --> 2}$ prints as \ct{3 + 4 - 5 --> 2}. + +Use \verb$@TEST$ to include the code in the automatic tests and use \verb$-->$ to represent the expected result +\begin{verbatim} +\begin{code}{@TEST} +true --> true +3@4 --> 3@4 +$a --> $a +#(1 2 3) --> #(1 2 3) +\end{code} +\end{verbatim} + +%============================================================= +%\paragraph{New code environment} + +%Experiment: + +%\begin{testenv}{testing} +%self doit +%\end{testenv} + +%============================================================= +\section*{Other macros} +%============================================================= +\paragraph{url} +\url{https://SqueakByExample.org} % URL protocol is NOT optional for all PDF viewers! +%============================================================= +\paragraph{names} +\SUnit +\xUnit +\st +\Squeak +\sq +\squeak +%============================================================= +\paragraph{editorial} +\ugh{please rephrase this} +\ins{please insert this text} +\del{delete this} +and +\chg{change this}{to this} +\ab{...} +%============================================================= +\paragraph{abbreviation} +\ie +\eg +\etc +%============================================================= +\paragraph{Smalltalk macros} +sep: \sep +%============================================================= +\paragraph{scat and prot} +System category \scat{Kernel-Objects} and protocol \prot{accessing}. +%============================================================= +\paragraph{menu} +\menu{World menu~\go{} open ...} +%============================================================= +\paragraph{button} +\button{Create} +%============================================================= +\paragraph{do this} +\verb|\dothis| +\ct{-->} +\dothis{Download and install \Squeak.} +%============================================================= +\paragraph{Keyboard shortcut} +\verb|\short{d}| +\ct{-->} +\short{d} +%============================================================= +\section*{Footnote citations} +There is a great book on \sq by Ducasse\cite{Duca05j}. +%============================================================= +\section*{Important stuff} +\important{This is really important} +%============================================================= +% \bibliographystyle{plain} +\bibliographystyle{jurabib} +\nobibliography{scg} + +%============================================================= +\end{document} +%============================================================= From f5de113f088a2f0d0b00f22ac3121452b9ff90a5 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:11:45 +0100 Subject: [PATCH 06/14] fix capitalization of NameOfSubclass --- FirstApp/FirstApp.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FirstApp/FirstApp.tex b/FirstApp/FirstApp.tex index 55cbfc06..3c633156 100644 --- a/FirstApp/FirstApp.tex +++ b/FirstApp/FirstApp.tex @@ -133,14 +133,14 @@ \section{Defining the class SBECell} As yet there are of course no classes in the new category. However, the main editing pane displays a template to make it easy to create a new class (see \figref{classTemplate}). -This template shows us a \st expression that sends a message to a class called \ct{Object}, asking it to create a subclass called \ct{NameOfSubClass}. +This template shows us a \st expression that sends a message to a class called \ct{Object}, asking it to create a subclass called \ct{NameOfSubclass}. The new class has no variables and should belong to the category \scat{SBE-Quinto}. We now modify the template to create the class that we want. \dothis{Modify the class creation template as follows:} \begin{itemize} \item Replace \clsind{Object} by \clsind{SimpleSwitchMorph}. - \item Replace \ct{NameOfSubClass} by \clsind{SBECell}. + \item Replace \ct{NameOfSubclass} by \clsind{SBECell}. \item Add \ct{mouseAction} to the list of instance variables. \end{itemize} The result should look like \clsref{firstClassDef}. From b1a02d16d3d6fc4b5dc0f5104d26c4cc229a1e0c Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:12:04 +0100 Subject: [PATCH 07/14] convert an itemize to a more appropriate enumerate --- FirstApp/FirstApp.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FirstApp/FirstApp.tex b/FirstApp/FirstApp.tex index 3c633156..c07ebb83 100644 --- a/FirstApp/FirstApp.tex +++ b/FirstApp/FirstApp.tex @@ -138,11 +138,11 @@ \section{Defining the class SBECell} We now modify the template to create the class that we want. \dothis{Modify the class creation template as follows:} -\begin{itemize} +\begin{enumerate} \item Replace \clsind{Object} by \clsind{SimpleSwitchMorph}. \item Replace \ct{NameOfSubclass} by \clsind{SBECell}. \item Add \ct{mouseAction} to the list of instance variables. -\end{itemize} +\end{enumerate} The result should look like \clsref{firstClassDef}. \begin{classdef}[firstClassDef]{Defining the class \ct| SBECell|.} From a592d750fcbe259929cc2b0072cd7eaf2022c046 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:12:13 +0100 Subject: [PATCH 08/14] fix a typo --- Model/Model.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Model.tex b/Model/Model.tex index cddd2038..95853cb4 100755 --- a/Model/Model.tex +++ b/Model/Model.tex @@ -575,7 +575,7 @@ \section{Everything happens by sending messages} One of the consequences of \st's model of message sending is that it encourages a style in which objects tend to have very small methods and delegate tasks to other objects, rather than implementing huge, procedural methods that assume too much responsibility. Joseph Pelrine expresses this principle succinctly as follows: -\important{Don not do anything that you can push off onto someone else.} +\important{Do not do anything that you can push off onto someone else.} \index{Pelrine, Joseph} \ab{Citation?} \on{sorry, just personal communication and my own lecture notes!} From 351f99019d6ef1d6b9826b5851903e33d0a143ab Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:12:49 +0100 Subject: [PATCH 09/14] title page: make author dicolon syndetic --- titlepage.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/titlepage.tex b/titlepage.tex index 6c2b42e7..f81827d4 100644 --- a/titlepage.tex +++ b/titlepage.tex @@ -12,7 +12,7 @@ \vspace{0.5cm} - \large Christoph Thiede, Patrick Rein + \large Christoph Thiede and Patrick Rein \vspace{0.5cm} From 94b62b42cba85436aa6f916c5f3a05cdff402b2c Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:13:01 +0100 Subject: [PATCH 10/14] fix more urls --- SBE.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SBE.tex b/SBE.tex index 20d16064..e40dacd9 100755 --- a/SBE.tex +++ b/SBE.tex @@ -80,7 +80,7 @@ \end{description} \begin{itemize} \item For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page: - \url{creativecommons.org/licenses/by-sa/3.0/} + \url{https://creativecommons.org/licenses/by-sa/3.0/} \item Any of the above conditions can be waived if you get permission from the copyright holder. \item Nothing in this license impairs or restricts the author's moral rights. \end{itemize} @@ -88,7 +88,7 @@ \parbox{\textwidth-2cm-1em}{ Your fair dealing and other rights are in no way affected by the above. This is a human-readable summary of the Legal Code (the full license):\\ - \url{creativecommons.org/licenses/by-sa/3.0/legalcode}}\\[1cm] + \url{https://creativecommons.org/licenses/by-sa/3.0/legalcode}}\\[1cm] First Edition, September 2007.\\ Revised editions with corrections, March 2008, May 2008, September 2009.\\ Published by Square Bracket Associates, Switzerland.\\ From 0263a52c0ec5f139551ed0440eeae87aacb022c2 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:13:14 +0100 Subject: [PATCH 11/14] readme: document installation via Metacello --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 1eb967ed..6dc2cd4b 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,16 @@ The usual workflow to **add a scripted screenshot to the book** is as follows: 2. Open the Git Browser and clone this repository. Install missing dependencies as specified in the baseline if necessary. + Alternatively, you can load the project via Metacello, but you won't be able to commit changes back to the repository without cloning it first: + + ```smalltalk + Metacello new + baseline: 'SBE'; + repository: 'github://hpi-swa-lab/SqueakByExample-english:master/SmalltalkSources'; + get; + load. + ``` + 3. Make sure to set the resource directory to the path of your working copy: ```smalltalk From f1512e595bcec4f325952606f547fd9099c68e48 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sat, 25 Nov 2023 22:15:23 +0100 Subject: [PATCH 12/14] d'oh! --- commonDemo.tex | 448 ++++++++++++++++++++++++------------------------- 1 file changed, 224 insertions(+), 224 deletions(-) diff --git a/commonDemo.tex b/commonDemo.tex index c5906cdf..e11a6172 100644 --- a/commonDemo.tex +++ b/commonDemo.tex @@ -1,224 +1,224 @@ -% $Author$ -% $Date: 2007-06-06 15:10:38 +0200 (Wed, 06 Jun 2007) $ -% $Revision$ -%============================================================= -% Demo and test the common macros -%================================================================= -\documentclass[a4paper,10pt,twoside]{book} -%============================================================= -\input{common.tex} -\graphicspath{{figures/}} % for \dothis -%============================================================= -\begin{document} -\sloppy -\mainmatter -%============================================================= -\section*{Code environments using the listings package} -%============================================================= -\paragraph{Sample code environment} -Use the script, method, classdef and example environments. -Each takes a name and an optional label. -With labels we can have cross references to -\verb|\egref{history}| \egref{history}, -\verb|\scrref{helloworld}| \scrref{helloworld}, -\verb|\clsref{myclass}| \clsref{myclass}, -and \verb|\mthref{doit}| \mthref{doit}. - -\begin{verbatim} -\begin{example}[history]{The first thing that Smalltalk could do}{} -3 + 4 --> 7 -\end{example} -\end{verbatim} -\begin{example}[history]{The first thing that Smalltalk could do}{} -3 + 4 --> 7 -\end{example} - -\begin{verbatim} -\begin{script}[helloworld]{The first thing you should try} -Transcript show: 'hello world' -\end{script} -\end{verbatim} -\begin{script}[helloworld]{The first thing you should try} -Transcript show: 'hello world' -\end{script} - -\begin{verbatim} -\begin{classdef}[myclass]{MyClass is defined} -Object subclass: #MyClass - instancevariables: '...' - ... -\end{classdef} -\end{verbatim} -\begin{classdef}[myclass]{MyClass is defined} -Object subclass: #MyClass - instancevariables: '...' - ... -\end{classdef} - -\begin{verbatim} -\begin{method}[doit]{A doit method} -MyClass>>>doit -^ super doit -\end{method} -\end{verbatim} -\begin{method}[doit]{A doit method} -MyClass>>>doit - ^ super doit -\end{method} - -The plain code environment has no title, label or numbering: - -\begin{verbatim} -\begin{code}{} -just some plain code -\end{code} -\end{verbatim} -\begin{code}{} -just some plain code -\end{code} - -%============================================================= -\paragraph{Listings environments and macros} -The code environments - -\begin{verbatim} -\begin{code}{} -... -\end{code} -\end{verbatim} -take plain, verbatim code, -and translate some special characters like $\wedge$ to \ct{^}. Even tabs are handled, (which is not true for verbatim). -\begin{code}{} -"All handled correctly: ^ $ ' % \\ << >> _ { }" -"NB: If you !{\bf really}! want an exclamation mark you must spell it BANG" -" -If you really want a caret to look like this: CARET instead of this: ^, you must spell it out." -| y | -true & false not & (nil isNil) ifFalse: [self halt]. -y _ self size + super size. -#($a #a 'a' 1 1.0) - do: [:each | Transcript - show: (each class name); - show: ' '; - show: (each printString). -{ 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }. -^ x < y -\end{code} - -QWERTY layout: -\begin{code}{} -BANG @ # $ % ^ & * ( ) UNDERSCORE + -1 2 3 4 5 6 7 8 9 0 - = - Q W E R T Y U I O P { } - q w e r t y u i o p [ ] - A S D F G H J K L : "" | (twice " to turn off italics") - a s d f g h j k l ; ' \ - Z X C V B N M < > ? - z x c v b n m , . / -\end{code} - -LaTeX escape: -\begin{verbatim} -\begin{code}{} -plain code and !\textbf{bolded text}! -\end{code} -\end{verbatim} - -\begin{code}{} -plain code and !\textbf{bolded text}! -\end{code} - -% ^ $ \\ % # ' - -In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code. - -\subsection{Special chars with $\backslash$ct} -\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =\\ -\verb|\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =| - -\subsection{Special conventions} - -\verb$\ct{Class>>>method}$ prints as \ct{Class>>>method}.\\ -\verb$\ct{3 + 4 - 5 --> 2}$ prints as \ct{3 + 4 - 5 --> 2}. - -Use \verb$@TEST$ to include the code in the automatic tests and use \verb$-->$ to represent the expected result -\begin{verbatim} -\begin{code}{@TEST} -true --> true -3@4 --> 3@4 -$a --> $a -#(1 2 3) --> #(1 2 3) -\end{code} -\end{verbatim} - -%============================================================= -%\paragraph{New code environment} - -%Experiment: - -%\begin{testenv}{testing} -%self doit -%\end{testenv} - -%============================================================= -\section*{Other macros} -%============================================================= -\paragraph{url} -\url{https://SqueakByExample.org} % URL protocol is NOT optional for all PDF viewers! -%============================================================= -\paragraph{names} -\SUnit -\xUnit -\st -\Squeak -\sq -\squeak -%============================================================= -\paragraph{editorial} -\ugh{please rephrase this} -\ins{please insert this text} -\del{delete this} -and -\chg{change this}{to this} -\ab{...} -%============================================================= -\paragraph{abbreviation} -\ie -\eg -\etc -%============================================================= -\paragraph{Smalltalk macros} -sep: \sep -%============================================================= -\paragraph{scat and prot} -System category \scat{Kernel-Objects} and protocol \prot{accessing}. -%============================================================= -\paragraph{menu} -\menu{World menu~\go{} open ...} -%============================================================= -\paragraph{button} -\button{Create} -%============================================================= -\paragraph{do this} -\verb|\dothis| -\ct{-->} -\dothis{Download and install \Squeak.} -%============================================================= -\paragraph{Keyboard shortcut} -\verb|\short{d}| -\ct{-->} -\short{d} -%============================================================= -\section*{Footnote citations} -There is a great book on \sq by Ducasse\cite{Duca05j}. -%============================================================= -\section*{Important stuff} -\important{This is really important} -%============================================================= -% \bibliographystyle{plain} -\bibliographystyle{jurabib} -\nobibliography{scg} - -%============================================================= -\end{document} -%============================================================= +% $Author$ +% $Date: 2007-06-06 15:10:38 +0200 (Wed, 06 Jun 2007) $ +% $Revision$ +%============================================================= +% Demo and test the common macros +%================================================================= +\documentclass[a4paper,10pt,twoside]{book} +%============================================================= +\input{common.tex} +\graphicspath{{figures/}} % for \dothis +%============================================================= +\begin{document} +\sloppy +\mainmatter +%============================================================= +\section*{Code environments using the listings package} +%============================================================= +\paragraph{Sample code environment} +Use the script, method, classdef and example environments. +Each takes a name and an optional label. +With labels we can have cross references to +\verb|\egref{history}| \egref{history}, +\verb|\scrref{helloworld}| \scrref{helloworld}, +\verb|\clsref{myclass}| \clsref{myclass}, +and \verb|\mthref{doit}| \mthref{doit}. + +\begin{verbatim} +\begin{example}[history]{The first thing that Smalltalk could do}{} +3 + 4 --> 7 +\end{example} +\end{verbatim} +\begin{example}[history]{The first thing that Smalltalk could do}{} +3 + 4 --> 7 +\end{example} + +\begin{verbatim} +\begin{script}[helloworld]{The first thing you should try} +Transcript show: 'hello world' +\end{script} +\end{verbatim} +\begin{script}[helloworld]{The first thing you should try} +Transcript show: 'hello world' +\end{script} + +\begin{verbatim} +\begin{classdef}[myclass]{MyClass is defined} +Object subclass: #MyClass + instancevariables: '...' + ... +\end{classdef} +\end{verbatim} +\begin{classdef}[myclass]{MyClass is defined} +Object subclass: #MyClass + instancevariables: '...' + ... +\end{classdef} + +\begin{verbatim} +\begin{method}[doit]{A doit method} +MyClass>>>doit +^ super doit +\end{method} +\end{verbatim} +\begin{method}[doit]{A doit method} +MyClass>>>doit + ^ super doit +\end{method} + +The plain code environment has no title, label or numbering: + +\begin{verbatim} +\begin{code}{} +just some plain code +\end{code} +\end{verbatim} +\begin{code}{} +just some plain code +\end{code} + +%============================================================= +\paragraph{Listings environments and macros} +The code environments + +\begin{verbatim} +\begin{code}{} +... +\end{code} +\end{verbatim} +take plain, verbatim code, +and translate some special characters like $\wedge$ to \ct{^}. Even tabs are handled, (which is not true for verbatim). +\begin{code}{} +"All handled correctly: ^ $ ' % \\ << >> _ { }" +"NB: If you !{\bf really}! want an exclamation mark you must spell it BANG" +" +If you really want a caret to look like this: CARET instead of this: ^, you must spell it out." +| y | +true & false not & (nil isNil) ifFalse: [self halt]. +y _ self size + super size. +#($a #a 'a' 1 1.0) + do: [:each | Transcript + show: (each class name); + show: ' '; + show: (each printString). +{ 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }. +^ x < y +\end{code} + +QWERTY layout: +\begin{code}{} +BANG @ # $ % ^ & * ( ) UNDERSCORE + +1 2 3 4 5 6 7 8 9 0 - = + Q W E R T Y U I O P { } + q w e r t y u i o p [ ] + A S D F G H J K L : "" | (twice " to turn off italics") + a s d f g h j k l ; ' \ + Z X C V B N M < > ? + z x c v b n m , . / +\end{code} + +LaTeX escape: +\begin{verbatim} +\begin{code}{} +plain code and !\textbf{bolded text}! +\end{code} +\end{verbatim} + +\begin{code}{} +plain code and !\textbf{bolded text}! +\end{code} + +% ^ $ \\ % # ' + +In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code. + +\subsection{Special chars with $\backslash$ct} +\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =\\ +\verb|\ct=^ ~ # $ ' % \\ << >> _ { } ! -- --> =| + +\subsection{Special conventions} + +\verb$\ct{Class>>>method}$ prints as \ct{Class>>>method}.\\ +\verb$\ct{3 + 4 - 5 --> 2}$ prints as \ct{3 + 4 - 5 --> 2}. + +Use \verb$@TEST$ to include the code in the automatic tests and use \verb$-->$ to represent the expected result +\begin{verbatim} +\begin{code}{@TEST} +true --> true +3@4 --> 3@4 +$a --> $a +#(1 2 3) --> #(1 2 3) +\end{code} +\end{verbatim} + +%============================================================= +%\paragraph{New code environment} + +%Experiment: + +%\begin{testenv}{testing} +%self doit +%\end{testenv} + +%============================================================= +\section*{Other macros} +%============================================================= +\paragraph{url} +\url{https://SqueakByExample.org} % URL protocol is NOT optional for all PDF viewers! +%============================================================= +\paragraph{names} +\SUnit +\xUnit +\st +\Squeak +\sq +\squeak +%============================================================= +\paragraph{editorial} +\ugh{please rephrase this} +\ins{please insert this text} +\del{delete this} +and +\chg{change this}{to this} +\ab{...} +%============================================================= +\paragraph{abbreviation} +\ie +\eg +\etc +%============================================================= +\paragraph{Smalltalk macros} +sep: \sep +%============================================================= +\paragraph{scat and prot} +System category \scat{Kernel-Objects} and protocol \prot{accessing}. +%============================================================= +\paragraph{menu} +\menu{World menu~\go{} open ...} +%============================================================= +\paragraph{button} +\button{Create} +%============================================================= +\paragraph{do this} +\verb|\dothis| +\ct{-->} +\dothis{Download and install \Squeak.} +%============================================================= +\paragraph{Keyboard shortcut} +\verb|\short{d}| +\ct{-->} +\short{d} +%============================================================= +\section*{Footnote citations} +There is a great book on \sq by Ducasse\cite{Duca05j}. +%============================================================= +\section*{Important stuff} +\important{This is really important} +%============================================================= +% \bibliographystyle{plain} +\bibliographystyle{jurabib} +\nobibliography{scg} + +%============================================================= +\end{document} +%============================================================= From b4c4d6410fadb26431e81bf5f458fb3446355d04 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sun, 26 Nov 2023 20:53:37 +0100 Subject: [PATCH 13/14] fix all invalid \seeindex's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supported by https://github.com/hpi-swa-lab/SqueakByExample-english/pull/222/commits/61df36dc1ad45f8edffa29e7b045a5af9ebe88f4 🤓 --- FirstApp/FirstApp.tex | 4 ++-- QuickTour/QuickTour.tex | 2 +- SUnit/SUnit.tex | 2 +- Syntax/Syntax.tex | 13 +++++++------ common.tex | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/FirstApp/FirstApp.tex b/FirstApp/FirstApp.tex index c07ebb83..ecc6abe3 100644 --- a/FirstApp/FirstApp.tex +++ b/FirstApp/FirstApp.tex @@ -80,7 +80,7 @@ \section{Creating a new class category} We have already seen the \ind{system browser} in \charef{quick}, where we learned how to navigate to classes and methods, and saw how to define new methods. Now we will see how to create system categories and classes. -\seeindex{system category}{category} +\seeindex{system category}{category, system} \seeindex{class category}{system category} \index{category!creating} @@ -767,7 +767,7 @@ \section{Saving and sharing Smalltalk code} The yellow-button menu in the System Categories pane will give you the option to file out the whole of category \scat{SBE-Quinto}. The resulting file is more or less human-readable, but is really intended for computers, not humans. You can email this file to your friends, and they can file it into their own \squeak images using drag-and-drop. -\seeindex{saving code}{categories} +\seeindex{saving code}{file, filing out} \seeindex{category!filing out}{file, filing out} \seeindex{class!filing out}{file, filing out} \seeindex{method!filing out}{file, filing out} diff --git a/QuickTour/QuickTour.tex b/QuickTour/QuickTour.tex index 3b688c83..03734188 100644 --- a/QuickTour/QuickTour.tex +++ b/QuickTour/QuickTour.tex @@ -639,7 +639,7 @@ \section{The system browser} You may have to scroll down to find it. Now you will see in the fourth pane only methods related to printing. \index{category!method} -\index{category!message|see method} +\index{category!message|see category, method} \dothis{Select the \mthind{Object}{printString} method.} Now we see in the bottom pane the source code of the \ct{printString} method, shared by all objects in the system (except those that override it). diff --git a/SUnit/SUnit.tex b/SUnit/SUnit.tex index 1ea72684..26a66562 100644 --- a/SUnit/SUnit.tex +++ b/SUnit/SUnit.tex @@ -38,7 +38,7 @@ \chapter{SUnit} \sunit was originally developed by Kent Beck and subsequently extended by Joseph Pelrine and others to incorporate the notion of a resource, which we will describe in \secref{resource}. \index{Beck, Kent} \index{Pelrine, Joseph} -\seeindex{resource}{test, resource} +\seeindex{resource}{TestResource, (class)} The interest in testing and \ind{Test Driven Development} is not limited to \squeak or \st. Automated testing has become a hallmark of the \ind{agile software development} movement, and any software developer concerned with improving software quality would do well to adopt it. diff --git a/Syntax/Syntax.tex b/Syntax/Syntax.tex index dd2ef1ec..29f99238 100755 --- a/Syntax/Syntax.tex +++ b/Syntax/Syntax.tex @@ -201,6 +201,7 @@ \section{Syntactic elements} \seeindex{"" ""@{\textsf{"" ""}}}{comment} \item[Temporary variable declaration.] + \index{temporary variable declaration} Vertical bars \ct{| |} enclose the \subind{variable}{declaration} of one or more temporary variables in a method (and also in a block). \seeindex{$\vert\ \vert$@{\textsf{$\vert\ \vert$}}}{temporary variable declaration} \seeindex{variable declaration}{temporary variable declaration} @@ -230,7 +231,7 @@ \section{Syntactic elements} Primitives denote an invocation of a \ind{virtual machine} \ind{primitive.} For instance, \ct{} is the VM primitive for \cmind{SmallInteger}{+}. Any code following the primitive is executed only if the primitive fails. - \seeindex{< >}{\textsf{< >}}{pragma} + \seeindex{< >@\textsf{< >}}{pragma} \item[Unary messages] consist of a single word (such as \ct{factorial}) sent to a receiver (like the number \ct{3}). \index{message!unary} @@ -257,9 +258,9 @@ \section{Syntactic elements} \item[Sequences of statements.] A period or full-stop (\ct{.}) is the \emph{statement} \emphsubind{statement}{separator}. Putting a period between two expressions turns them into independent statements. - \seeindex{full stop}{statement separator} - \seeindex{period}{statement separator} - \seeindex{\ct{.}}{statement separator} + \seeindex{full stop}{statement, separator} + \seeindex{period}{statement, separator} + \seeindex{\ct{.}}{statement, separator} \item[Cascades.] Semicolons can be used to send a \emphind{cascade} of messages to a single receiver. @@ -419,7 +420,7 @@ \section{Block syntax} A \ind{block} is essentially an anonymous function. A block is evaluated by sending it the message \mthind{BlockClosure}{value}. The block answers the value of the last expression in its body unless there is an explicit return (with \ct{^}), in which case it does not answer any value. -\seeindex{value}{BlockClosure} +\seeindex{value}{BlockClosure, value} \begin{code}{@TEST} [1 + 2] value --> 3 @@ -589,7 +590,7 @@ \section{Primitives and pragmas} bit manipulation (\mthind{Integer}{bitAnd:}, \mthind{Integer}{bitOr:}, \mthind{Integer}{bitShift:}), pointer and integer arithmetic (\ct{+}, \ct{-}, \ct{<}, \ct{>}, \ct{*}, \ct{/ }, \ct{=}, \ct{==}, ...), and array access (\mthind{Object}{at:}, \mthind{Object}{at:put:}). -\seeindex{new@{\ct{new}}}{\ct{Behavior>>>new}} +\seeindex{new@{\ct{new}}}{Behavior, new} Primitives are invoked with the syntax \ct{}. A method that invokes such a primitive may also include \st code, which will be evaluated \emph{only} if the primitive fails. diff --git a/common.tex b/common.tex index 667330bb..95050f34 100644 --- a/common.tex +++ b/common.tex @@ -516,7 +516,7 @@ \newcommand{\ind}[1]{\index{#1}#1\xspace} % plain text \newcommand{\subind}[2]{\index{#1!#2}#2\xspace} % show #2, subindex under #1 \newcommand{\emphind}[1]{\index{#1}\emph{#1}\xspace} % emph #1 -\newcommand{\emphsubind}[2]{\index{#1!#2}\emph{#2}\xspace} % show emph #2, subindex inder #1 +\newcommand{\emphsubind}[2]{\index{#1!#2}\emph{#2}\xspace} % show emph #2, subindex under #1 \newcommand{\scatind}[1]{\index{#1@\textsf{#1} (category)}\scat{#1}} % category \newcommand{\protind}[1]{\index{#1@\textsf{#1} (protocol)}\prot{#1}} % protocol % \newcommand{\clsind}[1]{\index{#1@\textsf{#1} (class)}\ct{#1}\xspace} From a7e06f0a29b387eca7aa39cfd34bbb8b01bf402b Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sun, 26 Nov 2023 21:28:07 +0100 Subject: [PATCH 14/14] add and extend top-level index entries for do it, print it, inspect it, explore it --- BasicClasses/BasicClasses.tex | 2 +- Environment/Environment.tex | 5 +++-- FAQ/FAQ.tex | 2 +- FirstApp/FirstApp.tex | 3 ++- Preface/Preface.tex | 1 + QuickTour/QuickTour.tex | 14 +++++++++++--- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/BasicClasses/BasicClasses.tex b/BasicClasses/BasicClasses.tex index 35f0e10a..1eca0ad5 100644 --- a/BasicClasses/BasicClasses.tex +++ b/BasicClasses/BasicClasses.tex @@ -70,7 +70,7 @@ \section{Object} %----------------------------------------------------------------- \subsection{Printing} Every object in Smalltalk can return a printed form of itself. -You can select any expression in a workspace and select the \menu{print it} menu item: +You can select any expression in a workspace and select the \menu{print it} menu item: \index{print it} This executes the expression and asks the returned object to print itself. In fact, this sends the message \ct{printString} to the returned object. The method \mthind{Object}{printString}, which is a \ind{template method}, at its core sends the message \mthind{Object}{printOn:} to its receiver. diff --git a/Environment/Environment.tex b/Environment/Environment.tex index 3dbd468d..934dfa5f 100644 --- a/Environment/Environment.tex +++ b/Environment/Environment.tex @@ -235,7 +235,7 @@ \subsubsection{Browsing code} When you are writing code you will almost certainly need at least two: one for the method that you are typing, and another to browse around the system to see what to type. You can also open a browser on a class named by any selected text using the \short{b} keyboard shortcut. \index{system browser!browse button} -\index{keyboard shortcuts!browse it} +\index{browse it} \dothis{Try this: in a workspace window, type the name of a class (for instance \ct{ScaleMorph}), select it, and then press \short{b}. This trick is often useful; it works in any text window.} @@ -608,6 +608,7 @@ \section{The inspector and the explorer} \subsection{The inspector} \dothis{As an illustration of what you can do with an \ind{inspector}, type \ct{TimeStamp now} in a workspace, and then choose \menu{inspect it} from the \ind{yellow button} menu. +\index{inspect it} (It's not necessary to select the text before using the menu; if no text is selected, the menu operations work on the whole of the current line. You can also type \short{i} for \menu{\textbf{i}nspect it}.)} \clsindex{TimeStamp} @@ -790,7 +791,7 @@ \subsection{The instance browser} However, this window is more interesting as it still knows about the \ct{PluggableListMorph} for which we opened it. Thus, we can evaluate code in the code pane. -\dothis{In the browser, open the method \ct{fullListSize} by selecting it in the list at the top right. Then, navigate to the last code line and \menu{print it} (\short{p}). You should see the result of evaluating the expression right within the code editor.} +\dothis{In the browser, open the method \ct{fullListSize} by selecting it in the list at the top right. Then, navigate to the last code line and \menu{print it} (\short{p}). \index{print it} You should see the result of evaluating the expression right within the code editor.} \begin{ExecuteSmalltalkScript} SBEScreenshotRecorder writeTo: './figures/instanceBrowser.png' building: [:helper | diff --git a/FAQ/FAQ.tex b/FAQ/FAQ.tex index b58bd266..0a1850cb 100644 --- a/FAQ/FAQ.tex +++ b/FAQ/FAQ.tex @@ -130,7 +130,7 @@ \section{Browsing the system} \end{faq} \answer \short{b} (browse) on the class name, \short{f} in the category pane of the class browser, or the global search on the top right of the world. -\index{keyboard shortcuts!browse it} +\index{browse it} \index{keyboard shortcuts!find ...} \begin{faq} diff --git a/FirstApp/FirstApp.tex b/FirstApp/FirstApp.tex index ecc6abe3..1252276a 100644 --- a/FirstApp/FirstApp.tex +++ b/FirstApp/FirstApp.tex @@ -289,7 +289,8 @@ \section{Inspecting an object} You can test the effect of the code you have written by creating a new \ct{SBECell} object and inspecting it. \dothis{Open a workspace. - Type the expression \ct{SBECell new} and \menu{inspect it}.} + Type the expression \ct{SBECell new} and \menu{inspect it}. + \index{inspect it}} \begin{ExecuteSmalltalkScript} SBEScreenshotRecorder writeTo: './figures/SBECellInspector.png' frame: #morphs building: [:helper | diff --git a/Preface/Preface.tex b/Preface/Preface.tex index c7f20a43..c87a8efe 100644 --- a/Preface/Preface.tex +++ b/Preface/Preface.tex @@ -141,6 +141,7 @@ \section*{Examples and exercises} We have tried to provide as many examples as possible. In particular, there are many examples that show a fragment of code that can be evaluated. +\index{print it} We use the symbol \ct{-->} to indicate the result that you obtain when you select an expression and \menu{print it}: \begin{code}{@TEST} diff --git a/QuickTour/QuickTour.tex b/QuickTour/QuickTour.tex index 03734188..2c1ea34c 100644 --- a/QuickTour/QuickTour.tex +++ b/QuickTour/QuickTour.tex @@ -428,6 +428,7 @@ \section{Workspaces and transcripts} Notice how an entire word, entire string, or the whole text is selected, depending on where you click. \dothis{Select the text you have typed and yellow-click. +\index{do it} Select \menu{do it (d)}.} Notice how the text ``hello world'' appears in the transcript window (\figref{doit}). @@ -479,7 +480,8 @@ \section{Keyboard shortcuts} (We will indicate these generically as \short{\emph{key}}.) \dothis{Evaluate the expression in the workspace again, but using the keyboard shortcut: \short{d}.} -\index{keyboard shortcuts!do it} +\index{do it} +\index{keyboard shortcuts!do it|seealso{do it}} In addition to \menu{do it}, you will have noticed \menu{print it}, \menu{inspect it} and \menu{explore it}. Let's have a quick look at each of these. @@ -491,6 +493,7 @@ \section{Keyboard shortcuts} Normally the result \ct{7} will have been computed and returned to you, but since the workspace did not know what to do with this answer, it simply threw the answer away. If you want to see the result, you should \menu{print it} instead. \menu{print it} actually compiles the expression, executes it, sends the message \ct{printString} to the result, and displays the resulting string. +\index{print it} \dothis{Select \ct{3 + 4} and \menu{print it} (\short{p}).} This time we see the result we expect (\figref{printit}). @@ -517,6 +520,8 @@ \section{Keyboard shortcuts} \noindent We use the notation \ct{-->} as a convention in this book to indicate that a particular \sq expression yields a given result when you \menu{print it}. +\index{inspect it} +\index{keyboard shortcuts!inspect it|seealso{inspect it}} \dothis{Delete the highlighted text ``\ct{7}'' (\sq should have selected it for you, so you can just press the delete key). Select \ct{3 + 4} again and this time \menu{inspect it} (\short{i}).} \noindent @@ -545,10 +550,11 @@ \section{Keyboard shortcuts} \dothis{Type \ct{self squared} in the bottom panel of the inspector on \ct{7} and \menu{print it}.} +\index{explore it} \needlines{2} \dothis{Close the inspector. Type the expression \ct{Object} in a workspace and this time \menu{explore it} (\short{I}, uppercased i).} -\index{keyboard shortcuts!explore it} +\index{keyboard shortcuts!explore it|seealso{explore it}} \index{explorer} This time you should see a window labeled \clsind{Object} containing the text @@ -658,7 +664,9 @@ \section{Finding classes} \dothis{Type \ct{Boolean browse} into a workspace and \menu{do it}.} A browser will open on the Boolean class (\figref{browseBoolean}). -There is also a keyboard shortcut \short{b} (browse) that you can use in any tool where you find a class name; \index{keyboard shortcuts!browse it}, select the name and type \short{b}. +There is also a keyboard shortcut \short{b} (browse) that you can use in any tool where you find a class name; select the name and type \short{b}. +\index{browse it} +\index{keyboard shortcuts!browse it|seealso{browse it}} \dothis{Use the keyboard shortcut to browse the class \ct{Boolean}.}