Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: perfbook@vger.kernel.org
Subject: Re: [GIT PULL v3] Trial of labeling lines in code snippets
Date: Fri, 3 Aug 2018 07:35:57 -0700	[thread overview]
Message-ID: <20180803143557.GA24813@linux.vnet.ibm.com> (raw)
In-Reply-To: <18fcce90-11d6-4ab1-c6fc-73791a305091@gmail.com>

On Fri, Aug 03, 2018 at 07:34:51AM +0900, Akira Yokosawa wrote:
> Hi Paul,
> 
> This is v3 of the trial of fancyvrb scheme.
> 
> Changes in v2 -> v3
> 
>     o Define "linelabel" and "lineref" environments and use them in the early part of
>       toolsoftrade.
>     o Define "VerbatimU" env for short snippet with no line count and use it for
>       a couple of snippet in toolsoftrade.
>     o Rename "VerbatimM" to "VerbatimN".
>     o Remove "[EXP]" in commit log titles.
> 
>           Thanks, Akira
> 
> ---
> The following changes since commit 3b62f67a76e15f8d8f8190a4252362d4ac0cdf23:
> 
>   Regenerating the atomic counter graph on a more modern CPU (2018-07-23 13:47:51 -0700)
> 
> are available in the git repository at:
> 
>   https://github.com/akiyks/perfbook.git trial-fancyvrb-20180802a
> 
> for you to fetch changes up to 6bf7a51b7b9dadf54a0b1edc8959fafed0fcf671:
> 
>   Add 'linelabel' and 'lineref' environment (2018-08-03 07:21:49 +0900)
> 
> ----------------------------------------------------------------
> Akira Yokosawa (9):
>       toolsoftrade: Add labels in code samples as comments
>       Add script to extract code snippet from code sample
>       toolsoftrade: Reference line in code snippets by label
>       Update hyphen2endash
>       Add *.fcv to .gitignore
>       Automate sub makefile update
>       Specify lmtt font for VerbatimM env
>       toolsoftrade: Use \lnlbl in inline code snippet
>       Add 'linelabel' and 'lineref' environment
> 
>  .gitignore                              |   2 +
>  CodeSamples/api-pthreads/api-pthreads.h |  18 +--
>  CodeSamples/toolsoftrade/forkjoinvar.c  |  12 +-
>  CodeSamples/toolsoftrade/pcreate.c      |   7 +-
>  Makefile                                |  14 ++-
>  perfbook.tex                            |  21 ++++
>  toolsoftrade/toolsoftrade.tex           | 211 +++++++++++---------------------
>  utilities/fcvextract.pl                 | 166 +++++++++++++++++++++++++
>  utilities/gen_snippet_mk.pl             |  55 +++++++++
>  utilities/hyphen2endash.sh              |   3 +
>  10 files changed, 351 insertions(+), 158 deletions(-)
>  create mode 100755 utilities/fcvextract.pl
>  create mode 100755 utilities/gen_snippet_mk.pl

Looks nice!

However, I tried updating a label in CodeSamples/toolsoftrade/forkjoinvar.c
like this (and yes, this is a nonsensical change just for testing):

------------------------------------------------------------------------

diff --git a/CodeSamples/toolsoftrade/forkjoinvar.c b/CodeSamples/toolsoftrade/forkjoinvar.c
index 1580478fe2f9..642451d9e880 100644
--- a/CodeSamples/toolsoftrade/forkjoinvar.c
+++ b/CodeSamples/toolsoftrade/forkjoinvar.c
@@ -35,11 +35,11 @@ int main(int argc, char *argv[])
 	if (pid == 0) { /* child */
 		x = 1;					//\lnlbl{setx}
 		printf("Child process set x=1\n");	//\lnlbl{print:c}
-		exit(EXIT_SUCCESS);			//\lnlbl{exit:s}
+		exit(EXIT_SUCCESS);
 	}
 	if (pid < 0) { /* parent, upon error */
 		perror("fork");
-		exit(EXIT_FAILURE);
+		exit(EXIT_FAILURE);			//\lnlbl{exit:s}
 	}

 	/* parent */

------------------------------------------------------------------------

When I typed "make", I got this:

------------------------------------------------------------------------

$ make
sh utilities/autodate.sh >autodate.tex
./utilities/gen_snippet_mk.pl > CodeSamples/snippets.mk
Use of uninitialized value $_ in substitution (s///) at ./utilities/gen_snippet_mk.pl line 47.
Use of uninitialized value $_ in concatenation (.) or string at ./utilities/gen_snippet_mk.pl line 48.
echo > qqz.tex
echo > contrib.tex
echo > origpub.tex
make -C CodeSamples -f snippets.mk
make[1]: Entering directory `/home/git/perfbook/CodeSamples'
 --> toolsoftrade/toolsoftrade.fcv
 Use of uninitialized value $extract_labelbase in concatenation (.) or string at ../utilities/fcvextract.pl line 115.
 make[1]: *** [toolsoftrade/toolsoftrade.fcv] Error 1
 make[1]: Leaving directory `/home/git/perfbook/CodeSamples'
 make: *** [perfbook_flat.tex] Error 2

------------------------------------------------------------------------

I typed "make" again and no errors.  Plus it did update as I expected it
to.  And when I changed it back, it built the first time without errors.

Do I perhaps have a shortcoming in my (admittedly ancient) environment?
Or is this something that happens the first time the new functionality
is exercised on a change?

But even so, this is -way- more convenient than my old approach of doing
all the changes by hand!!!

							Thanx, Paul


  reply	other threads:[~2018-08-03 16:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-21  0:19 [NOT YET PULL] Trial of labeling lines in code snippets Akira Yokosawa
2018-07-21 16:51 ` Paul E. McKenney
2018-07-22 15:43   ` Akira Yokosawa
2018-07-22 22:49     ` Paul E. McKenney
2018-07-23 15:09       ` Akira Yokosawa
2018-07-23 15:12         ` Akira Yokosawa
2018-07-23 21:03           ` Paul E. McKenney
2018-07-30 16:04 ` [NOT YET PULL v2] " Akira Yokosawa
2018-07-31 15:10   ` Paul E. McKenney
2018-08-01 15:24     ` Akira Yokosawa
2018-08-01 15:59       ` Paul E. McKenney
2018-08-01 22:14         ` Akira Yokosawa
2018-08-02  0:22           ` Paul E. McKenney
2018-08-02 22:34 ` [GIT PULL v3] " Akira Yokosawa
2018-08-03 14:35   ` Paul E. McKenney [this message]
2018-08-03 15:02     ` Akira Yokosawa
2018-08-03 15:49     ` Akira Yokosawa
2018-08-03 16:45       ` Paul E. McKenney
2018-08-03 23:12         ` Akira Yokosawa
2018-08-03 23:43           ` Paul E. McKenney
2018-08-04  0:00             ` Akira Yokosawa
2018-08-04 11:57 ` [GIT PULL v4] " Akira Yokosawa
2018-08-04 15:15   ` Akira Yokosawa
2018-08-05  0:06 ` [GIT PULL v5] " Akira Yokosawa
2018-08-05 16:35   ` Paul E. McKenney
2018-08-05 16:54     ` Paul E. McKenney
2018-08-05 21:58       ` Akira Yokosawa
2018-08-05 22:47         ` Paul E. McKenney
2018-08-05 23:26           ` Akira Yokosawa
2018-08-05 23:40             ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803143557.GA24813@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akiyks@gmail.com \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox