Skip to contentSkip to conversation

debugging: Employ new scheme for code snippets

PATCH New Akira Yokosawa 1 participant 1 message Jan 16, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 debugging: Employ new scheme for code snippets

From 87259dba261e59aba91f5e9b7943274567b200dd Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 16 Jan 2019 23:03:58 +0900
Subject: [PATCH] debugging: Employ new scheme for code snippets

In sh/awk code, it is not possible to put inline comments on lines ending with "\". To avoid continuations, shorten variable names in datablows.sh.

As source files of snippets are searched under CodeSamples/, put a symbolic link to utilities/datablows.sh under CodeSamples/debugging.

"grep -r" doesn't follow symbolic links, so use the "-R" option instead.

---
Hi Paul,

Another snippet scheme update.

I'm wondering if you are OK with the shortening of variable names in datablows.sh. It looks like almost impossible to properly put a label as a comment to the line of the form:

awk -v divisor=$divisor -v relerr=$relerr \ <-- this line
-v trendbreak=$trendbreak '{

, while keeping the script executable.

Thoughts?

Thanks, Akira
--

 CodeSamples/debugging/datablows.sh |   1 +
 Makefile                           |   4 +-
 debugging/debugging.tex            | 196 +++++++++++++------------------------
 utilities/datablows.sh             |  60 ++++++------
 utilities/gen_snippet_d.pl         |   4 +-
 5 files changed, 105 insertions(+), 160 deletions(-)
 create mode 120000 CodeSamples/debugging/datablows.sh
CodeSamples/debugging/datablows.sh new file +1 -0
new file mode 120000
index 0000000..cd04dd2
@@ -0,0 +1 @@
+../../utilities/datablows.sh
\ No newline at end of file
Makefile +2 -2
index b76eea0..6ef4629 100644
@@ -83,8 +83,8 @@ A2PING_GSCNFL := 0
 endif
 endif
 
-SOURCES_OF_SNIPPET_ALL := $(shell grep -r -l -F '\begin{snippet}' CodeSamples)
-SOURCES_OF_LITMUS      := $(shell grep -r -l -F '\begin[snippet]' CodeSamples)
+SOURCES_OF_SNIPPET_ALL := $(shell grep -R -l -F '\begin{snippet}' CodeSamples)
+SOURCES_OF_LITMUS      := $(shell grep -R -l -F '\begin[snippet]' CodeSamples)
 SOURCES_OF_LTMS        := $(patsubst %.litmus,%.ltms,$(SOURCES_OF_LITMUS))
 SOURCES_OF_SNIPPET     := $(filter-out $(SOURCES_OF_LTMS),$(SOURCES_OF_SNIPPET_ALL)) $(SOURCES_OF_LITMUS)
 GEN_SNIPPET_D  = utilities/gen_snippet_d.pl utilities/gen_snippet_d.sh
debugging/debugging.tex +69 -127

264 lines not on this page · raw message

utilities/datablows.sh +31 -29

85 lines not on this page · raw message

utilities/gen_snippet_d.pl +2 -2
index e07e58d..580e5ca 100755
@@ -23,9 +23,9 @@ my $re;
 $snippet_key = '\begin{snippet}' ;
 $snippet_key_ltms = '\begin[snippet]' ;
 @ignore_re = ('\.swp$', '~$', '\#$') ;  # to ignore backup of vim and emacs
-@fcvsources = `grep -l -r -F '$snippet_key' CodeSamples` ;
+@fcvsources = `grep -l -R -F '$snippet_key' CodeSamples` ;
 @fcvsources = grep { not /\.ltms$/ } @fcvsources ;
-@fcvsources_ltms = `grep -l -r -F '$snippet_key_ltms' CodeSamples` ;
+@fcvsources_ltms = `grep -l -R -F '$snippet_key_ltms' CodeSamples` ;
 foreach $re (@ignore_re) {
     @fcvsources = grep { not /$re/ } @fcvsources ;
     @fcvsources_ltms = grep { not /$re/ } @fcvsources_ltms ;
Signature · 1 line
2.7.4