From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: perfbook@vger.kernel.org
Subject: Re: [NOT YET PULL v2] Trial of labeling lines in code snippets
Date: Wed, 1 Aug 2018 17:22:02 -0700 [thread overview]
Message-ID: <20180802002202.GQ24813@linux.vnet.ibm.com> (raw)
In-Reply-To: <f1f6800c-c53f-6b64-210e-7b8d8d8960b2@gmail.com>
On Thu, Aug 02, 2018 at 07:14:25AM +0900, Akira Yokosawa wrote:
> On 2018/08/01 08:59:39 -0700, Paul E. McKenney wrote:
> > On Thu, Aug 02, 2018 at 12:24:50AM +0900, Akira Yokosawa wrote:
> >> On 2018/07/31 08:10:27 -0700, Paul E. McKenney wrote:
> >>> On Tue, Jul 31, 2018 at 01:04:18AM +0900, Akira Yokosawa wrote:
> >>>> Hi Paul,
> >>>>
> >>>> This is v2 of the trial of fancyvrb scheme.
> >>>>
> >>>> ---
> >>>> 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-20180730a
> >>>>
> >>>> for you to fetch changes up to 3361b7331cf0f08a75bf6a9f69b7ea2f126e3b75:
> >>>
> >>> Looks very nice!
> >>>
> >>> So the effect of these are to establish a "label name environment"?
> >>>
> >>> \renewcommand{\lnlblbase}{ln:toolsoftrade:forkjoin:main}
> >>> \renewcommand{\lnrefbase}{ln:toolsoftrade:forkjoin:main}
> >>
> >> Yes.
> >> Another approach would be to define a *real* environment and
> >> enclose those parts where \lnref{} commands are used inside the
> >> environment.
> >>
> >> If we name the environment "lineref", the LaTeX source would
> >> look like:
> >>
> >> \begin{lineref}[ln:toolsoftrade:forkjoin:main]
> >> If \co{fork()} succeeds, it returns twice, once for the parent
> >> and again for the child.
> >> [...]
> >> Otherwise, the \co{fork()} has executed successfully, and the parent
> >> therefore executes line~\lnref{parent} with the variable \co{pid}
> >> containing the process ID of the child.
> >> \end{lineref}
> >>
> >> This might be clearer to see where the label-base string is
> >> effective.
> >>
> >> \lnlblbase could also have its own environment defined.
> >>
> >> I'll try this approach in v3 of this branch.
> >
> > That wasn't actually intended as a criticism, but I do agree that the
> > \begin-\end style is more clear. ;-)
>
> No, there was no way I took it as a criticism.
> Your mention of a "label name environment" was a cue for me to think
> "Why not make it a real environment". ;-)
Fair enough! ;-)
Thanx, Paul
> >> Thanks, Akira
> >>
> >>>
> >>> This is very good -- allows use of short names, but also avoids
> >>> managing a very large flat global namespace.
> >>>
> >>> Then the C++ comments containing the "snippet" commands automate
> >>> code extraction, plus those containing the "lnlbl" commands to
> >>> automate label generation.
> >>>
> >>> This looks extremely good to me. It makes it much easier to modify
> >>> the code and the discussion of that code.
> >>>
> >>> Any thoughts from others?
> >>>
> >>> Thanx, Paul
> >>>
> >>>> [EXP] Automate sub makefile update (2018-07-31 00:31:56 +0900)
> >>>>
> >>>> ----------------------------------------------------------------
> >>>> Akira Yokosawa (6):
> >>>> [EXP] toolsoftrade: Add labels in code samples as comments
> >>>> [EXP] Add script to extract code snippet from code sample
> >>>> [EXP] toolsoftrade: Reference line in code snippets by label
> >>>> [EXP] Update hyphen2endash
> >>>> [EXP] Add *.fcv to .gitignore
> >>>> [EXP] Automate sub makefile update
> >>>>
> >>>> .gitignore | 2 +
> >>>> CodeSamples/api-pthreads/api-pthreads.h | 18 ++--
> >>>> CodeSamples/toolsoftrade/forkjoinvar.c | 12 ++-
> >>>> CodeSamples/toolsoftrade/pcreate.c | 7 +-
> >>>> Makefile | 14 ++-
> >>>> perfbook.tex | 12 +++
> >>>> toolsoftrade/toolsoftrade.tex | 174 ++++++++++----------------------
> >>>> utilities/fcvextract.pl | 166 ++++++++++++++++++++++++++++++
> >>>> utilities/gen_snippet_mk.pl | 55 ++++++++++
> >>>> utilities/hyphen2endash.sh | 3 +
> >>>> 10 files changed, 322 insertions(+), 141 deletions(-)
> >>>> create mode 100755 utilities/fcvextract.pl
> >>>> create mode 100755 utilities/gen_snippet_mk.pl
> >>>>
> >>>> ---
> >>>>
> >>>> There are quite a few changes since v1:
> >>>>
> >>>> o Rebased to current master.
> >>>> o Use line label format of "ln:directory:filename:function:linelabel"
> >>>> o To avoid repetitive use of long labels in reference, introduce
> >>>> \lnlblbase and \lnrefbase macros. By this change, now \lnlbl{} and
> >>>> \lnref{} can have simple line labels.
> >>>> o Add a script to extract VerbatimL sources from code samples.
> >>>> o Add a script to generate sub makefile for snippet extraction.
> >>>> o Update Makefile accordingly.
> >>>>
> >>>> The scheme looks like to work for 90% of code snippets.
> >>>>
> >>>> TODO list for me to improve:
> >>>>
> >>>> o Support of code snippets other than "C".
> >>>> o Support option to meta command \begin{snippet} other than labelbase and
> >>>> commandchars.
> >>>> o Support of commandchars option with no escape charactor required
> >>>>
> >>>> If this looks ready for you to merge, I'll amend commit logs and
> >>>> add header comment to gen_snippets_mk.pl and send a proper pull request.
> >>>> Please try this branch and let me know what you think.
> >>>>
> >>>> Thanks, Akika
> >>>>
> >>>
> >>
> >
>
next prev parent reply other threads:[~2018-08-02 2:10 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 [this message]
2018-08-02 22:34 ` [GIT PULL v3] " Akira Yokosawa
2018-08-03 14:35 ` Paul E. McKenney
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=20180802002202.GQ24813@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