Break and capitalize after colon, take four
cover Break and capitalize after colon, take four
Hi Paul,
This is the final round of colon-related fixes.
Patch 1/11 does the same changes in appendices and glossary as before. Patch 2/11 fixes a trivial-looking typo.
Patch 3/11 fixes remaining violations detected by the updated scripts. Patch 4/11 improves definition of \IfEbookSize and \IfSansSerif so that they are safe to be used in the middle of a paragraph.
Patch 5/11 fixes inline-enumerate list containing \co{}. This is similar to the issue of \co{} inside tabular cells.
Patches 6/11--10/11 are updates of check scripts. (Please refer to change logs for what they are after.) Patch 11/11 renames make target "periodcheck" to "punctcheck" as it checks punctuation-related conventions not limited to periods.
Thanks, Akira
--
Akira Yokosawa (11):
appendix, glossary: Break and capitalize after colon
glossary: Put missing question mark
treewide: Adjust punctuation convention
Add \ignorespaces command to \IfEbookSize and \IfSansSerif
datastruct: Use \tco{} inside inline enumerate list
periodcheck: Add colon-related checks
cleverefcheck: Check lower-case word after \item
periodcheck: Improve regex
periodcheck: Use counter to prevent false negatives
cleverefcheck: Add pattern to catch missing '\' in indexing macros
Makefile: Rename periodcheck --> punctcheck
Makefile | 14 +++--
SMPdesign/beyond.tex | 5 +-
appendix/questions/after.tex | 2 +-
appendix/styleguide/styleguide.tex | 5 +-
appendix/toyrcu/toyrcu.tex | 11 ++--
appendix/whymb/whymemorybarriers.tex | 24 ++++----
count/count.tex | 2 +-
datastruct/datastruct.tex | 19 +++---
defer/rcufundamental.tex | 4 +-
future/formalregress.tex | 2 +-
glossary.tex | 14 +++--
perfbook-lt.tex | 6 +-
utilities/cleverefcheck.pl | 65 ++++++++++++++-------
utilities/{periodcheck.pl => punctcheck.pl} | 65 ++++++++++++---------
utilities/{periodcheck.sh => punctcheck.sh} | 3 +-
15 files changed, 143 insertions(+), 98 deletions(-)
rename utilities/{periodcheck.pl => punctcheck.pl} (52%)
rename utilities/{periodcheck.sh => punctcheck.sh} (87%)Signature · 1 line
2.17.1
PATCH 1/11 appendix, glossary: Break and capitalize after colon
--- appendix/questions/after.tex | 2 +- appendix/toyrcu/toyrcu.tex | 11 ++++++----- appendix/whymb/whymemorybarriers.tex | 24 ++++++++++++------------ glossary.tex | 14 ++++++++------ 4 files changed, 27 insertions(+), 24 deletions(-)
appendix/questions/after.tex +1 -1
@@ -130,7 +130,7 @@ These locks cause the code segments in each other, in other words, to run atomically with respect to each other. This is represented in \cref{fig:app:questions:Effect of Locking on Snapshot Collection}: -the locking prevents any of the boxes of code from overlapping in time, so +The locking prevents any of the boxes of code from overlapping in time, so that the consumer's timestamp must be collected after the prior producer's timestamp. The segments of code in each box in this figure are termed
appendix/toyrcu/toyrcu.tex +6 -5
@@ -533,8 +533,9 @@ checking of \co{rcu_refcnt}. read-side critical section to see the recently removed data element. - Exercise for the reader: use a tool such as Promela/spin - to determine which (if any) of the memory barriers in + Exercise for the reader: + Use a tool such as Promela/spin to determine which (if any) of + the memory barriers in \cref{lst:app:toyrcu:RCU Update Using Global Reference-Count Pair} are really needed. See \cref{chp:Formal Verification}
@@ -590,9 +591,9 @@ checking of \co{rcu_refcnt}. section was still referencing. \end{sequence} - Exercise for the reader: What happens if \co{rcu_read_lock()} - is preempted for a very long time (hours!\@) just after - \clnref{r:lock:cur:b}? + Exercise for the reader: + What happens if \co{rcu_read_lock()} is preempted for a very long + time (hours!\@) just after \clnref{r:lock:cur:b}? Does this implementation operate correctly in that case? Why or why not? The first correct and complete response will be credited.
appendix/whymb/whymemorybarriers.tex +12 -12
@@ -21,10 +21,10 @@ of how CPU caches work, and especially what is required to make caches really work well. The following sections: \begin{enumerate} -\item present the structure of a cache, -\item describe how cache-coherency protocols ensure that CPUs agree +\item Present the structure of a cache, +\item Describe how cache-coherency protocols ensure that CPUs agree on the value of each location in memory, and, finally, -\item outline how store buffers and invalidate queues help +\item Outline how store buffers and invalidate queues help caches and cache-coherency protocols achieve high performance. \end{enumerate} We will see that memory barriers are a necessary evil that is required
@@ -99,7 +99,8 @@ The size (32 cache lines in this case) and the this case) are collectively called the cache's ``\IXalt{geometry}{cache geometry}''. Since this cache is implemented in hardware, the hash function is -extremely simple: extract four bits from the memory address. +extremely simple: +Extract four bits from the memory address. \begin{figure} \centering
@@ -385,11 +386,10 @@ levels of the system architecture. What happens if two CPUs attempt to invalidate the same cache line concurrently? }\QuickQuizAnswerB{ - One of the CPUs gains access - to the shared bus first, - and that CPU ``wins''. The other CPU must invalidate its copy of the - cache line and transmit an ``invalidate acknowledge'' message - to the other CPU\@. + One of the CPUs gains access to the shared bus first, + and that CPU ``wins''. + The other CPU must invalidate its copy of the cache line and + transmit an ``invalidate acknowledge'' message to the other CPU\@. Of course, the losing CPU can be expected to immediately issue a ``read invalidate'' transaction, so the winning CPU's victory will
@@ -1436,9 +1436,9 @@ the assertion. CPU~1's accesses, so the assertion could still fail. However, all mainstream computer systems provide one mechanism or another to provide ``transitivity'', which provides - intuitive causal ordering: if B saw the effects of A's accesses, - and C saw the effects of B's accesses, then C must also see - the effects of A's accesses. + intuitive causal ordering: + If B saw the effects of A's accesses, and C saw the effects of + B's accesses, then C must also see the effects of A's accesses. In short, hardware designers have taken at least a little pity on software developers. }\QuickQuizEnd
glossary.tex +8 -6
@@ -106,23 +106,25 @@ that CPU's cache. The data might be missing because of a number of reasons, including: - (1) this CPU has never accessed the data before + \begin{enumerate*}[(1)] + \item This CPU has never accessed the data before (``startup'' or ``warmup'' miss), - (2) this CPU has recently accessed more + \item This CPU has recently accessed more data than would fit in its cache, so that some of the older data had to be removed (``capacity'' miss), - (3) this CPU + \item This CPU has recently accessed more data in a given set\footnote{ In hardware-cache terminology, the word ``set'' is used in the same way that the word ``bucket'' is used when discussing software caches.} than that set could hold (``associativity'' miss), - (4) some other CPU has written to the data (or some other + \item Some other CPU has written to the data (or some other data in the same cache line) since this CPU has accessed it (``communication miss''), or - (5) this CPU attempted to write to a cache line that is + \item This CPU attempted to write to a cache line that is currently read-only, possibly due to that line being replicated in other CPUs' caches. + \end{enumerate*} \item[\IXalth{Capacity Miss}{capacity}{cache miss}:] A cache miss incurred because the corresponding CPU has recently accessed more data than will fit into the cache.
@@ -462,7 +464,7 @@ is a pre-existing writer, any threads attempting to write must wait for the writer to release the lock. A key concern for reader-writer locks is ``fairness'': - can an unending stream of readers starve a writer or vice versa. + Can an unending stream of readers starve a writer or vice versa. \item[\IX{Real Time}:] A situation in which getting the correct result is not sufficient, but where this result must also be obtained within a given amount
Signature · 1 line
2.17.1
PATCH 2/11 glossary: Put missing question mark
In reply to Akira Yokosawa--- glossary.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
glossary.tex +1 -1
@@ -464,7 +464,7 @@ is a pre-existing writer, any threads attempting to write must wait for the writer to release the lock. A key concern for reader-writer locks is ``fairness'': - Can an unending stream of readers starve a writer or vice versa. + Can an unending stream of readers starve a writer or vice versa? \item[\IX{Real Time}:] A situation in which getting the correct result is not sufficient, but where this result must also be obtained within a given amount
Signature · 1 line
2.17.1
PATCH 3/11 treewide: Adjust punctuation convention
In reply to Akira YokosawaFix violations of punctuation convention flagged by the to-be-updated check scripts.
--- SMPdesign/beyond.tex | 5 +++-- count/count.tex | 2 +- datastruct/datastruct.tex | 19 ++++++++++++------- defer/rcufundamental.tex | 4 ++-- future/formalregress.tex | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-)
SMPdesign/beyond.tex +3 -2
@@ -204,11 +204,12 @@ The parallel work-queue solver is a straightforward parallelization of the algorithm shown in \cref{lst:SMPdesign:SEQ Pseudocode,lst:SMPdesign:SEQ Helper Pseudocode}. \begin{fcvref}[ln:SMPdesign:SEQ Pseudocode] -\Clnref{ifge} of Listing~\ref{lst:SMPdesign:SEQ Pseudocode} must use fetch-and-add, +\Clnref{ifge} of \cref{lst:SMPdesign:SEQ Pseudocode} must use fetch-and-add, and the local variable \co{vi} must be shared among the various threads. \end{fcvref} \begin{fcvref}[ln:SMPdesign:SEQ Helper Pseudocode:try] -\Clnref{chk:not:visited,mark:visited} of Listing~\ref{lst:SMPdesign:SEQ Helper Pseudocode} must be +\Clnref{chk:not:visited,mark:visited} of +\cref{lst:SMPdesign:SEQ Helper Pseudocode} must be combined into a CAS loop, with CAS failure indicating a loop in the maze. \Clnrefrange{recordnext}{next:visited} of this listing must use
count/count.tex +1 -1
@@ -2301,7 +2301,7 @@ The state machine starts out in the IDLE state, and when \co{add_count()} or \co{sub_count()} find that the combination of the local thread's count and the global count cannot accommodate the request, the corresponding slowpath sets each thread's \co{theft} state to REQ (unless that thread -has no count, in which case it transitions directly to READY). +has no count, in which case it transitions directly to READY)\@. Only the slowpath, which holds the \co{gblcnt_mutex} lock, is permitted to transition from the IDLE state, as indicated by the green color.\footnote{ For those with black-and-white versions of this book,
datastruct/datastruct.tex +12 -7
@@ -182,7 +182,8 @@ shows mapping and locking functions. \Clnref{b,e} show the macro \co{HASH2BKT()}, which maps from a hash value to the corresponding \co{ht_bucket} structure. -This macro uses a simple modulus: if more aggressive hashing is required, +This macro uses a simple modulus: +If more aggressive hashing is required, the caller needs to implement it when mapping from key to hash value. The remaining two functions acquire and release the \co{->htb_lock} corresponding to the specified hash value.
@@ -318,8 +319,8 @@ on two or more CPUs. And things only get worse with more CPUs, as can be seen in \cref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; 448 CPUs}. -We do not need to show ideal performance: The performance for 29~CPUs -and beyond is all too clearly worse than abysmal. +We do not need to show ideal performance: +The performance for 29~CPUs and beyond is all too clearly worse than abysmal. This clearly underscores the dangers of extrapolating performance from a modest number of CPUs.
@@ -1754,8 +1755,9 @@ splits and combines corresponding hash chains so that readers always see valid hash chains at all points during the resizing operation. This incremental splitting and combining relies on the fact that it is harmless for a reader to see a data element that should be in some -other hash chain: When this happens, the reader will simply ignore the -extraneous data element due to key mismatches. +other hash chain: +When this happens, the reader will simply ignore the extraneous data +element due to key mismatches. \begin{figure} \centering
@@ -2074,8 +2076,11 @@ However, the resizable hash table's \co{ht} structure is not all that highly replicated. It is instead the \co{ht_bucket} structures we should focus on. There are two major opportunities for shrinking the \co{ht_bucket} structure: -(1)~Placing the \co{->htb_lock} field in a low-order bit of one of the -\co{->htb_head} pointers and (2)~Reducing the number of pointers required. +\begin{enumerate*}[(1)] +\item Placing the \co{->htb_lock} field in a low-order bit of one of the +\co{->htb_head} pointers and +\item Reducing the number of pointers required. +\end{enumerate*} The first opportunity might make use of bit-spinlocks in the Linux kernel, which are provided by the \path{include/linux/bit_spinlock.h}
defer/rcufundamental.tex +2 -2
@@ -296,7 +296,7 @@ However, it cannot be the case that \co{r1}'s final value is 0 and \co{r2}'s final value is 1. This would mean that an RCU read-side critical section had completely overlapped a grace period, which is forbidden (or at the very least -constitutes a bug in RCU). +constitutes a bug in RCU)\@. RCU's wait-for-readers guarantee therefore has two parts: \begin{enumerate*}[(1)] \item If any part of a given RCU read-side critical section precedes
@@ -484,7 +484,7 @@ One way to resolve this strange situation is via weaker semanitics. A reader traversal must encounter any data item that was present during the full traversal (B, C, and~D), and might or might not encounter data items that were present for only part of the -traversal (A and~E). +traversal (A and~E)\@. Therefore, in this particular case, it is perfectly legitimate for the reader traveral to encounter all five elements. If this outcome is problematic, another way to resolve this situation is
future/formalregress.tex +1 -1
@@ -114,7 +114,7 @@ project~\cite{ThomasSewell2013L4binaryVerification}. And although SEL4 has gained multi-processor capabilities, it is currently using very coarse-grained locking that is similar to the Linux kernel's old - Big Kernel Lock (BKL). + Big Kernel Lock (BKL)\@. There will hopefully come a day when it makes sense to add SEL4's verifiers to a book on parallel programming, but this is not yet that day.
Signature · 1 line
2.17.1
PATCH 4/11 Add \ignorespaces command to \IfEbookSize and \IfSansSerif
In reply to Akira YokosawaUsing \IfEbookSize or \IfSansSerif macro in the middle of a paragraph can cause extra white spaces around it.
Fix this by adding the \ignorespaces command in their definitions.
Also update the conditional text in styleguide.
As the other conditional macros aren't used in this manner, they are not modified for the moment.
--- appendix/styleguide/styleguide.tex | 5 +++-- perfbook-lt.tex | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
appendix/styleguide/styleguide.tex +3 -2
@@ -1013,8 +1013,9 @@ namely \qco{$-$}.\footnote{This rule assumes that math mode uses the same upright glyph as text mode. Our default font choice meets the assumption. \IfSansSerif{ - One of the experimental targets ``1csf'' \emph{does} use a differnt font - for math mode figures as of October 2017.}{} + Experimental targets with sans-serif fonts such as + ``1csf'' and ``ebsf'' \emph{do} use a differnt font + for math mode figures as of August 2021.}{} } For example,
perfbook-lt.tex +4 -2
@@ -117,13 +117,15 @@ \newcommand{\IfHardCover}[2]{\ifthenelse{\boolean{hardcover}}{#1}{#2}} \newboolean{ebooksize} \setboolean{ebooksize}{false} -\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}{#1}{#2}} +\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{afourpaper} \setboolean{afourpaper}{false} \newcommand{\IfAfourPaper}[2]{\ifthenelse{\boolean{afourpaper}}{#1}{#2}} \newboolean{sansserif} \setboolean{sansserif}{false} -\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}{#1}{#2}} +\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{lmttforcode} \setboolean{lmttforcode}{true} \newcommand{\IfLmttForCode}[2]{\ifthenelse{\boolean{lmttforcode}}{#1}{#2}}
Signature · 1 line
2.17.1
Re: [PATCH -perfbook 04/11] Add \ignorespaces command to \IfEbookSize and \IfSansSerif
Quoted 20 lines · Akira Yokosawa
Using \IfEbookSize or \IfSansSerif macro in the middle of a paragraph can cause extra white spaces around it.
Fix this by adding the \ignorespaces command in their definitions.Also update the conditional text in styleguide.
As the other conditional macros aren't used in this manner, they are not modified for the moment.
Signed-off-by Akira Yokosawa <[email protected]>--- appendix/styleguide/styleguide.tex | 5 +++-- perfbook-lt.tex | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)appendix/styleguide/styleguide.tex +0
-0
appendix/styleguide/styleguide.tex namely \qco{$-$}.\footnote{This rule assumes that math mode uses the · line 1017
Quoted 7 lines
appendix/styleguide/styleguide.tex +2
-2@@ -1013,8 +1013,9 @@ namely \qco{$-$}.\footnote{This rule assumes that math mode uses the same upright glyph as text mode. Our default font choice meets the assumption. \IfSansSerif{ - One of the experimental targets ``1csf'' \emph{does} use a differnt font - for math mode figures as of October 2017.}{} + Experimental targets with sans-serif fonts such as + ``1csf'' and ``ebsf'' \emph{do} use a differnt font
I did s/differnt/different/ here. This looks like the sort of typo that I would make! ;-)
Thanx, Paul
Quoted 30 lines
appendix/styleguide/styleguide.tex +1
-0+ for math mode figures as of August 2021.}{} } For example,perfbook-lt.tex +4
-2@@ -117,13 +117,15 @@ \newcommand{\IfHardCover}[2]{\ifthenelse{\boolean{hardcover}}{#1}{#2}} \newboolean{ebooksize} \setboolean{ebooksize}{false} -\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}{#1}{#2}} +\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{afourpaper} \setboolean{afourpaper}{false} \newcommand{\IfAfourPaper}[2]{\ifthenelse{\boolean{afourpaper}}{#1}{#2}} \newboolean{sansserif} \setboolean{sansserif}{false} -\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}{#1}{#2}} +\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{lmttforcode} \setboolean{lmttforcode}{true} \newcommand{\IfLmttForCode}[2]{\ifthenelse{\boolean{lmttforcode}}{#1}{#2}}Signature · 1 line
2.17.1
Re: [PATCH -perfbook 04/11] Add \ignorespaces command to \IfEbookSize and \IfSansSerif
Quoted 16 lines · Paul E. McKenney
Quoted 15 lines · Akira Yokosawa
Using \IfEbookSize or \IfSansSerif macro in the middle of a paragraph can cause extra white spaces around it.
Fix this by adding the \ignorespaces command in their definitions.Also update the conditional text in styleguide.
As the other conditional macros aren't used in this manner, they are not modified for the moment.
Signed-off-by Akira Yokosawa <[email protected]>--- appendix/styleguide/styleguide.tex | 5 +++-- perfbook-lt.tex | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
Quoted 15 lines
appendix/styleguide/styleguide.tex namely \qco{$-$}.\footnote{This rule assumes that math mode uses the · line 1017
Quoted 12 lines
appendix/styleguide/styleguide.tex +2
-2@@ -1013,8 +1013,9 @@ namely \qco{$-$}.\footnote{This rule assumes that math mode uses the same upright glyph as text mode. Our default font choice meets the assumption. \IfSansSerif{ - One of the experimental targets ``1csf'' \emph{does} use a differnt font - for math mode figures as of October 2017.}{} + Experimental targets with sans-serif fonts such as + ``1csf'' and ``ebsf'' \emph{do} use a differnt fontI did s/differnt/different/ here. This looks like the sort of typo that I would make! ;-)
Other than that, all queued and pushed, thank you!
Thanx, Paul
Quoted 30 lines
Quoted 30 lines
appendix/styleguide/styleguide.tex +1
-0+ for math mode figures as of August 2021.}{} } For example,perfbook-lt.tex +4
-2@@ -117,13 +117,15 @@ \newcommand{\IfHardCover}[2]{\ifthenelse{\boolean{hardcover}}{#1}{#2}} \newboolean{ebooksize} \setboolean{ebooksize}{false} -\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}{#1}{#2}} +\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{afourpaper} \setboolean{afourpaper}{false} \newcommand{\IfAfourPaper}[2]{\ifthenelse{\boolean{afourpaper}}{#1}{#2}} \newboolean{sansserif} \setboolean{sansserif}{false} -\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}{#1}{#2}} +\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{lmttforcode} \setboolean{lmttforcode}{true} \newcommand{\IfLmttForCode}[2]{\ifthenelse{\boolean{lmttforcode}}{#1}{#2}}Signature · 1 line
2.17.1
Re: [PATCH -perfbook 04/11] Add \ignorespaces command to \IfEbookSize and \IfSansSerif
In reply to Paul E. McKenneyQuoted 16 lines · Paul E. McKenney
Quoted 15 lines · Akira Yokosawa
Using \IfEbookSize or \IfSansSerif macro in the middle of a paragraph can cause extra white spaces around it.
Fix this by adding the \ignorespaces command in their definitions.Also update the conditional text in styleguide.
As the other conditional macros aren't used in this manner, they are not modified for the moment.
Signed-off-by Akira Yokosawa <[email protected]>--- appendix/styleguide/styleguide.tex | 5 +++-- perfbook-lt.tex | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
Quoted 15 lines
appendix/styleguide/styleguide.tex namely \qco{$-$}.\footnote{This rule assumes that math mode uses the · line 1017
Quoted 12 lines
appendix/styleguide/styleguide.tex +2
-2@@ -1013,8 +1013,9 @@ namely \qco{$-$}.\footnote{This rule assumes that math mode uses the same upright glyph as text mode. Our default font choice meets the assumption. \IfSansSerif{ - One of the experimental targets ``1csf'' \emph{does} use a differnt font - for math mode figures as of October 2017.}{} + Experimental targets with sans-serif fonts such as + ``1csf'' and ``ebsf'' \emph{do} use a differnt fontI did s/differnt/different/ here. This looks like the sort of typo that I would make! ;-)
So, I made the typo way back in 2017.
A typo in a footnote in Style Guide is unlikely to be caught. ;-)
Thanks, Akira
Quoted 33 lines
Thanx, Paul
Quoted 30 lines
appendix/styleguide/styleguide.tex +1
-0+ for math mode figures as of August 2021.}{} } For example,perfbook-lt.tex +4
-2@@ -117,13 +117,15 @@ \newcommand{\IfHardCover}[2]{\ifthenelse{\boolean{hardcover}}{#1}{#2}} \newboolean{ebooksize} \setboolean{ebooksize}{false} -\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}{#1}{#2}} +\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{afourpaper} \setboolean{afourpaper}{false} \newcommand{\IfAfourPaper}[2]{\ifthenelse{\boolean{afourpaper}}{#1}{#2}} \newboolean{sansserif} \setboolean{sansserif}{false} -\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}{#1}{#2}} +\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{lmttforcode} \setboolean{lmttforcode}{true} \newcommand{\IfLmttForCode}[2]{\ifthenelse{\boolean{lmttforcode}}{#1}{#2}}Signature · 1 line
2.17.1
Re: [PATCH -perfbook 04/11] Add \ignorespaces command to \IfEbookSize and \IfSansSerif
Quoted 33 lines · Akira Yokosawa
Quoted 16 lines · Paul E. McKenney
Quoted 15 lines · Akira Yokosawa
Using \IfEbookSize or \IfSansSerif macro in the middle of a paragraph can cause extra white spaces around it.
Fix this by adding the \ignorespaces command in their definitions.Also update the conditional text in styleguide.
As the other conditional macros aren't used in this manner, they are not modified for the moment.
Signed-off-by Akira Yokosawa <[email protected]>--- appendix/styleguide/styleguide.tex | 5 +++-- perfbook-lt.tex | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)Quoted 15 lines
appendix/styleguide/styleguide.tex namely \qco{$-$}.\footnote{This rule assumes that math mode uses the · line 1017
Quoted 12 lines
appendix/styleguide/styleguide.tex +2
-2@@ -1013,8 +1013,9 @@ namely \qco{$-$}.\footnote{This rule assumes that math mode uses the same upright glyph as text mode. Our default font choice meets the assumption. \IfSansSerif{ - One of the experimental targets ``1csf'' \emph{does} use a differnt font - for math mode figures as of October 2017.}{} + Experimental targets with sans-serif fonts such as + ``1csf'' and ``ebsf'' \emph{do} use a differnt fontI did s/differnt/different/ here. This looks like the sort of typo that I would make! ;-)
Quoted 2 lines
So, I made the typo way back in 2017.
A typo in a footnote in Style Guide is unlikely to be caught. ;-)
To your point, I most certainly did not catch it! ;-)
But yes, I should have checked for the typo in the old line as well as the new line.
Thanx, Paul
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
appendix/styleguide/styleguide.tex +1
-0+ for math mode figures as of August 2021.}{} } For example,perfbook-lt.tex +4
-2@@ -117,13 +117,15 @@ \newcommand{\IfHardCover}[2]{\ifthenelse{\boolean{hardcover}}{#1}{#2}} \newboolean{ebooksize} \setboolean{ebooksize}{false} -\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}{#1}{#2}} +\newcommand{\IfEbookSize}[2]{\ifthenelse{\boolean{ebooksize}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{afourpaper} \setboolean{afourpaper}{false} \newcommand{\IfAfourPaper}[2]{\ifthenelse{\boolean{afourpaper}}{#1}{#2}} \newboolean{sansserif} \setboolean{sansserif}{false} -\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}{#1}{#2}} +\newcommand{\IfSansSerif}[2]{\ifthenelse{\boolean{sansserif}}% + {\ignorespaces#1\ignorespaces}{\ignorespaces#2\ignorespaces}} \newboolean{lmttforcode} \setboolean{lmttforcode}{true} \newcommand{\IfLmttForCode}[2]{\ifthenelse{\boolean{lmttforcode}}{#1}{#2}}Signature · 1 line
2.17.1
PATCH 5/11 datastruct: Use \tco{} inside inline enumerate list
In reply to Akira YokosawaInline enumerate lists (enumerate*) are confused by \co{} commands which have breakable symbols in their argument.
\tco{} is a workaround in this case (as is the case in tabular cells).
--- datastruct/datastruct.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
datastruct/datastruct.tex +2 -2
@@ -2077,8 +2077,8 @@ highly replicated. It is instead the \co{ht_bucket} structures we should focus on. There are two major opportunities for shrinking the \co{ht_bucket} structure: \begin{enumerate*}[(1)] -\item Placing the \co{->htb_lock} field in a low-order bit of one of the -\co{->htb_head} pointers and +\item Placing the \tco{->htb_lock} field in a low-order bit of one of the +\tco{->htb_head} pointers and \item Reducing the number of pointers required. \end{enumerate*}
Signature · 1 line
2.17.1
PATCH 6/11 periodcheck: Add colon-related checks
In reply to Akira YokosawaExcerpt of Paul's message:
Quoted 2 lines
If you have some preference, I can update the scripts to enforce it.
In this case, I prefer the simple British approach to that of my homeland, so please unconditionally capitalize after a colon.
(Instead of the American approach of doing so only if the word following the colon begins a complete sentence, which is not something I want to be checking manually, let alone via a script!)
This means colons should always come at the end of LaTeX source lines. Adding ":" to the existing regex in the check scripts can catch violations to this convention.
As colons can lead a numbered list of sentences/clauses/phrases, a colon-specific pattern is also added in cleverefcheck.pl.
Also add a couple of filters to ignore arguments of LaTeX macros such as \caption{}, \paragraph{}, and \co{}.
Also add a pattern to ignore arguments of \QuickQuizChapter and \OriginalPublished as these macros can't be broken in-between.
--- utilities/cleverefcheck.pl | 25 +++++++++++++++++------ utilities/periodcheck.pl | 42 +++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 25 deletions(-)
utilities/cleverefcheck.pl +19 -6
@@ -36,6 +36,13 @@ sub check_line { $line =~ s/$quoted_2//; } } + if ($line =~ /\\[tq]?co\{([^\}]+)\}/) {# remove \co{} argument + while ($line && $line =~ /((\\[tq]?co\{)[^\}]+)\}/) { + my $quoted_1 = quotemeta $1; + my $quoted_2 = quotemeta $2; + $line =~ s/$quoted_1/$quoted_2/; + } + } unless ($skip) { $safe = 1; if ($line =~ /^(?=[\s]*+[^%])[^%]*\\ref\{/ ||
@@ -54,9 +61,9 @@ sub check_line { } if ($line =~ /^\s*\\Cref/ || $line =~ /^\s*\\Cpageref/ || $line =~ /^\s*\\Clnref/) { - if ($new_sentence) { + if ($new_sentence == 1) { $safe = 1; - } else { + } elsif ($new_sentence == 0) { $safe = 0; } }
@@ -68,8 +75,14 @@ sub check_line { $safe = 1; } } - if ($new_sentence == 1) { - if ($line =~ /^\s*[a-z]/ ) { + if ($new_sentence) { + if ($line =~ /^\s*`*[a-z]/ || $line =~ /^\s*\\acr/ || + $line =~ /^\s*\\IX[^A\{]*\{[a-z]/ ) { + $safe = 0; + } + } + if ($new_sentence == 2) { # after colon + if ($line =~ /^\s*\([0-9a-z]\)[\s~][a-z]/ ) { $safe = 0; } }
@@ -87,14 +100,14 @@ sub check_line { unless ($line =~ /\\begin\{fcvref\}/ || $line =~ /\\end\{fcvref\}/ || $line =~ /^\s*\}\s*$/ || $line =~ /^\s*%/) { if ($line =~ /^(?=[\s]*+[^%])[^%]*[\.\?!]\s*[\)\}\']*\s*(%.*)?$/ || - $line =~ /^\s*$/ || + $line =~ /^\s*$/ || $line =~ /\\begin\{quote\}/ || $line =~ /^\\E?QuickQuiz[BEM]?\{/ || $line =~ /\\E?QuickQuizAnswer[BEM]?\{/ ) { $new_sentence = 1; } else { $new_sentence = 0; if ($line =~ /^(?=[\s]*+[^%])[^%]*:\s*[\)\}\']*\s*(%.*)?$/ ) { - $new_sentence = 2; # don't care + $new_sentence = 2; # colon } } }
utilities/periodcheck.pl +23 -19
78 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 7/11 cleverefcheck: Check lower-case word after \item
In reply to Akira YokosawaAlso detect raw "(1)" or "(a)" comes after a colon. Inline enumerate list should be used instead.
--- utilities/cleverefcheck.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
utilities/cleverefcheck.pl +4 -1
@@ -75,6 +75,9 @@ sub check_line { $safe = 1; } } + if ($line =~ /^(?=[\s]*+[^%])[^%]*^\s*\\item\s+[a-z]/ ) { + $safe = 0; + } if ($new_sentence) { if ($line =~ /^\s*`*[a-z]/ || $line =~ /^\s*\\acr/ || $line =~ /^\s*\\IX[^A\{]*\{[a-z]/ ) {
@@ -82,7 +85,7 @@ sub check_line { } } if ($new_sentence == 2) { # after colon - if ($line =~ /^\s*\([0-9a-z]\)[\s~][a-z]/ ) { + if ($line =~ /^\s*\([0-9a-z]+\)/ ) { $safe = 0; } }
Signature · 1 line
2.17.1
PATCH 8/11 periodcheck: Improve regex
In reply to Akira YokosawaAdd patterns to catch end-of-sentence punctuation marks in front of quotation marks and/or parentheses.
Also add patterns to treat lines ending with "\\" as exceptions.
Add autodate.tex to the exception list in periodcheck.sh.
--- utilities/periodcheck.pl | 17 +++++++++++------ utilities/periodcheck.sh | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)
utilities/periodcheck.pl +11 -6
@@ -60,9 +60,9 @@ sub check_line { } unless ($skip) { $safe = 1; - if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\.\?\!\:][\)\}\']*$/ || - $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\.\?\!\:]\\footnote/ || - $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}[\.\?\!\:][\)\}\']*$/ ) { + if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:][\)\}\']*$/ || + $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:]\\footnote/ || + $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ) { $safe = 0; if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ || $next_line =~ /\\item/ ||
@@ -72,9 +72,14 @@ sub check_line { $safe = 1; } } - if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z\}][\.\?\!][\)\}\']*\s[^\\]+/ || - $line =~ /^(?=[\s]*+[^%])[^%]*.*:[\)\}\']*\s[^\\]+/) { + if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+[^%]/ || +# $line =~ /^(?=[\s]*+[^%])[^%]*.*\.[\)\}\']*\s+[^%]/ || # Uncomment for full check + $line =~ /^(?=[\s]*+[^%])[^%]*.*:[\)\}\']*\s+[^%]/ ) { $safe = 0; + if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+\\\\/ || + $line =~ /^(?=[\s]*+[^%])[^%]*.*[\.:][\)\}\']*\s+\\\\/ ) { + $safe = 1; + } } if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) { $safe = 0;
@@ -82,7 +87,7 @@ sub check_line { $safe = 1; } } - if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^\s%]+/){ + if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){ $safe = 0; } unless ($safe) {
utilities/periodcheck.sh +1 -0
@@ -11,6 +11,7 @@ do ./glsdict.tex) ;; ./origpub.tex) ;; ./contrib.tex) ;; + ./autodate.tex) ;; ./future/HTMtable*) ;; ./appendix/styleguide*) ;; *) tex_sources="$tex_sources $f" ;;
Signature · 1 line
2.17.1
PATCH 9/11 periodcheck: Use counter to prevent false negatives
In reply to Akira YokosawaAssigning 1 to $safe in one rule can cause a false negative when there is earlier match(es) to violation pattern(s) on the same input line.
By using a counter and incrementing/decrementing it on a particular pattern-match, such false negatives can be prevented.
--- utilities/cleverefcheck.pl | 37 +++++++++++++++++-------------------- utilities/periodcheck.pl | 22 +++++++++++----------- 2 files changed, 28 insertions(+), 31 deletions(-)
utilities/cleverefcheck.pl +17 -20
@@ -17,7 +17,7 @@ my $line; my $new_sentence = 1; my $line_num = 0; my $skip = 0; -my $safe = 0; +my $ng = 0; my $Verbatim_begin = qr/\\begin\{(Verbatim|tabula|equation|SaveVerb|verbbox)/ ; my $Verbatim_end = qr/\\end\{(Verbatim|tabula|equation|SaveVerb|verbbox)/ ; my $label_ptn = qr/(^\s*|\{)(,?[a-z]{3,4}:([a-zMPS]+:)?[^\},]+)(\}|,)/ ;
@@ -44,56 +44,53 @@ sub check_line { } } unless ($skip) { - $safe = 1; + $ng = 0; if ($line =~ /^(?=[\s]*+[^%])[^%]*\\ref\{/ || $line =~ /^(?=[\s]*+[^%])[^%]*\\pageref\{/ || $line =~ /^(?=[\s]*+[^%])[^%]*\\lnref\{/) { - $safe = 0; + $ng += 1; if ($line =~ /or~\\lnref\{/ || $line =~ /item~\\ref\{/) { - $safe = 1; + $ng -= 1; } } - if ($new_sentence == 1 && + if ($new_sentence != 0 && ($line =~ /^\s*\\cref/ || $line =~ /^\s*\\cpageref/ || $line =~ /^\s*\\clnref/)) { - $safe = 0; + $ng += 1; } - if ($line =~ /^\s*\\Cref/ || $line =~ /^\s*\\Cpageref/ || - $line =~ /^\s*\\Clnref/) { - if ($new_sentence == 1) { - $safe = 1; - } elsif ($new_sentence == 0) { - $safe = 0; - } + if ($new_sentence == 0 && + ($line =~ /^\s*\\Cref/ || $line =~ /^\s*\\Cpageref/ || + $line =~ /^\s*\\Clnref/)) { + $ng += 1; } if ($line =~ /^(?=[\s]*+[^%])[^%]*[^\s]+\s*\\Cref/ || $line =~ /^(?=[\s]*+[^%])[^%]*[^\s]+\s*\\Cpageref/ || $line =~ /^(?=[\s]*+[^%])[^%]*[^\s]+\s*\\Clnref/) { - $safe = 0; + $ng += 1; if ($line =~ /^(?=[\s]*+[^%])[^%]*^\s*\\item\s+\\C/ ) { - $safe = 1; + $ng -= 1; } } if ($line =~ /^(?=[\s]*+[^%])[^%]*^\s*\\item\s+[a-z]/ ) { - $safe = 0; + $ng += 1; } if ($new_sentence) { if ($line =~ /^\s*`*[a-z]/ || $line =~ /^\s*\\acr/ || $line =~ /^\s*\\IX[^A\{]*\{[a-z]/ ) { - $safe = 0; + $ng += 1; } } if ($new_sentence == 2) { # after colon if ($line =~ /^\s*\([0-9a-z]+\)/ ) { - $safe = 0; + $ng += 1; } } if ($line =~ /^[ ]{8}/ || # indent by white speces (should be TAB) $line =~ /^(?=[\s]*+[^%])[^%][ ]+\t/) { # TAB after white space - $safe = 0; + $ng += 1; } - unless ($safe) { + if ($ng) { print $ARGV[0], ':', $line_num, ':', $raw_line; } }
utilities/periodcheck.pl +11 -11
@@ -26,7 +26,7 @@ my $line; my $next_line; my $line_num = 0; my $skip = 0; -my $safe = 0; +my $ng; my $Verbatim_begin = qr/\\begin\{(Verbatim|tabula|equation)/ ; my $Verbatim_end = qr/\\end\{(Verbatim|tabular|equation)/ ; my $label_ptn = qr/(^\s*|\{)(,?[a-z]{3,4}:([a-zMPS]+:)?[^\},]+)(\}|,)/ ;
@@ -59,38 +59,38 @@ sub check_line { $skip = 1; } unless ($skip) { - $safe = 1; + $ng = 0; if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:][\)\}\']*$/ || $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:]\\footnote/ || - $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ) { - $safe = 0; + $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?(f|fst)?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ) { + $ng += 1; if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ || $next_line =~ /\\item/ || $next_line =~ /\\E?QuickQuizAnswer[BEM]?\{/ || $next_line =~ /\\E?QuickQuizEnd[BEM]?/ || $next_line =~ /\\end\{(quot|enum|item|sequ)/ ) { - $safe = 1; + $ng -= 1; } } if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+[^%]/ || # $line =~ /^(?=[\s]*+[^%])[^%]*.*\.[\)\}\']*\s+[^%]/ || # Uncomment for full check $line =~ /^(?=[\s]*+[^%])[^%]*.*:[\)\}\']*\s+[^%]/ ) { - $safe = 0; + $ng += 1; if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+\\\\/ || $line =~ /^(?=[\s]*+[^%])[^%]*.*[\.:][\)\}\']*\s+\\\\/ ) { - $safe = 1; + $ng -= 1; } } if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) { - $safe = 0; + $ng += 1; if ($line =~ /^(?=[\s]*+[^%])[^%]*~\(\\cite/) { - $safe = 1; + $ng -= 1; } } if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){ - $safe = 0; + $ng += 1; } - unless ($safe) { + if ($ng) { print $ARGV[0], ':', $line_num, ':', $line_raw; } }
Signature · 1 line
2.17.1
PATCH 10/11 cleverefcheck: Add pattern to catch typo in indexing macros
In reply to Akira YokosawaThere were cases where custom macros for indexing such as \IX, \Acr, \IXacr, etc. lacked the "\" leading them.
Add patterns to catch such typo.
They rely on the leading parts of those macros are spelled right.
--- utilities/cleverefcheck.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
utilities/cleverefcheck.pl +8 -0
@@ -21,6 +21,10 @@ my $ng = 0; my $Verbatim_begin = qr/\\begin\{(Verbatim|tabula|equation|SaveVerb|verbbox)/ ; my $Verbatim_end = qr/\\end\{(Verbatim|tabula|equation|SaveVerb|verbbox)/ ; my $label_ptn = qr/(^\s*|\{)(,?[a-z]{3,4}:([a-zMPS]+:)?[^\},]+)(\}|,)/ ; +my $IX_ptn = qr/(^|\s+)IX[^\s\{]*{/ ; +my $api_ptn = qr/(^|\s+)api[^\s\{]*{/ ; +my $ppl_ptn = qr/(^|\s+)ppl[^\s\{]*{/ ; +my $acr_ptn = qr/(^|\s+)[aA]cr[^\s\{]*{/ ; my $in_footnote = 0 ; my $footnote_save = 0;
@@ -90,6 +94,10 @@ sub check_line { $line =~ /^(?=[\s]*+[^%])[^%][ ]+\t/) { # TAB after white space $ng += 1; } + if ($line =~ /$IX_ptn/ || $line =~ /$api_ptn/ || + $line =~ /$ppl_ptn/ || $line =~ /$acr_ptn/ ) { + $ng += 1; + } if ($ng) { print $ARGV[0], ':', $line_num, ':', $raw_line; }
Signature · 1 line
2.17.1
PATCH 11/11 Makefile: Rename periodcheck --> punctcheck
In reply to Akira YokosawaNow that periodcheck checks punctuation marks not limited to periods, rename it and use the name "punctcheck".
Note: "make periodcheck" is now an alias of "make punctcheck".
---
Makefile | 14 ++++++++------
utilities/{periodcheck.pl => punctcheck.pl} | 0
utilities/{periodcheck.sh => punctcheck.sh} | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
rename utilities/{periodcheck.pl => punctcheck.pl} (100%)
rename utilities/{periodcheck.sh => punctcheck.sh} (92%)Makefile +8 -6
@@ -191,9 +191,9 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: qq perfbook-qq.pdf qqmsg .PHONY: help help-official help-full help-semiofficial help-paper help-draft .PHONY: help-experimental help-prefixed -.PHONY: paper-clean periodcheck periodcheck-auto +.PHONY: paper-clean periodcheck punctcheck punctcheck-auto -all: periodcheck-auto +all: punctcheck-auto ifeq ($(MAKECMDGOALS),clean) else ifeq ($(MAKECMDGOALS),distclean)
@@ -610,13 +610,15 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f -periodcheck: - utilities/periodcheck.sh +punctcheck: + utilities/punctcheck.sh utilities/cleverefcheck.sh -periodcheck-auto: $(targ) - utilities/periodcheck.sh +punctcheck-auto: $(targ) + utilities/punctcheck.sh utilities/cleverefcheck.sh +periodcheck: punctcheck + .SECONDEXPANSION: $(ABBREVTARGETS): %: [email protected]
utilities/punctcheck.pl renamed from utilities/periodcheck.pl +0 -0
utilities/punctcheck.sh renamed from utilities/periodcheck.sh +1 -1
@@ -20,5 +20,5 @@ done for g in $tex_sources do - utilities/periodcheck.pl $g + utilities/punctcheck.pl $g done
Signature · 1 line
2.17.1