[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/converter.c (find_output_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/converter.c (find_output_unit_file) (add_output_units_file, register_normalize_case_filename), tp/Texinfo/XS/main/utils.h (FILE_NAME_PATH_COUNTER): add normalized_filename field in FILE_NAME_PATH_COUNTER to distinguish case independent file name and case dependent file name with CASE_INSENSITIVE_FILENAMES. |
Date: |
Sat, 21 Oct 2023 18:05:49 -0400 |
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 0378a3419f * tp/Texinfo/XS/convert/converter.c (find_output_unit_file)
(add_output_units_file, register_normalize_case_filename),
tp/Texinfo/XS/main/utils.h (FILE_NAME_PATH_COUNTER): add normalized_filename
field in FILE_NAME_PATH_COUNTER to distinguish case independent file name and
case dependent file name with CASE_INSENSITIVE_FILENAMES.
0378a3419f is described below
commit 0378a3419ff901ac96c8eea0cff13f5760e60582
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 22 00:05:48 2023 +0200
* tp/Texinfo/XS/convert/converter.c (find_output_unit_file)
(add_output_units_file, register_normalize_case_filename),
tp/Texinfo/XS/main/utils.h (FILE_NAME_PATH_COUNTER): add
normalized_filename field in FILE_NAME_PATH_COUNTER to distinguish
case independent file name and case dependent file name with
CASE_INSENSITIVE_FILENAMES.
* tp/Texinfo/Convert/HTML.pm (_prepare_units_directions_files),
tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_units_directions_files),
tp/Texinfo/XS/main/build_perl_info. (build_filenames):
pass filenames state too from XS to perl.
---
ChangeLog | 15 ++++++++++++
tp/Texinfo/Convert/HTML.pm | 7 ++++--
tp/Texinfo/XS/convert/ConvertXS.xs | 15 ++++++++----
tp/Texinfo/XS/convert/converter.c | 14 ++++++++----
tp/Texinfo/XS/main/build_perl_info.c | 44 +++++++++++++++++++++++++++++-------
tp/Texinfo/XS/main/build_perl_info.h | 5 +++-
tp/Texinfo/XS/main/utils.h | 1 +
7 files changed, 82 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17f0a9cf10..26a617caea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2023-10-21 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/converter.c (find_output_unit_file)
+ (add_output_units_file, register_normalize_case_filename),
+ tp/Texinfo/XS/main/utils.h (FILE_NAME_PATH_COUNTER): add
+ normalized_filename field in FILE_NAME_PATH_COUNTER to distinguish
+ case independent file name and case dependent file name with
+ CASE_INSENSITIVE_FILENAMES.
+
+ * tp/Texinfo/Convert/HTML.pm (_prepare_units_directions_files),
+ tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_prepare_units_directions_files),
+ tp/Texinfo/XS/main/build_perl_info. (build_filenames):
+ pass filenames state too from XS to perl.
+
2023-10-21 Patrice Dumas <pertusus@free.fr>
* tp/t/html_tests.t (sectioning_check_menu_structure): rename
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 507e977ae5..94320bcf88 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9285,14 +9285,17 @@ sub _prepare_units_directions_files($$$$$$$$)
my $encoded_document_name = Encode::encode('UTF-8', $document_name);
my ($XS_files_source_info, $global_units_directions,
- $file_counters, $elements_in_file_count, $out_filepaths)
+ $elements_in_file_count, $filenames,
+ $file_counters, $out_filepaths)
= _XS_prepare_units_directions_files($encoded_converter,
$output_units, $special_units, $associated_special_units,
$output_file, $destination_directory, $output_filename,
$encoded_document_name);
$self->{'global_units_directions'} = $global_units_directions;
- $self->{'file_counters'} = $file_counters;
$self->{'elements_in_file_count'} = $elements_in_file_count;
+
+ $self->{'filenames'} = $filenames;
+ $self->{'file_counters'} = $file_counters;
$self->{'out_filepaths'} = $out_filepaths;
return %$XS_files_source_info;
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index f2cb363248..1f31df210d 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -198,8 +198,10 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
FILE_SOURCE_INFO_LIST *files_source_info = 0;
SV *files_source_info_sv;
SV *global_units_directions_sv;
- SV *file_counters_sv;
SV *elements_in_file_count_sv;
+
+ SV *filenames_sv;
+ SV *file_counters_sv;
SV *out_filepaths_sv;
PPCODE:
/* add warn string? */
@@ -232,16 +234,21 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
global_units_directions_sv
= build_html_global_units_directions (self->global_units_directions,
self->special_units_direction_name);
- file_counters_sv = build_file_counters (self->output_unit_files);
elements_in_file_count_sv
= build_html_elements_in_file_count (self->output_unit_files);
+
+ /* file names API */
+ filenames_sv = build_filenames (self->output_unit_files);
+ file_counters_sv = build_file_counters (self->output_unit_files);
out_filepaths_sv = build_out_filepaths (self->output_unit_files);
- EXTEND(SP, 5);
+ EXTEND(SP, 6);
PUSHs(sv_2mortal(files_source_info_sv));
PUSHs(sv_2mortal(global_units_directions_sv));
- PUSHs(sv_2mortal(file_counters_sv));
PUSHs(sv_2mortal(elements_in_file_count_sv));
+
+ PUSHs(sv_2mortal(filenames_sv));
+ PUSHs(sv_2mortal(file_counters_sv));
PUSHs(sv_2mortal(out_filepaths_sv));
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index 3783dd4836..d8f8608740 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -374,14 +374,15 @@ find_output_unit_file (CONVERTER *self, char *filename)
int i;
for (i = 0; i < output_unit_files->number; i++)
{
- if (!strcmp (output_unit_files->list[i].filename, filename))
+ if (!strcmp (output_unit_files->list[i].normalized_filename, filename))
return &output_unit_files->list[i];
}
return 0;
}
static FILE_NAME_PATH_COUNTER *
-add_output_units_file (CONVERTER *self, char *filename)
+add_output_units_file (CONVERTER *self, char *filename,
+ char *normalized_filename)
{
FILE_NAME_PATH_COUNTER *new_output_unit_file;
FILE_NAME_PATH_COUNTER_LIST *output_unit_files
@@ -398,6 +399,10 @@ add_output_units_file (CONVERTER *self, char *filename)
new_output_unit_file = &output_unit_files->list[output_unit_files->number];
memset (new_output_unit_file, 0, sizeof (FILE_NAME_PATH_COUNTER));
new_output_unit_file->filename = strdup (filename);
+ if (normalized_filename)
+ new_output_unit_file->normalized_filename = strdup (normalized_filename);
+ else
+ new_output_unit_file->normalized_filename = strdup (filename);
output_unit_files->number++;
@@ -427,7 +432,8 @@ register_normalize_case_filename (CONVERTER *self, char
*filename)
}
else
{
- output_unit_file = add_output_units_file (self, lc_filename);
+ output_unit_file = add_output_units_file (self, filename,
+ lc_filename);
free (lc_filename);
}
}
@@ -443,7 +449,7 @@ register_normalize_case_filename (CONVERTER *self, char
*filename)
}
}
else
- output_unit_file = add_output_units_file (self, filename);
+ output_unit_file = add_output_units_file (self, filename, 0);
}
return output_unit_file;
}
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index d0d52e925e..eaaa292f89 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -1669,7 +1669,8 @@ build_html_global_units_directions (OUTPUT_UNIT
**global_units_directions,
}
SV *
-build_file_counters (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+build_html_elements_in_file_count (
+ FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
{
int i;
HV *hv;
@@ -1687,7 +1688,7 @@ build_file_counters (FILE_NAME_PATH_COUNTER_LIST
*output_unit_files)
char *filename = output_unit_file->filename;
hv_store (hv, filename, strlen (filename),
- newSViv (output_unit_file->counter), 0);
+ newSViv (output_unit_file->elements_in_file_count), 0);
}
}
@@ -1695,7 +1696,34 @@ build_file_counters (FILE_NAME_PATH_COUNTER_LIST
*output_unit_files)
}
SV *
-build_out_filepaths (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+build_filenames (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+{
+ int i;
+ HV *hv;
+
+ dTHX;
+
+ hv = newHV ();
+
+ if (output_unit_files)
+ {
+ for (i = 0; i < output_unit_files->number; i++)
+ {
+ FILE_NAME_PATH_COUNTER *output_unit_file
+ = &output_unit_files->list[i];
+ char *normalized_filename = output_unit_file->normalized_filename;
+
+ hv_store (hv, normalized_filename, strlen (normalized_filename),
+ newSVpv (output_unit_file->filename,
+ strlen (output_unit_file->filename)), 0);
+ }
+ }
+
+ return newRV_noinc ((SV *) hv);
+}
+
+SV *
+build_file_counters (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
{
int i;
HV *hv;
@@ -1713,8 +1741,7 @@ build_out_filepaths (FILE_NAME_PATH_COUNTER_LIST
*output_unit_files)
char *filename = output_unit_file->filename;
hv_store (hv, filename, strlen (filename),
- newSVpv (output_unit_file->filepath,
- strlen (output_unit_file->filepath)), 0);
+ newSViv (output_unit_file->counter), 0);
}
}
@@ -1722,8 +1749,7 @@ build_out_filepaths (FILE_NAME_PATH_COUNTER_LIST
*output_unit_files)
}
SV *
-build_html_elements_in_file_count (
- FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+build_out_filepaths (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
{
int i;
HV *hv;
@@ -1741,9 +1767,11 @@ build_html_elements_in_file_count (
char *filename = output_unit_file->filename;
hv_store (hv, filename, strlen (filename),
- newSViv (output_unit_file->elements_in_file_count), 0);
+ newSVpv (output_unit_file->filepath,
+ strlen (output_unit_file->filepath)), 0);
}
}
return newRV_noinc ((SV *) hv);
}
+
diff --git a/tp/Texinfo/XS/main/build_perl_info.h
b/tp/Texinfo/XS/main/build_perl_info.h
index a7dba3f28a..a48a52c820 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -38,8 +38,11 @@ void pass_converter_errors (ERROR_MESSAGE_LIST
*error_messages,
SV *build_html_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info);
SV *build_html_global_units_directions (OUTPUT_UNIT **global_units_directions,
SPECIAL_UNIT_DIRECTION **special_units_direction_name);
-SV *build_file_counters (FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
SV *build_html_elements_in_file_count (
FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
+
+SV *build_filenames (FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
+SV *build_file_counters (FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
SV *build_out_filepaths (FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
+
#endif
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 6a83a72a83..9e6d1bf9e9 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -281,6 +281,7 @@ typedef struct FILE_NAME_PATH {
typedef struct FILE_NAME_PATH_COUNTER {
char *filename;
+ char *normalized_filename;
char *filepath;
int counter;
int elements_in_file_count; /* only used in HTML, corresponds to
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/converter.c (find_output_unit_file) (add_output_units_file, register_normalize_case_filename), tp/Texinfo/XS/main/utils.h (FILE_NAME_PATH_COUNTER): add normalized_filename field in FILE_NAME_PATH_COUNTER to distinguish case independent file name and case dependent file name with CASE_INSENSITIVE_FILENAMES.,
Patrice Dumas <=