Skip to contentSkip to conversation

toolsoftrade: Use description list

PATCH In review Akira Yokosawa 2 participants 3 messages Apr 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toolsoftrade: Use description list

In toolsoftrade, there are quite a few descriptions presented by using \subsubsection{} and \bf commands.

Description lists are more suited for those places.

Convert them into description lists.

For a couple of floating code snippets defined inside lists, where some parameters of vertical space differ slightly, add an alternative environment named VerbatimLL and use it.

---
Hi Paul,

As I said earlier, there are places where description lists can be applied.

How do they look to your eyes ?

I didn't want to add the VerbatimLL environment, but at least it works.

I think you'd like to indent items in those lists for coding style consistency. I can do so in a follow-up patch if you prefer.

Patch 2/2 will adjust section structure.

Thanks, Akira
--

 perfbook-lt.tex               |   3 +
 toolsoftrade/toolsoftrade.tex | 105 +++++++++++++++++-----------------
 2 files changed, 55 insertions(+), 53 deletions(-)
perfbook-lt.tex +3 -0
index 7239d2350477..cdac9d495a3a 100644
@@ -343,6 +343,9 @@
 \DefineVerbatimEnvironment{VerbatimL}{Verbatim}%
 {numbers=left,numbersep=5pt,xleftmargin=9pt}
 \AfterEndEnvironment{VerbatimL}{\vspace*{-9pt}}
+\DefineVerbatimEnvironment{VerbatimLL}{Verbatim}% for snippet inside list
+{numbers=left,numbersep=5pt,xleftmargin=9pt}
+\AfterEndEnvironment{VerbatimLL}{\vspace*{-5pt}}
 \DefineVerbatimEnvironment{VerbatimN}{Verbatim}%
 {numbers=left,numbersep=3pt,xleftmargin=5pt,xrightmargin=5pt,frame=single}
 \DefineVerbatimEnvironment{VerbatimU}{Verbatim}%
toolsoftrade/toolsoftrade.tex +52 -53

344 lines not on this page · raw message

base-commit: 852cb0657feeb6edef0aec191b104f19d90d8b00

Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 toolsoftrade: Add section titles of 'API Members'

For proper document structure, add section titles to the converted description lists.

Amend preceding sentences as well.

---
 toolsoftrade/toolsoftrade.tex | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
toolsoftrade/toolsoftrade.tex +8 -2
index ea65d6b99b29..5a38d957c19f 100644
@@ -1262,7 +1262,7 @@ which includes program counter and stack.
 
 The thread API is shown in
 \cref{lst:toolsoftrade:Thread API}, and members are described in the
-following sections.
+following section.
 
 \begin{listing}
 \begin{VerbatimL}[numbers=none,xleftmargin=2pt]
@@ -1277,6 +1277,8 @@ void wait_all_threads(void)
 \label{lst:toolsoftrade:Thread API}
 \end{listing}
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 \item[\tco{create_thread()}]
 The \apipf{create_thread()} primitive creates a new thread,
@@ -1389,7 +1391,7 @@ as in this case they are all \co{NULL}, which is not very interesting.
 
 A good starting subset of the Linux kernel's locking API is shown in
 \cref{lst:toolsoftrade:Locking API},
-each API element being described in the following sections.
+each API element being described in the following section.
 This book's CodeSamples locking API closely follows that of the Linux kernel.
 
 \begin{listing}
@@ -1403,6 +1405,8 @@ void spin_unlock(spinlock_t *sp);
 \label{lst:toolsoftrade:Locking API}
 \end{listing}
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 
 \item[\tco{spin_lock_init()}]
@@ -2524,6 +2528,8 @@ init_per_thread(name, v)
 	not they were C static variables!
 }\QuickQuizEnd
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 \item[\tco{DEFINE_PER_THREAD()}]
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH -perfbook 2/2] toolsoftrade: Add section titles of 'API Members'

Quoted 6 lines · Akira Yokosawa

For proper document structure, add section titles to the converted description lists.

Amend preceding sentences as well.

Looks good, queued both, thank you!

Thanx, Paul

Quoted 57 lines
---
 toolsoftrade/toolsoftrade.tex | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
toolsoftrade/toolsoftrade.tex +8 -2
index ea65d6b99b29..5a38d957c19f 100644
@@ -1262,7 +1262,7 @@ which includes program counter and stack.
 
 The thread API is shown in
 \cref{lst:toolsoftrade:Thread API}, and members are described in the
-following sections.
+following section.
 
 \begin{listing}
 \begin{VerbatimL}[numbers=none,xleftmargin=2pt]
@@ -1277,6 +1277,8 @@ void wait_all_threads(void)
 \label{lst:toolsoftrade:Thread API}
 \end{listing}
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 \item[\tco{create_thread()}]
 The \apipf{create_thread()} primitive creates a new thread,
@@ -1389,7 +1391,7 @@ as in this case they are all \co{NULL}, which is not very interesting.
 
 A good starting subset of the Linux kernel's locking API is shown in
 \cref{lst:toolsoftrade:Locking API},
-each API element being described in the following sections.
+each API element being described in the following section.
 This book's CodeSamples locking API closely follows that of the Linux kernel.
 
 \begin{listing}
@@ -1403,6 +1405,8 @@ void spin_unlock(spinlock_t *sp);
 \label{lst:toolsoftrade:Locking API}
 \end{listing}
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 
 \item[\tco{spin_lock_init()}]
@@ -2524,6 +2528,8 @@ init_per_thread(name, v)
 	not they were C static variables!
 }\QuickQuizEnd
 
+\subsubsection{API Members}
+
 \begin{description}[style=nextline]
 \item[\tco{DEFINE_PER_THREAD()}]
 
Signature · 1 line
2.25.1