texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Patrice Dumas
Date: Mon, 23 Dec 2024 18:10:12 -0500 (EST)

branch: master
commit 6f1b98bfd898153beaa6b061af3a63e7c2d3d15c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 10 19:26:23 2024 +0100

    * tp/Texinfo/XS/convert/texinfo.c (txi_parser): check that
    input_directory is not NULL before using.
    
    * tp/Texinfo/XS/teximakehtml.c (main): call
    options_list_add_option_number for parser options set.
    
    * tp/Texinfo/XS/Makefile.am (teximakehtml_CPPFLAGS),
    tp/Texinfo/XS/teximakehtml.c (push_include_directory, main): pass
    PATH_SEP from configure PATH_SEPARATOR to teximakehtml flags.
    Add -I option, add include_dirs and set INCLUDE_DIRECTORIES option
    based on the -I values.
---
 ChangeLog                       | 14 ++++++++++++++
 tp/Texinfo/XS/Makefile.am       |  2 +-
 tp/Texinfo/XS/convert/texinfo.c |  3 ++-
 tp/Texinfo/XS/teximakehtml.c    | 38 +++++++++++++++++++++++++++++++++++++-
 4 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c6e0fb3fa1..dd5c400a2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-12-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/texinfo.c (txi_parser): check that
+       input_directory is not NULL before using.
+
+       * tp/Texinfo/XS/teximakehtml.c (main): call
+       options_list_add_option_number for parser options set.
+
+       * tp/Texinfo/XS/Makefile.am (teximakehtml_CPPFLAGS),
+       tp/Texinfo/XS/teximakehtml.c (push_include_directory, main): pass
+       PATH_SEP from configure PATH_SEPARATOR to teximakehtml flags.
+       Add -I option, add include_dirs and set INCLUDE_DIRECTORIES option
+       based on the -I values.
+
 2024-12-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/teximakehtml.c (main): copy the parser customizations
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 8d29682ac5..2ee5bbc771 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -619,5 +619,5 @@ teximakehtml_SOURCES = \
 teximakehtml_LDADD = $(top_builddir)/gnulib/lib/libgnu.la
 teximakehtml_LDFLAGS = $(EUIDACCESS_LIBGEN) $(LTLIBINTL) $(LTLIBICONV) 
$(LTLIBUNISTRING)
 
-teximakehtml_CPPFLAGS = -I$(srcdir)/parsetexi -I$(srcdir)/convert 
-I$(srcdir)/main -I$(srcdir)/structuring_transfo $(AM_CPPFLAGS) 
$(GNULIB_CPPFLAGS)
+teximakehtml_CPPFLAGS = -I$(srcdir)/parsetexi -I$(srcdir)/convert 
-I$(srcdir)/main -I$(srcdir)/structuring_transfo $(AM_CPPFLAGS) 
$(GNULIB_CPPFLAGS) -DPATH_SEP=\"${PATH_SEPARATOR}\"
 
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 12c09f2a1d..8b30d5b46d 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -311,7 +311,8 @@ txi_parser (const char *file_path, const char 
*locale_encoding,
           if (strcmp (file_path, "."))
             {
               parser_conf_clear_INCLUDE_DIRECTORIES ();
-              parser_conf_add_include_directory (input_directory);
+              if (input_directory)
+                parser_conf_add_include_directory (input_directory);
               parser_conf_add_include_directory (".");
             }
           free (input_directory);
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index 7cebb619d2..5e4d2711f0 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -251,6 +251,21 @@ get_cmdline_customization_option (OPTIONS_LIST 
*options_list,
     }
 }
 
+static void
+push_include_directory (STRING_LIST *include_dirs_list, char *text)
+{
+  char *dir = strtok (text, PATH_SEP);
+
+  while (dir)
+    {
+      if (strlen (dir))
+        {
+          add_include_directory (dir, include_dirs_list);
+        }
+      dir = strtok (NULL, PATH_SEP);
+    }
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -269,6 +284,7 @@ main (int argc, char *argv[])
   size_t errors_nr;
   STRING_LIST texinfo_language_config_dirs;
   STRING_LIST converter_texinfo_language_config_dirs;
+  STRING_LIST include_dirs;
   CONVERTER_INITIALIZATION_INFO *format_defaults;
   char *home_dir;
   const char *curdir = ".";
@@ -366,13 +382,16 @@ main (int argc, char *argv[])
   if (strlen (DATADIR))
     add_string (DATADIR "/texinfo", &texinfo_language_config_dirs);
 
+
+  memset (&include_dirs, 0, sizeof (STRING_LIST));
+
   initialize_options_list (&cmdline_options);
 
   while (1)
     {
       int option_character;
 
-      option_character = getopt (argc, argv, "tmdc:");
+      option_character = getopt (argc, argv, "tmdc:I:");
       if (option_character == -1)
         break;
 
@@ -390,6 +409,9 @@ main (int argc, char *argv[])
         case 'c':
           get_cmdline_customization_option (&cmdline_options, optarg);
           break;
+        case 'I':
+          push_include_directory (&include_dirs, optarg);
+          break;
           /*
         case '?':
           if (isprint (optopt))
@@ -411,6 +433,16 @@ main (int argc, char *argv[])
   if (optind >= argc)
     exit (EXIT_FAILURE);
 
+
+  if (include_dirs.number > 0)
+    {
+      OPTION *option = &cmdline_options.options->INCLUDE_DIRECTORIES;
+      options_list_add_option_number (&cmdline_options,
+                                      option->number, 0);
+      merge_strings (option->o.strlist, &include_dirs);
+      include_dirs.number = 0;
+    }
+
   if (run_mode == TEXIMAKEHTML_mode_test
       || run_mode == TEXIMAKEHTML_mode_mimick_test)
     {
@@ -471,6 +503,8 @@ main (int argc, char *argv[])
           OPTION *option = get_conf (parser_option->number);
           if (option)
             {
+              options_list_add_option_number (&parser_options,
+                                              parser_option->number, 0);
               copy_option (parser_option, option);
             }
         }
@@ -591,6 +625,8 @@ main (int argc, char *argv[])
   free_strings_list (&converter_texinfo_language_config_dirs);
   free_strings_list (&texinfo_language_config_dirs);
 
+  free_strings_list (&include_dirs);
+
   free_options_list (&convert_options);
   free (program_file);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]