gbranden pushed a commit to branch master
in repository groff.
commit dd64518772e32f742621d4ab75ecd62be6225855
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jun 23 13:09:44 2024 -0500
[grog]: Trivially refactor (renamings).
* src/utils/grog/grog.pl: Trivially refactor. Rename scalar
`have_any_valid_arguments` to `have_any_valid_operands`, reflecting
its more specific purpose. Rename subrouting `process_input` to
`read_input`; it transforms its input only for internal purposes (to
draw inferences), without output. Rename subroutine `do_line` to
`interpret_line`. "Do" is an overused term in software development,
too often meaning "whatever the programmer had in mind at the time but
failed to document anywhere".
---
ChangeLog | 12 ++++++++++++
src/utils/grog/grog.pl | 22 +++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9c4c568f..06e44cd7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-06-23 G. Branden Robinson <[email protected]>
+
+ * src/utils/grog/grog.pl: Trivially refactor. Rename scalar
+ `have_any_valid_arguments` to `have_any_valid_operands`,
+ reflecting its more specific purpose. Rename subroutine
+ `process_input` to `read_input`; it transforms its input only
+ for internal purposes (to draw inferences), without output.
+ Rename subroutine `do_line` to `interpret_line`. "Do" is an
+ overused term in software development, too often meaning
+ "whatever the programmer had in mind at the time but failed to
+ document anywhere".
+
2024-06-22 Deri James <[email protected]>
[gropdf] Fix invalid pdf when using certain sizes of
diff --git a/src/utils/grog/grog.pl b/src/utils/grog/grog.pl
index d7e623aac..57cac48d7 100644
--- a/src/utils/grog/grog.pl
+++ b/src/utils/grog/grog.pl
@@ -38,7 +38,7 @@ my @inferred_main_package = (); # full-service
package(s) detected
my $main_package; # full-service package we go with
my $use_compatibility_mode = 0; # is -C being passed to groff?
-# See subroutine do_line below for chem(1) handling.
+# See subroutine interpret_line below for chem(1) handling.
my %preprocessor_for_macro = (
'EQ', 'eqn',
'G1', 'grap',
@@ -66,7 +66,7 @@ my $ms_score = 0;
my $had_inference_problem = 0;
my $had_processing_problem = 0;
-my $have_any_valid_arguments = 0;
+my $have_any_valid_operands = 0;
sub fail {
@@ -163,7 +163,7 @@ sub process_arguments {
# take no arguments.
my $cluster = '[abcCeEgGijklNpRsStUVXzZ]*';
- # Our do_line() needs to know if it should do compatibility parsing.
+ # Our interpret_line() must know if compatibility parsing is needed.
$use_compatibility_mode = 1 if ($arg =~ /^-${cluster}C${cluster}/);
push @command, $arg;
@@ -173,23 +173,23 @@ sub process_arguments {
} # process_arguments()
-sub process_input {
+sub read_input {
foreach my $file (@input_file) {
unless ( open(FILE, $file eq "-" ? $file : "< $file") ) {
&fail("cannot open '$file': $!");
next;
}
- $have_any_valid_arguments = 1;
+ $have_any_valid_operands = 1;
while (my $line = <FILE>) {
chomp $line;
- &do_line($line);
+ &interpret_line($line);
}
close(FILE);
} # end foreach
-} # process_input()
+} # read_input()
# Push item onto inferred full-service list only if not already present.
@@ -201,7 +201,7 @@ sub push_main_package {
} # push_main_package()
-sub do_line {
+sub interpret_line {
my $command; # request or macro name
my $args; # request or macro arguments
@@ -462,7 +462,7 @@ sub do_line {
&push_main_package('om');
return;
}
-} # do_line()
+} # interpret_line()
my @preprocessor = ();
@@ -691,9 +691,9 @@ my $in_unbuilt_source_tree = 0;
$groff_version = '@VERSION@' unless ($in_unbuilt_source_tree);
&process_arguments();
-&process_input();
+&read_input();
-if ($have_any_valid_arguments) {
+if ($have_any_valid_operands) {
&infer_preprocessors();
&infer_man_or_ms_package() if (scalar @inferred_main_package != 1);
&construct_command();
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit