[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7156] parsetexi settitle
From: |
gavinsmith0123 |
Subject: |
[7156] parsetexi settitle |
Date: |
Sun, 8 May 2016 15:23:50 +0000 (UTC) |
Revision: 7156
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7156
Author: gavin
Date: 2016-05-08 15:23:50 +0000 (Sun, 08 May 2016)
Log Message:
-----------
parsetexi settitle
Modified Paths:
--------------
trunk/tp/parsetexi/Parsetexi.pm
trunk/tp/parsetexi/Parsetexi.xs
trunk/tp/parsetexi/api.c
trunk/tp/parsetexi/api.h
trunk/tp/parsetexi/handle_commands.c
trunk/tp/parsetexi/input.c
trunk/tp/parsetexi/tree_types.h
Modified: trunk/tp/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/parsetexi/Parsetexi.pm 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/Parsetexi.pm 2016-05-08 15:23:50 UTC (rev 7156)
@@ -286,7 +286,7 @@
#print "Getting tree...\n";
my ($TREE, $LABELS, $FLOATS,
- $INDEX_NAMES, $ERRORS, $GLOBAL_INFO);
+ $INDEX_NAMES, $ERRORS, $GLOBAL_INFO, $GLOBAL_INFO2);
if (1) {
# This is our third way of passing the data: construct it using
# Perl api directly.
@@ -306,6 +306,8 @@
# from about 17.0 sec to 13.0 sec. documentencoding is utf-8.
$GLOBAL_INFO = build_global_info ();
+ $GLOBAL_INFO2 = build_global_info2 ();
+
} elsif (0) {
# $| = 1; # Flush after each print
print "Parsing file...\n";
@@ -390,6 +392,7 @@
$self->{'info'} = $GLOBAL_INFO;
#print "!!! ENCODING IS ", $self->{'info'}->{'input_encoding_name'} , "\n";
+ $self->{'extra'} = $GLOBAL_INFO2;
if (defined($self->{'info'}->{'input_encoding_name'})) {
my ($texinfo_encoding, $perl_encoding, $input_encoding)
@@ -474,6 +477,9 @@
my $FLOATS = build_float_list ();
$self->{'floats'} = $FLOATS;
+ my $GLOBAL_INFO2 = build_global_info2 ();
+ $self->{'extra'} = $GLOBAL_INFO2;
+
_get_errors ($self);
_add_parents ($tree);
_complete_node_list ($self, $tree);
Modified: trunk/tp/parsetexi/Parsetexi.xs
===================================================================
--- trunk/tp/parsetexi/Parsetexi.xs 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/Parsetexi.xs 2016-05-08 15:23:50 UTC (rev 7156)
@@ -16,6 +16,7 @@
HV *build_float_list (void);
HV *build_index_data (void);
HV *build_global_info (void);
+HV *build_global_info2 (void);
MODULE = Parsetexi PACKAGE = Parsetexi
@@ -112,6 +113,9 @@
HV *
build_global_info ()
+HV *
+build_global_info2 ()
+
void
reset_parser ()
Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/api.c 2016-05-08 15:23:50 UTC (rev 7156)
@@ -57,7 +57,7 @@
void
parse_file (char *filename)
{
- debug_output = 1;
+ debug_output = 0;
reset_parser ();
parse_texi_file (filename);
}
@@ -236,8 +236,6 @@
|| e->cmd == CM_anchor
|| e->cmd == CM_macro
|| e->cmd == CM_multitable
- || e->cmd == CM_item
- || e->cmd == CM_tab
|| e->type == ET_menu_entry_name
|| e->type == ET_brace_command_arg
|| e->cmd == CM_TeX
@@ -780,3 +778,21 @@
newSVpv (global_info.input_encoding_name, 0), 0);
return hv;
}
+
+/* Return object to be used as $self->{'extra'} in the Perl code, which
+ are mostly references to tree elements. */
+HV *
+build_global_info2 (void)
+{
+ HV *hv;
+
+ dTHX;
+
+ hv = newHV ();
+ if (global_info.settitle && global_info.settitle->hv)
+ {
+ hv_store (hv, "settitle", strlen ("settitle"),
+ newRV_inc ((SV *) global_info.settitle->hv), 0);
+ }
+ return hv;
+}
Modified: trunk/tp/parsetexi/api.h
===================================================================
--- trunk/tp/parsetexi/api.h 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/api.h 2016-05-08 15:23:50 UTC (rev 7156)
@@ -9,6 +9,7 @@
void reset_parser (void);
//HV *build_global_info (void);
+//HV *build_global_info2 (void);
/* Defined in dump_perl.c */
char *dump_tree_to_string_1 (void);
Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c 2016-05-08 14:50:13 UTC (rev
7155)
+++ trunk/tp/parsetexi/handle_commands.c 2016-05-08 15:23:50 UTC (rev
7156)
@@ -102,6 +102,16 @@
{
if (!current->line_nr.line_nr)
current->line_nr = line_nr;
+ switch (cmd)
+ {
+ extern int input_number;
+ case CM_setfilename:
+ /* Check if we are inside an @include, and if so, do nothing. */
+ if (input_number > 1)
+ break;
+ case CM_settitle:
+ global_info.settitle = current;
+ }
return 1;
}
Modified: trunk/tp/parsetexi/input.c
===================================================================
--- trunk/tp/parsetexi/input.c 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/input.c 2016-05-08 15:23:50 UTC (rev 7156)
@@ -39,7 +39,7 @@
} INPUT;
static INPUT *input_stack = 0;
-static size_t input_number = 0;
+size_t input_number = 0;
static size_t input_space = 0;
/* Current filename and line number. Used for reporting. */
Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h 2016-05-08 14:50:13 UTC (rev 7155)
+++ trunk/tp/parsetexi/tree_types.h 2016-05-08 15:23:50 UTC (rev 7156)
@@ -104,6 +104,7 @@
typedef struct GLOBAL_INFO {
char *input_file_name;
char *input_encoding_name;
+ ELEMENT *settitle; /* Title of document. */
} GLOBAL_INFO;
typedef struct {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7156] parsetexi settitle,
gavinsmith0123 <=