Skip to contentSkip to conversation

Add scripts to check 'verbbox' env usage

PATCH Superseded Akira Yokosawa 2 participants 8 messages Sep 12, 2016 – Sep 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add scripts to check 'verbbox' env usage

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 100 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +29 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;

utilities/verbboxcheck.pl line 39

Quoted 10 lines
utilities/verbboxcheck.pl new file +10 -0
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Thanx, Paul

Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#2 lore raw
Quoted 106 lines · Paul E. McKenney
Quoted 105 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +34 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
Quoted 8 lines

utilities/verbboxcheck.pl line 39

Quoted 5 lines
utilities/verbboxcheck.pl new file +5 -0
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Ah, this should have been

+while($line_now) {
+ if ($in_figure) {

Also, there remain unnecessary variables I used in a preliminary version. I'm sending a v2 of the patch. Hope it makes more sense.

Thanks, Akira

Quoted 28 lines

Thanx, Paul

Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#3 lore raw
Quoted 121 lines · Akira Yokosawa
Quoted 106 lines · Paul E. McKenney
Quoted 105 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +34 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
Quoted 8 lines

utilities/verbboxcheck.pl line 39

Quoted 5 lines
utilities/verbboxcheck.pl new file +5 -0
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Ah, this should have been

(quoted diff) +2 -0
+while($line_now) {
+    if ($in_figure) {
Quoted 2 lines

Also, there remain unnecessary variables I used in a preliminary version. I'm sending a v2 of the patch. Hope it makes more sense.

OK, please color me confused. Don't you want to list the occurrences of \theverbbox that are -not- within a figure?

Thanx, Paul

Quoted 26 lines
Quoted 25 lines
Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#4 lore raw
Quoted 119 lines · Paul E. McKenney
Quoted 118 lines · Akira Yokosawa
Quoted 106 lines · Paul E. McKenney
Quoted 105 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +34 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
Quoted 8 lines

utilities/verbboxcheck.pl line 39

Quoted 5 lines
utilities/verbboxcheck.pl new file +5 -0
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Ah, this should have been

Quoted 8 lines
Quoted 5 lines
(quoted diff) +2 -0
+while($line_now) {
+    if ($in_figure) {

Also, there remain unnecessary variables I used in a preliminary version. I'm sending a v2 of the patch. Hope it makes more sense.

OK, please color me confused. Don't you want to list the occurrences of \theverbbox that are -not- within a figure?

Well, I intentionally chose the \begin{figure} lines.
As you can see in the diff of commit 510b6afde7fb ("toyrcu: Enclose 'verbbox' within 'figure'"), we need to move the \begin{figure} lines. By listing them, we can directly jump to a line to be moved in a text editor.
Doesn't this make sense?
Maybe I need to rephrase the commit message and comment in the script to explain the intention.

By the way, I made a typo in the commit message of 510b6afde7fb.

The first sentence reads

Quoted 2 lines

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.

This should have been

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph to be lost.

If it isn't too late, can you amend the commit message?

Thanks, Akira

Quoted 31 lines

Thanx, Paul

Quoted 26 lines
Quoted 25 lines
Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#5 lore raw
Quoted 129 lines · Akira Yokosawa
Quoted 119 lines · Paul E. McKenney
Quoted 118 lines · Akira Yokosawa
Quoted 106 lines · Paul E. McKenney
Quoted 105 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +34 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
Quoted 8 lines

utilities/verbboxcheck.pl line 39

Quoted 5 lines
utilities/verbboxcheck.pl new file +5 -0
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Ah, this should have been

Quoted 8 lines
Quoted 5 lines
(quoted diff) +2 -0
+while($line_now) {
+    if ($in_figure) {

Also, there remain unnecessary variables I used in a preliminary version. I'm sending a v2 of the patch. Hope it makes more sense.

OK, please color me confused. Don't you want to list the occurrences of \theverbbox that are -not- within a figure?

Quoted 8 lines

Well, I intentionally chose the \begin{figure} lines.
As you can see in the diff of commit 510b6afde7fb ("toyrcu: Enclose 'verbbox' within 'figure'"), we need to move the \begin{figure} lines. By listing them, we can directly jump to a line to be moved in a text editor.
Doesn't this make sense?
Maybe I need to rephrase the commit message and comment in the script to explain the intention.

You know, I am just going to assume that I am suffering from jet lag. I pulled v2 of your patch, fixed the whitespace error, and pushed it out.

But if anyone complains about these scripts, I am sending them straight to you. ;-)

Quoted 7 lines

By the way, I made a typo in the commit message of 510b6afde7fb.

The first sentence reads

Quoted 2 lines

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.

Quoted 6 lines

This should have been

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph to be lost.

If it isn't too late, can you amend the commit message?

Done and pushed. But yes, you got lucky. I have been making changes on another branch. ;-)

Thanx, Paul

Quoted 33 lines

Thanks, Akira

Quoted 31 lines

Thanx, Paul

Quoted 26 lines
Quoted 25 lines
Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#6 lore raw
Quoted 139 lines · Paul E. McKenney
Quoted 129 lines · Akira Yokosawa
Quoted 119 lines · Paul E. McKenney
Quoted 118 lines · Akira Yokosawa
Quoted 106 lines · Paul E. McKenney
Quoted 105 lines · Akira Yokosawa
Quoted 1 line

From 177cdd60c2cfe8798547ad260bb821feeb896133 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..2801bf1
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +34 -0
new file mode 100644
index 0000000..976a41f
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# Check usage pattern of "verbbox" environment
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+my $line_now;
+my $line_prev;
+my $line_prev_prev;
+my $in_figure = 0;
+my $interval = 0;
+my $line_num;
+my $fig_line;
+my $fig_line_num;
+my $infile = $ARGV[0];
+
+$line_prev_prev = <>;
+$line_prev = <>;
Quoted 8 lines

utilities/verbboxcheck.pl line 39

Quoted 5 lines
utilities/verbboxcheck.pl new file +5 -0
+$line_now = <>;
+$line_num = 3;
+
+while($line_now) {
+    if ($in_figure == 1) {

Doesn't this need to be not-equal rather than equal? Or is the fact that I haven't written perl for 20 years becoming apparent? ;-)

Ah, this should have been

Quoted 8 lines
Quoted 5 lines
(quoted diff) +2 -0
+while($line_now) {
+    if ($in_figure) {

Also, there remain unnecessary variables I used in a preliminary version. I'm sending a v2 of the patch. Hope it makes more sense.

OK, please color me confused. Don't you want to list the occurrences of \theverbbox that are -not- within a figure?

Quoted 8 lines

Well, I intentionally chose the \begin{figure} lines.
As you can see in the diff of commit 510b6afde7fb ("toyrcu: Enclose 'verbbox' within 'figure'"), we need to move the \begin{figure} lines. By listing them, we can directly jump to a line to be moved in a text editor.
Doesn't this make sense?
Maybe I need to rephrase the commit message and comment in the script to explain the intention.

Quoted 5 lines

You know, I am just going to assume that I am suffering from jet lag. I pulled v2 of your patch, fixed the whitespace error, and pushed it out.

But if anyone complains about these scripts, I am sending them straight to you. ;-)

Alright!
And I missed the whitespece error. My bad.

Quoted 10 lines
Quoted 10 lines

By the way, I made a typo in the commit message of 510b6afde7fb.

The first sentence reads

Quoted 2 lines

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.

This should have been

Quoted 7 lines
Quoted 4 lines

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph to be lost.

If it isn't too late, can you amend the commit message?

Done and pushed. But yes, you got lucky. I have been making changes on another branch. ;-)

Thank you so much.

And I'm sending a pull request of the other modification to enclose "verbbox" withing "figure" env. It's somewhat large, but utilities/doverbboxcheck.sh would be of your help I hope (as long as you trust the script...)

Many thanks, Akira

Quoted 38 lines

Thanx, Paul

Quoted 33 lines

Thanks, Akira

Quoted 31 lines

Thanx, Paul

Quoted 26 lines
Quoted 25 lines
Quoted 23 lines
utilities/verbboxcheck.pl new file +20 -0
+	if ($line_now =~ /\\theverbbox/) {
+	    print "$infile:$fig_line_num:$fig_line";
+	    $in_figure = 0;
+	}
+	$interval++;
+    }
+    if ($line_now =~ /\\begin\{figure\}/) {
+	$in_figure = 1;
+	$fig_line = $line_now;
+	$fig_line_num = $line_num;
+    }
+    if ($interval > 3) {
+	$in_figure = 0;
+	$interval = 0;
+    }
+    $line_prev_prev = $line_prev;
+    $line_prev = $line_now;
+    $line_now = <>;
+    $line_num++;
+}
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 1/1 Add scripts to check 'verbbox' env usage

In reply to Akira Yokosawa

From 376bd195eeb599184f5e12e6f109f88cfc19ee94 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 12 Sep 2016 23:39:22 +0900
Subject: [PATCH v2] Add scripts to check 'verbbox' env usage

This commit adds scripts to search modification candidates for enclosing "verbbox" environment within "figure" environment.

At the top of perfbook directory, the command

$ sh utilities/doverbboxcheck.sh

will show \begin{figure} statements to be moved ahead of "verbbox" environment.

---
 utilities/doverbboxcheck.sh | 36 +++++++++++++++++++++++++++++++
 utilities/verbboxcheck.pl   | 52 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100644 utilities/doverbboxcheck.sh
 create mode 100644 utilities/verbboxcheck.pl
utilities/doverbboxcheck.sh new file +36 -0
new file mode 100644
index 0000000..cda60f0
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Apply verbboxcheck.pl for all .tex files
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <[email protected]>
+
+# check if companion script exists
+if ! test -e utilities/verbboxcheck.pl
+then
+	echo "utilities/verrboxcheck.pl not found."
+	exit 1
+fi
+texfiles=`find . -name '*.tex' -print`
+for i in $texfiles
+do
+	basename="${i%.tex}"
+#	echo $basename
+	perl ./utilities/verbboxcheck.pl $basename.tex
+done
+
utilities/verbboxcheck.pl new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.9.1