Skip to contentSkip to conversation

Add script to check period spacing

PATCH Superseded Akira Yokosawa 1 participant 4 messages Apr 27, 2021 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add script to check period spacing

Hi Paul,

This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.

Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.

After Patch 9/9 is applied, "make periodcheck" will be clean.

I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.

Thanks, Akira
--
Akira Yokosawa (9):
Annotate mid-sentence and end-of-sentence periods
periodcheck: Add script to check missing annotation of period
periodcheck: Add check of nbsp in front of \cite{}
periodcheck: Improve label string matching
periodcheck: Replace escaped percent symbol first
treewide: Make end-of-sentence periods be at end of lines
styleguide: Make end-of-sentence periods be at the end of lines
treewide: Fix space in front of \cite{}
treewide: Substitute ';' for ',' in label strings

 Makefile                             |   5 +-
 SMPdesign/SMPdesign.tex              |  36 ++--
 SMPdesign/beyond.tex                 |  15 +-
 SMPdesign/criteria.tex               |   4 +-
 SMPdesign/partexercises.tex          |  12 +-
 ack.tex                              |   2 +-
 advsync/rt.tex                       |   7 +-
 appendix/styleguide/styleguide.tex   | 237 +++++++++++++++------------
 appendix/whymb/whymemorybarriers.tex |  71 ++++----
 count/count.tex                      |  11 +-
 cpu/hwfreelunch.tex                  |   2 +-
 datastruct/datastruct.tex            |  55 ++++---
 debugging/debugging.tex              |  16 +-
 defer/defer.tex                      |   4 +-
 defer/hazptr.tex                     |   7 +-
 defer/rcuapi.tex                     |   4 +-
 defer/rcufundamental.tex             |   5 +-
 defer/refcnt.tex                     |   4 +-
 easy/easy.tex                        |   3 +-
 formal/dyntickrcu.tex                |  15 +-
 formal/ppcmem.tex                    | 184 +++++++++++----------
 formal/spinhint.tex                  | 148 +++++++++--------
 glossary.tex                         |   9 +-
 howto/howto.tex                      |   2 +-
 intro/intro.tex                      |  33 ++--
 legal.tex                            |   9 +-
 locking/locking.tex                  |   5 +-
 memorder/memorder.tex                |  12 +-
 owned/owned.tex                      |   5 +-
 together/refcnt.tex                  |   4 +-
 toolsoftrade/toolsoftrade.tex        |   9 +-
 utilities/periodcheck.pl             |  87 ++++++++++
 utilities/periodcheck.sh             |  23 +++
 33 files changed, 627 insertions(+), 418 deletions(-)
 create mode 100755 utilities/periodcheck.pl
 create mode 100755 utilities/periodcheck.sh
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/9 Annotate mid-sentence and end-of-sentence periods

From ae551669fa11abdeebd8f4b99d49dfc59866398a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 23 Apr 2021 10:23:18 +0900
Subject: [PATCH -perfbook 1/9] Annotate mid-sentence and end-of-sentence periods

These were caught by the check script to be added in the following updates.

---
 ack.tex             | 2 +-
 advsync/rt.tex      | 2 +-
 howto/howto.tex     | 2 +-
 locking/locking.tex | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
ack.tex +1 -1
index b8cffa37..ce64d325 100644
@@ -126,4 +126,4 @@ organizations that keep Internet and the World Wide Web up and running,
 and this one is no exception.
 
 Portions of this material are based upon work supported by the National
-Science Foundation under Grant No. CNS-0719851.
+Science Foundation under Grant No.\@ CNS-0719851.
advsync/rt.tex +1 -1
index bb8465ff..71ab0661 100644
@@ -573,7 +573,7 @@ as depicted in
 \cref{fig:advsync:Real-Time Reflexes}.
 The hard real-time reflexes, which read from sensors and control
 actuators, run real-time on a single CPU or on special-purpose hardware
-such as an FPGA.
+such as an FPGA\@.
 The non-real-time strategy and planning portion of the application runs
 on the remaining CPUs.
 Strategy and planning activities might include statistical analysis,
howto/howto.tex +1 -1
index c3d0a101..0f0ba293 100644
@@ -304,7 +304,7 @@ Fortunately, there are many alternatives available to you:
 	\pplsur{Victor}{Luchangco}, and \pplsur{Michael}{Spear} did
 	catch up in their second edition by adding short sections on
 	hazard pointers and on \acr{rcu}, with the latter in the guise
-	of \acr{ebr}.
+	of \acr{ebr}\@.
 	They also include a brief history of both, albeit with an
 	abbreviated history of \acr{rcu} that picks up almost a year after
 	it was accepted into the Linux kernel and more than 20~years
locking/locking.tex +1 -1
index 5313f926..6bc93e49 100644
@@ -713,7 +713,7 @@ outside of a signal handler without blocking signals.
 	handler without blocking signals, a signal might be handled while
 	holding this lock.
 	The corresponding signal handler might then acquire
-	Lock~B, so that Lock~B is acquired while holding Lock~A.
+	Lock~B, so that Lock~B is acquired while holding Lock~A\@.
 	Therefore, if we also acquire Lock~A while holding Lock~B,
 	we will have a deadlock cycle.
 	Note that this problem exists even if signals are blocked while
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/9 periodcheck: Add script to check missing annotation of period

In reply to Akira Yokosawa

"make periodcheck" will do the check.

NOTE: Possible false negative/positive as of this commit:
o A mid-sentence period is ignored when the line matches "\label{"
or "\*ref{" pattern. It should be caught when it is outside a macro.
o \cref{} can have comma-separated multiple labels as an argument.
When one of the labels has a mid-sentence period and on a subsequent line in the input, it is not ignored.
o \crefrange{}{} can also have a label string on a subsequent line.

---
 Makefile                 |  5 ++-
 utilities/periodcheck.pl | 76 ++++++++++++++++++++++++++++++++++++++++
 utilities/periodcheck.sh | 20 +++++++++++
 3 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100755 utilities/periodcheck.pl
 create mode 100755 utilities/periodcheck.sh
Makefile +4 -1
index 4beb2c17..ea264dc5 100644
@@ -192,7 +192,7 @@ 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
+.PHONY: paper-clean periodcheck
 
 all: $(targ)
 
@@ -611,5 +611,8 @@ ls-unused:
 neatfreak: distclean
 	find . -name '*.pdf' | xargs rm -f
 
+periodcheck:
+	utilities/periodcheck.sh
+
 .SECONDEXPANSION:
 $(ABBREVTARGETS): %: [email protected]
utilities/periodcheck.pl new file +76 -0

76 lines not on this page · raw message

utilities/periodcheck.sh new file +20 -0
new file mode 100755
index 00000000..a56657f3
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+tex_sources_all=`find . -name "*.tex" -print`
+tex_sources=""
+
+for f in $tex_sources_all
+do
+	case $f in
+	./perfbook*) ;;
+	./qqz*) ;;
+	./future/HTMtable*) ;;
+	./appendix/styleguide*) ;;
+	*) tex_sources="$tex_sources $f" ;;
+        esac
+done
+
+for g in $tex_sources
+do
+	utilities/periodcheck.pl $g
+done
Signature · 1 line
2.17.1