>From 8a66ba5902d512e0e5e9a2bea27b4542ff74b57d Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Fri, 21 Jul 2017 22:15:05 +0900 Subject: [PATCH v2 6/8] styleguide: Add example of grouping code snippets Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- appendix/styleguide/styleguide.tex | 79 +++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/appendix/styleguide/styleguide.tex b/appendix/styleguide/styleguide.tex index b04b62b..f84ade8 100644 --- a/appendix/styleguide/styleguide.tex +++ b/appendix/styleguide/styleguide.tex @@ -669,7 +669,84 @@ The floatrow package provides the features to do so.\footnote{ One problem of grouping figures might be the learning curve to do so.} -% TODO: Add example +For example, +Figures~\ref{fig:advsync:Message-Passing Litmus Test} +and~\ref{fig:advsync:Enforcing Order of Message-Passing Litmus Test} +can be grouped together as in +Listings~\ref{lst:app:styleguide:Message-Passing Litmus Test} +and~\ref{lst:app:styleguide:Enforcing Order of Message-Passing Litmus Test}. + +\begin{listing*}\RawFloats +{ \scriptsize +\begin{verbbox} + 1 C C-MP+o-wmb-o+o-o.litmus + 2 + 3 { + 4 } + 5 + 6 + 7 P0(int* x0, int* x1) { + 8 + 9 WRITE_ONCE(*x0, 2); +10 smp_wmb(); +11 WRITE_ONCE(*x1, 2); +12 +13 } +14 +15 P1(int* x0, int* x1) { +16 +17 int r2; +18 int r3; +19 +20 r2 = READ_ONCE(*x1); +21 r3 = READ_ONCE(*x0); +22 +23 } +24 +25 exists (1:r2=2 /\ 1:r3=0) +\end{verbbox} +} + \begin{floatrow}[2]\thisfloatsetup{style=ruled} + \floatbox{listing}[2.2in]{\caption{Message-Passing Litmus Test} + \label{lst:app:styleguide:Message-Passing Litmus Test}}{ + \theverbbox +} +{ \scriptsize +\begin{verbbox} + 1 C C-MP+o-wmb-o+o-rmb-o.litmus + 2 + 3 { + 4 } + 5 + 6 P0(int* x0, int* x1) { + 7 + 8 WRITE_ONCE(*x0, 2); + 9 smp_wmb(); +10 WRITE_ONCE(*x1, 2); +11 +12 } +13 +14 P1(int* x0, int* x1) { +15 +16 int r2; +17 int r3; +18 +19 r2 = READ_ONCE(*x1); +20 smp_rmb(); +21 r3 = READ_ONCE(*x0); +22 +23 } +24 +25 exists (1:r2=2 /\ 1:r3=0) +\end{verbbox} +} + \thisfloatsetup{style=ruled}\hspace{1em}% + \floatbox{listing}[2.2in]{\caption{Enforcing Order of Message\-/Passing Litmus Test} + \label{lst:app:styleguide:Enforcing Order of Message-Passing Litmus Test}}{ + \theverbbox +} + \end{floatrow} +\end{listing*} \subsubsection{Ruled Line in Table} \label{sec:app:styleguide:Ruled Line in Table} -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html