[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 43/80: [refer]: Align with modern groff conventions.
From: |
G. Branden Robinson |
Subject: |
[groff] 43/80: [refer]: Align with modern groff conventions. |
Date: |
Sat, 30 Nov 2024 04:02:21 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit b99195d6aee9eb8b9a7c23f1e79a4cbf28a4faa9
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 27 21:42:52 2024 -0600
[refer]: Align with modern groff conventions.
* src/preproc/refer/command.cpp:
* src/preproc/refer/label.ypp:
* src/preproc/refer/ref.cpp:
* src/preproc/refer/refer.cpp:
* src/preproc/refer/token.cpp: Add Autoconf "<config.h>"-inclusion
boilerplate to these translation units.
Replace old-style Emacs local variable declaration. Add editor aid
comments. Fix sloppy whitespace.
---
ChangeLog | 11 +++++++++++
src/preproc/refer/command.cpp | 6 +++++-
src/preproc/refer/label.ypp | 26 +++++++++++++++-----------
src/preproc/refer/ref.cpp | 22 +++++++++++++++-------
src/preproc/refer/refer.cpp | 6 +++++-
src/preproc/refer/token.cpp | 17 +++++++++++++----
6 files changed, 64 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e6711cfff..b4f08ae55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [refer]: Align with modern groff conventions.
+
+ * src/preproc/refer/command.cpp:
+ * src/preproc/refer/label.ypp:
+ * src/preproc/refer/ref.cpp:
+ * src/preproc/refer/refer.cpp:
+ * src/preproc/refer/token.cpp: Add Autoconf "<config.h>"-
+ inclusion boilerplate to these translation units.
+
2024-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[preconv]: Align with modern groff conventions.
diff --git a/src/preproc/refer/command.cpp b/src/preproc/refer/command.cpp
index 56957c951..f24a08111 100644
--- a/src/preproc/refer/command.cpp
+++ b/src/preproc/refer/command.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -16,6 +16,10 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "refer.h"
#include "refid.h"
#include "search.h"
diff --git a/src/preproc/refer/label.ypp b/src/preproc/refer/label.ypp
index 3536ae503..60c8dac22 100644
--- a/src/preproc/refer/label.ypp
+++ b/src/preproc/refer/label.ypp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -18,6 +18,10 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
%{
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "refer.h"
#include "refid.h"
#include "ref.h"
@@ -41,7 +45,7 @@ label_info *lookup_label(const string &label);
struct expression {
enum {
// Does the tentative label depend on the reference?
- CONTAINS_VARIABLE = 01,
+ CONTAINS_VARIABLE = 01,
CONTAINS_STAR = 02,
CONTAINS_FORMAT = 04,
CONTAINS_AT = 010
@@ -124,7 +128,7 @@ public:
map_expr(expression *e, map_func *f) : unary_expr(e), func(f) { }
void evaluate(int, const reference &, string &, substring_position &);
};
-
+
typedef const char *extractor_func(const char *, const char *, const char **);
class extractor_expr : public unary_expr {
@@ -140,7 +144,7 @@ public:
class truncate_expr : public unary_expr {
int n;
public:
- truncate_expr(expression *e, int i) : unary_expr(e), n(i) { }
+ truncate_expr(expression *e, int i) : unary_expr(e), n(i) { }
void evaluate(int, const reference &, string &, substring_position &);
};
@@ -268,7 +272,7 @@ alternative:
{ $$ = new alternative_expr($1, $3); }
| alternative '&' list
{ $$ = new conditional_expr($1, $3, 0); }
- ;
+ ;
list:
substitute
@@ -311,7 +315,7 @@ string:
break;
}
}
-
+
| '%' digits
{
$$ = new format_expr('0', $2.ndigits, $2.val);
@@ -379,8 +383,8 @@ digits:
| digits TOKEN_DIGIT
{ $$.ndigits = $1.ndigits + 1; $$.val = $1.val*10 + $2; }
;
-
-
+
+
flag:
/* empty */
{ $$ = 0; }
@@ -409,7 +413,7 @@ static char uppercase_array[] = {
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z',
};
-
+
static char lowercase_array[] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
@@ -905,7 +909,7 @@ const substring_position
&reference::get_separator_pos(label_type type) const
const string &reference::get_label(label_type type) const
{
if (type == SHORT_LABEL && short_label_flag)
- return short_label;
+ return short_label;
else
return label;
}
@@ -918,7 +922,7 @@ int reference::merge_labels_by_parts(reference **v, int n,
label_type type,
const string &lb = get_label(type);
const substring_position &sp = get_separator_pos(type);
if (sp.start < 0
- || sp.start != v[0]->get_separator_pos(type).start
+ || sp.start != v[0]->get_separator_pos(type).start
|| memcmp(lb.contents(), v[0]->get_label(type).contents(),
sp.start) != 0)
return 0;
diff --git a/src/preproc/refer/ref.cpp b/src/preproc/refer/ref.cpp
index 65b7edaf3..0cb9f632e 100644
--- a/src/preproc/refer/ref.cpp
+++ b/src/preproc/refer/ref.cpp
@@ -1,5 +1,4 @@
-// -*- C++ -*-
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -16,7 +15,11 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "refer.h"
#include "refid.h"
#include "ref.h"
@@ -27,7 +30,7 @@ static int find_month(const char *start, const char *end);
static void abbreviate_names(string &);
#define DEFAULT_ARTICLES "the\000a\000an"
-
+
string articles(DEFAULT_ARTICLES, sizeof(DEFAULT_ARTICLES));
// Multiple occurrences of fields are separated by FIELD_SEPARATOR.
@@ -314,7 +317,7 @@ void sortify_other(const char *s, int len, string &key)
void sortify_title(const char *s, int len, string &key)
{
const char *end = s + len;
- for (; s < end && (*s == ' ' || *s == '\n'); s++)
+ for (; s < end && (*s == ' ' || *s == '\n'); s++)
;
const char *ptr = s;
for (;;) {
@@ -534,7 +537,7 @@ int same_reference(const reference &r1, const reference &r2)
return 0;
if (r1.nfields != r2.nfields)
return 0;
- int i = 0;
+ int i = 0;
for (i = 0; i < 256; i++)
if (r1.field_index[i] != r2.field_index[i])
return 0;
@@ -816,7 +819,7 @@ void reference::output(FILE *fp)
// should check for overflow
n = n*10 + reverse_fields[j] - '0';
}
- else
+ else
n = INT_MAX;
reverse_names(f, n);
}
@@ -1159,3 +1162,8 @@ const char *reference::get_sort_field(int i, int si, int
ssi,
return start;
}
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
diff --git a/src/preproc/refer/refer.cpp b/src/preproc/refer/refer.cpp
index 3f441a438..cd240c149 100644
--- a/src/preproc/refer/refer.cpp
+++ b/src/preproc/refer/refer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -16,6 +16,10 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "refer.h"
#include "refid.h"
#include "ref.h"
diff --git a/src/preproc/refer/token.cpp b/src/preproc/refer/token.cpp
index e643cbd4a..4f12bf7e9 100644
--- a/src/preproc/refer/token.cpp
+++ b/src/preproc/refer/token.cpp
@@ -1,5 +1,4 @@
-// -*- C++ -*-
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -17,6 +16,10 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "refer.h"
#include "token.h"
@@ -295,7 +298,7 @@ static void init_two_char_letter(char l1, char l2, char u1,
char u2,
buf[2] = l1;
buf[3] = l2;
store_letter(strsave(buf), p, sk);
-
+
}
static void init_special_chars()
@@ -318,7 +321,7 @@ static void init_special_chars()
init_two_char_letter('o', 'a', 'o', 'A', "a");
init_two_char_letter('T', 'p', 'T', 'P', THORN_SORT_KEY);
init_two_char_letter('-', 'd', '-', 'D');
-
+
store_token("\\(ss", TOKEN_LOWER, 0, "SS");
store_token("\\[ss]", TOKEN_LOWER, 0, "SS");
@@ -375,3 +378,9 @@ token_initer::token_initer()
init_strings();
default_token_info.set(TOKEN_OTHER);
}
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 43/80: [refer]: Align with modern groff conventions.,
G. Branden Robinson <=