[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7533] parsetexi record more global commands
From: |
gavinsmith0123 |
Subject: |
[7533] parsetexi record more global commands |
Date: |
Tue, 22 Nov 2016 18:58:34 +0000 (UTC) |
Revision: 7533
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7533
Author: gavin
Date: 2016-11-22 18:58:34 +0000 (Tue, 22 Nov 2016)
Log Message:
-----------
parsetexi record more global commands
Modified Paths:
--------------
trunk/tp/parsetexi/api.c
trunk/tp/parsetexi/end_line.c
trunk/tp/parsetexi/handle_commands.c
trunk/tp/parsetexi/tree_types.h
Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c 2016-11-22 11:55:42 UTC (rev 7532)
+++ trunk/tp/parsetexi/api.c 2016-11-22 18:58:34 UTC (rev 7533)
@@ -904,6 +904,7 @@
/* The following are arrays of elements. */
+
if (global_info.footnotes.contents.number > 0)
{
av = newAV ();
@@ -916,102 +917,48 @@
av_push (av, newRV_inc ((SV *) e->hv));
}
}
- if (global_info.hyphenation.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "hyphenation", strlen ("hyphenation"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.hyphenation.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.hyphenation, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
+
+#define BUILD_GLOBAL_ARRAY(cmd) \
+ if (global_info.cmd.contents.number > 0) \
+ { \
+ av = newAV (); \
+ hv_store (hv, #cmd, strlen (#cmd), \
+ newRV_inc ((SV *) av), 0); \
+ for (i = 0; i < global_info.cmd.contents.number; i++) \
+ { \
+ e = contents_child_by_index (&global_info.cmd, i); \
+ if (e->hv) \
+ av_push (av, newRV_inc ((SV *) e->hv)); \
+ } \
}
- if (global_info.insertcopying.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "insertcopying", strlen ("insertcopying"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.insertcopying.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.insertcopying, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.printindex.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "printindex", strlen ("printindex"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.printindex.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.printindex, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.subtitle.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "subtitle", strlen ("subtitle"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.subtitle.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.subtitle, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.titlefont.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "titlefont", strlen ("titlefont"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.titlefont.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.titlefont, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.listoffloats.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "listoffloats", strlen ("listoffloats"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.listoffloats.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.listoffloats, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.detailmenu.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "detailmenu", strlen ("detailmenu"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.detailmenu.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.detailmenu, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
- if (global_info.part.contents.number > 0)
- {
- av = newAV ();
- hv_store (hv, "part", strlen ("part"),
- newRV_inc ((SV *) av), 0);
- for (i = 0; i < global_info.part.contents.number; i++)
- {
- e = contents_child_by_index (&global_info.part, i);
- if (e->hv)
- av_push (av, newRV_inc ((SV *) e->hv));
- }
- }
+
+ BUILD_GLOBAL_ARRAY(hyphenation);
+ BUILD_GLOBAL_ARRAY(insertcopying);
+ BUILD_GLOBAL_ARRAY(printindex);
+ BUILD_GLOBAL_ARRAY(subtitle);
+ BUILD_GLOBAL_ARRAY(titlefont);
+ BUILD_GLOBAL_ARRAY(listoffloats);
+ BUILD_GLOBAL_ARRAY(detailmenu);
+ BUILD_GLOBAL_ARRAY(part);
+
+ /* from Common.pm %document_settable_at_commands */
+ BUILD_GLOBAL_ARRAY(allowcodebreaks);
+ BUILD_GLOBAL_ARRAY(clickstyle);
+ BUILD_GLOBAL_ARRAY(codequotebacktick);
+ BUILD_GLOBAL_ARRAY(codequoteundirected);
+ BUILD_GLOBAL_ARRAY(contents);
+ BUILD_GLOBAL_ARRAY(deftypefnnewline);
+ BUILD_GLOBAL_ARRAY(documentencoding);
+ BUILD_GLOBAL_ARRAY(documentlanguage);
+ BUILD_GLOBAL_ARRAY(exampleindent);
+ BUILD_GLOBAL_ARRAY(firstparagraphindent);
+ BUILD_GLOBAL_ARRAY(frenchspacing);
+ BUILD_GLOBAL_ARRAY(headings);
+ BUILD_GLOBAL_ARRAY(kbdinputstyle);
+ BUILD_GLOBAL_ARRAY(paragraphindent);
+ BUILD_GLOBAL_ARRAY(shortcontents);
+ BUILD_GLOBAL_ARRAY(urefbreakstyle);
+ BUILD_GLOBAL_ARRAY(xrefautomaticsectiontitle);
return hv;
}
Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c 2016-11-22 11:55:42 UTC (rev 7532)
+++ trunk/tp/parsetexi/end_line.c 2016-11-22 18:58:34 UTC (rev 7533)
@@ -1662,7 +1662,7 @@
add_extra_string (current, "input_encoding_name",
input_encoding);
- global_info.input_encoding_name = text; // 3210
+ global_info.input_encoding_name = input_encoding; // 3210
set_input_encoding (input_encoding);
}
}
Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c 2016-11-22 11:55:42 UTC (rev
7532)
+++ trunk/tp/parsetexi/handle_commands.c 2016-11-22 18:58:34 UTC (rev
7533)
@@ -96,33 +96,43 @@
current->line_nr = line_nr;
switch (cmd)
{
+#define GLOBAL_CASE(cmx) \
+ case CM_##cmx: \
+ add_to_contents_as_array (&global_info.cmx, current); \
+ break
+
case CM_footnote:
add_to_contents_as_array (&global_info.footnotes, current);
break;
- case CM_hyphenation:
- add_to_contents_as_array (&global_info.hyphenation, current);
- break;
- case CM_insertcopying:
- add_to_contents_as_array (&global_info.insertcopying, current);
- break;
- case CM_printindex:
- add_to_contents_as_array (&global_info.printindex, current);
- break;
- case CM_subtitle:
- add_to_contents_as_array (&global_info.subtitle, current);
- break;
- case CM_titlefont:
- add_to_contents_as_array (&global_info.titlefont, current);
- break;
- case CM_listoffloats:
- add_to_contents_as_array (&global_info.listoffloats, current);
- break;
- case CM_detailmenu:
- add_to_contents_as_array (&global_info.detailmenu, current);
- break;
- case CM_part:
- add_to_contents_as_array (&global_info.part, current);
- break;
+
+ GLOBAL_CASE(hyphenation);
+ GLOBAL_CASE(insertcopying);
+ GLOBAL_CASE(printindex);
+ GLOBAL_CASE(subtitle);
+ GLOBAL_CASE(titlefont);
+ GLOBAL_CASE(listoffloats);
+ GLOBAL_CASE(detailmenu);
+ GLOBAL_CASE(part);
+
+ /* from Common.pm %document_settable_at_commands */
+ GLOBAL_CASE(allowcodebreaks);
+ GLOBAL_CASE(clickstyle);
+ GLOBAL_CASE(codequotebacktick);
+ GLOBAL_CASE(codequoteundirected);
+ GLOBAL_CASE(contents);
+ GLOBAL_CASE(deftypefnnewline);
+ GLOBAL_CASE(documentencoding);
+ GLOBAL_CASE(documentlanguage);
+ GLOBAL_CASE(exampleindent);
+ GLOBAL_CASE(firstparagraphindent);
+ GLOBAL_CASE(frenchspacing);
+ GLOBAL_CASE(headings);
+ GLOBAL_CASE(kbdinputstyle);
+ GLOBAL_CASE(paragraphindent);
+ GLOBAL_CASE(shortcontents);
+ GLOBAL_CASE(urefbreakstyle);
+ GLOBAL_CASE(xrefautomaticsectiontitle);
+#undef GLOBAL_CASE
}
/* TODO: Check if all of these are necessary. */
return 1;
Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h 2016-11-22 11:55:42 UTC (rev 7532)
+++ trunk/tp/parsetexi/tree_types.h 2016-11-22 18:58:34 UTC (rev 7533)
@@ -152,6 +152,24 @@
ELEMENT listoffloats;
ELEMENT detailmenu;
ELEMENT part;
+
+ ELEMENT allowcodebreaks;
+ ELEMENT clickstyle;
+ ELEMENT codequotebacktick;
+ ELEMENT codequoteundirected;
+ ELEMENT contents;
+ ELEMENT deftypefnnewline;
+ ELEMENT documentencoding;
+ ELEMENT documentlanguage;
+ ELEMENT exampleindent;
+ ELEMENT firstparagraphindent;
+ ELEMENT frenchspacing;
+ ELEMENT headings;
+ ELEMENT kbdinputstyle;
+ ELEMENT paragraphindent;
+ ELEMENT shortcontents;
+ ELEMENT urefbreakstyle;
+ ELEMENT xrefautomaticsectiontitle;
} GLOBAL_INFO;
typedef struct CONF {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7533] parsetexi record more global commands,
gavinsmith0123 <=