Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
* [PATCH 0/9] Update code snippet extraction scheme
@ 2018-09-23  7:21 Akira Yokosawa
  2018-09-23  7:22 ` [PATCH 1/9] fcvextract.pl: Use 'linelabel' env in extracted snippet Akira Yokosawa
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Akira Yokosawa @ 2018-09-23  7:21 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From df6459c699d373a247342b3a79d3bf7a239cfbe3 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 23 Sep 2018 09:16:20 +0900
Subject: [PATCH 0/9] Update code snippet extraction scheme

Hi Paul,

This patch set updates scripts to extract code snippet from
source files under CodeSamples/.

Patch #1 fixes fcvextract.pl to use "linelabel" environment in
extracted .fcv files.

Patches #2 through #5 add capability to handle code snippets
other than C. Patch #2 is a simple update with a bug fix to
handle source files under deep sub-directories. 

One major obstacle was the restriction of comments in .litmus
files.

    1) We can't add comments at the beginning nor the end of
       a litmus test.
    2) There are a few tokens and characters we can't use in
       comments, i.e. "exists" or "filter" as a token in
       comment is not accepted by herd7, "{" and "}" characters
       sometimes cause error, comments of the form "(*" -- "*)"
       are not allowed in the C-language part of litmus test.

I ended up using comments of the form "//...", which has been
supported by herdtools7.

Patches #3 and #4 work around the restriction.

Patch #5 prevents a side-effect of doing "make" under
CodeSamples/formal/herd, which will convert litmus tests under
CodeSamples/formal/litmus so that they can be fed into herd7,
and cause the converted tests to have redundant
"\begin[snippet]" meta commands.

Patch #6 adds an option "style=" to the meta command
\begin{snippet}, which can be used to specify which of
Verbetim{L/N/U} is to be emitted. It also adds pass-through
handling of other options.

Patch #7 is not an update to the scripts, but a tweak in
appearance of VerbatimN and VerbatimU environments so that
inline snippets will have frames around them. 

Patches #8 and #9 are examples of actually extracting snippets
from .sh and .litmus files.

Effect of patch #7 can be seen in Section 4.1 (below the 1st
paragraph) and in Section 4.2.1 (above Quick Quiz 4.6) after
applying the whole patch set.  If you don't like the change,
feel free to omit #7.

By this update, hopefully, the new scheme should be able to
cover 99 percent of snippets. Although the scripts lack
rigorous checks of unexpected inputs.

        Thanks, Akira

Akira Yokosawa (9):
  fcvextract.pl: Use 'linelabel' env in extracted snippet
  Update build scripts to support code snippets other than 'C'
  Add scripts and recipes to work around restriction of herdtools7
  reorder_ltms.pl: Enable further labeling in litmus test snippet
  Exclude meta command lines in .litmus -> .litmus.herd conversion
  fcvextract.pl: Support 'style=' option and pass through other options
  Enable 'single' frame around inline code snippets
  toolsoftrade: Example of extraction of snippet from parallel.sh
  future/formalregress: Example of extraction of snippet from .litmus
    file

 .gitignore                                         |   1 +
 .../formal/herd/C-SB+l-o-o-u+l-o-o-u-C.litmus      |   2 +
 CodeSamples/formal/herd/litmus2herd.sh             |   4 +-
 CodeSamples/toolsoftrade/parallel.sh               |  20 ++--
 Makefile                                           |  19 +++-
 future/formalregress.tex                           |  40 +------
 perfbook.tex                                       |   7 +-
 toolsoftrade/toolsoftrade.tex                      |  12 +--
 utilities/fcvextract.pl                            |  74 ++++++++++---
 utilities/gen_snippet_d.pl                         |  66 +++++++++++-
 utilities/reorder_ltms.pl                          | 117 +++++++++++++++++++++
 11 files changed, 281 insertions(+), 81 deletions(-)
 create mode 100755 utilities/reorder_ltms.pl

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-09-24  3:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-23  7:21 [PATCH 0/9] Update code snippet extraction scheme Akira Yokosawa
2018-09-23  7:22 ` [PATCH 1/9] fcvextract.pl: Use 'linelabel' env in extracted snippet Akira Yokosawa
2018-09-23  7:24 ` [PATCH 2/9] Update build scripts to support code snippets other than 'C' Akira Yokosawa
2018-09-23  7:26 ` [PATCH 3/9] Add scripts and recipes to work around restriction of herdtools7 Akira Yokosawa
2018-09-23  7:27 ` [PATCH 4/9] reorder_ltms.pl: Enable further labeling in litmus test snippet Akira Yokosawa
2018-09-23  7:29 ` [PATCH 5/9] Exclude meta command lines in .litmus -> .litmus.herd conversion Akira Yokosawa
2018-09-23  7:30 ` [PATCH 6/9] fcvextract.pl: Support 'style=' option and pass through other options Akira Yokosawa
2018-09-23  7:31 ` [PATCH 7/9] Enable 'single' frame around inline code snippets Akira Yokosawa
2018-09-23  7:32 ` [PATCH 8/9] toolsoftrade: Example of extraction of snippet from parallel.sh Akira Yokosawa
2018-09-23  7:34 ` [PATCH 9/9] future/formalregress: Example of extraction of snippet from .litmus file Akira Yokosawa
2018-09-23 21:44 ` [PATCH 0/9] Update code snippet extraction scheme Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox