[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/teximakehtml.c (main): add prepen
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/teximakehtml.c (main): add prepended include directories options. Correctly set include directories for parser and converters. |
Date: |
Mon, 23 Dec 2024 18:36:30 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new ad5421b31c * tp/Texinfo/XS/teximakehtml.c (main): add prepended
include directories options. Correctly set include directories for parser and
converters.
ad5421b31c is described below
commit ad5421b31c2708a0c7f079186aad019ae99305a5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 21 11:39:06 2024 +0100
* tp/Texinfo/XS/teximakehtml.c (main): add prepended include
directories options. Correctly set include directories for parser and
converters.
* tp/Texinfo/XS/convert/texinfo.c (txi_parser): rearrange code for the
case of cinclude directories not set, and put the current directory in
front.
---
ChangeLog | 10 ++++++++
tp/Texinfo/XS/convert/texinfo.c | 5 ++--
tp/Texinfo/XS/teximakehtml.c | 54 ++++++++++++++++++++++++++++++++++++++---
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f2f4c3240b..6a0eed22e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-12-21 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/teximakehtml.c (main): add prepended include
+ directories options. Correctly set include directories for parser and
+ converters.
+
+ * tp/Texinfo/XS/convert/texinfo.c (txi_parser): rearrange code for the
+ case of cinclude directories not set, and put the current directory in
+ front.
+
2024-12-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/teximakehtml.c (set_option_value)
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 9589e7150f..50cb2084fd 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -308,12 +308,11 @@ txi_parser (const char *file_path, const char
*locale_encoding,
input_directory = input_file_name_and_directory[1];
free (input_file_name_and_directory[0]);
- if (strcmp (file_path, "."))
+ if (input_directory && strcmp (input_directory, "."))
{
parser_conf_clear_INCLUDE_DIRECTORIES ();
- if (input_directory)
- parser_conf_add_include_directory (input_directory);
parser_conf_add_include_directory (".");
+ parser_conf_add_include_directory (input_directory);
}
free (input_directory);
}
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index 25274671f3..0d11bead21 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -779,9 +779,9 @@ main (int argc, char *argv[])
STRING_LIST converter_texinfo_language_config_dirs;
STRING_LIST ignored_formats;
STRING_LIST default_expanded_formats;
+ STRING_LIST prepend_dirs;
CONVERTER_INITIALIZATION_INFO *format_defaults;
DEPRECATED_DIRS_LIST deprecated_directories;
- const char *curdir = ".";
char *top_srcdir;
char *top_builddir;
char *tp_builddir = 0;
@@ -793,6 +793,7 @@ main (int argc, char *argv[])
size_t i;
STRING_LIST input_files;
STRING_LIST opened_files;
+ STRING_LIST prepended_include_directories;
char *texinfo_output_format_env;
OPTION *output_format_option;
const char *output_format;
@@ -800,7 +801,7 @@ main (int argc, char *argv[])
FORMAT_SPECIFICATION *format_specification = 0;
int do_menu = 0;
size_t format_menu_option_nr;
- const char *conversion_format_menu_default = 0;
+ char *conversion_format_menu_default = 0;
parse_file_path (argv[0], program_file_name_and_directory);
program_file = program_file_name_and_directory[0];
@@ -867,6 +868,8 @@ main (int argc, char *argv[])
texinfo_language_config_dirs
= set_subdir_directories ("texinfo", &deprecated_directories);
+ memset (&prepend_dirs, 0, sizeof (STRING_LIST));
+
memset (&input_files, 0, sizeof (STRING_LIST));
initialize_options_list (&cmdline_options);
@@ -878,7 +881,7 @@ main (int argc, char *argv[])
{
int option_character;
- option_character = getopt_long (argc, argv, "VhvFc:e:I:o:E:",
+ option_character = getopt_long (argc, argv, "VhvFc:e:I:P:o:E:",
long_options,
&getopt_long_index);
@@ -950,6 +953,9 @@ main (int argc, char *argv[])
options_list_add_option_number (&cmdline_options, option->number);
}
break;
+ case 'P':
+ push_include_directory (&prepend_dirs, optarg);
+ break;
case 'h':
print_help_p = 1;
break;
@@ -1177,6 +1183,9 @@ main (int argc, char *argv[])
text_append_n (&help_message, "\n", 1);
text_append (&help_message,
_(" -I DIR append DIR to the @include search
path."));
+ text_append_n (&help_message, "\n", 1);
+ text_append (&help_message,
+ _(" -P DIR prepend DIR to the @include search
path."));
text_append_n (&help_message, "\n\n", 2);
text_append (&help_message, _("Conditional processing in input:"));
@@ -1370,6 +1379,9 @@ main (int argc, char *argv[])
OPTION *parser_option = parser_options.sorted_options[i];
if (parser_option->flags & OF_parser_option)
{
+ /* note that INCLUDE_DIRECTORIES is reset before parsing
+ to add prepended directories, current directory and manual
+ directory */
OPTION *option = get_conf (parser_option->number);
if (option)
{
@@ -1446,6 +1458,7 @@ main (int argc, char *argv[])
initialize_options_list (&convert_options);
memset (&opened_files, 0, sizeof (STRING_LIST));
+ memset (&prepended_include_directories, 0, sizeof (STRING_LIST));
for (i = 0; i < input_files.number; i++)
{
@@ -1458,6 +1471,13 @@ main (int argc, char *argv[])
OPTION *trace_includes_option;
OPTION *macro_expand_option;
OPTION *dump_texi_option;
+ OPTION *converter_include_dirs_option;
+ STRING_LIST *cmdline_include_dirs
+ = cmdline_options.options->INCLUDE_DIRECTORIES.o.strlist;
+ STRING_LIST *parser_include_dirs
+ = parser_options.options->INCLUDE_DIRECTORIES.o.strlist;
+ STRING_LIST *converter_include_dirs;
+ const char *curdir = ".";
input_file_path = input_files.list[i];
@@ -1465,6 +1485,20 @@ main (int argc, char *argv[])
input_file_name = input_file_name_and_directory[0];
input_directory = input_file_name_and_directory[1];
+ if (prepend_dirs.number > 0)
+ copy_strings (&prepended_include_directories, &prepend_dirs);
+
+ add_string (curdir, &prepended_include_directories);
+ if (input_directory && strcmp (curdir, input_directory))
+ add_string (input_directory, &prepended_include_directories);
+
+ /* tune for the input file include directory and prepend to
+ INCLUDE_DIRECTORIES by merging prepended directories and command
+ line include directories */
+ clear_strings_list (parser_include_dirs);
+ copy_strings (parser_include_dirs, &prepended_include_directories);
+ copy_strings (parser_include_dirs, cmdline_include_dirs);
+
/* Texinfo file parsing */
/* initialize parser */
txi_parser (input_file_path, locale_encoding, expanded_formats,
@@ -1632,6 +1666,18 @@ main (int argc, char *argv[])
copy_options_list (&convert_options, &init_files_options);
copy_options_list (&convert_options, &cmdline_options);
+ /* prepend to INCLUDE_DIRECTORIES by resetting include directories to
+ merged prepended directories and command line include directories */
+ converter_include_dirs_option
+ = &convert_options.options->INCLUDE_DIRECTORIES;
+ converter_include_dirs = converter_include_dirs_option->o.strlist;
+ clear_strings_list (converter_include_dirs);
+ copy_strings (converter_include_dirs, &prepended_include_directories);
+ copy_strings (converter_include_dirs, cmdline_include_dirs);
+ /* always mark include directories as set in converter options */
+ options_list_add_option_number (&convert_options,
+ converter_include_dirs_option->number);
+
add_string (curdir, &converter_texinfo_language_config_dirs);
if (input_directory)
{
@@ -1679,11 +1725,13 @@ main (int argc, char *argv[])
free (input_file_name);
+ clear_strings_list (&prepended_include_directories);
clear_strings_list (&converter_texinfo_language_config_dirs);
clear_options_list (&convert_options);
}
free_strings_list (&opened_files);
+ free_strings_list (&prepended_include_directories);
free_strings_list (&converter_texinfo_language_config_dirs);
free_options_list (&convert_options);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/teximakehtml.c (main): add prepended include directories options. Correctly set include directories for parser and converters.,
Patrice Dumas <=