[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Reform parsetexi header files
From: |
Gavin D. Smith |
Subject: |
branch master updated: Reform parsetexi header files |
Date: |
Thu, 18 Feb 2021 16:13:59 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 27d2ec8 Reform parsetexi header files
27d2ec8 is described below
commit 27d2ec88a5d9f4a8a64089ed2dac8830ee5db6cc
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Thu Feb 18 21:13:51 2021 +0000
Reform parsetexi header files
* tp/Texinfo/XS/parsetexi: Make header files include the other
headers that they need.
* tp/Texinfo/XS/parsetexi/command_data.awk,
* tp/Texinfo/XS/parsetexi/element_types.awk: Output include guards
in generated headers.
* tp/Texinfo/XS/parsetexi/parser.c,
* tp/Texinfo/XS/parsetexi/errors.c: (bug, fatal): Move to errors.c.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/XS/parsetexi/command_data.awk | 5 ++++-
tp/Texinfo/XS/parsetexi/command_ids.h | 3 +++
tp/Texinfo/XS/parsetexi/commands.c | 4 +++-
tp/Texinfo/XS/parsetexi/commands.h | 2 +-
tp/Texinfo/XS/parsetexi/conf.h | 2 +-
tp/Texinfo/XS/parsetexi/context_stack.h | 4 +++-
tp/Texinfo/XS/parsetexi/convert.h | 3 +++
tp/Texinfo/XS/parsetexi/counter.c | 2 ++
tp/Texinfo/XS/parsetexi/counter.h | 7 ++++++-
tp/Texinfo/XS/parsetexi/def.h | 3 +++
tp/Texinfo/XS/parsetexi/element_types.awk | 5 ++++-
tp/Texinfo/XS/parsetexi/element_types.h | 3 +++
tp/Texinfo/XS/parsetexi/errors.c | 15 ++++++++++++++-
tp/Texinfo/XS/parsetexi/errors.h | 5 +++++
tp/Texinfo/XS/parsetexi/handle_commands.h | 2 ++
tp/Texinfo/XS/parsetexi/indices.h | 2 ++
tp/Texinfo/XS/parsetexi/input.c | 3 ++-
tp/Texinfo/XS/parsetexi/input.h | 2 ++
tp/Texinfo/XS/parsetexi/labels.h | 4 +++-
tp/Texinfo/XS/parsetexi/macro.h | 4 +++-
tp/Texinfo/XS/parsetexi/parser.c | 13 -------------
tp/Texinfo/XS/parsetexi/parser.h | 2 --
tp/Texinfo/XS/parsetexi/text.c | 4 ++--
tp/Texinfo/XS/parsetexi/text.h | 8 +++++++-
tp/Texinfo/XS/parsetexi/tree.c | 3 ++-
tp/Texinfo/XS/parsetexi/tree.h | 2 ++
tp/Texinfo/XS/parsetexi/tree_types.h | 9 ++-------
28 files changed, 96 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 76c7aa0..114fab4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2021-02-18 Gavin Smith <gavinsmith0123@gmail.com>
+ Reform parsetexi header files
+
+ * tp/Texinfo/XS/parsetexi: Make header files include the other
+ headers that they need.
+ * tp/Texinfo/XS/parsetexi/command_data.awk,
+ * tp/Texinfo/XS/parsetexi/element_types.awk: Output include guards
+ in generated headers.
+ * tp/Texinfo/XS/parsetexi/parser.c,
+ * tp/Texinfo/XS/parsetexi/errors.c: (bug, fatal): Move to errors.c.
+
+2021-02-18 Gavin Smith <gavinsmith0123@gmail.com>
+
* tp/Texinfo/Convert/HTML.pm (_default_format_begin_file):
Add viewport declaration as was already output for node
redirection pages. Report from Per Bothner.
diff --git a/tp/Texinfo/XS/parsetexi/command_data.awk
b/tp/Texinfo/XS/parsetexi/command_data.awk
index 5fea87b..9974d1a 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.awk
+++ b/tp/Texinfo/XS/parsetexi/command_data.awk
@@ -1,4 +1,4 @@
-# Copyright 2010-2019 Free Software Foundation, Inc.
+# Copyright 2010-2021 Free Software Foundation, Inc.
#
# 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
@@ -74,6 +74,8 @@ BEGIN {
CI = srcdir "/command_ids.h"
print "/* This file automatically generated by command_data.awk */" > CI
+ print "#ifndef COMMAND_IDS_H" > CI
+ print "#define COMMAND_IDS_H" > CI
print > CI
print "/* Useful aliases */" > CI
print "#define CM_hex_09 CM_TAB" > CI
@@ -154,6 +156,7 @@ END {
}
print "};" > CD
print "};" > CI
+ print "#endif" > CI
}
diff --git a/tp/Texinfo/XS/parsetexi/command_ids.h
b/tp/Texinfo/XS/parsetexi/command_ids.h
index 1c5e4e9..1201e40 100644
--- a/tp/Texinfo/XS/parsetexi/command_ids.h
+++ b/tp/Texinfo/XS/parsetexi/command_ids.h
@@ -1,4 +1,6 @@
/* This file automatically generated by command_data.awk */
+#ifndef COMMAND_IDS_H
+#define COMMAND_IDS_H
/* Useful aliases */
#define CM_hex_09 CM_TAB
@@ -390,3 +392,4 @@ CM_hex_7c,
CM_hex_7d,
CM_hex_7e,
};
+#endif
diff --git a/tp/Texinfo/XS/parsetexi/commands.c
b/tp/Texinfo/XS/parsetexi/commands.c
index cf36090..e0caffd 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -18,7 +18,9 @@
#include <stdlib.h>
#include <string.h>
-#include "parser.h"
+#include "command_ids.h"
+#include "commands.h"
+#include "errors.h"
#include "command_data.c"
diff --git a/tp/Texinfo/XS/parsetexi/commands.h
b/tp/Texinfo/XS/parsetexi/commands.h
index 1a8fdef..92078a4 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -1,7 +1,7 @@
/* commands.h - declarations for commands.c */
#ifndef COMMANDS_H
#define COMMANDS_H
-/* Copyright 2010-2020 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index bf0fc79..7efcb56 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -1,7 +1,7 @@
/* conf.h - declarations for conf.c */
#ifndef CONF_H
#define CONF_H
-/* Copyright 2010-2018 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
diff --git a/tp/Texinfo/XS/parsetexi/context_stack.h
b/tp/Texinfo/XS/parsetexi/context_stack.h
index 668179e..9b4f933 100644
--- a/tp/Texinfo/XS/parsetexi/context_stack.h
+++ b/tp/Texinfo/XS/parsetexi/context_stack.h
@@ -1,7 +1,7 @@
/* context_stack.h - declarations for context_stack.c */
#ifndef CONTEXT_STACK_H
#define CONTEXT_STACK_H
-/* Copyright 2010-2019 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
@@ -16,6 +16,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "tree_types.h"
+
enum context {
ct_NONE,
ct_line,
diff --git a/tp/Texinfo/XS/parsetexi/convert.h
b/tp/Texinfo/XS/parsetexi/convert.h
index f01c2e1..a0a9650 100644
--- a/tp/Texinfo/XS/parsetexi/convert.h
+++ b/tp/Texinfo/XS/parsetexi/convert.h
@@ -1,6 +1,9 @@
/* convert.h - definitions for convert.c */
#ifndef CONVERT_H
#define CONVERT_H
+
+#include "tree_types.h"
+
char *convert_to_texinfo (ELEMENT *e);
char *convert_to_text (ELEMENT *e, int *superfluous_arg);
char *node_extra_to_texi (NODE_SPEC_EXTRA *nse);
diff --git a/tp/Texinfo/XS/parsetexi/counter.c
b/tp/Texinfo/XS/parsetexi/counter.c
index 0f46685..79499e0 100644
--- a/tp/Texinfo/XS/parsetexi/counter.c
+++ b/tp/Texinfo/XS/parsetexi/counter.c
@@ -15,8 +15,10 @@
#include <config.h>
+#include "counter.h"
#include "parser.h"
+
void
counter_push (COUNTER *c, ELEMENT *elt, int num)
{
diff --git a/tp/Texinfo/XS/parsetexi/counter.h
b/tp/Texinfo/XS/parsetexi/counter.h
index ee1d3f3..9e5ce28 100644
--- a/tp/Texinfo/XS/parsetexi/counter.h
+++ b/tp/Texinfo/XS/parsetexi/counter.h
@@ -1,7 +1,10 @@
/* counter.h - definitions for counter.c */
#ifndef COUNTER_H
#define COUNTER_H
-/* Copyright 2015-2020 Free Software Foundation, Inc.
+
+#include "tree_types.h"
+
+/* Copyright 2015-2021 Free Software Foundation, Inc.
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
@@ -16,6 +19,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "tree_types.h"
+
typedef struct {
int *values; /* Array of values. */
ELEMENT **elts; /* Elements corresponding to each value. */
diff --git a/tp/Texinfo/XS/parsetexi/def.h b/tp/Texinfo/XS/parsetexi/def.h
index 49d363a..074e528 100644
--- a/tp/Texinfo/XS/parsetexi/def.h
+++ b/tp/Texinfo/XS/parsetexi/def.h
@@ -1,6 +1,9 @@
/* def.h - definitions for def.c */
#ifndef DEF_H
#define DEF_H
+
+#include "tree_types.h"
+
void gather_def_item (ELEMENT *current, enum command_id next_command);
DEF_INFO *parse_def (enum command_id command, ELEMENT *current);
#endif
diff --git a/tp/Texinfo/XS/parsetexi/element_types.awk
b/tp/Texinfo/XS/parsetexi/element_types.awk
index 5c2c062..83618f9 100644
--- a/tp/Texinfo/XS/parsetexi/element_types.awk
+++ b/tp/Texinfo/XS/parsetexi/element_types.awk
@@ -1,4 +1,4 @@
-# Copyright 2014-2018 Free Software Foundation, Inc.
+# Copyright 2014-2021 Free Software Foundation, Inc.
#
# 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
@@ -22,6 +22,8 @@ BEGIN {
ETC = srcdir "/element_types.c"
print "/* This file automatically generated by element_types.awk */" > ETH
+ print "#ifndef ELEMENT_TYPES_H" > ETH
+ print "#define ELEMENT_TYPES_H" > ETH
print "enum element_type {" > ETH
print "ET_NONE," > ETH
}
@@ -35,6 +37,7 @@ END {
print "};" > ETH
print > ETH
print "extern char *element_type_names[];" > ETH
+ print "#endif" > ETH
print "char *element_type_names[] = {" > ETC
print "0," > ETC
diff --git a/tp/Texinfo/XS/parsetexi/element_types.h
b/tp/Texinfo/XS/parsetexi/element_types.h
index 32ab381..9a6fb59 100644
--- a/tp/Texinfo/XS/parsetexi/element_types.h
+++ b/tp/Texinfo/XS/parsetexi/element_types.h
@@ -1,4 +1,6 @@
/* This file automatically generated by element_types.awk */
+#ifndef ELEMENT_TYPES_H
+#define ELEMENT_TYPES_H
enum element_type {
ET_NONE,
ET_command_as_argument,
@@ -70,3 +72,4 @@ ET_untranslated,
};
extern char *element_type_names[];
+#endif
diff --git a/tp/Texinfo/XS/parsetexi/errors.c b/tp/Texinfo/XS/parsetexi/errors.c
index a2d8558..9acdfe3 100644
--- a/tp/Texinfo/XS/parsetexi/errors.c
+++ b/tp/Texinfo/XS/parsetexi/errors.c
@@ -20,10 +20,23 @@
#include <stdarg.h>
#include <stdio.h>
-#include "parser.h"
+#include "errors.h"
#include "input.h"
#include "text.h"
+void bug (char *message)
+{
+ fprintf (stderr, "texi2any (XS parser): bug: %s\n", message);
+ abort ();
+}
+
+void fatal (char *message)
+{
+ bug (message);
+ abort ();
+}
+
+
typedef struct {
char *message;
enum error_type type;
diff --git a/tp/Texinfo/XS/parsetexi/errors.h b/tp/Texinfo/XS/parsetexi/errors.h
index 3def506..733d137 100644
--- a/tp/Texinfo/XS/parsetexi/errors.h
+++ b/tp/Texinfo/XS/parsetexi/errors.h
@@ -2,6 +2,11 @@
#ifndef ERRORS_H
#define ERRORS_H
+#include "tree_types.h"
+
+void fatal (char *);
+void bug (char *);
+
enum error_type { error, warning };
void line_error (char *format, ...);
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.h
b/tp/Texinfo/XS/parsetexi/handle_commands.h
index 5d09425..08673a2 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.h
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.h
@@ -2,6 +2,8 @@
#ifndef HANDLE_COMMANDS_H
#define HANDLE_COMMANDS_H
+#include "tree_types.h"
+
ELEMENT *handle_other_command (ELEMENT *current, char **line_inout,
enum command_id cmd_id, int *status);
ELEMENT *handle_line_command (ELEMENT *current, char **line_inout,
diff --git a/tp/Texinfo/XS/parsetexi/indices.h
b/tp/Texinfo/XS/parsetexi/indices.h
index e35bc3b..043042d 100644
--- a/tp/Texinfo/XS/parsetexi/indices.h
+++ b/tp/Texinfo/XS/parsetexi/indices.h
@@ -2,6 +2,8 @@
#ifndef INDICES_H
#define INDICES_H
+#include "tree_types.h"
+
extern INDEX **index_names;
void init_index_commands (void);
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index a1f97fa..67309c2 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -24,9 +24,10 @@
#include <errno.h>
#include <sys/stat.h>
-#include "parser.h"
+#include "errors.h"
#include "input.h"
#include "text.h"
+#include "commands.h"
enum input_type { IN_file, IN_text };
diff --git a/tp/Texinfo/XS/parsetexi/input.h b/tp/Texinfo/XS/parsetexi/input.h
index 8021015..6a906c0 100644
--- a/tp/Texinfo/XS/parsetexi/input.h
+++ b/tp/Texinfo/XS/parsetexi/input.h
@@ -2,6 +2,8 @@
#ifndef INPUT_H
#define INPUT_H
+#include "tree_types.h"
+
char *new_line (void);
char *next_text (void);
diff --git a/tp/Texinfo/XS/parsetexi/labels.h b/tp/Texinfo/XS/parsetexi/labels.h
index b65ba02..66624c5 100644
--- a/tp/Texinfo/XS/parsetexi/labels.h
+++ b/tp/Texinfo/XS/parsetexi/labels.h
@@ -1,7 +1,7 @@
/* labels.h - declarations for labels.c */
#ifndef LABELS_H
#define LABELS_H
-/* Copyright 2010-2019 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
@@ -16,6 +16,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "tree_types.h"
+
/* Information about a possible target of a cross-reference, often a node. */
typedef struct {
/* Pointer to the element for the command defining this label, usually a
diff --git a/tp/Texinfo/XS/parsetexi/macro.h b/tp/Texinfo/XS/parsetexi/macro.h
index 4aa33dc..784a3ca 100644
--- a/tp/Texinfo/XS/parsetexi/macro.h
+++ b/tp/Texinfo/XS/parsetexi/macro.h
@@ -1,7 +1,7 @@
/* macro.h - declarations for macro.c */
#ifndef MACRO_H
#define MACRO_H
-/* Copyright 2010-2019 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
@@ -16,6 +16,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "tree_types.h"
+
typedef struct {
enum command_id cmd;
char *begin;
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index fbd8816..65498f0 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -30,19 +30,6 @@ const char *digit_chars = "0123456789";
// [^\S\r\n] in Perl
const char *whitespace_chars_except_newline = " \t\f";
-
-void bug (char *message)
-{
- fprintf (stderr, "texi2any (XS parser): bug: %s\n", message);
- abort ();
-}
-
-void fatal (char *message)
-{
- bug (message);
- abort ();
-}
-
/* Check if the contents of S2 appear at S1). */
int
looking_at (char *s1, char *s2)
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 35a5ee3..9cc2f24 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -159,8 +159,6 @@ int is_end_current_command (ELEMENT *current, char **line,
void set_documentlanguage (char *);
void set_novalidate (int value);
char *element_type_name (ELEMENT *e);
-void fatal (char *);
-void bug (char *);
/* Return values */
#define GET_A_NEW_LINE 0
diff --git a/tp/Texinfo/XS/parsetexi/text.c b/tp/Texinfo/XS/parsetexi/text.c
index 901b6c1..224464f 100644
--- a/tp/Texinfo/XS/parsetexi/text.c
+++ b/tp/Texinfo/XS/parsetexi/text.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2019 Free Software Foundation, Inc.
+/* Copyright 2014-2021 Free Software Foundation, Inc.
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
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdarg.h>
-#include "parser.h"
+#include "errors.h"
#include "text.h"
/* Make sure there are LEN free bytes. */
diff --git a/tp/Texinfo/XS/parsetexi/text.h b/tp/Texinfo/XS/parsetexi/text.h
index 04b86ed..11ea682 100644
--- a/tp/Texinfo/XS/parsetexi/text.h
+++ b/tp/Texinfo/XS/parsetexi/text.h
@@ -1,7 +1,7 @@
/* text.h - declarations for text.c */
#ifndef TEXT_H
#define TEXT_H
-/* Copyright 2014, 2015 Free Software Foundation, Inc.
+/* Copyright 2014-2021 Free Software Foundation, Inc.
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
@@ -16,6 +16,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+typedef struct TEXT {
+ char *text;
+ size_t space; /* Allocated bytes in 'text', including terminating null. */
+ size_t end;
+} TEXT;
+
void text_init (TEXT *t);
void text_append (TEXT *t, char *s);
void text_append_n (TEXT *t, char *s, size_t len);
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index 797aa65..f1b6474 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -17,7 +17,8 @@
#include <stdlib.h>
#include <string.h>
-#include "parser.h"
+#include "errors.h"
+#include "tree.h"
//int element_counter;
diff --git a/tp/Texinfo/XS/parsetexi/tree.h b/tp/Texinfo/XS/parsetexi/tree.h
index 4360e4b..acb224a 100644
--- a/tp/Texinfo/XS/parsetexi/tree.h
+++ b/tp/Texinfo/XS/parsetexi/tree.h
@@ -2,6 +2,8 @@
#ifndef TREE_H
#define TREE_H
+#include "tree_types.h"
+
ELEMENT *new_element (enum element_type type);
void add_to_element_contents (ELEMENT *parent, ELEMENT *e);
void add_to_contents_as_array (ELEMENT *parent, ELEMENT *e);
diff --git a/tp/Texinfo/XS/parsetexi/tree_types.h
b/tp/Texinfo/XS/parsetexi/tree_types.h
index 2b494f6..3f9f782 100644
--- a/tp/Texinfo/XS/parsetexi/tree_types.h
+++ b/tp/Texinfo/XS/parsetexi/tree_types.h
@@ -1,7 +1,7 @@
/* tree_types.h - types for the parse tree that are used in many places */
#ifndef TREE_TYPES_H
#define TREE_TYPES_H
-/* Copyright 2010-2018 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
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
@@ -20,12 +20,7 @@
#include "command_ids.h"
#include "element_types.h"
-
-typedef struct TEXT {
- char *text;
- size_t space; /* Allocated bytes in 'text', including terminating null. */
- size_t end;
-} TEXT;
+#include "text.h"
enum extra_type {
extra_element,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Reform parsetexi header files,
Gavin D. Smith <=