Codebase list texinfo / af90468
New upstream version 6.5.91.dfsg.1 Norbert Preining 5 years ago
87 changed file(s) with 8736 addition(s) and 9904 deletion(s). Raw diff Collapse all Expand all
0 2019-01-04 Gavin Smith <gavinsmith0123@gmail.com>
1
2 pretest 6.5.91.
3
4 * configure.ac: version
5
6 2019-01-13 Gavin Smith <gavinsmith0123@gmail.com>
7
8 * info/man.c: Include stdio.h.
9
10 2019-01-12 Hans-Bernhard Bröker <HBBroeker@t-online.de> (tiny change)
11
12 Fix some warnings.
13
14 * tp/Texinfo/XS/parsetexi/close.c: Initialize a variable.
15
16 2019-01-12 Hans-Bernhard Bröker <HBBroeker@t-online.de> (tiny change)
17
18 Fix some warnings.
19
20 * tp/Texinfo/XS/parsetexi/end_line.c: Fix an unterminated
21 comment.
22 (check_empty_node): Avoid reaching end of undefined function.
23 * tp/Texinfo/XS/parsetexi/parser.c (register_global_command):
24 Add default cases.
25 * tp/Texinfo/XS/parsetexi/multitable.c (gather_previous_item):
26 Correct enum type in variable declaration.
27
28 2019-01-12 Gavin Smith <gavinsmith0123@gmail.com>
29
30 Remove unused variables.
31
32 * tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
33 * tp/Texinfo/XS/parsetexi/parser.c (register_global_command)
34 (process_remaining_on_line),
35 * tp/Texinfo/XS/parsetexi/convert.c (expand_cmd_args_to_texi),
36 * tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args)
37 (end_line_starting_block, end_line_misc_line),
38 * tp/Texinfo/XS/parsetexi/macro.c (expand_macro_body),
39 * tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
40 * tp/Texinfo/XS/parsetexi/def.c (split_delimiters, split_def_args)
41 (parse_def): Remove declarations of unused variables.
42
43 2019-01-12 Gavin Smith <gavinsmith0123@gmail.com>
44
45 Remove an unused variable.
46
47 * tp/Texinfo/ParserNonXS.pm (_parse_texi): Remove an unused
48 variable.
49
50 2019-01-12 Gavin Smith <gavinsmith0123@gmail.com>
51
52 Add a default case.
53
54 * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
55 Add an empty default clause in switch block.
56
57 2019-01-12 Gavin Smith <gavinsmith0123@gmail.com>
58
59 * tp/Texinfo/XS/parsetexi: Fix implicit function declarations.
60
61 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
62
63 Make Parsetexi XS module conditional on iconv.
64
65 * tp/Texinfo/XS/configure.ac: Add an AM_CONDITIONAL checking
66 whether gnulib found that iconv worked.
67 * tp/Texinfo/XS/Makefile.am: Make building Parsetexi module
68 conditional.
69
70 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
71
72 Set PERL_EXT_var in configure.ac.
73
74 * tp/Texinfo/XS/configure.ac,
75 * tp/Texinfo/XS/Makefile.am: Move setting of CFLAGS, CPPFLAGS
76 and LDFLAGS from PERL_EXT_CFLAGS, PERL_EXT_CPPFLAGS and
77 PERL_EXT_LDFLAGS from Makefile.am to configure.ac in order that
78 they are used during the Gnulib checks. Report from Bruno Haible.
79
80 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
81
82 No buffering for pseudotty output.
83
84 * info/pseudotty.c: Set VMIN value on the c_cc array in the
85 termios structure to 1, meaning 'read' can return with a single
86 byte. (The default value on Solaris 10 was found to be 4, which
87 may be C-d for end-of-file.) Also set VTIME to 0.
88
89 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
90
91 Turn off canonical input processing in pseudotty.
92
93 * info/pseudotty.c [HAVE_TERMIOS_H]: Clear the ICANON and ECHO
94 flags.
95
96 In the test suite, if bytes were passed through the pseudotty
97 program before ginfo could make this change, they could be
98 subject to undesired processing. This was not apparent as info
99 treated '\n' the same as '\r'. This could be shown by using a
100 "dribble" file and inserting a "sleep" in one of the test scripts.
101 Tests were failing on Solaris 10 and Solaris 11 because bytes
102 that were supposed to be sent to ginfo were being buffered,
103 awaiting a newline.
104
105 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
106
107 Do not send debug output to infodebug file.
108
109 * info/session.c (vinfo_debug): Always sent debugging output to
110 stderr.
111 (close_debugfile, debug_file): Remove.
112 * doc/info-stnd.texi (Invoking Info): Update.
113 * NEWS: Mention change.
114
115 This is to make all the debugging output from info appear
116 together in a log files when output is diverted from a test
117 script.
118
119 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
120
121 Avoid possible infinite loop in info test suite.
122
123 * info/t/replace-viewed.sh: Replace a loop that waits for ginfo
124 to create a file with a "sleep" statement. If the file weren't
125 created, this would be an infinte loop.
126
127 2019-01-07 Gavin Smith <gavinsmith0123@gmail.com>
128
129 Remove useless code in info test suite.
130
131 * info/t/replace-viewed.sh,
132 * info/t/resize-in-completions: Do not check for a variable
133 having a value that no code sets it to. This has been the case
134 since the way the PID of the process was found changed.
135
136 2019-01-06 Gavin Smith <gavinsmith0123@gmail.com>
137
138 Fix info tests under Solaris.
139
140 * info/pseudotty.c [__sun]: Additionally perform a "ttycompat"
141 ioctl on the slave fd. This is what is done in the gnulib
142 openpty module. Since these ioctls were no longer guarded by
143 isatty, it would lead to some of the info tests failing. I
144 don't know under what conditions the ioctls are actually needed
145 under Solaris: possibly they aren't needed at all.
146
147 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
148
149 Include iconv.h unconditionally.
150
151 * tp/Texinfo/XS/parsetexi/input.c: Do not depend on HAVE_ICONV
152 for #include <iconv.h>. Use of iconv_t, iconv_open etc. later
153 on in the file is not conditional, and we don't have a way to
154 avoid using these. It's possible that gnulib set HAVE_ICONV to
155 0 because it found that iconv.h was buggy, even if it existed.
156
157 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
158
159 Don't use variable in SOURCES in Makefile.am.
160
161 * tp/Texinfo/XS/Makefile.am (Parsetexi_la_SOURCES, BUILT_SOURCES):
162 Write out "parsetexi" explicitly instead of hiding it inside $p.
163 Although the latter works with automake 1.16 (which we are
164 using), the OpenCSW buildbot still uses automake 1.15.1, leading
165 to build failures.
166
167 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
168
169 Integrate parsetexi with gnulib.
170
171 * tp/Texinfo/XS/parsetexi/input.c: Do not define ICONV_CONST.
172
173 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
174
175 Fall back to pure Perl module when TEXINFO_XS_PARSER is set.
176
177 * tp/Texinfo/Parser.pm, tp/Texinfo/ParserNonXS.pm: Rename file.
178 * tp/Texinfo/ParserNonXS.pm: Make module symbols available under
179 both Texinfo::Parser and Texinfo::ParserNonXS.
180 * tp/Texinfo/ModulePath.pm.in: If TEXINFO_XS_PARSER is not set,
181 load Texinfo/ParserNonXS.pm instead of Texinfo/Parser.pm.
182 * tp/Texinfo/XS/parsetexi/Parsetexi.pm: Pass Texinfo::ParserNonXS
183 as a fallback module to Texinfo::XSLoader::init. Comment out
184 line to reset_parser in END block, as this won't work if
185 Texinfo::ParserNonXS is loaded.
186
187 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
188
189 Fix info test suite hang under HP-UX 11.31.
190
191 * info/pseudotty.c [HAVE_STROPTS_H]: Do not call isatty on
192 pseudoterminal file descriptor. Bruno Haible reported that this
193 made a test hang. Do not use HAVE_STROPTS_H condition: replace
194 with "#if defined(__hpux) || defined(__sun)", as is done in
195 gnulib. Remove some commented-out code.
196 * configure.ac (AC_CHECK_HEADERS): Do not check for stropts.h.
197
198 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
199
200 Improve XS loading error message.
201
202 * tp/Texinfo/XSLoader.pm: Improve error message in the case that
203 a module couldn't be loaded.
204
205 2019-01-05 Bruno Haible <bruno@clisp.org>
206
207 Fix build errors on AIX 7.1.
208
209 * info/Makefile.am (LDADD),
210 * install-info/Makefile.am (LDADD): Add $(LIBTHREAD).
211
212 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
213
214 Check for Data::Dumper.
215
216 * configure.ac: Check for Data::Dumper as well as Encode. Bruno
217 Haible reported that Data::Dumper was missing on CentOS 7.3.
218
219 2019-01-05 Gavin Smith <gavinsmith0123@gmail.com>
220
221 Combine Makefiles for XS modules.
222
223 * tp/Texinfo/XS/configure.ac (AC_CONFIG_FILES): Remove Makefile
224 in parsetexi subdirectory.
225 * tp/Texinfo/XS/Makefile.am: Merge in contents of
226 tp/Texinfo/XS/parsetexi/Makefile.am.
227 * tp/Texinfo/XS/parsetexi/Makefile.am: Remove file.
228
229 This means that passing -lperl when linking will always be
230 conditional on HOST_NEEDS_NO_UNDEFINED.
231
0232 2019-01-04 Gavin Smith <gavinsmith0123@gmail.com>
1233
2234 pretest 6.5.90.
3939 implemented in texinfo.tex)
4040 . `FIX_TEXINFO' removed as a customization variable
4141 . do not recognise or warn about obsolete customization variables
42
43 * info
44 . debugging output with -x is not diverted to a separated infodebug file
4245
4346 * Development:
4447 . switch from Subversion to git
499499
500500 /* Define to 1 if you have the `strnlen' function. */
501501 #undef HAVE_STRNLEN
502
503 /* Define to 1 if you have the <stropts.h> header file. */
504 #undef HAVE_STROPTS_H
505502
506503 /* Define to 1 if `decimal_point' is a member of `struct lconv'. */
507504 #undef HAVE_STRUCT_LCONV_DECIMAL_POINT
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for GNU Texinfo 6.5.90.
2 # Generated by GNU Autoconf 2.69 for GNU Texinfo 6.5.91.
33 #
44 # Report bugs to <bug-texinfo@gnu.org>.
55 #
579579 # Identity of this package.
580580 PACKAGE_NAME='GNU Texinfo'
581581 PACKAGE_TARNAME='texinfo'
582 PACKAGE_VERSION='6.5.90'
583 PACKAGE_STRING='GNU Texinfo 6.5.90'
582 PACKAGE_VERSION='6.5.91'
583 PACKAGE_STRING='GNU Texinfo 6.5.91'
584584 PACKAGE_BUGREPORT='bug-texinfo@gnu.org'
585585 PACKAGE_URL='http://www.gnu.org/software/texinfo/'
586586
20742074 # Omit some internal or obsolete options to make the list less imposing.
20752075 # This message is too long to be a string in the A/UX 3.1 sh.
20762076 cat <<_ACEOF
2077 \`configure' configures GNU Texinfo 6.5.90 to adapt to many kinds of systems.
2077 \`configure' configures GNU Texinfo 6.5.91 to adapt to many kinds of systems.
20782078
20792079 Usage: $0 [OPTION]... [VAR=VALUE]...
20802080
21442144
21452145 if test -n "$ac_init_help"; then
21462146 case $ac_init_help in
2147 short | recursive ) echo "Configuration of GNU Texinfo 6.5.90:";;
2147 short | recursive ) echo "Configuration of GNU Texinfo 6.5.91:";;
21482148 esac
21492149 cat <<\_ACEOF
21502150
22822282 test -n "$ac_init_help" && exit $ac_status
22832283 if $ac_init_version; then
22842284 cat <<\_ACEOF
2285 GNU Texinfo configure 6.5.90
2285 GNU Texinfo configure 6.5.91
22862286 generated by GNU Autoconf 2.69
22872287
22882288 Copyright (C) 2012 Free Software Foundation, Inc.
29912991 This file contains any messages produced by compilers while
29922992 running configure, to aid debugging if configure makes a mistake.
29932993
2994 It was created by GNU Texinfo $as_me 6.5.90, which was
2994 It was created by GNU Texinfo $as_me 6.5.91, which was
29952995 generated by GNU Autoconf 2.69. Invocation command line was
29962996
29972997 $ $0 $@
38923892
38933893 # Define the identity of the package.
38943894 PACKAGE='texinfo'
3895 VERSION='6.5.90'
3895 VERSION='6.5.91'
38963896
38973897
38983898 cat >>confdefs.h <<_ACEOF
41814181
41824182
41834183
4184 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Perl version and Encode module" >&5
4185 $as_echo_n "checking Perl version and Encode module... " >&6; }
4186 if $PERL -e "use 5.007_003; use Encode;" > /dev/null 2>&1; then
4184 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Perl version and modules" >&5
4185 $as_echo_n "checking Perl version and modules... " >&6; }
4186 if $PERL -e "use 5.007_003; use Encode; use Data::Dumper" >/dev/null 2>&1; then
41874187 perl_version_requirement='yes'
41884188 else
41894189 perl_version_requirement='no'
41914191 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_version_requirement" >&5
41924192 $as_echo "$perl_version_requirement" >&6; }
41934193 if test z"$perl_version_requirement" = 'zno' ; then
4194 as_fn_error $? "perl >= 5.7.3 with Encode required by Texinfo." "$LINENO" 5
4195 fi
4194 as_fn_error $? "perl >= 5.7.3 with Encode and Data::Dumper required by Texinfo." "$LINENO" 5
4195 fi
4196
41964197
41974198
41984199 for ac_prog in gawk mawk nawk awk
2241022411 fi
2241122412
2241222413 for ac_header in fcntl.h io.h limits.h pwd.h string.h strings.h \
22413 stropts.h termcap.h termio.h termios.h unistd.h \
22414 termcap.h termio.h termios.h unistd.h \
2241422415 sys/fcntl.h sys/file.h sys/ioctl.h sys/stream.h \
2241522416 sys/time.h sys/ttold.h sys/wait.h
2241622417 do :
2568225683 # report actual input values of CONFIG_FILES etc. instead of their
2568325684 # values after options handling.
2568425685 ac_log="
25685 This file was extended by GNU Texinfo $as_me 6.5.90, which was
25686 This file was extended by GNU Texinfo $as_me 6.5.91, which was
2568625687 generated by GNU Autoconf 2.69. Invocation command line was
2568725688
2568825689 CONFIG_FILES = $CONFIG_FILES
2575025751 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2575125752 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2575225753 ac_cs_version="\\
25753 GNU Texinfo config.status 6.5.90
25754 GNU Texinfo config.status 6.5.91
2575425755 configured by $0, generated by GNU Autoconf 2.69,
2575525756 with options \\"\$ac_cs_config\\"
2575625757
99 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
1010 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111 #
12 AC_INIT([GNU Texinfo], [6.5.90], [bug-texinfo@gnu.org])
12 AC_INIT([GNU Texinfo], [6.5.91], [bug-texinfo@gnu.org])
1313
1414 dnl Must come before AM_INIT_AUTOMAKE.
1515 AC_CONFIG_AUX_DIR([build-aux])
5959 AC_ARG_VAR([PERL_EXT_LDFLAGS], [Linker flags for a Perl extension])
6060 AC_ARG_VAR([PERL_EXT_CC], [Compiler for a Perl extension])
6161
62 AC_MSG_CHECKING([Perl version and Encode module])
63 if $PERL -e "use 5.007_003; use Encode;" > /dev/null 2>&1; then
62 AC_MSG_CHECKING([Perl version and modules])
63 if $PERL -e "use 5.007_003; use Encode; use Data::Dumper" >/dev/null 2>&1; then
6464 perl_version_requirement='yes'
6565 else
6666 perl_version_requirement='no'
6767 fi
6868 AC_MSG_RESULT($perl_version_requirement)
6969 if test z"$perl_version_requirement" = 'zno' ; then
70 AC_MSG_ERROR([perl >= 5.7.3 with Encode required by Texinfo.])
71 fi
70 AC_MSG_ERROR([perl >= 5.7.3 with Encode and Data::Dumper required by Texinfo.])
71 fi
72
7273
7374 AC_REQUIRE_AUX_FILE([tap-driver.sh])
7475 AC_PROG_AWK
140141 AC_HEADER_STAT
141142 AC_HEADER_STDC
142143 AC_CHECK_HEADERS(fcntl.h io.h limits.h pwd.h string.h strings.h \
143 stropts.h termcap.h termio.h termios.h unistd.h \
144 termcap.h termio.h termios.h unistd.h \
144145 sys/fcntl.h sys/file.h sys/ioctl.h sys/stream.h \
145146 sys/time.h sys/ttold.h sys/wait.h)
146147
0 @set UPDATED 3 January 2019
0 @set UPDATED 13 January 2019
11 @set UPDATED-MONTH January 2019
2 @set EDITION 6.5.90
3 @set VERSION 6.5.90
2 @set EDITION 6.5.91
3 @set VERSION 6.5.91
0 @set UPDATED 3 January 2019
0 @set UPDATED 13 January 2019
11 @set UPDATED-MONTH January 2019
2 @set EDITION 6.5.90
3 @set VERSION 6.5.90
2 @set EDITION 6.5.91
3 @set VERSION 6.5.91
00 # $Id$
11 # Makefile.am for texinfo/doc/tp_api.
22 #
3 # Copyright 2012
4 # Free Software Foundation, Inc.
3 # Copyright 2012-2019 Free Software Foundation, Inc.
54 #
65 # This file is free software; as a special exception the author gives
76 # unlimited permission to copy and/or distribute it, with or without
2827 #DISTCLEANFILES = tp_api.info
2928
3029 tp_api_dependencies = \
31 $(top_srcdir)/tp/Texinfo/Common.pm $(top_srcdir)/tp/Texinfo/Parser.pm \
30 $(top_srcdir)/tp/Texinfo/Common.pm $(top_srcdir)/tp/Texinfo/ParserNonXS.pm \
3231 $(top_srcdir)/tp/Texinfo/Structuring.pm $(top_srcdir)/tp/Texinfo/Report.pm \
3332 $(top_srcdir)/tp/Texinfo/Encoding.pm \
3433 $(top_srcdir)/tp/Texinfo/Convert/NodeNameNormalization.pm \
1616 # $Id$
1717 # Makefile.am for texinfo/doc/tp_api.
1818 #
19 # Copyright 2012
20 # Free Software Foundation, Inc.
19 # Copyright 2012-2019 Free Software Foundation, Inc.
2120 #
2221 # This file is free software; as a special exception the author gives
2322 # unlimited permission to copy and/or distribute it, with or without
10251024
10261025 #DISTCLEANFILES = tp_api.info
10271026 @BUILD_PERL_API_TEXI_TRUE@tp_api_dependencies = \
1028 @BUILD_PERL_API_TEXI_TRUE@ $(top_srcdir)/tp/Texinfo/Common.pm $(top_srcdir)/tp/Texinfo/Parser.pm \
1027 @BUILD_PERL_API_TEXI_TRUE@ $(top_srcdir)/tp/Texinfo/Common.pm $(top_srcdir)/tp/Texinfo/ParserNonXS.pm \
10291028 @BUILD_PERL_API_TEXI_TRUE@ $(top_srcdir)/tp/Texinfo/Structuring.pm $(top_srcdir)/tp/Texinfo/Report.pm \
10301029 @BUILD_PERL_API_TEXI_TRUE@ $(top_srcdir)/tp/Texinfo/Encoding.pm \
10311030 @BUILD_PERL_API_TEXI_TRUE@ $(top_srcdir)/tp/Texinfo/Convert/NodeNameNormalization.pm \
0 @set UPDATED 3 January 2019
0 @set UPDATED 13 January 2019
11 @set UPDATED-MONTH January 2019
2 @set EDITION 6.5.90
3 @set VERSION 6.5.90
2 @set EDITION 6.5.91
3 @set VERSION 6.5.91
0 @set UPDATED 3 January 2019
0 @set UPDATED 13 January 2019
11 @set UPDATED-MONTH January 2019
2 @set EDITION 6.5.90
3 @set VERSION 6.5.90
2 @set EDITION 6.5.91
3 @set VERSION 6.5.91
11 # Makefile.am for texinfo/info.
22 #
33 # Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012,
4 # 2013, 2014, 2015, 2016, 2017 Free Software Foundation, Inc.
4 # 2013, 2014, 2015, 2016, 2017, 2018, 2019 Free Software Foundation, Inc.
55 #
66 # This file is free software; as a special exception the author gives
77 # unlimited permission to copy and/or distribute it, with or without
2525 -DINFODIR=\"$(infodir)\" \
2626 -DINFODIR2=\"$(datadir)/info\"
2727
28 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL) $(LIBICONV)
28 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL) $(LIBICONV) $(LIBTHREAD)
2929
3030 EXTRA_DIST = pcterm.c
3131
1717 # Makefile.am for texinfo/info.
1818 #
1919 # Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012,
20 # 2013, 2014, 2015, 2016, 2017 Free Software Foundation, Inc.
20 # 2013, 2014, 2015, 2016, 2017, 2018, 2019 Free Software Foundation, Inc.
2121 #
2222 # This file is free software; as a special exception the author gives
2323 # unlimited permission to copy and/or distribute it, with or without
232232 am__DEPENDENCIES_1 =
233233 ginfo_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
234234 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
235 $(am__DEPENDENCIES_1)
235 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
236236 am_makedoc_OBJECTS = makedoc.$(OBJEXT)
237237 makedoc_OBJECTS = $(am_makedoc_OBJECTS)
238238 makedoc_LDADD = $(LDADD)
239239 makedoc_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
240240 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
241 $(am__DEPENDENCIES_1)
241 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
242242 am__pseudotty_SOURCES_DIST = pseudotty.c
243243 @have_ptys_TRUE@am_pseudotty_OBJECTS = pseudotty.$(OBJEXT)
244244 pseudotty_OBJECTS = $(am_pseudotty_OBJECTS)
245245 pseudotty_LDADD = $(LDADD)
246246 pseudotty_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
247247 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
248 $(am__DEPENDENCIES_1)
248 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
249249 AM_V_P = $(am__v_P_@AM_V@)
250250 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
251251 am__v_P_0 = false
13121312 -DINFODIR=\"$(infodir)\" \
13131313 -DINFODIR2=\"$(datadir)/info\"
13141314
1315 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL) $(LIBICONV)
1315 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL) $(LIBICONV) $(LIBTHREAD)
13161316 EXTRA_DIST = pcterm.c $(TESTS) $(XFAIL_TESTS) t/README t/infodir \
13171317 t/Init-test.inc t/Infokey-config t/node-target
13181318 ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \
2525 #if defined (HAVE_SYS_WAIT_H)
2626 #include <sys/wait.h>
2727 #endif
28 #include <stdio.h>
2829
2930 #include "tilde.h"
3031 #include "nodes.h"
3333 #include <stdlib.h>
3434 #include <string.h>
3535
36 #if HAVE_STROPTS_H
36 #if defined __sun || defined __hpux /* Solaris, HP-UX */
3737 #include <stropts.h>
3838 #endif
3939
6868 if (slave == -1)
6969 exit (1);
7070
71 #ifdef HAVE_STROPTS_H
72 if (!isatty (slave))
71 #if defined __sun || defined __hpux /* Solaris, HP-UX */
72 if (isastream (slave))
7373 {
7474 error (0, 0, "performing STREAMS ioctl's on slave");
75 if (isastream (slave))
76 {
77 if (ioctl (slave, I_PUSH, "ptem") < 0
78 || ioctl (slave, I_PUSH, "ldterm") < 0)
79 error (1, 0, "STREAMS ioctl's failed");
80 }
75 if (ioctl (slave, I_PUSH, "ptem") < 0
76 || ioctl (slave, I_PUSH, "ldterm") < 0
77 # if defined __sun
78 || ioctl (slave, I_PUSH, "ttcompat") < 0
79 # endif
80 )
81 error (1, 0, "STREAMS ioctl's failed");
8182 }
82 /* Don't close it because it just leads to an EOF read at the master end. */
83 /*
84 error (0, 0, "closing slave device");
85 close (slave);
86 error (0, 0, "...closed");
87 */
8883 #endif
8984
9085 #if defined (HAVE_TERMIOS_H)
10095 t.c_cc[VSTOP] = disable; /* C-s */
10196 t.c_cc[VKILL] = disable; /* C-u */
10297 t.c_cc[VINTR] = disable; /* C-c */
98 t.c_lflag &= (~ICANON & ~ECHO);
99 t.c_cc[VMIN] = 1;
100 t.c_cc[VTIME] = 0;
103101 if (tcsetattr (slave, TCSANOW, &t) == -1)
104102 error (0, 0, "error calling tcsetattr");
105103 }
781781 /* Debugging level */
782782 unsigned debug_level;
783783
784 static FILE *debug_file;
785
786 static void
787 close_debugfile (void)
788 {
789 fclose (debug_file);
790 }
791
792 #define INFODEBUG_FILE "infodebug"
793
794784 static void
795785 vinfo_debug (const char *format, va_list ap)
796786 {
797 FILE *fp;
798
799 if (!debug_file)
800 {
801 if (!info_windows_initialized_p || display_inhibited)
802 fp = stderr;
803 else
804 {
805 debug_file = fopen (INFODEBUG_FILE, "w");
806 if (!debug_file)
807 {
808 info_error (_("can't open %s: %s"), INFODEBUG_FILE,
809 strerror (errno));
810 exit (EXIT_FAILURE);
811 }
812 atexit (close_debugfile);
813 fp = debug_file;
814 info_error (_("debugging output diverted to \"%s\""),
815 INFODEBUG_FILE);
816 }
817 }
818 else
819 fp = debug_file;
820
821 fprintf (fp, "%s: ", program_name);
822 vfprintf (fp, format, ap);
823 fprintf (fp, "\n");
787 fprintf (stderr, "%s: ", program_name);
788 vfprintf (stderr, format, ap);
789 fprintf (stderr, "\n");
824790 fflush (stderr);
825791 }
826792
00 #!/bin/sh
1 # Copyright (C) 2015-2018 Free Software Foundation, Inc.
1 # Copyright (C) 2015-2019 Free Software Foundation, Inc.
22 #
33 # This program is free software; you can redistribute it and/or modify
44 # it under the terms of the GNU General Public License as published by
2424
2525 run_ginfo -f t/replace-viewed.info
2626
27 # Make sure ginfo is up and running. Skip test if no process could be found,
28 # because it may not have started properly.
29 if test $ginfo_pid = unknown ; then
30 retval=77 # skip test
31 cleanup
32 fi
27 # for debugging - show what node we got to
3328 printf 'D' >$pty_type
34 while test ! -f $ginfo_output ; do sleep 1 ; done
29
30 # give ginfo time to load the node
31 sleep 1
3532 cat $ginfo_output
3633
3734 # Now replace the file while it is being viewed.
00 #!/bin/sh
1 # Copyright (C) 2014-2018 Free Software Foundation, Inc.
1 # Copyright (C) 2014-2019 Free Software Foundation, Inc.
22 #
33 # This program is free software; you can redistribute it and/or modify
44 # it under the terms of the GNU General Public License as published by
1919 # Indicate a window resize while showing a completions window
2020
2121 run_ginfo -f file-menu
22 if test $ginfo_pid = unknown; then
23 printf 'q' >$pty_type
24 echo 'test skipped - do not have PID of ginfo process' >&2
25 retval=77 # automake code for skipped test
26 else
27 printf 'g\t' >$pty_type
28 sleep 1 # Give ginfo time to process above keystrokes
29 kill -s WINCH $ginfo_pid
30 sleep 1 # Give ginfo time to process signal
31 # C-g to exit completions, q to quit
32 printf '\007q' >$pty_type
33 fi
22
23 printf 'g\t' >$pty_type
24 sleep 1 # Give ginfo time to process above keystrokes
25 kill -s WINCH $ginfo_pid
26 sleep 1 # Give ginfo time to process signal
27 # C-g to exit completions, q to quit
28 printf '\007q' >$pty_type
3429
3530 timeout_test
3631 cleanup
3232 -I$(top_srcdir)/gnulib/lib \
3333 -I$(top_builddir)/gnulib/lib \
3434 -DLOCALEDIR=\"$(localedir)\"
35 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
35 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL) $(LIBTHREAD)
220220 ginstall_info_LDADD = $(LDADD)
221221 am__DEPENDENCIES_1 =
222222 ginstall_info_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
223 $(am__DEPENDENCIES_1)
223 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
224224 am__dist_bin_SCRIPTS_DIST = ginstall-info.exe.manifest
225225 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
226226 am__vpath_adj = case $$p in \
11471147 -I$(top_builddir)/gnulib/lib \
11481148 -DLOCALEDIR=\"$(localedir)\"
11491149
1150 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
1150 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL) $(LIBTHREAD)
11511151 all: all-recursive
11521152
11531153 .SUFFIXES:
00 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4.
1 .TH INFO "1" "January 2019" "info 6.5.90" "User Commands"
1 .TH INFO "1" "January 2019" "info 6.5.91" "User Commands"
22 .SH NAME
33 info \- read Info documents
44 .SH SYNOPSIS
00 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4.
1 .TH INSTALL-INFO "1" "January 2019" "install-info 6.5.90" "User Commands"
1 .TH INSTALL-INFO "1" "January 2019" "install-info 6.5.91" "User Commands"
22 .SH NAME
33 install-info \- update info/dir entries
44 .SH SYNOPSIS
00 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4.
1 .TH TEXI2ANY "1" "January 2019" "texi2any 6.5.90" "User Commands"
1 .TH TEXI2ANY "1" "January 2019" "texi2any 6.5.91" "User Commands"
22 .SH NAME
33 texi2any \- translate Texinfo documents
44 .SH SYNOPSIS
132132 .\" ========================================================================
133133 .\"
134134 .IX Title "POD2TEXI 1"
135 .TH POD2TEXI 1 "2019-01-02" "perl v5.28.0" "User Contributed Perl Documentation"
135 .TH POD2TEXI 1 "2019-01-13" "perl v5.28.0" "User Contributed Perl Documentation"
136136 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
137137 .\" way too many mistakes in technical documents.
138138 .if n .ad l
00 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4.
1 .TH TEXINDEX "1" "January 2019" "texindex 6.5.90" "User Commands"
1 .TH TEXINDEX "1" "January 2019" "texindex 6.5.91" "User Commands"
22 .SH NAME
33 texindex \- sort Texinfo index files
44 .SH SYNOPSIS
0 # Copyright 2005, 2006, 2007, 2008, 2011, 2012, 2013, 2014, 2015
1 # Free Software Foundation, Inc.
0 # Copyright 2005-2019 Free Software Foundation, Inc.
21 #
32 # Copying and distribution of this file, with or without modification,
43 # are permitted in any medium without royalty provided the copyright
4039 tp/Texinfo/Convert/Plaintext.pm
4140 tp/Texinfo/Convert/Text.pm
4241 tp/Texinfo/Convert/TexinfoXML.pm
43 tp/Texinfo/Parser.pm
42 tp/Texinfo/ParserNonXS.pm
4443 tp/Texinfo/Report.pm
4544 tp/Texinfo/Structuring.pm
4645 tp/init/chm.pm
161161 EXIT_SUCCESS = 0
162162 EXIT_FAILURE = 1
163163
164 Texindex_version = "6.5.90"
164 Texindex_version = "6.5.91"
165165 if (! Invocation_name) {
166166 # provide fallback in case it's not passed in.
167167 Invocation_name = "texindex"
6464 modulesdir = $(pkgdatadir)/Texinfo
6565 dist_modules_DATA = \
6666 Texinfo/Parser.pm \
67 Texinfo/ParserNonXS.pm \
6768 Texinfo/Report.pm \
6869 Texinfo/Common.pm \
6970 Texinfo/Encoding.pm \
12941294 top_builddir = @top_builddir@
12951295 top_srcdir = @top_srcdir@
12961296
1297 # Makefile.tres generated by ./tp/maintain/regenerate_file_lists.pl.
1297 # Makefile.tres generated by ./maintain/regenerate_file_lists.pl.
12981298 #
12991299 test_tap_files_generated_list = \
13001300 t/01use.t \
28462846 modulesdir = $(pkgdatadir)/Texinfo
28472847 dist_modules_DATA = \
28482848 Texinfo/Parser.pm \
2849 Texinfo/ParserNonXS.pm \
28492850 Texinfo/Report.pm \
28502851 Texinfo/Common.pm \
28512852 Texinfo/Encoding.pm \
0 # Makefile.tres generated by ./tp/maintain/regenerate_file_lists.pl.
0 # Makefile.tres generated by ./maintain/regenerate_file_lists.pl.
11 #
22 test_tap_files_generated_list = \
33 t/01use.t \
6363 __ __p print_tree
6464 );
6565
66 $VERSION = '6.5.90';
66 $VERSION = '6.5.91';
6767
6868 # i18n
6969 sub N__($)
5151 @EXPORT = qw(
5252 );
5353
54 $VERSION = '6.5.90';
54 $VERSION = '6.5.91';
5555
5656 my %defaults = (
5757 'ENABLE_ENCODING' => 1,
4646 @EXPORT = qw(
4747 );
4848
49 $VERSION = '6.5.90';
49 $VERSION = '6.5.91';
5050
5151 my $nbsp = '&#'.hex('00A0').';';
5252 my $mdash = '&#'.hex('2014').';';
5454 @EXPORT = qw(
5555 );
5656
57 $VERSION = '6.5.90';
57 $VERSION = '6.5.91';
5858
5959 # misc commands that are of use for formatting.
6060 my %formatting_misc_commands = %Texinfo::Convert::Text::formatting_misc_commands;
4646 @EXPORT = qw(
4747 );
4848
49 $VERSION = '6.5.90';
49 $VERSION = '6.5.91';
5050
5151 my $ixin_version = 1;
5252
4545 @EXPORT = qw(
4646 );
4747
48 $VERSION = '6.5.90';
48 $VERSION = '6.5.91';
4949
5050 my %defaults = (
5151 'ENABLE_ENCODING' => 0,
4242 @EXPORT = qw(
4343 );
4444
45 $VERSION = '6.5.90';
45 $VERSION = '6.5.91';
4646
4747 my $STDIN_DOCU_NAME = 'stdin';
4848
1919 use strict;
2020 use warnings;
2121
22 our $VERSION = '6.5.90';
22 our $VERSION = '6.5.91';
2323
2424 use Texinfo::XSLoader;
2525
6060 @EXPORT = qw(
6161 );
6262
63 $VERSION = '6.5.90';
63 $VERSION = '6.5.91';
6464
6565 # misc commands that are of use for formatting.
6666 my %formatting_misc_commands = %Texinfo::Convert::Text::formatting_misc_commands;
3939 @EXPORT = qw(
4040 );
4141
42 $VERSION = '6.5.90';
42 $VERSION = '6.5.91';
4343
4444 my %misc_commands = %Texinfo::Common::misc_commands;
4545 my %brace_commands = %Texinfo::Common::brace_commands;
4242 @EXPORT = qw(
4343 );
4444
45 $VERSION = '6.5.90';
45 $VERSION = '6.5.91';
4646
4747 # SXML specific
4848 my %defaults = (
4444 @EXPORT = qw(
4545 );
4646
47 $VERSION = '6.5.90';
47 $VERSION = '6.5.91';
4848
4949 # XML specific
5050 my %defaults = (
4646 @EXPORT = qw(
4747 );
4848
49 $VERSION = '6.5.90';
49 $VERSION = '6.5.91';
5050
5151 # this is in fact not needed for 'footnote', 'shortcaption', 'caption'
5252 # when they have no brace_command_arg, see below.
2121 use strict;
2222 use warnings;
2323
24 our $VERSION = '6.5.90';
24 our $VERSION = '6.5.91';
2525
2626 use Texinfo::XSLoader;
2727
8181 }
8282 }
8383
84 if ($ENV{TEXINFO_XS_PARSER}) {
85 unshift @INC, sub {
86 my ($coderef, $filename) = @_;
87 if ($filename eq 'Texinfo/Parser.pm') {
88 my $replacement = 'Texinfo/XS/parsetexi/Parsetexi.pm';
89 foreach my $prefix (@INC) {
90 if (ref($prefix)) {
91 next;
92 }
93 my $realfilename = File::Spec->catdir($prefix, $replacement);
94 if (-f $realfilename) {
95 my $fh;
96 open ($fh, '<', $realfilename);
97 if ($fh) {
98 $INC{$filename} = $realfilename;
99 return $fh;
100 }
84 unshift @INC, sub {
85 my ($coderef, $filename) = @_;
86 if ($filename eq 'Texinfo/Parser.pm') {
87 my $replacement;
88 if ($ENV{TEXINFO_XS_PARSER}) {
89 $replacement = 'Texinfo/XS/parsetexi/Parsetexi.pm';
90 } else {
91 $replacement = 'Texinfo/ParserNonXS.pm';
92 }
93 foreach my $prefix (@INC) {
94 if (ref($prefix)) {
95 next;
96 }
97 my $realfilename = File::Spec->catdir($prefix, $replacement);
98 if (-f $realfilename) {
99 my $fh;
100 open ($fh, '<', $realfilename);
101 if ($fh) {
102 $INC{$filename} = $realfilename;
103 return $fh;
101104 }
102105 }
103106 }
104 return;
105 };
106 }
107 }
108 return;
109 };
107110 }
108111
109112 sub import {
0 # Parser.pm: parse texinfo code into a tree.
1 #
2 # Copyright 2010-2019 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License,
7 # or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # Original author: Patrice Dumas <pertusus@free.fr>
18 # Parts (also from Patrice Dumas) come from texi2html.pl or texi2html.init.
19
20 # Note: This file may not be loaded if TEXINFO_XS_PARSER is set in the
21 # environment, due to a hook placed in @INC by Texinfo::ModulePath.
22
23 # The organization of the file is the following:
24 # module definitions.
25 # default parser state. With explanation of the internal structures.
26 # initializations, determination of command types.
27 # user visible subroutines.
28 # internal subroutines, doing the parsing.
29
30 package Texinfo::Parser;
31
32 # We need the unicode stuff.
33 use 5.006;
34 use strict;
35
36 # debug
37 use Carp qw(cluck);
38
39 use Data::Dumper;
40
41 # to detect if an encoding may be used to open the files
42 use Encode;
43
44 # for fileparse
45 use File::Basename;
46
47 # Clone could be faster for small structures, which should be the case
48 # here, but Clone is not in perl core modules, so we use Storable::dclone.
49 use Storable qw(dclone); # standard in 5.007003
50
51 # commands definitions
52 use Texinfo::Common;
53 # Error reporting and counting, translation of strings.
54 use Texinfo::Report;
55 # encoding_alias
56 use Texinfo::Encoding;
57
58 # to normalize node name, anchor, float arg, and first *ref argument.
59 use Texinfo::Convert::NodeNameNormalization;
60 # in error messages, and for macro body expansion
61 use Texinfo::Convert::Texinfo;
62
63 require Exporter;
64 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
65 @ISA = qw(Exporter Texinfo::Report);
66
67 our $module_loaded = 0;
68 sub import {
69 if (!$module_loaded) {
70 Texinfo::XSLoader::override ("Texinfo::Parser::_merge_text",
71 "Texinfo::MiscXS::merge_text");
72 Texinfo::XSLoader::override ("Texinfo::Parser::_abort_empty_line",
73 "Texinfo::MiscXS::abort_empty_line");
74 Texinfo::XSLoader::override ("Texinfo::Parser::_parse_texi_regex",
75 "Texinfo::MiscXS::parse_texi_regex");
76 $module_loaded = 1;
77 }
78 # The usual import method
79 goto &Exporter::import;
80 }
81
82
83 %EXPORT_TAGS = ( 'all' => [ qw(
84 parser
85 parse_texi_text
86 parse_texi_line
87 parse_texi_file
88 indices_information
89 floats_information
90 internal_references_information
91 labels_information
92 global_commands_information
93 global_informations
94 ) ] );
95
96 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
97
98 @EXPORT = qw(
99 );
100
101 $VERSION = '6.5.90';
102
103 sub N__($)
104 {
105 return $_[0];
106 }
107
108 # Customization variables obeyed by the Parser, and the default values.
109 our %default_customization_values = (
110 'TEST' => 0,
111 'DEBUG' => 0, # if >= 10, tree is printed in texi2any.pl after parsing.
112 # If >= 100 tree is printed every line.
113 'SHOW_MENU' => 1, # if false no menu error related.
114 'IGNORE_BEFORE_SETFILENAME' => 1,
115 'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME' => 1,
116 'INPUT_PERL_ENCODING' => undef, # input perl encoding name, set from
117 # @documentencoding in the default case
118 'INPUT_ENCODING_NAME' => undef, # encoding name normalized as preferred
119 # IANA, set from @documentencoding in the default
120 # case
121 'CPP_LINE_DIRECTIVES' => 1, # handle cpp like synchronization lines
122 'MAX_MACRO_CALL_NESTING' => 100000, # max number of nested macro calls
123 # This is not used directly, but passed to Convert::Text through
124 # Texinfo::Common::_convert_text_options
125 'ENABLE_ENCODING' => 1, # output accented and special characters
126 # based on @documentencoding
127 # following are used in Texinfo::Structuring
128 'TOP_NODE_UP' => '(dir)', # up node of Top node
129 'SIMPLE_MENU' => 0, # not used in the parser but in structuring
130 'USE_UP_NODE_FOR_ELEMENT_UP' => 0, # Use node up for Up if there is no
131 # section up.
132 );
133
134 my %parser_default_configuration = (%Texinfo::Common::default_parser_state_configuration,
135 %default_customization_values);
136
137 # the other possible keys for the parser state are:
138 #
139 # expanded_formats_hash each key comes from expanded_formats value is 1
140 # index_names a structure holding the link between index
141 # names, merged indices,
142 # initial value is %index_names in Texinfo::Common.
143 # context_stack stack of the contexts, more recent on top.
144 # 'line' is added when on a line or
145 # block @-command line,
146 # 'def' is added instead if on a definition line.
147 # 'preformatted' is added in block commands
148 # where there is no paragraphs and spaces are kept
149 # (format, example, display...)
150 # 'rawpreformatted' is added in raw block commands
151 # (html, xml, docbook...)
152 # 'menu' is added in menu commands
153 # 'math', 'footnote', 'caption', 'shortcaption',
154 # 'inlineraw' are also added when in those commands
155 # conditionals_stack a stack of conditional commands that are expanded.
156 # macro_stack stack of macros being expanded (more recent first)
157 # definfoenclose an hash, key is the command name, value is an array
158 # reference with 2 values, beginning and ending.
159 # input a stack, with last at bottom. Holds the opened files
160 # or text. Pending macro expansion or text expansion
161 # is also in that structure.
162 # line_commands the same as %line_commands in Texinfo::Common,
163 # but with index entry commands dynamically added
164 # close_paragraph_commands same as %close_paragraph_commands
165 # close_preformatted_commands same as %close_preformatted_commands
166 # no_paragraph_commands the same as %default_no_paragraph_commands
167 # below, with index
168 # entry commands dynamically added
169 # simple_text_commands the same as %simple_text_commands below, but
170 # with index entry commands dynamically added
171 # current_node last seen node.
172 # current_section last seen section.
173 # nodes list of nodes.
174 # command_index associate a command name with an index name
175 # floats key is the normalized float type, value is an array
176 # reference holding all the floats.
177 # internal_references an array holding all the internal references.
178
179 # set points to the value set when initializing, for
180 # configuration items that are not to be overriden
181 # by @-commands. For example documentlanguage.
182
183 # A line information is an hash reference with the keys:
184 # line_nr the line number
185 # file_name the file name
186 # macro if in a macro expansion, the name of the macro
187 #
188 # A text fragment information is a 2 element array reference, the first is the
189 # text fragment, the second is the line information.
190
191 # The input structure is an array, the first is the most recently included
192 # file. The last element may be a file if the parsing is done on a file,
193 # with parse_texi_file, or simply pending text, if called as parse_texi_text.
194 # each element of the array is a hash reference. The key are:
195 # pending an array reference containing pending text fragments, either the
196 # text given as parse_texi_text or macro expansion text.
197 # name file name
198 # line_nr current line number in the file
199 # fh filehandle for the file
200
201 # content is not copied but reference is copied when duplicating a parser.
202 my %tree_informations;
203 foreach my $tree_information ('values', 'macros', 'explained_commands', 'labels') {
204 $tree_informations{$tree_information} = 1;
205 }
206
207 # The commands in initialization_overrides are not set in the document if
208 # set at the parser initialization.
209 my %initialization_overrides = (
210 'INPUT_ENCODING_NAME' => 1,
211 'documentlanguage' => 1,
212 );
213
214 my %no_brace_commands = %Texinfo::Common::no_brace_commands;
215 my %line_commands = %Texinfo::Common::line_commands;
216 my %other_commands = %Texinfo::Common::other_commands;
217 my %brace_commands = %Texinfo::Common::brace_commands;
218 my %accent_commands = %Texinfo::Common::accent_commands;
219 my %context_brace_commands = %Texinfo::Common::context_brace_commands;
220 my %block_commands = %Texinfo::Common::block_commands;
221 my %block_item_commands = %Texinfo::Common::block_item_commands;
222 my %close_paragraph_commands = %Texinfo::Common::close_paragraph_commands;
223 my %def_map = %Texinfo::Common::def_map;
224 my %def_commands = %Texinfo::Common::def_commands;
225 my %def_aliases = %Texinfo::Common::def_aliases;
226 my %menu_commands = %Texinfo::Common::menu_commands;
227 my %preformatted_commands = %Texinfo::Common::preformatted_commands;
228 my %format_raw_commands = %Texinfo::Common::format_raw_commands;
229 my %item_container_commands = %Texinfo::Common::item_container_commands;
230 my %item_line_commands = %Texinfo::Common::item_line_commands;
231 my %deprecated_commands = %Texinfo::Common::deprecated_commands;
232 my %root_commands = %Texinfo::Common::root_commands;
233 my %sectioning_commands = %Texinfo::Common::sectioning_commands;
234 my %command_index = %Texinfo::Common::command_index;
235 my %ref_commands = %Texinfo::Common::ref_commands;
236 my %region_commands = %Texinfo::Common::region_commands;
237 my %code_style_commands = %Texinfo::Common::code_style_commands;
238 my %in_heading_commands = %Texinfo::Common::in_heading_commands;
239 my %in_index_commands = %Texinfo::Common::in_index_commands;
240 my %explained_commands = %Texinfo::Common::explained_commands;
241 my %inline_format_commands = %Texinfo::Common::inline_format_commands;
242 my %inline_commands = %Texinfo::Common::inline_commands;
243 my %inline_conditional_commands = %Texinfo::Common::inline_conditional_commands;
244 my %all_commands = %Texinfo::Common::all_commands;
245
246 # equivalence between a @set flag and an @@-command
247 my %set_flag_command_equivalent = (
248 'txicodequoteundirected' => 'codequoteundirected',
249 'txicodequotebacktick' => 'codequotebacktick',
250 # 'txideftypefnnl' => 'deftypefnnewline',
251 );
252
253
254 # keep line information for those commands.
255 my %keep_line_nr_brace_commands = %context_brace_commands;
256 foreach my $keep_line_nr_brace_command ('titlefont', 'anchor') {
257 $keep_line_nr_brace_commands{$keep_line_nr_brace_command} = 1;
258 }
259 foreach my $brace_command (keys (%brace_commands)) {
260 $keep_line_nr_brace_commands{$brace_command} = 1;
261 }
262
263 my %type_with_paragraph;
264 foreach my $type ('before_item', 'text_root', 'document_root',
265 'brace_command_context') {
266 $type_with_paragraph{$type} = 1;
267 }
268
269 my %command_ignore_space_after;
270 foreach my $command ('anchor', 'hyphenation', 'caption', 'shortcaption',
271 'sortas') {
272 $command_ignore_space_after{$command} = 1;
273 }
274
275 my %global_multiple_commands;
276 foreach my $global_multiple_command (
277 'footnote', 'hyphenation', 'insertcopying', 'printindex',
278 'subtitle','titlefont', 'listoffloats', 'detailmenu', 'part',
279 keys(%Texinfo::Common::document_settable_at_commands), ) {
280 $global_multiple_commands{$global_multiple_command} = 1;
281 }
282
283 my %global_unique_commands;
284 foreach my $global_unique_command (
285 'copying', 'settitle',
286 'shorttitlepage', 'title', 'titlepage', 'top',
287 keys(%Texinfo::Common::document_settable_unique_at_commands), ) {
288 $global_unique_commands{$global_unique_command} = 1;
289 }
290
291 my %index_names = %Texinfo::Common::index_names;
292
293 # index names that cannot be set by the user.
294 my %forbidden_index_name = ();
295
296 foreach my $name (keys(%index_names)) {
297 $forbidden_index_name{$name} = 1;
298 if ($name =~ /^(.).$/) {
299 $forbidden_index_name{$1} = 1;
300 }
301 }
302
303 foreach my $other_forbidden_index_name ('info','ps','pdf','htm',
304 'html', 'log','aux','dvi','texi','txi','texinfo','tex','bib') {
305 $forbidden_index_name{$other_forbidden_index_name} = 1;
306 }
307
308 # @-commands that do not start a paragraph
309 my %default_no_paragraph_commands;
310 # @-commands that should be at the beginning of a line
311 my %begin_line_commands;
312
313 foreach my $command ('node', 'end') {
314 $begin_line_commands{$command} = $command;
315 }
316
317 foreach my $no_paragraph_command ('titlefont', 'caption', 'shortcaption',
318 'image', '*', 'hyphenation', 'anchor', 'errormsg') {
319 $default_no_paragraph_commands{$no_paragraph_command} = 1;
320 }
321
322 foreach my $no_paragraph_command (keys(%line_commands),
323 keys(%other_commands)) {
324 $default_no_paragraph_commands{$no_paragraph_command} = 1;
325 }
326
327 foreach my $no_paragraph_command (keys(%line_commands)) {
328 $begin_line_commands{$no_paragraph_command} = 1;
329 }
330
331 # verbatiminclude is not said to begin at the beginning of the line
332 # in the manual
333 foreach my $not_begin_line_command ('comment', 'c', 'sp', 'columnfractions',
334 'item', 'verbatiminclude',
335 'set', 'clear', 'vskip') {
336 delete $begin_line_commands{$not_begin_line_command};
337 }
338
339 my %block_arg_commands;
340 foreach my $block_command (keys(%block_commands)) {
341 $begin_line_commands{$block_command} = 1;
342 $default_no_paragraph_commands{$block_command} = 1;
343 $block_arg_commands{$block_command} = 1
344 if ($block_commands{$block_command} ne 'raw');
345 # and ! $format_raw_commands{$block_command});
346 }
347
348 my %close_preformatted_commands = %close_paragraph_commands;
349 foreach my $no_close_preformatted('sp') {
350 delete $close_preformatted_commands{$no_close_preformatted};
351 }
352 # FIXME to close preformated or not to close?
353 #foreach my $format_raw_command(keys(%format_raw_commands)) {
354 # $close_preformatted_commands{$format_raw_command} = 1;
355 #}
356
357 # commands that may appear in accents
358 my %in_accent_commands = %accent_commands;
359 foreach my $brace_command(keys(%brace_commands)) {
360 $in_accent_commands{$brace_command} = 1 if (!$brace_commands{$brace_command});
361 }
362 foreach my $no_brace_command (keys(%no_brace_commands)) {
363 $in_accent_commands{$no_brace_command} = 1;
364 }
365 $in_accent_commands{'c'} = 1;
366 $in_accent_commands{'comment'} = 1;
367
368 # commands that may appear in text arguments
369 my %in_full_text_commands;
370 foreach my $command (keys(%brace_commands), keys(%no_brace_commands)) {
371 $in_full_text_commands{$command} = 1;
372 }
373 foreach my $in_full_text_command ('c', 'comment', 'refill',
374 'columnfractions', 'set', 'clear', 'end') {
375 $in_full_text_commands{$in_full_text_command} = 1;
376 }
377
378 foreach my $out_format (keys(%format_raw_commands)) {
379 $in_full_text_commands{$out_format} = 1;
380 }
381 delete $in_full_text_commands{'caption'};
382 delete $in_full_text_commands{'shortcaption'};
383 foreach my $block_command (keys(%block_commands)) {
384 $in_full_text_commands{$block_command} = 1
385 if ($block_commands{$block_command} eq 'conditional');
386 }
387
388
389 # commands that may appear inside sectioning commands
390 my %in_full_line_commands_no_refs = %in_full_text_commands;
391 foreach my $not_in_full_line_commands_no_refs ('titlefont',
392 'anchor', 'footnote', 'verb') {
393 delete $in_full_line_commands_no_refs{$not_in_full_line_commands_no_refs};
394 }
395
396 # commands that may happen in simple text arguments
397 my %in_simple_text_commands = %in_full_line_commands_no_refs;
398 foreach my $not_in_simple_text_command('xref', 'ref', 'pxref', 'inforef') {
399 delete $in_simple_text_commands{$not_in_simple_text_command};
400 }
401
402 # commands that only accept simple text as argument in any context.
403 my %simple_text_commands;
404 foreach my $line_command(keys(%line_commands)) {
405 if ($line_commands{$line_command} =~ /^\d+$/
406 or ($line_commands{$line_command} eq 'line'
407 and !($sectioning_commands{$line_command}
408 or $def_commands{$line_command}))
409 or $line_commands{$line_command} eq 'text') {
410 $simple_text_commands{$line_command} = 1;
411 }
412 }
413
414 my %full_line_commands_no_refs = (%sectioning_commands,
415 %def_commands);
416
417 delete $simple_text_commands{'center'};
418 delete $simple_text_commands{'exdent'};
419
420 foreach my $command (keys (%brace_commands)) {
421 if ($brace_commands{$command} =~ /\d/
422 and $brace_commands{$command} > 0
423 and !$inline_conditional_commands{$command}) {
424 $simple_text_commands{$command} = 1;
425 }
426 }
427
428 foreach my $command ('shortcaption', 'math') {
429 $simple_text_commands{$command} = 1;
430 }
431
432 # commands that accept full text, but no block or top-level commands
433 my %full_text_commands;
434 foreach my $brace_command (keys (%brace_commands)) {
435 if ($brace_commands{$brace_command} eq 'style') {
436 $full_text_commands{$brace_command} = 1;
437 }
438 }
439
440 # commands that accept almost the same as in full text, except
441 # what does not make sense on a line.
442 my %full_line_commands;
443 $full_line_commands{'center'} = 1;
444 $full_line_commands{'exdent'} = 1;
445 $full_line_commands{'item'} = 1;
446 $full_line_commands{'itemx'} = 1;
447
448 # Fill the valid nestings hash. The keys are the containing commands and
449 # the values arrays of commands that are allowed to occur inside those
450 # commands. All commands not in this hash are considered to accept anything.
451 # There are additional context tests, to make sure, for instance that we are
452 # testing @-commands on the block, line or node @-command line and not
453 # in the content.
454 # Index entry commands are dynamically set as %in_simple_text_commands
455 my %default_valid_nestings;
456
457 foreach my $command (keys(%accent_commands)) {
458 $default_valid_nestings{$command} = \%in_accent_commands;
459 }
460 foreach my $command (keys(%simple_text_commands)) {
461 $default_valid_nestings{$command} = \%in_simple_text_commands;
462 }
463 foreach my $command (keys(%full_text_commands), keys(%full_line_commands)) {
464 $default_valid_nestings{$command} = \%in_full_text_commands;
465 }
466 foreach my $command (keys(%full_line_commands_no_refs)) {
467 $default_valid_nestings{$command} = \%in_full_line_commands_no_refs;
468 }
469
470 # Only for block commands with line arguments
471 foreach my $command (keys(%block_commands)) {
472 if ($block_commands{$command} and $block_commands{$command} ne 'raw'
473 and $block_commands{$command} ne 'conditional'
474 and !$def_commands{$command}) {
475 $default_valid_nestings{$command} = \%in_simple_text_commands;
476 }
477 }
478
479
480 my @preformatted_contexts = ('preformatted', 'rawpreformatted');
481 my %preformatted_contexts;
482 foreach my $preformatted_context (@preformatted_contexts) {
483 $preformatted_contexts{$preformatted_context} = 1;
484 }
485
486 # contexts on the context_stack stack where empty line doesn't trigger
487 # a paragraph
488 my %no_paragraph_contexts;
489 foreach my $no_paragraph_context ('math', 'menu', @preformatted_contexts,
490 'def', 'inlineraw') {
491 $no_paragraph_contexts{$no_paragraph_context} = 1;
492 };
493
494
495
496 # Format a bug message
497 sub _bug_message($$;$$)
498 {
499 my ($self, $message, $line_number, $current) = @_;
500
501 my $line_message = '';
502 if ($line_number) {
503 my $file = $line_number->{'file_name'};
504 $line_message
505 = "last location: $line_number->{'file_name'}:$line_number->{'line_nr'}";
506 if ($line_number->{'macro'} ne '') {
507 $line_message .= " (possibly involving $line_number->{'macro'})";
508 }
509 $line_message .= "\n";
510 }
511 my $message_context_stack = "context_stack: (@{$self->{'context_stack'}})\n";
512 my $current_element_message = '';
513 if ($current) {
514 $current_element_message = "current: ". _print_current($current);
515 }
516 warn "You found a bug: $message\n\n".
517 "Additional informations:\n".
518 $line_message.$message_context_stack.$current_element_message;
519 }
520
521 # simple deep copy of a structure
522 # NOTE: currently not used, dclone is used instead. But in case dclone
523 # happens not to be enough in the future, _deep_copy could be reused.
524 sub _deep_copy($)
525 {
526 my $struct = shift;
527 my $string = Data::Dumper->Dump([$struct], ['struct']);
528 eval $string;
529 return $struct;
530 }
531
532 sub _setup_conf($$$)
533 {
534 my ($parser, $conf, $module_name) = @_;
535
536 if (defined($conf)) {
537 foreach my $key (keys(%$conf)) {
538 if (exists($parser_default_configuration{$key})) {
539 if ($key ne 'values' and ref($conf->{$key})) {
540 $parser->{$key} = dclone($conf->{$key});
541 } else {
542 $parser->{$key} = $conf->{$key};
543 }
544 if ($initialization_overrides{$key}) {
545 $parser->{'set'}->{$key} = $parser->{$key};
546 }
547 } else {
548 warn "$key not a possible customization in $module_name\n";
549 }
550 }
551 }
552 }
553
554 # Duplicate an existing parser.
555 sub duplicate_parser {
556 my $old_parser = shift;
557
558 my $parser = dclone(\%parser_default_configuration);
559
560 foreach my $key (keys(%parser_default_configuration)) {
561 if ($tree_informations{$key}) {
562 if (defined($old_parser->{$key})) {
563 foreach my $info_key (keys(%{$old_parser->{$key}})) {
564 $parser->{$key}->{$info_key}
565 = $old_parser->{$key}->{$info_key};
566 }
567 }
568 } elsif(ref($old_parser->{$key})) {
569 $parser->{$key} = dclone($old_parser->{$key});
570 } else {
571 $parser->{$key} = $old_parser->{$key};
572 }
573 }
574 bless $parser, ref($old_parser);
575
576 return _setup_parser($parser, undef);
577 }
578
579 # initialization entry point. Set up a parser.
580 # The last argument, optional, is a hash provided by the user to change
581 # the default values for what is present in %parser_default_configuration.
582 sub parser(;$$)
583 {
584 my $conf = shift;
585
586 my $parser = dclone(\%parser_default_configuration);
587 bless $parser;
588
589 return _setup_parser($parser, $conf);
590 }
591
592 sub _setup_parser {
593 my ($parser, $conf) = @_;
594
595 _setup_conf($parser, $conf, "Texinfo::Parser::parser");
596
597 # Now initialize command hash that are dynamically modified, notably
598 # those for index commands, and lists, based on defaults and user provided.
599 $parser->{'line_commands'} = dclone(\%line_commands);
600 $parser->{'valid_nestings'} = dclone(\%default_valid_nestings);
601 $parser->{'no_paragraph_commands'} = { %default_no_paragraph_commands };
602 $parser->{'index_names'} = dclone(\%index_names);
603 $parser->{'command_index'} = {%command_index};
604 $parser->{'close_paragraph_commands'} = {%close_paragraph_commands};
605 $parser->{'close_preformatted_commands'} = {%close_preformatted_commands};
606 # a hash is simply concatenated. It should be like %index_names.
607 if (ref($parser->{'indices'}) eq 'HASH') {
608 %{$parser->{'index_names'}} = (%{$parser->{'index_names'}},
609 %{$parser->{'indices'}});
610 } else { # an array holds index names defined with @defindex
611 foreach my $name (@{$parser->{'indices'}}) {
612 $parser->{'index_names'}->{$name} = {'in_code' => 0};
613 }
614 }
615 foreach my $index (keys (%{$parser->{'index_names'}})) {
616 if (!exists($parser->{'index_names'}->{$index}->{'name'})) {
617 $parser->{'index_names'}->{$index}->{'name'} = $index;
618 }
619 if (!exists($parser->{'index_names'}->{$index}->{'contained_indices'})) {
620 $parser->{'index_names'}->{$index}->{'contained_indices'}->{$index} = 1;
621 }
622 foreach my $prefix ($index, substr($index, 0, 1)) {
623 $parser->{'line_commands'}->{$prefix.'index'} = 'line';
624 $parser->{'no_paragraph_commands'}->{$prefix.'index'} = 1;
625 $parser->{'valid_nestings'}->{$prefix.'index'} = \%in_simple_text_commands;
626 $parser->{'command_index'}->{$prefix.'index'} = $index;
627 }
628 }
629 if ($parser->{'merged_indices'}) {
630 foreach my $index_from (keys (%{$parser->{'merged_indices'}})) {
631 my $index_to = $parser->{'merged_indices'}->{$index_from};
632 if (defined($parser->{'index_names'}->{$index_from})
633 and defined($parser->{'index_names'}->{$index_to})) {
634 $parser->{'index_names'}->{$index_from}->{'merged_in'} = $index_to;
635 $parser->{'index_names'}->{$index_to}->{'contained_indices'}->{$index_from} = 1;
636 }
637 }
638 }
639 foreach my $explained_command(keys(%explained_commands)) {
640 if (!defined($parser->{'explained_commands'}->{$explained_command})) {
641 $parser->{'explained_commands'}->{$explained_command} = {};
642 }
643 }
644 $parser->{'context_stack'} = [ '_root' ];
645 $parser->{'regions_stack'} = [];
646 $parser->{'macro_stack'} = [];
647 $parser->{'conditionals_stack'} = [];
648
649 # turn the array to a hash for speed. Not sure it really matters for such
650 # a small array.
651 foreach my $expanded_format(@{$parser->{'expanded_formats'}}) {
652 $parser->{'expanded_formats_hash'}->{$expanded_format} = 1;
653 }
654
655 %{$parser->{'global_commands'}} = %global_multiple_commands;
656
657 $parser->Texinfo::Report::new;
658
659 return $parser;
660 }
661
662 # simple parser initialization, fit for strings of Texinfo, not whole
663 # documents, targetting speed.
664 # all the simple_parsers share the dynamic informations
665 my $simple_parser_line_commands = dclone(\%line_commands);
666 my $simple_parser_valid_nestings = dclone(\%default_valid_nestings);
667 my $simple_parser_no_paragraph_commands = { %default_no_paragraph_commands };
668 my $simple_parser_index_names = dclone(\%index_names);
669 my $simple_parser_command_index = {%command_index};
670 my $simple_parser_close_paragraph_commands = {%close_paragraph_commands};
671 my $simple_parser_close_preformatted_commands = {%close_preformatted_commands};
672 sub simple_parser(;$)
673 {
674 my $conf = shift;
675
676 my $parser = dclone(\%parser_default_configuration);
677 bless $parser;
678
679 _setup_conf($parser, $conf, "Texinfo::Parser::simple_parser");
680
681 $parser->{'line_commands'} = $simple_parser_line_commands;
682 $parser->{'valid_nestings'} = $simple_parser_valid_nestings;
683 $parser->{'no_paragraph_commands'} = $simple_parser_no_paragraph_commands;
684 $parser->{'index_names'} = $simple_parser_index_names;
685 $parser->{'command_index'} = $simple_parser_command_index;
686 $parser->{'close_paragraph_commands'} = $simple_parser_close_paragraph_commands;
687 $parser->{'close_preformatted_commands'} = $simple_parser_close_preformatted_commands;
688
689 foreach my $explained_command(keys(%explained_commands)) {
690 if (!defined($parser->{'explained_commands'}->{$explained_command})) {
691 $parser->{'explained_commands'}->{$explained_command} = {};
692 }
693 }
694 $parser->{'context_stack'} = [ '_root' ];
695 $parser->{'regions_stack'} = [];
696 $parser->{'macro_stack'} = [];
697 $parser->{'conditionals_stack'} = [];
698
699 # turn the array to a hash for speed. Not sure it really matters for such
700 # a small array.
701 foreach my $expanded_format(@{$parser->{'expanded_formats'}}) {
702 $parser->{'expanded_formats_hash'}->{$expanded_format} = 1;
703 }
704
705 %{$parser->{'global_commands'}} = ();
706
707 $parser->Texinfo::Report::new;
708
709 return $parser;
710 }
711
712 sub get_conf($$)
713 {
714 my ($self, $var) = @_;
715 return $self->{$var};
716 }
717
718 # split a scalar text in an array lines.
719 sub _text_to_lines($)
720 {
721 my $text = shift;
722 die if (!defined($text));
723 my $had_final_end_line = chomp($text);
724 my $lines = [ map {$_."\n"} split (/\n/, $text, -1) ];
725 chomp($lines->[-1]) unless (!@$lines or $had_final_end_line);
726 return $lines;
727 }
728
729 # construct a text fragments array matching a lines array, based on information
730 # supplied.
731 # If $fixed_line_number is set the line number is not increased, otherwise
732 # it is increased, beginning at $first_line.
733 sub _complete_line_nr($$;$$$)
734 {
735 my ($lines, $first_line, $file, $macro, $fixed_line_number) = @_;
736
737 $macro = '' if (!defined($macro));
738 $file = '' if (!defined($file));
739 my $new_lines = [];
740
741 if (defined($first_line)) {
742 my $line_index = $first_line;
743 foreach my $index(0..scalar(@$lines)-1) {
744 $line_index = $index+$first_line if (!$fixed_line_number);
745 $new_lines->[$index] = [ $lines->[$index],
746 { 'line_nr' => $line_index,
747 'file_name' => $file, 'macro' => $macro } ];
748 }
749 } else {
750 foreach my $line (@$lines) {
751 push @$new_lines, [ $line ];
752 }
753 }
754 return $new_lines;
755 }
756
757 # entry point for text fragments.
758 # Used in tests.
759 # Note that it has no associated root type a opposed to parse_texi_line
760 # and parse_texi_file.
761 sub parse_texi_text($$;$$$$)
762 {
763 my ($self, $text, $lines_nr, $file, $macro, $fixed_line_number) = @_;
764
765 return undef if (!defined($text));
766
767 my $lines_array = [];
768 if (!ref($text)) {
769 $text = _text_to_lines($text);
770 }
771 $lines_nr = [] if (!defined($lines_nr));
772 if (!ref($lines_nr)) {
773 #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
774 $lines_array = _complete_line_nr($text, $lines_nr, $file,
775 $macro, $fixed_line_number);
776 } else {
777 while (@$text) {
778 my $line_nr = shift @$lines_nr;
779 my $line = shift @$text;
780 push @$lines_array, [$line, $line_nr];
781 }
782 }
783
784 $self = parser() if (!defined($self));
785 $self->{'input'} = [{'pending' => $lines_array}];
786 my $tree = $self->_parse_texi();
787 return $tree;
788 }
789
790 # parse a texi file
791 sub parse_texi_file($$)
792 {
793 my ($self, $file_name) = @_;
794
795 my $filehandle = do { local *FH };
796 if (! open($filehandle, $file_name)) {
797 $self->document_error(sprintf(__("could not open %s: %s"),
798 $file_name, $!));
799 return undef;
800 }
801 my $line_nr = 0;
802 my $line;
803 my @first_lines;
804
805 my $pending_first_texi_line;
806 # the first line not empty and not with \input is kept in
807 # $pending_first_texi_line and put in the pending lines just below
808 while ($line = <$filehandle>) {
809 $line_nr++;
810 if ($line =~ /^ *\\input/ or $line =~ /^\s*$/) {
811 $line =~ s/\x{7F}.*\s*//;
812 push @first_lines, $line;
813 } else {
814 $pending_first_texi_line = $line;
815 last;
816 }
817 }
818 my $root = { 'contents' => [], 'type' => 'text_root' };
819 if (@first_lines) {
820 push @{$root->{'contents'}}, { 'type' => 'preamble', 'contents' => [],
821 'parent' => $root };
822 foreach my $line (@first_lines) {
823 push @{$root->{'contents'}->[-1]->{'contents'}},
824 { 'text' => $line,
825 'type' => 'preamble_text',
826 'parent' => $root->{'contents'}->[-1]
827 };
828 }
829 }
830 my ($directories, $suffix);
831 ($file_name, $directories, $suffix) = fileparse($file_name)
832 if ($self->{'TEST'});
833 $self = parser() if (!defined($self));
834 $self->{'input'} = [{
835 'pending' => [[$pending_first_texi_line, {'line_nr' => $line_nr,
836 'macro' => '', 'file_name' => $file_name}]],
837 'name' => $file_name,
838 'line_nr' => $line_nr,
839 'fh' => $filehandle
840 }];
841 $self->{'info'}->{'input_file_name'} = $file_name;
842 $self->{'info'}->{'input_directory'} = $directories;
843 my $tree = $self->_parse_texi($root);
844
845 # Find 'text_root', which contains everything before first node/section.
846 # if there are elements, 'text_root' is the first content, otherwise it
847 # is the root.
848 my $text_root;
849 if ($tree->{'type'} eq 'text_root') {
850 $text_root = $tree;
851 } elsif ($tree->{'contents'} and $tree->{'contents'}->[0]
852 and $tree->{'contents'}->[0]->{'type'} eq 'text_root') {
853 $text_root = $tree->{'contents'}->[0];
854 }
855
856 # Put everything before @setfilename in a special type. This allows to
857 # ignore everything before @setfilename.
858 if ($self->{'IGNORE_BEFORE_SETFILENAME'} and $text_root and
859 $self->{'extra'} and $self->{'extra'}->{'setfilename'}
860 and $self->{'extra'}->{'setfilename'}->{'parent'} eq $text_root) {
861 my $before_setfilename = {'type' => 'preamble_before_setfilename',
862 'parent' => $text_root,
863 'contents' => []};
864 while ($text_root->{'contents'}->[0] ne $self->{'extra'}->{'setfilename'}) {
865 my $content = shift @{$text_root->{'contents'}};
866 $content->{'parent'} = $before_setfilename;
867 push @{$before_setfilename->{'contents'}}, $content;
868 }
869 unshift (@{$text_root->{'contents'}}, $before_setfilename)
870 if (@{$before_setfilename->{'contents'}});
871 }
872 #$self->_check_contents_location($tree);
873
874 return $tree;
875 }
876
877 sub parse_texi_line($$;$$$$)
878 {
879 my ($self, $text, $lines_nr, $file, $macro, $fixed_line_number) = @_;
880
881 return undef if (!defined($text));
882
883 if (!ref($text)) {
884 $text = _text_to_lines($text);
885 }
886 #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
887 my $lines_array = _complete_line_nr($text, $lines_nr, $file,
888 $macro, $fixed_line_number);
889
890 $self = parser() if (!defined($self));
891 $self->{'input'} = [{'pending' => $lines_array}];
892 my $tree = $self->_parse_texi({'contents' => [], 'type' => 'root_line'});
893 return $tree;
894 }
895
896 # return indices informations
897 sub indices_information($)
898 {
899 my $self = shift;
900 return $self->{'index_names'};
901 }
902
903 sub floats_information($)
904 {
905 my $self = shift;
906 return $self->{'floats'};
907 }
908
909 sub internal_references_information($)
910 {
911 my $self = shift;
912 return $self->{'internal_references'};
913 }
914
915 sub global_commands_information($)
916 {
917 my $self = shift;
918 return $self->{'extra'};
919 }
920
921 # @ dircategory_direntry
922 # perl_encoding
923 # input_encoding_name
924 # input_file_name
925 sub global_informations($)
926 {
927 my $self = shift;
928 return $self->{'info'};
929 }
930
931 # Setup labels and nodes info and return labels
932 sub labels_information
933 {
934 goto &Texinfo::Common::labels_information;
935 }
936
937 # Following are the internal subroutines. The most important are
938 # _parse_texi: the main parser loop.
939 # _end_line: called at an end of line. Handling of @include lines is
940 # done here.
941 # _next_text: present the next text fragment, from pending text or line,
942 # as described above.
943
944 # for debugging
945 sub _print_current($)
946 {
947 my $current = shift;
948 return Texinfo::Common::_print_current($current);
949 }
950
951 # for debugging
952 sub _print_command_args_texi($)
953 {
954 my $current = shift;
955 return '' if (!$current->{'cmdname'});
956 my $args = '';
957 my $with_brace;
958 if ($current->{'args'} and @{$current->{'args'}}) {
959 $with_brace
960 = ($current->{'args'}->[0]->{'type'} eq 'brace_command_arg'
961 or $current->{'args'}->[0]->{'type'} eq 'brace_command_context');
962 $args .= '{' if ($with_brace);
963 foreach my $arg (@{$current->{'args'}}) {
964 $args .= Texinfo::Convert::Texinfo::convert($arg).', ';
965 }
966 $args =~ s/, $//;
967 }
968 chomp($args);
969 if ($with_brace) {
970 $args .= '}';
971 }
972 return '@'.$current->{'cmdname'} .$args."\n";
973 }
974
975 sub _print_current_keys($)
976 {
977 my $current = shift;
978 my $string = _print_current($current);
979 foreach my $key (keys (%$current)) {
980 $string .= " $key: $current->{$key}\n";
981 }
982 if ($current->{'extra'}) {
983 $string .= " EXTRA\n";
984 foreach my $key (keys (%{$current->{'extra'}})) {
985 $string .= " $key: $current->{'extra'}->{$key}\n";
986 }
987 }
988 return $string;
989 }
990
991 # For debugging
992 sub _print_tree($)
993 {
994 my $tree = shift;
995
996 return Texinfo::Common::print_tree($tree);
997 }
998
999 sub _register_global_command {
1000 my ($self, $current, $line_nr) = @_;
1001
1002 my $command = $current->{'cmdname'};
1003
1004 if ($command eq 'summarycontents' and !$self->{'global_commands'}->{$command}) {
1005 $command = 'shortcontents';
1006 }
1007 if ($self->{'global_commands'}->{$command}) {
1008 push @{$self->{'extra'}->{$command}}, $current;
1009 $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
1010 return 1;
1011 } elsif ($global_unique_commands{$command}) {
1012 # setfilename ignored in an included file
1013 $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
1014 if ($command eq 'setfilename'
1015 and scalar(@{$self->{'input'}}) > 1) {
1016 } elsif (exists ($self->{'extra'}->{$current->{'cmdname'}})) {
1017 $self->line_warn(sprintf(__('multiple @%s'),
1018 $current->{'cmdname'}), $line_nr);
1019 } else {
1020 $self->{'extra'}->{$current->{'cmdname'}} = $current;
1021 }
1022 return 1;
1023 }
1024 return 0;
1025 }
1026
1027 # parse a @macro line
1028 sub _parse_macro_command_line($$$$$;$)
1029 {
1030 my ($self, $command, $line, $parent, $line_nr) = @_;
1031
1032 my $macro = { 'cmdname' => $command, 'parent' => $parent, 'contents' => [],
1033 'extra' => {'arg_line' => $line}, 'line_nr' => $line_nr };
1034 # REMACRO
1035 if ($line =~ /^\s+([[:alnum:]][[:alnum:]_-]*)\s*(.*)/) {
1036 my $macro_name = $1;
1037 my $args_def = $2;
1038 my @args;
1039
1040 if ($args_def =~ s/^\s*{\s*(.*?)\s*}\s*//) {
1041 @args = split(/\s*,\s*/, $1);
1042 }
1043
1044 print STDERR "MACRO \@$command $macro_name\n" if ($self->{'DEBUG'});
1045
1046 $macro->{'args'} = [
1047 { 'type' => 'macro_name', 'text' => $macro_name,
1048 'parent' => $macro } ];
1049 my $index = 0;
1050 foreach my $formal_arg (@args) {
1051 push @{$macro->{'args'}},
1052 { 'type' => 'macro_arg', 'text' => $formal_arg,
1053 'parent' => $macro};
1054 if ($formal_arg !~ /^[\w\-]+$/) {
1055 $self->line_error(sprintf(__("bad or empty \@%s formal argument: %s"),
1056 $command, $formal_arg), $line_nr);
1057 $macro->{'extra'}->{'invalid_syntax'} = 1;
1058 }
1059 $macro->{'extra'}->{'args_index'}->{$formal_arg} = $index;
1060 $index++;
1061 }
1062 # accept an @-command after the arguments in case there is a @c or
1063 # @comment
1064 if ($args_def =~ /^\s*[^\@]/) {
1065 $self->line_error(sprintf(__("bad syntax for \@%s argument: %s"),
1066 $command, $args_def),
1067 $line_nr);
1068 $macro->{'extra'}->{'invalid_syntax'} = 1;
1069 }
1070 } elsif ($line !~ /\S/) {
1071 $self->line_error(sprintf(
1072 __("%c%s requires a name"), ord('@'), $command), $line_nr);
1073 $macro->{'extra'}->{'invalid_syntax'} = 1;
1074 } else {
1075 $self->line_error(sprintf(
1076 __("bad name for \@%s"), $command), $line_nr);
1077 $macro->{'extra'}->{'invalid_syntax'} = 1;
1078 }
1079 return $macro;
1080 }
1081
1082 # start a paragraph if in a context where paragraphs are to be started.
1083 sub _begin_paragraph($$;$)
1084 {
1085 my ($self, $current, $line_nr) = @_;
1086
1087 # !$current->{'type'} is true for @-commands. In fact it is unclear
1088 # that there may be cases of !$current->{'type'} and !$current->{'cmdname'}
1089 if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
1090 and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
1091 if (!defined($current->{'contents'})) {
1092 $self->_bug_message("contents undef", $line_nr, $current);
1093 die;
1094 }
1095
1096 # find whether an @indent precedes the paragraph
1097 my $indent;
1098 if (scalar(@{$current->{'contents'}})) {
1099 my $index = scalar(@{$current->{'contents'}}) -1;
1100 while ($index >= 0
1101 and !($current->{'contents'}->[$index]->{'type'}
1102 and ($current->{'contents'}->[$index]->{'type'} eq 'empty_line'
1103 or $current->{'contents'}->[$index]->{'type'} eq 'paragraph'))
1104 and !($current->{'contents'}->[$index]->{'cmdname'}
1105 and $self->{'close_paragraph_commands'}->{$current->{'contents'}->[$index]->{'cmdname'}})) {
1106 if ($current->{'contents'}->[$index]->{'cmdname'}
1107 and ($current->{'contents'}->[$index]->{'cmdname'} eq 'indent'
1108 or $current->{'contents'}->[$index]->{'cmdname'} eq 'noindent')) {
1109 $indent = $current->{'contents'}->[$index]->{'cmdname'};
1110 last;
1111 }
1112 $index--;
1113 }
1114 }
1115 push @{$current->{'contents'}},
1116 { 'type' => 'paragraph', 'parent' => $current, 'contents' => [] };
1117 $current->{'contents'}->[-1]->{'extra'}->{$indent} = 1 if ($indent);
1118 $current = $current->{'contents'}->[-1];
1119 print STDERR "PARAGRAPH\n" if ($self->{'DEBUG'});
1120 return $current;
1121 }
1122 return 0;
1123 }
1124
1125 sub _begin_preformatted($$)
1126 {
1127 my ($self, $current) = @_;
1128
1129 if ($preformatted_contexts{$self->{'context_stack'}->[-1]}) {
1130 push @{$current->{'contents'}},
1131 { 'type' => $self->{'context_stack'}->[-1],
1132 'parent' => $current, 'contents' => [] };
1133 $current = $current->{'contents'}->[-1];
1134 print STDERR "PREFORMATTED $self->{'context_stack'}->[-1]\n" if ($self->{'DEBUG'});
1135 }
1136 return $current;
1137 }
1138
1139 # wrapper around line_warn. Set line_nr to be the line_nr of the command,
1140 # corresponding to the opening of the command. Call line_warn with
1141 # sprintf if needed.
1142 sub _command_warn($$$$;@)
1143 {
1144 my $self = shift;
1145 my $current = shift;
1146 my $line_nr = shift;
1147 my $message = shift;
1148
1149 if ($current->{'line_nr'}) {
1150 $line_nr = $current->{'line_nr'};
1151 }
1152 if (@_) {
1153 $self->line_warn(sprintf($message, @_), $line_nr);
1154 } else {
1155 $self->line_warn($message, $line_nr);
1156 }
1157 }
1158
1159 sub _command_error($$$$;@)
1160 {
1161 my $self = shift;
1162 my $current = shift;
1163 my $line_nr = shift;
1164 my $message = shift;
1165
1166 # use the beginning of the @-command for the error message
1167 # line number if available.
1168 # FIXME line_nr currently not registered for regular brace commands
1169 if ($current->{'line_nr'}) {
1170 $line_nr = $current->{'line_nr'};
1171 }
1172 if (@_) {
1173 $self->line_error(sprintf($message, @_), $line_nr);
1174 } else {
1175 $self->line_error($message, $line_nr);
1176 }
1177 }
1178
1179 # currently doesn't do much more than
1180 # return $_[1]->{'parent'}
1181 sub _close_brace_command($$$;$$)
1182 {
1183 my ($self, $current, $line_nr, $closed_command,
1184 $interrupting_command) = @_;
1185
1186 if ($current->{'cmdname'} ne 'verb'
1187 or $current->{'extra'}->{'delimiter'} eq '') {
1188 if (defined($closed_command)) {
1189 $self->_command_error($current, $line_nr,
1190 __("\@end %s seen before \@%s closing brace"),
1191 $closed_command, $current->{'cmdname'});
1192 } elsif (defined($interrupting_command)) {
1193 $self->_command_error($current, $line_nr,
1194 __("\@%s seen before \@%s closing brace"),
1195 $interrupting_command, $current->{'cmdname'});
1196
1197 } else {
1198 $self->_command_error($current, $line_nr,
1199 __("%c%s missing closing brace"), ord('@'), $current->{'cmdname'});
1200 }
1201 } else {
1202 $self->_command_error($current, $line_nr,
1203 __("\@%s missing closing delimiter sequence: %s}"),
1204 $current->{'cmdname'}, $current->{'extra'}->{'delimiter'});
1205 }
1206 $current = $current->{'parent'};
1207 return $current;
1208 }
1209
1210 sub _in_code($$)
1211 {
1212 my ($self, $current) = @_;
1213
1214 while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1215 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}
1216 and !exists $context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
1217 return 1 if ($code_style_commands{$current->{'parent'}->{'cmdname'}});
1218 $current = $current->{'parent'}->{'parent'};
1219 }
1220 return 0;
1221 }
1222
1223 # close brace commands, that don't set a new context (ie @caption, @footnote)
1224 sub _close_all_style_commands($$$;$$)
1225 {
1226 my ($self, $current, $line_nr, $closed_command,
1227 $interrupting_command) = @_;
1228
1229 while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1230 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}
1231 and !exists $context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
1232 $current = _close_brace_command($self, $current->{'parent'}, $line_nr,
1233 $closed_command, $interrupting_command);
1234 }
1235 return $current;
1236 }
1237
1238 # close brace commands except for @caption, @footnote then the paragraph
1239 sub _end_paragraph($$$;$$)
1240 {
1241 my ($self, $current, $line_nr, $closed_command,
1242 $interrupting_command) = @_;
1243
1244 $current = _close_all_style_commands($self, $current, $line_nr,
1245 $closed_command, $interrupting_command);
1246 if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
1247 print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
1248 $current = $current->{'parent'};
1249 }
1250 return $current;
1251 }
1252
1253 # close brace commands except for @caption, @footnote then the preformatted
1254 sub _end_preformatted($$$;$$)
1255 {
1256 my ($self, $current, $line_nr, $closed_command,
1257 $interrupting_command) = @_;
1258
1259 $current = _close_all_style_commands($self, $current, $line_nr,
1260 $closed_command, $interrupting_command);
1261 if ($current->{'type'} and $preformatted_contexts{$current->{'type'}}) {
1262 print STDERR "CLOSE PREFORMATTED $current->{'type'}\n" if ($self->{'DEBUG'});
1263 # completly remove void preformatted contexts
1264 if (!@{$current->{'contents'}}) {
1265 my $removed = pop @{$current->{'parent'}->{'contents'}};
1266 print STDERR "popping $removed->{'type'}\n" if ($self->{'DEBUG'});
1267 }
1268 $current = $current->{'parent'};
1269 }
1270 return $current;
1271 }
1272
1273 # check that there are no text holding environment (currently
1274 # checking only paragraphs and preformatted) in contents
1275 sub _check_no_text($)
1276 {
1277 my $current = shift;
1278 my $after_paragraph = 0;
1279 foreach my $content (@{$current->{'contents'}}) {
1280 if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
1281 $after_paragraph = 1;
1282 last;
1283 } elsif ($content->{'type'} and $preformatted_contexts{$content->{'type'}}) {
1284 foreach my $preformatted_content (@{$content->{'contents'}}) {
1285 if ((defined($preformatted_content->{'text'})
1286 and $preformatted_content->{'text'} =~ /\S/)
1287 or ($preformatted_content->{'cmdname'}
1288 and ($preformatted_content->{'cmdname'} ne 'c'
1289 and $preformatted_content->{'cmdname'} ne 'comment')
1290 and !($preformatted_content->{'type'}
1291 and $preformatted_content->{'type'} eq 'index_entry_command'))) {
1292 $after_paragraph = 1;
1293 last;
1294 }
1295 }
1296 last if ($after_paragraph);
1297 }
1298 }
1299 return $after_paragraph;
1300 }
1301
1302 # put everything after the last @item/@itemx in an item_table type container
1303 # and distinguish table_term and table_entry.
1304 sub _gather_previous_item($$;$$)
1305 {
1306 my ($self, $current, $next_command, $line_nr) = @_;
1307
1308 # nothing to do in that case.
1309 if ($current->{'contents'}->[-1]->{'type'}
1310 and $current->{'contents'}->[-1]->{'type'} eq 'before_item') {
1311 if ($next_command and $next_command eq 'itemx') {
1312 $self->line_warn(sprintf(__("\@itemx should not begin \@%s"),
1313 $current->{'cmdname'}), $line_nr);
1314 }
1315 return;
1316 }
1317 my $type;
1318 # if before an itemx, the type is different since there should not be
1319 # real content, so it may be treated differently
1320 if ($next_command and $next_command eq 'itemx') {
1321 $type = 'inter_item';
1322 } else {
1323 $type = 'table_item';
1324 }
1325 my $table_gathered = {'type' => $type,
1326 'contents' => []};
1327 # remove everything that is not an @item/@items or before_item to
1328 # put it in the table_item, starting from the end.
1329 my $contents_count = scalar(@{$current->{'contents'}});
1330 for (my $i = 0; $i < $contents_count; $i++) {
1331 if ($current->{'contents'}->[-1]->{'cmdname'}
1332 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'item'
1333 or ($current->{'contents'}->[-1]->{'cmdname'} eq 'itemx'))) {
1334 last;
1335 } else {
1336 my $item_content = pop @{$current->{'contents'}};
1337 $item_content->{'parent'} = $table_gathered;
1338 unshift @{$table_gathered->{'contents'}}, $item_content;
1339 }
1340 }
1341 if ($type eq 'table_item') {
1342 my $table_entry = {'type' => 'table_entry',
1343 'parent' => $current,
1344 'contents' => []};
1345 my $table_term = {'type' => 'table_term',
1346 'parent' => $table_entry,
1347 'contents' => []};
1348 push @{$table_entry->{'contents'}}, $table_term;
1349 my $contents_count = scalar(@{$current->{'contents'}});
1350 for (my $i = 0; $i < $contents_count; $i++) {
1351 if ($current->{'contents'}->[-1]->{'type'}
1352 and ($current->{'contents'}->[-1]->{'type'} eq 'before_item'
1353 or $current->{'contents'}->[-1]->{'type'} eq 'table_entry')) {
1354 last;
1355 } else {
1356 my $item_content = pop @{$current->{'contents'}};
1357 $item_content->{'parent'} = $table_term;
1358 unshift @{$table_term->{'contents'}}, $item_content;
1359 # debug
1360 if (! (($item_content->{'cmdname'}
1361 and ($item_content->{'cmdname'} eq 'itemx'
1362 or $item_content->{'cmdname'} eq 'item'))
1363 or ($item_content->{'type'}
1364 and $item_content->{'type'} eq 'inter_item'))) {
1365 $self->_bug_message("wrong element in table term", $line_nr,
1366 $item_content);
1367 }
1368 }
1369 }
1370 push @{$current->{'contents'}}, $table_entry;
1371 if (scalar(@{$table_gathered->{'contents'}})) {
1372 push @{$table_entry->{'contents'}}, $table_gathered;
1373 $table_gathered->{'parent'} = $table_entry;
1374 }
1375 } else {
1376 my $after_paragraph = _check_no_text($table_gathered);
1377 if ($after_paragraph) {
1378 $self->line_error(__("\@itemx must follow \@item"), $line_nr);
1379 }
1380 if (scalar(@{$table_gathered->{'contents'}})) {
1381 push @{$current->{'contents'}}, $table_gathered;
1382 $table_gathered->{'parent'} = $current;
1383 }
1384 }
1385 }
1386
1387 # Starting from the end, gather everything util the def_line to put in
1388 # a def_item
1389 sub _gather_def_item($;$)
1390 {
1391 my ($current, $next_command) = @_;
1392
1393 my $type;
1394 # means that we are between a @def*x and a @def
1395 if ($next_command) {
1396 $type = 'inter_def_item';
1397 } else {
1398 $type = 'def_item';
1399 }
1400
1401 # This may happen for a construct like
1402 # @deffnx a b @section
1403 # but otherwise the end of line will lead to the command closing
1404 return if (!$current->{'cmdname'} or $current->{'cmdname'} =~ /x$/);
1405 my $def_item = {'type' => $type,
1406 'parent' => $current,
1407 'contents' => []};
1408 # remove everything that is not a def_line to put it in the def_item,
1409 # starting from the end.
1410 my $contents_count = scalar(@{$current->{'contents'}});
1411 for (my $i = 0; $i < $contents_count; $i++) {
1412 if ($current->{'contents'}->[-1]->{'type'}
1413 and $current->{'contents'}->[-1]->{'type'} eq 'def_line') {
1414 # and !$current->{'contents'}->[-1]->{'extra'}->{'not_after_command'}) {
1415 last;
1416 } else {
1417 my $item_content = pop @{$current->{'contents'}};
1418 $item_content->{'parent'} = $def_item;
1419 unshift @{$def_item->{'contents'}}, $item_content;
1420 }
1421 }
1422 if (scalar(@{$def_item->{'contents'}})) {
1423 push @{$current->{'contents'}}, $def_item;
1424 }
1425 }
1426
1427 # close formats
1428 sub _close_command_cleanup($$) {
1429 my ($self, $current) = @_;
1430
1431 return unless ($current->{'cmdname'});
1432 # remove the dynamic counters in multitable, they are not of use in the final
1433 # tree. Also determine the multitable_body and multitable_head with
1434 # @item or @headitem rows.
1435 if ($current->{'cmdname'} eq 'multitable') {
1436 my $in_head_or_rows;
1437 my @contents = @{$current->{'contents'}};
1438 $current->{'contents'} = [];
1439 foreach my $row (@contents) {
1440 if ($row->{'type'} and $row->{'type'} eq 'row') {
1441 delete $row->{'cells_count'};
1442 if ($row->{'contents'}->[0]->{'cmdname'} eq 'headitem') {
1443 if (!$in_head_or_rows) {
1444 push @{$current->{'contents'}}, {'type' => 'multitable_head',
1445 'parent' => $current};
1446 $in_head_or_rows = 1;
1447 }
1448 } elsif ($row->{'contents'}->[0]->{'cmdname'} eq 'item') {
1449 if (!defined($in_head_or_rows) or $in_head_or_rows) {
1450 push @{$current->{'contents'}}, {'type' => 'multitable_body',
1451 'parent' => $current};
1452 $in_head_or_rows = 0;
1453 }
1454 }
1455 push @{$current->{'contents'}->[-1]->{'contents'}}, $row;
1456 $row->{'parent'} = $current->{'contents'}->[-1];
1457 } else {
1458 push @{$current->{'contents'}}, $row;
1459 $in_head_or_rows = undef;
1460 }
1461 }
1462 delete $current->{'rows_count'};
1463 } elsif ($item_container_commands{$current->{'cmdname'}}) {
1464 delete $current->{'items_count'};
1465 }
1466
1467 # put everything after the last @def*x command in a def_item type container.
1468 if ($def_commands{$current->{'cmdname'}}) {
1469 # At this point the end command hasn't been added to the command contents.
1470 # so checks cannot be done at this point.
1471 _gather_def_item($current);
1472 }
1473
1474 if ($item_line_commands{$current->{'cmdname'}}) {
1475 # At this point the end command hasn't been added to the command contents.
1476 # so checks cannot be done at this point.
1477 if (@{$current->{'contents'}}) {
1478 _gather_previous_item($self, $current);
1479 }
1480 }
1481
1482 # put end out of before_item, and replace it at the end of the parent.
1483 # remove empty before_item.
1484 # warn if not empty before_item, but format is empty
1485 if ($block_item_commands{$current->{'cmdname'}}) {
1486 if (@{$current->{'contents'}}) {
1487 my $leading_spaces = 0;
1488 my $before_item;
1489 if ($current->{'contents'}->[0]->{'type'}
1490 and $current->{'contents'}->[0]->{'type'} eq 'empty_line_after_command'
1491 and $current->{'contents'}->[1]
1492 and $current->{'contents'}->[1]->{'type'}
1493 and $current->{'contents'}->[1]->{'type'} eq 'before_item') {
1494 $leading_spaces = 1;
1495 $before_item = $current->{'contents'}->[1];
1496 } elsif ($current->{'contents'}->[0]->{'type'}
1497 and $current->{'contents'}->[0]->{'type'} eq 'before_item') {
1498 $before_item = $current->{'contents'}->[0];
1499 }
1500 if ($before_item) {
1501 if ($current->{'extra'}->{'end_command'}
1502 and @{$before_item->{'contents'}}
1503 and $before_item->{'contents'}->[-1] eq $current->{'extra'}->{'end_command'}) {
1504 my $end = pop @{$before_item->{'contents'}};
1505 $end->{'parent'} = $current;
1506 push @{$current->{'contents'}}, $end;
1507 }
1508 # remove empty before_items
1509 if (!@{$before_item->{'contents'}}) {
1510 if ($leading_spaces) {
1511 my $space = shift @{$current->{'contents'}};
1512 shift @{$current->{'contents'}};
1513 unshift @{$current->{'contents'}}, $space;
1514 } else {
1515 shift @{$current->{'contents'}};
1516 }
1517 } else {
1518 # warn if not empty before_item, but format is empty
1519 my $empty_before_item = 1;
1520 foreach my $before_item_content (@{$before_item->{'contents'}}) {
1521 if (!$before_item_content->{'cmdname'} or
1522 ($before_item_content->{'cmdname'} ne 'c'
1523 and $before_item_content->{'cmdname'} ne 'comment')) {
1524 $empty_before_item = 0;
1525 last;
1526 }
1527 }
1528 if (!$empty_before_item) {
1529 my $empty_format = 1;
1530 foreach my $format_content (@{$current->{'contents'}}) {
1531 next if ($format_content eq $before_item);
1532 if (($format_content->{'cmdname'} and
1533 ($format_content->{'cmdname'} ne 'c'
1534 and $format_content->{'cmdname'} ne 'comment'
1535 and $format_content->{'cmdname'} ne 'end'))
1536 or ($format_content->{'type'} and
1537 ($format_content->{'type'} ne 'empty_line_after_command'))) {
1538 $empty_format = 0;
1539 last;
1540 }
1541 }
1542 if ($empty_format) {
1543 $self->line_warn(sprintf(__("\@%s has text but no \@item"),
1544 $current->{'cmdname'}), $current->{'line_nr'});
1545 }
1546 }
1547 }
1548 }
1549 }
1550 }
1551 }
1552
1553 # close the current command, with error messages and give the parent.
1554 # If the last argument is given it is the command being closed if
1555 # hadn't there be an error, currently only block command, used for a
1556 # better error message.
1557 sub _close_current($$$;$$)
1558 {
1559 my ($self, $current, $line_nr, $closed_command,
1560 $interrupting_command) = @_;
1561
1562 if ($current->{'cmdname'}) {
1563 print STDERR "CLOSING(_close_current) \@$current->{'cmdname'}\n" if ($self->{'DEBUG'});
1564 if (exists($brace_commands{$current->{'cmdname'}})) {
1565 pop @{$self->{'context_stack'}}
1566 if (exists $context_brace_commands{$current->{'cmdname'}});
1567 $current = _close_brace_command($self, $current, $line_nr,
1568 $closed_command, $interrupting_command);
1569 } elsif (exists($block_commands{$current->{'cmdname'}})) {
1570 if (defined($closed_command)) {
1571 $self->line_error(sprintf(__("`\@end' expected `%s', but saw `%s'"),
1572 $current->{'cmdname'}, $closed_command), $line_nr);
1573 } elsif ($interrupting_command) {
1574 $self->line_error(sprintf(__("\@%s seen before \@end %s"),
1575 $interrupting_command, $current->{'cmdname'}),
1576 $line_nr);
1577 } else {
1578 $self->line_error(sprintf(__("no matching `%cend %s'"),
1579 ord('@'), $current->{'cmdname'}), $line_nr);
1580 if ($block_commands{$current->{'cmdname'}} eq 'conditional') {
1581 # in this case we are within an ignored conditional
1582 my $conditional = pop @{$current->{'parent'}->{'contents'}};
1583 }
1584 }
1585 if ($preformatted_commands{$current->{'cmdname'}}
1586 or $menu_commands{$current->{'cmdname'}}
1587 or $format_raw_commands{$current->{'cmdname'}}) {
1588 my $context = pop @{$self->{'context_stack'}};
1589 }
1590 pop @{$self->{'regions_stack'}}
1591 if ($region_commands{$current->{'cmdname'}});
1592 $current = $current->{'parent'};
1593 } else {
1594 # There @item and @tab commands are closed, and also line commands
1595 # with invalid content
1596 $current = $current->{'parent'};
1597 }
1598 } elsif ($current->{'type'}) {
1599 print STDERR "CLOSING type $current->{'type'}\n" if ($self->{'DEBUG'});
1600 if ($current->{'type'} eq 'bracketed') {
1601 $self->_command_error($current, $line_nr,
1602 __("misplaced %c"), ord('{'));
1603 if ($current->{'contents'}
1604 and @{$current->{'contents'}}
1605 and $current->{'contents'}->[0]->{'type'}
1606 and $current->{'contents'}->[0]->{'type'}
1607 eq 'empty_spaces_before_argument') {
1608 # remove spaces element from tree and update extra values
1609 _abort_empty_line($self, $current)
1610 }
1611
1612 } elsif ($current->{'type'} eq 'menu_comment'
1613 or $current->{'type'} eq 'menu_entry_description') {
1614 my $context = pop @{$self->{'context_stack'}};
1615 if ($context ne 'preformatted') {
1616 $self->_bug_message("context $context instead of preformatted",
1617 $line_nr, $current);
1618 }
1619 # close empty menu_comment
1620 if (!@{$current->{'contents'}}) {
1621 pop @{$current->{'parent'}->{'contents'}};
1622 }
1623 } elsif ($current->{'type'} eq 'line_arg'
1624 or $current->{'type'} eq 'block_line_arg') {
1625 my $context = pop @{$self->{'context_stack'}};
1626 if ($context ne 'line' and $context ne 'def') {
1627 $self->_bug_message("context $context instead of line or def",
1628 $line_nr, $current);
1629 die;
1630 }
1631 }
1632 $current = $current->{'parent'};
1633 } else { # Should never go here.
1634 $current = $current->{'parent'} if ($current->{'parent'});
1635 $self->_bug_message("No type nor cmdname when closing",
1636 $line_nr, $current);
1637 }
1638 return $current;
1639 }
1640
1641 # a closed_command arg means closing until that command is found.
1642 # no command arg means closing until the root or a root_command
1643 # is found.
1644 sub _close_commands($$$;$$)
1645 {
1646 my ($self, $current, $line_nr, $closed_command,
1647 $interrupting_command) = @_;
1648
1649 $current = _end_paragraph($self, $current, $line_nr, $closed_command,
1650 $interrupting_command);
1651 $current = _end_preformatted($self, $current, $line_nr, $closed_command,
1652 $interrupting_command);
1653
1654 # stop if the command is found
1655 while (!($closed_command and $current->{'cmdname'}
1656 and $current->{'cmdname'} eq $closed_command)
1657 # stop if at the root
1658 and $current->{'parent'}
1659 # stop if in a root command
1660 # or in a context_brace_commands and searching for a specific
1661 # end block command (with $closed_command set).
1662 # This second condition means that a footnote is not closed when
1663 # looking for the end of a block command, but is closed when
1664 # completly closing the stack.
1665 and !($current->{'cmdname'}
1666 and ($root_commands{$current->{'cmdname'}}
1667 or ($closed_command and $current->{'parent'}->{'cmdname'}
1668 and $context_brace_commands{$current->{'parent'}->{'cmdname'}})))){
1669 _close_command_cleanup($self, $current);
1670 $current = _close_current($self, $current, $line_nr, $closed_command,
1671 $interrupting_command);
1672 }
1673
1674 my $closed_element;
1675 if ($closed_command and $current->{'cmdname'}
1676 and $current->{'cmdname'} eq $closed_command) {
1677 if ($preformatted_commands{$current->{'cmdname'}}) {
1678 my $context = pop @{$self->{'context_stack'}};
1679 if ($context ne 'preformatted') {
1680 $self->_bug_message("context $context instead of preformatted for $closed_command",
1681 $line_nr, $current);
1682 }
1683 } elsif ($format_raw_commands{$current->{'cmdname'}}) {
1684 my $context = pop @{$self->{'context_stack'}};
1685 if ($context ne 'rawpreformatted') {
1686 $self->_bug_message("context $context instead of rawpreformatted for $closed_command",
1687 $line_nr, $current);
1688 }
1689 } elsif ($menu_commands{$current->{'cmdname'}}) {
1690 my $context = pop @{$self->{'context_stack'}};
1691 # may be in menu, but context is preformatted if in a preformatted too.
1692 if ($context ne 'menu' and $context ne 'preformatted') {
1693 $self->_bug_message("context $context instead of preformatted or menu for $closed_command",
1694 $line_nr, $current);
1695 }
1696 }
1697 pop @{$self->{'regions_stack'}}
1698 if ($region_commands{$current->{'cmdname'}});
1699 $closed_element = $current;
1700 #$self->_close_command_cleanup($current);
1701 $current = $current->{'parent'};
1702 } elsif ($closed_command) {
1703 $self->line_error(sprintf(__("unmatched `%c%s'"),
1704 ord('@'), "end $closed_command"), $line_nr);
1705 }
1706 return ($closed_element, $current);
1707 }
1708
1709 # begin paragraph if needed. If not try to merge with the previous
1710 # content if it is also some text.
1711 # NOTE - this sub has an XS override
1712 sub _merge_text {
1713 my ($self, $current, $text) = @_;
1714
1715 my $paragraph;
1716
1717 my $no_merge_with_following_text = 0;
1718 if ($text =~ /\S/) {
1719 my $leading_spaces;
1720 if ($text =~ /^(\s+)/) {
1721 $leading_spaces = $1;
1722 }
1723 if ($current->{'contents'} and @{$current->{'contents'}}
1724 and $current->{'contents'}->[-1]->{'type'}
1725 and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
1726 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_command'
1727 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_before_argument'
1728 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_close_brace')) {
1729 $no_merge_with_following_text = 1;
1730 }
1731 if (_abort_empty_line($self, $current, $leading_spaces)) {
1732 $text =~ s/^(\s+)//;
1733 }
1734
1735 $paragraph = _begin_paragraph($self, $current);
1736 $current = $paragraph if ($paragraph);
1737 }
1738
1739 if (!defined($current->{'contents'})) {
1740 $self->_bug_message("No contents in _merge_text",
1741 undef, $current);
1742 die;
1743 }
1744
1745 if (!$no_merge_with_following_text
1746 and @{$current->{'contents'}}
1747 and exists($current->{'contents'}->[-1]->{'text'})
1748 and $current->{'contents'}->[-1]->{'text'} !~ /\n/) {
1749 $current->{'contents'}->[-1]->{'text'} .= $text;
1750 print STDERR "MERGED TEXT: $text|||\n" if ($self->{'DEBUG'});
1751 } else {
1752 push @{$current->{'contents'}}, { 'text' => $text, 'parent' => $current };
1753 print STDERR "NEW TEXT: $text|||\n" if ($self->{'DEBUG'});
1754 }
1755 return $current;
1756 }
1757
1758 # return the parent if in a item_container command, itemize or enumerate
1759 sub _item_container_parent($)
1760 {
1761 my $current = shift;
1762 if ((($current->{'cmdname'} and $current->{'cmdname'} eq 'item')
1763 or ($current->{'type'} and $current->{'type'} eq 'before_item'))
1764 and ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1765 and $item_container_commands{$current->{'parent'}->{'cmdname'}})) {
1766 return ($current->{'parent'});
1767 }
1768 return undef;
1769 }
1770
1771 # return the parent if in a item_line command, @*table
1772 sub _item_line_parent($)
1773 {
1774 my $current = shift;
1775 if ($current->{'type'} and $current->{'type'} eq 'before_item'
1776 and $current->{'parent'}) {
1777 $current = $current->{'parent'};
1778 }
1779 return $current if ($current->{'cmdname'}
1780 and $item_line_commands{$current->{'cmdname'}});
1781 return undef;
1782 }
1783
1784 # return the parent if in a multitable
1785 sub _item_multitable_parent($)
1786 {
1787 my $current = shift;
1788 if (($current->{'cmdname'} and ($current->{'cmdname'} eq 'headitem'
1789 or $current->{'cmdname'} eq 'item' or $current->{'cmdname'} eq 'tab'))
1790 and $current->{'parent'} and $current->{'parent'}->{'parent'}) {
1791 $current = $current->{'parent'}->{'parent'};
1792 } elsif ($current->{'type'} and $current->{'type'} eq 'before_item'
1793 and $current->{'parent'}) {
1794 $current = $current->{'parent'};
1795 }
1796 return $current if ($current->{'cmdname'}
1797 and $current->{'cmdname'} eq 'multitable');
1798 return undef;
1799 }
1800
1801 sub _save_line_directive
1802 {
1803 my ($self, $line_nr, $file_name) = @_;
1804
1805 my $input = $self->{'input'}->[0];
1806 return if !$input;
1807 $input->{'line_nr'} = $line_nr if $line_nr;
1808 $input->{'name'} = $file_name if $file_name;
1809 }
1810
1811 # returns next text fragment, be it pending from a macro expansion or
1812 # text or file
1813 sub _next_text($$)
1814 {
1815 my ($self, $line_nr) = @_;
1816
1817 while (@{$self->{'input'}}) {
1818 my $input = $self->{'input'}->[0];
1819 if (@{$input->{'pending'}}) {
1820 my $new_text = shift @{$input->{'pending'}};
1821 if ($new_text->[1] and $new_text->[1]->{'end_macro'}) {
1822 delete $new_text->[1]->{'end_macro'};
1823 my $top_macro = shift @{$self->{'macro_stack'}};
1824 print STDERR "SHIFT MACRO_STACK(@{$self->{'macro_stack'}}): $top_macro->{'args'}->[0]->{'text'}\n"
1825 if ($self->{'DEBUG'});
1826 }
1827 return ($new_text->[0], $new_text->[1]);
1828 } elsif ($input->{'fh'}) {
1829 my $fh = $input->{'fh'};
1830 my $line = <$fh>;
1831 if (defined($line)) {
1832 # add an end of line if there is none at the end of file
1833 if (eof($fh) and $line !~ /\n/) {
1834 $line .= "\n";
1835 }
1836 $line =~ s/\x{7F}.*\s*//;
1837 $input->{'line_nr'}++;
1838 return ($line, {'line_nr' => $input->{'line_nr'},
1839 'file_name' => $input->{'name'},
1840 'macro' => ''});
1841 }
1842 }
1843 my $previous_input = shift(@{$self->{'input'}});
1844 # Don't close STDIN
1845 if ($previous_input->{'fh'} and $previous_input->{'name'} ne '-') {
1846 if (!close($previous_input->{'fh'})) {
1847 $self->document_warn(sprintf(__("error on closing %s: %s"),
1848 $previous_input->{'name'}, $!));
1849
1850 }
1851 }
1852 }
1853
1854 return (undef, $line_nr);
1855 }
1856
1857 # collect text and line numbers until an end of line is found.
1858 sub _new_line($$)
1859 {
1860 my ($self, $line_nr) = @_;
1861
1862 my $new_line = '';
1863
1864 while (1) {
1865 my $new_text;
1866 ($new_text, $line_nr) = _next_text($self, $line_nr);
1867 if (!defined($new_text)) {
1868 $new_line = undef if ($new_line eq '');
1869 last;
1870 }
1871
1872 $new_line .= $new_text;
1873
1874 my $chomped_text = $new_text;
1875 last if chomp($chomped_text);
1876 }
1877 return ($new_line, $line_nr);
1878 }
1879
1880 # $MACRO is the element in the tree defining the macro.
1881 sub _expand_macro_arguments($$$$)
1882 {
1883 my ($self, $macro, $line, $line_nr) = @_;
1884
1885 my $braces_level = 1;
1886 my $arguments = [ '' ];
1887 my $arg_nr = 0;
1888 my $args_total = scalar(@{$macro->{'args'}}) -1;
1889 my $name = $macro->{'args'}->[0]->{'text'};
1890
1891 my $line_nr_orig = $line_nr;
1892
1893 while (1) {
1894 if ($line =~ s/([^\\{},]*)([\\{},])//) {
1895 my $separator = $2;
1896 $arguments->[-1] .= $1;
1897 if ($separator eq '\\') {
1898 if ($line =~ s/^(.)//) {
1899 my $protected_char = $1;
1900 if ($protected_char !~ /[\\{},]/) {
1901 $arguments->[-1] .= '\\';
1902 }
1903 $arguments->[-1] .= $protected_char;
1904
1905 print STDERR "MACRO ARG: $separator: $protected_char\n" if ($self->{'DEBUG'});
1906 } else {
1907 $arguments->[-1] .= '\\';
1908 print STDERR "MACRO ARG: $separator\n" if ($self->{'DEBUG'});
1909 }
1910 } elsif ($separator eq ',') {
1911 if ($braces_level == 1) {
1912 if (scalar(@$arguments) < $args_total) {
1913 push @$arguments, '';
1914 $line =~ s/^\s*//;
1915 print STDERR "MACRO NEW ARG\n" if ($self->{'DEBUG'});
1916 } else {
1917 # implicit quoting when there is one argument.
1918 if ($args_total != 1) {
1919 $self->line_error(sprintf(__(
1920 "macro `%s' called with too many args"),
1921 $name), $line_nr);
1922 }
1923 $arguments->[-1] .= ',';
1924 }
1925 } else {
1926 $arguments->[-1] .= ',';
1927 }
1928 } elsif ($separator eq '}') {
1929 $braces_level--;
1930 last if ($braces_level == 0);
1931 $arguments->[-1] .= $separator;
1932 } elsif ($separator eq '{') {
1933 $braces_level++;
1934 $arguments->[-1] .= $separator;
1935 }
1936 } else {
1937 print STDERR "MACRO ARG end of line\n" if ($self->{'DEBUG'});
1938 $arguments->[-1] .= $line;
1939
1940 ($line, $line_nr) = _new_line($self, $line_nr);
1941 if (!defined($line)) {
1942 $self->line_error(sprintf(__("\@%s missing closing brace"),
1943 $name), $line_nr_orig);
1944 return ($arguments, "\n", $line_nr);
1945 }
1946 }
1947 }
1948 if ($args_total == 0 and $arguments->[0] ne '') {
1949 $self->line_error(sprintf(__(
1950 "macro `%s' declared without argument called with an argument"),
1951 $name), $line_nr);
1952 }
1953 print STDERR "END MACRO ARGS EXPANSION(".scalar(@$arguments)."): ".
1954 join("|\n", @$arguments) ."|\n" if ($self->{'DEBUG'});
1955 return ($arguments, $line, $line_nr);
1956 }
1957
1958 # $MACRO is a member of $self->{'macros'}.
1959 sub _expand_macro_body($$$$) {
1960 my ($self, $macro, $args, $line_nr) = @_;
1961
1962 my $macrobody = $macro->{'macrobody'};
1963 my $args_total = scalar(@{$macro->{'element'}->{'args'}}) -1;
1964 my $args_index = $macro->{'args_index'};
1965
1966 my $i;
1967 for ($i=0; $i<=$args_total; $i++) {
1968 $args->[$i] = "" unless (defined($args->[$i]));
1969 }
1970
1971 my $result = '';
1972 while ($macrobody ne '') {
1973 if ($macrobody =~ s/^([^\\]*)\\//o) {
1974 $result .= $1;
1975 if ($macrobody =~ s/^\\//) {
1976 $result .= '\\';
1977 } elsif ($macrobody =~ s/^([^\\]*)\\//) {
1978 my $arg = $1;
1979 if (defined($args_index->{$arg})) {
1980 $result .= $args->[$args_index->{$arg}];
1981 } else {
1982 $self->line_error(sprintf(__(
1983 "\\ in \@%s expansion followed `%s' instead of parameter name or \\"),
1984 $macro->{'element'}->{'args'}->[0]->{'text'}, $arg), $line_nr);
1985 $result .= '\\' . $arg;
1986 }
1987 }
1988 next;
1989 }
1990 $result .= $macrobody;
1991 last;
1992 }
1993 return $result;
1994 }
1995
1996 # each time a new line appeared, a container is opened to hold the text
1997 # consisting only of spaces. This container is removed here, typically
1998 # this is called when non-space happens on a line.
1999 # NOTE - this sub has an XS override
2000 sub _abort_empty_line {
2001 my ($self, $current, $additional_spaces) = @_;
2002
2003 $additional_spaces = '' if (!defined($additional_spaces));
2004 if ($current->{'contents'} and @{$current->{'contents'}}
2005 and $current->{'contents'}->[-1]->{'type'}
2006 and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line'
2007 or $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
2008 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_before_argument'
2009 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_close_brace')) {
2010
2011 my $spaces_element = $current->{'contents'}->[-1];
2012
2013 my $owning_element;
2014 if ($spaces_element->{'extra'}
2015 and $spaces_element->{'extra'}->{'command'}) {
2016 $owning_element = $spaces_element->{'extra'}->{'command'};
2017 }
2018
2019 print STDERR "ABORT EMPTY "
2020 .$spaces_element->{'type'}
2021 ." additional text |$additional_spaces|,"
2022 ." current |$spaces_element->{'text'}|\n"
2023 if ($self->{'DEBUG'});
2024
2025 $spaces_element->{'text'} .= $additional_spaces;
2026 # remove empty 'empty*before'.
2027 if ($spaces_element->{'text'} eq '') {
2028 pop @{$current->{'contents'}};
2029
2030 } elsif ($spaces_element->{'type'} eq 'empty_line') {
2031 # exactly the same condition as to begin a paragraph
2032 if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
2033 and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
2034 $spaces_element->{'type'} = 'empty_spaces_before_paragraph';
2035 } else {
2036 delete $spaces_element->{'type'};
2037 }
2038 } elsif ($spaces_element->{'type'} eq 'empty_line_after_command'
2039 or $spaces_element->{'type'} eq 'empty_spaces_before_argument') {
2040 if ($owning_element) {
2041 # Remove element from main tree. It will still be referenced in
2042 # the 'extra' hash as 'spaces_before_argument'.
2043 pop @{$current->{'contents'}};
2044
2045 $owning_element->{'extra'}->{'spaces_before_argument'}
2046 = $spaces_element->{'text'};
2047 } else {
2048 $spaces_element->{'type'} = 'empty_spaces_after_command';
2049 }
2050 }
2051
2052 return 1;
2053 }
2054 return 0;
2055 }
2056
2057 # isolate last space in a command to help expansion disregard unuseful spaces.
2058 sub _isolate_last_space
2059 {
2060 my ($self, $current) = @_;
2061
2062 return if (!$current->{'contents'} or !@{$current->{'contents'}});
2063
2064 # Store a final comment command in the 'extra' hash.
2065 if (scalar(@{$current->{'contents'}}) >= 1
2066 and $current->{'contents'}->[-1]->{'cmdname'}
2067 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
2068 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')) {
2069 $current->{'extra'}->{'comment_at_end'} = pop @{$current->{'contents'}};
2070 # TODO: @c should probably not be allowed inside most brace commands
2071 # as this would be difficult to implement properly in TeX.
2072 }
2073
2074 return if !@{$current->{'contents'}}
2075 or !defined($current->{'contents'}->[-1]->{'text'})
2076 or ($current->{'contents'}->[-1]->{'type'}
2077 and (!$current->{'type'}
2078 or $current->{'type'} ne 'line_arg'))
2079 or $current->{'contents'}->[-1]->{'text'} !~ /\s+$/;
2080
2081 if ($current->{'type'} and $current->{'type'} eq 'menu_entry_node') {
2082 if ($current->{'contents'}->[-1]->{'text'} !~ /\S/) {
2083 $current->{'contents'}->[-1]->{'type'} = 'space_at_end_menu_node';
2084 } else {
2085 $current->{'contents'}->[-1]->{'text'} =~ s/(\s+)$//;
2086 my $new_spaces = { 'text' => $1, 'parent' => $current,
2087 'type' => 'space_at_end_menu_node' };
2088 push @{$current->{'contents'}}, $new_spaces;
2089 }
2090 } else {
2091 # Store final spaces in 'spaces_after_argument'.
2092 if ($current->{'contents'}->[-1]->{'text'} !~ /\S/) {
2093 my $end_spaces = $current->{'contents'}->[-1]->{'text'};
2094 pop @{$current->{'contents'}};
2095 $current->{'extra'}->{'spaces_after_argument'} = $end_spaces;
2096 } else {
2097 $current->{'contents'}->[-1]->{'text'} =~ s/(\s+)$//;
2098 $current->{'extra'}->{'spaces_after_argument'} = $1;
2099 }
2100 }
2101 }
2102
2103 # $NODE->{'contents'} is the Texinfo for the specification of a node.
2104 # Returned object is a hash with two fields:
2105 #
2106 # manual_content - Texinfo tree for a manual name extracted from the
2107 # node specification.
2108 # node_content - Texinfo tree for the node name on its own
2109 #
2110 # retrieve a leading manual name in parentheses, if there is one.
2111 sub _parse_node_manual($)
2112 {
2113 my $node = shift;
2114 return Texinfo::Common::parse_node_manual ($node);
2115 }
2116
2117 sub _parse_float_type($)
2118 {
2119 my $current = shift;
2120 if ($current->{'args'} and @{$current->{'args'}}) {
2121 if (@{$current->{'args'}->[0]->{'contents'}}) {
2122 my $normalized
2123 = Texinfo::Convert::Texinfo::convert(
2124 {'contents' => $current->{'args'}->[0]->{'contents'}});
2125 $current->{'extra'}->{'type'}->{'content'} =
2126 $current->{'args'}->[0]->{'contents'};
2127 $current->{'extra'}->{'type'}->{'normalized'} = $normalized;
2128 return 1;
2129 }
2130 }
2131 $current->{'extra'}->{'type'}->{'normalized'} = '';
2132 return 0;
2133 }
2134
2135 # split non-space text elements into strings without [ ] ( ) , and single
2136 # character strings with one of them
2137 sub _split_delimiters
2138 {
2139 my ($self, $root) = @_;
2140
2141 if (defined $root->{'type'} # 'spaces' for spaces
2142 or !defined $root->{'text'}) {
2143 return $root;
2144 } else {
2145 my @elements;
2146 my $type;
2147 my $chars = quotemeta '[](),';
2148 my $text = $root->{'text'};
2149 while (1) {
2150 if ($text =~ s/^([^$chars]+)//) {
2151 push @elements, {'text' => $1, 'parent' => $root->{'parent'}};
2152 } elsif ($text =~ s/^([$chars])//) {
2153 push @elements, {'text' => $1, 'type' => 'delimiter',
2154 'parent' => $root->{'parent'}};
2155 } else {
2156 last;
2157 }
2158 }
2159 return @elements;
2160 }
2161 }
2162
2163 # split text elements into whitespace and non-whitespace
2164 sub _split_def_args
2165 {
2166 my ($self, $root) = @_;
2167
2168 if ($root->{'type'} and $root->{'type'} eq 'spaces_inserted') {
2169 return $root;
2170 } elsif (defined $root->{'text'}) {
2171 my @elements;
2172 my $type;
2173 my @split_text = split /(?<=\s)(?=\S)|(?<=\S)(?=\s)/, $root->{'text'};
2174 if ($split_text[0] =~ /^\s*$/) {
2175 $type = 'spaces';
2176 }
2177 for my $t (@split_text) {
2178 my $e = {'text' => $t };
2179 if ($type) {
2180 $e->{'type'} = $type;
2181 $type = undef;
2182 } else {
2183 $type = 'spaces';
2184 }
2185 $e->{'parent'} = $root->{'parent'};
2186 push @elements, $e;
2187 }
2188 return @elements;
2189 } elsif ($root->{'type'} and $root->{'type'} eq 'bracketed') {
2190 _isolate_last_space($self, $root);
2191 $root->{'type'} = 'bracketed_def_content';
2192 }
2193 return $root;
2194 }
2195
2196 # definition line parsing
2197 sub _parse_def($$$)
2198 {
2199 my ($self, $command, $current) = @_;
2200
2201 my $contents = $current->{'contents'};
2202 my $empty_spaces_after_command;
2203
2204 my @new_contents;
2205 my @contents = @$contents;
2206 if ($contents[0] and $contents[0]->{'type'}
2207 and ($contents[0]->{'type'} eq 'empty_spaces_after_command'
2208 or $contents[0]->{'type'} eq 'empty_line_after_command')) {
2209 $empty_spaces_after_command = shift @contents;
2210 }
2211
2212 if ($def_aliases{$command}) {
2213 my $real_command = $def_aliases{$command};
2214 my $prepended = $def_map{$command}->{$real_command};
2215
2216
2217 my $bracketed = { 'type' => 'bracketed_inserted',
2218 'parent' => $current };
2219 my $content = { 'text' => $prepended, 'parent' => $bracketed };
2220 if ($self->{'documentlanguage'}) {
2221 $content->{'type'} = 'untranslated';
2222 $content->{'extra'}->{'documentlanguage'} = $self->{'documentlanguage'};
2223 }
2224 @{$bracketed->{'contents'}} = ($content);
2225
2226 unshift @contents, $bracketed,
2227 { 'text' => ' ', 'type' => 'spaces_inserted',
2228 'parent' => $current,
2229 };
2230
2231 $command = $def_aliases{$command};
2232 }
2233 @contents = map (_split_def_args($self, $_), @contents );
2234 @new_contents = @contents;
2235
2236 $current->{'contents'} = \@new_contents;
2237
2238 my @result;
2239 my @args = @{$def_map{$command}};
2240 my $arg_type;
2241
2242 $arg_type = pop @args if ($args[-1] eq 'arg' or $args[-1] eq 'argtype');
2243 # If $arg_type is not set (for @def* commands that are not documented
2244 # to take args), everything happens as if arg_type was set to 'arg'.
2245
2246 # Fill in everything up to the args, collecting adjacent non-whitespace
2247 # elements into a single element, e.g 'a@i{b}c'.
2248 my $argument_content = [];
2249 my $arg = shift (@args);
2250
2251 my $i = 0; # the offset in @new_contents of $token
2252 while (@contents) {
2253 my $token = $contents[0];
2254 # finish previous item
2255 if ( $token->{'type'}
2256 and ($token->{'type'} eq 'spaces'
2257 or $token->{'type'} eq 'spaces_inserted'
2258 or $token->{'type'} eq 'bracketed_def_content'
2259 or $token->{'type'} eq 'bracketed_inserted'
2260 or $token->{'type'} eq 'delimiter')) {
2261 # we create a {'contents' =>} only if there is more than one
2262 # content gathered.
2263 if (scalar(@$argument_content)) {
2264 if (scalar(@$argument_content) > 1) {
2265 my $e = {'contents' => $argument_content,
2266 'type' => 'def_aggregate',
2267 'parent' => $current };
2268 push @result, [$arg, $e];
2269 # Replace in the main tree.
2270 splice @new_contents,
2271 $i - scalar(@$argument_content),
2272 scalar(@$argument_content),
2273 $e;
2274 for my $e2 (@$argument_content) {
2275 $e2->{'parent'} = $e;
2276 }
2277 $i -= scalar(@$argument_content) - 1;
2278 } elsif (scalar(@$argument_content) == 1) {
2279 push @result, [$arg, $argument_content->[0]];
2280 }
2281 $argument_content = [];
2282 if ($token->{'type'} eq 'spaces'
2283 or $token->{'type'} eq 'spaces_inserted') {
2284 $arg = shift (@args);
2285 }
2286 }
2287 }
2288
2289 if ($token->{'type'} and ($token->{'type'} eq 'bracketed_def_content'
2290 or $token->{'type'} eq 'bracketed_inserted')) {
2291 push @result, [$arg, $token];
2292 shift @contents;
2293 $arg = shift (@args);
2294 } elsif ($token->{'type'}
2295 and ($token->{'type'} eq 'spaces'
2296 or $token->{'type'} eq 'spaces_inserted')) {
2297 if ($token->{'text'}) {
2298 if ($token->{'text'} =~ /\n$/) {
2299 $token->{'type'} = 'spaces_at_end';
2300 }
2301 push @result, ['spaces', $token];
2302 shift @contents;
2303 } else {
2304 $i++;
2305 last;
2306 }
2307 } elsif ($token->{'type'} and $token->{'type'} eq 'delimiter') {
2308 push @result, ['delimiter', shift @contents];
2309 } else {
2310 my $text_or_cmd = shift @contents;
2311 push @$argument_content, $text_or_cmd;
2312 }
2313 $i++;
2314 last if (! defined($arg));
2315 }
2316 if (scalar(@$argument_content) > 1) {
2317 my $e = {'contents' => $argument_content,
2318 'type' => 'def_aggregate' };
2319 push @result, [$arg, $e];
2320 # Replace in the main tree.
2321 splice @new_contents, $i - scalar(@$argument_content),
2322 scalar(@$argument_content), $e;
2323 } elsif (scalar(@$argument_content) == 1) {
2324 push @result, [$arg, $argument_content->[0]];
2325 }
2326
2327 if (scalar(@contents) > 0) {
2328 splice @new_contents, -scalar(@contents);
2329 }
2330 unshift @new_contents, $empty_spaces_after_command
2331 if $empty_spaces_after_command;
2332
2333 @contents = map (_split_delimiters($self, $_), @contents );
2334 @new_contents = (@new_contents, @contents);
2335
2336 # Create the part of the def_args array for any arguments.
2337 my @args_results;
2338 while (@contents) {
2339 my $spaces;
2340 my $next_token = shift @contents;
2341 if ($next_token->{'type'} and $next_token->{'type'} eq 'spaces') {
2342 $spaces = $next_token;
2343 $next_token = shift @contents;
2344 }
2345 if (defined($spaces)) {
2346 if ($spaces->{'text'} =~ /\n$/) {
2347 $spaces->{'type'} = 'spaces_at_end';
2348 }
2349 push @args_results, ['spaces', $spaces]
2350 }
2351 last if (!defined($next_token));
2352 if ($next_token->{'type'} and $next_token->{'type'} eq 'delimiter') {
2353 push @args_results, ['delimiter', $next_token];
2354 } else {
2355 push @args_results, ['arg', $next_token];
2356 }
2357 }
2358
2359 # If a command like @deftypefn, mark the type arguments
2360 if ($arg_type and $arg_type eq 'argtype') {
2361 my $next_is_type = 1;
2362 foreach my $arg(@args_results) {
2363 if ($arg->[0] eq 'spaces') {
2364 } elsif ($arg->[0] eq 'delimiter') {
2365 $next_is_type = 1;
2366 } elsif ($arg->[1]->{'cmdname'} and $arg->[1]->{'cmdname'} ne 'code') {
2367 $next_is_type = 1;
2368 } elsif ($next_is_type) {
2369 $arg->[0] = 'typearg';
2370 $next_is_type = 0;
2371 } else {
2372 $next_is_type = 1;
2373 }
2374 }
2375 }
2376
2377 for my $pair (@result, @args_results) {
2378 $pair->[1]->{'extra'}->{'def_role'} = $pair->[0];
2379 }
2380
2381 return [@result, @args_results];
2382 }
2383
2384 # register a label, that is something that may be the target of a reference
2385 # and must be unique in the document. Corresponds to @node, @anchor and
2386 # @float second arg.
2387 sub _register_label($$$)
2388 {
2389 my ($self, $current, $label) = @_;
2390
2391 push @{$self->{'targets'}}, $current;
2392 if ($label->{'node_content'}) {
2393 $current->{'extra'}->{'node_content'} = $label->{'node_content'};
2394 }
2395 }
2396
2397 # store an index entry.
2398 # $current is the command element.
2399 # $content holds the actual content.
2400 # for index entries and v|ftable items, it is the index entry content,
2401 # for def, it is the parsed arguments, based on the definition line
2402 # arguments.
2403 sub _enter_index_entry($$$$$$$)
2404 {
2405 my ($self, $command_container, $command, $current, $content,
2406 $content_normalized, $line_nr) = @_;
2407
2408 $content_normalized = $content if (!defined($content_normalized));
2409
2410 my $index_name = $self->{'command_index'}->{$command_container};
2411 my $index = $self->{'index_names'}->{$index_name};
2412
2413 my $number = (defined($index->{'index_entries'})
2414 ? (scalar(@{$index->{'index_entries'}}) + 1)
2415 : 1);
2416 my $index_entry = { 'index_name' => $index_name,
2417 'index_at_command' => $command,
2418 'index_type_command' => $command_container,
2419 'content' => $content,
2420 'content_normalized' => $content_normalized,
2421 'command' => $current,
2422 'number' => $number,
2423 };
2424 if (defined $current->{'extra'}->{'sortas'}) {
2425 $index_entry->{'sortas'} = $current->{'extra'}->{'sortas'};
2426 }
2427 if (@{$self->{'regions_stack'}}) {
2428 $index_entry->{'region'} = $self->{'regions_stack'}->[-1];
2429 } elsif ($self->{'current_node'}) {
2430 $index_entry->{'node'} = $self->{'current_node'};
2431 } elsif (!$self->{'current_section'}) {
2432 $self->line_warn(sprintf(__("entry for index `%s' outside of any node"),
2433 $index_name), $line_nr);
2434 }
2435 push @{$index->{'index_entries'}}, $index_entry;
2436 $current->{'extra'}->{'index_entry'} = $index_entry;
2437 }
2438
2439 # close constructs and do stuff at end of line (or end of the document)
2440 sub _end_line($$$);
2441 sub _end_line($$$)
2442 {
2443 my ($self, $current, $line_nr) = @_;
2444
2445 my $current_old = $current;
2446
2447 my $included_file = 0;
2448
2449 # a line consisting only of spaces.
2450 if ($current->{'contents'} and @{$current->{'contents'}}
2451 and $current->{'contents'}->[-1]->{'type'}
2452 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
2453 print STDERR "END EMPTY LINE\n" if ($self->{'DEBUG'});
2454 if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
2455 my $empty_line = pop @{$current->{'contents'}};
2456 $current = _end_paragraph($self, $current, $line_nr);
2457 push @{$current->{'contents'}}, $empty_line;
2458 $empty_line->{'parent'} = $current;
2459 } elsif ($current->{'type'}
2460 and $current->{'type'} eq 'preformatted'
2461 and $current->{'parent'}->{'type'}
2462 and $current->{'parent'}->{'type'} eq 'menu_entry_description') {
2463 my $empty_line = pop @{$current->{'contents'}};
2464 if ($current->{'type'} eq 'preformatted') {
2465 my $empty_preformatted = (!@{$current->{'contents'}});
2466 $current = $current->{'parent'};
2467 pop @{$current->{'contents'}} if ($empty_preformatted);
2468 }
2469 my $context = pop @{$self->{'context_stack'}};
2470 if ($context ne 'preformatted') {
2471 $self->_bug_message("context $context instead of preformatted in empty line after menu_entry_description",
2472 $line_nr, $current);
2473 }
2474
2475 # first parent is menu_entry
2476 $current = $current->{'parent'}->{'parent'};
2477
2478 push @{$current->{'contents'}}, { 'type' => 'menu_comment',
2479 'parent' => $current,
2480 'contents' => [] };
2481 $current = $current->{'contents'}->[-1];
2482 push @{$current->{'contents'}}, { 'type' => 'preformatted',
2483 'parent' => $current,
2484 'contents' => [] };
2485 $current = $current->{'contents'}->[-1];
2486 push @{$current->{'contents'}}, { 'type' => 'after_description_line',
2487 'text' => $empty_line->{'text'},
2488 'parent' => $current };
2489 push @{$self->{'context_stack'}}, 'preformatted';
2490 print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if ($self->{'DEBUG'});
2491 } elsif (!$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
2492 $current = _end_paragraph($self, $current, $line_nr);
2493 }
2494
2495 # end of a menu line.
2496 } elsif ($current->{'type'}
2497 and ($current->{'type'} eq 'menu_entry_name'
2498 or $current->{'type'} eq 'menu_entry_node')) {
2499 my $empty_menu_entry_node = 0;
2500 my $end_comment;
2501 if ($current->{'type'} eq 'menu_entry_node') {
2502 if (@{$current->{'contents'}}
2503 and $current->{'contents'}->[-1]->{'cmdname'}
2504 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
2505 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')) {
2506 $end_comment = pop @{$current->{'contents'}};
2507 }
2508 if (!@{$current->{'contents'}}
2509 # empty if only the end of line or spaces
2510 or (@{$current->{'contents'}} == 1
2511 and defined($current->{'contents'}->[-1]->{'text'})
2512 and $current->{'contents'}->[-1]->{'text'} !~ /\S/)) {
2513 $empty_menu_entry_node = 1;
2514 push @{$current->{'contents'}}, $end_comment if ($end_comment);
2515 }
2516 }
2517 # we abort the menu entry if there is no node name
2518 if ($empty_menu_entry_node
2519 or $current->{'type'} eq 'menu_entry_name') {
2520 my $description_or_menu_comment;
2521 print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'DEBUG'});
2522 my $menu = $current->{'parent'}->{'parent'};
2523 my $menu_entry = pop @{$menu->{'contents'}};
2524 if (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
2525 and $menu->{'contents'}->[-1]->{'type'} eq 'menu_entry') {
2526 my $entry = $menu->{'contents'}->[-1];
2527 my $description;
2528 foreach my $entry_element (reverse(@{$entry->{'args'}})) {
2529 if ($entry_element->{'type'} eq 'menu_entry_description') {
2530 $description = $entry_element;
2531 last;
2532 }
2533 }
2534 if ($description) {
2535 $description_or_menu_comment = $description;
2536 } else {
2537 # Normally this cannot happen
2538 $self->_bug_message("No description in menu_entry",
2539 $line_nr, $current);
2540 push @{$entry->{'args'}}, {'type' => 'menu_entry_description',
2541 'parent' => $entry,
2542 'contents' => [] };
2543 $description_or_menu_comment = $entry->{'args'}->[-1];
2544 }
2545 } elsif (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
2546 and $menu->{'contents'}->[-1]->{'type'} eq 'menu_comment') {
2547 $description_or_menu_comment = $menu->{'contents'}->[-1];
2548 }
2549 if ($description_or_menu_comment) {
2550 $current = $description_or_menu_comment;
2551 if ($current->{'contents'}->[-1] and $current->{'contents'}->[-1]->{'type'}
2552 and $current->{'contents'}->[-1]->{'type'} eq 'preformatted') {
2553 $current = $current->{'contents'}->[-1];
2554 } else {
2555 # this should not happen
2556 $self->_bug_message("description or menu comment not in preformatted",
2557 $line_nr, $current);
2558 push @{$current->{'contents'}}, {'type' => 'preformatted',
2559 'parent' => $current,
2560 'contents' => [] };
2561 $current = $current->{'contents'}->[-1];
2562 }
2563 push @{$self->{'context_stack'}}, 'preformatted';
2564 } else {
2565 push @{$menu->{'contents'}}, {'type' => 'menu_comment',
2566 'parent' => $menu,
2567 'contents' => [] };
2568 $current = $menu->{'contents'}->[-1];
2569 push @{$current->{'contents'}}, {'type' => 'preformatted',
2570 'parent' => $current,
2571 'contents' => [] };
2572 $current = $current->{'contents'}->[-1];
2573 push @{$self->{'context_stack'}}, 'preformatted';
2574 print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
2575 }
2576 while (@{$menu_entry->{'args'}}) {
2577 my $arg = shift @{$menu_entry->{'args'}};
2578 if (defined($arg->{'text'})) {
2579 $current = _merge_text($self, $current, $arg->{'text'});
2580 } else {
2581 while (@{$arg->{'contents'}}) {
2582 my $content = shift @{$arg->{'contents'}};
2583 if (defined($content->{'text'})) {
2584 $current = _merge_text($self, $current,
2585 $content->{'text'});
2586 $content = undef;
2587 } else {
2588 $content->{'parent'} = $current;
2589 push @{$current->{'contents'}}, $content;
2590 }
2591 }
2592 }
2593 $arg = undef;
2594 }
2595 # MENU_COMMENT open
2596 $menu_entry = undef;
2597 } else {
2598 print STDERR "MENU ENTRY END LINE\n" if ($self->{'DEBUG'});
2599 $current = $current->{'parent'};
2600 $current = _enter_menu_entry_node($self, $current, $line_nr);
2601 if (defined($end_comment)) {
2602 $end_comment->{'parent'} = $current;
2603 push @{$current->{'contents'}}, $end_comment;
2604 }
2605 }
2606 # def line
2607 } elsif ($current->{'parent'}
2608 and $current->{'parent'}->{'type'}
2609 and $current->{'parent'}->{'type'} eq 'def_line') {
2610 my $def_context = pop @{$self->{'context_stack'}};
2611 if ($def_context ne 'def') {
2612 $self->_bug_message("context $def_context instead of def",
2613 $line_nr, $current);
2614 die;
2615 }
2616 my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
2617 my $arguments = _parse_def($self, $def_command, $current);
2618 if (scalar(@$arguments)) {
2619 #$current->{'parent'}->{'extra'}->{'def_args'} = $arguments;
2620 my $def_parsed_hash;
2621 foreach my $arg (@$arguments) {
2622 die if (!defined($arg->[0]));
2623 last if ($arg->[0] eq 'arg' or $arg->[0] eq 'typearg'
2624 or $arg->[0] eq 'delimiter');
2625 next if ($arg->[0] eq 'spaces');
2626 $def_parsed_hash->{$arg->[0]} = $arg->[1];
2627 }
2628 $current->{'parent'}->{'extra'}->{'def_parsed_hash'} = $def_parsed_hash;
2629 # do an standard index entry tree
2630 my $index_entry;
2631 if (defined($def_parsed_hash->{'name'})) {
2632 $index_entry = $def_parsed_hash->{'name'}
2633 # empty bracketed
2634 unless ($def_parsed_hash->{'name'}->{'type'}
2635 and $def_parsed_hash->{'name'}->{'type'} eq 'bracketed_def_content'
2636 and (!$def_parsed_hash->{'name'}->{'contents'}
2637 or (!scalar(@{$def_parsed_hash->{'name'}->{'contents'}}))
2638 or (scalar(@{$def_parsed_hash->{'name'}->{'contents'}}) == 1
2639 and defined($def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'})
2640 and $def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'} !~ /\S/)));
2641 }
2642 if (defined($index_entry)) {
2643 my $index_contents_normalized;
2644 if ($def_parsed_hash->{'class'}) {
2645 # Delay getting the text until Texinfo::Structuring::sort_index_keys
2646 # in order to avoid using gdt.
2647 # We need to store the language as well in case there are multiple
2648 # languages in the document.
2649 if ($command_index{$def_command} eq 'fn'
2650 or $command_index{$def_command} eq 'vr'
2651 and $def_command ne 'defcv') {
2652 undef $index_entry;
2653 $current->{'parent'}->{'extra'}->{'documentlanguage'}
2654 = $self->{'documentlanguage'};
2655 }
2656 }
2657 my $index_contents;
2658 if ($index_entry) {
2659 $index_contents_normalized = [$index_entry];
2660 $index_contents = [$index_entry];
2661 }
2662
2663 _enter_index_entry($self,
2664 $current->{'parent'}->{'extra'}->{'def_command'},
2665 $current->{'parent'}->{'extra'}->{'original_def_cmdname'},
2666 $current->{'parent'}, $index_contents,
2667 $index_contents_normalized, $line_nr);
2668 } else {
2669 $self->_command_warn($current->{'parent'}, $line_nr,
2670 __('missing name for @%s'),
2671 $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
2672 }
2673 } else {
2674 $self->_command_warn($current->{'parent'}, $line_nr,
2675 __('missing category for @%s'),
2676 $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
2677 }
2678 $current = $current->{'parent'}->{'parent'};
2679 $current = _begin_preformatted($self, $current);
2680
2681 # other block command lines
2682 } elsif ($current->{'type'}
2683 and $current->{'type'} eq 'block_line_arg') {
2684 my $empty_text;
2685 my $context = pop @{$self->{'context_stack'}};
2686 if ($context ne 'line') {
2687 $self->_bug_message("context $context instead of line in block_line_arg",
2688 $line_nr, $current);
2689 }
2690 # @multitable args
2691 if ($current->{'parent'}->{'cmdname'}
2692 and $current->{'parent'}->{'cmdname'} eq 'multitable') {
2693 # parse the prototypes and put them in a special arg
2694 my @prototype_row;
2695 foreach my $content (@{$current->{'contents'}}) {
2696 if ($content->{'type'} and $content->{'type'} eq 'bracketed') {
2697 push @prototype_row, { 'contents' => $content->{'contents'},
2698 'type' => 'bracketed_multitable_prototype'};
2699 } elsif ($content->{'text'}) {
2700 # TODO: this should be a warning or an error - all prototypes
2701 # on a @multitable line should be in braces, as documented in the
2702 # Texinfo manual.
2703 if ($content->{'text'} =~ /\S/) {
2704 foreach my $prototype (split /\s+/, $content->{'text'}) {
2705 push @prototype_row, { 'text' => $prototype,
2706 'type' => 'row_prototype' } unless ($prototype eq '');
2707 }
2708 }
2709 } else {
2710 if (!$content->{'cmdname'}
2711 or ($content->{'cmdname'} ne 'c'
2712 and $content->{'cmdname'} ne 'comment')) {
2713 $self->_command_warn($current, $line_nr,
2714 __("unexpected argument on \@%s line: %s"),
2715 $current->{'parent'}->{'cmdname'},
2716 Texinfo::Convert::Texinfo::convert($content));
2717 }
2718 }
2719 }
2720
2721 my $multitable = $current->{'parent'};
2722 $multitable->{'extra'}->{'max_columns'} = scalar(@prototype_row);
2723 if (!scalar(@prototype_row)) {
2724 $self->_command_warn($multitable, $line_nr,
2725 __("empty multitable"));
2726 }
2727 $multitable->{'extra'}->{'prototypes'} = \@prototype_row;
2728 }
2729 _isolate_last_space($self, $current);
2730 $current = $current->{'parent'};
2731 delete $current->{'remaining_args'};
2732 # don't consider empty argument of block @-commands as argument,
2733 # reparent them as contents
2734 if ($current->{'args'}->[0]->{'contents'}->[0]
2735 and $current->{'args'}->[0]->{'contents'}->[0]->{'type'}
2736 and $current->{'args'}->[0]->{'contents'}->[0]->{'type'} eq 'empty_line_after_command')
2737 {
2738 my $empty_text = $current->{'args'}->[0]->{'contents'}->[0];
2739 $empty_text->{'parent'} = $current;
2740 unshift @{$current->{'contents'}}, $empty_text;
2741 delete $current->{'args'};
2742 }
2743
2744 # @float args
2745 if ($current->{'cmdname'} and $current->{'cmdname'} eq 'float') {
2746 $current->{'line_nr'} = $line_nr;
2747 my $type = '';
2748 my $float_label;
2749 if ($current->{'args'} and $current->{'args'}->[1]) {
2750 $float_label = _parse_node_manual($current->{'args'}->[1]);
2751 _check_internal_node($self, $float_label, $line_nr);
2752 }
2753 _register_label($self, $current, $float_label);
2754 _parse_float_type($current);
2755 $type = $current->{'extra'}->{'type'}->{'normalized'};
2756 push @{$self->{'floats'}->{$type}}, $current;
2757 $current->{'extra'}->{'float_section'} = $self->{'current_section'}
2758 if (defined($self->{'current_section'}));
2759 }
2760
2761 if ($current->{'cmdname'}
2762 and $block_item_commands{$current->{'cmdname'}}) {
2763 if ($current->{'cmdname'} eq 'enumerate') {
2764 my $spec = 1;
2765 if ($current->{'args'} and $current->{'args'}->[0]
2766 and $current->{'args'}->[0]->{'contents'}
2767 and @{$current->{'args'}->[0]->{'contents'}}) {
2768 if (scalar(@{$current->{'args'}->[0]->{'contents'}}) > 1) {
2769 $self->_command_error($current, $line_nr,
2770 __("superfluous argument to \@%s"),
2771 $current->{'cmdname'});
2772 }
2773 my $arg = $current->{'args'}->[0]->{'contents'}->[0];
2774 if (!defined($arg->{'text'}) or $arg->{'text'} !~ /^(([[:digit:]]+)|([[:alpha:]]+))$/) {
2775 $self->_command_error($current, $line_nr,
2776 __("bad argument to \@%s"),
2777 $current->{'cmdname'});
2778 } else {
2779 $spec = $arg->{'text'};
2780 }
2781 }
2782 $current->{'extra'}->{'enumerate_specification'} = $spec;
2783 } elsif ($item_line_commands{$current->{'cmdname'}}) {
2784 if (!$current->{'extra'}
2785 or !$current->{'extra'}->{'command_as_argument'}) {
2786 $self->_command_error($current, $line_nr,
2787 __("%s requires an argument: the formatter for %citem"),
2788 $current->{'cmdname'}, ord('@'));
2789 } elsif (!$brace_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}) {
2790 $self->_command_error($current, $line_nr,
2791 __("command \@%s not accepting argument in brace should not be on \@%s line"),
2792 $current->{'extra'}->{'command_as_argument'}->{'cmdname'},
2793 $current->{'cmdname'});
2794 delete $current->{'extra'}->{'command_as_argument'};
2795 }
2796 }
2797 # This code checks that the command_as_argument of the @itemize
2798 # is alone on the line, otherwise it is not a command_as_argument.
2799 if ($current->{'extra'}
2800 and $current->{'extra'}->{'command_as_argument'}
2801 and $current->{'cmdname'} eq 'itemize') {
2802 my @args = @{$current->{'args'}->[0]->{'contents'}};
2803 while (@args) {
2804 my $arg = shift @args;
2805 last if ($arg eq $current->{'extra'}->{'command_as_argument'});
2806 }
2807 while (@args) {
2808 my $arg = shift @args;
2809 if (!(($arg->{'cmdname'}
2810 and ($arg->{'cmdname'} eq 'c'
2811 or $arg->{'cmdname'} eq 'comment'))
2812 or (defined($arg->{'text'}) and $arg->{'text'} !~ /\S/))) {
2813 delete $current->{'extra'}->{'command_as_argument'}->{'type'};
2814 delete $current->{'extra'}->{'command_as_argument'};
2815 last;
2816 }
2817 }
2818 }
2819 if ($current->{'extra'}
2820 and $current->{'extra'}->{'command_as_argument'}
2821 and $accent_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
2822 and ($current->{'cmdname'} eq 'itemize'
2823 or $item_line_commands{$current->{'cmdname'}})) {
2824 $self->_command_warn($current, $line_nr,
2825 __("accent command `\@%s' not allowed as \@%s argument"),
2826 $current->{'extra'}->{'command_as_argument'}->{'cmdname'},
2827 $current->{'cmdname'});
2828 delete $current->{'extra'}->{'command_as_argument'};
2829 }
2830 if ($current->{'cmdname'} eq 'itemize'
2831 and (!$current->{'args'}
2832 or !$current->{'args'}->[0]
2833 or !$current->{'args'}->[0]->{'contents'}
2834 or !@{$current->{'args'}->[0]->{'contents'}})) {
2835 my $inserted = { 'cmdname' => 'bullet',
2836 'contents' => [],
2837 'type' => 'command_as_argument_inserted',
2838 'parent' => $current };
2839 unshift @{$current->{'args'}}, $inserted;
2840 $current->{'extra'}->{'command_as_argument'} = $inserted;
2841 } elsif ($item_line_commands{$current->{'cmdname'}} and
2842 !$current->{'extra'}->{'command_as_argument'}) {
2843 my $inserted = { 'cmdname' => 'asis',
2844 'contents' => [],
2845 'type' => 'command_as_argument_inserted',
2846 'parent' => $current };
2847 unshift @{$current->{'args'}}, $inserted;
2848 $current->{'extra'}->{'command_as_argument'} = $inserted;
2849 }
2850 push @{$current->{'contents'}}, { 'type' => 'before_item',
2851 'contents' => [], 'parent', $current };
2852 $current = $current->{'contents'}->[-1];
2853 }
2854 if ($current->{'cmdname'} and $menu_commands{$current->{'cmdname'}}) {
2855 push @{$current->{'contents'}}, {'type' => 'menu_comment',
2856 'parent' => $current,
2857 'contents' => [] };
2858 $current = $current->{'contents'}->[-1];
2859 print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
2860 push @{$self->{'context_stack'}}, 'preformatted';
2861 }
2862 $current = _begin_preformatted($self, $current);
2863
2864 # if we are after a @end verbatim, we must restart a preformatted if needed,
2865 # since there is no @end command explicitly associated to raw commands
2866 # it won't be done elsewhere.
2867 } elsif ($current->{'contents'}
2868 and $current->{'contents'}->[-1]
2869 and $current->{'contents'}->[-1]->{'type'}
2870 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
2871 and $current->{'contents'}->[-2]
2872 and $current->{'contents'}->[-2]->{'cmdname'}
2873 and $current->{'contents'}->[-2]->{'cmdname'} eq 'verbatim') {
2874 $current = _begin_preformatted($self, $current);
2875 # misc command line arguments
2876 # Never go here if skipline/noarg/...
2877 } elsif ($current->{'type'}
2878 and $current->{'type'} eq 'line_arg') {
2879 my $context = pop @{$self->{'context_stack'}};
2880 if ($context ne 'line') {
2881 $self->_bug_message("context $context instead of line in line_arg",
2882 $line_nr, $current);
2883 }
2884 _isolate_last_space($self, $current);
2885
2886 # first parent is the @command, second is the parent
2887 $current = $current->{'parent'};
2888 my $misc_cmd = $current;
2889 my $command = $current->{'cmdname'};
2890 my $end_command;
2891 print STDERR "MISC END \@$command\n" if ($self->{'DEBUG'});
2892
2893 if ($self->{'line_commands'}->{$command} =~ /^\d$/) {
2894 my $args = _parse_line_command_args($self, $current, $line_nr);
2895 $current->{'extra'}->{'misc_args'} = $args if (defined($args));
2896 if ($command eq 'validatemenus') {
2897 if ($args and $args->[0]) {
2898 my $arg = $args->[0];
2899 if ($arg eq 'on') {
2900 $self->{'validatemenus'} = 1;
2901 } elsif ($arg eq 'off') {
2902 $self->{'validatemenus'} = 0;
2903 }
2904 }
2905 }
2906 } elsif ($self->{'line_commands'}->{$command} eq 'text') {
2907 my $text = '';
2908 my $superfluous_arg = 0;
2909 for my $c (@{$current->{'args'}->[0]->{'contents'}}) {
2910 # Allow @@, @{ and @} to give a way for @, { and } to appear in
2911 # filenames (although it's not a good idea to use these characters
2912 # in filenames).
2913 if ($c->{'text'}) {
2914 $text .= $c->{'text'};
2915 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '@') {
2916 $text .= '@';
2917 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '{') {
2918 $text .= '{';
2919 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '}') {
2920 $text .= '}';
2921 } else {
2922 $superfluous_arg = 1;
2923 }
2924 }
2925 if ($text eq '') {
2926 if (not $superfluous_arg) {
2927 $self->_command_warn($current, $line_nr,
2928 __("\@%s missing argument"), $command);
2929 }
2930 # Otherwise an error message is issued below.
2931 $current->{'extra'}->{'missing_argument'} = 1;
2932 } else {
2933 $current->{'extra'}->{'text_arg'} = $text;
2934 if ($command eq 'end') {
2935 # REMACRO
2936 my $line = $text;
2937 if ($line =~ s/^([[:alnum:]][[:alnum:]-]+)//) {
2938 $end_command = $1;
2939
2940 if (!exists $block_commands{$end_command}) {
2941 $self->_command_warn($current, $line_nr,
2942 __("unknown \@end %s"), $end_command);
2943 $end_command = undef;
2944 } else {
2945 print STDERR "END BLOCK $end_command\n" if ($self->{'DEBUG'});
2946 if ($block_commands{$end_command} eq 'conditional') {
2947 if (@{$self->{'conditionals_stack'}}
2948 and $self->{'conditionals_stack'}->[-1] eq $end_command) {
2949 pop @{$self->{'conditionals_stack'}};
2950 } else {
2951 $self->_command_error($current, $line_nr,
2952 __("unmatched `%c%s'"), ord('@'), 'end');
2953 $end_command = undef;
2954 }
2955 }
2956 $current->{'extra'}->{'command_argument'} = $end_command
2957 if (defined($end_command));
2958 }
2959 if (($superfluous_arg or $line =~ /\S/)
2960 and defined($end_command)) {
2961 my $texi_line
2962 = Texinfo::Convert::Texinfo::convert($current->{'args'}->[0]);
2963 $texi_line =~ s/^\s*([[:alnum:]][[:alnum:]-]+)//;
2964 $self->_command_error($current, $line_nr,
2965 __("superfluous argument to \@%s %s: %s"),
2966 $command, $end_command, $texi_line);
2967 $superfluous_arg = 0; # Don't issue another error message below.
2968 }
2969 } else {
2970 $self->_command_error($current, $line_nr,
2971 __("bad argument to \@%s: %s"),
2972 $command, $line);
2973 }
2974 } elsif ($superfluous_arg) {
2975 # An error message is issued below.
2976 } elsif ($command eq 'include') {
2977 my $file = Texinfo::Common::locate_include_file($self, $text) ;
2978 if (defined($file)) {
2979 my $filehandle = do { local *FH };
2980 if (open ($filehandle, $file)) {
2981 $included_file = 1;
2982 binmode($filehandle, ":encoding($self->{'INPUT_PERL_ENCODING'})")
2983 if (defined($self->{'INPUT_PERL_ENCODING'}));
2984 print STDERR "Included $file($filehandle)\n" if ($self->{'DEBUG'});
2985 my ($directories, $suffix);
2986 ($file, $directories, $suffix) = fileparse($file)
2987 if ($self->{'TEST'});
2988 unshift @{$self->{'input'}}, {
2989 'name' => $file,
2990 'line_nr' => 0,
2991 'pending' => [],
2992 'fh' => $filehandle };
2993 } else {
2994 $self->_command_error($current, $line_nr,
2995 __("\@%s: could not open %s: %s"),
2996 $command, $text, $!);
2997 }
2998 } else {
2999 $self->_command_error($current, $line_nr,
3000 __("\@%s: could not find %s"),
3001 $command, $text);
3002 }
3003 } elsif ($command eq 'verbatiminclude') {
3004 $current->{'extra'}->{'input_perl_encoding'}
3005 = $self->{'INPUT_PERL_ENCODING'}
3006 if defined $self->{'INPUT_PERL_ENCODING'};
3007 } elsif ($command eq 'documentencoding') {
3008 my ($texinfo_encoding, $perl_encoding, $input_encoding)
3009 = Texinfo::Encoding::encoding_alias($text);
3010 $self->_command_warn($current, $line_nr,
3011 __("encoding `%s' is not a canonical texinfo encoding"),
3012 $text)
3013 if (!$texinfo_encoding or $texinfo_encoding ne lc($text));
3014 if ($input_encoding) {
3015 $current->{'extra'}->{'input_encoding_name'} = $input_encoding;
3016 }
3017 if (!$perl_encoding) {
3018 $self->_command_warn($current, $line_nr,
3019 __("unrecognized encoding name `%s'"), $text);
3020 } else {
3021 $current->{'extra'}->{'input_perl_encoding'} = $perl_encoding;
3022
3023 if ($input_encoding) {
3024 if (!$self->{'set'}->{'INPUT_ENCODING_NAME'}) {
3025 $self->{'INPUT_ENCODING_NAME'} = $input_encoding;
3026 $self->{'info'}->{'input_encoding_name'} = $input_encoding;
3027 }
3028 }
3029
3030 if (!$self->{'set'}->{'INPUT_PERL_ENCODING'}) {
3031 $self->{'INPUT_PERL_ENCODING'} = $perl_encoding;
3032 $self->{'info'}->{'input_perl_encoding'} = $perl_encoding;
3033 foreach my $input (@{$self->{'input'}}) {
3034 binmode($input->{'fh'}, ":encoding($perl_encoding)") if ($input->{'fh'});
3035 }
3036 }
3037 }
3038 } elsif ($command eq 'documentlanguage') {
3039 my @messages = Texinfo::Common::warn_unknown_language($text);
3040 foreach my $message(@messages) {
3041 $self->_command_warn($current, $line_nr, $message);
3042 }
3043 if (!$self->{'set'}->{'documentlanguage'}) {
3044 $self->{'documentlanguage'} = $text;
3045 }
3046 }
3047 }
3048 if ($superfluous_arg) {
3049 my $texi_line
3050 = Texinfo::Convert::Texinfo::convert($current->{'args'}->[0]);
3051 $texi_line =~ s/^\s*//;
3052 $texi_line =~ s/\s*$//;
3053
3054 $self->_command_error($current, $line_nr,
3055 __("bad argument to \@%s: %s"),
3056 $command, $texi_line);
3057
3058 }
3059 } elsif ($command eq 'node') {
3060 foreach my $arg (@{$current->{'args'}}) {
3061 my $node = _parse_node_manual($arg);
3062 push @{$current->{'extra'}->{'nodes_manuals'}}, $node;
3063 }
3064 _check_internal_node($self, $current->{'extra'}->{'nodes_manuals'}->[0],
3065 $line_nr);
3066 _register_label($self, $current,
3067 $current->{'extra'}->{'nodes_manuals'}->[0]);
3068 $self->{'current_node'} = $current;
3069 } elsif ($command eq 'listoffloats') {
3070 _parse_float_type($current);
3071 } else {
3072 # Handle all the other 'line' commands. Here just check that they
3073 # have an argument. Empty @top is allowed
3074 if (!@{$current->{'args'}->[0]->{'contents'}} and $command ne 'top') {
3075 $self->_command_warn($current, $line_nr,
3076 __("\@%s missing argument"), $command);
3077 $current->{'extra'}->{'missing_argument'} = 1;
3078 } else {
3079 if (($command eq 'item' or $command eq 'itemx')
3080 and $current->{'parent'}->{'cmdname'}
3081 and $self->{'command_index'}->{$current->{'parent'}->{'cmdname'}}) {
3082 _enter_index_entry($self, $current->{'parent'}->{'cmdname'},
3083 $command, $current,
3084 $current->{'args'}->[0]->{'contents'},
3085 undef, $line_nr);
3086 } elsif ($self->{'command_index'}->{$current->{'cmdname'}}) {
3087 _enter_index_entry($self, $current->{'cmdname'},
3088 $current->{'cmdname'}, $current,
3089 $current->{'args'}->[0]->{'contents'},
3090 undef, $line_nr);
3091 $current->{'type'} = 'index_entry_command';
3092 }
3093 }
3094 }
3095 $current = $current->{'parent'};
3096 if ($end_command) {
3097 print STDERR "END COMMAND $end_command\n" if ($self->{'DEBUG'});
3098 my $end = pop @{$current->{'contents'}};
3099 if ($block_commands{$end_command} ne 'conditional') {
3100 my $closed_command;
3101 ($closed_command, $current)
3102 = _close_commands($self, $current, $line_nr, $end_command);
3103 my $inline_copying;
3104 if ($closed_command) {
3105 $closed_command->{'extra'}->{'end_command'} = $misc_cmd;
3106 _close_command_cleanup($self, $closed_command);
3107 $end->{'parent'} = $closed_command;
3108
3109 push @{$closed_command->{'contents'}}, $end;
3110
3111 # closing a menu command, but still in a menu. Open a menu_comment
3112 if ($menu_commands{$closed_command->{'cmdname'}}
3113 and $self->{'context_stack'}->[-1] eq 'menu') {
3114 print STDERR "CLOSE MENU but still in menu context\n"
3115 if ($self->{'DEBUG'});
3116 push @{$current->{'contents'}}, {'type' => 'menu_comment',
3117 'parent' => $current,
3118 'contents' => [] };
3119 $current = $current->{'contents'}->[-1];
3120 push @{$self->{'context_stack'}}, 'preformatted';
3121 }
3122 } else {
3123 # block command not found for @end
3124 }
3125 $current = _begin_preformatted($self, $current)
3126 if ($close_preformatted_commands{$end_command});
3127 }
3128 } else {
3129 $current = _begin_preformatted($self, $current)
3130 if ($close_preformatted_commands{$command});
3131 }
3132 # if a file was included, remove completly the include file command.
3133 # Also ignore @setfilename in included file, as said in the manual.
3134 if ($included_file or ($command eq 'setfilename'
3135 and scalar(@{$self->{'input'}}) > 1)) {
3136 # TODO keep the information with sourcemark
3137 pop @{$current->{'contents'}};
3138 } elsif ($command eq 'setfilename'
3139 and ($self->{'current_node'} or $self->{'current_section'})) {
3140 $self->_command_warn($misc_cmd, $line_nr,
3141 __("\@%s after the first element"), $command);
3142 # columnfractions
3143 } elsif ($command eq 'columnfractions') {
3144 # in a multitable, we are in a block_line_arg
3145 if (!$current->{'parent'} or !$current->{'parent'}->{'cmdname'}
3146 or $current->{'parent'}->{'cmdname'} ne 'multitable') {
3147 $self->_command_error($current, $line_nr,
3148 __("\@%s only meaningful on a \@multitable line"),
3149 $command);
3150 } else {
3151 # This is the multitable block_line_arg line context
3152 my $context = pop @{$self->{'context_stack'}};
3153 if ($context ne 'line') {
3154 $self->_bug_message("context $context instead of line for multitable",
3155 $line_nr, $current);
3156 }
3157 $current = $current->{'parent'};
3158 $current->{'extra'}->{'max_columns'} = 0;
3159 if (defined($misc_cmd->{'extra'}->{'misc_args'})) {
3160 $current->{'extra'}->{'max_columns'} =
3161 scalar(@{$misc_cmd->{'extra'}->{'misc_args'}});
3162 $current->{'extra'}->{'columnfractions'} = $misc_cmd;
3163 }
3164 push @{$current->{'contents'}}, { 'type' => 'before_item',
3165 'contents' => [], 'parent', $current };
3166 $current = $current->{'contents'}->[-1];
3167 }
3168 } elsif ($root_commands{$command}) {
3169 $current = $current->{'contents'}->[-1];
3170 delete $current->{'remaining_args'};
3171
3172 # associate the section (not part) with the current node.
3173 if ($command ne 'node' and $command ne 'part') {
3174 if ($self->{'current_node'}
3175 and !$self->{'current_node'}->{'extra'}->{'associated_section'}) {
3176 $self->{'current_node'}->{'extra'}->{'associated_section'} = $current;
3177 $current->{'extra'}->{'associated_node'} = $self->{'current_node'};
3178 }
3179 if ($self->{'current_part'}) {
3180 $current->{'extra'}->{'associated_part'} = $self->{'current_part'};
3181 $self->{'current_part'}->{'extra'}->{'part_associated_section'}
3182 = $current;
3183 if ($current->{'cmdname'} eq 'top') {
3184 $self->line_warn("\@part should not be associated with \@top",
3185 $self->{'current_part'}->{'line_nr'});
3186 }
3187 delete $self->{'current_part'};
3188 }
3189 $self->{'current_section'} = $current;
3190 } elsif ($command eq 'part') {
3191 $self->{'current_part'} = $current;
3192 if ($self->{'current_node'}
3193 and !$self->{'current_node'}->{'extra'}->{'associated_section'}) {
3194 $self->line_warn (sprintf(__(
3195 "\@node precedes \@%s, but parts may not be associated with nodes"),
3196 $command), $line_nr);
3197 }
3198 }
3199 }
3200 # do that last in order to have the line processed if one of the above
3201 # case is also set.
3202 } elsif (
3203 $current->{'contents'}
3204 and (scalar(@{$current->{'contents'}}) == 1
3205 and (($current->{'contents'}->[-1]->{'type'}
3206 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'))
3207 or (scalar(@{$current->{'contents'}}) == 2
3208 and $current->{'contents'}->[-1]->{'cmdname'}
3209 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
3210 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')
3211 and $current->{'contents'}->[-2]
3212 and $current->{'contents'}->[-2]->{'type'}
3213 and $current->{'contents'}->[-2]->{'type'} eq 'empty_line_after_command'))) {
3214 # empty line after a @menu or before a preformatted. Reparent to the menu
3215 # or other format
3216 if ($current->{'type'}
3217 and $preformatted_contexts{$current->{'type'}}) {
3218 my $parent = $current->{'parent'};
3219 if ($parent->{'type'} and $parent->{'type'} eq 'menu_comment'
3220 and scalar(@{$parent->{'contents'}}) == 1) {
3221 $parent = $parent->{'parent'};
3222 }
3223 my $to_reparent = pop @{$parent->{'contents'}};
3224 print STDERR "LINE AFTER COMMAND IN PREFORMATTED ($to_reparent->{'type'})\n" if ($self->{'DEBUG'});
3225 while (@{$current->{'contents'}}) {
3226 my $content = shift @{$current->{'contents'}};
3227 $content->{'parent'} = $parent;
3228 push @{$parent->{'contents'}}, $content;
3229 }
3230 push @{$parent->{'contents'}}, $to_reparent;
3231 }
3232 }
3233
3234 # this happens if there is a nesting of line @-commands on a line.
3235 # they are reprocessed here.
3236 if ($self->{'context_stack'}->[-1] eq 'line'
3237 or $self->{'context_stack'}->[-1] eq 'def') {
3238 print STDERR "Still opened line command $self->{'context_stack'}->[-1]:"._print_current($current)
3239 if ($self->{'DEBUG'});
3240 if ($self->{'context_stack'}->[-1] eq 'def') {
3241 while ($current->{'parent'} and !($current->{'parent'}->{'type'}
3242 and $current->{'parent'}->{'type'} eq 'def_line')) {
3243 $current = _close_current($self, $current, $line_nr);
3244 }
3245 } else {
3246 while ($current->{'parent'} and !($current->{'type'}
3247 and ($current->{'type'} eq 'block_line_arg'
3248 or $current->{'type'} eq 'line_arg'))) {
3249 $current = _close_current($self, $current, $line_nr);
3250 }
3251 }
3252
3253 # check for infinite loop bugs...
3254 if ($current eq $current_old) {
3255 my $indent = '- ';
3256 my $tree_msg = $indent . _print_current($current);
3257 while ($current->{'parent'}) {
3258 $indent = '-'.$indent;
3259 $current = $current->{'parent'};
3260 $tree_msg .= $indent . _print_current($current);
3261 }
3262 $self->_bug_message("Nothing closed while a line context remains\n$tree_msg",
3263 $line_nr);
3264 die;
3265 }
3266
3267 $current = $self->_end_line($current, $line_nr);
3268 }
3269 return $current;
3270 }
3271
3272 # $command may be undef if we are after a wrong misc command such as
3273 # a buggy @tab.
3274 sub _start_empty_line_after_command($$$) {
3275 my ($line, $current, $command) = @_;
3276
3277 $line =~ s/^([^\S\r\n]*)//;
3278 push @{$current->{'contents'}}, { 'type' => 'empty_line_after_command',
3279 'text' => $1,
3280 'parent' => $current,
3281 };
3282 if (defined($command)) {
3283 $current->{'contents'}->[-1]->{'extra'} = {'command' => $command};
3284 }
3285 return $line;
3286 }
3287
3288 sub _check_empty_node($$$$)
3289 {
3290 my ($self, $parsed_node, $command, $line_nr) = @_;
3291
3292 if (!defined($parsed_node) or !$parsed_node->{'node_content'}) {
3293 $self->line_error (sprintf(__("empty argument in \@%s"),
3294 $command), $line_nr);
3295 return 0;
3296 } else {
3297 return 1;
3298 }
3299 }
3300
3301 sub _check_internal_node($$$)
3302 {
3303 my ($self, $parsed_node, $line_nr) = @_;
3304
3305 if ($parsed_node and $parsed_node->{'manual_content'}) {
3306 $self->line_error (sprintf(__("syntax for an external node used for `%s'"),
3307 Texinfo::Structuring::node_extra_to_texi($parsed_node)), $line_nr)
3308 }
3309 }
3310
3311 sub _check_node_label($$$$)
3312 {
3313 my ($self, $parsed_node, $command, $line_nr) = @_;
3314
3315 _check_internal_node($self, $parsed_node, $line_nr);
3316 return _check_empty_node($self, $parsed_node, $command, $line_nr);
3317 }
3318
3319 sub _register_extra_menu_entry_information($$;$)
3320 {
3321 my ($self, $current, $line_nr) = @_;
3322
3323 foreach my $arg (@{$current->{'args'}}) {
3324 if ($arg->{'type'} eq 'menu_entry_name') {
3325 $current->{'extra'}->{'menu_entry_name'} = $arg;
3326 my $normalized_menu_entry_name =
3327 Texinfo::Convert::NodeNameNormalization::normalize_node($arg);
3328 if ($normalized_menu_entry_name !~ /[^-]/) {
3329 $self->line_warn(sprintf(__("empty menu entry name in `%s'"),
3330 Texinfo::Convert::Texinfo::convert($current)), $line_nr);
3331 }
3332 } elsif ($arg->{'type'} eq 'menu_entry_node') {
3333 _isolate_last_space($self, $arg);
3334 my $parsed_entry_node = _parse_node_manual($arg);
3335 if (! defined($parsed_entry_node)) {
3336 if ($self->{'SHOW_MENU'}) {
3337 $self->line_error (__("empty node name in menu entry"), $line_nr);
3338 }
3339 } else {
3340 delete $parsed_entry_node->{'normalized'};
3341 $current->{'extra'}->{'menu_entry_node'} = $parsed_entry_node;
3342 }
3343 } elsif ($arg->{'type'} eq 'menu_entry_description') {
3344 $current->{'extra'}->{'menu_entry_description'} = $arg;
3345 }
3346 }
3347 }
3348
3349 sub _enter_menu_entry_node($$$)
3350 {
3351 my ($self, $current, $line_nr) = @_;
3352
3353 my $description = { 'type' => 'menu_entry_description',
3354 'contents' => [],
3355 'parent' => $current };
3356 push @{$current->{'args'}}, $description;
3357 _register_extra_menu_entry_information($self, $current, $line_nr);
3358 $current->{'line_nr'} = $line_nr;
3359 push @{$self->{'internal_references'}}, $current;
3360
3361 $current = $description;
3362 push @{$current->{'contents'}}, {'type' => 'preformatted',
3363 'parent' => $current,
3364 'contents' => [] };
3365 $current = $current->{'contents'}->[-1];
3366 push @{$self->{'context_stack'}}, 'preformatted';
3367 return $current;
3368 }
3369
3370 sub _command_with_command_as_argument($)
3371 {
3372 my $current = shift;
3373 return ($current and $current->{'type'}
3374 and $current->{'type'} eq 'block_line_arg'
3375 and $current->{'parent'}
3376 and $current->{'parent'}->{'cmdname'} and
3377 ($current->{'parent'}->{'cmdname'} eq 'itemize'
3378 or $item_line_commands{$current->{'parent'}->{'cmdname'}})
3379 and scalar(@{$current->{'contents'}}) == 1);
3380 }
3381
3382 # This combines several regular expressions used in '_parse_texi' to
3383 # look at what is next on the remaining part of the line.
3384 # NOTE - this sub has an XS override
3385 sub _parse_texi_regex {
3386 my ($line) = @_;
3387
3388 my ($at_command, $open_brace, $asterisk, $single_letter_command,
3389 $separator_match, $misc_text)
3390 = ($line =~ /^\@([[:alnum:]][[:alnum:]-]*)
3391 |^(\{)
3392 |^(\*)
3393 |^\@(["'~\@&\}\{,\.!\? \t\n\*\-\^`=:\|\/\\])
3394 |^([{}@,:\t.\f])
3395 |^([^{}@,:\t.\n\f]+)
3396 /x);
3397
3398 if ($open_brace) {
3399 $separator_match = $open_brace;
3400 } elsif ($asterisk) {
3401 ($misc_text) = ($line =~ /^([^{}@,:\t.\n\f]+)/);
3402 }
3403
3404 return ($at_command, $open_brace, $asterisk, $single_letter_command,
3405 $separator_match, $misc_text);
3406 }
3407
3408 sub _check_line_directive {
3409 my ($self, $line, $line_nr) = @_;
3410
3411 if ($self->{'CPP_LINE_DIRECTIVES'}
3412 and defined($line_nr->{'file_name'})
3413 and $line_nr->{'file_name'} ne ''
3414 and !$line_nr->{'macro'}
3415 and $line =~ /^\s*#\s*(line)? (\d+)(( "([^"]+)")(\s+\d+)*)?\s*$/) {
3416 _save_line_directive ($self, $2, $5);
3417 return 1;
3418 }
3419 return 0;
3420 }
3421
3422 # Check whether $COMMAND can appear within $CURRENT->{'parent'}.
3423 sub _check_valid_nesting {
3424 my ($self, $current, $command, $line_nr) = @_;
3425
3426 my $invalid_parent;
3427 # error messages for forbidden constructs, like @node in @r,
3428 # block command on line command, @xref in @anchor or node...
3429 if ($current->{'parent'}) {
3430 if ($current->{'parent'}->{'cmdname'}) {
3431 if (defined($self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}})
3432 and !$self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}}->{$command}
3433 # we make sure that we are on a root @-command line and
3434 # not in contents
3435 and (!$root_commands{$current->{'parent'}->{'cmdname'}}
3436 or ($current->{'type'}
3437 and $current->{'type'} eq 'line_arg'))
3438 # we make sure that we are on a block @-command line and
3439 # not in contents
3440 and (!($block_commands{$current->{'parent'}->{'cmdname'}})
3441 or ($current->{'type'}
3442 and $current->{'type'} eq 'block_line_arg'))
3443 # we make sure that we are on an @item/@itemx line and
3444 # not in an @enumerate, @multitable or @itemize @item.
3445 and (($current->{'parent'}->{'cmdname'} ne 'itemx'
3446 and $current->{'parent'}->{'cmdname'} ne 'item')
3447 or ($current->{'type'}
3448 and $current->{'type'} eq 'line_arg'))) {
3449 $invalid_parent = $current->{'parent'}->{'cmdname'};
3450 }
3451 } elsif ($self->{'context_stack'}->[-1] eq 'def'
3452 # FIXME instead of hardcoding in_full_line_commands_no_refs
3453 # it would be better to use the parent command valid_nesting.
3454 and !$in_full_line_commands_no_refs{$command}) {
3455 my $def_block = $current;
3456 while ($def_block->{'parent'} and (!$def_block->{'parent'}->{'type'}
3457 or $def_block->{'parent'}->{'type'} ne 'def_line')) {
3458 $def_block = $def_block->{'parent'};
3459 }
3460
3461 $invalid_parent = $def_block->{'parent'}->{'parent'}->{'cmdname'};
3462 }
3463 }
3464
3465 if (defined($invalid_parent)) {
3466 $self->line_warn(sprintf(__("\@%s should not appear in \@%s"),
3467 $command, $invalid_parent), $line_nr);
3468 }
3469 }
3470
3471
3472 # the main subroutine
3473 sub _parse_texi($;$)
3474 {
3475 my ($self, $root) = @_;
3476
3477 $root = { 'contents' => [], 'type' => 'text_root' } if (!defined($root));
3478 my $current = $root;
3479
3480 my $line_nr;
3481
3482 NEXT_LINE:
3483 while (1) {
3484 my $line;
3485 ($line, $line_nr) = _next_text($self, $line_nr);
3486 last if (!defined($line));
3487
3488 if ($self->{'DEBUG'}) {
3489 my $line_text = '';
3490 $line_text = "$line_nr->{'line_nr'}.$line_nr->{'macro'}" if ($line_nr);
3491 print STDERR "NEW LINE(".join('|', @{$self->{'context_stack'}}).":@{$self->{'conditionals_stack'}}:$line_text): $line";
3492 #print STDERR "CONTEXT_STACK ".join('|',@{$self->{'context_stack'}})."\n";
3493 }
3494
3495 if (not
3496 # raw format or verb
3497 (($current->{'cmdname'}
3498 and $block_commands{$current->{'cmdname'}}
3499 and ($block_commands{$current->{'cmdname'}} eq 'raw'
3500 or $block_commands{$current->{'cmdname'}} eq 'conditional'))
3501 or
3502 ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
3503 and $current->{'parent'}->{'cmdname'} eq 'verb')
3504 )
3505 # not def line
3506 and $self->{'context_stack'}->[-1] ne 'def') {
3507 next NEXT_LINE if _check_line_directive ($self, $line, $line_nr);
3508 print STDERR "BEGIN LINE\n" if ($self->{'DEBUG'});
3509
3510 if ($current->{'contents'}
3511 and $current->{'contents'}->[-1]
3512 and $current->{'contents'}->[-1]->{'type'}
3513 and $current->{'contents'}->[-1]->{'type'}
3514 eq 'empty_spaces_before_argument') {
3515 # Remove this element and update 'extra' values.
3516 # FIXME: should we continue with this element instead?
3517 _abort_empty_line($self, $current);
3518 }
3519 $line =~ s/^([^\S\r\n]*)//;
3520 push @{$current->{'contents'}}, { 'type' => 'empty_line',
3521 'text' => $1,
3522 'parent' => $current };
3523 }
3524
3525 while (1) {
3526 # in a raw or ignored conditional block command
3527 if ($current->{'cmdname'} and
3528 $block_commands{$current->{'cmdname'}} and
3529 ($block_commands{$current->{'cmdname'}} eq 'raw'
3530 or $block_commands{$current->{'cmdname'}} eq 'conditional')) {
3531 # r?macro may be nested
3532 if (($current->{'cmdname'} eq 'macro'
3533 or $current->{'cmdname'} eq 'rmacro')
3534 and $line =~ /^\s*\@r?macro\s+/) {
3535 $line =~ s/\s*\@(r?macro)//;
3536 push @{$current->{'contents'}}, { 'cmdname' => $1,
3537 'parent' => $current,
3538 'contents' => [],
3539 'extra' => {'arg_line' => $line }};
3540 $current = $current->{'contents'}->[-1];
3541 last;
3542 # ifclear/ifset may be nested
3543 } elsif (($current->{'cmdname'} eq 'ifclear'
3544 or $current->{'cmdname'} eq 'ifset'
3545 or $current->{'cmdname'} eq 'ifcommanddefined'
3546 or $current->{'cmdname'} eq 'ifcommandnotdefined')
3547 and $line =~ /^\s*\@$current->{'cmdname'}/) {
3548 $line =~ s/\s*\@($current->{'cmdname'})//;
3549 push @{$current->{'contents'}}, { 'cmdname' => $1,
3550 'parent' => $current,
3551 'contents' => [],
3552 'extra' => {'line' => $line }};
3553 $current = $current->{'contents'}->[-1];
3554 last;
3555 } elsif ($line =~ /^(\s*?)\@end\s+([a-zA-Z][\w-]*)/
3556 and ($2 eq $current->{'cmdname'})) {
3557 my $end_command = $2;
3558 my $raw_command = $current;
3559 $line =~ s/^(\s*?)(\@end\s+$current->{'cmdname'})//;
3560 if ($1 eq '') {
3561 # FIXME exclude other formats, like @macro, @ifset, @ignore?
3562 if ($current->{'cmdname'} ne 'verbatim'
3563 and @{$current->{'contents'}}
3564 and $current->{'contents'}->[-1]->{'type'}
3565 and $current->{'contents'}->[-1]->{'type'} eq 'raw') {
3566 if ($current->{'contents'}->[-1]->{'text'} =~ s/(\n)//) {
3567 push @{$current->{'contents'}}, {'type' => 'last_raw_newline',
3568 'text' => $1, 'parent' => $current};
3569 }
3570 }
3571 } else {
3572 push @{$current->{'contents'}},
3573 { 'text' => $1, 'type' => 'raw', 'parent' => $current };
3574 $self->line_warn(sprintf(__("\@end %s should only appear at the beginning of a line"),
3575 $end_command), $line_nr);
3576 }
3577 # if there is a user defined macro that expandes to spaces, there
3578 # will be a spurious warning.
3579 $self->line_warn(sprintf(
3580 __("superfluous argument to \@%s %s: %s"), 'end', $end_command,
3581 $line), $line_nr)
3582 if ($line =~ /\S/ and $line !~ /^\s*\@c(omment)?\b/);
3583 # store toplevel macro specification
3584 if (($end_command eq 'macro' or $end_command eq 'rmacro')
3585 and (! $current->{'parent'}
3586 or !$current->{'parent'}->{'cmdname'}
3587 or ($current->{'parent'}->{'cmdname'} ne 'macro'
3588 and $current->{'parent'}->{'cmdname'} ne 'rmacro'))) {
3589 my $macrobody =
3590 Texinfo::Convert::Texinfo::convert({ 'contents'
3591 => $current->{'contents'} });
3592 if ($current->{'args'} and $current->{'args'}->[0]) {
3593 my $name = $current->{'args'}->[0]->{'text'};
3594 if (exists($self->{'macros'}->{$name})) {
3595 $self->line_warn(sprintf(__("macro `%s' previously defined"),
3596 $name), $current->{'line_nr'});
3597 $self->line_warn(sprintf(__(
3598 "here is the previous definition of `%s'"),
3599 $name), $self->{'macros'}->{$name}->{'element'}->{'line_nr'});
3600 }
3601 if ($all_commands{$name}) {
3602 $self->line_warn(sprintf(__(
3603 "redefining Texinfo language command: \@%s"),
3604 $name), $current->{'line_nr'});
3605 }
3606 if (!$current->{'extra'}->{'invalid_syntax'}) {
3607 $self->{'macros'}->{$name} = {
3608 'element' => $current,
3609 'macrobody' => $macrobody
3610 };
3611 # Don't need 'args_index' in final tree.
3612 if (defined $current->{'extra'}->{'args_index'}) {
3613 $self->{'macros'}->{$name}->{'args_index'}
3614 = $current->{'extra'}->{'args_index'};
3615 delete $current->{'extra'}->{'args_index'};
3616 }
3617 } elsif (defined $current->{'extra'}->{'args_index'}) {
3618 delete $current->{'extra'}->{'args_index'};
3619 }
3620 }
3621 }
3622 $current = $current->{'parent'};
3623 if ($block_commands{$end_command} eq 'conditional') {
3624 # don't store ignored @if*
3625 my $conditional = pop @{$current->{'contents'}};
3626 if (!defined($conditional->{'cmdname'}
3627 or $conditional->{'cmdname'} ne $end_command)) {
3628 $self->_bug_message("Ignored command is not the conditional $end_command",
3629 $line_nr, $conditional);
3630 die;
3631 }
3632 # Ignore until end of line
3633 if ($line !~ /\n/) {
3634 ($line, $line_nr) = _new_line($self, $line_nr);
3635 print STDERR "IGNORE CLOSE line: $line" if ($self->{'DEBUG'});
3636 }
3637 print STDERR "CLOSED conditional $end_command\n" if ($self->{'DEBUG'});
3638 last;
3639 } else {
3640 print STDERR "CLOSED raw $end_command\n" if ($self->{'DEBUG'});
3641 $line =~ s/^([^\S\r\n]*)//;
3642 # Start an element to have the spaces at the end of the line
3643 # ignored.
3644 push @{$current->{'contents'}},
3645 { 'type' => 'empty_line_after_command',
3646 'text' => $1,
3647 'parent' => $current,
3648 };
3649 }
3650 } else {
3651 if (@{$current->{'contents'}}
3652 and $current->{'contents'}->[-1]->{'type'}
3653 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
3654 and $current->{'contents'}->[-1]->{'text'} !~ /\n/
3655 and $line !~ /\S/) {
3656 $current->{'contents'}->[-1]->{'text'} .= $line;
3657 } else {
3658 push @{$current->{'contents'}},
3659 { 'text' => $line, 'type' => 'raw', 'parent' => $current };
3660 }
3661 last;
3662 }
3663 # in @verb. type should be 'brace_command_arg'
3664 } elsif ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
3665 and $current->{'parent'}->{'cmdname'} eq 'verb') {
3666 # collect the first character if not already done
3667 if (!defined($current->{'parent'}->{'extra'}->{'delimiter'})) {
3668 if ($line =~ /^$/) {
3669 $current->{'parent'}->{'extra'}->{'delimiter'} = '';
3670 $self->line_error(sprintf(
3671 __("\@%s without associated character"), 'verb'), $line_nr);
3672 } else {
3673 $line =~ s/^(.)//;
3674 $current->{'parent'}->{'extra'}->{'delimiter'} = $1;
3675 }
3676 }
3677 my $char = quotemeta($current->{'parent'}->{'extra'}->{'delimiter'});
3678 if ($line =~ s/^(.*?)$char\}/\}/) {
3679 push @{$current->{'contents'}},
3680 { 'text' => $1, 'type' => 'raw', 'parent' => $current }
3681 if ($1 ne '');
3682 print STDERR "END VERB\n" if ($self->{'DEBUG'});
3683 } else {
3684 push @{$current->{'contents'}},
3685 { 'text' => $line, 'type' => 'raw', 'parent' => $current };
3686 print STDERR "LINE VERB: $line" if ($self->{'DEBUG'});
3687 last;
3688 }
3689 }
3690
3691 # this mostly happens in the following cases:
3692 # after expansion of user defined macro that doesn't end with EOL
3693 # after a protection of @\n in @def* line
3694 # at the end of an expanded Texinfo fragment
3695 while ($line eq '') {
3696 print STDERR "EMPTY TEXT\n"
3697 if ($self->{'DEBUG'});
3698 ($line, $line_nr) = _next_text($self, $line_nr);
3699 if (!defined($line)) {
3700 # end of the file or of a text fragment.
3701 $current = _end_line ($self, $current, $line_nr);
3702 # It may happen that there is an @include file on the line, it
3703 # will be picked up at NEXT_LINE, beginning a new line
3704 next NEXT_LINE;
3705 }
3706 }
3707
3708 # handle user defined macros before anything else since
3709 # their expansion may lead to changes in the line
3710 # REMACRO
3711 my $at_command_length;
3712
3713 my ($at_command, $open_brace, $asterisk, $single_letter_command,
3714 $separator_match, $misc_text) = _parse_texi_regex ($line);
3715
3716 if ($at_command) {
3717 $at_command_length = length($at_command) + 1;
3718 }
3719 if ($at_command
3720 and ($self->{'macros'}->{$at_command}
3721 or (exists $self->{'aliases'}->{$at_command} and
3722 $self->{'macros'}->{$self->{'aliases'}->{$at_command}}))) {
3723 substr($line, 0, $at_command_length) = '';
3724 my $command = $at_command;
3725 my $alias_command;
3726 if (exists($self->{'aliases'}->{$command})) {
3727 $alias_command = $command;
3728 $command = $self->{'aliases'}->{$command};
3729 }
3730
3731 my $expanded_macro = $self->{'macros'}->{$command}->{'element'};
3732 my $args_number = scalar(@{$expanded_macro->{'args'}}) -1;
3733 my $arguments = [];
3734 if ($line =~ s/^\s*{\s*//) { # macro with args
3735 ($arguments, $line, $line_nr) =
3736 _expand_macro_arguments($self, $expanded_macro, $line, $line_nr);
3737 } elsif (($args_number >= 2) or ($args_number <1)) {
3738 # as agreed on the bug-texinfo mailing list, no warn when zero
3739 # arg and not called with {}.
3740 $self->line_warn(sprintf(__(
3741 "\@%s defined with zero or more than one argument should be invoked with {}"),
3742 $command), $line_nr)
3743 if ($args_number >= 2);
3744 } else {
3745 if ($line !~ /\n/) {
3746 ($line, $line_nr) = _new_line($self, $line_nr);
3747 $line = '' if (!defined($line));
3748 }
3749 $line =~ s/^\s*// if ($line =~ /\S/);
3750 my $has_end_of_line = chomp $line;
3751 $arguments = [$line];
3752 $line = "\n" if ($has_end_of_line);
3753 }
3754 my $expanded = _expand_macro_body ($self,
3755 $self->{'macros'}->{$command},
3756 $arguments, $line_nr);
3757 print STDERR "MACROBODY: $expanded".'||||||'."\n"
3758 if ($self->{'DEBUG'});
3759 # empty result. It is ignored here.
3760 if ($expanded eq '') {
3761 next;
3762 }
3763 if ($self->{'MAX_MACRO_CALL_NESTING'}
3764 and scalar(@{$self->{'macro_stack'}}) > $self->{'MAX_MACRO_CALL_NESTING'}) {
3765 $self->line_warn(sprintf(__(
3766 "macro call nested too deeply (set MAX_NESTED_MACROS to override; current value %d)"),
3767 $self->{'MAX_MACRO_CALL_NESTING'}), $line_nr);
3768 next;
3769 }
3770 if ($expanded_macro->{'cmdname'} eq 'macro') {
3771 my $found = 0;
3772 foreach my $macro (@{$self->{'macro_stack'}}) {
3773 if ($macro->{'args'}->[0]->{'text'} eq $command) {
3774 $self->line_error(sprintf(__(
3775 "recursive call of macro %s is not allowed; use \@rmacro if needed"),
3776 $command), $line_nr);
3777 $found = 1;
3778 last;
3779 }
3780 }
3781 next if ($found);
3782 }
3783
3784 my $expanded_lines = _text_to_lines($expanded);
3785 next if (!@$expanded_lines);
3786 chomp ($expanded_lines->[-1]);
3787 pop @$expanded_lines if ($expanded_lines->[-1] eq '');
3788 print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
3789 ."|\nEND LINES MACRO EXPANSION\n" if ($self->{'DEBUG'});
3790 next if (!@$expanded_lines);
3791 unshift @{$self->{'macro_stack'}}, $expanded_macro;
3792 print STDERR "UNSHIFT MACRO_STACK: $expanded_macro->{'args'}->[0]->{'text'}\n"
3793 if ($self->{'DEBUG'});
3794 my $new_lines = _complete_line_nr($expanded_lines,
3795 $line_nr->{'line_nr'}, $line_nr->{'file_name'},
3796 $expanded_macro->{'args'}->[0]->{'text'}, 1);
3797 $line_nr->{'end_macro'} = 1;
3798 unshift @{$self->{'input'}->[0]->{'pending'}}, [$line, $line_nr];
3799 my $new_text = shift @$new_lines;
3800 ($line, $line_nr) = ($new_text->[0], $new_text->[1]);
3801 unshift @{$self->{'input'}->[0]->{'pending'}}, @$new_lines;
3802
3803 # Now handle all the cases that may lead to command closing
3804 # or following character association with an @-command, especially
3805 # accent command, that is handle @-command with braces that don't
3806 # always need a brace.
3807
3808 # The condition below is only caught right after command opening,
3809 # otherwise we are in the 'args' and not right in the command container.
3810 } elsif ($current->{'cmdname'}
3811 and defined($brace_commands{$current->{'cmdname'}})
3812 and !$open_brace) {
3813 # special case for @-command as argument of @itemize or @*table.
3814 if (_command_with_command_as_argument($current->{'parent'})) {
3815 print STDERR "FOR PARENT \@$current->{'parent'}->{'parent'}->{'cmdname'} command_as_argument $current->{'cmdname'}\n" if ($self->{'DEBUG'});
3816 $current->{'type'} = 'command_as_argument' if (!$current->{'type'});
3817 $current->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
3818 = $current;
3819 $current = $current->{'parent'};
3820 # now accent commands
3821 } elsif ($accent_commands{$current->{'cmdname'}}) {
3822 if ($line =~ /^[^\S\r\n]/) {
3823 if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
3824 $line =~ s/^([^\S\r\n]+)//;
3825 $current->{'extra'}->{'spaces'} = ''
3826 if (!defined($current->{'extra'}->{'spaces'}));
3827 $current->{'extra'}->{'spaces'} .= $1;
3828 } else {
3829 $self->line_warn(sprintf(
3830 __("accent command `\@%s' must not be followed by whitespace"),
3831 $current->{'cmdname'}), $line_nr);
3832 $current = $current->{'parent'};
3833 }
3834 } elsif ($line =~ /^\@/) {
3835 $self->line_error(sprintf(
3836 __("use braces to give a command as an argument to \@%s"),
3837 $current->{'cmdname'}), $line_nr);
3838 $current = $current->{'parent'};
3839 } elsif ($line =~ s/^(.)//o) {
3840 print STDERR "ACCENT \@$current->{'cmdname'}\n"
3841 if ($self->{'DEBUG'});
3842 my $following_arg = {'type' => 'following_arg',
3843 'parent' => $current};
3844 $following_arg->{'contents'} = [{ 'text' => $1,
3845 'parent' => $following_arg } ];
3846 $current->{'args'} = [ $following_arg ];
3847 if ($current->{'cmdname'} eq 'dotless' and $1 ne 'i' and $1 ne 'j') {
3848 $self->line_error(sprintf(
3849 __("%c%s expects `i' or `j' as argument, not `%s'"),
3850 ord('@'), $current->{'cmdname'}, $1), $line_nr);
3851 }
3852 if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
3853 $current->{'args'}->[-1]->{'type'} = 'space_command_arg';
3854 }
3855 $current = $current->{'parent'};
3856 } else { # The accent is at end of line
3857 # whitespace for commands with letter.
3858 print STDERR "STRANGE ACC \@$current->{'cmdname'}\n" if ($self->{'DEBUG'});
3859 $self->line_warn(sprintf(
3860 __("accent command `\@%s' must not be followed by new line"),
3861 $current->{'cmdname'}), $line_nr);
3862 $current = $current->{'parent'};
3863 }
3864 next;
3865 } else {
3866 # ignore space after a braced @-command like TeX does
3867 if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
3868 and $line =~ s/^\s+//) {
3869 next;
3870 }
3871 $self->line_error(sprintf(__("\@%s expected braces"),
3872 $current->{'cmdname'}), $line_nr);
3873 $current = $current->{'parent'};
3874 }
3875 # maybe a menu entry beginning: a * at the beginning of a menu line
3876 } elsif ($current->{'type'}
3877 and $current->{'type'} eq 'preformatted'
3878 and $current->{'parent'}->{'type'}
3879 and ($current->{'parent'}->{'type'} eq 'menu_comment'
3880 or $current->{'parent'}->{'type'} eq 'menu_entry_description')
3881 and $asterisk
3882 and @{$current->{'contents'}}
3883 and $current->{'contents'}->[-1]->{'type'}
3884 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line'
3885 and $current->{'contents'}->[-1]->{'text'} eq '') {
3886 print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
3887 _abort_empty_line($self, $current);
3888 $line =~ s/^\*//;
3889 push @{$current->{'contents'}}, { 'parent' => $current,
3890 'type' => 'menu_star',
3891 'text' => '*' };
3892 # a space after a * at the beginning of a menu line
3893 } elsif ($current->{'contents'} and @{$current->{'contents'}}
3894 and $current->{'contents'}->[-1]->{'type'}
3895 and $current->{'contents'}->[-1]->{'type'} eq 'menu_star') {
3896 if ($line !~ /^\s+/) {
3897 print STDERR "ABORT MENU STAR ($line)\n" if ($self->{'DEBUG'});
3898 delete $current->{'contents'}->[-1]->{'type'};
3899 } else {
3900 print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
3901 # this is the menu star collected previously
3902 pop @{$current->{'contents'}};
3903 $line =~ s/^(\s+)//;
3904 my $leading_text = '*' . $1;
3905 if ($current->{'type'} eq 'preformatted'
3906 and $current->{'parent'}->{'type'}
3907 and $current->{'parent'}->{'type'} eq 'menu_comment') {
3908 my $menu = $current->{'parent'}->{'parent'};
3909 if (!@{$current->{'contents'}}) {
3910 pop @{$current->{'parent'}->{'contents'}};
3911 if (!scalar(@{$current->{'parent'}->{'contents'}})) {
3912 pop @{$menu->{'contents'}};
3913 }
3914 }
3915 $current = $menu;
3916 } else {
3917 # first parent preformatted, third is menu_entry
3918 if ($current->{'type'} ne 'preformatted'
3919 or $current->{'parent'}->{'type'} ne 'menu_entry_description'
3920 or $current->{'parent'}->{'parent'}->{'type'} ne 'menu_entry'
3921 or !$menu_commands{$current->{'parent'}->{'parent'}->{'parent'}->{'cmdname'}}) {
3922 $self->_bug_message("Not in menu comment nor description",
3923 $line_nr, $current);
3924 }
3925 $current = $current->{'parent'}->{'parent'}->{'parent'};
3926 }
3927 my $context = pop @{$self->{'context_stack'}};
3928 if ($context ne 'preformatted') {
3929 $self->_bug_message("context $context instead of preformatted after menu leading star",
3930 $line_nr, $current);
3931 }
3932 push @{$current->{'contents'}}, { 'type' => 'menu_entry',
3933 'parent' => $current,
3934 };
3935 $current = $current->{'contents'}->[-1];
3936 $current->{'args'} = [ { 'type' => 'menu_entry_leading_text',
3937 'text' => $leading_text,
3938 'parent' => $current },
3939 { 'type' => 'menu_entry_name',
3940 'contents' => [],
3941 'parent' => $current } ];
3942 $current = $current->{'args'}->[-1];
3943 }
3944 # after a separator in menu
3945 } elsif ($current->{'args'} and @{$current->{'args'}}
3946 and $current->{'args'}->[-1]->{'type'}
3947 and $current->{'args'}->[-1]->{'type'} eq 'menu_entry_separator') {
3948 my $separator = $current->{'args'}->[-1]->{'text'};
3949 # separator is ::, we concatenate and let the while restart
3950 # in order to collect spaces below
3951 if ($separator eq ':' and $line =~ s/^(:)//) {
3952 $current->{'args'}->[-1]->{'text'} .= $1;
3953 # a . not followed by a space. Not a separator.
3954 } elsif ($separator eq '.' and $line =~ /^\S/) {
3955 pop @{$current->{'args'}};
3956 $current = $current->{'args'}->[-1];
3957 $current = _merge_text($self, $current, $separator);
3958 # here we collect spaces following separators.
3959 } elsif ($line =~ s/^([^\S\r\n]+)//) {
3960 # FIXME a trailing end of line could be considered to be part
3961 # of the separator. Right now it is part of the description,
3962 # since it is catched (in the next while) as one of the case below
3963 $current->{'args'}->[-1]->{'text'} .= $1;
3964 # now handle the menu part that was closed
3965 } elsif ($separator =~ /^::/) {
3966 print STDERR "MENU NODE no entry $separator\n" if ($self->{'DEBUG'});
3967 # it was previously registered as menu_entry_name, it is
3968 # changed to node
3969 $current->{'args'}->[-2]->{'type'} = 'menu_entry_node';
3970 $current = _enter_menu_entry_node($self, $current, $line_nr);
3971 # end of the menu entry name
3972 } elsif ($separator =~ /^:/) {
3973 print STDERR "MENU ENTRY $separator\n" if ($self->{'DEBUG'});
3974 push @{$current->{'args'}}, { 'type' => 'menu_entry_node',
3975 'contents' => [],
3976 'parent' => $current };
3977 $current = $current->{'args'}->[-1];
3978 # anything else is the end of the menu node following a menu_entry_name
3979 } else {
3980 print STDERR "MENU NODE $separator\n" if ($self->{'DEBUG'});
3981 $current = _enter_menu_entry_node($self, $current, $line_nr);
3982 }
3983 # REMACRO
3984 } elsif ($at_command or $single_letter_command) {
3985 my $command;
3986 if (!$at_command) {
3987 $command = $single_letter_command;
3988 substr($line, 0, 2) = '';
3989 } else {
3990 $command = $at_command;
3991 substr($line, 0, $at_command_length) = '';
3992 }
3993
3994 print STDERR "COMMAND $command\n" if ($self->{'DEBUG'});
3995 if (!$all_commands{$command}
3996 and !$self->{'macros'}->{$command}
3997 and !$self->{'definfoenclose'}->{$command}
3998 and !$self->{'aliases'}->{$command}
3999 and !$self->{'command_index'}->{$command}) {
4000 $self->line_error(sprintf(__("unknown command `%s'"),
4001 $command), $line_nr);
4002 _abort_empty_line($self, $current);
4003 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4004 $current = $paragraph if ($paragraph);
4005 next;
4006 }
4007
4008 my $alias_command;
4009 if (exists($self->{'aliases'}->{$command})) {
4010 $alias_command = $command;
4011 $command = $self->{'aliases'}->{$command};
4012 }
4013
4014 if ($command eq 'value') {
4015 $line =~ s/^\s*//
4016 if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'});
4017 # REVALUE
4018 if ($line =~ s/^{([\w\-][^\s{\\}~`\^+"<>|@]*)}//) {
4019 my $value = $1;
4020 if (exists($self->{'values'}->{$value})) {
4021 if (!defined($self->{'values'}->{$value})) {
4022 print STDERR "BUG? $value exists but not defined\n";
4023 } elsif (!ref($self->{'values'}->{$value})) {
4024 $line = $self->{'values'}->{$value} . $line;
4025 } else {
4026 print STDERR "BUG? $value defined as reference\n";
4027 }
4028 } else {
4029 # Flag not defined. This is an error if it comes from
4030 # a user's document. It is also expected behaviour for
4031 # Texinfo::Report::gdt, where we want to defer substitution
4032 # of the value until after the containing Texinfo is parsed.
4033 _abort_empty_line($self, $current);
4034 # caller should expand something along
4035 # gdt('@{No value for `{value}\'@}', {'value' => $value}, {'keep_texi'=> 1});
4036 push @{$current->{'contents'}}, { 'cmdname' => 'value',
4037 'type' => $value,
4038 'contents' => [],
4039 'parent' => $current };
4040 if (!$self->{'in_gdt'}) {
4041 $self->line_warn(
4042 sprintf(__("undefined flag: %s"), $value), $line_nr);
4043 }
4044 }
4045 } else {
4046 $self->line_error(__("bad syntax for \@value"), $line_nr);
4047 }
4048 next;
4049 }
4050
4051 if (defined($deprecated_commands{$command})) {
4052 if ($deprecated_commands{$command} eq '') {
4053 $self->line_warn(sprintf(__("%c%s is obsolete."),
4054 ord('@'), $command), $line_nr);
4055 } else {
4056 $self->line_warn(sprintf(__("%c%s is obsolete; %s"),
4057 ord('@'), $command,
4058 __($deprecated_commands{$command})), $line_nr);
4059 }
4060 }
4061
4062 # special case with @ followed by a newline protecting end of lines
4063 # in @def*
4064 my $def_line_continuation
4065 = ($self->{'context_stack'}->[-1] eq 'def' and $command eq "\n");
4066
4067 if (not $def_line_continuation
4068 and not _abort_empty_line($self, $current)
4069 and $begin_line_commands{$command}) {
4070 $self->line_warn(
4071 sprintf(__("\@%s should only appear at the beginning of a line"),
4072 $command), $line_nr);
4073 }
4074
4075 _check_valid_nesting ($self, $current, $command, $line_nr);
4076
4077 last if ($def_line_continuation);
4078
4079 unless ($self->{'no_paragraph_commands'}->{$command}) {
4080 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4081 $current = $paragraph if ($paragraph);
4082 }
4083
4084 if ($self->{'close_paragraph_commands'}->{$command}) {
4085 $current = _end_paragraph($self, $current, $line_nr);
4086 }
4087 if ($self->{'close_preformatted_commands'}->{$command}) {
4088 $current = _end_preformatted($self, $current, $line_nr);
4089 }
4090
4091 if (defined($other_commands{$command})
4092 and ($command ne 'item' or !_item_line_parent($current))) {
4093 # noarg skipspace
4094 my $arg_spec = $other_commands{$command};
4095 my $misc;
4096
4097 if ($arg_spec eq 'noarg') {
4098 if ($in_heading_commands{$command}) {
4099 $self->line_error(
4100 sprintf(__("\@%s should only appear in heading or footing"),
4101 $command), $line_nr);
4102 }
4103 $misc = {'cmdname' => $command, 'parent' => $current};
4104 push @{$current->{'contents'}}, $misc;
4105 _register_global_command($self, $misc, $line_nr);
4106 $current = _begin_preformatted($self, $current)
4107 if ($close_preformatted_commands{$command});
4108 } else {
4109 if ($command eq 'item'
4110 or $command eq 'headitem' or $command eq 'tab') {
4111 my $parent;
4112 # @itemize or @enumerate
4113 if ($parent = _item_container_parent($current)) {
4114 if ($command eq 'item') {
4115 print STDERR "ITEM_CONTAINER\n" if ($self->{'DEBUG'});
4116 $parent->{'items_count'}++;
4117 $misc = { 'cmdname' => $command, 'parent' => $parent,
4118 'contents' => [],
4119 'extra' =>
4120 {'item_number' => $parent->{'items_count'}} };
4121 push @{$parent->{'contents'}}, $misc;
4122 $current = $parent->{'contents'}->[-1];
4123 } else {
4124 $self->line_error(sprintf(__(
4125 "\@%s not meaningful inside `\@%s' block"),
4126 $command, $parent->{'cmdname'}), $line_nr);
4127 }
4128 $current = _begin_preformatted($self, $current);
4129 # @*table
4130 } elsif ($parent = _item_line_parent($current)) {
4131 $self->line_error(sprintf(__(
4132 "\@%s not meaningful inside `\@%s' block"),
4133 $command, $parent->{'cmdname'}), $line_nr);
4134 $current = _begin_preformatted($self, $current);
4135 # @multitable
4136 } elsif ($parent = _item_multitable_parent($current)) {
4137 if ($command eq 'item' or $command eq 'headitem'
4138 or $command eq 'tab') {
4139 if (!$parent->{'extra'}->{'max_columns'}) {
4140 $self->line_warn(
4141 sprintf(__("\@%s in empty multitable"),
4142 $command), $line_nr);
4143 } elsif ($command eq 'tab') {
4144 my $row = $parent->{'contents'}->[-1];
4145 die if (!$row->{'type'});
4146 if ($row->{'type'} eq 'before_item') {
4147 $self->line_error(__("\@tab before \@item"), $line_nr);
4148 } elsif ($row->{'cells_count'} >= $parent->{'extra'}->{'max_columns'}) {
4149 $self->line_error(sprintf(__(
4150 "too many columns in multitable item (max %d)"),
4151 $parent->{'extra'}->{'max_columns'}), $line_nr);
4152 } else {
4153 $row->{'cells_count'}++;
4154 $misc = { 'cmdname' => $command,
4155 'parent' => $row,
4156 'contents' => [],
4157 'extra' =>
4158 {'cell_number' => $row->{'cells_count'}} };
4159 push @{$row->{'contents'}}, $misc;
4160 $current = $row->{'contents'}->[-1];
4161 #$current = $self->_begin_preformatted($current);
4162 print STDERR "TAB\n" if ($self->{'DEBUG'});
4163 }
4164 } else {
4165 print STDERR "ROW\n" if ($self->{'DEBUG'});
4166 $parent->{'rows_count'}++;
4167 my $row = { 'type' => 'row', 'contents' => [],
4168 'cells_count' => 1,
4169 'extra' => {'row_number' => $parent->{'rows_count'} },
4170 'parent' => $parent };
4171 push @{$parent->{'contents'}}, $row;
4172 $misc = { 'cmdname' => $command,
4173 'parent' => $row,
4174 'contents' => [],
4175 'extra' => {'cell_number' => 1}};
4176 push @{$row->{'contents'}}, $misc;
4177 $current = $row->{'contents'}->[-1];
4178 }
4179 } else {
4180 $self->line_error(sprintf(__(
4181 "\@%s not meaningful inside `\@%s' block"),
4182 $command, $parent->{'cmdname'}), $line_nr);
4183 }
4184 $current = _begin_preformatted($self, $current);
4185 } elsif ($command eq 'tab') {
4186 $self->line_error(__(
4187 "ignoring \@tab outside of multitable"), $line_nr);
4188 $current = _begin_preformatted($self, $current);
4189 } else {
4190 $self->line_error (sprintf(__(
4191 "\@%s outside of table or list"), $command), $line_nr);
4192 $current = _begin_preformatted($self, $current);
4193 }
4194 $misc->{'line_nr'} = $line_nr if (defined($misc));
4195 } else {
4196 $misc = { 'cmdname' => $command, 'parent' => $current,
4197 'line_nr' => $line_nr };
4198 push @{$current->{'contents'}}, $misc;
4199 }
4200 $line = _start_empty_line_after_command($line, $current, $misc);
4201 if ($command eq 'indent'
4202 or $command eq 'noindent') {
4203 if ($line !~ /\n/) {
4204 my ($new_line, $new_line_nr) = _new_line($self, $line_nr);
4205 $line .= $new_line if (defined($new_line));
4206 }
4207 $line =~ s/^(\s*)//;
4208 if ($1) {
4209 $current = _merge_text($self, $current, $1);
4210 }
4211 if ($line ne ''
4212 and $current->{'contents'}->[-1]->{'type'} eq
4213 'empty_line_after_command') {
4214 $current->{'contents'}->[-1]->{'type'}
4215 = 'empty_spaces_after_command';
4216 }
4217 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4218 $current = $paragraph if $paragraph;
4219 if ($line eq '') {
4220 last;
4221 }
4222 }
4223 }
4224 # line commands
4225 } elsif (defined($self->{'line_commands'}->{$command})) {
4226 if ($root_commands{$command} or $command eq 'bye') {
4227 $current = _close_commands($self, $current, $line_nr, undef,
4228 $command);
4229 # root_level commands leads to setting a new root
4230 # for the whole document and stuffing the preceding text
4231 # as the first content, this is done only once.
4232 if ($current->{'type'} and $current->{'type'} eq 'text_root') {
4233 if ($command ne 'bye') {
4234 $root = { 'type' => 'document_root', 'contents' => [$current] };
4235 $current->{'parent'} = $root;
4236 $current = $root;
4237 }
4238 } else {
4239 die if (!defined($current->{'parent'}));
4240 $current = $current->{'parent'};
4241 }
4242 }
4243
4244 # skipline text line lineraw /^\d$/
4245 my $arg_spec = $self->{'line_commands'}->{$command};
4246 my $misc;
4247
4248 # all the cases using the raw line
4249 if ($arg_spec eq 'skipline' or $arg_spec eq 'lineraw'
4250 or $arg_spec eq 'special') {
4251 my $ignored = 0;
4252 if ($command eq 'insertcopying') {
4253 my $parent = $current;
4254 while ($parent) {
4255 if ($parent->{'cmdname'} and $parent->{'cmdname'} eq 'copying') {
4256 $self->line_error(
4257 sprintf(__("\@%s not allowed inside `\@%s' block"),
4258 $command, $parent->{'cmdname'}), $line_nr);
4259 $ignored = 1;
4260 last;
4261 }
4262 $parent = $parent->{'parent'};
4263 }
4264 }
4265
4266 # complete the line if there was a user macro expansion
4267 if ($line !~ /\n/) {
4268 my ($new_line, $new_line_nr) = _new_line($self, $line_nr);
4269 $line .= $new_line if (defined($new_line));
4270 }
4271 $misc = {'cmdname' => $command,
4272 'parent' => $current};
4273 my $args = [];
4274 my $has_comment;
4275 if ($arg_spec eq 'lineraw' or $arg_spec eq 'skipline') {
4276 $args = [ $line ];
4277 } elsif ($arg_spec eq 'special') {
4278 ($args, $has_comment)
4279 = _parse_special_misc_command($self, $line, $command, $line_nr);
4280 $misc->{'extra'}->{'arg_line'} = $line;
4281 }
4282
4283 # if using the @set txi* instead of a proper @-command, replace
4284 # by the tree obtained with the @-command. Even though
4285 # _end_line is called below, as $current is not line_arg
4286 # there should not be anything done in addition than what is
4287 # done for @clear or @set.
4288 if (($command eq 'set' or $command eq 'clear')
4289 and scalar(@$args) >= 1
4290 and $set_flag_command_equivalent{$args->[0]}) {
4291 my $arg;
4292 if ($command eq 'set') {
4293 $arg = 'on';
4294 } else {
4295 $arg = 'off';
4296 }
4297 $command = $set_flag_command_equivalent{$args->[0]};
4298 $misc = {'cmdname' => $command,
4299 'parent' => $current,
4300 'line_nr' => $line_nr,
4301 'extra' => {'misc_args' => [$arg]}};
4302 my $misc_line_args = {'type' => 'line_arg',
4303 'parent' => $misc};
4304 $misc->{'args'} = [$misc_line_args];
4305 $misc->{'extra'}->{'spaces_before_argument'} = ' ';
4306 $misc_line_args->{'contents'} = [
4307 { 'text' => $arg,
4308 'parent' => $misc_line_args, },
4309 { 'text' => "\n",
4310 'parent' => $misc_line_args,
4311 'type' => 'spaces_at_end', } ];
4312 push @{$current->{'contents'}}, $misc;
4313 } else {
4314 if (!$ignored) {
4315 push @{$current->{'contents'}}, $misc;
4316 foreach my $arg (@$args) {
4317 push @{$misc->{'args'}},
4318 { 'type' => 'misc_arg', 'text' => $arg,
4319 'parent' => $current->{'contents'}->[-1] };
4320 }
4321 $misc->{'extra'}->{'misc_args'} = $args
4322 if (scalar(@$args) and $arg_spec ne 'skipline');
4323 } else {
4324 $misc = undef;
4325 }
4326 }
4327 if ($command eq 'raisesections') {
4328 $self->{'sections_level'}++;
4329 } elsif ($command eq 'lowersections') {
4330 $self->{'sections_level'}--;
4331 } elsif ($command eq 'novalidate') {
4332 $self->{'info'}->{'novalidate'} = 1;
4333 }
4334 _register_global_command($self, $misc, $line_nr)
4335 if $misc;
4336 # the end of line is ignored for special commands
4337 if ($arg_spec ne 'special' or !$has_comment) {
4338 $current = _end_line($self, $current, $line_nr);
4339 }
4340
4341 last NEXT_LINE if ($command eq 'bye');
4342 # Even if _end_line is called, it is not done since there is
4343 # no line_arg
4344 $current = _begin_preformatted($self, $current)
4345 if ($close_preformatted_commands{$command});
4346 last;
4347 } else {
4348 # $arg_spec is text, line or a number
4349 # @item or @itemx in @table
4350 if ($command eq 'item' or $command eq 'itemx') {
4351 my $parent;
4352 print STDERR "ITEM_LINE\n" if ($self->{'DEBUG'});
4353 if ($parent = _item_line_parent($current)) {
4354 $current = $parent;
4355 _gather_previous_item($self, $current, $command, $line_nr);
4356 } else {
4357 $self->line_error (sprintf(__(
4358 "\@%s outside of table or list"), $command), $line_nr);
4359 $current = _begin_preformatted($self, $current);
4360 }
4361 $misc = { 'cmdname' => $command, 'parent' => $current };
4362 push @{$current->{'contents'}}, $misc;
4363 $misc->{'line_nr'} = $line_nr;
4364 } else {
4365 $misc = { 'cmdname' => $command, 'parent' => $current,
4366 'line_nr' => $line_nr };
4367 push @{$current->{'contents'}}, $misc;
4368 if ($sectioning_commands{$command}) {
4369 if ($self->{'sections_level'}) {
4370 $current->{'contents'}->[-1]->{'extra'}->{'sections_level'}
4371 = $self->{'sections_level'};
4372 }
4373 }
4374 if ($root_commands{$command}) {
4375 $misc->{'contents'} = [];
4376 }
4377 # def*x
4378 if ($def_commands{$command}) {
4379 my $base_command = $command;
4380 $base_command =~ s/x$//;
4381 # check that the def*x is first after @def*, no paragraph
4382 # in-between.
4383 my $after_paragraph = _check_no_text($current);
4384 push @{$self->{'context_stack'}}, 'def';
4385 $current->{'contents'}->[-1]->{'type'} = 'def_line';
4386 $current->{'contents'}->[-1]->{'extra'} =
4387 {'def_command' => $base_command,
4388 'original_def_cmdname' => $command};
4389 if ($current->{'cmdname'}
4390 and $current->{'cmdname'} eq $base_command) {
4391 pop @{$current->{'contents'}};
4392 _gather_def_item($current, $command);
4393 push @{$current->{'contents'}}, $misc;
4394 }
4395 if (!$current->{'cmdname'}
4396 or $current->{'cmdname'} ne $base_command
4397 or $after_paragraph) {
4398 $self->line_error(sprintf(__(
4399 "must be after `\@%s' to use `\@%s'"),
4400 $base_command, $command), $line_nr);
4401 $current->{'contents'}->[-1]->{'extra'}->{'not_after_command'} = 1;
4402 }
4403 }
4404 }
4405 $current = $current->{'contents'}->[-1];
4406 $current->{'args'} = [{ 'type' => 'line_arg',
4407 'contents' => [],
4408 'parent' => $current }];
4409 # @node is the only misc command with args separated with comma
4410 # FIXME a 3 lingering here deep into the code may not
4411 # be very wise... However having a hash only for one @-command
4412 # is not very appealing either...
4413 if ($command eq 'node') {
4414 $current->{'remaining_args'} = 3;
4415 } elsif ($command eq 'author') {
4416 my $parent = $current;
4417 my $found;
4418 while ($parent->{'parent'}) {
4419 $parent = $parent->{'parent'};
4420 last if ($parent->{'type'}
4421 and $parent->{'type'} eq 'brace_command_context');
4422 if ($parent->{'cmdname'}) {
4423 if ($parent->{'cmdname'} eq 'titlepage') {
4424 $current->{'extra'}->{'titlepage'} = $parent;
4425 $found = 1;
4426 } elsif ($parent->{'cmdname'} eq 'quotation' or
4427 $parent->{'cmdname'} eq 'smallquotation') {
4428 push @{$parent->{'extra'}->{'authors'}}, $current;
4429 $current->{'extra'}->{'quotation'} = $parent;
4430 $found = 1;
4431 }
4432 last if ($found);
4433 }
4434 }
4435 if (!$found) {
4436 $self->line_warn(sprintf(__(
4437 "\@%s not meaningful outside `\@titlepage' and `\@quotation' environments"),
4438 $command), $current->{'line_nr'});
4439 }
4440 } elsif ($command eq 'dircategory' and $self->{'current_node'}) {
4441 $self->line_warn(__("\@dircategory after first node"),
4442 $line_nr);
4443 }
4444
4445 $current = $current->{'args'}->[-1];
4446 push @{$self->{'context_stack'}}, 'line'
4447 unless ($def_commands{$command});
4448 $line = _start_empty_line_after_command($line, $current, $misc);
4449 }
4450 _register_global_command($self, $misc, $line_nr)
4451 if $misc;
4452 if ($command eq 'dircategory') {
4453 push @{$self->{'info'}->{'dircategory_direntry'}}, $misc;
4454 }
4455 # @-command with matching @end opening
4456 } elsif (exists($block_commands{$command})) {
4457 if ($command eq 'macro' or $command eq 'rmacro') {
4458 my $macro = _parse_macro_command_line($self, $command, $line,
4459 $current, $line_nr);
4460 push @{$current->{'contents'}}, $macro;
4461 $current = $current->{'contents'}->[-1];
4462 last;
4463 } elsif ($block_commands{$command} eq 'conditional') {
4464 my $ifvalue_true = 0;
4465 if ($command eq 'ifclear' or $command eq 'ifset') {
4466 # REVALUE
4467 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
4468 my $name = $1;
4469 if ((exists($self->{'values'}->{$name}) and $command eq 'ifset')
4470 or (!exists($self->{'values'}->{$name})
4471 and $command eq 'ifclear')) {
4472 $ifvalue_true = 1;
4473 }
4474 print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n" if ($self->{'DEBUG'});
4475 } elsif ($line !~ /\S/) {
4476 $self->line_error(sprintf(
4477 __("%c%s requires a name"), ord('@'), $command), $line_nr);
4478 } else {
4479 $self->line_error(sprintf(
4480 __("bad name for \@%s"), $command), $line_nr);
4481 }
4482 } elsif ($command eq 'ifcommanddefined'
4483 or $command eq 'ifcommandnotdefined') {
4484 # REMACRO
4485 if ($line =~ /^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
4486 my $name = $1;
4487 my $command_is_defined = (
4488 exists($Texinfo::Common::all_commands{$name})
4489 or $self->{'macros'}->{$name}
4490 or $self->{'definfoenclose'}->{$name}
4491 or $self->{'aliases'}->{$name}
4492 or $self->{'command_index'}->{$name}
4493 );
4494 if (($command_is_defined
4495 and $command eq 'ifcommanddefined')
4496 or (! $command_is_defined
4497 and $command eq 'ifcommandnotdefined')) {
4498 $ifvalue_true = 1;
4499 }
4500 print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n" if ($self->{'DEBUG'});
4501 } elsif ($line !~ /\S/) {
4502 $self->line_error(sprintf(
4503 __("%c%s requires a name"), ord('@'), $command), $line_nr);
4504 } else {
4505 $self->line_error(sprintf(
4506 __("bad name for \@%s"), $command), $line_nr);
4507 }
4508 } elsif ($command =~ /^ifnot(.*)/) {
4509 $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1}
4510 # exception as explained in the texinfo manual
4511 or ($1 eq 'info'
4512 and $self->{'expanded_formats_hash'}->{'plaintext'}));
4513 print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n" if ($self->{'DEBUG'});
4514 } else {
4515 die unless ($command =~ /^if(.*)/);
4516 $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
4517 or ($1 eq 'info'
4518 and $self->{'expanded_formats_hash'}->{'plaintext'}));
4519 print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n" if ($self->{'DEBUG'});
4520 }
4521 if ($ifvalue_true) {
4522 push @{$self->{'conditionals_stack'}}, $command;
4523 } else {
4524 push @{$current->{'contents'}}, { 'cmdname' => $command,
4525 'parent' => $current,
4526 'contents' => [] };
4527 $current = $current->{'contents'}->[-1];
4528 }
4529 # FIXME(Karl) ignore what is remaining on the line, to eat
4530 # the end of line?
4531 last;
4532 } else {
4533 my $block;
4534 # a menu command closes a menu_comment, but not the other
4535 # block commands. This won't catch menu commands buried in
4536 # other formats (that are incorrect anyway).
4537 if ($menu_commands{$command} and $current->{'type'}
4538 and ($current->{'type'} eq 'menu_comment'
4539 or $current->{'type'} eq 'menu_entry_description')) {
4540
4541 my $menu;
4542
4543 $menu = $current->{'parent'};
4544 pop @{$menu->{'contents'}}
4545 if (!@{$current->{'contents'}});
4546
4547 my $context = pop @{$self->{'context_stack'}};
4548 if ($context ne 'preformatted') {
4549 $self->_bug_message("context $context instead of preformatted in new menu",
4550 $line_nr, $current);
4551 }
4552
4553 if ($menu->{'type'} and $menu->{'type'} eq 'menu_entry') {
4554 $menu = $menu->{'parent'};
4555 }
4556
4557 $current = $menu;
4558 }
4559 # the def command holds a line_def* which corresponds with the
4560 # definition line. This allows to have a treatement similar
4561 # with def*x.
4562 if ($def_commands{$command}) {
4563 push @{$self->{'context_stack'}}, 'def';
4564 $block = { 'parent' => $current,
4565 'cmdname' => $command,
4566 'contents' => [] };
4567 push @{$current->{'contents'}}, $block;
4568 $current = $current->{'contents'}->[-1];
4569 push @{$current->{'contents'}}, {
4570 'type' => 'def_line',
4571 'parent' => $current,
4572 'line_nr' => $line_nr,
4573 'extra' =>
4574 {'def_command' => $command,
4575 'original_def_cmdname' => $command}
4576 };
4577 } else {
4578 $block = { 'cmdname' => $command,
4579 'parent' => $current,
4580 'contents' => [] };
4581 push @{$current->{'contents'}}, $block;
4582 }
4583 $current = $current->{'contents'}->[-1];
4584
4585 if ($block_arg_commands{$command}) {
4586 if ($preformatted_commands{$command}) {
4587 push @{$self->{'context_stack'}}, 'preformatted';
4588 } elsif ($format_raw_commands{$command}) {
4589 push @{$self->{'context_stack'}}, 'rawpreformatted';
4590 if (not $self->{'expanded_formats_hash'}->{$command}) {
4591 push @{$current->{'contents'}}, {
4592 'parent' => $current,
4593 'type' => 'elided_block',
4594 'contents' => []
4595 };
4596 while (not $line =~ /^\s*\@end\s+$command/) {
4597 ($line, $line_nr) = _new_line($self, $line_nr);
4598 if (!$line) {
4599 # unclosed block
4600 $line = '';
4601 last;
4602 }
4603 }
4604 push @{$current->{'contents'}},
4605 { 'type' => 'empty_line_after_command',
4606 'text' => "\n",
4607 'parent' => $current };
4608 push @{$current->{'contents'}}, { 'type' => 'empty_line',
4609 'text' => '',
4610 'parent' => $current };
4611 next;
4612 }
4613 }
4614 if ($region_commands{$command}) {
4615 if (@{$self->{'regions_stack'}}) {
4616 $self->line_error(
4617 sprintf(__("region %s inside region %s is not allowed"),
4618 $command, $self->{'regions_stack'}->[-1]->{'cmdname'}),
4619 $line_nr);
4620 }
4621 push @{$self->{'regions_stack'}}, $block;
4622 }
4623 if ($menu_commands{$command}) {
4624 if ($self->{'context_stack'}->[-1] eq 'preformatted') {
4625 push @{$self->{'context_stack'}}, 'preformatted';
4626 } else {
4627 push @{$self->{'context_stack'}}, 'menu';
4628 }
4629 push @{$self->{'info'}->{'dircategory_direntry'}}, $block
4630 if ($command eq 'direntry');
4631 if ($self->{'current_node'}) {
4632 if ($command eq 'direntry') {
4633 if ($self->{'SHOW_MENU'}) {
4634 $self->line_warn(__("\@direntry after first node"),
4635 $line_nr);
4636 }
4637 } elsif ($command eq 'menu') {
4638 if (!(defined $current->{'parent'}->{'cmdname'})
4639 or $root_commands{$current->{'parent'}->{'cmdname'}}) {
4640 push @{$self->{'current_node'}->{'menus'}}, $current;
4641 } else {
4642 $self->line_warn(__("\@menu in invalid context"),
4643 $line_nr);
4644 }
4645 }
4646 } elsif ($command ne 'direntry') {
4647 if ($self->{'SHOW_MENU'}) {
4648 $self->line_error(sprintf(__("\@%s seen before first \@node"),
4649 $command), $line_nr);
4650 $self->line_error(__(
4651 "perhaps your \@top node should be wrapped in \@ifnottex rather than \@ifinfo?"),
4652 $line_nr);
4653 }
4654 }
4655 }
4656 $current->{'args'} = [ {
4657 'type' => 'block_line_arg',
4658 'contents' => [],
4659 'parent' => $current } ];
4660
4661 $current->{'remaining_args'} = $block_commands{$command} -1
4662 if ($block_commands{$command} =~ /^\d+$/
4663 and $block_commands{$command} -1 > 0);
4664 $current = $current->{'args'}->[-1];
4665 push @{$self->{'context_stack'}}, 'line'
4666 unless ($def_commands{$command});
4667 }
4668 $block->{'line_nr'} = $line_nr;
4669 _register_global_command($self, $block, $line_nr);
4670
4671 $line = _start_empty_line_after_command($line, $current, $block);
4672 }
4673 } elsif (defined($brace_commands{$command})) {
4674 push @{$current->{'contents'}}, { 'cmdname' => $command,
4675 'parent' => $current,
4676 'contents' => [] };
4677 $current->{'contents'}->[-1]->{'line_nr'} = $line_nr
4678 if ($keep_line_nr_brace_commands{$command}
4679 and !$self->{'definfoenclose'}->{$command});
4680
4681 if ($in_index_commands{$command}
4682 and (!$current->{'parent'}->{'cmdname'}
4683 or !$self->{'command_index'}
4684 ->{$current->{'parent'}->{'cmdname'}})) {
4685 $self->line_warn(
4686 sprintf(__("\@%s should only appear in an index entry"),
4687 $command), $line_nr);
4688 }
4689
4690 $current = $current->{'contents'}->[-1];
4691 if ($command eq 'click') {
4692 $current->{'extra'}->{'clickstyle'} = $self->{'clickstyle'};
4693 } elsif ($command eq 'kbd') {
4694 if ($self->{'context_stack'}->[-1] eq 'preformatted'
4695 and $self->{'kbdinputstyle'} ne 'distinct') {
4696 $current->{'extra'}->{'code'} = 1;
4697 } elsif ($self->{'kbdinputstyle'} eq 'code'
4698 or ($self->{'kbdinputstyle'} eq 'example'
4699 and $self->_in_code($current->{'parent'}))) {
4700 $current->{'extra'}->{'code'} = 1;
4701 }
4702 }
4703 if ($self->{'definfoenclose'}->{$command}) {
4704 $current->{'type'} = 'definfoenclose_command';
4705 $current->{'extra'}->{'begin'} =
4706 $self->{'definfoenclose'}->{$command}->[0];
4707 $current->{'extra'}->{'end'} =
4708 $self->{'definfoenclose'}->{$command}->[1];
4709 }
4710 } elsif (exists ($no_brace_commands{$command})) {
4711 push @{$current->{'contents'}},
4712 { 'cmdname' => $command, 'parent' => $current };
4713 # FIXME generalize?
4714 if ($command eq '\\' and $self->{'context_stack'}->[-1] ne 'math') {
4715 $self->line_warn(sprintf(__("\@%s should only appear in math context"),
4716 $command), $line_nr);
4717 }
4718 if ($command eq "\n") {
4719 $current = _end_line($self, $current, $line_nr);
4720 last;
4721 }
4722 }
4723 } elsif ($separator_match) {
4724 my $separator = $separator_match;
4725 substr ($line, 0, 1) = '';
4726 print STDERR "SEPARATOR: $separator\n" if ($self->{'DEBUG'});
4727 if ($separator eq '@') {
4728 # this may happen with a @ at the very end of a file, therefore
4729 # not followed by anything.
4730 $self->line_error(__("unexpected \@"), $line_nr);
4731 } elsif ($separator eq '{') {
4732 _abort_empty_line($self, $current);
4733 if ($current->{'cmdname'}
4734 and defined($brace_commands{$current->{'cmdname'}})) {
4735 my $command = $current->{'cmdname'};
4736 $current->{'args'} = [ { 'parent' => $current,
4737 'contents' => [] } ];
4738
4739 if ($brace_commands{$command}
4740 and $brace_commands{$command} =~ /^\d$/
4741 and $brace_commands{$command} > 1) {
4742 $current->{'remaining_args'} = $brace_commands{$command} - 1;
4743 }
4744
4745 $current = $current->{'args'}->[-1];
4746 if ($context_brace_commands{$command}) {
4747 if ($command eq 'caption' or $command eq 'shortcaption') {
4748 my $float;
4749 if (!$current->{'parent'}->{'parent'}
4750 or !$current->{'parent'}->{'parent'}->{'cmdname'}
4751 or $current->{'parent'}->{'parent'}->{'cmdname'} ne 'float') {
4752 $float = $current->{'parent'};
4753 while ($float->{'parent'} and !($float->{'cmdname'}
4754 and $float->{'cmdname'} eq 'float')) {
4755 $float = $float->{'parent'};
4756 }
4757 if (!($float->{'cmdname'} and $float->{'cmdname'} eq 'float')) {
4758 $self->line_error(sprintf(__(
4759 "\@%s is not meaningful outside `\@float' environment"),
4760 $command), $line_nr);
4761 $float = undef;
4762 } else {
4763 $self->line_warn(sprintf(__(
4764 "\@%s should be right below `\@float'"),
4765 $command), $line_nr);
4766 }
4767 } else {
4768 $float = $current->{'parent'}->{'parent'};
4769 }
4770 if ($float) {
4771 if ($float->{'extra'}->{$command}) {
4772 $self->line_warn(sprintf(__("ignoring multiple \@%s"),
4773 $command), $line_nr);
4774 } else {
4775 $current->{'parent'}->{'extra'}->{'float'} = $float;
4776 $float->{'extra'}->{$command} = $current->{'parent'};
4777 }
4778 }
4779 }
4780 push @{$self->{'context_stack'}}, $command;
4781 $line =~ s/([^\S\f\n]*)//;
4782 $current->{'type'} = 'brace_command_context';
4783 push @{$current->{'contents'}}, { 'type' => 'empty_spaces_before_argument',
4784 'text' => $1,
4785 'parent' => $current,
4786 'extra' => {'command' => $current->{'parent'}}
4787 };
4788 } else {
4789 $current->{'type'} = 'brace_command_arg';
4790 if ($brace_commands{$command}
4791 and $brace_commands{$command} =~ /^\d$/
4792 and $brace_commands{$command} > 0) {
4793 push @{$current->{'contents'}},
4794 {'type' => 'empty_spaces_before_argument',
4795 'text' => '',
4796 'parent' => $current,
4797 'extra' => {'command' => $current}
4798 };
4799 }
4800 push @{$self->{'context_stack'}}, $command
4801 if ($command eq 'inlineraw');
4802 }
4803 print STDERR "OPENED \@$current->{'parent'}->{'cmdname'}, remaining: "
4804 .(defined($current->{'parent'}->{'remaining_args'}) ? "remaining: $current->{'parent'}->{'remaining_args'}, " : '')
4805 .($current->{'type'} ? "type: $current->{'type'}" : '')."\n"
4806 if ($self->{'DEBUG'});
4807 } elsif ($current->{'parent'}
4808 and (($current->{'parent'}->{'cmdname'}
4809 and $current->{'parent'}->{'cmdname'} eq 'multitable')
4810 or ($current->{'parent'}->{'type'}
4811 and $current->{'parent'}->{'type'} eq 'def_line'))) {
4812 push @{$current->{'contents'}},
4813 { 'type' => 'bracketed', 'contents' => [],
4814 'parent' => $current };
4815 $current = $current->{'contents'}->[-1];
4816 # we need the line number here in case @ protects end of line
4817 $current->{'line_nr'} = $line_nr
4818 if ($current->{'parent'}->{'parent'}->{'type'}
4819 and $current->{'parent'}->{'parent'}->{'type'} eq 'def_line');
4820 push @{$current->{'contents'}},
4821 {'type' => 'empty_spaces_before_argument',
4822 'text' => '',
4823 'parent' => $current,
4824 'extra' => {'command' => $current}
4825 };
4826 print STDERR "BRACKETED in def/multitable\n" if ($self->{'DEBUG'});
4827 # lone braces accepted right in a rawpreformatted
4828 } elsif ($current->{'type'}
4829 and $current->{'type'} eq 'rawpreformatted') {
4830 push @{$current->{'contents'}}, {'text' => '{',
4831 'parent' => $current };
4832 # matching braces accepted in a rawpreformatted or math or ignored
4833 # code
4834 } elsif ($self->{'context_stack'}->[-1] eq 'math'
4835 or $self->{'context_stack'}->[-1] eq 'rawpreformatted'
4836 or $self->{'context_stack'}->[-1] eq 'inlineraw') {
4837 push @{$current->{'contents'}},
4838 { 'type' => 'bracketed', 'contents' => [],
4839 'parent' => $current, 'line_nr' => $line_nr };
4840 $current = $current->{'contents'}->[-1];
4841 print STDERR "BRACKETED in math\n" if ($self->{'DEBUG'});
4842 } else {
4843 $self->line_error(sprintf(__("misplaced %c"),
4844 ord('{')), $line_nr);
4845 }
4846
4847 } elsif ($separator eq '}') {
4848 _abort_empty_line($self, $current);
4849 if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
4850 $current = $current->{'parent'};
4851 # the following will not happen for footnote if there is
4852 # a paragraph withing the footnote
4853 } elsif ($current->{'parent'}
4854 and $current->{'parent'}->{'cmdname'}
4855 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}) {
4856 # for math and footnote out of paragraph
4857 if ($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
4858 my $context_command = pop @{$self->{'context_stack'}};
4859 if ($context_command ne $current->{'parent'}->{'cmdname'}) {
4860 $self->_bug_message("context $context_command instead of brace command $current->{'parent'}->{'cmdname'}",
4861 $line_nr, $current);
4862 die;
4863 }
4864 }
4865 # first is the arg.
4866
4867 if ($brace_commands{$current->{'parent'}->{'cmdname'}}
4868 and $brace_commands{$current->{'parent'}{'cmdname'}} =~ /^\d$/
4869 and $brace_commands{$current->{'parent'}->{'cmdname'}} > 0
4870 and $current->{'parent'}->{'cmdname'} ne 'math') {
4871 # @inline* always have end spaces considered as normal text
4872 _isolate_last_space($self, $current)
4873 unless ($inline_commands{$current->{'parent'}->{'cmdname'}});
4874 }
4875 my $closed_command = $current->{'parent'}->{'cmdname'};
4876 print STDERR "CLOSING(brace) \@$current->{'parent'}->{'cmdname'}\n"
4877 if ($self->{'DEBUG'});
4878 delete $current->{'parent'}->{'remaining_args'};
4879 if (defined($brace_commands{$closed_command})
4880 and $brace_commands{$closed_command} eq '0'
4881 and @{$current->{'contents'}}) {
4882 $self->line_warn(sprintf(__(
4883 "command \@%s does not accept arguments"),
4884 $closed_command), $line_nr);
4885 }
4886 if ($current->{'parent'}->{'cmdname'} eq 'anchor') {
4887 $current->{'parent'}->{'line_nr'} = $line_nr;
4888 my $parsed_anchor = _parse_node_manual($current);
4889 if (_check_node_label($self, $parsed_anchor,
4890 $current->{'parent'}->{'cmdname'}, $line_nr)) {
4891 _register_label($self, $current->{'parent'}, $parsed_anchor);
4892 if (@{$self->{'regions_stack'}}) {
4893 $current->{'extra'}->{'region'} = $self->{'regions_stack'}->[-1];
4894 }
4895 }
4896 } elsif ($ref_commands{$current->{'parent'}->{'cmdname'}}) {
4897 my $ref = $current->{'parent'};
4898 if (@{$ref->{'args'}}) {
4899 my @args;
4900 for $a (@{$ref->{'args'}}) {
4901 if (@{$a->{'contents'}}) {
4902 push @args, $a->{'contents'};
4903 } else {
4904 push @args, undef;
4905 }
4906 }
4907 if (($closed_command eq 'inforef'
4908 and !defined($args[0]) and !defined($args[2]))
4909 or ($closed_command ne 'inforef'
4910 and !defined($args[0]) and !defined($args[3])
4911 and !defined($args[4]))) {
4912 $self->line_warn(sprintf(__(
4913 "command \@%s missing a node or external manual argument"),
4914 $closed_command), $line_nr);
4915 } else {
4916 my $parsed_ref_node = _parse_node_manual($ref->{'args'}->[0]);
4917 if (defined $parsed_ref_node) {
4918 if ($closed_command ne 'inforef'
4919 and !defined($args[3]) and !defined($args[4])
4920 and !$parsed_ref_node->{'manual_content'}) {
4921 push @{$self->{'internal_references'}}, $ref;
4922 }
4923 $ref->{'extra'}->{'node_argument'} = $parsed_ref_node
4924 }
4925 }
4926 if (defined($args[1])) {
4927 my $normalized_cross_ref_name =
4928 Texinfo::Convert::NodeNameNormalization::normalize_node(
4929 {'contents' => $args[1]});
4930 if ($normalized_cross_ref_name !~ /[^-]/) {
4931 $self->line_warn(sprintf(__(
4932 "in \@%s empty cross reference name after expansion `%s'"),
4933 $closed_command,
4934 Texinfo::Convert::Texinfo::convert({'contents' => $args[1]})),
4935 $line_nr);
4936 }
4937 }
4938 if ($closed_command ne 'inforef' and defined($args[2])) {
4939 my $normalized_cross_ref_title =
4940 Texinfo::Convert::NodeNameNormalization::normalize_node({'contents' => $args[2]});
4941 if ($normalized_cross_ref_title !~ /[^-]/) {
4942 $self->line_warn(sprintf(__(
4943 "in \@%s empty cross reference title after expansion `%s'"),
4944 $closed_command,
4945 Texinfo::Convert::Texinfo::convert({'contents' => $args[2]})),
4946 $line_nr);
4947 }
4948 }
4949 }
4950 } elsif ($current->{'parent'}->{'cmdname'} eq 'image') {
4951 my $image = $current->{'parent'};
4952 if (!@{$image->{'args'}}
4953 or !defined($image->{'args'}->[0])
4954 or scalar(@{$image->{'args'}->[0]->{'contents'}}) == 0) {
4955 $self->line_error(
4956 __("\@image missing filename argument"), $line_nr);
4957 }
4958 $image->{'extra'}->{'input_perl_encoding'}
4959 = $self->{'INPUT_PERL_ENCODING'}
4960 if defined $self->{'INPUT_PERL_ENCODING'};
4961 } elsif($current->{'parent'}->{'cmdname'} eq 'dotless') {
4962 my $dotless = $current->{'parent'};
4963 if (@{$current->{'contents'}}) {
4964 my $text = $current->{'contents'}->[0]->{'text'};
4965 if (!defined ($text)
4966 or ($text ne 'i' and $text ne 'j')) {
4967 $self->line_error(sprintf(
4968 __("%c%s expects `i' or `j' as argument, not `%s'"),
4969 ord('@'), $dotless->{'cmdname'},
4970 Texinfo::Convert::Texinfo::convert($current)), $line_nr);
4971 }
4972 }
4973 } elsif ($explained_commands{$current->{'parent'}->{'cmdname'}}
4974 or $inline_commands{$current->{'parent'}->{'cmdname'}}) {
4975 my $current_command = $current->{'parent'};
4976 if ($inline_commands{$current_command->{'cmdname'}}) {
4977 if ($current_command->{'cmdname'} eq 'inlineraw') {
4978 my $context_command = pop @{$self->{'context_stack'}};
4979 if ($context_command ne $current_command->{'cmdname'}) {
4980 $self->_bug_message("context $context_command instead of inlineraw $current_command->{'cmdname'}",
4981 $line_nr, $current);
4982 die;
4983 }
4984 }
4985 }
4986 if (!@{$current_command->{'args'}}
4987 or !defined($current_command->{'args'}->[0])
4988 or scalar(@{$current_command->{'args'}->[0]->{'contents'}}) == 0) {
4989 $self->line_warn(
4990 sprintf(__("\@%s missing first argument"),
4991 $current_command->{'cmdname'}), $line_nr);
4992 }
4993 } elsif ($current->{'parent'}->{'cmdname'} eq 'errormsg') {
4994 my $error_message_text = $current->{'contents'}->[0]->{'text'};
4995 $self->line_error($error_message_text, $line_nr)
4996 if $error_message_text;
4997 } elsif ($current->{'parent'}->{'cmdname'} eq 'U') {
4998 my $arg;
4999 if ($current->{'contents'}->[0]) {
5000 $arg = $current->{'contents'}->[0]->{'text'};
5001 }
5002 if (!defined($arg) || !$arg) {
5003 $self->line_warn(__("no argument specified for \@U"),
5004 $line_nr);
5005
5006 } elsif ($arg !~ /^[0-9A-Fa-f]+$/) {
5007 $self->line_error(
5008 sprintf(__("non-hex digits in argument for \@U: %s"), $arg),
5009 $line_nr);
5010
5011 } elsif (length ($arg) < 4) {
5012 # Perl doesn't mind, but too much trouble to do in TeX.
5013 $self->line_warn(sprintf(__("fewer than four hex digits in argument for \@U: %s"), $arg),
5014 $line_nr);
5015
5016 } else {
5017 # we don't want to call hex at all if the value isn't
5018 # going to fit; so first use eval to check.
5019 # Since integer overflow is only a warning, have to make
5020 # warnings fatal for the eval to be effective.
5021 eval qq!use warnings FATAL => qw(all); hex("$arg")!;
5022 if ($@) {
5023 # leave clue in case something else went wrong.
5024 warn "\@U hex($arg) eval failed: $@\n" if ($self->{'DEBUG'});
5025 # argument likely exceeds size of integer
5026 }
5027 # ok, value can be given to hex(), so try it.
5028 if ($@ or hex($arg) > 0x10FFFF) {
5029 $self->line_error(
5030 sprintf(__("argument for \@U exceeds Unicode maximum 0x10FFFF: %s"),
5031 $arg),
5032 $line_nr);
5033 }
5034 }
5035
5036 } elsif (_command_with_command_as_argument($current->{'parent'}->{'parent'})
5037 and scalar(@{$current->{'contents'}}) == 0) {
5038 print STDERR "FOR PARENT \@$current->{'parent'}->{'parent'}->{'parent'}->{'cmdname'} command_as_argument braces $current->{'cmdname'}\n" if ($self->{'DEBUG'});
5039 $current->{'parent'}->{'type'} = 'command_as_argument'
5040 if (!$current->{'parent'}->{'type'});
5041 $current->{'parent'}->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
5042 = $current->{'parent'};
5043 } elsif ($current->{'parent'}->{'cmdname'} eq 'sortas') {
5044 my @contents = @{$current->{'contents'}};
5045 my $arg = $current->{'contents'}->[0]->{'text'};
5046 if (defined($arg)) {
5047 my $index_element = $current->{'parent'}->{'parent'}->{'parent'};
5048 if ($index_element and $index_element->{'cmdname'}
5049 and $self->{'command_index'}->{$index_element->{'cmdname'}}) {
5050 $index_element->{'extra'}->{'sortas'} = $arg;
5051 }
5052 }
5053 }
5054 _register_global_command($self, $current->{'parent'}, $line_nr);
5055 if ($command_ignore_space_after{$current->{'parent'}->{'cmdname'}}) {
5056 push @{$current->{'parent'}->{'parent'}->{'contents'}},
5057 {'type' => 'empty_spaces_after_close_brace',
5058 'text' => '',
5059 'parent' => $current->{'parent'}->{'parent'}
5060 };
5061 }
5062 $current = $current->{'parent'}->{'parent'};
5063 $current = _begin_preformatted ($self, $current)
5064 if ($close_preformatted_commands{$closed_command});
5065 # lone braces accepted right in a rawpreformatted
5066 } elsif ($current->{'type'}
5067 and $current->{'type'} eq 'rawpreformatted') {
5068 push @{$current->{'contents'}}, {'text' => '}',
5069 'parent' => $current };
5070 # footnote caption closing, when there is a paragraph inside.
5071 } elsif ($context_brace_commands{$self->{'context_stack'}->[-1]}) {
5072 # closing the context under broader situations
5073 $current = _end_paragraph($self, $current, $line_nr);
5074 if ($current->{'parent'}
5075 and $current->{'parent'}->{'cmdname'}
5076 and $context_brace_commands{$current->{'parent'}->{'cmdname'}}
5077 and $current->{'parent'}->{'cmdname'} eq $self->{'context_stack'}->[-1]) {
5078 my $context_command = pop @{$self->{'context_stack'}};
5079 if ($context_command ne $current->{'parent'}->{'cmdname'}) {
5080 $self->_bug_message("context $context_command instead of brace isolated $current->{'parent'}->{'cmdname'}",
5081 $line_nr, $current);
5082 die;
5083 }
5084 print STDERR "CLOSING(context command) \@$current->{'parent'}->{'cmdname'}\n" if ($self->{'DEBUG'});
5085 my $closed_command = $current->{'parent'}->{'cmdname'};
5086 _register_global_command($self, $current->{'parent'}, $line_nr);
5087 $current = $current->{'parent'}->{'parent'};
5088 $current = _begin_preformatted ($self, $current)
5089 if ($close_preformatted_commands{$closed_command});
5090 }
5091 } else {
5092 $self->line_error(sprintf(__("misplaced %c"),
5093 ord('}')), $line_nr);
5094 }
5095 } elsif ($separator eq ','
5096 and $current->{'parent'}->{'remaining_args'}) {
5097 _abort_empty_line ($self, $current);
5098 _isolate_last_space($self, $current);
5099 my $type = $current->{'type'};
5100 $current = $current->{'parent'};
5101 if ($inline_commands{$current->{'cmdname'}}) {
5102 my $expandp = 0;
5103 if (! $current->{'extra'}->{'format'}) {
5104 my $inline_type;
5105 if (defined $current->{'args'}->[0]
5106 and @{$current->{'args'}->[0]->{'contents'}}) {
5107 $inline_type = $current->{'args'}->[0]->{'contents'}->[0]->{'text'};
5108 }
5109
5110 if (!$inline_type) {
5111 # condition is missing for some reason
5112 print STDERR "INLINE COND MISSING\n"
5113 if ($self->{'DEBUG'});
5114 } elsif ($inline_format_commands{$current->{'cmdname'}}) {
5115 if ($self->{'expanded_formats_hash'}->{$inline_type}) {
5116 $expandp = 1;
5117 $current->{'extra'}->{'expand_index'} = 1;
5118 } else {
5119 $expandp = 0;
5120 }
5121 } elsif (($current->{'cmdname'} eq 'inlineifset'
5122 and exists($self->{'values'}->{$inline_type}))
5123 or ($current->{'cmdname'} eq 'inlineifclear'
5124 and ! exists($self->{'values'}->{$inline_type}))) {
5125 $expandp = 1;
5126 $current->{'extra'}->{'expand_index'} = 1;
5127 } else {
5128 $expandp = 0;
5129 }
5130 $current->{'extra'}->{'format'} = $inline_type;
5131
5132 # Skip first argument for a false @inlinefmtifelse
5133 if (!$expandp and $current->{'cmdname'} eq 'inlinefmtifelse') {
5134 $current->{'extra'}->{'expand_index'} = 2;
5135
5136 # Add a dummy argument for the first argument.
5137 push @{$current->{'args'}}, {'type' => 'elided',
5138 'parent' => $current,
5139 'contents' => []};
5140
5141 # Scan forward to get the next argument.
5142 my $brace_count = 1;
5143 while ($brace_count > 0) {
5144 # Forward to next comma or brace
5145 if ($line =~ s/[^{,}]*([,{}])//) {
5146 if ($1 eq ',' and $brace_count == 1) {
5147 last;
5148 } elsif ($1 eq '{') {
5149 $brace_count++;
5150 } elsif ($1 eq '}') {
5151 $brace_count--;
5152 }
5153 } else {
5154 my $new_text;
5155 ($new_text, $line_nr) = _next_text($self, $line_nr);
5156 if (!$new_text) {
5157 next NEXT_LINE; # error - unbalanced brace
5158 }
5159 $line .= $new_text;
5160 }
5161 }
5162 if ($brace_count == 0) {
5163 # second arg missing
5164 $line = '}' . $line;
5165 }
5166 $current->{'remaining_args'}--;
5167 $expandp = 1;
5168 }
5169 } elsif ($current->{'cmdname'} eq 'inlinefmtifelse') {
5170 # Second arg of @inlinefmtifelse when condition is true.
5171 # Discard second argument.
5172 $expandp = 0;
5173 }
5174 # If this command is not being expanded, add a dummy argument,
5175 # and scan forward to the closing brace.
5176 if (!$expandp) {
5177 push @{$current->{'args'}}, {'type' => 'elided',
5178 'parent' => $current,
5179 'contents' => []};
5180 my $brace_count = 1;
5181 while ($brace_count > 0) {
5182 if ($line =~ s/[^{}]*([{}])//) {
5183 if ($1 eq '{') {
5184 $brace_count++;
5185 } else {
5186 $brace_count--;
5187 }
5188 } else {
5189 my $new_text;
5190 ($new_text, $line_nr) = _next_text($self, $line_nr);
5191 if (!$new_text) {
5192 next NEXT_LINE; # error - unbalanced brace
5193 }
5194 $line .= $new_text;
5195 }
5196 }
5197 $current = $current->{'args'}->[-1];
5198 $line = '}' . $line;
5199 next;
5200 }
5201 }
5202 $current->{'remaining_args'}--;
5203 push @{$current->{'args'}},
5204 { 'type' => $type, 'parent' => $current, 'contents' => [] };
5205 $current = $current->{'args'}->[-1];
5206 push @{$current->{'contents'}},
5207 {'type' => 'empty_spaces_before_argument',
5208 'text' => '',
5209 'parent' => $current,
5210 'extra' => {'command' => $current}
5211 };
5212 } elsif ($separator eq ',' and $current->{'type'}
5213 and $current->{'type'} eq 'line_arg'
5214 and $current->{'parent'}->{'cmdname'}
5215 and $current->{'parent'}->{'cmdname'} eq 'node') {
5216 $self->line_warn(__("superfluous arguments for node"), $line_nr);
5217 # end of menu node (. must be followed by a space to stop the node).
5218 } elsif (($separator =~ /[,\t.]/ and $current->{'type'}
5219 and $current->{'type'} eq 'menu_entry_node')
5220 or ($separator eq ':' and $current->{'type'}
5221 and $current->{'type'} eq 'menu_entry_name')) {
5222 $current = $current->{'parent'};
5223 push @{$current->{'args'}}, { 'type' => 'menu_entry_separator',
5224 'text' => $separator,
5225 'parent' => $current };
5226 } elsif ($separator eq "\f" and $current->{'type'}
5227 and $current->{'type'} eq 'paragraph') {
5228 # form feed stops and restart a paragraph.
5229 $current = $self->_end_paragraph($current);
5230 push @{$current->{'contents'}}, {'text' => $separator,
5231 'type' => 'empty_line',
5232 'parent' => $current };
5233 push @{$current->{'contents'}}, { 'type' => 'empty_line',
5234 'text' => '',
5235 'parent' => $current };
5236
5237 } else {
5238 $current = _merge_text($self, $current, $separator);
5239 }
5240 # Misc text except end of line
5241 } elsif (defined $misc_text) {
5242 my $new_text = $misc_text;
5243 substr ($line, 0, length ($misc_text)) = '';
5244 $current = _merge_text($self, $current, $new_text);
5245 # end of line
5246 } else {
5247 print STDERR "END LINE: ". _print_current($current)."\n"
5248 if ($self->{'DEBUG'});
5249 if ($line =~ s/^(\n)//) {
5250 $current = _merge_text($self, $current, $1);
5251 } else {
5252 if (scalar(@{$self->{'input'}})) {
5253 $self->_bug_message("Text remaining without normal text but `$line'",
5254 $line_nr, $current);
5255 die;
5256 }
5257 }
5258 $current = _end_line($self, $current, $line_nr);
5259 last;
5260 }
5261 }
5262 }
5263 while (@{$self->{'conditionals_stack'}}) {
5264 my $end_conditional = pop @{$self->{'conditionals_stack'}};
5265 $self->line_error(sprintf(__("expected \@end %s"), $end_conditional),
5266 $line_nr);
5267 }
5268 $current = _close_commands($self, $current, $line_nr);
5269
5270 if (@{$self->{'context_stack'}} != 1) {
5271 # This happens in 2 cases in the tests:
5272 # @verb not closed on misc commands line
5273 # def line escaped with @ ending the file
5274 if ($self->{'DEBUG'}) {
5275 print STDERR "CONTEXT_STACK no empty end _parse_texi: ".join('|', @{$self->{'context_stack'}})."\n";
5276 }
5277 @{$self->{'context_stack'}} = ('_root');
5278 }
5279
5280 # Call 'labels_information' to initialize labels.
5281 my $labels = labels_information($self);
5282 Texinfo::Common::complete_indices($self);
5283 return $root;
5284 }
5285
5286 # parse special line @-commands, unmacro, set, clear, clickstyle.
5287 # Also remove spaces or ignore text, as specified in the line_commands hash.
5288 sub _parse_special_misc_command($$$$)
5289 {
5290 my ($self, $line, $command, $line_nr) = @_;
5291
5292 my $args = [];
5293
5294 my $has_comment = 0;
5295 my $remaining;
5296 if ($command eq 'set') {
5297 # REVALUE
5298 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)(\@(c|comment)((\@|\s+).*)?|\s+(.*?))?\s*$/) {
5299 if ($line =~ s/\@(c|comment)((\@|\s+).*)?$//) {
5300 $has_comment = 1;
5301 }
5302 $line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)(\s+(.*?))?\s*$/;
5303 my $name = $1;
5304 my $arg = $3;
5305 $arg = '' if (!defined($arg));
5306 $args = [$name, $arg];
5307 $self->{'values'}->{$name} = $arg;
5308 } elsif ($line !~ /\S/) {
5309 $self->line_error(sprintf(
5310 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5311 } else {
5312 $self->line_error(sprintf(
5313 __("bad name for \@%s"), $command), $line_nr);
5314 }
5315 } elsif ($command eq 'clear') {
5316 # REVALUE
5317 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
5318 $args = [$1];
5319 delete $self->{'values'}->{$1};
5320 $has_comment = 1 if (defined($3));
5321 } elsif ($line !~ /\S/) {
5322 $self->line_error(sprintf(
5323 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5324 } else {
5325 $self->line_error(sprintf(
5326 __("bad name for \@%s"), $command), $line_nr);
5327 }
5328 } elsif ($command eq 'unmacro') {
5329 # REMACRO
5330 if ($line =~ /^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
5331 $args = [$1];
5332 delete $self->{'macros'}->{$1};
5333 $has_comment = 1 if (defined($3));
5334 print STDERR "UNMACRO $1\n" if ($self->{'DEBUG'});
5335 } elsif ($line !~ /\S/) {
5336 $self->line_error(sprintf(
5337 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5338 } else {
5339 $self->line_error(sprintf(
5340 __("bad name for \@%s"), $command), $line_nr);
5341 }
5342 } elsif ($command eq 'clickstyle') {
5343 # REMACRO
5344 if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*/) {
5345 $args = ['@'.$1];
5346 $self->{'clickstyle'} = $1;
5347 $remaining = $line;
5348 $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
5349 $has_comment = 1 if (defined($4));
5350 } else {
5351 $self->line_error (sprintf(__(
5352 "\@%s should only accept an \@-command as argument, not `%s'"),
5353 $command, $line), $line_nr);
5354 }
5355 } else {
5356 die $self->_bug_message("Unknown special command $command", $line_nr);
5357 }
5358 if (defined($remaining)) {
5359 chomp($remaining);
5360 if ($remaining ne '') {
5361 $self->line_warn(sprintf(__(
5362 "remaining argument on \@%s line: %s"),
5363 $command, $remaining), $line_nr);
5364 }
5365 }
5366 return ($args, $has_comment);
5367 }
5368
5369 # at the end of an @-command line with arguments, parse the resulting
5370 # text, to collect aliases, definfoenclose and collect errors on
5371 # wrong arguments.
5372 sub _parse_line_command_args($$$)
5373 {
5374 my ($self, $line_command, $line_nr) = @_;
5375
5376 my $args;
5377
5378 my $command = $line_command->{'cmdname'};
5379 my $arg = $line_command->{'args'}->[0];
5380
5381 if ($self->{'DEBUG'}) {
5382 print STDERR "MISC ARGS \@$command\n";
5383 if (@{$arg->{'contents'}}) {
5384 my $idx = 0;
5385 foreach my $content (@{$arg->{'contents'}}) {
5386 my $name = '';
5387 $name = '@' . $content->{'cmdname'} if ($content->{'cmdname'});
5388 my $type = ', t: ';
5389 $type .= $content->{'type'} if ($content->{'type'});
5390 my $text = ', ';
5391 $type .= $content->{'text'} if ($content->{'text'});
5392 print STDERR " -> $idx $name $type $text\n";
5393 $idx++;
5394 }
5395 }
5396 }
5397
5398 if (!$arg->{'contents'} or !@{$arg->{'contents'}}) {
5399 $self->_command_error($line_command, $line_nr,
5400 __("\@%s missing argument"), $command);
5401 $line_command->{'extra'}->{'missing_argument'} = 1;
5402 return undef;
5403 }
5404
5405 if (@{$arg->{'contents'}} > 1
5406 or (!defined($arg->{'contents'}->[0]->{'text'}))) {
5407 $self->line_error (sprintf(__("superfluous argument to \@%s"),
5408 $command), $line_nr);
5409 }
5410 return undef if (!defined($arg->{'contents'}->[0]->{'text'}));
5411
5412 my $line = $arg->{'contents'}->[0]->{'text'};
5413
5414 if ($command eq 'alias') {
5415 # REMACRO
5416 if ($line =~ s/^([[:alnum:]][[:alnum:]-]*)(\s*=\s*)([[:alnum:]][[:alnum:]-]*)$//) {
5417 my $new_command = $1;
5418 my $existing_command = $3;
5419 $args = [$1, $3];
5420 $self->{'aliases'}->{$new_command} = $existing_command;
5421 if (exists($block_commands{$existing_command})) {
5422 $self->line_warn(sprintf(
5423 __("environment command %s as argument to \@%s"),
5424 $existing_command, $command), $line_nr);
5425 }
5426 } else {
5427 $self->line_error(sprintf(
5428 __("bad argument to \@%s"), $command), $line_nr);
5429 }
5430
5431 } elsif ($command eq 'definfoenclose') {
5432 # REMACRO
5433 if ($line =~ s/^([[:alnum:]][[:alnum:]\-]*)\s*,\s*([^\s,]*)\s*,\s*([^\s,]*)$//) {
5434 $args = [$1, $2, $3 ];
5435 $self->{'definfoenclose'}->{$1} = [ $2, $3 ];
5436 print STDERR "DEFINFOENCLOSE \@$1: $2, $3\n" if ($self->{'DEBUG'});
5437
5438 $brace_commands{$1} = 'style';
5439
5440 # Warning: there is a risk of mixing of data between a built-in
5441 # command and a user command defined with @definfoenclose.
5442 # %keep_line_nr_brace_commands is one example of this.
5443 } else {
5444 $self->line_error(sprintf(
5445 __("bad argument to \@%s"), $command), $line_nr);
5446 }
5447 } elsif ($command eq 'columnfractions') {
5448 my @possible_fractions = split (/\s+/, $line);
5449 if (!@possible_fractions) {
5450 $self->line_error (sprintf(__("empty \@%s"), $command),
5451 $line_nr);
5452 } else {
5453 foreach my $fraction (@possible_fractions) {
5454 if ($fraction =~ /^\d*\.\d+$|^\d+\.?$/) {
5455 push @$args, $fraction;
5456 } else {
5457 $self->line_error (sprintf(
5458 __("column fraction not a number: %s"),
5459 $fraction), $line_nr);
5460 }
5461 }
5462 }
5463 } elsif ($command eq 'sp') {
5464 if ($line =~ /^([0-9]+)$/) {
5465 $args = [$1];
5466 } else {
5467 $self->line_error(sprintf(__("\@sp arg must be numeric, not `%s'"),
5468 $line), $line_nr);
5469 }
5470 } elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
5471 # REMACRO
5472 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
5473 my $name = $1;
5474 if ($forbidden_index_name{$name}) {
5475 $self->line_error(sprintf(
5476 __("reserved index name %s"),$name), $line_nr);
5477 } else {
5478 my $in_code = 0;
5479 $in_code = 1 if ($command eq 'defcodeindex');
5480 $args = [$name];
5481 $self->{'index_names'}->{$name} = {'in_code' => $in_code};
5482 if (!exists($self->{'index_names'}->{$name}->{'name'})) {
5483 $self->{'index_names'}->{$name}->{'name'} = $name;
5484 }
5485 if (!exists($self->{'index_names'}->{$name}->{'contained_indices'})) {
5486 $self->{'index_names'}->{$name}->{'contained_indices'}->{$name} = 1;
5487 }
5488 $self->{'line_commands'}->{$name.'index'} = 'line';
5489 $self->{'no_paragraph_commands'}->{$name.'index'} = 1;
5490 $self->{'valid_nestings'}->{$name.'index'} = \%in_simple_text_commands;
5491 $self->{'command_index'}->{$name.'index'} = $name;
5492 }
5493 } else {
5494 $self->line_error(sprintf(
5495 __("bad argument to \@%s: %s"), $command, $line), $line_nr);
5496 }
5497 } elsif ($command eq 'synindex' || $command eq 'syncodeindex') {
5498 # REMACRO
5499 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)\s+([[:alnum:]][[:alnum:]\-]*)$/) {
5500 my $index_from = $1;
5501 my $index_to = $2;
5502 $self->line_error(sprintf(__("unknown source index in \@%s: %s"),
5503 $command, $index_from), $line_nr)
5504 unless $self->{'index_names'}->{$index_from};
5505 $self->line_error(sprintf(__("unknown destination index in \@%s: %s"),
5506 $command, $index_to), $line_nr)
5507 unless $self->{'index_names'}->{$index_to};
5508 if ($self->{'index_names'}->{$index_from}
5509 and $self->{'index_names'}->{$index_to}) {
5510 my $current_to = $index_to;
5511 # find the merged indices recursively avoiding loops
5512 while ($current_to ne $index_from
5513 and $self->{'merged_indices'}->{$current_to}) {
5514 $current_to = $self->{'merged_indices'}->{$current_to};
5515 }
5516 if ($current_to ne $index_from) {
5517 my $index_from_info = $self->{'index_names'}->{$index_from};
5518 my $index_to_info = $self->{'index_names'}->{$current_to};
5519
5520 my $in_code = 0;
5521 $in_code = 1 if ($command eq 'syncodeindex');
5522 $self->{'merged_indices'}->{$index_from} = $current_to;
5523 $index_from_info->{'in_code'} = $in_code;
5524 foreach my $contained_index (keys %{$index_from_info->{'contained_indices'}}) {
5525 $index_to_info->{'contained_indices'}->{$contained_index} = 1;
5526 $self->{'index_names'}->{$contained_index}->{'merged_in'} = $current_to;
5527 $self->{'merged_indices'}->{$contained_index} = $current_to;
5528 }
5529 delete $index_from_info->{'contained_indices'};
5530 $index_from_info->{'merged_in'} = $current_to;
5531 $index_to_info->{'contained_indices'}->{$index_from} = 1;
5532 $args = [$index_from, $index_to];
5533 } else {
5534 $self->line_warn(sprintf(__(
5535 "\@%s leads to a merging of %s in itself, ignoring"),
5536 $command, $index_from), $line_nr);
5537 }
5538 }
5539 } else {
5540 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5541 $command, $line), $line_nr);
5542 }
5543 } elsif ($command eq 'printindex') {
5544 # REMACRO
5545 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
5546 my $name = $1;
5547 if (!exists($self->{'index_names'}->{$name})) {
5548 $self->line_error(sprintf(__("unknown index `%s' in \@printindex"),
5549 $name), $line_nr);
5550
5551 } else {
5552 if ($self->{'merged_indices'}->{$name}) {
5553 $self->line_warn(sprintf(__(
5554 "printing an index `%s' merged in another one, `%s'"),
5555 $name, $self->{'merged_indices'}->{$name}),
5556 $line_nr);
5557 }
5558 if (!defined($self->{'current_node'})
5559 and !defined($self->{'current_section'})
5560 and !scalar(@{$self->{'regions_stack'}})) {
5561 $self->line_warn(sprintf(__(
5562 "printindex before document beginning: \@printindex %s"),
5563 $name), $line_nr);
5564 }
5565 $args = [$name];
5566 }
5567 } else {
5568 $self->line_error(sprintf(
5569 __("bad argument to \@%s: %s"), $command, $line), $line_nr);
5570 }
5571 } elsif (grep {$_ eq $command} ('everyheadingmarks', 'everyfootingmarks',
5572 'evenheadingmarks', 'oddheadingmarks',
5573 'evenfootingmarks', 'oddfootingmarks')) {
5574 if ($line eq 'top' or $line eq 'bottom') {
5575 $args = [$line];
5576 } else {
5577 $self->line_error(sprintf(__(
5578 "\@%s arg must be `top' or `bottom', not `%s'"),
5579 $command, $line), $line_nr);
5580 }
5581 } elsif ($command eq 'fonttextsize') {
5582 if ($line eq '10' or $line eq '11') {
5583 $args = [$line];
5584 } else {
5585 $self->line_error(sprintf(__(
5586 "Only \@%s 10 or 11 is supported, not `%s'"),
5587 $command, $line), $line_nr);
5588 }
5589 } elsif ($command eq 'footnotestyle') {
5590 if ($line eq 'separate' or $line eq 'end') {
5591 $args = [$line];
5592 } else {
5593 $self->line_error(sprintf(__(
5594 "\@%s arg must be `separate' or `end', not `%s'"),
5595 $command, $line), $line_nr);
5596 }
5597 } elsif ($command eq 'setchapternewpage') {
5598 if ($line eq 'on' or $line eq 'off' or $line eq 'odd') {
5599 $args = [$1];
5600 } else {
5601 $self->line_error(sprintf(__(
5602 "\@%s arg must be `on', `off' or `odd', not `%s'"),
5603 $command, $line), $line_nr);
5604 }
5605 } elsif ($command eq 'need') { # only a warning
5606 if (($line =~ /^([0-9]+(\.[0-9]*)?)$/) or
5607 ($line =~ /^(\.[0-9]+)$/)) {
5608 $args = [$1];
5609 } else {
5610 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5611 $command, $line), $line_nr);
5612 }
5613 } elsif ($command eq 'paragraphindent') {
5614 if ($line =~ /^([\w\-]+)$/) {
5615 my $value = $1;
5616 if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq 'asis') {
5617 $args = [$1];
5618 } else {
5619 $self->line_error(sprintf(__(
5620 "\@paragraphindent arg must be numeric/`none'/`asis', not `%s'"),
5621 $value), $line_nr);
5622 }
5623 } else {
5624 $self->line_error(sprintf(__(
5625 "\@paragraphindent arg must be numeric/`none'/`asis', not `%s'"),
5626 $line), $line_nr);
5627 }
5628 } elsif ($command eq 'firstparagraphindent') {
5629 if ($line eq 'none' or $line eq 'insert') {
5630 $args = [$line];
5631 } else {
5632 $self->line_error(sprintf(__(
5633 "\@firstparagraphindent arg must be `none' or `insert', not `%s'"),
5634 $line), $line_nr);
5635 }
5636 } elsif ($command eq 'exampleindent') {
5637 if ($line =~ /^([0-9]+)$/) {
5638 $args = [$1];
5639 } elsif ($line =~ /^(asis)$/) {
5640 $args = [$1];
5641 } else {
5642 $self->line_error(sprintf(__(
5643 "\@exampleindent arg must be numeric/`asis', not `%s'"),
5644 $line), $line_nr);
5645 }
5646 } elsif ($command eq 'frenchspacing'
5647 or $command eq 'xrefautomaticsectiontitle'
5648 or $command eq 'codequoteundirected'
5649 or $command eq 'codequotebacktick'
5650 or $command eq 'validatemenus'
5651 or $command eq 'deftypefnnewline') {
5652 if ($line eq 'on' or $line eq 'off') {
5653 $args = [$line];
5654 } else {
5655 $self->line_error(sprintf(__("expected \@%s on or off, not `%s'"),
5656 $command, $line), $line_nr);
5657 }
5658 } elsif ($command eq 'kbdinputstyle') {
5659 if ($line eq 'code' or $line eq 'example' or $line eq 'distinct') {
5660 $self->{'kbdinputstyle'} = $line;
5661 $args = [$line];
5662 } else {
5663 $self->line_error(sprintf(__(
5664 "\@kbdinputstyle arg must be `code'/`example'/`distinct', not `%s'"),
5665 $line), $line_nr);
5666 }
5667 } elsif ($command eq 'allowcodebreaks') {
5668 if ($line eq 'true' or $line eq 'false') {
5669 $args = [$line];
5670 } else {
5671 $self->line_error(sprintf(__(
5672 "\@allowcodebreaks arg must be `true' or `false', not `%s'"),
5673 $line), $line_nr);
5674 }
5675 } elsif ($command eq 'urefbreakstyle') {
5676 if ($line eq 'after' or $line eq 'before' or $line eq 'none') {
5677 $args = [$line];
5678 } else {
5679 $self->line_error(sprintf(__(
5680 "\@urefbreakstyle arg must be `after'/`before'/`none', not `%s'"),
5681 $line), $line_nr);
5682 }
5683 } elsif ($command eq 'headings') {
5684 if ($line eq 'off' or $line eq 'on' or $line eq 'single'
5685 or $line eq 'double' or $line eq 'singleafter' or $line eq 'doubleafter') {
5686 $args = [$line];
5687 } else {
5688 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5689 $command, $line), $line_nr);
5690 }
5691 }
5692 return $args;
5693 }
0 # This file is for use by pod2texi.
1 use Texinfo::ParserNonXS;
56942
56953 1;
5696 __END__
5697 =head1 NAME
5698
5699 Texinfo::Parser - Parse Texinfo code into a Perl tree
5700
5701 =head1 SYNOPSIS
5702
5703 use Texinfo::Parser;
5704 my $parser = Texinfo::Parser::parser();
5705 my $tree = $parser->parse_texi_file("somefile.texi");
5706 my ($errors, $errors_count) = $parser->errors();
5707 foreach my $error_message (@$errors) {
5708 warn $error_message->{'error_line'};
5709 }
5710
5711 my $index_names = $parser->indices_information();
5712 my $float_types_arrays = $parser->floats_information();
5713 my $internal_references_array
5714 = $parser->internal_references_information();
5715 # An hash reference on normalized node/float/anchor names
5716 my $labels_information = $parser->labels_information();
5717 # A hash reference, keys are @-command names, value is an
5718 # array reference holding all the corresponding @-commands.
5719 my $global_commands_information = $parser->global_commands_information();
5720 # a hash reference on some document informations (encodings,
5721 # input file name, dircategory and direntry list, for exampel).
5722 my $global_informations = $parser->global_informations();
5723
5724 =head1 DESCRIPTION
5725
5726 Texinfo::Parser will parse Texinfo text into a perl tree. In one pass
5727 it expands user-defined @-commands, conditionals (@ifset, @ifinfo...)
5728 and @value and constructs the tree. Some extra information is gathered
5729 while doing the tree: for example, the block command associated with @end,
5730 the number of rows in a multitable, or the node associated with a section.
5731
5732
5733
5734 =head1 METHODS
5735
5736 No method is exported in the default case. The module allows both
5737 an object-oriented syntax, or traditional function, with the parser
5738 as an opaque data structure given as an argument to every function.
5739
5740 =head2 Initialization
5741
5742 The following method is used to construct a new C<Texinfo::Parser> object:
5743
5744 =over
5745
5746 =item $parser = Texinfo::Parser::parser($options);
5747
5748 This method creates a new parser. The options may be provided as a hash
5749 reference. There are two types of option. The first type of option
5750 change the way the parser behaves; they are described right here. The
5751 other type of option allows giving the parser some information as if
5752 it came from texinfo code; for example, allow setting aliases (as with
5753 C<@alias>), values (as with C<@set>), or merged indices (as with
5754 C<@synindex>). These options are described below in L</Texinfo Parser options>.
5755
5756 =over
5757
5758 =item expanded_formats
5759
5760 An array reference of the output formats for which C<@ifI<FORMAT>>
5761 conditional blocks should be expanded. Default is empty.
5762
5763 =item include_directories
5764
5765 An array reference of directories in which C<@include> files should be
5766 searched for. Default contains the working directory, F<.>.
5767
5768 =item IGNORE_BEFORE_SETFILENAME
5769
5770 If set, and C<@setfilename> exists, everything before C<@setfilename>
5771 is put in a special container type, @C<preamble_before_setfilename>.
5772 This option is set in the default case.
5773
5774 =item IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME
5775
5776 If set, spaces after an @-command name that take braces are ignored.
5777 Default on.
5778
5779 =item MAX_MACRO_CALL_NESTING
5780
5781 Maximal number of nested user-defined macro calls. Default is 100000.
5782
5783 =item SHOW_MENU
5784
5785 If false, no menu-related errors are reported. Default is true.
5786
5787 =begin :comment
5788
5789 Used by Sectioning only
5790 =item TOP_NODE_UP
5791
5792 Text for the up node of the Top node. The default is C<(dir)>. The
5793 string may contain @-commands.
5794
5795 =end :comment
5796
5797 =back
5798
5799 =back
5800
5801 =head2 Parsing Texinfo text
5802
5803 There are three methods that may be called to parse some Texinfo code:
5804 C<parse_texi_line> for a line, C<parse_texi_text> for a text fragment,
5805 and C<parse_texi_file> for a file.
5806
5807 For all those functions, if the I<$parser> argument is undef, a new
5808 parser object is generated to parse the line. Otherwise the parser given
5809 as an argument is used to parse into a tree.
5810
5811 When C<parse_texi_text> is used, the resulting tree is rooted at
5812 a C<root_line> type container. Otherwise, the resulting tree should be
5813 rooted at a C<text_root> type container if it does not contain nodes or
5814 sections, at a C<document_root> type container otherwise.
5815
5816 =over
5817
5818 =item $tree = parse_texi_line($parser, $text, $first_line_number, $file_name, $macro_name, $fixed_line_number)
5819
5820 This function is used to parse a short fragment of Texinfo code.
5821
5822 I<$text> may be either an array reference of lines, or a text.
5823
5824 The other arguments are optional and allow specifying the position
5825 information of the Texinfo code. I<$first_line_number> is the line number
5826 of the first text line. I<$file_name> is the name of the file the
5827 text comes from. I<$macro> is for the user-defined macro name the text
5828 is expanded from. If I<$fixed_line_number> is set, the line number is
5829 not increased for the different lines, as if the text was the expansion
5830 of a macro.
5831
5832 =item $tree = parse_texi_text ($parser, $text, $line_numbers_specification, $file_name, $macro_name, $fixed_line_number)
5833
5834 This function is used to parse some Texinfo text.
5835
5836 I<$text> may be either an array reference of lines, or a text.
5837
5838 The other arguments are optional and allow specifying the position
5839 information of the Texinfo code. There are two distinct cases for
5840 I<$line_numbers_specification>.
5841
5842 =over
5843
5844 =item 1.
5845
5846 If it is an array reference, it is considered to hold objects describing
5847 the position information of each text line.
5848
5849 =item 2.
5850
5851 If I<$line_numbers_specification> is a scalar, it is the line number of
5852 the first text line. In that case (like for C<parse_texi_text>),
5853 I<$file_name> is the name of the file the text comes from.
5854 and I<$macro> is for the user-defined macro name the text
5855 is expanded from. If I<$fixed_line_number> is set, the line number is
5856 not increased for the different lines, as if the text was the expansion
5857 of a macro.
5858
5859 =back
5860
5861 =item $tree = parse_texi_file($parser, $file_name)
5862
5863 The file with name I<$file_name> is considered to be a Texinfo file and
5864 is parsed into a tree.
5865
5866 undef is returned if the file couldn't be read.
5867
5868 =back
5869
5870 The errors collected during the tree parsing are available through the
5871 C<errors> method. This method comes from C<Texinfo::Report>, and is
5872 described in L<errors|Texinfo::Report/($error_warnings_list, $error_count) = errors ($converter)>.
5873
5874 =head2 Getting information on the document
5875
5876 After parsing some information about the Texinfo code that was processed
5877 is available from the parser.
5878
5879 Some global information is available through C<global_informations>
5880
5881 =over
5882
5883 =item $info = global_informations($parser)
5884
5885 The I<$info> returned is a hash reference. The possible keys are
5886
5887 =over
5888
5889 =item input_file_name
5890
5891 The name of the main Texinfo input file.
5892
5893 =item input_encoding_name
5894
5895 =item input_perl_encoding
5896
5897 C<input_encoding_name> string is the encoding name used for the
5898 Texinfo code.
5899 C<input_perl_encoding> string is a corresponding perl encoding name.
5900
5901 =item dircategory_direntry
5902
5903 An array of successive C<@dircategory> and C<@direntry> as they appear
5904 in the document.
5905
5906 =item novalidate
5907
5908 If set, it is as if C<@novalidate> was set in the document.
5909
5910
5911 =back
5912
5913 =back
5914
5915 Some command lists are available, such that it is possible to go through
5916 the corresponding tree elements without walking the tree. They are
5917 available through C<global_commands_information>
5918
5919 =over
5920
5921 =item $commands = global_commands_information($parser)
5922
5923 I<$commands> is an hash reference. The keys are @-command names. The
5924 associated values are array references containing all the corresponding
5925 tree elements.
5926
5927 =back
5928
5929 All the @-commands that have an associated label (so can be the
5930 target of cross references) - C<@node>, C<@anchor> and C<@float> with
5931 label - have a normalized name associated, constructed as described in the
5932 B<HTML Xref> node in the Texinfo manual. Those normalized labels and
5933 the association with @-commands is available through C<labels_information>:
5934
5935 =over
5936
5937 =item $labels_information = labels_information($parser)
5938
5939 I<$labels_information> is a hash reference whose keys are normalized
5940 labels, and the associated value is the corresponding @-command.
5941
5942 =back
5943
5944 Information on C<@float> is also available, grouped by type of
5945 floats, each type correponding to potential C<@listoffloats>.
5946 This information is available through the method C<floats_information>.
5947
5948 =over
5949
5950 =item $float_types = floats_information($parser)
5951
5952 I<$float_types> is a hash reference whose keys are normalized float
5953 types (the first float argument, or the C<@listoffloats> argument).
5954 The normalization is the same as for node names. The value is the list
5955 of float tree elements appearing in the texinfo document.
5956
5957 =back
5958
5959 Internal references, that is, @-commands that refer to node, anchors
5960 or floats within the document are also available:
5961
5962 =over
5963
5964 =item $internal_references_array = internal_references_information($parser);
5965
5966 The function returns a list of cross-reference commands referring to
5967 the same document.
5968
5969 =back
5970
5971 Information about defined indices, merged indices and index entries is
5972 also available through the C<indices_information> method.
5973
5974 =over
5975
5976 =item indices_information
5977
5978 $index_names = indices_information($parser);
5979
5980 The index names is a hash reference. The keys are
5981
5982 =over
5983
5984 =item in_code
5985
5986 1 if the index entries should be formatted as code, 0 in the opposite case.
5987
5988 =item name
5989
5990 The index name.
5991
5992 =item prefix
5993
5994 An array reference of prefix associated to the index.
5995
5996 =item merged_in
5997
5998 In case the index is merged to another index, this key holds the name of
5999 the index the index is merged into. It takes into account indirectly
6000 merged indices.
6001
6002 =item contained_indices
6003
6004 An hash reference holding names of indices that are merged into the index,
6005 including itself. It also contains indirectly merged indices. This key
6006 is removed if the index is itself later merged to another index.
6007
6008 =item index_entries
6009
6010 An array reference containing index entry structures for index entries
6011 associated with the index. The index entry could be associated to
6012 @-commands like C<@cindex>, or C<@item> in C<@vtable>, or definition
6013 commands entries like C<@deffn>.
6014
6015 The keys of the index entry structures are
6016
6017 =over
6018
6019 =item index_name
6020
6021 The index name.
6022
6023 =item index_at_command
6024
6025 The name of the @-command associated with the index entry.
6026
6027 =item index_type_command
6028
6029 The @-command associated with the index entry allowing to
6030 find the index type.
6031
6032 =item content
6033
6034 An array reference corresponding to the index entry content.
6035
6036 =item content_normalized
6037
6038 An array reference corresponding to the index entry content, independent
6039 of the current language.
6040
6041 =item command
6042
6043 The element in the parsed tree associated with the @-command holding the
6044 index entry.
6045
6046 =item node
6047
6048 The node in the parsed tree containing the index entry.
6049
6050 =item number
6051
6052 The number of the index entry.
6053
6054 =item region
6055
6056 The region command (C<@copying>, C<@titlepage>) containing the index entry,
6057 if it is in such an environement.
6058
6059 =back
6060
6061 =back
6062
6063 The following shows the references corresponding to the default indexes
6064 I<cp> and I<fn>, the I<fn> index having its entries formatted as code and
6065 the indices corresponding to the following texinfo
6066
6067 @defindex some
6068 @defcodeindex code
6069
6070 $index_names = {'cp' => {'name' => 'cp', 'in_code' => 0, },
6071 'fn' => {'name' => 'fn', 'in_code' => 1, },
6072 'some' => {'in_code' => 0},
6073 'code' => {'in_code' => 1}};
6074
6075 If C<name> is not set, it is set to the index name.
6076
6077 =back
6078
6079 =head2 Texinfo Parser options
6080
6081 Setting these options is the same as seeing some Texinfo constructs in the
6082 document.
6083
6084 =over
6085
6086 =item aliases
6087
6088 A hash reference. The key is a command name, the value is the alias, as
6089 could be set by C<@alias>.
6090
6091 =item clickstyle
6092
6093 A string, the command name associated with C<@clickstyle>.
6094
6095 =item documentlanguage
6096
6097 A string corresponding to a document language set by C<@documentlanguage>.
6098
6099 =item INPUT_ENCODING_NAME
6100
6101 =item INPUT_PERL_ENCODING
6102
6103 C<INPUT_ENCODING_NAME> string is the encoding name as set
6104 by C<@documentencoding>.
6105 C<INPUT_PERL_ENCODING> string is a corresponding perl encoding name.
6106 In general those two strings should be set simultaneously.
6107
6108 =item indices
6109
6110 If it is a hash reference, the keys are index names, the values are
6111 index prefix hash references. The index prefix hash reference values are
6112 prefix, the value is set if the corresponding index entries should be
6113 formatted as if in C<@code>. An example is as L</indices_information>.
6114
6115 If it is an array reference, it is a list of index names, as if they were
6116 entered as
6117
6118 @defindex name
6119
6120 =item kbdinputstyle
6121
6122 A string, the C<@kbdinputstyle> style.
6123
6124 =item labels
6125
6126 A hash reference. Keys are normalized node names as described in the
6127 B<HTML Xref> node in the Texinfo manual. Instead of a node, it may also
6128 be a float label or an anchor name. The value is the corresponding
6129 @-command element in the tree.
6130
6131 =item macros
6132
6133 The associated hash reference has as keys user-defined macro names. The
6134 value is the reference on a macro definition element as obtained by
6135 the Parser when parsing a C<@macro>. For example
6136
6137 @macro mymacro{arg}
6138 coucou \arg\ after arg
6139 @end macro
6140
6141 Is associated to a macro definition element
6142
6143 {'cmdname' => 'macro',
6144 'args' => [{'text' => 'mymacro', 'type' => 'macro_name'},
6145 {'text' => 'arg', 'type' => 'macro_arg}],
6146 'contents' => [{'text' => "coucou \arg\ after arg\n", 'type' => 'raw'}],
6147 'extra' => {'arg_line' => " mymacro{arg}\n", }}
6148
6149 = item merged_indices
6150
6151 The associated hash reference holds merged indices information, each key
6152 is merged in the value. Same as setting C<@synindex> or C<syncodeindex>.
6153
6154 =item sections_level
6155
6156 Modifier of the sections level. Same as calling C<@lowersections> or
6157 C<@raisesections>.
6158
6159 =item values
6160
6161 A hash reference. Keys are names, values are the corresponding values.
6162 Same as values set by C<@set>.
6163
6164 =back
6165
6166 =head1 TEXINFO TREE
6167
6168 A Texinfo tree element (called element because node is overloaded in
6169 the Texinfo world) is an hash reference. There are three main categories
6170 of tree element. Tree elements associated with an @-command have a
6171 C<cmdname> key holding the @-command name. Tree elements corresponding
6172 to text fragments have a C<text> key holding the corresponding text.
6173 Finally, the last category is other containers (hereafter called
6174 containers) which in most cases have a C<type> key holding their name.
6175 Text fragments and @-command elements may also have an associated type
6176 when such information is needed.
6177
6178 The children of an @-command or container element are in the array
6179 referred to with the C<args> key or with the C<contents> key. The
6180 C<args> key is for arguments of @-commands, either in braces or on
6181 the rest of the line after the command, depending on the type of command.
6182 C<args> is also used for the elements of a menu entry, as a menu
6183 entry is well-structured with a limited number of arguments.
6184 The C<contents> key array holds the contents of the texinfo
6185 code appearing within a block @-command, within a container,
6186 or within a C<@node> or sectioning @-command.
6187
6188 Another important key for the elements is the C<extra> key which is
6189 associated to a hash reference and holds all kinds of information that
6190 is gathered during the parsing and may help with the conversion.
6191
6192 You can see examples of the tree structure by running makeinfo like
6193 this:
6194
6195 makeinfo -c DUMP_TREE=1 -c TEXINFO_OUTPUT_FORMAT=parse document.texi
6196
6197 For a simpler, more regular representation of the tree structure, you
6198 can do:
6199
6200 makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree document.texi
6201
6202 =head2 Element keys
6203
6204 =over
6205
6206 =item cmdname
6207
6208 The command name of @-command elements.
6209
6210 =item text
6211
6212 The text fragment of text elements.
6213
6214 =item type
6215
6216 The type of the element. For C<@verb> it is the delimiter. But otherwise
6217 it is the type of element considered as a container. Frequent types
6218 encountered are I<paragraph> for a paragraph container,
6219 I<brace_command_arg> for the container holding the brace @-commands
6220 contents, I<line_arg> and I<block_line_arg> contain the arguments
6221 appearing on the line of @-commands. Text fragments may have a type to
6222 give an information of the kind of text fragment, for example
6223 C<empty_spaces_before_argument> is associated to spaces after a brace
6224 opening and before the argument. Many @-commands elements don't have
6225 a type associated.
6226
6227 =item args
6228
6229 Arguments in braces or on @-command line, and the elements of a menu entry.
6230
6231 =item contents
6232
6233 The Texinfo appearing in the element. For block commands, other
6234 containers, C<@node> and sectioning commands.
6235
6236 =item parent
6237
6238 The parent element.
6239
6240 =item line_nr
6241
6242 An hash reference corresponding to information on the location of the
6243 element in the Texinfo input manual. It should only be available for
6244 @-command elements, and only for @-commands that are considered to be
6245 complex enough that the location in the document is needed, for example
6246 to prepare an error message.
6247
6248 The keys of the line number hash references are
6249
6250 =over
6251
6252 =item line_nr
6253
6254 The line number of the @-command.
6255
6256 =item file_name
6257
6258 The file name where @-command appeared.
6259
6260 =item macro
6261
6262 The user macro name the @-command is expanded from.
6263
6264 =back
6265
6266 =item extra
6267
6268 A hash reference holding any additional information.
6269 See L</Information available in the extra key>.
6270
6271 =back
6272
6273 =head2 Element types
6274
6275 =head3 Types for command elements
6276
6277 Some types can be associated with @-commands (in addition to the element
6278 being described by C<cmdname>), although usually there will be no type
6279 at all. As said above, for C<@verb> the type is the delimiter. For a
6280 C<@value> command that is not expanded because there is no corresponding
6281 value set, the type is the value argument string.
6282
6283 The following are the other possible values of C<type> for tree elements
6284 for @-commands.
6285
6286 =over
6287
6288 =item def_line
6289
6290 This type may be associated with a definition command with a x form,
6291 like C<@defunx>, C<@defvrx>. For the form without x, the associated
6292 I<def_line> is the first C<contents> element. It is described in more
6293 details below.
6294
6295 =item command_as_argument
6296
6297 This is the type of a command given in argument of C<@itemize>,
6298 C<@table>, C<@vtable> or C<@ftable>. For example in
6299
6300 @itemize @bullet
6301 @item item
6302 @end itemize
6303
6304 the element corresponding with bullet has the following keys:
6305
6306 'cmdname' => 'bullet'
6307 'type' => 'command_as_argument'
6308
6309 The parent @-command has an entry in extra for the I<command_as_argument>
6310 element:
6311
6312 'cmdname' => 'itemize'
6313 'extra => {'command_as_argument' => $command_element_as_argument}
6314
6315 =item index_entry_command
6316
6317 This is the type of index entry command like C<@cindex>, and, more
6318 importantly user-defined index entry commands. So for example if there
6319 is
6320
6321 @defindex foo
6322 ...
6323
6324 @fooindex index entry
6325
6326 the C<@fooindex> @-command element will have the I<index_entry_command>
6327 type.
6328
6329 =item following_arg
6330
6331 This type is set for non-alphabetic accent @-commands that don't use braces
6332 but instead have their argument right after them, as
6333
6334 @~n
6335
6336 =item space_command_arg
6337
6338 This type is set for accent @-commands that don't use brace but instead
6339 have their argument after some space, as
6340
6341 @ringaccent A
6342
6343 =item definfoenclose_command
6344
6345 This type is set for an @-command that is redefined by C<@definfoenclose>.
6346 The beginning is in C<< {'extra'}->{'begin'} >> and the end in
6347 C<< {'extra'}->{'end'} >>.
6348
6349 =back
6350
6351 =head3 Types for text elements
6352
6353 The text elements may have the following types (or may have no type
6354 at all):
6355
6356 =over
6357
6358 =item empty_line
6359
6360 An empty line (possibly containing whitespace characters only).
6361
6362 =item empty_line_after_command
6363
6364 =item empty_spaces_after_command
6365
6366 The text is spaces for I<empty_spaces_after_command>
6367 or spaces followed by a newline for
6368 I<empty_line_after_command>, appearing after an @-command that
6369 takes an argument on the line or a block @-command.
6370
6371 =item empty_spaces_before_argument
6372
6373 The text is spaces appearing after an opening brace or after a
6374 comma separating a command's arguments.
6375
6376 =item spaces_at_end
6377
6378 Space at the end of an argument to a line command, at the end of an
6379 comma-separated argument for some brace commands, or at the end of
6380 bracketed content on a C<@multitable> line or definition line.
6381
6382 =item empty_spaces_after_close_brace
6383
6384 Spaces appearing after a closing brace, for some rare commands for which
6385 this space should be ignorable (like C<@caption>).
6386
6387 =item empty_spaces_before_paragraph
6388
6389 Space appearing before a paragraph beginning.
6390
6391 =item raw
6392
6393 Text in an environment where it should be kept as is (in C<@verbatim>,
6394 C<@verb>, C<@html>, C<@macro> body).
6395
6396 =item last_raw_newline
6397
6398 The last end of line in a raw block (except for C<@verbatim>).
6399
6400 =item preamble_text
6401
6402 Text appearing before real content, including the C<\input texinfo.tex>.
6403
6404 =item space_at_end_menu_node
6405
6406 =item after_description_line
6407
6408 Space after a node in the menu entry, when there is no description,
6409 and space appearing after the description line.
6410
6411 =back
6412
6413 =head3 Types of container elements
6414
6415 The other types of element are the following. These are containers with
6416 other elements appearing in their C<contents>.
6417
6418 =over
6419
6420 =item text_root
6421
6422 =item document_root
6423
6424 =item root_line
6425
6426 These types correspond to document roots. C<text_root> is the document
6427 root when there is no C<@node> or sectioning command. When
6428 such a command appears, a new root container is used, C<document_root>,
6429 and C<text_root> becomes the first element in the contents of C<document_root>.
6430 C<root_line> is the type of the root tree when parsing Texinfo line
6431 fragments using C<parse_texi_line>.
6432
6433 =item preamble
6434
6435 This container holds the text appearing before the first content, including
6436 the C<\input texinfo.tex> line and following blank lines.
6437
6438 =item preamble_before_setfilename
6439
6440 This container holds everything that appears before C<@setfilename>
6441 if I<IGNORE_BEFORE_SETFILENAME> parser option is set.
6442
6443 =item paragraph
6444
6445 A paragraph. The C<contents> of a paragraph (like other container
6446 elements for Texinfo content) are elements representing the contents of
6447 the paragraph in the order they occur, such as simple text elements
6448 without a C<cmdname> or C<type>, or @-command elements for commands
6449 appearing in the paragraph.
6450
6451 =item preformatted
6452
6453 Texinfo code within a format that is not filled. Happens within some
6454 block commands like C<@example>, but also in menu (in menu descriptions,
6455 menu comments...).
6456
6457 =item brace_command_arg
6458
6459 =item brace_command_context
6460
6461 =item line_arg
6462
6463 =item block_line_arg
6464
6465 Those containers occur within the C<args> array of @-commands taking an
6466 argument. I<brace_command_arg> is used for the arguments to commands
6467 taking arguments surrounded by braces (and in some cases separated by
6468 commas). I<brace_command_context> is used for @-commands with braces
6469 that start a new context (C<@footnote>, C<@caption>, C<@math>).
6470
6471 I<line_arg> is used for commands that take the texinfo code on the
6472 rest of the line as their argument (for example (C<@settitle>, C<@node>,
6473 C<@section> and similar). I<block_line_arg> is similar but is used for
6474 commands that start a new block (which is to be ended with C<@end>).
6475
6476 For example
6477
6478 @code{in code}
6479
6480 leads to
6481
6482 {'cmdname' => 'code',
6483 'args' => [{'type' => 'brace_command_arg',
6484 'contents' => [{'text' => 'in code'}]}]}
6485
6486 =item misc_arg
6487
6488 Used for the arguments to some special line commands whose arguments
6489 aren't subject to the usual macro expansion. For example C<@set>,
6490 C<@clickstyle>, C<@unmacro>, C<@comment>. The argument is associated to
6491 the I<text> key.
6492
6493 =item menu_entry
6494
6495 =item menu_entry_leading_text
6496
6497 =item menu_entry_name
6498
6499 =item menu_entry_separator
6500
6501 =item menu_entry_node
6502
6503 =item menu_entry_description
6504
6505 A I<menu_entry> holds a full menu entry, like
6506
6507 * node:: description.
6508
6509 The different elements of the menu entry are directly in the
6510 I<menu_entry> C<args> array reference.
6511
6512 I<menu_entry_leading_text> holds the star and following spaces.
6513 I<menu_entry_name> is the menu entry name (if present), I<menu_entry_node>
6514 corresponds to the node in the menu entry, I<menu_entry_separator> holds
6515 the text after the node and before the description, in most cases
6516 C<:: >. Lastly, I<menu_entry_description> is for the description.
6517
6518 =item menu_comment
6519
6520 The I<menu_comment> container holds what is between menu entries
6521 in menus. For example in
6522
6523 @menu
6524 Menu title
6525
6526 * entry::
6527
6528 Between entries
6529 * other::
6530 @end menu
6531
6532 Both
6533
6534 Menu title
6535
6536 and
6537
6538 Between entries
6539
6540 will be in I<menu_comment>.
6541
6542 =item macro_name
6543
6544 =item macro_arg
6545
6546 Taken from C<@macro> definition and put in the C<args> key array of
6547 the macro, I<macro_name> is the type of the text fragment corresponding
6548 to the macro name, I<macro_arg> is the type of the text fragments
6549 correponding to macro formal arguments.
6550
6551 =item before_item
6552
6553 A container for content before the first C<@item> of block @-commands
6554 with items (C<@table>, C<@multitable>, C<@enumerate>...).
6555
6556 =item table_entry
6557
6558 =item table_term
6559
6560 =item table_item
6561
6562 =item inter_item
6563
6564 Those containers appear in C<@table>, C<@ftable> and C<@vtable>.
6565 A I<table_entry> container contains an entire row of the table.
6566 It contains a I<table_term> container, which holds all the C<@item> and
6567 C<@itemx> lines. This is followed by a I<table_item> container, which
6568 holds the content that is to go into the second column of the table.
6569
6570 If there is any content before an C<@itemx> (normally only comments,
6571 empty lines or maybe index entries are allowed), it will be in
6572 a container with type I<inter_item>.
6573
6574 =item def_line
6575
6576 =item def_item
6577
6578 =item inter_def_item
6579
6580 The I<def_line> type is either associated with a container within a
6581 definition command, or is the type of a definition command with a x
6582 form, like C<@deffnx>. It holds the definition line arguments.
6583 The container with type I<def_item> holds the definition text content.
6584 Content appearing before a definition command with a x form is in
6585 an I<inter_def_item> container.
6586
6587 =item multitable_head
6588
6589 =item multitable_body
6590
6591 =item row
6592
6593 In C<@multitable>, a I<multitable_head> container contains all the rows
6594 with C<@headitem>, while I<multitable_body> contains the rows associated
6595 with C<@item>. A I<row> container contains the C<@item> and @<tab>
6596 forming a row.
6597
6598 =item bracketed
6599
6600 This a special type containing content in brackets in the context
6601 where they are valid, in C<@math>.
6602
6603 =item bracketed_def_content
6604
6605 Content in brackets on definition command lines.
6606
6607 =item def_aggregate
6608
6609 Contains several elements that together are a single unit on a @def* line.
6610
6611 =item bracketed_multitable_prototype
6612
6613 =item row_prototype
6614
6615 On C<@multitable> line, content in brackets is in
6616 I<bracketed_multitable_prototype>, text not in brackets
6617 is in I<row_prototype>.
6618
6619 =back
6620
6621 =head2 Information available in the extra key
6622
6623 =head3 Extra keys available for more than one @-command
6624
6625 =over
6626
6627 =item end_command
6628
6629 The C<@end> associated to the block @-command.
6630
6631 =item missing_argument
6632
6633 Set for some @-commands with line arguments and a missing argument.
6634
6635 =item arg_line
6636
6637 The string correspond to the line after the @-command
6638 for @-commands that have special arguments on their line,
6639 and for C<@macro> line.
6640
6641 =item text_arg
6642
6643 The string correspond to the line after the @-command for @-commands
6644 that have an argument interpreted as simple text, like C<@setfilename>,
6645 C<@end> or C<@documentencoding>.
6646
6647 =item index_entry
6648
6649 The index entry information (described in L</index_entries>
6650 in details) is associated to @-commands that have an associated
6651 index entry.
6652
6653 =item misc_args
6654
6655 An array holding strings, the arguments of @-commands taking simple
6656 textual arguments as arguments, like C<@everyheadingmarks>,
6657 C<@frenchspacing>, C<@alias>, C<@synindex>, C<@columnfractions>.
6658 Also filled for C<@set>, C<@clickstyle>, C<@unmacro> or C<@comment>
6659 arguments.
6660
6661 =item spaces_before_argument
6662
6663 For @-commands with opening brace followed by spaces held in a
6664 C<empty_spaces_before_argument> element, a reference to those spaces.
6665
6666 =item spaces
6667
6668 For accent commands acting on one letter only, like C<@ringaccent>
6669 appearing like
6670
6671 @ringaccent A
6672
6673 there is a I<spaces> key which holds the spaces appearing between
6674 the command and the argument.
6675
6676 =back
6677
6678 =head3 Extra keys specific of certain @-commands or containers
6679
6680 =over
6681
6682 =item C<@macro>
6683
6684 I<invalid_syntax> is set if there was an error on the C<@macro>
6685 line. I<arg_line> holds the line after C<@macro>.
6686
6687 =item C<@node>
6688
6689 The arguments are in the I<nodes_manuals> array. Each
6690 of the entries is a hash with a I<node_content> key for
6691 an array holding the corresponding content, a I<manual_content> key
6692 if there is an associated external manual name, and a I<normalized>
6693 key for the normalized label, built as specified in the Texinfo manual
6694 in the B<HTML Xref> node.
6695
6696 An I<associated_section> key holds the tree element of the
6697 sectioning command that follows the node.
6698
6699 =item C<@part>
6700
6701 The next sectioning command is in I<part_associated_section>.
6702
6703 =item sectioning command
6704
6705 The node preceding the command is in I<associated_node>.
6706 The part preceding the command is in I<associated_part>.
6707 If the level of the document was modified by C<@raisections>
6708 or C<@lowersections>, the differential level is in I<sections_level>.
6709
6710 =item C<@float>
6711
6712 =item C<@listoffloats>
6713
6714 If float has a second argument, and for C<@listoffloats>
6715 argument there is a I<type> key which is also a hash reference,
6716 with two keys. I<content> is an array holding the associated
6717 contents, I<normalized> holds the normalized float type.
6718
6719 I<caption> and I<shortcaption> holds the corresponding
6720 tree elements for float. The C<@caption> or C<@shortcaption>
6721 have the float tree element stored in I<float>.
6722
6723 =item C<@float>
6724
6725 =item C<@anchor>
6726
6727 @-commands that are targets for cross-references have a I<normalized>
6728 key for the normalized label, built as specified in the Texinfo manual
6729 in the B<HTML Xref> node. There is also a I<node_content> key for
6730 an array holding the corresponding content.
6731
6732 C<@anchor> also has I<region> set to the special region name if
6733 in a special region (C<@copying>, C<@titlepage>).
6734
6735 =item C<@ref>
6736
6737 =item C<@xref>
6738
6739 =item C<@pxref>
6740
6741 =item C<@inforef>
6742
6743 The I<node_argument> entry holds a parsed node entry, like
6744 the one appearing in the I<nodes_manuals> array for C<@node>.
6745
6746 =item C<@abbr>
6747
6748 =item C<@acronym>
6749
6750 The first argument normalized is in I<normalized>.
6751
6752 =item definition command
6753
6754 I<def_command> holds the command name, without x if it is
6755 an x form of a definition command.
6756 I<original_def_cmdname> is the original def command.
6757
6758 If it is an x form, it has I<not_after_command> set if not
6759 appearing after the definition command without x.
6760
6761 =item def_line
6762
6763 For each element in a def_line, the key I<def_role> holds a string
6764 describing the meaning of the element. It is one of
6765 I<category>, I<name>, I<class>, I<type>, I<arg>, I<typearg>,
6766 I<spaces> or I<delimiter>, depending on the definition.
6767
6768 The I<def_parsed_hash> hash reference has these strings as keys,
6769 and the values are the corresponding elements.
6770
6771 =item C<@multitable>
6772
6773 The key I<max_columns> holds the maximal number of columns. If there
6774 are prototypes on the line they are in the array associated with
6775 I<prototypes>. If there is a C<@columnfractions> as argument, then the
6776 I<columnfractions> key is associated with the element for the
6777 @columnfractions command.
6778
6779 =item C<@enumerate>
6780
6781 The extra key I<enumerate_specification> contains the enumerate
6782 argument.
6783
6784 =item C<@itemize>
6785
6786 =item C<@table>
6787
6788 =item C<@vtable>
6789
6790 =item C<@ftable>
6791
6792 The I<command_as_argument> extra key points to the @-command on
6793 as argument on the @-command line.
6794
6795 =item paragraph
6796
6797 The I<indent> or I<noindent> key value is set if the corresponding
6798 @-commands are associated with that paragraph.
6799
6800 =item C<@item> in C<@enumerate> or C<@itemize>
6801
6802 The I<item_number> extra key holds the number of this item.
6803
6804 =item C<@item> and C<@tab> in C<@multitable>
6805
6806 The I<cell_number> index key holds the index of the column of
6807 the cell.
6808
6809 =item row
6810
6811 The I<row_number> index key holds the index of the row in
6812 the C<@multitable>.
6813
6814 =item C<@author>
6815
6816 If in a C<@titlepage>, the titlepage is in I<titlepage>, if in
6817 C<@quotation> or C<@smallquotation>, the corresponding tree element
6818 is in I<quotation>.
6819
6820 The author tree element is in the I<author> array of the C<@titlepage>
6821 or the C<@quotation> or C<@smallquotation> it is associated with.
6822
6823 =item C<@ifclear>
6824
6825 =item C<@ifset>
6826
6827 The original line is in I<line>.
6828
6829 =item C<@end>
6830
6831 The textual argument is in I<command_argument>.
6832 The corresponding @-command is in I<command>.
6833
6834 =item C<@documentencoding>
6835
6836 The argument, normalized is in I<input_encoding_name> if it is recognized.
6837 The corresponding perl encoding name is in I<input_perl_encoding>.
6838
6839 =item C<@click>
6840
6841 In I<clickstyle> there is the current clickstyle command.
6842
6843 =item C<@kbd>
6844
6845 I<code> is set depending on the context and C<@kbdinputstyle>.
6846
6847 =item definfoenclose defined commands
6848
6849 I<begin> holds the string beginning the definfoenclose,
6850 I<end> holds the string ending the definfoenclose.
6851
6852 =item menu_entry
6853
6854 The I<menu_entry_description> and I<menu_entry_name> keys
6855 are associated with the corresponding tree elements. The
6856 I<menu_entry_node> value is a hash with information about the parsed
6857 node entry; its keys are the same as those appearing in the
6858 elements of the I<nodes_manuals> array for C<@node>.
6859
6860 =item empty_line_after_command
6861
6862 The corresponding command is in I<command>.
6863
6864 =item C<@inlinefmt>
6865
6866 =item C<@inlineraw>
6867
6868 =item C<@inlinefmtifelse>
6869
6870 =item C<@inlineifclear>
6871
6872 =item C<@inlineifset>
6873
6874 The first argument is in I<format>. If an argument has been determined
6875 as being expanded by the Parser, the index of this argument is in
6876 I<expand_index>. Index numbering begins at 0, but the first argument is
6877 always the format or flag name, so, if set, it should be 1 or 2 for
6878 C<@inlinefmtifelse>, and 1 for other commands.
6879
6880 =back
6881
6882 =head2 Other information set by the parser
6883
6884 The parser creates an array of nodes and stores this in the
6885 I<nodes> key of the parser object.
6886
6887 Each element in the tree corresponding to a node contaning a menu
6888 has a I<menus> key which refers to an array of references to menu
6889 elements occuring in the node.
6890
6891 These are both used by the C<Texinfo::Structuring> module.
6892
6893
6894
6895 =head1 SEE ALSO
6896
6897 L<Texinfo manual|http://www.gnu.org/s/texinfo/manual/texinfo/>
6898
6899 =head1 AUTHOR
6900
6901 Patrice Dumas, E<lt>pertusus@free.frE<gt>
6902
6903 =cut
0 # Parser.pm: parse texinfo code into a tree.
1 #
2 # Copyright 2010-2019 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License,
7 # or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # Original author: Patrice Dumas <pertusus@free.fr>
18 # Parts (also from Patrice Dumas) come from texi2html.pl or texi2html.init.
19
20 # Note: This file may not be loaded if TEXINFO_XS_PARSER is set in the
21 # environment, due to a hook placed in @INC by Texinfo::ModulePath.
22
23 # The organization of the file is the following:
24 # module definitions.
25 # default parser state. With explanation of the internal structures.
26 # initializations, determination of command types.
27 # user visible subroutines.
28 # internal subroutines, doing the parsing.
29
30 package Texinfo::ParserNonXS;
31
32 no strict 'refs';
33 BEGIN { *Texinfo::Parser:: = \%Texinfo::ParserNonXS::; }
34 use strict 'refs';
35
36 # We need the unicode stuff.
37 use 5.006;
38 use strict;
39
40 # debug
41 use Carp qw(cluck);
42
43 use Data::Dumper;
44
45 # to detect if an encoding may be used to open the files
46 use Encode;
47
48 # for fileparse
49 use File::Basename;
50
51 # Clone could be faster for small structures, which should be the case
52 # here, but Clone is not in perl core modules, so we use Storable::dclone.
53 use Storable qw(dclone); # standard in 5.007003
54
55 # commands definitions
56 use Texinfo::Common;
57 # Error reporting and counting, translation of strings.
58 use Texinfo::Report;
59 # encoding_alias
60 use Texinfo::Encoding;
61
62 # to normalize node name, anchor, float arg, and first *ref argument.
63 use Texinfo::Convert::NodeNameNormalization;
64 # in error messages, and for macro body expansion
65 use Texinfo::Convert::Texinfo;
66
67 require Exporter;
68 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
69 @ISA = qw(Exporter Texinfo::Report);
70
71 our $module_loaded = 0;
72 sub import {
73 if (!$module_loaded) {
74 Texinfo::XSLoader::override ("Texinfo::Parser::_merge_text",
75 "Texinfo::MiscXS::merge_text");
76 Texinfo::XSLoader::override ("Texinfo::Parser::_abort_empty_line",
77 "Texinfo::MiscXS::abort_empty_line");
78 Texinfo::XSLoader::override ("Texinfo::Parser::_parse_texi_regex",
79 "Texinfo::MiscXS::parse_texi_regex");
80 $module_loaded = 1;
81 }
82 # The usual import method
83 goto &Exporter::import;
84 }
85
86
87 %EXPORT_TAGS = ( 'all' => [ qw(
88 parser
89 parse_texi_text
90 parse_texi_line
91 parse_texi_file
92 indices_information
93 floats_information
94 internal_references_information
95 labels_information
96 global_commands_information
97 global_informations
98 ) ] );
99
100 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
101
102 @EXPORT = qw(
103 );
104
105 $VERSION = '6.5.91';
106
107 sub N__($)
108 {
109 return $_[0];
110 }
111
112 # Customization variables obeyed by the Parser, and the default values.
113 our %default_customization_values = (
114 'TEST' => 0,
115 'DEBUG' => 0, # if >= 10, tree is printed in texi2any.pl after parsing.
116 # If >= 100 tree is printed every line.
117 'SHOW_MENU' => 1, # if false no menu error related.
118 'IGNORE_BEFORE_SETFILENAME' => 1,
119 'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME' => 1,
120 'INPUT_PERL_ENCODING' => undef, # input perl encoding name, set from
121 # @documentencoding in the default case
122 'INPUT_ENCODING_NAME' => undef, # encoding name normalized as preferred
123 # IANA, set from @documentencoding in the default
124 # case
125 'CPP_LINE_DIRECTIVES' => 1, # handle cpp like synchronization lines
126 'MAX_MACRO_CALL_NESTING' => 100000, # max number of nested macro calls
127 # This is not used directly, but passed to Convert::Text through
128 # Texinfo::Common::_convert_text_options
129 'ENABLE_ENCODING' => 1, # output accented and special characters
130 # based on @documentencoding
131 # following are used in Texinfo::Structuring
132 'TOP_NODE_UP' => '(dir)', # up node of Top node
133 'SIMPLE_MENU' => 0, # not used in the parser but in structuring
134 'USE_UP_NODE_FOR_ELEMENT_UP' => 0, # Use node up for Up if there is no
135 # section up.
136 );
137
138 my %parser_default_configuration = (%Texinfo::Common::default_parser_state_configuration,
139 %default_customization_values);
140
141 # the other possible keys for the parser state are:
142 #
143 # expanded_formats_hash each key comes from expanded_formats value is 1
144 # index_names a structure holding the link between index
145 # names, merged indices,
146 # initial value is %index_names in Texinfo::Common.
147 # context_stack stack of the contexts, more recent on top.
148 # 'line' is added when on a line or
149 # block @-command line,
150 # 'def' is added instead if on a definition line.
151 # 'preformatted' is added in block commands
152 # where there is no paragraphs and spaces are kept
153 # (format, example, display...)
154 # 'rawpreformatted' is added in raw block commands
155 # (html, xml, docbook...)
156 # 'menu' is added in menu commands
157 # 'math', 'footnote', 'caption', 'shortcaption',
158 # 'inlineraw' are also added when in those commands
159 # conditionals_stack a stack of conditional commands that are expanded.
160 # macro_stack stack of macros being expanded (more recent first)
161 # definfoenclose an hash, key is the command name, value is an array
162 # reference with 2 values, beginning and ending.
163 # input a stack, with last at bottom. Holds the opened files
164 # or text. Pending macro expansion or text expansion
165 # is also in that structure.
166 # line_commands the same as %line_commands in Texinfo::Common,
167 # but with index entry commands dynamically added
168 # close_paragraph_commands same as %close_paragraph_commands
169 # close_preformatted_commands same as %close_preformatted_commands
170 # no_paragraph_commands the same as %default_no_paragraph_commands
171 # below, with index
172 # entry commands dynamically added
173 # simple_text_commands the same as %simple_text_commands below, but
174 # with index entry commands dynamically added
175 # current_node last seen node.
176 # current_section last seen section.
177 # nodes list of nodes.
178 # command_index associate a command name with an index name
179 # floats key is the normalized float type, value is an array
180 # reference holding all the floats.
181 # internal_references an array holding all the internal references.
182
183 # set points to the value set when initializing, for
184 # configuration items that are not to be overriden
185 # by @-commands. For example documentlanguage.
186
187 # A line information is an hash reference with the keys:
188 # line_nr the line number
189 # file_name the file name
190 # macro if in a macro expansion, the name of the macro
191 #
192 # A text fragment information is a 2 element array reference, the first is the
193 # text fragment, the second is the line information.
194
195 # The input structure is an array, the first is the most recently included
196 # file. The last element may be a file if the parsing is done on a file,
197 # with parse_texi_file, or simply pending text, if called as parse_texi_text.
198 # each element of the array is a hash reference. The key are:
199 # pending an array reference containing pending text fragments, either the
200 # text given as parse_texi_text or macro expansion text.
201 # name file name
202 # line_nr current line number in the file
203 # fh filehandle for the file
204
205 # content is not copied but reference is copied when duplicating a parser.
206 my %tree_informations;
207 foreach my $tree_information ('values', 'macros', 'explained_commands', 'labels') {
208 $tree_informations{$tree_information} = 1;
209 }
210
211 # The commands in initialization_overrides are not set in the document if
212 # set at the parser initialization.
213 my %initialization_overrides = (
214 'INPUT_ENCODING_NAME' => 1,
215 'documentlanguage' => 1,
216 );
217
218 my %no_brace_commands = %Texinfo::Common::no_brace_commands;
219 my %line_commands = %Texinfo::Common::line_commands;
220 my %other_commands = %Texinfo::Common::other_commands;
221 my %brace_commands = %Texinfo::Common::brace_commands;
222 my %accent_commands = %Texinfo::Common::accent_commands;
223 my %context_brace_commands = %Texinfo::Common::context_brace_commands;
224 my %block_commands = %Texinfo::Common::block_commands;
225 my %block_item_commands = %Texinfo::Common::block_item_commands;
226 my %close_paragraph_commands = %Texinfo::Common::close_paragraph_commands;
227 my %def_map = %Texinfo::Common::def_map;
228 my %def_commands = %Texinfo::Common::def_commands;
229 my %def_aliases = %Texinfo::Common::def_aliases;
230 my %menu_commands = %Texinfo::Common::menu_commands;
231 my %preformatted_commands = %Texinfo::Common::preformatted_commands;
232 my %format_raw_commands = %Texinfo::Common::format_raw_commands;
233 my %item_container_commands = %Texinfo::Common::item_container_commands;
234 my %item_line_commands = %Texinfo::Common::item_line_commands;
235 my %deprecated_commands = %Texinfo::Common::deprecated_commands;
236 my %root_commands = %Texinfo::Common::root_commands;
237 my %sectioning_commands = %Texinfo::Common::sectioning_commands;
238 my %command_index = %Texinfo::Common::command_index;
239 my %ref_commands = %Texinfo::Common::ref_commands;
240 my %region_commands = %Texinfo::Common::region_commands;
241 my %code_style_commands = %Texinfo::Common::code_style_commands;
242 my %in_heading_commands = %Texinfo::Common::in_heading_commands;
243 my %in_index_commands = %Texinfo::Common::in_index_commands;
244 my %explained_commands = %Texinfo::Common::explained_commands;
245 my %inline_format_commands = %Texinfo::Common::inline_format_commands;
246 my %inline_commands = %Texinfo::Common::inline_commands;
247 my %inline_conditional_commands = %Texinfo::Common::inline_conditional_commands;
248 my %all_commands = %Texinfo::Common::all_commands;
249
250 # equivalence between a @set flag and an @@-command
251 my %set_flag_command_equivalent = (
252 'txicodequoteundirected' => 'codequoteundirected',
253 'txicodequotebacktick' => 'codequotebacktick',
254 # 'txideftypefnnl' => 'deftypefnnewline',
255 );
256
257
258 # keep line information for those commands.
259 my %keep_line_nr_brace_commands = %context_brace_commands;
260 foreach my $keep_line_nr_brace_command ('titlefont', 'anchor') {
261 $keep_line_nr_brace_commands{$keep_line_nr_brace_command} = 1;
262 }
263 foreach my $brace_command (keys (%brace_commands)) {
264 $keep_line_nr_brace_commands{$brace_command} = 1;
265 }
266
267 my %type_with_paragraph;
268 foreach my $type ('before_item', 'text_root', 'document_root',
269 'brace_command_context') {
270 $type_with_paragraph{$type} = 1;
271 }
272
273 my %command_ignore_space_after;
274 foreach my $command ('anchor', 'hyphenation', 'caption', 'shortcaption',
275 'sortas') {
276 $command_ignore_space_after{$command} = 1;
277 }
278
279 my %global_multiple_commands;
280 foreach my $global_multiple_command (
281 'footnote', 'hyphenation', 'insertcopying', 'printindex',
282 'subtitle','titlefont', 'listoffloats', 'detailmenu', 'part',
283 keys(%Texinfo::Common::document_settable_at_commands), ) {
284 $global_multiple_commands{$global_multiple_command} = 1;
285 }
286
287 my %global_unique_commands;
288 foreach my $global_unique_command (
289 'copying', 'settitle',
290 'shorttitlepage', 'title', 'titlepage', 'top',
291 keys(%Texinfo::Common::document_settable_unique_at_commands), ) {
292 $global_unique_commands{$global_unique_command} = 1;
293 }
294
295 my %index_names = %Texinfo::Common::index_names;
296
297 # index names that cannot be set by the user.
298 my %forbidden_index_name = ();
299
300 foreach my $name (keys(%index_names)) {
301 $forbidden_index_name{$name} = 1;
302 if ($name =~ /^(.).$/) {
303 $forbidden_index_name{$1} = 1;
304 }
305 }
306
307 foreach my $other_forbidden_index_name ('info','ps','pdf','htm',
308 'html', 'log','aux','dvi','texi','txi','texinfo','tex','bib') {
309 $forbidden_index_name{$other_forbidden_index_name} = 1;
310 }
311
312 # @-commands that do not start a paragraph
313 my %default_no_paragraph_commands;
314 # @-commands that should be at the beginning of a line
315 my %begin_line_commands;
316
317 foreach my $command ('node', 'end') {
318 $begin_line_commands{$command} = $command;
319 }
320
321 foreach my $no_paragraph_command ('titlefont', 'caption', 'shortcaption',
322 'image', '*', 'hyphenation', 'anchor', 'errormsg') {
323 $default_no_paragraph_commands{$no_paragraph_command} = 1;
324 }
325
326 foreach my $no_paragraph_command (keys(%line_commands),
327 keys(%other_commands)) {
328 $default_no_paragraph_commands{$no_paragraph_command} = 1;
329 }
330
331 foreach my $no_paragraph_command (keys(%line_commands)) {
332 $begin_line_commands{$no_paragraph_command} = 1;
333 }
334
335 # verbatiminclude is not said to begin at the beginning of the line
336 # in the manual
337 foreach my $not_begin_line_command ('comment', 'c', 'sp', 'columnfractions',
338 'item', 'verbatiminclude',
339 'set', 'clear', 'vskip') {
340 delete $begin_line_commands{$not_begin_line_command};
341 }
342
343 my %block_arg_commands;
344 foreach my $block_command (keys(%block_commands)) {
345 $begin_line_commands{$block_command} = 1;
346 $default_no_paragraph_commands{$block_command} = 1;
347 $block_arg_commands{$block_command} = 1
348 if ($block_commands{$block_command} ne 'raw');
349 # and ! $format_raw_commands{$block_command});
350 }
351
352 my %close_preformatted_commands = %close_paragraph_commands;
353 foreach my $no_close_preformatted('sp') {
354 delete $close_preformatted_commands{$no_close_preformatted};
355 }
356 # FIXME to close preformated or not to close?
357 #foreach my $format_raw_command(keys(%format_raw_commands)) {
358 # $close_preformatted_commands{$format_raw_command} = 1;
359 #}
360
361 # commands that may appear in accents
362 my %in_accent_commands = %accent_commands;
363 foreach my $brace_command(keys(%brace_commands)) {
364 $in_accent_commands{$brace_command} = 1 if (!$brace_commands{$brace_command});
365 }
366 foreach my $no_brace_command (keys(%no_brace_commands)) {
367 $in_accent_commands{$no_brace_command} = 1;
368 }
369 $in_accent_commands{'c'} = 1;
370 $in_accent_commands{'comment'} = 1;
371
372 # commands that may appear in text arguments
373 my %in_full_text_commands;
374 foreach my $command (keys(%brace_commands), keys(%no_brace_commands)) {
375 $in_full_text_commands{$command} = 1;
376 }
377 foreach my $in_full_text_command ('c', 'comment', 'refill',
378 'columnfractions', 'set', 'clear', 'end') {
379 $in_full_text_commands{$in_full_text_command} = 1;
380 }
381
382 foreach my $out_format (keys(%format_raw_commands)) {
383 $in_full_text_commands{$out_format} = 1;
384 }
385 delete $in_full_text_commands{'caption'};
386 delete $in_full_text_commands{'shortcaption'};
387 foreach my $block_command (keys(%block_commands)) {
388 $in_full_text_commands{$block_command} = 1
389 if ($block_commands{$block_command} eq 'conditional');
390 }
391
392
393 # commands that may appear inside sectioning commands
394 my %in_full_line_commands_no_refs = %in_full_text_commands;
395 foreach my $not_in_full_line_commands_no_refs ('titlefont',
396 'anchor', 'footnote', 'verb') {
397 delete $in_full_line_commands_no_refs{$not_in_full_line_commands_no_refs};
398 }
399
400 # commands that may happen in simple text arguments
401 my %in_simple_text_commands = %in_full_line_commands_no_refs;
402 foreach my $not_in_simple_text_command('xref', 'ref', 'pxref', 'inforef') {
403 delete $in_simple_text_commands{$not_in_simple_text_command};
404 }
405
406 # commands that only accept simple text as argument in any context.
407 my %simple_text_commands;
408 foreach my $line_command(keys(%line_commands)) {
409 if ($line_commands{$line_command} =~ /^\d+$/
410 or ($line_commands{$line_command} eq 'line'
411 and !($sectioning_commands{$line_command}
412 or $def_commands{$line_command}))
413 or $line_commands{$line_command} eq 'text') {
414 $simple_text_commands{$line_command} = 1;
415 }
416 }
417
418 my %full_line_commands_no_refs = (%sectioning_commands,
419 %def_commands);
420
421 delete $simple_text_commands{'center'};
422 delete $simple_text_commands{'exdent'};
423
424 foreach my $command (keys (%brace_commands)) {
425 if ($brace_commands{$command} =~ /\d/
426 and $brace_commands{$command} > 0
427 and !$inline_conditional_commands{$command}) {
428 $simple_text_commands{$command} = 1;
429 }
430 }
431
432 foreach my $command ('shortcaption', 'math') {
433 $simple_text_commands{$command} = 1;
434 }
435
436 # commands that accept full text, but no block or top-level commands
437 my %full_text_commands;
438 foreach my $brace_command (keys (%brace_commands)) {
439 if ($brace_commands{$brace_command} eq 'style') {
440 $full_text_commands{$brace_command} = 1;
441 }
442 }
443
444 # commands that accept almost the same as in full text, except
445 # what does not make sense on a line.
446 my %full_line_commands;
447 $full_line_commands{'center'} = 1;
448 $full_line_commands{'exdent'} = 1;
449 $full_line_commands{'item'} = 1;
450 $full_line_commands{'itemx'} = 1;
451
452 # Fill the valid nestings hash. The keys are the containing commands and
453 # the values arrays of commands that are allowed to occur inside those
454 # commands. All commands not in this hash are considered to accept anything.
455 # There are additional context tests, to make sure, for instance that we are
456 # testing @-commands on the block, line or node @-command line and not
457 # in the content.
458 # Index entry commands are dynamically set as %in_simple_text_commands
459 my %default_valid_nestings;
460
461 foreach my $command (keys(%accent_commands)) {
462 $default_valid_nestings{$command} = \%in_accent_commands;
463 }
464 foreach my $command (keys(%simple_text_commands)) {
465 $default_valid_nestings{$command} = \%in_simple_text_commands;
466 }
467 foreach my $command (keys(%full_text_commands), keys(%full_line_commands)) {
468 $default_valid_nestings{$command} = \%in_full_text_commands;
469 }
470 foreach my $command (keys(%full_line_commands_no_refs)) {
471 $default_valid_nestings{$command} = \%in_full_line_commands_no_refs;
472 }
473
474 # Only for block commands with line arguments
475 foreach my $command (keys(%block_commands)) {
476 if ($block_commands{$command} and $block_commands{$command} ne 'raw'
477 and $block_commands{$command} ne 'conditional'
478 and !$def_commands{$command}) {
479 $default_valid_nestings{$command} = \%in_simple_text_commands;
480 }
481 }
482
483
484 my @preformatted_contexts = ('preformatted', 'rawpreformatted');
485 my %preformatted_contexts;
486 foreach my $preformatted_context (@preformatted_contexts) {
487 $preformatted_contexts{$preformatted_context} = 1;
488 }
489
490 # contexts on the context_stack stack where empty line doesn't trigger
491 # a paragraph
492 my %no_paragraph_contexts;
493 foreach my $no_paragraph_context ('math', 'menu', @preformatted_contexts,
494 'def', 'inlineraw') {
495 $no_paragraph_contexts{$no_paragraph_context} = 1;
496 };
497
498
499
500 # Format a bug message
501 sub _bug_message($$;$$)
502 {
503 my ($self, $message, $line_number, $current) = @_;
504
505 my $line_message = '';
506 if ($line_number) {
507 my $file = $line_number->{'file_name'};
508 $line_message
509 = "last location: $line_number->{'file_name'}:$line_number->{'line_nr'}";
510 if ($line_number->{'macro'} ne '') {
511 $line_message .= " (possibly involving $line_number->{'macro'})";
512 }
513 $line_message .= "\n";
514 }
515 my $message_context_stack = "context_stack: (@{$self->{'context_stack'}})\n";
516 my $current_element_message = '';
517 if ($current) {
518 $current_element_message = "current: ". _print_current($current);
519 }
520 warn "You found a bug: $message\n\n".
521 "Additional informations:\n".
522 $line_message.$message_context_stack.$current_element_message;
523 }
524
525 # simple deep copy of a structure
526 # NOTE: currently not used, dclone is used instead. But in case dclone
527 # happens not to be enough in the future, _deep_copy could be reused.
528 sub _deep_copy($)
529 {
530 my $struct = shift;
531 my $string = Data::Dumper->Dump([$struct], ['struct']);
532 eval $string;
533 return $struct;
534 }
535
536 sub _setup_conf($$$)
537 {
538 my ($parser, $conf, $module_name) = @_;
539
540 if (defined($conf)) {
541 foreach my $key (keys(%$conf)) {
542 if (exists($parser_default_configuration{$key})) {
543 if ($key ne 'values' and ref($conf->{$key})) {
544 $parser->{$key} = dclone($conf->{$key});
545 } else {
546 $parser->{$key} = $conf->{$key};
547 }
548 if ($initialization_overrides{$key}) {
549 $parser->{'set'}->{$key} = $parser->{$key};
550 }
551 } else {
552 warn "$key not a possible customization in $module_name\n";
553 }
554 }
555 }
556 }
557
558 # Duplicate an existing parser.
559 sub duplicate_parser {
560 my $old_parser = shift;
561
562 my $parser = dclone(\%parser_default_configuration);
563
564 foreach my $key (keys(%parser_default_configuration)) {
565 if ($tree_informations{$key}) {
566 if (defined($old_parser->{$key})) {
567 foreach my $info_key (keys(%{$old_parser->{$key}})) {
568 $parser->{$key}->{$info_key}
569 = $old_parser->{$key}->{$info_key};
570 }
571 }
572 } elsif(ref($old_parser->{$key})) {
573 $parser->{$key} = dclone($old_parser->{$key});
574 } else {
575 $parser->{$key} = $old_parser->{$key};
576 }
577 }
578 bless $parser, ref($old_parser);
579
580 return _setup_parser($parser, undef);
581 }
582
583 # initialization entry point. Set up a parser.
584 # The last argument, optional, is a hash provided by the user to change
585 # the default values for what is present in %parser_default_configuration.
586 sub parser(;$$)
587 {
588 my $conf = shift;
589
590 my $parser = dclone(\%parser_default_configuration);
591 bless $parser;
592
593 return _setup_parser($parser, $conf);
594 }
595
596 sub _setup_parser {
597 my ($parser, $conf) = @_;
598
599 _setup_conf($parser, $conf, "Texinfo::Parser::parser");
600
601 # Now initialize command hash that are dynamically modified, notably
602 # those for index commands, and lists, based on defaults and user provided.
603 $parser->{'line_commands'} = dclone(\%line_commands);
604 $parser->{'valid_nestings'} = dclone(\%default_valid_nestings);
605 $parser->{'no_paragraph_commands'} = { %default_no_paragraph_commands };
606 $parser->{'index_names'} = dclone(\%index_names);
607 $parser->{'command_index'} = {%command_index};
608 $parser->{'close_paragraph_commands'} = {%close_paragraph_commands};
609 $parser->{'close_preformatted_commands'} = {%close_preformatted_commands};
610 # a hash is simply concatenated. It should be like %index_names.
611 if (ref($parser->{'indices'}) eq 'HASH') {
612 %{$parser->{'index_names'}} = (%{$parser->{'index_names'}},
613 %{$parser->{'indices'}});
614 } else { # an array holds index names defined with @defindex
615 foreach my $name (@{$parser->{'indices'}}) {
616 $parser->{'index_names'}->{$name} = {'in_code' => 0};
617 }
618 }
619 foreach my $index (keys (%{$parser->{'index_names'}})) {
620 if (!exists($parser->{'index_names'}->{$index}->{'name'})) {
621 $parser->{'index_names'}->{$index}->{'name'} = $index;
622 }
623 if (!exists($parser->{'index_names'}->{$index}->{'contained_indices'})) {
624 $parser->{'index_names'}->{$index}->{'contained_indices'}->{$index} = 1;
625 }
626 foreach my $prefix ($index, substr($index, 0, 1)) {
627 $parser->{'line_commands'}->{$prefix.'index'} = 'line';
628 $parser->{'no_paragraph_commands'}->{$prefix.'index'} = 1;
629 $parser->{'valid_nestings'}->{$prefix.'index'} = \%in_simple_text_commands;
630 $parser->{'command_index'}->{$prefix.'index'} = $index;
631 }
632 }
633 if ($parser->{'merged_indices'}) {
634 foreach my $index_from (keys (%{$parser->{'merged_indices'}})) {
635 my $index_to = $parser->{'merged_indices'}->{$index_from};
636 if (defined($parser->{'index_names'}->{$index_from})
637 and defined($parser->{'index_names'}->{$index_to})) {
638 $parser->{'index_names'}->{$index_from}->{'merged_in'} = $index_to;
639 $parser->{'index_names'}->{$index_to}->{'contained_indices'}->{$index_from} = 1;
640 }
641 }
642 }
643 foreach my $explained_command(keys(%explained_commands)) {
644 if (!defined($parser->{'explained_commands'}->{$explained_command})) {
645 $parser->{'explained_commands'}->{$explained_command} = {};
646 }
647 }
648 $parser->{'context_stack'} = [ '_root' ];
649 $parser->{'regions_stack'} = [];
650 $parser->{'macro_stack'} = [];
651 $parser->{'conditionals_stack'} = [];
652
653 # turn the array to a hash for speed. Not sure it really matters for such
654 # a small array.
655 foreach my $expanded_format(@{$parser->{'expanded_formats'}}) {
656 $parser->{'expanded_formats_hash'}->{$expanded_format} = 1;
657 }
658
659 %{$parser->{'global_commands'}} = %global_multiple_commands;
660
661 $parser->Texinfo::Report::new;
662
663 return $parser;
664 }
665
666 # simple parser initialization, fit for strings of Texinfo, not whole
667 # documents, targetting speed.
668 # all the simple_parsers share the dynamic informations
669 my $simple_parser_line_commands = dclone(\%line_commands);
670 my $simple_parser_valid_nestings = dclone(\%default_valid_nestings);
671 my $simple_parser_no_paragraph_commands = { %default_no_paragraph_commands };
672 my $simple_parser_index_names = dclone(\%index_names);
673 my $simple_parser_command_index = {%command_index};
674 my $simple_parser_close_paragraph_commands = {%close_paragraph_commands};
675 my $simple_parser_close_preformatted_commands = {%close_preformatted_commands};
676 sub simple_parser(;$)
677 {
678 my $conf = shift;
679
680 my $parser = dclone(\%parser_default_configuration);
681 bless $parser;
682
683 _setup_conf($parser, $conf, "Texinfo::Parser::simple_parser");
684
685 $parser->{'line_commands'} = $simple_parser_line_commands;
686 $parser->{'valid_nestings'} = $simple_parser_valid_nestings;
687 $parser->{'no_paragraph_commands'} = $simple_parser_no_paragraph_commands;
688 $parser->{'index_names'} = $simple_parser_index_names;
689 $parser->{'command_index'} = $simple_parser_command_index;
690 $parser->{'close_paragraph_commands'} = $simple_parser_close_paragraph_commands;
691 $parser->{'close_preformatted_commands'} = $simple_parser_close_preformatted_commands;
692
693 foreach my $explained_command(keys(%explained_commands)) {
694 if (!defined($parser->{'explained_commands'}->{$explained_command})) {
695 $parser->{'explained_commands'}->{$explained_command} = {};
696 }
697 }
698 $parser->{'context_stack'} = [ '_root' ];
699 $parser->{'regions_stack'} = [];
700 $parser->{'macro_stack'} = [];
701 $parser->{'conditionals_stack'} = [];
702
703 # turn the array to a hash for speed. Not sure it really matters for such
704 # a small array.
705 foreach my $expanded_format(@{$parser->{'expanded_formats'}}) {
706 $parser->{'expanded_formats_hash'}->{$expanded_format} = 1;
707 }
708
709 %{$parser->{'global_commands'}} = ();
710
711 $parser->Texinfo::Report::new;
712
713 return $parser;
714 }
715
716 sub get_conf($$)
717 {
718 my ($self, $var) = @_;
719 return $self->{$var};
720 }
721
722 # split a scalar text in an array lines.
723 sub _text_to_lines($)
724 {
725 my $text = shift;
726 die if (!defined($text));
727 my $had_final_end_line = chomp($text);
728 my $lines = [ map {$_."\n"} split (/\n/, $text, -1) ];
729 chomp($lines->[-1]) unless (!@$lines or $had_final_end_line);
730 return $lines;
731 }
732
733 # construct a text fragments array matching a lines array, based on information
734 # supplied.
735 # If $fixed_line_number is set the line number is not increased, otherwise
736 # it is increased, beginning at $first_line.
737 sub _complete_line_nr($$;$$$)
738 {
739 my ($lines, $first_line, $file, $macro, $fixed_line_number) = @_;
740
741 $macro = '' if (!defined($macro));
742 $file = '' if (!defined($file));
743 my $new_lines = [];
744
745 if (defined($first_line)) {
746 my $line_index = $first_line;
747 foreach my $index(0..scalar(@$lines)-1) {
748 $line_index = $index+$first_line if (!$fixed_line_number);
749 $new_lines->[$index] = [ $lines->[$index],
750 { 'line_nr' => $line_index,
751 'file_name' => $file, 'macro' => $macro } ];
752 }
753 } else {
754 foreach my $line (@$lines) {
755 push @$new_lines, [ $line ];
756 }
757 }
758 return $new_lines;
759 }
760
761 # entry point for text fragments.
762 # Used in tests.
763 # Note that it has no associated root type a opposed to parse_texi_line
764 # and parse_texi_file.
765 sub parse_texi_text($$;$$$$)
766 {
767 my ($self, $text, $lines_nr, $file, $macro, $fixed_line_number) = @_;
768
769 return undef if (!defined($text));
770
771 my $lines_array = [];
772 if (!ref($text)) {
773 $text = _text_to_lines($text);
774 }
775 $lines_nr = [] if (!defined($lines_nr));
776 if (!ref($lines_nr)) {
777 #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
778 $lines_array = _complete_line_nr($text, $lines_nr, $file,
779 $macro, $fixed_line_number);
780 } else {
781 while (@$text) {
782 my $line_nr = shift @$lines_nr;
783 my $line = shift @$text;
784 push @$lines_array, [$line, $line_nr];
785 }
786 }
787
788 $self = parser() if (!defined($self));
789 $self->{'input'} = [{'pending' => $lines_array}];
790 my $tree = $self->_parse_texi();
791 return $tree;
792 }
793
794 # parse a texi file
795 sub parse_texi_file($$)
796 {
797 my ($self, $file_name) = @_;
798
799 my $filehandle = do { local *FH };
800 if (! open($filehandle, $file_name)) {
801 $self->document_error(sprintf(__("could not open %s: %s"),
802 $file_name, $!));
803 return undef;
804 }
805 my $line_nr = 0;
806 my $line;
807 my @first_lines;
808
809 my $pending_first_texi_line;
810 # the first line not empty and not with \input is kept in
811 # $pending_first_texi_line and put in the pending lines just below
812 while ($line = <$filehandle>) {
813 $line_nr++;
814 if ($line =~ /^ *\\input/ or $line =~ /^\s*$/) {
815 $line =~ s/\x{7F}.*\s*//;
816 push @first_lines, $line;
817 } else {
818 $pending_first_texi_line = $line;
819 last;
820 }
821 }
822 my $root = { 'contents' => [], 'type' => 'text_root' };
823 if (@first_lines) {
824 push @{$root->{'contents'}}, { 'type' => 'preamble', 'contents' => [],
825 'parent' => $root };
826 foreach my $line (@first_lines) {
827 push @{$root->{'contents'}->[-1]->{'contents'}},
828 { 'text' => $line,
829 'type' => 'preamble_text',
830 'parent' => $root->{'contents'}->[-1]
831 };
832 }
833 }
834 my ($directories, $suffix);
835 ($file_name, $directories, $suffix) = fileparse($file_name)
836 if ($self->{'TEST'});
837 $self = parser() if (!defined($self));
838 $self->{'input'} = [{
839 'pending' => [[$pending_first_texi_line, {'line_nr' => $line_nr,
840 'macro' => '', 'file_name' => $file_name}]],
841 'name' => $file_name,
842 'line_nr' => $line_nr,
843 'fh' => $filehandle
844 }];
845 $self->{'info'}->{'input_file_name'} = $file_name;
846 $self->{'info'}->{'input_directory'} = $directories;
847 my $tree = $self->_parse_texi($root);
848
849 # Find 'text_root', which contains everything before first node/section.
850 # if there are elements, 'text_root' is the first content, otherwise it
851 # is the root.
852 my $text_root;
853 if ($tree->{'type'} eq 'text_root') {
854 $text_root = $tree;
855 } elsif ($tree->{'contents'} and $tree->{'contents'}->[0]
856 and $tree->{'contents'}->[0]->{'type'} eq 'text_root') {
857 $text_root = $tree->{'contents'}->[0];
858 }
859
860 # Put everything before @setfilename in a special type. This allows to
861 # ignore everything before @setfilename.
862 if ($self->{'IGNORE_BEFORE_SETFILENAME'} and $text_root and
863 $self->{'extra'} and $self->{'extra'}->{'setfilename'}
864 and $self->{'extra'}->{'setfilename'}->{'parent'} eq $text_root) {
865 my $before_setfilename = {'type' => 'preamble_before_setfilename',
866 'parent' => $text_root,
867 'contents' => []};
868 while ($text_root->{'contents'}->[0] ne $self->{'extra'}->{'setfilename'}) {
869 my $content = shift @{$text_root->{'contents'}};
870 $content->{'parent'} = $before_setfilename;
871 push @{$before_setfilename->{'contents'}}, $content;
872 }
873 unshift (@{$text_root->{'contents'}}, $before_setfilename)
874 if (@{$before_setfilename->{'contents'}});
875 }
876 #$self->_check_contents_location($tree);
877
878 return $tree;
879 }
880
881 sub parse_texi_line($$;$$$$)
882 {
883 my ($self, $text, $lines_nr, $file, $macro, $fixed_line_number) = @_;
884
885 return undef if (!defined($text));
886
887 if (!ref($text)) {
888 $text = _text_to_lines($text);
889 }
890 #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
891 my $lines_array = _complete_line_nr($text, $lines_nr, $file,
892 $macro, $fixed_line_number);
893
894 $self = parser() if (!defined($self));
895 $self->{'input'} = [{'pending' => $lines_array}];
896 my $tree = $self->_parse_texi({'contents' => [], 'type' => 'root_line'});
897 return $tree;
898 }
899
900 # return indices informations
901 sub indices_information($)
902 {
903 my $self = shift;
904 return $self->{'index_names'};
905 }
906
907 sub floats_information($)
908 {
909 my $self = shift;
910 return $self->{'floats'};
911 }
912
913 sub internal_references_information($)
914 {
915 my $self = shift;
916 return $self->{'internal_references'};
917 }
918
919 sub global_commands_information($)
920 {
921 my $self = shift;
922 return $self->{'extra'};
923 }
924
925 # @ dircategory_direntry
926 # perl_encoding
927 # input_encoding_name
928 # input_file_name
929 sub global_informations($)
930 {
931 my $self = shift;
932 return $self->{'info'};
933 }
934
935 # Setup labels and nodes info and return labels
936 sub labels_information
937 {
938 goto &Texinfo::Common::labels_information;
939 }
940
941 # Following are the internal subroutines. The most important are
942 # _parse_texi: the main parser loop.
943 # _end_line: called at an end of line. Handling of @include lines is
944 # done here.
945 # _next_text: present the next text fragment, from pending text or line,
946 # as described above.
947
948 # for debugging
949 sub _print_current($)
950 {
951 my $current = shift;
952 return Texinfo::Common::_print_current($current);
953 }
954
955 # for debugging
956 sub _print_command_args_texi($)
957 {
958 my $current = shift;
959 return '' if (!$current->{'cmdname'});
960 my $args = '';
961 my $with_brace;
962 if ($current->{'args'} and @{$current->{'args'}}) {
963 $with_brace
964 = ($current->{'args'}->[0]->{'type'} eq 'brace_command_arg'
965 or $current->{'args'}->[0]->{'type'} eq 'brace_command_context');
966 $args .= '{' if ($with_brace);
967 foreach my $arg (@{$current->{'args'}}) {
968 $args .= Texinfo::Convert::Texinfo::convert($arg).', ';
969 }
970 $args =~ s/, $//;
971 }
972 chomp($args);
973 if ($with_brace) {
974 $args .= '}';
975 }
976 return '@'.$current->{'cmdname'} .$args."\n";
977 }
978
979 sub _print_current_keys($)
980 {
981 my $current = shift;
982 my $string = _print_current($current);
983 foreach my $key (keys (%$current)) {
984 $string .= " $key: $current->{$key}\n";
985 }
986 if ($current->{'extra'}) {
987 $string .= " EXTRA\n";
988 foreach my $key (keys (%{$current->{'extra'}})) {
989 $string .= " $key: $current->{'extra'}->{$key}\n";
990 }
991 }
992 return $string;
993 }
994
995 # For debugging
996 sub _print_tree($)
997 {
998 my $tree = shift;
999
1000 return Texinfo::Common::print_tree($tree);
1001 }
1002
1003 sub _register_global_command {
1004 my ($self, $current, $line_nr) = @_;
1005
1006 my $command = $current->{'cmdname'};
1007
1008 if ($command eq 'summarycontents' and !$self->{'global_commands'}->{$command}) {
1009 $command = 'shortcontents';
1010 }
1011 if ($self->{'global_commands'}->{$command}) {
1012 push @{$self->{'extra'}->{$command}}, $current;
1013 $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
1014 return 1;
1015 } elsif ($global_unique_commands{$command}) {
1016 # setfilename ignored in an included file
1017 $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
1018 if ($command eq 'setfilename'
1019 and scalar(@{$self->{'input'}}) > 1) {
1020 } elsif (exists ($self->{'extra'}->{$current->{'cmdname'}})) {
1021 $self->line_warn(sprintf(__('multiple @%s'),
1022 $current->{'cmdname'}), $line_nr);
1023 } else {
1024 $self->{'extra'}->{$current->{'cmdname'}} = $current;
1025 }
1026 return 1;
1027 }
1028 return 0;
1029 }
1030
1031 # parse a @macro line
1032 sub _parse_macro_command_line($$$$$;$)
1033 {
1034 my ($self, $command, $line, $parent, $line_nr) = @_;
1035
1036 my $macro = { 'cmdname' => $command, 'parent' => $parent, 'contents' => [],
1037 'extra' => {'arg_line' => $line}, 'line_nr' => $line_nr };
1038 # REMACRO
1039 if ($line =~ /^\s+([[:alnum:]][[:alnum:]_-]*)\s*(.*)/) {
1040 my $macro_name = $1;
1041 my $args_def = $2;
1042 my @args;
1043
1044 if ($args_def =~ s/^\s*{\s*(.*?)\s*}\s*//) {
1045 @args = split(/\s*,\s*/, $1);
1046 }
1047
1048 print STDERR "MACRO \@$command $macro_name\n" if ($self->{'DEBUG'});
1049
1050 $macro->{'args'} = [
1051 { 'type' => 'macro_name', 'text' => $macro_name,
1052 'parent' => $macro } ];
1053 my $index = 0;
1054 foreach my $formal_arg (@args) {
1055 push @{$macro->{'args'}},
1056 { 'type' => 'macro_arg', 'text' => $formal_arg,
1057 'parent' => $macro};
1058 if ($formal_arg !~ /^[\w\-]+$/) {
1059 $self->line_error(sprintf(__("bad or empty \@%s formal argument: %s"),
1060 $command, $formal_arg), $line_nr);
1061 $macro->{'extra'}->{'invalid_syntax'} = 1;
1062 }
1063 $macro->{'extra'}->{'args_index'}->{$formal_arg} = $index;
1064 $index++;
1065 }
1066 # accept an @-command after the arguments in case there is a @c or
1067 # @comment
1068 if ($args_def =~ /^\s*[^\@]/) {
1069 $self->line_error(sprintf(__("bad syntax for \@%s argument: %s"),
1070 $command, $args_def),
1071 $line_nr);
1072 $macro->{'extra'}->{'invalid_syntax'} = 1;
1073 }
1074 } elsif ($line !~ /\S/) {
1075 $self->line_error(sprintf(
1076 __("%c%s requires a name"), ord('@'), $command), $line_nr);
1077 $macro->{'extra'}->{'invalid_syntax'} = 1;
1078 } else {
1079 $self->line_error(sprintf(
1080 __("bad name for \@%s"), $command), $line_nr);
1081 $macro->{'extra'}->{'invalid_syntax'} = 1;
1082 }
1083 return $macro;
1084 }
1085
1086 # start a paragraph if in a context where paragraphs are to be started.
1087 sub _begin_paragraph($$;$)
1088 {
1089 my ($self, $current, $line_nr) = @_;
1090
1091 # !$current->{'type'} is true for @-commands. In fact it is unclear
1092 # that there may be cases of !$current->{'type'} and !$current->{'cmdname'}
1093 if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
1094 and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
1095 if (!defined($current->{'contents'})) {
1096 $self->_bug_message("contents undef", $line_nr, $current);
1097 die;
1098 }
1099
1100 # find whether an @indent precedes the paragraph
1101 my $indent;
1102 if (scalar(@{$current->{'contents'}})) {
1103 my $index = scalar(@{$current->{'contents'}}) -1;
1104 while ($index >= 0
1105 and !($current->{'contents'}->[$index]->{'type'}
1106 and ($current->{'contents'}->[$index]->{'type'} eq 'empty_line'
1107 or $current->{'contents'}->[$index]->{'type'} eq 'paragraph'))
1108 and !($current->{'contents'}->[$index]->{'cmdname'}
1109 and $self->{'close_paragraph_commands'}->{$current->{'contents'}->[$index]->{'cmdname'}})) {
1110 if ($current->{'contents'}->[$index]->{'cmdname'}
1111 and ($current->{'contents'}->[$index]->{'cmdname'} eq 'indent'
1112 or $current->{'contents'}->[$index]->{'cmdname'} eq 'noindent')) {
1113 $indent = $current->{'contents'}->[$index]->{'cmdname'};
1114 last;
1115 }
1116 $index--;
1117 }
1118 }
1119 push @{$current->{'contents'}},
1120 { 'type' => 'paragraph', 'parent' => $current, 'contents' => [] };
1121 $current->{'contents'}->[-1]->{'extra'}->{$indent} = 1 if ($indent);
1122 $current = $current->{'contents'}->[-1];
1123 print STDERR "PARAGRAPH\n" if ($self->{'DEBUG'});
1124 return $current;
1125 }
1126 return 0;
1127 }
1128
1129 sub _begin_preformatted($$)
1130 {
1131 my ($self, $current) = @_;
1132
1133 if ($preformatted_contexts{$self->{'context_stack'}->[-1]}) {
1134 push @{$current->{'contents'}},
1135 { 'type' => $self->{'context_stack'}->[-1],
1136 'parent' => $current, 'contents' => [] };
1137 $current = $current->{'contents'}->[-1];
1138 print STDERR "PREFORMATTED $self->{'context_stack'}->[-1]\n" if ($self->{'DEBUG'});
1139 }
1140 return $current;
1141 }
1142
1143 # wrapper around line_warn. Set line_nr to be the line_nr of the command,
1144 # corresponding to the opening of the command. Call line_warn with
1145 # sprintf if needed.
1146 sub _command_warn($$$$;@)
1147 {
1148 my $self = shift;
1149 my $current = shift;
1150 my $line_nr = shift;
1151 my $message = shift;
1152
1153 if ($current->{'line_nr'}) {
1154 $line_nr = $current->{'line_nr'};
1155 }
1156 if (@_) {
1157 $self->line_warn(sprintf($message, @_), $line_nr);
1158 } else {
1159 $self->line_warn($message, $line_nr);
1160 }
1161 }
1162
1163 sub _command_error($$$$;@)
1164 {
1165 my $self = shift;
1166 my $current = shift;
1167 my $line_nr = shift;
1168 my $message = shift;
1169
1170 # use the beginning of the @-command for the error message
1171 # line number if available.
1172 # FIXME line_nr currently not registered for regular brace commands
1173 if ($current->{'line_nr'}) {
1174 $line_nr = $current->{'line_nr'};
1175 }
1176 if (@_) {
1177 $self->line_error(sprintf($message, @_), $line_nr);
1178 } else {
1179 $self->line_error($message, $line_nr);
1180 }
1181 }
1182
1183 # currently doesn't do much more than
1184 # return $_[1]->{'parent'}
1185 sub _close_brace_command($$$;$$)
1186 {
1187 my ($self, $current, $line_nr, $closed_command,
1188 $interrupting_command) = @_;
1189
1190 if ($current->{'cmdname'} ne 'verb'
1191 or $current->{'extra'}->{'delimiter'} eq '') {
1192 if (defined($closed_command)) {
1193 $self->_command_error($current, $line_nr,
1194 __("\@end %s seen before \@%s closing brace"),
1195 $closed_command, $current->{'cmdname'});
1196 } elsif (defined($interrupting_command)) {
1197 $self->_command_error($current, $line_nr,
1198 __("\@%s seen before \@%s closing brace"),
1199 $interrupting_command, $current->{'cmdname'});
1200
1201 } else {
1202 $self->_command_error($current, $line_nr,
1203 __("%c%s missing closing brace"), ord('@'), $current->{'cmdname'});
1204 }
1205 } else {
1206 $self->_command_error($current, $line_nr,
1207 __("\@%s missing closing delimiter sequence: %s}"),
1208 $current->{'cmdname'}, $current->{'extra'}->{'delimiter'});
1209 }
1210 $current = $current->{'parent'};
1211 return $current;
1212 }
1213
1214 sub _in_code($$)
1215 {
1216 my ($self, $current) = @_;
1217
1218 while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1219 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}
1220 and !exists $context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
1221 return 1 if ($code_style_commands{$current->{'parent'}->{'cmdname'}});
1222 $current = $current->{'parent'}->{'parent'};
1223 }
1224 return 0;
1225 }
1226
1227 # close brace commands, that don't set a new context (ie @caption, @footnote)
1228 sub _close_all_style_commands($$$;$$)
1229 {
1230 my ($self, $current, $line_nr, $closed_command,
1231 $interrupting_command) = @_;
1232
1233 while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1234 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}
1235 and !exists $context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
1236 $current = _close_brace_command($self, $current->{'parent'}, $line_nr,
1237 $closed_command, $interrupting_command);
1238 }
1239 return $current;
1240 }
1241
1242 # close brace commands except for @caption, @footnote then the paragraph
1243 sub _end_paragraph($$$;$$)
1244 {
1245 my ($self, $current, $line_nr, $closed_command,
1246 $interrupting_command) = @_;
1247
1248 $current = _close_all_style_commands($self, $current, $line_nr,
1249 $closed_command, $interrupting_command);
1250 if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
1251 print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
1252 $current = $current->{'parent'};
1253 }
1254 return $current;
1255 }
1256
1257 # close brace commands except for @caption, @footnote then the preformatted
1258 sub _end_preformatted($$$;$$)
1259 {
1260 my ($self, $current, $line_nr, $closed_command,
1261 $interrupting_command) = @_;
1262
1263 $current = _close_all_style_commands($self, $current, $line_nr,
1264 $closed_command, $interrupting_command);
1265 if ($current->{'type'} and $preformatted_contexts{$current->{'type'}}) {
1266 print STDERR "CLOSE PREFORMATTED $current->{'type'}\n" if ($self->{'DEBUG'});
1267 # completly remove void preformatted contexts
1268 if (!@{$current->{'contents'}}) {
1269 my $removed = pop @{$current->{'parent'}->{'contents'}};
1270 print STDERR "popping $removed->{'type'}\n" if ($self->{'DEBUG'});
1271 }
1272 $current = $current->{'parent'};
1273 }
1274 return $current;
1275 }
1276
1277 # check that there are no text holding environment (currently
1278 # checking only paragraphs and preformatted) in contents
1279 sub _check_no_text($)
1280 {
1281 my $current = shift;
1282 my $after_paragraph = 0;
1283 foreach my $content (@{$current->{'contents'}}) {
1284 if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
1285 $after_paragraph = 1;
1286 last;
1287 } elsif ($content->{'type'} and $preformatted_contexts{$content->{'type'}}) {
1288 foreach my $preformatted_content (@{$content->{'contents'}}) {
1289 if ((defined($preformatted_content->{'text'})
1290 and $preformatted_content->{'text'} =~ /\S/)
1291 or ($preformatted_content->{'cmdname'}
1292 and ($preformatted_content->{'cmdname'} ne 'c'
1293 and $preformatted_content->{'cmdname'} ne 'comment')
1294 and !($preformatted_content->{'type'}
1295 and $preformatted_content->{'type'} eq 'index_entry_command'))) {
1296 $after_paragraph = 1;
1297 last;
1298 }
1299 }
1300 last if ($after_paragraph);
1301 }
1302 }
1303 return $after_paragraph;
1304 }
1305
1306 # put everything after the last @item/@itemx in an item_table type container
1307 # and distinguish table_term and table_entry.
1308 sub _gather_previous_item($$;$$)
1309 {
1310 my ($self, $current, $next_command, $line_nr) = @_;
1311
1312 # nothing to do in that case.
1313 if ($current->{'contents'}->[-1]->{'type'}
1314 and $current->{'contents'}->[-1]->{'type'} eq 'before_item') {
1315 if ($next_command and $next_command eq 'itemx') {
1316 $self->line_warn(sprintf(__("\@itemx should not begin \@%s"),
1317 $current->{'cmdname'}), $line_nr);
1318 }
1319 return;
1320 }
1321 my $type;
1322 # if before an itemx, the type is different since there should not be
1323 # real content, so it may be treated differently
1324 if ($next_command and $next_command eq 'itemx') {
1325 $type = 'inter_item';
1326 } else {
1327 $type = 'table_item';
1328 }
1329 my $table_gathered = {'type' => $type,
1330 'contents' => []};
1331 # remove everything that is not an @item/@items or before_item to
1332 # put it in the table_item, starting from the end.
1333 my $contents_count = scalar(@{$current->{'contents'}});
1334 for (my $i = 0; $i < $contents_count; $i++) {
1335 if ($current->{'contents'}->[-1]->{'cmdname'}
1336 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'item'
1337 or ($current->{'contents'}->[-1]->{'cmdname'} eq 'itemx'))) {
1338 last;
1339 } else {
1340 my $item_content = pop @{$current->{'contents'}};
1341 $item_content->{'parent'} = $table_gathered;
1342 unshift @{$table_gathered->{'contents'}}, $item_content;
1343 }
1344 }
1345 if ($type eq 'table_item') {
1346 my $table_entry = {'type' => 'table_entry',
1347 'parent' => $current,
1348 'contents' => []};
1349 my $table_term = {'type' => 'table_term',
1350 'parent' => $table_entry,
1351 'contents' => []};
1352 push @{$table_entry->{'contents'}}, $table_term;
1353 my $contents_count = scalar(@{$current->{'contents'}});
1354 for (my $i = 0; $i < $contents_count; $i++) {
1355 if ($current->{'contents'}->[-1]->{'type'}
1356 and ($current->{'contents'}->[-1]->{'type'} eq 'before_item'
1357 or $current->{'contents'}->[-1]->{'type'} eq 'table_entry')) {
1358 last;
1359 } else {
1360 my $item_content = pop @{$current->{'contents'}};
1361 $item_content->{'parent'} = $table_term;
1362 unshift @{$table_term->{'contents'}}, $item_content;
1363 # debug
1364 if (! (($item_content->{'cmdname'}
1365 and ($item_content->{'cmdname'} eq 'itemx'
1366 or $item_content->{'cmdname'} eq 'item'))
1367 or ($item_content->{'type'}
1368 and $item_content->{'type'} eq 'inter_item'))) {
1369 $self->_bug_message("wrong element in table term", $line_nr,
1370 $item_content);
1371 }
1372 }
1373 }
1374 push @{$current->{'contents'}}, $table_entry;
1375 if (scalar(@{$table_gathered->{'contents'}})) {
1376 push @{$table_entry->{'contents'}}, $table_gathered;
1377 $table_gathered->{'parent'} = $table_entry;
1378 }
1379 } else {
1380 my $after_paragraph = _check_no_text($table_gathered);
1381 if ($after_paragraph) {
1382 $self->line_error(__("\@itemx must follow \@item"), $line_nr);
1383 }
1384 if (scalar(@{$table_gathered->{'contents'}})) {
1385 push @{$current->{'contents'}}, $table_gathered;
1386 $table_gathered->{'parent'} = $current;
1387 }
1388 }
1389 }
1390
1391 # Starting from the end, gather everything util the def_line to put in
1392 # a def_item
1393 sub _gather_def_item($;$)
1394 {
1395 my ($current, $next_command) = @_;
1396
1397 my $type;
1398 # means that we are between a @def*x and a @def
1399 if ($next_command) {
1400 $type = 'inter_def_item';
1401 } else {
1402 $type = 'def_item';
1403 }
1404
1405 # This may happen for a construct like
1406 # @deffnx a b @section
1407 # but otherwise the end of line will lead to the command closing
1408 return if (!$current->{'cmdname'} or $current->{'cmdname'} =~ /x$/);
1409 my $def_item = {'type' => $type,
1410 'parent' => $current,
1411 'contents' => []};
1412 # remove everything that is not a def_line to put it in the def_item,
1413 # starting from the end.
1414 my $contents_count = scalar(@{$current->{'contents'}});
1415 for (my $i = 0; $i < $contents_count; $i++) {
1416 if ($current->{'contents'}->[-1]->{'type'}
1417 and $current->{'contents'}->[-1]->{'type'} eq 'def_line') {
1418 # and !$current->{'contents'}->[-1]->{'extra'}->{'not_after_command'}) {
1419 last;
1420 } else {
1421 my $item_content = pop @{$current->{'contents'}};
1422 $item_content->{'parent'} = $def_item;
1423 unshift @{$def_item->{'contents'}}, $item_content;
1424 }
1425 }
1426 if (scalar(@{$def_item->{'contents'}})) {
1427 push @{$current->{'contents'}}, $def_item;
1428 }
1429 }
1430
1431 # close formats
1432 sub _close_command_cleanup($$) {
1433 my ($self, $current) = @_;
1434
1435 return unless ($current->{'cmdname'});
1436 # remove the dynamic counters in multitable, they are not of use in the final
1437 # tree. Also determine the multitable_body and multitable_head with
1438 # @item or @headitem rows.
1439 if ($current->{'cmdname'} eq 'multitable') {
1440 my $in_head_or_rows;
1441 my @contents = @{$current->{'contents'}};
1442 $current->{'contents'} = [];
1443 foreach my $row (@contents) {
1444 if ($row->{'type'} and $row->{'type'} eq 'row') {
1445 delete $row->{'cells_count'};
1446 if ($row->{'contents'}->[0]->{'cmdname'} eq 'headitem') {
1447 if (!$in_head_or_rows) {
1448 push @{$current->{'contents'}}, {'type' => 'multitable_head',
1449 'parent' => $current};
1450 $in_head_or_rows = 1;
1451 }
1452 } elsif ($row->{'contents'}->[0]->{'cmdname'} eq 'item') {
1453 if (!defined($in_head_or_rows) or $in_head_or_rows) {
1454 push @{$current->{'contents'}}, {'type' => 'multitable_body',
1455 'parent' => $current};
1456 $in_head_or_rows = 0;
1457 }
1458 }
1459 push @{$current->{'contents'}->[-1]->{'contents'}}, $row;
1460 $row->{'parent'} = $current->{'contents'}->[-1];
1461 } else {
1462 push @{$current->{'contents'}}, $row;
1463 $in_head_or_rows = undef;
1464 }
1465 }
1466 delete $current->{'rows_count'};
1467 } elsif ($item_container_commands{$current->{'cmdname'}}) {
1468 delete $current->{'items_count'};
1469 }
1470
1471 # put everything after the last @def*x command in a def_item type container.
1472 if ($def_commands{$current->{'cmdname'}}) {
1473 # At this point the end command hasn't been added to the command contents.
1474 # so checks cannot be done at this point.
1475 _gather_def_item($current);
1476 }
1477
1478 if ($item_line_commands{$current->{'cmdname'}}) {
1479 # At this point the end command hasn't been added to the command contents.
1480 # so checks cannot be done at this point.
1481 if (@{$current->{'contents'}}) {
1482 _gather_previous_item($self, $current);
1483 }
1484 }
1485
1486 # put end out of before_item, and replace it at the end of the parent.
1487 # remove empty before_item.
1488 # warn if not empty before_item, but format is empty
1489 if ($block_item_commands{$current->{'cmdname'}}) {
1490 if (@{$current->{'contents'}}) {
1491 my $leading_spaces = 0;
1492 my $before_item;
1493 if ($current->{'contents'}->[0]->{'type'}
1494 and $current->{'contents'}->[0]->{'type'} eq 'empty_line_after_command'
1495 and $current->{'contents'}->[1]
1496 and $current->{'contents'}->[1]->{'type'}
1497 and $current->{'contents'}->[1]->{'type'} eq 'before_item') {
1498 $leading_spaces = 1;
1499 $before_item = $current->{'contents'}->[1];
1500 } elsif ($current->{'contents'}->[0]->{'type'}
1501 and $current->{'contents'}->[0]->{'type'} eq 'before_item') {
1502 $before_item = $current->{'contents'}->[0];
1503 }
1504 if ($before_item) {
1505 if ($current->{'extra'}->{'end_command'}
1506 and @{$before_item->{'contents'}}
1507 and $before_item->{'contents'}->[-1] eq $current->{'extra'}->{'end_command'}) {
1508 my $end = pop @{$before_item->{'contents'}};
1509 $end->{'parent'} = $current;
1510 push @{$current->{'contents'}}, $end;
1511 }
1512 # remove empty before_items
1513 if (!@{$before_item->{'contents'}}) {
1514 if ($leading_spaces) {
1515 my $space = shift @{$current->{'contents'}};
1516 shift @{$current->{'contents'}};
1517 unshift @{$current->{'contents'}}, $space;
1518 } else {
1519 shift @{$current->{'contents'}};
1520 }
1521 } else {
1522 # warn if not empty before_item, but format is empty
1523 my $empty_before_item = 1;
1524 foreach my $before_item_content (@{$before_item->{'contents'}}) {
1525 if (!$before_item_content->{'cmdname'} or
1526 ($before_item_content->{'cmdname'} ne 'c'
1527 and $before_item_content->{'cmdname'} ne 'comment')) {
1528 $empty_before_item = 0;
1529 last;
1530 }
1531 }
1532 if (!$empty_before_item) {
1533 my $empty_format = 1;
1534 foreach my $format_content (@{$current->{'contents'}}) {
1535 next if ($format_content eq $before_item);
1536 if (($format_content->{'cmdname'} and
1537 ($format_content->{'cmdname'} ne 'c'
1538 and $format_content->{'cmdname'} ne 'comment'
1539 and $format_content->{'cmdname'} ne 'end'))
1540 or ($format_content->{'type'} and
1541 ($format_content->{'type'} ne 'empty_line_after_command'))) {
1542 $empty_format = 0;
1543 last;
1544 }
1545 }
1546 if ($empty_format) {
1547 $self->line_warn(sprintf(__("\@%s has text but no \@item"),
1548 $current->{'cmdname'}), $current->{'line_nr'});
1549 }
1550 }
1551 }
1552 }
1553 }
1554 }
1555 }
1556
1557 # close the current command, with error messages and give the parent.
1558 # If the last argument is given it is the command being closed if
1559 # hadn't there be an error, currently only block command, used for a
1560 # better error message.
1561 sub _close_current($$$;$$)
1562 {
1563 my ($self, $current, $line_nr, $closed_command,
1564 $interrupting_command) = @_;
1565
1566 if ($current->{'cmdname'}) {
1567 print STDERR "CLOSING(_close_current) \@$current->{'cmdname'}\n" if ($self->{'DEBUG'});
1568 if (exists($brace_commands{$current->{'cmdname'}})) {
1569 pop @{$self->{'context_stack'}}
1570 if (exists $context_brace_commands{$current->{'cmdname'}});
1571 $current = _close_brace_command($self, $current, $line_nr,
1572 $closed_command, $interrupting_command);
1573 } elsif (exists($block_commands{$current->{'cmdname'}})) {
1574 if (defined($closed_command)) {
1575 $self->line_error(sprintf(__("`\@end' expected `%s', but saw `%s'"),
1576 $current->{'cmdname'}, $closed_command), $line_nr);
1577 } elsif ($interrupting_command) {
1578 $self->line_error(sprintf(__("\@%s seen before \@end %s"),
1579 $interrupting_command, $current->{'cmdname'}),
1580 $line_nr);
1581 } else {
1582 $self->line_error(sprintf(__("no matching `%cend %s'"),
1583 ord('@'), $current->{'cmdname'}), $line_nr);
1584 if ($block_commands{$current->{'cmdname'}} eq 'conditional') {
1585 # in this case we are within an ignored conditional
1586 my $conditional = pop @{$current->{'parent'}->{'contents'}};
1587 }
1588 }
1589 if ($preformatted_commands{$current->{'cmdname'}}
1590 or $menu_commands{$current->{'cmdname'}}
1591 or $format_raw_commands{$current->{'cmdname'}}) {
1592 my $context = pop @{$self->{'context_stack'}};
1593 }
1594 pop @{$self->{'regions_stack'}}
1595 if ($region_commands{$current->{'cmdname'}});
1596 $current = $current->{'parent'};
1597 } else {
1598 # There @item and @tab commands are closed, and also line commands
1599 # with invalid content
1600 $current = $current->{'parent'};
1601 }
1602 } elsif ($current->{'type'}) {
1603 print STDERR "CLOSING type $current->{'type'}\n" if ($self->{'DEBUG'});
1604 if ($current->{'type'} eq 'bracketed') {
1605 $self->_command_error($current, $line_nr,
1606 __("misplaced %c"), ord('{'));
1607 if ($current->{'contents'}
1608 and @{$current->{'contents'}}
1609 and $current->{'contents'}->[0]->{'type'}
1610 and $current->{'contents'}->[0]->{'type'}
1611 eq 'empty_spaces_before_argument') {
1612 # remove spaces element from tree and update extra values
1613 _abort_empty_line($self, $current)
1614 }
1615
1616 } elsif ($current->{'type'} eq 'menu_comment'
1617 or $current->{'type'} eq 'menu_entry_description') {
1618 my $context = pop @{$self->{'context_stack'}};
1619 if ($context ne 'preformatted') {
1620 $self->_bug_message("context $context instead of preformatted",
1621 $line_nr, $current);
1622 }
1623 # close empty menu_comment
1624 if (!@{$current->{'contents'}}) {
1625 pop @{$current->{'parent'}->{'contents'}};
1626 }
1627 } elsif ($current->{'type'} eq 'line_arg'
1628 or $current->{'type'} eq 'block_line_arg') {
1629 my $context = pop @{$self->{'context_stack'}};
1630 if ($context ne 'line' and $context ne 'def') {
1631 $self->_bug_message("context $context instead of line or def",
1632 $line_nr, $current);
1633 die;
1634 }
1635 }
1636 $current = $current->{'parent'};
1637 } else { # Should never go here.
1638 $current = $current->{'parent'} if ($current->{'parent'});
1639 $self->_bug_message("No type nor cmdname when closing",
1640 $line_nr, $current);
1641 }
1642 return $current;
1643 }
1644
1645 # a closed_command arg means closing until that command is found.
1646 # no command arg means closing until the root or a root_command
1647 # is found.
1648 sub _close_commands($$$;$$)
1649 {
1650 my ($self, $current, $line_nr, $closed_command,
1651 $interrupting_command) = @_;
1652
1653 $current = _end_paragraph($self, $current, $line_nr, $closed_command,
1654 $interrupting_command);
1655 $current = _end_preformatted($self, $current, $line_nr, $closed_command,
1656 $interrupting_command);
1657
1658 # stop if the command is found
1659 while (!($closed_command and $current->{'cmdname'}
1660 and $current->{'cmdname'} eq $closed_command)
1661 # stop if at the root
1662 and $current->{'parent'}
1663 # stop if in a root command
1664 # or in a context_brace_commands and searching for a specific
1665 # end block command (with $closed_command set).
1666 # This second condition means that a footnote is not closed when
1667 # looking for the end of a block command, but is closed when
1668 # completly closing the stack.
1669 and !($current->{'cmdname'}
1670 and ($root_commands{$current->{'cmdname'}}
1671 or ($closed_command and $current->{'parent'}->{'cmdname'}
1672 and $context_brace_commands{$current->{'parent'}->{'cmdname'}})))){
1673 _close_command_cleanup($self, $current);
1674 $current = _close_current($self, $current, $line_nr, $closed_command,
1675 $interrupting_command);
1676 }
1677
1678 my $closed_element;
1679 if ($closed_command and $current->{'cmdname'}
1680 and $current->{'cmdname'} eq $closed_command) {
1681 if ($preformatted_commands{$current->{'cmdname'}}) {
1682 my $context = pop @{$self->{'context_stack'}};
1683 if ($context ne 'preformatted') {
1684 $self->_bug_message("context $context instead of preformatted for $closed_command",
1685 $line_nr, $current);
1686 }
1687 } elsif ($format_raw_commands{$current->{'cmdname'}}) {
1688 my $context = pop @{$self->{'context_stack'}};
1689 if ($context ne 'rawpreformatted') {
1690 $self->_bug_message("context $context instead of rawpreformatted for $closed_command",
1691 $line_nr, $current);
1692 }
1693 } elsif ($menu_commands{$current->{'cmdname'}}) {
1694 my $context = pop @{$self->{'context_stack'}};
1695 # may be in menu, but context is preformatted if in a preformatted too.
1696 if ($context ne 'menu' and $context ne 'preformatted') {
1697 $self->_bug_message("context $context instead of preformatted or menu for $closed_command",
1698 $line_nr, $current);
1699 }
1700 }
1701 pop @{$self->{'regions_stack'}}
1702 if ($region_commands{$current->{'cmdname'}});
1703 $closed_element = $current;
1704 #$self->_close_command_cleanup($current);
1705 $current = $current->{'parent'};
1706 } elsif ($closed_command) {
1707 $self->line_error(sprintf(__("unmatched `%c%s'"),
1708 ord('@'), "end $closed_command"), $line_nr);
1709 }
1710 return ($closed_element, $current);
1711 }
1712
1713 # begin paragraph if needed. If not try to merge with the previous
1714 # content if it is also some text.
1715 # NOTE - this sub has an XS override
1716 sub _merge_text {
1717 my ($self, $current, $text) = @_;
1718
1719 my $paragraph;
1720
1721 my $no_merge_with_following_text = 0;
1722 if ($text =~ /\S/) {
1723 my $leading_spaces;
1724 if ($text =~ /^(\s+)/) {
1725 $leading_spaces = $1;
1726 }
1727 if ($current->{'contents'} and @{$current->{'contents'}}
1728 and $current->{'contents'}->[-1]->{'type'}
1729 and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
1730 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_command'
1731 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_before_argument'
1732 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_close_brace')) {
1733 $no_merge_with_following_text = 1;
1734 }
1735 if (_abort_empty_line($self, $current, $leading_spaces)) {
1736 $text =~ s/^(\s+)//;
1737 }
1738
1739 $paragraph = _begin_paragraph($self, $current);
1740 $current = $paragraph if ($paragraph);
1741 }
1742
1743 if (!defined($current->{'contents'})) {
1744 $self->_bug_message("No contents in _merge_text",
1745 undef, $current);
1746 die;
1747 }
1748
1749 if (!$no_merge_with_following_text
1750 and @{$current->{'contents'}}
1751 and exists($current->{'contents'}->[-1]->{'text'})
1752 and $current->{'contents'}->[-1]->{'text'} !~ /\n/) {
1753 $current->{'contents'}->[-1]->{'text'} .= $text;
1754 print STDERR "MERGED TEXT: $text|||\n" if ($self->{'DEBUG'});
1755 } else {
1756 push @{$current->{'contents'}}, { 'text' => $text, 'parent' => $current };
1757 print STDERR "NEW TEXT: $text|||\n" if ($self->{'DEBUG'});
1758 }
1759 return $current;
1760 }
1761
1762 # return the parent if in a item_container command, itemize or enumerate
1763 sub _item_container_parent($)
1764 {
1765 my $current = shift;
1766 if ((($current->{'cmdname'} and $current->{'cmdname'} eq 'item')
1767 or ($current->{'type'} and $current->{'type'} eq 'before_item'))
1768 and ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
1769 and $item_container_commands{$current->{'parent'}->{'cmdname'}})) {
1770 return ($current->{'parent'});
1771 }
1772 return undef;
1773 }
1774
1775 # return the parent if in a item_line command, @*table
1776 sub _item_line_parent($)
1777 {
1778 my $current = shift;
1779 if ($current->{'type'} and $current->{'type'} eq 'before_item'
1780 and $current->{'parent'}) {
1781 $current = $current->{'parent'};
1782 }
1783 return $current if ($current->{'cmdname'}
1784 and $item_line_commands{$current->{'cmdname'}});
1785 return undef;
1786 }
1787
1788 # return the parent if in a multitable
1789 sub _item_multitable_parent($)
1790 {
1791 my $current = shift;
1792 if (($current->{'cmdname'} and ($current->{'cmdname'} eq 'headitem'
1793 or $current->{'cmdname'} eq 'item' or $current->{'cmdname'} eq 'tab'))
1794 and $current->{'parent'} and $current->{'parent'}->{'parent'}) {
1795 $current = $current->{'parent'}->{'parent'};
1796 } elsif ($current->{'type'} and $current->{'type'} eq 'before_item'
1797 and $current->{'parent'}) {
1798 $current = $current->{'parent'};
1799 }
1800 return $current if ($current->{'cmdname'}
1801 and $current->{'cmdname'} eq 'multitable');
1802 return undef;
1803 }
1804
1805 sub _save_line_directive
1806 {
1807 my ($self, $line_nr, $file_name) = @_;
1808
1809 my $input = $self->{'input'}->[0];
1810 return if !$input;
1811 $input->{'line_nr'} = $line_nr if $line_nr;
1812 $input->{'name'} = $file_name if $file_name;
1813 }
1814
1815 # returns next text fragment, be it pending from a macro expansion or
1816 # text or file
1817 sub _next_text($$)
1818 {
1819 my ($self, $line_nr) = @_;
1820
1821 while (@{$self->{'input'}}) {
1822 my $input = $self->{'input'}->[0];
1823 if (@{$input->{'pending'}}) {
1824 my $new_text = shift @{$input->{'pending'}};
1825 if ($new_text->[1] and $new_text->[1]->{'end_macro'}) {
1826 delete $new_text->[1]->{'end_macro'};
1827 my $top_macro = shift @{$self->{'macro_stack'}};
1828 print STDERR "SHIFT MACRO_STACK(@{$self->{'macro_stack'}}): $top_macro->{'args'}->[0]->{'text'}\n"
1829 if ($self->{'DEBUG'});
1830 }
1831 return ($new_text->[0], $new_text->[1]);
1832 } elsif ($input->{'fh'}) {
1833 my $fh = $input->{'fh'};
1834 my $line = <$fh>;
1835 if (defined($line)) {
1836 # add an end of line if there is none at the end of file
1837 if (eof($fh) and $line !~ /\n/) {
1838 $line .= "\n";
1839 }
1840 $line =~ s/\x{7F}.*\s*//;
1841 $input->{'line_nr'}++;
1842 return ($line, {'line_nr' => $input->{'line_nr'},
1843 'file_name' => $input->{'name'},
1844 'macro' => ''});
1845 }
1846 }
1847 my $previous_input = shift(@{$self->{'input'}});
1848 # Don't close STDIN
1849 if ($previous_input->{'fh'} and $previous_input->{'name'} ne '-') {
1850 if (!close($previous_input->{'fh'})) {
1851 $self->document_warn(sprintf(__("error on closing %s: %s"),
1852 $previous_input->{'name'}, $!));
1853
1854 }
1855 }
1856 }
1857
1858 return (undef, $line_nr);
1859 }
1860
1861 # collect text and line numbers until an end of line is found.
1862 sub _new_line($$)
1863 {
1864 my ($self, $line_nr) = @_;
1865
1866 my $new_line = '';
1867
1868 while (1) {
1869 my $new_text;
1870 ($new_text, $line_nr) = _next_text($self, $line_nr);
1871 if (!defined($new_text)) {
1872 $new_line = undef if ($new_line eq '');
1873 last;
1874 }
1875
1876 $new_line .= $new_text;
1877
1878 my $chomped_text = $new_text;
1879 last if chomp($chomped_text);
1880 }
1881 return ($new_line, $line_nr);
1882 }
1883
1884 # $MACRO is the element in the tree defining the macro.
1885 sub _expand_macro_arguments($$$$)
1886 {
1887 my ($self, $macro, $line, $line_nr) = @_;
1888
1889 my $braces_level = 1;
1890 my $arguments = [ '' ];
1891 my $arg_nr = 0;
1892 my $args_total = scalar(@{$macro->{'args'}}) -1;
1893 my $name = $macro->{'args'}->[0]->{'text'};
1894
1895 my $line_nr_orig = $line_nr;
1896
1897 while (1) {
1898 if ($line =~ s/([^\\{},]*)([\\{},])//) {
1899 my $separator = $2;
1900 $arguments->[-1] .= $1;
1901 if ($separator eq '\\') {
1902 if ($line =~ s/^(.)//) {
1903 my $protected_char = $1;
1904 if ($protected_char !~ /[\\{},]/) {
1905 $arguments->[-1] .= '\\';
1906 }
1907 $arguments->[-1] .= $protected_char;
1908
1909 print STDERR "MACRO ARG: $separator: $protected_char\n" if ($self->{'DEBUG'});
1910 } else {
1911 $arguments->[-1] .= '\\';
1912 print STDERR "MACRO ARG: $separator\n" if ($self->{'DEBUG'});
1913 }
1914 } elsif ($separator eq ',') {
1915 if ($braces_level == 1) {
1916 if (scalar(@$arguments) < $args_total) {
1917 push @$arguments, '';
1918 $line =~ s/^\s*//;
1919 print STDERR "MACRO NEW ARG\n" if ($self->{'DEBUG'});
1920 } else {
1921 # implicit quoting when there is one argument.
1922 if ($args_total != 1) {
1923 $self->line_error(sprintf(__(
1924 "macro `%s' called with too many args"),
1925 $name), $line_nr);
1926 }
1927 $arguments->[-1] .= ',';
1928 }
1929 } else {
1930 $arguments->[-1] .= ',';
1931 }
1932 } elsif ($separator eq '}') {
1933 $braces_level--;
1934 last if ($braces_level == 0);
1935 $arguments->[-1] .= $separator;
1936 } elsif ($separator eq '{') {
1937 $braces_level++;
1938 $arguments->[-1] .= $separator;
1939 }
1940 } else {
1941 print STDERR "MACRO ARG end of line\n" if ($self->{'DEBUG'});
1942 $arguments->[-1] .= $line;
1943
1944 ($line, $line_nr) = _new_line($self, $line_nr);
1945 if (!defined($line)) {
1946 $self->line_error(sprintf(__("\@%s missing closing brace"),
1947 $name), $line_nr_orig);
1948 return ($arguments, "\n", $line_nr);
1949 }
1950 }
1951 }
1952 if ($args_total == 0 and $arguments->[0] ne '') {
1953 $self->line_error(sprintf(__(
1954 "macro `%s' declared without argument called with an argument"),
1955 $name), $line_nr);
1956 }
1957 print STDERR "END MACRO ARGS EXPANSION(".scalar(@$arguments)."): ".
1958 join("|\n", @$arguments) ."|\n" if ($self->{'DEBUG'});
1959 return ($arguments, $line, $line_nr);
1960 }
1961
1962 # $MACRO is a member of $self->{'macros'}.
1963 sub _expand_macro_body($$$$) {
1964 my ($self, $macro, $args, $line_nr) = @_;
1965
1966 my $macrobody = $macro->{'macrobody'};
1967 my $args_total = scalar(@{$macro->{'element'}->{'args'}}) -1;
1968 my $args_index = $macro->{'args_index'};
1969
1970 my $i;
1971 for ($i=0; $i<=$args_total; $i++) {
1972 $args->[$i] = "" unless (defined($args->[$i]));
1973 }
1974
1975 my $result = '';
1976 while ($macrobody ne '') {
1977 if ($macrobody =~ s/^([^\\]*)\\//o) {
1978 $result .= $1;
1979 if ($macrobody =~ s/^\\//) {
1980 $result .= '\\';
1981 } elsif ($macrobody =~ s/^([^\\]*)\\//) {
1982 my $arg = $1;
1983 if (defined($args_index->{$arg})) {
1984 $result .= $args->[$args_index->{$arg}];
1985 } else {
1986 $self->line_error(sprintf(__(
1987 "\\ in \@%s expansion followed `%s' instead of parameter name or \\"),
1988 $macro->{'element'}->{'args'}->[0]->{'text'}, $arg), $line_nr);
1989 $result .= '\\' . $arg;
1990 }
1991 }
1992 next;
1993 }
1994 $result .= $macrobody;
1995 last;
1996 }
1997 return $result;
1998 }
1999
2000 # each time a new line appeared, a container is opened to hold the text
2001 # consisting only of spaces. This container is removed here, typically
2002 # this is called when non-space happens on a line.
2003 # NOTE - this sub has an XS override
2004 sub _abort_empty_line {
2005 my ($self, $current, $additional_spaces) = @_;
2006
2007 $additional_spaces = '' if (!defined($additional_spaces));
2008 if ($current->{'contents'} and @{$current->{'contents'}}
2009 and $current->{'contents'}->[-1]->{'type'}
2010 and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line'
2011 or $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
2012 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_before_argument'
2013 or $current->{'contents'}->[-1]->{'type'} eq 'empty_spaces_after_close_brace')) {
2014
2015 my $spaces_element = $current->{'contents'}->[-1];
2016
2017 my $owning_element;
2018 if ($spaces_element->{'extra'}
2019 and $spaces_element->{'extra'}->{'command'}) {
2020 $owning_element = $spaces_element->{'extra'}->{'command'};
2021 }
2022
2023 print STDERR "ABORT EMPTY "
2024 .$spaces_element->{'type'}
2025 ." additional text |$additional_spaces|,"
2026 ." current |$spaces_element->{'text'}|\n"
2027 if ($self->{'DEBUG'});
2028
2029 $spaces_element->{'text'} .= $additional_spaces;
2030 # remove empty 'empty*before'.
2031 if ($spaces_element->{'text'} eq '') {
2032 pop @{$current->{'contents'}};
2033
2034 } elsif ($spaces_element->{'type'} eq 'empty_line') {
2035 # exactly the same condition as to begin a paragraph
2036 if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
2037 and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
2038 $spaces_element->{'type'} = 'empty_spaces_before_paragraph';
2039 } else {
2040 delete $spaces_element->{'type'};
2041 }
2042 } elsif ($spaces_element->{'type'} eq 'empty_line_after_command'
2043 or $spaces_element->{'type'} eq 'empty_spaces_before_argument') {
2044 if ($owning_element) {
2045 # Remove element from main tree. It will still be referenced in
2046 # the 'extra' hash as 'spaces_before_argument'.
2047 pop @{$current->{'contents'}};
2048
2049 $owning_element->{'extra'}->{'spaces_before_argument'}
2050 = $spaces_element->{'text'};
2051 } else {
2052 $spaces_element->{'type'} = 'empty_spaces_after_command';
2053 }
2054 }
2055
2056 return 1;
2057 }
2058 return 0;
2059 }
2060
2061 # isolate last space in a command to help expansion disregard unuseful spaces.
2062 sub _isolate_last_space
2063 {
2064 my ($self, $current) = @_;
2065
2066 return if (!$current->{'contents'} or !@{$current->{'contents'}});
2067
2068 # Store a final comment command in the 'extra' hash.
2069 if (scalar(@{$current->{'contents'}}) >= 1
2070 and $current->{'contents'}->[-1]->{'cmdname'}
2071 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
2072 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')) {
2073 $current->{'extra'}->{'comment_at_end'} = pop @{$current->{'contents'}};
2074 # TODO: @c should probably not be allowed inside most brace commands
2075 # as this would be difficult to implement properly in TeX.
2076 }
2077
2078 return if !@{$current->{'contents'}}
2079 or !defined($current->{'contents'}->[-1]->{'text'})
2080 or ($current->{'contents'}->[-1]->{'type'}
2081 and (!$current->{'type'}
2082 or $current->{'type'} ne 'line_arg'))
2083 or $current->{'contents'}->[-1]->{'text'} !~ /\s+$/;
2084
2085 if ($current->{'type'} and $current->{'type'} eq 'menu_entry_node') {
2086 if ($current->{'contents'}->[-1]->{'text'} !~ /\S/) {
2087 $current->{'contents'}->[-1]->{'type'} = 'space_at_end_menu_node';
2088 } else {
2089 $current->{'contents'}->[-1]->{'text'} =~ s/(\s+)$//;
2090 my $new_spaces = { 'text' => $1, 'parent' => $current,
2091 'type' => 'space_at_end_menu_node' };
2092 push @{$current->{'contents'}}, $new_spaces;
2093 }
2094 } else {
2095 # Store final spaces in 'spaces_after_argument'.
2096 if ($current->{'contents'}->[-1]->{'text'} !~ /\S/) {
2097 my $end_spaces = $current->{'contents'}->[-1]->{'text'};
2098 pop @{$current->{'contents'}};
2099 $current->{'extra'}->{'spaces_after_argument'} = $end_spaces;
2100 } else {
2101 $current->{'contents'}->[-1]->{'text'} =~ s/(\s+)$//;
2102 $current->{'extra'}->{'spaces_after_argument'} = $1;
2103 }
2104 }
2105 }
2106
2107 # $NODE->{'contents'} is the Texinfo for the specification of a node.
2108 # Returned object is a hash with two fields:
2109 #
2110 # manual_content - Texinfo tree for a manual name extracted from the
2111 # node specification.
2112 # node_content - Texinfo tree for the node name on its own
2113 #
2114 # retrieve a leading manual name in parentheses, if there is one.
2115 sub _parse_node_manual($)
2116 {
2117 my $node = shift;
2118 return Texinfo::Common::parse_node_manual ($node);
2119 }
2120
2121 sub _parse_float_type($)
2122 {
2123 my $current = shift;
2124 if ($current->{'args'} and @{$current->{'args'}}) {
2125 if (@{$current->{'args'}->[0]->{'contents'}}) {
2126 my $normalized
2127 = Texinfo::Convert::Texinfo::convert(
2128 {'contents' => $current->{'args'}->[0]->{'contents'}});
2129 $current->{'extra'}->{'type'}->{'content'} =
2130 $current->{'args'}->[0]->{'contents'};
2131 $current->{'extra'}->{'type'}->{'normalized'} = $normalized;
2132 return 1;
2133 }
2134 }
2135 $current->{'extra'}->{'type'}->{'normalized'} = '';
2136 return 0;
2137 }
2138
2139 # split non-space text elements into strings without [ ] ( ) , and single
2140 # character strings with one of them
2141 sub _split_delimiters
2142 {
2143 my ($self, $root) = @_;
2144
2145 if (defined $root->{'type'} # 'spaces' for spaces
2146 or !defined $root->{'text'}) {
2147 return $root;
2148 } else {
2149 my @elements;
2150 my $type;
2151 my $chars = quotemeta '[](),';
2152 my $text = $root->{'text'};
2153 while (1) {
2154 if ($text =~ s/^([^$chars]+)//) {
2155 push @elements, {'text' => $1, 'parent' => $root->{'parent'}};
2156 } elsif ($text =~ s/^([$chars])//) {
2157 push @elements, {'text' => $1, 'type' => 'delimiter',
2158 'parent' => $root->{'parent'}};
2159 } else {
2160 last;
2161 }
2162 }
2163 return @elements;
2164 }
2165 }
2166
2167 # split text elements into whitespace and non-whitespace
2168 sub _split_def_args
2169 {
2170 my ($self, $root) = @_;
2171
2172 if ($root->{'type'} and $root->{'type'} eq 'spaces_inserted') {
2173 return $root;
2174 } elsif (defined $root->{'text'}) {
2175 my @elements;
2176 my $type;
2177 my @split_text = split /(?<=\s)(?=\S)|(?<=\S)(?=\s)/, $root->{'text'};
2178 if ($split_text[0] =~ /^\s*$/) {
2179 $type = 'spaces';
2180 }
2181 for my $t (@split_text) {
2182 my $e = {'text' => $t };
2183 if ($type) {
2184 $e->{'type'} = $type;
2185 $type = undef;
2186 } else {
2187 $type = 'spaces';
2188 }
2189 $e->{'parent'} = $root->{'parent'};
2190 push @elements, $e;
2191 }
2192 return @elements;
2193 } elsif ($root->{'type'} and $root->{'type'} eq 'bracketed') {
2194 _isolate_last_space($self, $root);
2195 $root->{'type'} = 'bracketed_def_content';
2196 }
2197 return $root;
2198 }
2199
2200 # definition line parsing
2201 sub _parse_def($$$)
2202 {
2203 my ($self, $command, $current) = @_;
2204
2205 my $contents = $current->{'contents'};
2206 my $empty_spaces_after_command;
2207
2208 my @new_contents;
2209 my @contents = @$contents;
2210 if ($contents[0] and $contents[0]->{'type'}
2211 and ($contents[0]->{'type'} eq 'empty_spaces_after_command'
2212 or $contents[0]->{'type'} eq 'empty_line_after_command')) {
2213 $empty_spaces_after_command = shift @contents;
2214 }
2215
2216 if ($def_aliases{$command}) {
2217 my $real_command = $def_aliases{$command};
2218 my $prepended = $def_map{$command}->{$real_command};
2219
2220
2221 my $bracketed = { 'type' => 'bracketed_inserted',
2222 'parent' => $current };
2223 my $content = { 'text' => $prepended, 'parent' => $bracketed };
2224 if ($self->{'documentlanguage'}) {
2225 $content->{'type'} = 'untranslated';
2226 $content->{'extra'}->{'documentlanguage'} = $self->{'documentlanguage'};
2227 }
2228 @{$bracketed->{'contents'}} = ($content);
2229
2230 unshift @contents, $bracketed,
2231 { 'text' => ' ', 'type' => 'spaces_inserted',
2232 'parent' => $current,
2233 };
2234
2235 $command = $def_aliases{$command};
2236 }
2237 @contents = map (_split_def_args($self, $_), @contents );
2238 @new_contents = @contents;
2239
2240 $current->{'contents'} = \@new_contents;
2241
2242 my @result;
2243 my @args = @{$def_map{$command}};
2244 my $arg_type;
2245
2246 $arg_type = pop @args if ($args[-1] eq 'arg' or $args[-1] eq 'argtype');
2247 # If $arg_type is not set (for @def* commands that are not documented
2248 # to take args), everything happens as if arg_type was set to 'arg'.
2249
2250 # Fill in everything up to the args, collecting adjacent non-whitespace
2251 # elements into a single element, e.g 'a@i{b}c'.
2252 my $argument_content = [];
2253 my $arg = shift (@args);
2254
2255 my $i = 0; # the offset in @new_contents of $token
2256 while (@contents) {
2257 my $token = $contents[0];
2258 # finish previous item
2259 if ( $token->{'type'}
2260 and ($token->{'type'} eq 'spaces'
2261 or $token->{'type'} eq 'spaces_inserted'
2262 or $token->{'type'} eq 'bracketed_def_content'
2263 or $token->{'type'} eq 'bracketed_inserted'
2264 or $token->{'type'} eq 'delimiter')) {
2265 # we create a {'contents' =>} only if there is more than one
2266 # content gathered.
2267 if (scalar(@$argument_content)) {
2268 if (scalar(@$argument_content) > 1) {
2269 my $e = {'contents' => $argument_content,
2270 'type' => 'def_aggregate',
2271 'parent' => $current };
2272 push @result, [$arg, $e];
2273 # Replace in the main tree.
2274 splice @new_contents,
2275 $i - scalar(@$argument_content),
2276 scalar(@$argument_content),
2277 $e;
2278 for my $e2 (@$argument_content) {
2279 $e2->{'parent'} = $e;
2280 }
2281 $i -= scalar(@$argument_content) - 1;
2282 } elsif (scalar(@$argument_content) == 1) {
2283 push @result, [$arg, $argument_content->[0]];
2284 }
2285 $argument_content = [];
2286 if ($token->{'type'} eq 'spaces'
2287 or $token->{'type'} eq 'spaces_inserted') {
2288 $arg = shift (@args);
2289 }
2290 }
2291 }
2292
2293 if ($token->{'type'} and ($token->{'type'} eq 'bracketed_def_content'
2294 or $token->{'type'} eq 'bracketed_inserted')) {
2295 push @result, [$arg, $token];
2296 shift @contents;
2297 $arg = shift (@args);
2298 } elsif ($token->{'type'}
2299 and ($token->{'type'} eq 'spaces'
2300 or $token->{'type'} eq 'spaces_inserted')) {
2301 if ($token->{'text'}) {
2302 if ($token->{'text'} =~ /\n$/) {
2303 $token->{'type'} = 'spaces_at_end';
2304 }
2305 push @result, ['spaces', $token];
2306 shift @contents;
2307 } else {
2308 $i++;
2309 last;
2310 }
2311 } elsif ($token->{'type'} and $token->{'type'} eq 'delimiter') {
2312 push @result, ['delimiter', shift @contents];
2313 } else {
2314 my $text_or_cmd = shift @contents;
2315 push @$argument_content, $text_or_cmd;
2316 }
2317 $i++;
2318 last if (! defined($arg));
2319 }
2320 if (scalar(@$argument_content) > 1) {
2321 my $e = {'contents' => $argument_content,
2322 'type' => 'def_aggregate' };
2323 push @result, [$arg, $e];
2324 # Replace in the main tree.
2325 splice @new_contents, $i - scalar(@$argument_content),
2326 scalar(@$argument_content), $e;
2327 } elsif (scalar(@$argument_content) == 1) {
2328 push @result, [$arg, $argument_content->[0]];
2329 }
2330
2331 if (scalar(@contents) > 0) {
2332 splice @new_contents, -scalar(@contents);
2333 }
2334 unshift @new_contents, $empty_spaces_after_command
2335 if $empty_spaces_after_command;
2336
2337 @contents = map (_split_delimiters($self, $_), @contents );
2338 @new_contents = (@new_contents, @contents);
2339
2340 # Create the part of the def_args array for any arguments.
2341 my @args_results;
2342 while (@contents) {
2343 my $spaces;
2344 my $next_token = shift @contents;
2345 if ($next_token->{'type'} and $next_token->{'type'} eq 'spaces') {
2346 $spaces = $next_token;
2347 $next_token = shift @contents;
2348 }
2349 if (defined($spaces)) {
2350 if ($spaces->{'text'} =~ /\n$/) {
2351 $spaces->{'type'} = 'spaces_at_end';
2352 }
2353 push @args_results, ['spaces', $spaces]
2354 }
2355 last if (!defined($next_token));
2356 if ($next_token->{'type'} and $next_token->{'type'} eq 'delimiter') {
2357 push @args_results, ['delimiter', $next_token];
2358 } else {
2359 push @args_results, ['arg', $next_token];
2360 }
2361 }
2362
2363 # If a command like @deftypefn, mark the type arguments
2364 if ($arg_type and $arg_type eq 'argtype') {
2365 my $next_is_type = 1;
2366 foreach my $arg(@args_results) {
2367 if ($arg->[0] eq 'spaces') {
2368 } elsif ($arg->[0] eq 'delimiter') {
2369 $next_is_type = 1;
2370 } elsif ($arg->[1]->{'cmdname'} and $arg->[1]->{'cmdname'} ne 'code') {
2371 $next_is_type = 1;
2372 } elsif ($next_is_type) {
2373 $arg->[0] = 'typearg';
2374 $next_is_type = 0;
2375 } else {
2376 $next_is_type = 1;
2377 }
2378 }
2379 }
2380
2381 for my $pair (@result, @args_results) {
2382 $pair->[1]->{'extra'}->{'def_role'} = $pair->[0];
2383 }
2384
2385 return [@result, @args_results];
2386 }
2387
2388 # register a label, that is something that may be the target of a reference
2389 # and must be unique in the document. Corresponds to @node, @anchor and
2390 # @float second arg.
2391 sub _register_label($$$)
2392 {
2393 my ($self, $current, $label) = @_;
2394
2395 push @{$self->{'targets'}}, $current;
2396 if ($label->{'node_content'}) {
2397 $current->{'extra'}->{'node_content'} = $label->{'node_content'};
2398 }
2399 }
2400
2401 # store an index entry.
2402 # $current is the command element.
2403 # $content holds the actual content.
2404 # for index entries and v|ftable items, it is the index entry content,
2405 # for def, it is the parsed arguments, based on the definition line
2406 # arguments.
2407 sub _enter_index_entry($$$$$$$)
2408 {
2409 my ($self, $command_container, $command, $current, $content,
2410 $content_normalized, $line_nr) = @_;
2411
2412 $content_normalized = $content if (!defined($content_normalized));
2413
2414 my $index_name = $self->{'command_index'}->{$command_container};
2415 my $index = $self->{'index_names'}->{$index_name};
2416
2417 my $number = (defined($index->{'index_entries'})
2418 ? (scalar(@{$index->{'index_entries'}}) + 1)
2419 : 1);
2420 my $index_entry = { 'index_name' => $index_name,
2421 'index_at_command' => $command,
2422 'index_type_command' => $command_container,
2423 'content' => $content,
2424 'content_normalized' => $content_normalized,
2425 'command' => $current,
2426 'number' => $number,
2427 };
2428 if (defined $current->{'extra'}->{'sortas'}) {
2429 $index_entry->{'sortas'} = $current->{'extra'}->{'sortas'};
2430 }
2431 if (@{$self->{'regions_stack'}}) {
2432 $index_entry->{'region'} = $self->{'regions_stack'}->[-1];
2433 } elsif ($self->{'current_node'}) {
2434 $index_entry->{'node'} = $self->{'current_node'};
2435 } elsif (!$self->{'current_section'}) {
2436 $self->line_warn(sprintf(__("entry for index `%s' outside of any node"),
2437 $index_name), $line_nr);
2438 }
2439 push @{$index->{'index_entries'}}, $index_entry;
2440 $current->{'extra'}->{'index_entry'} = $index_entry;
2441 }
2442
2443 # close constructs and do stuff at end of line (or end of the document)
2444 sub _end_line($$$);
2445 sub _end_line($$$)
2446 {
2447 my ($self, $current, $line_nr) = @_;
2448
2449 my $current_old = $current;
2450
2451 my $included_file = 0;
2452
2453 # a line consisting only of spaces.
2454 if ($current->{'contents'} and @{$current->{'contents'}}
2455 and $current->{'contents'}->[-1]->{'type'}
2456 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
2457 print STDERR "END EMPTY LINE\n" if ($self->{'DEBUG'});
2458 if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
2459 my $empty_line = pop @{$current->{'contents'}};
2460 $current = _end_paragraph($self, $current, $line_nr);
2461 push @{$current->{'contents'}}, $empty_line;
2462 $empty_line->{'parent'} = $current;
2463 } elsif ($current->{'type'}
2464 and $current->{'type'} eq 'preformatted'
2465 and $current->{'parent'}->{'type'}
2466 and $current->{'parent'}->{'type'} eq 'menu_entry_description') {
2467 my $empty_line = pop @{$current->{'contents'}};
2468 if ($current->{'type'} eq 'preformatted') {
2469 my $empty_preformatted = (!@{$current->{'contents'}});
2470 $current = $current->{'parent'};
2471 pop @{$current->{'contents'}} if ($empty_preformatted);
2472 }
2473 my $context = pop @{$self->{'context_stack'}};
2474 if ($context ne 'preformatted') {
2475 $self->_bug_message("context $context instead of preformatted in empty line after menu_entry_description",
2476 $line_nr, $current);
2477 }
2478
2479 # first parent is menu_entry
2480 $current = $current->{'parent'}->{'parent'};
2481
2482 push @{$current->{'contents'}}, { 'type' => 'menu_comment',
2483 'parent' => $current,
2484 'contents' => [] };
2485 $current = $current->{'contents'}->[-1];
2486 push @{$current->{'contents'}}, { 'type' => 'preformatted',
2487 'parent' => $current,
2488 'contents' => [] };
2489 $current = $current->{'contents'}->[-1];
2490 push @{$current->{'contents'}}, { 'type' => 'after_description_line',
2491 'text' => $empty_line->{'text'},
2492 'parent' => $current };
2493 push @{$self->{'context_stack'}}, 'preformatted';
2494 print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if ($self->{'DEBUG'});
2495 } elsif (!$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
2496 $current = _end_paragraph($self, $current, $line_nr);
2497 }
2498
2499 # end of a menu line.
2500 } elsif ($current->{'type'}
2501 and ($current->{'type'} eq 'menu_entry_name'
2502 or $current->{'type'} eq 'menu_entry_node')) {
2503 my $empty_menu_entry_node = 0;
2504 my $end_comment;
2505 if ($current->{'type'} eq 'menu_entry_node') {
2506 if (@{$current->{'contents'}}
2507 and $current->{'contents'}->[-1]->{'cmdname'}
2508 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
2509 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')) {
2510 $end_comment = pop @{$current->{'contents'}};
2511 }
2512 if (!@{$current->{'contents'}}
2513 # empty if only the end of line or spaces
2514 or (@{$current->{'contents'}} == 1
2515 and defined($current->{'contents'}->[-1]->{'text'})
2516 and $current->{'contents'}->[-1]->{'text'} !~ /\S/)) {
2517 $empty_menu_entry_node = 1;
2518 push @{$current->{'contents'}}, $end_comment if ($end_comment);
2519 }
2520 }
2521 # we abort the menu entry if there is no node name
2522 if ($empty_menu_entry_node
2523 or $current->{'type'} eq 'menu_entry_name') {
2524 my $description_or_menu_comment;
2525 print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'DEBUG'});
2526 my $menu = $current->{'parent'}->{'parent'};
2527 my $menu_entry = pop @{$menu->{'contents'}};
2528 if (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
2529 and $menu->{'contents'}->[-1]->{'type'} eq 'menu_entry') {
2530 my $entry = $menu->{'contents'}->[-1];
2531 my $description;
2532 foreach my $entry_element (reverse(@{$entry->{'args'}})) {
2533 if ($entry_element->{'type'} eq 'menu_entry_description') {
2534 $description = $entry_element;
2535 last;
2536 }
2537 }
2538 if ($description) {
2539 $description_or_menu_comment = $description;
2540 } else {
2541 # Normally this cannot happen
2542 $self->_bug_message("No description in menu_entry",
2543 $line_nr, $current);
2544 push @{$entry->{'args'}}, {'type' => 'menu_entry_description',
2545 'parent' => $entry,
2546 'contents' => [] };
2547 $description_or_menu_comment = $entry->{'args'}->[-1];
2548 }
2549 } elsif (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
2550 and $menu->{'contents'}->[-1]->{'type'} eq 'menu_comment') {
2551 $description_or_menu_comment = $menu->{'contents'}->[-1];
2552 }
2553 if ($description_or_menu_comment) {
2554 $current = $description_or_menu_comment;
2555 if ($current->{'contents'}->[-1] and $current->{'contents'}->[-1]->{'type'}
2556 and $current->{'contents'}->[-1]->{'type'} eq 'preformatted') {
2557 $current = $current->{'contents'}->[-1];
2558 } else {
2559 # this should not happen
2560 $self->_bug_message("description or menu comment not in preformatted",
2561 $line_nr, $current);
2562 push @{$current->{'contents'}}, {'type' => 'preformatted',
2563 'parent' => $current,
2564 'contents' => [] };
2565 $current = $current->{'contents'}->[-1];
2566 }
2567 push @{$self->{'context_stack'}}, 'preformatted';
2568 } else {
2569 push @{$menu->{'contents'}}, {'type' => 'menu_comment',
2570 'parent' => $menu,
2571 'contents' => [] };
2572 $current = $menu->{'contents'}->[-1];
2573 push @{$current->{'contents'}}, {'type' => 'preformatted',
2574 'parent' => $current,
2575 'contents' => [] };
2576 $current = $current->{'contents'}->[-1];
2577 push @{$self->{'context_stack'}}, 'preformatted';
2578 print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
2579 }
2580 while (@{$menu_entry->{'args'}}) {
2581 my $arg = shift @{$menu_entry->{'args'}};
2582 if (defined($arg->{'text'})) {
2583 $current = _merge_text($self, $current, $arg->{'text'});
2584 } else {
2585 while (@{$arg->{'contents'}}) {
2586 my $content = shift @{$arg->{'contents'}};
2587 if (defined($content->{'text'})) {
2588 $current = _merge_text($self, $current,
2589 $content->{'text'});
2590 $content = undef;
2591 } else {
2592 $content->{'parent'} = $current;
2593 push @{$current->{'contents'}}, $content;
2594 }
2595 }
2596 }
2597 $arg = undef;
2598 }
2599 # MENU_COMMENT open
2600 $menu_entry = undef;
2601 } else {
2602 print STDERR "MENU ENTRY END LINE\n" if ($self->{'DEBUG'});
2603 $current = $current->{'parent'};
2604 $current = _enter_menu_entry_node($self, $current, $line_nr);
2605 if (defined($end_comment)) {
2606 $end_comment->{'parent'} = $current;
2607 push @{$current->{'contents'}}, $end_comment;
2608 }
2609 }
2610 # def line
2611 } elsif ($current->{'parent'}
2612 and $current->{'parent'}->{'type'}
2613 and $current->{'parent'}->{'type'} eq 'def_line') {
2614 my $def_context = pop @{$self->{'context_stack'}};
2615 if ($def_context ne 'def') {
2616 $self->_bug_message("context $def_context instead of def",
2617 $line_nr, $current);
2618 die;
2619 }
2620 my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
2621 my $arguments = _parse_def($self, $def_command, $current);
2622 if (scalar(@$arguments)) {
2623 #$current->{'parent'}->{'extra'}->{'def_args'} = $arguments;
2624 my $def_parsed_hash;
2625 foreach my $arg (@$arguments) {
2626 die if (!defined($arg->[0]));
2627 last if ($arg->[0] eq 'arg' or $arg->[0] eq 'typearg'
2628 or $arg->[0] eq 'delimiter');
2629 next if ($arg->[0] eq 'spaces');
2630 $def_parsed_hash->{$arg->[0]} = $arg->[1];
2631 }
2632 $current->{'parent'}->{'extra'}->{'def_parsed_hash'} = $def_parsed_hash;
2633 # do an standard index entry tree
2634 my $index_entry;
2635 if (defined($def_parsed_hash->{'name'})) {
2636 $index_entry = $def_parsed_hash->{'name'}
2637 # empty bracketed
2638 unless ($def_parsed_hash->{'name'}->{'type'}
2639 and $def_parsed_hash->{'name'}->{'type'} eq 'bracketed_def_content'
2640 and (!$def_parsed_hash->{'name'}->{'contents'}
2641 or (!scalar(@{$def_parsed_hash->{'name'}->{'contents'}}))
2642 or (scalar(@{$def_parsed_hash->{'name'}->{'contents'}}) == 1
2643 and defined($def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'})
2644 and $def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'} !~ /\S/)));
2645 }
2646 if (defined($index_entry)) {
2647 my $index_contents_normalized;
2648 if ($def_parsed_hash->{'class'}) {
2649 # Delay getting the text until Texinfo::Structuring::sort_index_keys
2650 # in order to avoid using gdt.
2651 # We need to store the language as well in case there are multiple
2652 # languages in the document.
2653 if ($command_index{$def_command} eq 'fn'
2654 or $command_index{$def_command} eq 'vr'
2655 and $def_command ne 'defcv') {
2656 undef $index_entry;
2657 $current->{'parent'}->{'extra'}->{'documentlanguage'}
2658 = $self->{'documentlanguage'};
2659 }
2660 }
2661 my $index_contents;
2662 if ($index_entry) {
2663 $index_contents_normalized = [$index_entry];
2664 $index_contents = [$index_entry];
2665 }
2666
2667 _enter_index_entry($self,
2668 $current->{'parent'}->{'extra'}->{'def_command'},
2669 $current->{'parent'}->{'extra'}->{'original_def_cmdname'},
2670 $current->{'parent'}, $index_contents,
2671 $index_contents_normalized, $line_nr);
2672 } else {
2673 $self->_command_warn($current->{'parent'}, $line_nr,
2674 __('missing name for @%s'),
2675 $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
2676 }
2677 } else {
2678 $self->_command_warn($current->{'parent'}, $line_nr,
2679 __('missing category for @%s'),
2680 $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
2681 }
2682 $current = $current->{'parent'}->{'parent'};
2683 $current = _begin_preformatted($self, $current);
2684
2685 # other block command lines
2686 } elsif ($current->{'type'}
2687 and $current->{'type'} eq 'block_line_arg') {
2688 my $empty_text;
2689 my $context = pop @{$self->{'context_stack'}};
2690 if ($context ne 'line') {
2691 $self->_bug_message("context $context instead of line in block_line_arg",
2692 $line_nr, $current);
2693 }
2694 # @multitable args
2695 if ($current->{'parent'}->{'cmdname'}
2696 and $current->{'parent'}->{'cmdname'} eq 'multitable') {
2697 # parse the prototypes and put them in a special arg
2698 my @prototype_row;
2699 foreach my $content (@{$current->{'contents'}}) {
2700 if ($content->{'type'} and $content->{'type'} eq 'bracketed') {
2701 push @prototype_row, { 'contents' => $content->{'contents'},
2702 'type' => 'bracketed_multitable_prototype'};
2703 } elsif ($content->{'text'}) {
2704 # TODO: this should be a warning or an error - all prototypes
2705 # on a @multitable line should be in braces, as documented in the
2706 # Texinfo manual.
2707 if ($content->{'text'} =~ /\S/) {
2708 foreach my $prototype (split /\s+/, $content->{'text'}) {
2709 push @prototype_row, { 'text' => $prototype,
2710 'type' => 'row_prototype' } unless ($prototype eq '');
2711 }
2712 }
2713 } else {
2714 if (!$content->{'cmdname'}
2715 or ($content->{'cmdname'} ne 'c'
2716 and $content->{'cmdname'} ne 'comment')) {
2717 $self->_command_warn($current, $line_nr,
2718 __("unexpected argument on \@%s line: %s"),
2719 $current->{'parent'}->{'cmdname'},
2720 Texinfo::Convert::Texinfo::convert($content));
2721 }
2722 }
2723 }
2724
2725 my $multitable = $current->{'parent'};
2726 $multitable->{'extra'}->{'max_columns'} = scalar(@prototype_row);
2727 if (!scalar(@prototype_row)) {
2728 $self->_command_warn($multitable, $line_nr,
2729 __("empty multitable"));
2730 }
2731 $multitable->{'extra'}->{'prototypes'} = \@prototype_row;
2732 }
2733 _isolate_last_space($self, $current);
2734 $current = $current->{'parent'};
2735 delete $current->{'remaining_args'};
2736 # don't consider empty argument of block @-commands as argument,
2737 # reparent them as contents
2738 if ($current->{'args'}->[0]->{'contents'}->[0]
2739 and $current->{'args'}->[0]->{'contents'}->[0]->{'type'}
2740 and $current->{'args'}->[0]->{'contents'}->[0]->{'type'} eq 'empty_line_after_command')
2741 {
2742 my $empty_text = $current->{'args'}->[0]->{'contents'}->[0];
2743 $empty_text->{'parent'} = $current;
2744 unshift @{$current->{'contents'}}, $empty_text;
2745 delete $current->{'args'};
2746 }
2747
2748 # @float args
2749 if ($current->{'cmdname'} and $current->{'cmdname'} eq 'float') {
2750 $current->{'line_nr'} = $line_nr;
2751 my $type = '';
2752 my $float_label;
2753 if ($current->{'args'} and $current->{'args'}->[1]) {
2754 $float_label = _parse_node_manual($current->{'args'}->[1]);
2755 _check_internal_node($self, $float_label, $line_nr);
2756 }
2757 _register_label($self, $current, $float_label);
2758 _parse_float_type($current);
2759 $type = $current->{'extra'}->{'type'}->{'normalized'};
2760 push @{$self->{'floats'}->{$type}}, $current;
2761 $current->{'extra'}->{'float_section'} = $self->{'current_section'}
2762 if (defined($self->{'current_section'}));
2763 }
2764
2765 if ($current->{'cmdname'}
2766 and $block_item_commands{$current->{'cmdname'}}) {
2767 if ($current->{'cmdname'} eq 'enumerate') {
2768 my $spec = 1;
2769 if ($current->{'args'} and $current->{'args'}->[0]
2770 and $current->{'args'}->[0]->{'contents'}
2771 and @{$current->{'args'}->[0]->{'contents'}}) {
2772 if (scalar(@{$current->{'args'}->[0]->{'contents'}}) > 1) {
2773 $self->_command_error($current, $line_nr,
2774 __("superfluous argument to \@%s"),
2775 $current->{'cmdname'});
2776 }
2777 my $arg = $current->{'args'}->[0]->{'contents'}->[0];
2778 if (!defined($arg->{'text'}) or $arg->{'text'} !~ /^(([[:digit:]]+)|([[:alpha:]]+))$/) {
2779 $self->_command_error($current, $line_nr,
2780 __("bad argument to \@%s"),
2781 $current->{'cmdname'});
2782 } else {
2783 $spec = $arg->{'text'};
2784 }
2785 }
2786 $current->{'extra'}->{'enumerate_specification'} = $spec;
2787 } elsif ($item_line_commands{$current->{'cmdname'}}) {
2788 if (!$current->{'extra'}
2789 or !$current->{'extra'}->{'command_as_argument'}) {
2790 $self->_command_error($current, $line_nr,
2791 __("%s requires an argument: the formatter for %citem"),
2792 $current->{'cmdname'}, ord('@'));
2793 } elsif (!$brace_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}) {
2794 $self->_command_error($current, $line_nr,
2795 __("command \@%s not accepting argument in brace should not be on \@%s line"),
2796 $current->{'extra'}->{'command_as_argument'}->{'cmdname'},
2797 $current->{'cmdname'});
2798 delete $current->{'extra'}->{'command_as_argument'};
2799 }
2800 }
2801 # This code checks that the command_as_argument of the @itemize
2802 # is alone on the line, otherwise it is not a command_as_argument.
2803 if ($current->{'extra'}
2804 and $current->{'extra'}->{'command_as_argument'}
2805 and $current->{'cmdname'} eq 'itemize') {
2806 my @args = @{$current->{'args'}->[0]->{'contents'}};
2807 while (@args) {
2808 my $arg = shift @args;
2809 last if ($arg eq $current->{'extra'}->{'command_as_argument'});
2810 }
2811 while (@args) {
2812 my $arg = shift @args;
2813 if (!(($arg->{'cmdname'}
2814 and ($arg->{'cmdname'} eq 'c'
2815 or $arg->{'cmdname'} eq 'comment'))
2816 or (defined($arg->{'text'}) and $arg->{'text'} !~ /\S/))) {
2817 delete $current->{'extra'}->{'command_as_argument'}->{'type'};
2818 delete $current->{'extra'}->{'command_as_argument'};
2819 last;
2820 }
2821 }
2822 }
2823 if ($current->{'extra'}
2824 and $current->{'extra'}->{'command_as_argument'}
2825 and $accent_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
2826 and ($current->{'cmdname'} eq 'itemize'
2827 or $item_line_commands{$current->{'cmdname'}})) {
2828 $self->_command_warn($current, $line_nr,
2829 __("accent command `\@%s' not allowed as \@%s argument"),
2830 $current->{'extra'}->{'command_as_argument'}->{'cmdname'},
2831 $current->{'cmdname'});
2832 delete $current->{'extra'}->{'command_as_argument'};
2833 }
2834 if ($current->{'cmdname'} eq 'itemize'
2835 and (!$current->{'args'}
2836 or !$current->{'args'}->[0]
2837 or !$current->{'args'}->[0]->{'contents'}
2838 or !@{$current->{'args'}->[0]->{'contents'}})) {
2839 my $inserted = { 'cmdname' => 'bullet',
2840 'contents' => [],
2841 'type' => 'command_as_argument_inserted',
2842 'parent' => $current };
2843 unshift @{$current->{'args'}}, $inserted;
2844 $current->{'extra'}->{'command_as_argument'} = $inserted;
2845 } elsif ($item_line_commands{$current->{'cmdname'}} and
2846 !$current->{'extra'}->{'command_as_argument'}) {
2847 my $inserted = { 'cmdname' => 'asis',
2848 'contents' => [],
2849 'type' => 'command_as_argument_inserted',
2850 'parent' => $current };
2851 unshift @{$current->{'args'}}, $inserted;
2852 $current->{'extra'}->{'command_as_argument'} = $inserted;
2853 }
2854 push @{$current->{'contents'}}, { 'type' => 'before_item',
2855 'contents' => [], 'parent', $current };
2856 $current = $current->{'contents'}->[-1];
2857 }
2858 if ($current->{'cmdname'} and $menu_commands{$current->{'cmdname'}}) {
2859 push @{$current->{'contents'}}, {'type' => 'menu_comment',
2860 'parent' => $current,
2861 'contents' => [] };
2862 $current = $current->{'contents'}->[-1];
2863 print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
2864 push @{$self->{'context_stack'}}, 'preformatted';
2865 }
2866 $current = _begin_preformatted($self, $current);
2867
2868 # if we are after a @end verbatim, we must restart a preformatted if needed,
2869 # since there is no @end command explicitly associated to raw commands
2870 # it won't be done elsewhere.
2871 } elsif ($current->{'contents'}
2872 and $current->{'contents'}->[-1]
2873 and $current->{'contents'}->[-1]->{'type'}
2874 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
2875 and $current->{'contents'}->[-2]
2876 and $current->{'contents'}->[-2]->{'cmdname'}
2877 and $current->{'contents'}->[-2]->{'cmdname'} eq 'verbatim') {
2878 $current = _begin_preformatted($self, $current);
2879 # misc command line arguments
2880 # Never go here if skipline/noarg/...
2881 } elsif ($current->{'type'}
2882 and $current->{'type'} eq 'line_arg') {
2883 my $context = pop @{$self->{'context_stack'}};
2884 if ($context ne 'line') {
2885 $self->_bug_message("context $context instead of line in line_arg",
2886 $line_nr, $current);
2887 }
2888 _isolate_last_space($self, $current);
2889
2890 # first parent is the @command, second is the parent
2891 $current = $current->{'parent'};
2892 my $misc_cmd = $current;
2893 my $command = $current->{'cmdname'};
2894 my $end_command;
2895 print STDERR "MISC END \@$command\n" if ($self->{'DEBUG'});
2896
2897 if ($self->{'line_commands'}->{$command} =~ /^\d$/) {
2898 my $args = _parse_line_command_args($self, $current, $line_nr);
2899 $current->{'extra'}->{'misc_args'} = $args if (defined($args));
2900 if ($command eq 'validatemenus') {
2901 if ($args and $args->[0]) {
2902 my $arg = $args->[0];
2903 if ($arg eq 'on') {
2904 $self->{'validatemenus'} = 1;
2905 } elsif ($arg eq 'off') {
2906 $self->{'validatemenus'} = 0;
2907 }
2908 }
2909 }
2910 } elsif ($self->{'line_commands'}->{$command} eq 'text') {
2911 my $text = '';
2912 my $superfluous_arg = 0;
2913 for my $c (@{$current->{'args'}->[0]->{'contents'}}) {
2914 # Allow @@, @{ and @} to give a way for @, { and } to appear in
2915 # filenames (although it's not a good idea to use these characters
2916 # in filenames).
2917 if ($c->{'text'}) {
2918 $text .= $c->{'text'};
2919 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '@') {
2920 $text .= '@';
2921 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '{') {
2922 $text .= '{';
2923 } elsif ($c->{'cmdname'} and $c->{'cmdname'} eq '}') {
2924 $text .= '}';
2925 } else {
2926 $superfluous_arg = 1;
2927 }
2928 }
2929 if ($text eq '') {
2930 if (not $superfluous_arg) {
2931 $self->_command_warn($current, $line_nr,
2932 __("\@%s missing argument"), $command);
2933 }
2934 # Otherwise an error message is issued below.
2935 $current->{'extra'}->{'missing_argument'} = 1;
2936 } else {
2937 $current->{'extra'}->{'text_arg'} = $text;
2938 if ($command eq 'end') {
2939 # REMACRO
2940 my $line = $text;
2941 if ($line =~ s/^([[:alnum:]][[:alnum:]-]+)//) {
2942 $end_command = $1;
2943
2944 if (!exists $block_commands{$end_command}) {
2945 $self->_command_warn($current, $line_nr,
2946 __("unknown \@end %s"), $end_command);
2947 $end_command = undef;
2948 } else {
2949 print STDERR "END BLOCK $end_command\n" if ($self->{'DEBUG'});
2950 if ($block_commands{$end_command} eq 'conditional') {
2951 if (@{$self->{'conditionals_stack'}}
2952 and $self->{'conditionals_stack'}->[-1] eq $end_command) {
2953 pop @{$self->{'conditionals_stack'}};
2954 } else {
2955 $self->_command_error($current, $line_nr,
2956 __("unmatched `%c%s'"), ord('@'), 'end');
2957 $end_command = undef;
2958 }
2959 }
2960 $current->{'extra'}->{'command_argument'} = $end_command
2961 if (defined($end_command));
2962 }
2963 if (($superfluous_arg or $line =~ /\S/)
2964 and defined($end_command)) {
2965 my $texi_line
2966 = Texinfo::Convert::Texinfo::convert($current->{'args'}->[0]);
2967 $texi_line =~ s/^\s*([[:alnum:]][[:alnum:]-]+)//;
2968 $self->_command_error($current, $line_nr,
2969 __("superfluous argument to \@%s %s: %s"),
2970 $command, $end_command, $texi_line);
2971 $superfluous_arg = 0; # Don't issue another error message below.
2972 }
2973 } else {
2974 $self->_command_error($current, $line_nr,
2975 __("bad argument to \@%s: %s"),
2976 $command, $line);
2977 }
2978 } elsif ($superfluous_arg) {
2979 # An error message is issued below.
2980 } elsif ($command eq 'include') {
2981 my $file = Texinfo::Common::locate_include_file($self, $text) ;
2982 if (defined($file)) {
2983 my $filehandle = do { local *FH };
2984 if (open ($filehandle, $file)) {
2985 $included_file = 1;
2986 binmode($filehandle, ":encoding($self->{'INPUT_PERL_ENCODING'})")
2987 if (defined($self->{'INPUT_PERL_ENCODING'}));
2988 print STDERR "Included $file($filehandle)\n" if ($self->{'DEBUG'});
2989 my ($directories, $suffix);
2990 ($file, $directories, $suffix) = fileparse($file)
2991 if ($self->{'TEST'});
2992 unshift @{$self->{'input'}}, {
2993 'name' => $file,
2994 'line_nr' => 0,
2995 'pending' => [],
2996 'fh' => $filehandle };
2997 } else {
2998 $self->_command_error($current, $line_nr,
2999 __("\@%s: could not open %s: %s"),
3000 $command, $text, $!);
3001 }
3002 } else {
3003 $self->_command_error($current, $line_nr,
3004 __("\@%s: could not find %s"),
3005 $command, $text);
3006 }
3007 } elsif ($command eq 'verbatiminclude') {
3008 $current->{'extra'}->{'input_perl_encoding'}
3009 = $self->{'INPUT_PERL_ENCODING'}
3010 if defined $self->{'INPUT_PERL_ENCODING'};
3011 } elsif ($command eq 'documentencoding') {
3012 my ($texinfo_encoding, $perl_encoding, $input_encoding)
3013 = Texinfo::Encoding::encoding_alias($text);
3014 $self->_command_warn($current, $line_nr,
3015 __("encoding `%s' is not a canonical texinfo encoding"),
3016 $text)
3017 if (!$texinfo_encoding or $texinfo_encoding ne lc($text));
3018 if ($input_encoding) {
3019 $current->{'extra'}->{'input_encoding_name'} = $input_encoding;
3020 }
3021 if (!$perl_encoding) {
3022 $self->_command_warn($current, $line_nr,
3023 __("unrecognized encoding name `%s'"), $text);
3024 } else {
3025 $current->{'extra'}->{'input_perl_encoding'} = $perl_encoding;
3026
3027 if ($input_encoding) {
3028 if (!$self->{'set'}->{'INPUT_ENCODING_NAME'}) {
3029 $self->{'INPUT_ENCODING_NAME'} = $input_encoding;
3030 $self->{'info'}->{'input_encoding_name'} = $input_encoding;
3031 }
3032 }
3033
3034 if (!$self->{'set'}->{'INPUT_PERL_ENCODING'}) {
3035 $self->{'INPUT_PERL_ENCODING'} = $perl_encoding;
3036 $self->{'info'}->{'input_perl_encoding'} = $perl_encoding;
3037 foreach my $input (@{$self->{'input'}}) {
3038 binmode($input->{'fh'}, ":encoding($perl_encoding)") if ($input->{'fh'});
3039 }
3040 }
3041 }
3042 } elsif ($command eq 'documentlanguage') {
3043 my @messages = Texinfo::Common::warn_unknown_language($text);
3044 foreach my $message(@messages) {
3045 $self->_command_warn($current, $line_nr, $message);
3046 }
3047 if (!$self->{'set'}->{'documentlanguage'}) {
3048 $self->{'documentlanguage'} = $text;
3049 }
3050 }
3051 }
3052 if ($superfluous_arg) {
3053 my $texi_line
3054 = Texinfo::Convert::Texinfo::convert($current->{'args'}->[0]);
3055 $texi_line =~ s/^\s*//;
3056 $texi_line =~ s/\s*$//;
3057
3058 $self->_command_error($current, $line_nr,
3059 __("bad argument to \@%s: %s"),
3060 $command, $texi_line);
3061
3062 }
3063 } elsif ($command eq 'node') {
3064 foreach my $arg (@{$current->{'args'}}) {
3065 my $node = _parse_node_manual($arg);
3066 push @{$current->{'extra'}->{'nodes_manuals'}}, $node;
3067 }
3068 _check_internal_node($self, $current->{'extra'}->{'nodes_manuals'}->[0],
3069 $line_nr);
3070 _register_label($self, $current,
3071 $current->{'extra'}->{'nodes_manuals'}->[0]);
3072 $self->{'current_node'} = $current;
3073 } elsif ($command eq 'listoffloats') {
3074 _parse_float_type($current);
3075 } else {
3076 # Handle all the other 'line' commands. Here just check that they
3077 # have an argument. Empty @top is allowed
3078 if (!@{$current->{'args'}->[0]->{'contents'}} and $command ne 'top') {
3079 $self->_command_warn($current, $line_nr,
3080 __("\@%s missing argument"), $command);
3081 $current->{'extra'}->{'missing_argument'} = 1;
3082 } else {
3083 if (($command eq 'item' or $command eq 'itemx')
3084 and $current->{'parent'}->{'cmdname'}
3085 and $self->{'command_index'}->{$current->{'parent'}->{'cmdname'}}) {
3086 _enter_index_entry($self, $current->{'parent'}->{'cmdname'},
3087 $command, $current,
3088 $current->{'args'}->[0]->{'contents'},
3089 undef, $line_nr);
3090 } elsif ($self->{'command_index'}->{$current->{'cmdname'}}) {
3091 _enter_index_entry($self, $current->{'cmdname'},
3092 $current->{'cmdname'}, $current,
3093 $current->{'args'}->[0]->{'contents'},
3094 undef, $line_nr);
3095 $current->{'type'} = 'index_entry_command';
3096 }
3097 }
3098 }
3099 $current = $current->{'parent'};
3100 if ($end_command) {
3101 print STDERR "END COMMAND $end_command\n" if ($self->{'DEBUG'});
3102 my $end = pop @{$current->{'contents'}};
3103 if ($block_commands{$end_command} ne 'conditional') {
3104 my $closed_command;
3105 ($closed_command, $current)
3106 = _close_commands($self, $current, $line_nr, $end_command);
3107 my $inline_copying;
3108 if ($closed_command) {
3109 $closed_command->{'extra'}->{'end_command'} = $misc_cmd;
3110 _close_command_cleanup($self, $closed_command);
3111 $end->{'parent'} = $closed_command;
3112
3113 push @{$closed_command->{'contents'}}, $end;
3114
3115 # closing a menu command, but still in a menu. Open a menu_comment
3116 if ($menu_commands{$closed_command->{'cmdname'}}
3117 and $self->{'context_stack'}->[-1] eq 'menu') {
3118 print STDERR "CLOSE MENU but still in menu context\n"
3119 if ($self->{'DEBUG'});
3120 push @{$current->{'contents'}}, {'type' => 'menu_comment',
3121 'parent' => $current,
3122 'contents' => [] };
3123 $current = $current->{'contents'}->[-1];
3124 push @{$self->{'context_stack'}}, 'preformatted';
3125 }
3126 } else {
3127 # block command not found for @end
3128 }
3129 $current = _begin_preformatted($self, $current)
3130 if ($close_preformatted_commands{$end_command});
3131 }
3132 } else {
3133 $current = _begin_preformatted($self, $current)
3134 if ($close_preformatted_commands{$command});
3135 }
3136 # if a file was included, remove completly the include file command.
3137 # Also ignore @setfilename in included file, as said in the manual.
3138 if ($included_file or ($command eq 'setfilename'
3139 and scalar(@{$self->{'input'}}) > 1)) {
3140 # TODO keep the information with sourcemark
3141 pop @{$current->{'contents'}};
3142 } elsif ($command eq 'setfilename'
3143 and ($self->{'current_node'} or $self->{'current_section'})) {
3144 $self->_command_warn($misc_cmd, $line_nr,
3145 __("\@%s after the first element"), $command);
3146 # columnfractions
3147 } elsif ($command eq 'columnfractions') {
3148 # in a multitable, we are in a block_line_arg
3149 if (!$current->{'parent'} or !$current->{'parent'}->{'cmdname'}
3150 or $current->{'parent'}->{'cmdname'} ne 'multitable') {
3151 $self->_command_error($current, $line_nr,
3152 __("\@%s only meaningful on a \@multitable line"),
3153 $command);
3154 } else {
3155 # This is the multitable block_line_arg line context
3156 my $context = pop @{$self->{'context_stack'}};
3157 if ($context ne 'line') {
3158 $self->_bug_message("context $context instead of line for multitable",
3159 $line_nr, $current);
3160 }
3161 $current = $current->{'parent'};
3162 $current->{'extra'}->{'max_columns'} = 0;
3163 if (defined($misc_cmd->{'extra'}->{'misc_args'})) {
3164 $current->{'extra'}->{'max_columns'} =
3165 scalar(@{$misc_cmd->{'extra'}->{'misc_args'}});
3166 $current->{'extra'}->{'columnfractions'} = $misc_cmd;
3167 }
3168 push @{$current->{'contents'}}, { 'type' => 'before_item',
3169 'contents' => [], 'parent', $current };
3170 $current = $current->{'contents'}->[-1];
3171 }
3172 } elsif ($root_commands{$command}) {
3173 $current = $current->{'contents'}->[-1];
3174 delete $current->{'remaining_args'};
3175
3176 # associate the section (not part) with the current node.
3177 if ($command ne 'node' and $command ne 'part') {
3178 if ($self->{'current_node'}
3179 and !$self->{'current_node'}->{'extra'}->{'associated_section'}) {
3180 $self->{'current_node'}->{'extra'}->{'associated_section'} = $current;
3181 $current->{'extra'}->{'associated_node'} = $self->{'current_node'};
3182 }
3183 if ($self->{'current_part'}) {
3184 $current->{'extra'}->{'associated_part'} = $self->{'current_part'};
3185 $self->{'current_part'}->{'extra'}->{'part_associated_section'}
3186 = $current;
3187 if ($current->{'cmdname'} eq 'top') {
3188 $self->line_warn("\@part should not be associated with \@top",
3189 $self->{'current_part'}->{'line_nr'});
3190 }
3191 delete $self->{'current_part'};
3192 }
3193 $self->{'current_section'} = $current;
3194 } elsif ($command eq 'part') {
3195 $self->{'current_part'} = $current;
3196 if ($self->{'current_node'}
3197 and !$self->{'current_node'}->{'extra'}->{'associated_section'}) {
3198 $self->line_warn (sprintf(__(
3199 "\@node precedes \@%s, but parts may not be associated with nodes"),
3200 $command), $line_nr);
3201 }
3202 }
3203 }
3204 # do that last in order to have the line processed if one of the above
3205 # case is also set.
3206 } elsif (
3207 $current->{'contents'}
3208 and (scalar(@{$current->{'contents'}}) == 1
3209 and (($current->{'contents'}->[-1]->{'type'}
3210 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'))
3211 or (scalar(@{$current->{'contents'}}) == 2
3212 and $current->{'contents'}->[-1]->{'cmdname'}
3213 and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
3214 or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')
3215 and $current->{'contents'}->[-2]
3216 and $current->{'contents'}->[-2]->{'type'}
3217 and $current->{'contents'}->[-2]->{'type'} eq 'empty_line_after_command'))) {
3218 # empty line after a @menu or before a preformatted. Reparent to the menu
3219 # or other format
3220 if ($current->{'type'}
3221 and $preformatted_contexts{$current->{'type'}}) {
3222 my $parent = $current->{'parent'};
3223 if ($parent->{'type'} and $parent->{'type'} eq 'menu_comment'
3224 and scalar(@{$parent->{'contents'}}) == 1) {
3225 $parent = $parent->{'parent'};
3226 }
3227 my $to_reparent = pop @{$parent->{'contents'}};
3228 print STDERR "LINE AFTER COMMAND IN PREFORMATTED ($to_reparent->{'type'})\n" if ($self->{'DEBUG'});
3229 while (@{$current->{'contents'}}) {
3230 my $content = shift @{$current->{'contents'}};
3231 $content->{'parent'} = $parent;
3232 push @{$parent->{'contents'}}, $content;
3233 }
3234 push @{$parent->{'contents'}}, $to_reparent;
3235 }
3236 }
3237
3238 # this happens if there is a nesting of line @-commands on a line.
3239 # they are reprocessed here.
3240 if ($self->{'context_stack'}->[-1] eq 'line'
3241 or $self->{'context_stack'}->[-1] eq 'def') {
3242 print STDERR "Still opened line command $self->{'context_stack'}->[-1]:"._print_current($current)
3243 if ($self->{'DEBUG'});
3244 if ($self->{'context_stack'}->[-1] eq 'def') {
3245 while ($current->{'parent'} and !($current->{'parent'}->{'type'}
3246 and $current->{'parent'}->{'type'} eq 'def_line')) {
3247 $current = _close_current($self, $current, $line_nr);
3248 }
3249 } else {
3250 while ($current->{'parent'} and !($current->{'type'}
3251 and ($current->{'type'} eq 'block_line_arg'
3252 or $current->{'type'} eq 'line_arg'))) {
3253 $current = _close_current($self, $current, $line_nr);
3254 }
3255 }
3256
3257 # check for infinite loop bugs...
3258 if ($current eq $current_old) {
3259 my $indent = '- ';
3260 my $tree_msg = $indent . _print_current($current);
3261 while ($current->{'parent'}) {
3262 $indent = '-'.$indent;
3263 $current = $current->{'parent'};
3264 $tree_msg .= $indent . _print_current($current);
3265 }
3266 $self->_bug_message("Nothing closed while a line context remains\n$tree_msg",
3267 $line_nr);
3268 die;
3269 }
3270
3271 $current = $self->_end_line($current, $line_nr);
3272 }
3273 return $current;
3274 }
3275
3276 # $command may be undef if we are after a wrong misc command such as
3277 # a buggy @tab.
3278 sub _start_empty_line_after_command($$$) {
3279 my ($line, $current, $command) = @_;
3280
3281 $line =~ s/^([^\S\r\n]*)//;
3282 push @{$current->{'contents'}}, { 'type' => 'empty_line_after_command',
3283 'text' => $1,
3284 'parent' => $current,
3285 };
3286 if (defined($command)) {
3287 $current->{'contents'}->[-1]->{'extra'} = {'command' => $command};
3288 }
3289 return $line;
3290 }
3291
3292 sub _check_empty_node($$$$)
3293 {
3294 my ($self, $parsed_node, $command, $line_nr) = @_;
3295
3296 if (!defined($parsed_node) or !$parsed_node->{'node_content'}) {
3297 $self->line_error (sprintf(__("empty argument in \@%s"),
3298 $command), $line_nr);
3299 return 0;
3300 } else {
3301 return 1;
3302 }
3303 }
3304
3305 sub _check_internal_node($$$)
3306 {
3307 my ($self, $parsed_node, $line_nr) = @_;
3308
3309 if ($parsed_node and $parsed_node->{'manual_content'}) {
3310 $self->line_error (sprintf(__("syntax for an external node used for `%s'"),
3311 Texinfo::Structuring::node_extra_to_texi($parsed_node)), $line_nr)
3312 }
3313 }
3314
3315 sub _check_node_label($$$$)
3316 {
3317 my ($self, $parsed_node, $command, $line_nr) = @_;
3318
3319 _check_internal_node($self, $parsed_node, $line_nr);
3320 return _check_empty_node($self, $parsed_node, $command, $line_nr);
3321 }
3322
3323 sub _register_extra_menu_entry_information($$;$)
3324 {
3325 my ($self, $current, $line_nr) = @_;
3326
3327 foreach my $arg (@{$current->{'args'}}) {
3328 if ($arg->{'type'} eq 'menu_entry_name') {
3329 $current->{'extra'}->{'menu_entry_name'} = $arg;
3330 my $normalized_menu_entry_name =
3331 Texinfo::Convert::NodeNameNormalization::normalize_node($arg);
3332 if ($normalized_menu_entry_name !~ /[^-]/) {
3333 $self->line_warn(sprintf(__("empty menu entry name in `%s'"),
3334 Texinfo::Convert::Texinfo::convert($current)), $line_nr);
3335 }
3336 } elsif ($arg->{'type'} eq 'menu_entry_node') {
3337 _isolate_last_space($self, $arg);
3338 my $parsed_entry_node = _parse_node_manual($arg);
3339 if (! defined($parsed_entry_node)) {
3340 if ($self->{'SHOW_MENU'}) {
3341 $self->line_error (__("empty node name in menu entry"), $line_nr);
3342 }
3343 } else {
3344 delete $parsed_entry_node->{'normalized'};
3345 $current->{'extra'}->{'menu_entry_node'} = $parsed_entry_node;
3346 }
3347 } elsif ($arg->{'type'} eq 'menu_entry_description') {
3348 $current->{'extra'}->{'menu_entry_description'} = $arg;
3349 }
3350 }
3351 }
3352
3353 sub _enter_menu_entry_node($$$)
3354 {
3355 my ($self, $current, $line_nr) = @_;
3356
3357 my $description = { 'type' => 'menu_entry_description',
3358 'contents' => [],
3359 'parent' => $current };
3360 push @{$current->{'args'}}, $description;
3361 _register_extra_menu_entry_information($self, $current, $line_nr);
3362 $current->{'line_nr'} = $line_nr;
3363 push @{$self->{'internal_references'}}, $current;
3364
3365 $current = $description;
3366 push @{$current->{'contents'}}, {'type' => 'preformatted',
3367 'parent' => $current,
3368 'contents' => [] };
3369 $current = $current->{'contents'}->[-1];
3370 push @{$self->{'context_stack'}}, 'preformatted';
3371 return $current;
3372 }
3373
3374 sub _command_with_command_as_argument($)
3375 {
3376 my $current = shift;
3377 return ($current and $current->{'type'}
3378 and $current->{'type'} eq 'block_line_arg'
3379 and $current->{'parent'}
3380 and $current->{'parent'}->{'cmdname'} and
3381 ($current->{'parent'}->{'cmdname'} eq 'itemize'
3382 or $item_line_commands{$current->{'parent'}->{'cmdname'}})
3383 and scalar(@{$current->{'contents'}}) == 1);
3384 }
3385
3386 # This combines several regular expressions used in '_parse_texi' to
3387 # look at what is next on the remaining part of the line.
3388 # NOTE - this sub has an XS override
3389 sub _parse_texi_regex {
3390 my ($line) = @_;
3391
3392 my ($at_command, $open_brace, $asterisk, $single_letter_command,
3393 $separator_match, $misc_text)
3394 = ($line =~ /^\@([[:alnum:]][[:alnum:]-]*)
3395 |^(\{)
3396 |^(\*)
3397 |^\@(["'~\@&\}\{,\.!\? \t\n\*\-\^`=:\|\/\\])
3398 |^([{}@,:\t.\f])
3399 |^([^{}@,:\t.\n\f]+)
3400 /x);
3401
3402 if ($open_brace) {
3403 $separator_match = $open_brace;
3404 } elsif ($asterisk) {
3405 ($misc_text) = ($line =~ /^([^{}@,:\t.\n\f]+)/);
3406 }
3407
3408 return ($at_command, $open_brace, $asterisk, $single_letter_command,
3409 $separator_match, $misc_text);
3410 }
3411
3412 sub _check_line_directive {
3413 my ($self, $line, $line_nr) = @_;
3414
3415 if ($self->{'CPP_LINE_DIRECTIVES'}
3416 and defined($line_nr->{'file_name'})
3417 and $line_nr->{'file_name'} ne ''
3418 and !$line_nr->{'macro'}
3419 and $line =~ /^\s*#\s*(line)? (\d+)(( "([^"]+)")(\s+\d+)*)?\s*$/) {
3420 _save_line_directive ($self, $2, $5);
3421 return 1;
3422 }
3423 return 0;
3424 }
3425
3426 # Check whether $COMMAND can appear within $CURRENT->{'parent'}.
3427 sub _check_valid_nesting {
3428 my ($self, $current, $command, $line_nr) = @_;
3429
3430 my $invalid_parent;
3431 # error messages for forbidden constructs, like @node in @r,
3432 # block command on line command, @xref in @anchor or node...
3433 if ($current->{'parent'}) {
3434 if ($current->{'parent'}->{'cmdname'}) {
3435 if (defined($self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}})
3436 and !$self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}}->{$command}
3437 # we make sure that we are on a root @-command line and
3438 # not in contents
3439 and (!$root_commands{$current->{'parent'}->{'cmdname'}}
3440 or ($current->{'type'}
3441 and $current->{'type'} eq 'line_arg'))
3442 # we make sure that we are on a block @-command line and
3443 # not in contents
3444 and (!($block_commands{$current->{'parent'}->{'cmdname'}})
3445 or ($current->{'type'}
3446 and $current->{'type'} eq 'block_line_arg'))
3447 # we make sure that we are on an @item/@itemx line and
3448 # not in an @enumerate, @multitable or @itemize @item.
3449 and (($current->{'parent'}->{'cmdname'} ne 'itemx'
3450 and $current->{'parent'}->{'cmdname'} ne 'item')
3451 or ($current->{'type'}
3452 and $current->{'type'} eq 'line_arg'))) {
3453 $invalid_parent = $current->{'parent'}->{'cmdname'};
3454 }
3455 } elsif ($self->{'context_stack'}->[-1] eq 'def'
3456 # FIXME instead of hardcoding in_full_line_commands_no_refs
3457 # it would be better to use the parent command valid_nesting.
3458 and !$in_full_line_commands_no_refs{$command}) {
3459 my $def_block = $current;
3460 while ($def_block->{'parent'} and (!$def_block->{'parent'}->{'type'}
3461 or $def_block->{'parent'}->{'type'} ne 'def_line')) {
3462 $def_block = $def_block->{'parent'};
3463 }
3464
3465 $invalid_parent = $def_block->{'parent'}->{'parent'}->{'cmdname'};
3466 }
3467 }
3468
3469 if (defined($invalid_parent)) {
3470 $self->line_warn(sprintf(__("\@%s should not appear in \@%s"),
3471 $command, $invalid_parent), $line_nr);
3472 }
3473 }
3474
3475
3476 # the main subroutine
3477 sub _parse_texi($;$)
3478 {
3479 my ($self, $root) = @_;
3480
3481 $root = { 'contents' => [], 'type' => 'text_root' } if (!defined($root));
3482 my $current = $root;
3483
3484 my $line_nr;
3485
3486 NEXT_LINE:
3487 while (1) {
3488 my $line;
3489 ($line, $line_nr) = _next_text($self, $line_nr);
3490 last if (!defined($line));
3491
3492 if ($self->{'DEBUG'}) {
3493 my $line_text = '';
3494 $line_text = "$line_nr->{'line_nr'}.$line_nr->{'macro'}" if ($line_nr);
3495 print STDERR "NEW LINE(".join('|', @{$self->{'context_stack'}}).":@{$self->{'conditionals_stack'}}:$line_text): $line";
3496 #print STDERR "CONTEXT_STACK ".join('|',@{$self->{'context_stack'}})."\n";
3497 }
3498
3499 if (not
3500 # raw format or verb
3501 (($current->{'cmdname'}
3502 and $block_commands{$current->{'cmdname'}}
3503 and ($block_commands{$current->{'cmdname'}} eq 'raw'
3504 or $block_commands{$current->{'cmdname'}} eq 'conditional'))
3505 or
3506 ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
3507 and $current->{'parent'}->{'cmdname'} eq 'verb')
3508 )
3509 # not def line
3510 and $self->{'context_stack'}->[-1] ne 'def') {
3511 next NEXT_LINE if _check_line_directive ($self, $line, $line_nr);
3512 print STDERR "BEGIN LINE\n" if ($self->{'DEBUG'});
3513
3514 if ($current->{'contents'}
3515 and $current->{'contents'}->[-1]
3516 and $current->{'contents'}->[-1]->{'type'}
3517 and $current->{'contents'}->[-1]->{'type'}
3518 eq 'empty_spaces_before_argument') {
3519 # Remove this element and update 'extra' values.
3520 # FIXME: should we continue with this element instead?
3521 _abort_empty_line($self, $current);
3522 }
3523 $line =~ s/^([^\S\r\n]*)//;
3524 push @{$current->{'contents'}}, { 'type' => 'empty_line',
3525 'text' => $1,
3526 'parent' => $current };
3527 }
3528
3529 while (1) {
3530 # in a raw or ignored conditional block command
3531 if ($current->{'cmdname'} and
3532 $block_commands{$current->{'cmdname'}} and
3533 ($block_commands{$current->{'cmdname'}} eq 'raw'
3534 or $block_commands{$current->{'cmdname'}} eq 'conditional')) {
3535 # r?macro may be nested
3536 if (($current->{'cmdname'} eq 'macro'
3537 or $current->{'cmdname'} eq 'rmacro')
3538 and $line =~ /^\s*\@r?macro\s+/) {
3539 $line =~ s/\s*\@(r?macro)//;
3540 push @{$current->{'contents'}}, { 'cmdname' => $1,
3541 'parent' => $current,
3542 'contents' => [],
3543 'extra' => {'arg_line' => $line }};
3544 $current = $current->{'contents'}->[-1];
3545 last;
3546 # ifclear/ifset may be nested
3547 } elsif (($current->{'cmdname'} eq 'ifclear'
3548 or $current->{'cmdname'} eq 'ifset'
3549 or $current->{'cmdname'} eq 'ifcommanddefined'
3550 or $current->{'cmdname'} eq 'ifcommandnotdefined')
3551 and $line =~ /^\s*\@$current->{'cmdname'}/) {
3552 $line =~ s/\s*\@($current->{'cmdname'})//;
3553 push @{$current->{'contents'}}, { 'cmdname' => $1,
3554 'parent' => $current,
3555 'contents' => [],
3556 'extra' => {'line' => $line }};
3557 $current = $current->{'contents'}->[-1];
3558 last;
3559 } elsif ($line =~ /^(\s*?)\@end\s+([a-zA-Z][\w-]*)/
3560 and ($2 eq $current->{'cmdname'})) {
3561 my $end_command = $2;
3562 $line =~ s/^(\s*?)(\@end\s+$current->{'cmdname'})//;
3563 if ($1 eq '') {
3564 # FIXME exclude other formats, like @macro, @ifset, @ignore?
3565 if ($current->{'cmdname'} ne 'verbatim'
3566 and @{$current->{'contents'}}
3567 and $current->{'contents'}->[-1]->{'type'}
3568 and $current->{'contents'}->[-1]->{'type'} eq 'raw') {
3569 if ($current->{'contents'}->[-1]->{'text'} =~ s/(\n)//) {
3570 push @{$current->{'contents'}}, {'type' => 'last_raw_newline',
3571 'text' => $1, 'parent' => $current};
3572 }
3573 }
3574 } else {
3575 push @{$current->{'contents'}},
3576 { 'text' => $1, 'type' => 'raw', 'parent' => $current };
3577 $self->line_warn(sprintf(__("\@end %s should only appear at the beginning of a line"),
3578 $end_command), $line_nr);
3579 }
3580 # if there is a user defined macro that expandes to spaces, there
3581 # will be a spurious warning.
3582 $self->line_warn(sprintf(
3583 __("superfluous argument to \@%s %s: %s"), 'end', $end_command,
3584 $line), $line_nr)
3585 if ($line =~ /\S/ and $line !~ /^\s*\@c(omment)?\b/);
3586 # store toplevel macro specification
3587 if (($end_command eq 'macro' or $end_command eq 'rmacro')
3588 and (! $current->{'parent'}
3589 or !$current->{'parent'}->{'cmdname'}
3590 or ($current->{'parent'}->{'cmdname'} ne 'macro'
3591 and $current->{'parent'}->{'cmdname'} ne 'rmacro'))) {
3592 my $macrobody =
3593 Texinfo::Convert::Texinfo::convert({ 'contents'
3594 => $current->{'contents'} });
3595 if ($current->{'args'} and $current->{'args'}->[0]) {
3596 my $name = $current->{'args'}->[0]->{'text'};
3597 if (exists($self->{'macros'}->{$name})) {
3598 $self->line_warn(sprintf(__("macro `%s' previously defined"),
3599 $name), $current->{'line_nr'});
3600 $self->line_warn(sprintf(__(
3601 "here is the previous definition of `%s'"),
3602 $name), $self->{'macros'}->{$name}->{'element'}->{'line_nr'});
3603 }
3604 if ($all_commands{$name}) {
3605 $self->line_warn(sprintf(__(
3606 "redefining Texinfo language command: \@%s"),
3607 $name), $current->{'line_nr'});
3608 }
3609 if (!$current->{'extra'}->{'invalid_syntax'}) {
3610 $self->{'macros'}->{$name} = {
3611 'element' => $current,
3612 'macrobody' => $macrobody
3613 };
3614 # Don't need 'args_index' in final tree.
3615 if (defined $current->{'extra'}->{'args_index'}) {
3616 $self->{'macros'}->{$name}->{'args_index'}
3617 = $current->{'extra'}->{'args_index'};
3618 delete $current->{'extra'}->{'args_index'};
3619 }
3620 } elsif (defined $current->{'extra'}->{'args_index'}) {
3621 delete $current->{'extra'}->{'args_index'};
3622 }
3623 }
3624 }
3625 $current = $current->{'parent'};
3626 if ($block_commands{$end_command} eq 'conditional') {
3627 # don't store ignored @if*
3628 my $conditional = pop @{$current->{'contents'}};
3629 if (!defined($conditional->{'cmdname'}
3630 or $conditional->{'cmdname'} ne $end_command)) {
3631 $self->_bug_message("Ignored command is not the conditional $end_command",
3632 $line_nr, $conditional);
3633 die;
3634 }
3635 # Ignore until end of line
3636 if ($line !~ /\n/) {
3637 ($line, $line_nr) = _new_line($self, $line_nr);
3638 print STDERR "IGNORE CLOSE line: $line" if ($self->{'DEBUG'});
3639 }
3640 print STDERR "CLOSED conditional $end_command\n" if ($self->{'DEBUG'});
3641 last;
3642 } else {
3643 print STDERR "CLOSED raw $end_command\n" if ($self->{'DEBUG'});
3644 $line =~ s/^([^\S\r\n]*)//;
3645 # Start an element to have the spaces at the end of the line
3646 # ignored.
3647 push @{$current->{'contents'}},
3648 { 'type' => 'empty_line_after_command',
3649 'text' => $1,
3650 'parent' => $current,
3651 };
3652 }
3653 } else {
3654 if (@{$current->{'contents'}}
3655 and $current->{'contents'}->[-1]->{'type'}
3656 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
3657 and $current->{'contents'}->[-1]->{'text'} !~ /\n/
3658 and $line !~ /\S/) {
3659 $current->{'contents'}->[-1]->{'text'} .= $line;
3660 } else {
3661 push @{$current->{'contents'}},
3662 { 'text' => $line, 'type' => 'raw', 'parent' => $current };
3663 }
3664 last;
3665 }
3666 # in @verb. type should be 'brace_command_arg'
3667 } elsif ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
3668 and $current->{'parent'}->{'cmdname'} eq 'verb') {
3669 # collect the first character if not already done
3670 if (!defined($current->{'parent'}->{'extra'}->{'delimiter'})) {
3671 if ($line =~ /^$/) {
3672 $current->{'parent'}->{'extra'}->{'delimiter'} = '';
3673 $self->line_error(sprintf(
3674 __("\@%s without associated character"), 'verb'), $line_nr);
3675 } else {
3676 $line =~ s/^(.)//;
3677 $current->{'parent'}->{'extra'}->{'delimiter'} = $1;
3678 }
3679 }
3680 my $char = quotemeta($current->{'parent'}->{'extra'}->{'delimiter'});
3681 if ($line =~ s/^(.*?)$char\}/\}/) {
3682 push @{$current->{'contents'}},
3683 { 'text' => $1, 'type' => 'raw', 'parent' => $current }
3684 if ($1 ne '');
3685 print STDERR "END VERB\n" if ($self->{'DEBUG'});
3686 } else {
3687 push @{$current->{'contents'}},
3688 { 'text' => $line, 'type' => 'raw', 'parent' => $current };
3689 print STDERR "LINE VERB: $line" if ($self->{'DEBUG'});
3690 last;
3691 }
3692 }
3693
3694 # this mostly happens in the following cases:
3695 # after expansion of user defined macro that doesn't end with EOL
3696 # after a protection of @\n in @def* line
3697 # at the end of an expanded Texinfo fragment
3698 while ($line eq '') {
3699 print STDERR "EMPTY TEXT\n"
3700 if ($self->{'DEBUG'});
3701 ($line, $line_nr) = _next_text($self, $line_nr);
3702 if (!defined($line)) {
3703 # end of the file or of a text fragment.
3704 $current = _end_line ($self, $current, $line_nr);
3705 # It may happen that there is an @include file on the line, it
3706 # will be picked up at NEXT_LINE, beginning a new line
3707 next NEXT_LINE;
3708 }
3709 }
3710
3711 # handle user defined macros before anything else since
3712 # their expansion may lead to changes in the line
3713 # REMACRO
3714 my $at_command_length;
3715
3716 my ($at_command, $open_brace, $asterisk, $single_letter_command,
3717 $separator_match, $misc_text) = _parse_texi_regex ($line);
3718
3719 if ($at_command) {
3720 $at_command_length = length($at_command) + 1;
3721 }
3722 if ($at_command
3723 and ($self->{'macros'}->{$at_command}
3724 or (exists $self->{'aliases'}->{$at_command} and
3725 $self->{'macros'}->{$self->{'aliases'}->{$at_command}}))) {
3726 substr($line, 0, $at_command_length) = '';
3727 my $command = $at_command;
3728 my $alias_command;
3729 if (exists($self->{'aliases'}->{$command})) {
3730 $alias_command = $command;
3731 $command = $self->{'aliases'}->{$command};
3732 }
3733
3734 my $expanded_macro = $self->{'macros'}->{$command}->{'element'};
3735 my $args_number = scalar(@{$expanded_macro->{'args'}}) -1;
3736 my $arguments = [];
3737 if ($line =~ s/^\s*{\s*//) { # macro with args
3738 ($arguments, $line, $line_nr) =
3739 _expand_macro_arguments($self, $expanded_macro, $line, $line_nr);
3740 } elsif (($args_number >= 2) or ($args_number <1)) {
3741 # as agreed on the bug-texinfo mailing list, no warn when zero
3742 # arg and not called with {}.
3743 $self->line_warn(sprintf(__(
3744 "\@%s defined with zero or more than one argument should be invoked with {}"),
3745 $command), $line_nr)
3746 if ($args_number >= 2);
3747 } else {
3748 if ($line !~ /\n/) {
3749 ($line, $line_nr) = _new_line($self, $line_nr);
3750 $line = '' if (!defined($line));
3751 }
3752 $line =~ s/^\s*// if ($line =~ /\S/);
3753 my $has_end_of_line = chomp $line;
3754 $arguments = [$line];
3755 $line = "\n" if ($has_end_of_line);
3756 }
3757 my $expanded = _expand_macro_body ($self,
3758 $self->{'macros'}->{$command},
3759 $arguments, $line_nr);
3760 print STDERR "MACROBODY: $expanded".'||||||'."\n"
3761 if ($self->{'DEBUG'});
3762 # empty result. It is ignored here.
3763 if ($expanded eq '') {
3764 next;
3765 }
3766 if ($self->{'MAX_MACRO_CALL_NESTING'}
3767 and scalar(@{$self->{'macro_stack'}}) > $self->{'MAX_MACRO_CALL_NESTING'}) {
3768 $self->line_warn(sprintf(__(
3769 "macro call nested too deeply (set MAX_NESTED_MACROS to override; current value %d)"),
3770 $self->{'MAX_MACRO_CALL_NESTING'}), $line_nr);
3771 next;
3772 }
3773 if ($expanded_macro->{'cmdname'} eq 'macro') {
3774 my $found = 0;
3775 foreach my $macro (@{$self->{'macro_stack'}}) {
3776 if ($macro->{'args'}->[0]->{'text'} eq $command) {
3777 $self->line_error(sprintf(__(
3778 "recursive call of macro %s is not allowed; use \@rmacro if needed"),
3779 $command), $line_nr);
3780 $found = 1;
3781 last;
3782 }
3783 }
3784 next if ($found);
3785 }
3786
3787 my $expanded_lines = _text_to_lines($expanded);
3788 next if (!@$expanded_lines);
3789 chomp ($expanded_lines->[-1]);
3790 pop @$expanded_lines if ($expanded_lines->[-1] eq '');
3791 print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
3792 ."|\nEND LINES MACRO EXPANSION\n" if ($self->{'DEBUG'});
3793 next if (!@$expanded_lines);
3794 unshift @{$self->{'macro_stack'}}, $expanded_macro;
3795 print STDERR "UNSHIFT MACRO_STACK: $expanded_macro->{'args'}->[0]->{'text'}\n"
3796 if ($self->{'DEBUG'});
3797 my $new_lines = _complete_line_nr($expanded_lines,
3798 $line_nr->{'line_nr'}, $line_nr->{'file_name'},
3799 $expanded_macro->{'args'}->[0]->{'text'}, 1);
3800 $line_nr->{'end_macro'} = 1;
3801 unshift @{$self->{'input'}->[0]->{'pending'}}, [$line, $line_nr];
3802 my $new_text = shift @$new_lines;
3803 ($line, $line_nr) = ($new_text->[0], $new_text->[1]);
3804 unshift @{$self->{'input'}->[0]->{'pending'}}, @$new_lines;
3805
3806 # Now handle all the cases that may lead to command closing
3807 # or following character association with an @-command, especially
3808 # accent command, that is handle @-command with braces that don't
3809 # always need a brace.
3810
3811 # The condition below is only caught right after command opening,
3812 # otherwise we are in the 'args' and not right in the command container.
3813 } elsif ($current->{'cmdname'}
3814 and defined($brace_commands{$current->{'cmdname'}})
3815 and !$open_brace) {
3816 # special case for @-command as argument of @itemize or @*table.
3817 if (_command_with_command_as_argument($current->{'parent'})) {
3818 print STDERR "FOR PARENT \@$current->{'parent'}->{'parent'}->{'cmdname'} command_as_argument $current->{'cmdname'}\n" if ($self->{'DEBUG'});
3819 $current->{'type'} = 'command_as_argument' if (!$current->{'type'});
3820 $current->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
3821 = $current;
3822 $current = $current->{'parent'};
3823 # now accent commands
3824 } elsif ($accent_commands{$current->{'cmdname'}}) {
3825 if ($line =~ /^[^\S\r\n]/) {
3826 if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
3827 $line =~ s/^([^\S\r\n]+)//;
3828 $current->{'extra'}->{'spaces'} = ''
3829 if (!defined($current->{'extra'}->{'spaces'}));
3830 $current->{'extra'}->{'spaces'} .= $1;
3831 } else {
3832 $self->line_warn(sprintf(
3833 __("accent command `\@%s' must not be followed by whitespace"),
3834 $current->{'cmdname'}), $line_nr);
3835 $current = $current->{'parent'};
3836 }
3837 } elsif ($line =~ /^\@/) {
3838 $self->line_error(sprintf(
3839 __("use braces to give a command as an argument to \@%s"),
3840 $current->{'cmdname'}), $line_nr);
3841 $current = $current->{'parent'};
3842 } elsif ($line =~ s/^(.)//o) {
3843 print STDERR "ACCENT \@$current->{'cmdname'}\n"
3844 if ($self->{'DEBUG'});
3845 my $following_arg = {'type' => 'following_arg',
3846 'parent' => $current};
3847 $following_arg->{'contents'} = [{ 'text' => $1,
3848 'parent' => $following_arg } ];
3849 $current->{'args'} = [ $following_arg ];
3850 if ($current->{'cmdname'} eq 'dotless' and $1 ne 'i' and $1 ne 'j') {
3851 $self->line_error(sprintf(
3852 __("%c%s expects `i' or `j' as argument, not `%s'"),
3853 ord('@'), $current->{'cmdname'}, $1), $line_nr);
3854 }
3855 if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
3856 $current->{'args'}->[-1]->{'type'} = 'space_command_arg';
3857 }
3858 $current = $current->{'parent'};
3859 } else { # The accent is at end of line
3860 # whitespace for commands with letter.
3861 print STDERR "STRANGE ACC \@$current->{'cmdname'}\n" if ($self->{'DEBUG'});
3862 $self->line_warn(sprintf(
3863 __("accent command `\@%s' must not be followed by new line"),
3864 $current->{'cmdname'}), $line_nr);
3865 $current = $current->{'parent'};
3866 }
3867 next;
3868 } else {
3869 # ignore space after a braced @-command like TeX does
3870 if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
3871 and $line =~ s/^\s+//) {
3872 next;
3873 }
3874 $self->line_error(sprintf(__("\@%s expected braces"),
3875 $current->{'cmdname'}), $line_nr);
3876 $current = $current->{'parent'};
3877 }
3878 # maybe a menu entry beginning: a * at the beginning of a menu line
3879 } elsif ($current->{'type'}
3880 and $current->{'type'} eq 'preformatted'
3881 and $current->{'parent'}->{'type'}
3882 and ($current->{'parent'}->{'type'} eq 'menu_comment'
3883 or $current->{'parent'}->{'type'} eq 'menu_entry_description')
3884 and $asterisk
3885 and @{$current->{'contents'}}
3886 and $current->{'contents'}->[-1]->{'type'}
3887 and $current->{'contents'}->[-1]->{'type'} eq 'empty_line'
3888 and $current->{'contents'}->[-1]->{'text'} eq '') {
3889 print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
3890 _abort_empty_line($self, $current);
3891 $line =~ s/^\*//;
3892 push @{$current->{'contents'}}, { 'parent' => $current,
3893 'type' => 'menu_star',
3894 'text' => '*' };
3895 # a space after a * at the beginning of a menu line
3896 } elsif ($current->{'contents'} and @{$current->{'contents'}}
3897 and $current->{'contents'}->[-1]->{'type'}
3898 and $current->{'contents'}->[-1]->{'type'} eq 'menu_star') {
3899 if ($line !~ /^\s+/) {
3900 print STDERR "ABORT MENU STAR ($line)\n" if ($self->{'DEBUG'});
3901 delete $current->{'contents'}->[-1]->{'type'};
3902 } else {
3903 print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
3904 # this is the menu star collected previously
3905 pop @{$current->{'contents'}};
3906 $line =~ s/^(\s+)//;
3907 my $leading_text = '*' . $1;
3908 if ($current->{'type'} eq 'preformatted'
3909 and $current->{'parent'}->{'type'}
3910 and $current->{'parent'}->{'type'} eq 'menu_comment') {
3911 my $menu = $current->{'parent'}->{'parent'};
3912 if (!@{$current->{'contents'}}) {
3913 pop @{$current->{'parent'}->{'contents'}};
3914 if (!scalar(@{$current->{'parent'}->{'contents'}})) {
3915 pop @{$menu->{'contents'}};
3916 }
3917 }
3918 $current = $menu;
3919 } else {
3920 # first parent preformatted, third is menu_entry
3921 if ($current->{'type'} ne 'preformatted'
3922 or $current->{'parent'}->{'type'} ne 'menu_entry_description'
3923 or $current->{'parent'}->{'parent'}->{'type'} ne 'menu_entry'
3924 or !$menu_commands{$current->{'parent'}->{'parent'}->{'parent'}->{'cmdname'}}) {
3925 $self->_bug_message("Not in menu comment nor description",
3926 $line_nr, $current);
3927 }
3928 $current = $current->{'parent'}->{'parent'}->{'parent'};
3929 }
3930 my $context = pop @{$self->{'context_stack'}};
3931 if ($context ne 'preformatted') {
3932 $self->_bug_message("context $context instead of preformatted after menu leading star",
3933 $line_nr, $current);
3934 }
3935 push @{$current->{'contents'}}, { 'type' => 'menu_entry',
3936 'parent' => $current,
3937 };
3938 $current = $current->{'contents'}->[-1];
3939 $current->{'args'} = [ { 'type' => 'menu_entry_leading_text',
3940 'text' => $leading_text,
3941 'parent' => $current },
3942 { 'type' => 'menu_entry_name',
3943 'contents' => [],
3944 'parent' => $current } ];
3945 $current = $current->{'args'}->[-1];
3946 }
3947 # after a separator in menu
3948 } elsif ($current->{'args'} and @{$current->{'args'}}
3949 and $current->{'args'}->[-1]->{'type'}
3950 and $current->{'args'}->[-1]->{'type'} eq 'menu_entry_separator') {
3951 my $separator = $current->{'args'}->[-1]->{'text'};
3952 # separator is ::, we concatenate and let the while restart
3953 # in order to collect spaces below
3954 if ($separator eq ':' and $line =~ s/^(:)//) {
3955 $current->{'args'}->[-1]->{'text'} .= $1;
3956 # a . not followed by a space. Not a separator.
3957 } elsif ($separator eq '.' and $line =~ /^\S/) {
3958 pop @{$current->{'args'}};
3959 $current = $current->{'args'}->[-1];
3960 $current = _merge_text($self, $current, $separator);
3961 # here we collect spaces following separators.
3962 } elsif ($line =~ s/^([^\S\r\n]+)//) {
3963 # FIXME a trailing end of line could be considered to be part
3964 # of the separator. Right now it is part of the description,
3965 # since it is catched (in the next while) as one of the case below
3966 $current->{'args'}->[-1]->{'text'} .= $1;
3967 # now handle the menu part that was closed
3968 } elsif ($separator =~ /^::/) {
3969 print STDERR "MENU NODE no entry $separator\n" if ($self->{'DEBUG'});
3970 # it was previously registered as menu_entry_name, it is
3971 # changed to node
3972 $current->{'args'}->[-2]->{'type'} = 'menu_entry_node';
3973 $current = _enter_menu_entry_node($self, $current, $line_nr);
3974 # end of the menu entry name
3975 } elsif ($separator =~ /^:/) {
3976 print STDERR "MENU ENTRY $separator\n" if ($self->{'DEBUG'});
3977 push @{$current->{'args'}}, { 'type' => 'menu_entry_node',
3978 'contents' => [],
3979 'parent' => $current };
3980 $current = $current->{'args'}->[-1];
3981 # anything else is the end of the menu node following a menu_entry_name
3982 } else {
3983 print STDERR "MENU NODE $separator\n" if ($self->{'DEBUG'});
3984 $current = _enter_menu_entry_node($self, $current, $line_nr);
3985 }
3986 # REMACRO
3987 } elsif ($at_command or $single_letter_command) {
3988 my $command;
3989 if (!$at_command) {
3990 $command = $single_letter_command;
3991 substr($line, 0, 2) = '';
3992 } else {
3993 $command = $at_command;
3994 substr($line, 0, $at_command_length) = '';
3995 }
3996
3997 print STDERR "COMMAND $command\n" if ($self->{'DEBUG'});
3998 if (!$all_commands{$command}
3999 and !$self->{'macros'}->{$command}
4000 and !$self->{'definfoenclose'}->{$command}
4001 and !$self->{'aliases'}->{$command}
4002 and !$self->{'command_index'}->{$command}) {
4003 $self->line_error(sprintf(__("unknown command `%s'"),
4004 $command), $line_nr);
4005 _abort_empty_line($self, $current);
4006 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4007 $current = $paragraph if ($paragraph);
4008 next;
4009 }
4010
4011 my $alias_command;
4012 if (exists($self->{'aliases'}->{$command})) {
4013 $alias_command = $command;
4014 $command = $self->{'aliases'}->{$command};
4015 }
4016
4017 if ($command eq 'value') {
4018 $line =~ s/^\s*//
4019 if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'});
4020 # REVALUE
4021 if ($line =~ s/^{([\w\-][^\s{\\}~`\^+"<>|@]*)}//) {
4022 my $value = $1;
4023 if (exists($self->{'values'}->{$value})) {
4024 if (!defined($self->{'values'}->{$value})) {
4025 print STDERR "BUG? $value exists but not defined\n";
4026 } elsif (!ref($self->{'values'}->{$value})) {
4027 $line = $self->{'values'}->{$value} . $line;
4028 } else {
4029 print STDERR "BUG? $value defined as reference\n";
4030 }
4031 } else {
4032 # Flag not defined. This is an error if it comes from
4033 # a user's document. It is also expected behaviour for
4034 # Texinfo::Report::gdt, where we want to defer substitution
4035 # of the value until after the containing Texinfo is parsed.
4036 _abort_empty_line($self, $current);
4037 # caller should expand something along
4038 # gdt('@{No value for `{value}\'@}', {'value' => $value}, {'keep_texi'=> 1});
4039 push @{$current->{'contents'}}, { 'cmdname' => 'value',
4040 'type' => $value,
4041 'contents' => [],
4042 'parent' => $current };
4043 if (!$self->{'in_gdt'}) {
4044 $self->line_warn(
4045 sprintf(__("undefined flag: %s"), $value), $line_nr);
4046 }
4047 }
4048 } else {
4049 $self->line_error(__("bad syntax for \@value"), $line_nr);
4050 }
4051 next;
4052 }
4053
4054 if (defined($deprecated_commands{$command})) {
4055 if ($deprecated_commands{$command} eq '') {
4056 $self->line_warn(sprintf(__("%c%s is obsolete."),
4057 ord('@'), $command), $line_nr);
4058 } else {
4059 $self->line_warn(sprintf(__("%c%s is obsolete; %s"),
4060 ord('@'), $command,
4061 __($deprecated_commands{$command})), $line_nr);
4062 }
4063 }
4064
4065 # special case with @ followed by a newline protecting end of lines
4066 # in @def*
4067 my $def_line_continuation
4068 = ($self->{'context_stack'}->[-1] eq 'def' and $command eq "\n");
4069
4070 if (not $def_line_continuation
4071 and not _abort_empty_line($self, $current)
4072 and $begin_line_commands{$command}) {
4073 $self->line_warn(
4074 sprintf(__("\@%s should only appear at the beginning of a line"),
4075 $command), $line_nr);
4076 }
4077
4078 _check_valid_nesting ($self, $current, $command, $line_nr);
4079
4080 last if ($def_line_continuation);
4081
4082 unless ($self->{'no_paragraph_commands'}->{$command}) {
4083 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4084 $current = $paragraph if ($paragraph);
4085 }
4086
4087 if ($self->{'close_paragraph_commands'}->{$command}) {
4088 $current = _end_paragraph($self, $current, $line_nr);
4089 }
4090 if ($self->{'close_preformatted_commands'}->{$command}) {
4091 $current = _end_preformatted($self, $current, $line_nr);
4092 }
4093
4094 if (defined($other_commands{$command})
4095 and ($command ne 'item' or !_item_line_parent($current))) {
4096 # noarg skipspace
4097 my $arg_spec = $other_commands{$command};
4098 my $misc;
4099
4100 if ($arg_spec eq 'noarg') {
4101 if ($in_heading_commands{$command}) {
4102 $self->line_error(
4103 sprintf(__("\@%s should only appear in heading or footing"),
4104 $command), $line_nr);
4105 }
4106 $misc = {'cmdname' => $command, 'parent' => $current};
4107 push @{$current->{'contents'}}, $misc;
4108 _register_global_command($self, $misc, $line_nr);
4109 $current = _begin_preformatted($self, $current)
4110 if ($close_preformatted_commands{$command});
4111 } else {
4112 if ($command eq 'item'
4113 or $command eq 'headitem' or $command eq 'tab') {
4114 my $parent;
4115 # @itemize or @enumerate
4116 if ($parent = _item_container_parent($current)) {
4117 if ($command eq 'item') {
4118 print STDERR "ITEM_CONTAINER\n" if ($self->{'DEBUG'});
4119 $parent->{'items_count'}++;
4120 $misc = { 'cmdname' => $command, 'parent' => $parent,
4121 'contents' => [],
4122 'extra' =>
4123 {'item_number' => $parent->{'items_count'}} };
4124 push @{$parent->{'contents'}}, $misc;
4125 $current = $parent->{'contents'}->[-1];
4126 } else {
4127 $self->line_error(sprintf(__(
4128 "\@%s not meaningful inside `\@%s' block"),
4129 $command, $parent->{'cmdname'}), $line_nr);
4130 }
4131 $current = _begin_preformatted($self, $current);
4132 # @*table
4133 } elsif ($parent = _item_line_parent($current)) {
4134 $self->line_error(sprintf(__(
4135 "\@%s not meaningful inside `\@%s' block"),
4136 $command, $parent->{'cmdname'}), $line_nr);
4137 $current = _begin_preformatted($self, $current);
4138 # @multitable
4139 } elsif ($parent = _item_multitable_parent($current)) {
4140 if ($command eq 'item' or $command eq 'headitem'
4141 or $command eq 'tab') {
4142 if (!$parent->{'extra'}->{'max_columns'}) {
4143 $self->line_warn(
4144 sprintf(__("\@%s in empty multitable"),
4145 $command), $line_nr);
4146 } elsif ($command eq 'tab') {
4147 my $row = $parent->{'contents'}->[-1];
4148 die if (!$row->{'type'});
4149 if ($row->{'type'} eq 'before_item') {
4150 $self->line_error(__("\@tab before \@item"), $line_nr);
4151 } elsif ($row->{'cells_count'} >= $parent->{'extra'}->{'max_columns'}) {
4152 $self->line_error(sprintf(__(
4153 "too many columns in multitable item (max %d)"),
4154 $parent->{'extra'}->{'max_columns'}), $line_nr);
4155 } else {
4156 $row->{'cells_count'}++;
4157 $misc = { 'cmdname' => $command,
4158 'parent' => $row,
4159 'contents' => [],
4160 'extra' =>
4161 {'cell_number' => $row->{'cells_count'}} };
4162 push @{$row->{'contents'}}, $misc;
4163 $current = $row->{'contents'}->[-1];
4164 #$current = $self->_begin_preformatted($current);
4165 print STDERR "TAB\n" if ($self->{'DEBUG'});
4166 }
4167 } else {
4168 print STDERR "ROW\n" if ($self->{'DEBUG'});
4169 $parent->{'rows_count'}++;
4170 my $row = { 'type' => 'row', 'contents' => [],
4171 'cells_count' => 1,
4172 'extra' => {'row_number' => $parent->{'rows_count'} },
4173 'parent' => $parent };
4174 push @{$parent->{'contents'}}, $row;
4175 $misc = { 'cmdname' => $command,
4176 'parent' => $row,
4177 'contents' => [],
4178 'extra' => {'cell_number' => 1}};
4179 push @{$row->{'contents'}}, $misc;
4180 $current = $row->{'contents'}->[-1];
4181 }
4182 } else {
4183 $self->line_error(sprintf(__(
4184 "\@%s not meaningful inside `\@%s' block"),
4185 $command, $parent->{'cmdname'}), $line_nr);
4186 }
4187 $current = _begin_preformatted($self, $current);
4188 } elsif ($command eq 'tab') {
4189 $self->line_error(__(
4190 "ignoring \@tab outside of multitable"), $line_nr);
4191 $current = _begin_preformatted($self, $current);
4192 } else {
4193 $self->line_error (sprintf(__(
4194 "\@%s outside of table or list"), $command), $line_nr);
4195 $current = _begin_preformatted($self, $current);
4196 }
4197 $misc->{'line_nr'} = $line_nr if (defined($misc));
4198 } else {
4199 $misc = { 'cmdname' => $command, 'parent' => $current,
4200 'line_nr' => $line_nr };
4201 push @{$current->{'contents'}}, $misc;
4202 }
4203 $line = _start_empty_line_after_command($line, $current, $misc);
4204 if ($command eq 'indent'
4205 or $command eq 'noindent') {
4206 if ($line !~ /\n/) {
4207 my ($new_line, $new_line_nr) = _new_line($self, $line_nr);
4208 $line .= $new_line if (defined($new_line));
4209 }
4210 $line =~ s/^(\s*)//;
4211 if ($1) {
4212 $current = _merge_text($self, $current, $1);
4213 }
4214 if ($line ne ''
4215 and $current->{'contents'}->[-1]->{'type'} eq
4216 'empty_line_after_command') {
4217 $current->{'contents'}->[-1]->{'type'}
4218 = 'empty_spaces_after_command';
4219 }
4220 my $paragraph = _begin_paragraph($self, $current, $line_nr);
4221 $current = $paragraph if $paragraph;
4222 if ($line eq '') {
4223 last;
4224 }
4225 }
4226 }
4227 # line commands
4228 } elsif (defined($self->{'line_commands'}->{$command})) {
4229 if ($root_commands{$command} or $command eq 'bye') {
4230 $current = _close_commands($self, $current, $line_nr, undef,
4231 $command);
4232 # root_level commands leads to setting a new root
4233 # for the whole document and stuffing the preceding text
4234 # as the first content, this is done only once.
4235 if ($current->{'type'} and $current->{'type'} eq 'text_root') {
4236 if ($command ne 'bye') {
4237 $root = { 'type' => 'document_root', 'contents' => [$current] };
4238 $current->{'parent'} = $root;
4239 $current = $root;
4240 }
4241 } else {
4242 die if (!defined($current->{'parent'}));
4243 $current = $current->{'parent'};
4244 }
4245 }
4246
4247 # skipline text line lineraw /^\d$/
4248 my $arg_spec = $self->{'line_commands'}->{$command};
4249 my $misc;
4250
4251 # all the cases using the raw line
4252 if ($arg_spec eq 'skipline' or $arg_spec eq 'lineraw'
4253 or $arg_spec eq 'special') {
4254 my $ignored = 0;
4255 if ($command eq 'insertcopying') {
4256 my $parent = $current;
4257 while ($parent) {
4258 if ($parent->{'cmdname'} and $parent->{'cmdname'} eq 'copying') {
4259 $self->line_error(
4260 sprintf(__("\@%s not allowed inside `\@%s' block"),
4261 $command, $parent->{'cmdname'}), $line_nr);
4262 $ignored = 1;
4263 last;
4264 }
4265 $parent = $parent->{'parent'};
4266 }
4267 }
4268
4269 # complete the line if there was a user macro expansion
4270 if ($line !~ /\n/) {
4271 my ($new_line, $new_line_nr) = _new_line($self, $line_nr);
4272 $line .= $new_line if (defined($new_line));
4273 }
4274 $misc = {'cmdname' => $command,
4275 'parent' => $current};
4276 my $args = [];
4277 my $has_comment;
4278 if ($arg_spec eq 'lineraw' or $arg_spec eq 'skipline') {
4279 $args = [ $line ];
4280 } elsif ($arg_spec eq 'special') {
4281 ($args, $has_comment)
4282 = _parse_special_misc_command($self, $line, $command, $line_nr);
4283 $misc->{'extra'}->{'arg_line'} = $line;
4284 }
4285
4286 # if using the @set txi* instead of a proper @-command, replace
4287 # by the tree obtained with the @-command. Even though
4288 # _end_line is called below, as $current is not line_arg
4289 # there should not be anything done in addition than what is
4290 # done for @clear or @set.
4291 if (($command eq 'set' or $command eq 'clear')
4292 and scalar(@$args) >= 1
4293 and $set_flag_command_equivalent{$args->[0]}) {
4294 my $arg;
4295 if ($command eq 'set') {
4296 $arg = 'on';
4297 } else {
4298 $arg = 'off';
4299 }
4300 $command = $set_flag_command_equivalent{$args->[0]};
4301 $misc = {'cmdname' => $command,
4302 'parent' => $current,
4303 'line_nr' => $line_nr,
4304 'extra' => {'misc_args' => [$arg]}};
4305 my $misc_line_args = {'type' => 'line_arg',
4306 'parent' => $misc};
4307 $misc->{'args'} = [$misc_line_args];
4308 $misc->{'extra'}->{'spaces_before_argument'} = ' ';
4309 $misc_line_args->{'contents'} = [
4310 { 'text' => $arg,
4311 'parent' => $misc_line_args, },
4312 { 'text' => "\n",
4313 'parent' => $misc_line_args,
4314 'type' => 'spaces_at_end', } ];
4315 push @{$current->{'contents'}}, $misc;
4316 } else {
4317 if (!$ignored) {
4318 push @{$current->{'contents'}}, $misc;
4319 foreach my $arg (@$args) {
4320 push @{$misc->{'args'}},
4321 { 'type' => 'misc_arg', 'text' => $arg,
4322 'parent' => $current->{'contents'}->[-1] };
4323 }
4324 $misc->{'extra'}->{'misc_args'} = $args
4325 if (scalar(@$args) and $arg_spec ne 'skipline');
4326 } else {
4327 $misc = undef;
4328 }
4329 }
4330 if ($command eq 'raisesections') {
4331 $self->{'sections_level'}++;
4332 } elsif ($command eq 'lowersections') {
4333 $self->{'sections_level'}--;
4334 } elsif ($command eq 'novalidate') {
4335 $self->{'info'}->{'novalidate'} = 1;
4336 }
4337 _register_global_command($self, $misc, $line_nr)
4338 if $misc;
4339 # the end of line is ignored for special commands
4340 if ($arg_spec ne 'special' or !$has_comment) {
4341 $current = _end_line($self, $current, $line_nr);
4342 }
4343
4344 last NEXT_LINE if ($command eq 'bye');
4345 # Even if _end_line is called, it is not done since there is
4346 # no line_arg
4347 $current = _begin_preformatted($self, $current)
4348 if ($close_preformatted_commands{$command});
4349 last;
4350 } else {
4351 # $arg_spec is text, line or a number
4352 # @item or @itemx in @table
4353 if ($command eq 'item' or $command eq 'itemx') {
4354 my $parent;
4355 print STDERR "ITEM_LINE\n" if ($self->{'DEBUG'});
4356 if ($parent = _item_line_parent($current)) {
4357 $current = $parent;
4358 _gather_previous_item($self, $current, $command, $line_nr);
4359 } else {
4360 $self->line_error (sprintf(__(
4361 "\@%s outside of table or list"), $command), $line_nr);
4362 $current = _begin_preformatted($self, $current);
4363 }
4364 $misc = { 'cmdname' => $command, 'parent' => $current };
4365 push @{$current->{'contents'}}, $misc;
4366 $misc->{'line_nr'} = $line_nr;
4367 } else {
4368 $misc = { 'cmdname' => $command, 'parent' => $current,
4369 'line_nr' => $line_nr };
4370 push @{$current->{'contents'}}, $misc;
4371 if ($sectioning_commands{$command}) {
4372 if ($self->{'sections_level'}) {
4373 $current->{'contents'}->[-1]->{'extra'}->{'sections_level'}
4374 = $self->{'sections_level'};
4375 }
4376 }
4377 if ($root_commands{$command}) {
4378 $misc->{'contents'} = [];
4379 }
4380 # def*x
4381 if ($def_commands{$command}) {
4382 my $base_command = $command;
4383 $base_command =~ s/x$//;
4384 # check that the def*x is first after @def*, no paragraph
4385 # in-between.
4386 my $after_paragraph = _check_no_text($current);
4387 push @{$self->{'context_stack'}}, 'def';
4388 $current->{'contents'}->[-1]->{'type'} = 'def_line';
4389 $current->{'contents'}->[-1]->{'extra'} =
4390 {'def_command' => $base_command,
4391 'original_def_cmdname' => $command};
4392 if ($current->{'cmdname'}
4393 and $current->{'cmdname'} eq $base_command) {
4394 pop @{$current->{'contents'}};
4395 _gather_def_item($current, $command);
4396 push @{$current->{'contents'}}, $misc;
4397 }
4398 if (!$current->{'cmdname'}
4399 or $current->{'cmdname'} ne $base_command
4400 or $after_paragraph) {
4401 $self->line_error(sprintf(__(
4402 "must be after `\@%s' to use `\@%s'"),
4403 $base_command, $command), $line_nr);
4404 $current->{'contents'}->[-1]->{'extra'}->{'not_after_command'} = 1;
4405 }
4406 }
4407 }
4408 $current = $current->{'contents'}->[-1];
4409 $current->{'args'} = [{ 'type' => 'line_arg',
4410 'contents' => [],
4411 'parent' => $current }];
4412 # @node is the only misc command with args separated with comma
4413 # FIXME a 3 lingering here deep into the code may not
4414 # be very wise... However having a hash only for one @-command
4415 # is not very appealing either...
4416 if ($command eq 'node') {
4417 $current->{'remaining_args'} = 3;
4418 } elsif ($command eq 'author') {
4419 my $parent = $current;
4420 my $found;
4421 while ($parent->{'parent'}) {
4422 $parent = $parent->{'parent'};
4423 last if ($parent->{'type'}
4424 and $parent->{'type'} eq 'brace_command_context');
4425 if ($parent->{'cmdname'}) {
4426 if ($parent->{'cmdname'} eq 'titlepage') {
4427 $current->{'extra'}->{'titlepage'} = $parent;
4428 $found = 1;
4429 } elsif ($parent->{'cmdname'} eq 'quotation' or
4430 $parent->{'cmdname'} eq 'smallquotation') {
4431 push @{$parent->{'extra'}->{'authors'}}, $current;
4432 $current->{'extra'}->{'quotation'} = $parent;
4433 $found = 1;
4434 }
4435 last if ($found);
4436 }
4437 }
4438 if (!$found) {
4439 $self->line_warn(sprintf(__(
4440 "\@%s not meaningful outside `\@titlepage' and `\@quotation' environments"),
4441 $command), $current->{'line_nr'});
4442 }
4443 } elsif ($command eq 'dircategory' and $self->{'current_node'}) {
4444 $self->line_warn(__("\@dircategory after first node"),
4445 $line_nr);
4446 }
4447
4448 $current = $current->{'args'}->[-1];
4449 push @{$self->{'context_stack'}}, 'line'
4450 unless ($def_commands{$command});
4451 $line = _start_empty_line_after_command($line, $current, $misc);
4452 }
4453 _register_global_command($self, $misc, $line_nr)
4454 if $misc;
4455 if ($command eq 'dircategory') {
4456 push @{$self->{'info'}->{'dircategory_direntry'}}, $misc;
4457 }
4458 # @-command with matching @end opening
4459 } elsif (exists($block_commands{$command})) {
4460 if ($command eq 'macro' or $command eq 'rmacro') {
4461 my $macro = _parse_macro_command_line($self, $command, $line,
4462 $current, $line_nr);
4463 push @{$current->{'contents'}}, $macro;
4464 $current = $current->{'contents'}->[-1];
4465 last;
4466 } elsif ($block_commands{$command} eq 'conditional') {
4467 my $ifvalue_true = 0;
4468 if ($command eq 'ifclear' or $command eq 'ifset') {
4469 # REVALUE
4470 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
4471 my $name = $1;
4472 if ((exists($self->{'values'}->{$name}) and $command eq 'ifset')
4473 or (!exists($self->{'values'}->{$name})
4474 and $command eq 'ifclear')) {
4475 $ifvalue_true = 1;
4476 }
4477 print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n" if ($self->{'DEBUG'});
4478 } elsif ($line !~ /\S/) {
4479 $self->line_error(sprintf(
4480 __("%c%s requires a name"), ord('@'), $command), $line_nr);
4481 } else {
4482 $self->line_error(sprintf(
4483 __("bad name for \@%s"), $command), $line_nr);
4484 }
4485 } elsif ($command eq 'ifcommanddefined'
4486 or $command eq 'ifcommandnotdefined') {
4487 # REMACRO
4488 if ($line =~ /^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
4489 my $name = $1;
4490 my $command_is_defined = (
4491 exists($Texinfo::Common::all_commands{$name})
4492 or $self->{'macros'}->{$name}
4493 or $self->{'definfoenclose'}->{$name}
4494 or $self->{'aliases'}->{$name}
4495 or $self->{'command_index'}->{$name}
4496 );
4497 if (($command_is_defined
4498 and $command eq 'ifcommanddefined')
4499 or (! $command_is_defined
4500 and $command eq 'ifcommandnotdefined')) {
4501 $ifvalue_true = 1;
4502 }
4503 print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n" if ($self->{'DEBUG'});
4504 } elsif ($line !~ /\S/) {
4505 $self->line_error(sprintf(
4506 __("%c%s requires a name"), ord('@'), $command), $line_nr);
4507 } else {
4508 $self->line_error(sprintf(
4509 __("bad name for \@%s"), $command), $line_nr);
4510 }
4511 } elsif ($command =~ /^ifnot(.*)/) {
4512 $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1}
4513 # exception as explained in the texinfo manual
4514 or ($1 eq 'info'
4515 and $self->{'expanded_formats_hash'}->{'plaintext'}));
4516 print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n" if ($self->{'DEBUG'});
4517 } else {
4518 die unless ($command =~ /^if(.*)/);
4519 $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
4520 or ($1 eq 'info'
4521 and $self->{'expanded_formats_hash'}->{'plaintext'}));
4522 print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n" if ($self->{'DEBUG'});
4523 }
4524 if ($ifvalue_true) {
4525 push @{$self->{'conditionals_stack'}}, $command;
4526 } else {
4527 push @{$current->{'contents'}}, { 'cmdname' => $command,
4528 'parent' => $current,
4529 'contents' => [] };
4530 $current = $current->{'contents'}->[-1];
4531 }
4532 # FIXME(Karl) ignore what is remaining on the line, to eat
4533 # the end of line?
4534 last;
4535 } else {
4536 my $block;
4537 # a menu command closes a menu_comment, but not the other
4538 # block commands. This won't catch menu commands buried in
4539 # other formats (that are incorrect anyway).
4540 if ($menu_commands{$command} and $current->{'type'}
4541 and ($current->{'type'} eq 'menu_comment'
4542 or $current->{'type'} eq 'menu_entry_description')) {
4543
4544 my $menu;
4545
4546 $menu = $current->{'parent'};
4547 pop @{$menu->{'contents'}}
4548 if (!@{$current->{'contents'}});
4549
4550 my $context = pop @{$self->{'context_stack'}};
4551 if ($context ne 'preformatted') {
4552 $self->_bug_message("context $context instead of preformatted in new menu",
4553 $line_nr, $current);
4554 }
4555
4556 if ($menu->{'type'} and $menu->{'type'} eq 'menu_entry') {
4557 $menu = $menu->{'parent'};
4558 }
4559
4560 $current = $menu;
4561 }
4562 # the def command holds a line_def* which corresponds with the
4563 # definition line. This allows to have a treatement similar
4564 # with def*x.
4565 if ($def_commands{$command}) {
4566 push @{$self->{'context_stack'}}, 'def';
4567 $block = { 'parent' => $current,
4568 'cmdname' => $command,
4569 'contents' => [] };
4570 push @{$current->{'contents'}}, $block;
4571 $current = $current->{'contents'}->[-1];
4572 push @{$current->{'contents'}}, {
4573 'type' => 'def_line',
4574 'parent' => $current,
4575 'line_nr' => $line_nr,
4576 'extra' =>
4577 {'def_command' => $command,
4578 'original_def_cmdname' => $command}
4579 };
4580 } else {
4581 $block = { 'cmdname' => $command,
4582 'parent' => $current,
4583 'contents' => [] };
4584 push @{$current->{'contents'}}, $block;
4585 }
4586 $current = $current->{'contents'}->[-1];
4587
4588 if ($block_arg_commands{$command}) {
4589 if ($preformatted_commands{$command}) {
4590 push @{$self->{'context_stack'}}, 'preformatted';
4591 } elsif ($format_raw_commands{$command}) {
4592 push @{$self->{'context_stack'}}, 'rawpreformatted';
4593 if (not $self->{'expanded_formats_hash'}->{$command}) {
4594 push @{$current->{'contents'}}, {
4595 'parent' => $current,
4596 'type' => 'elided_block',
4597 'contents' => []
4598 };
4599 while (not $line =~ /^\s*\@end\s+$command/) {
4600 ($line, $line_nr) = _new_line($self, $line_nr);
4601 if (!$line) {
4602 # unclosed block
4603 $line = '';
4604 last;
4605 }
4606 }
4607 push @{$current->{'contents'}},
4608 { 'type' => 'empty_line_after_command',
4609 'text' => "\n",
4610 'parent' => $current };
4611 push @{$current->{'contents'}}, { 'type' => 'empty_line',
4612 'text' => '',
4613 'parent' => $current };
4614 next;
4615 }
4616 }
4617 if ($region_commands{$command}) {
4618 if (@{$self->{'regions_stack'}}) {
4619 $self->line_error(
4620 sprintf(__("region %s inside region %s is not allowed"),
4621 $command, $self->{'regions_stack'}->[-1]->{'cmdname'}),
4622 $line_nr);
4623 }
4624 push @{$self->{'regions_stack'}}, $block;
4625 }
4626 if ($menu_commands{$command}) {
4627 if ($self->{'context_stack'}->[-1] eq 'preformatted') {
4628 push @{$self->{'context_stack'}}, 'preformatted';
4629 } else {
4630 push @{$self->{'context_stack'}}, 'menu';
4631 }
4632 push @{$self->{'info'}->{'dircategory_direntry'}}, $block
4633 if ($command eq 'direntry');
4634 if ($self->{'current_node'}) {
4635 if ($command eq 'direntry') {
4636 if ($self->{'SHOW_MENU'}) {
4637 $self->line_warn(__("\@direntry after first node"),
4638 $line_nr);
4639 }
4640 } elsif ($command eq 'menu') {
4641 if (!(defined $current->{'parent'}->{'cmdname'})
4642 or $root_commands{$current->{'parent'}->{'cmdname'}}) {
4643 push @{$self->{'current_node'}->{'menus'}}, $current;
4644 } else {
4645 $self->line_warn(__("\@menu in invalid context"),
4646 $line_nr);
4647 }
4648 }
4649 } elsif ($command ne 'direntry') {
4650 if ($self->{'SHOW_MENU'}) {
4651 $self->line_error(sprintf(__("\@%s seen before first \@node"),
4652 $command), $line_nr);
4653 $self->line_error(__(
4654 "perhaps your \@top node should be wrapped in \@ifnottex rather than \@ifinfo?"),
4655 $line_nr);
4656 }
4657 }
4658 }
4659 $current->{'args'} = [ {
4660 'type' => 'block_line_arg',
4661 'contents' => [],
4662 'parent' => $current } ];
4663
4664 $current->{'remaining_args'} = $block_commands{$command} -1
4665 if ($block_commands{$command} =~ /^\d+$/
4666 and $block_commands{$command} -1 > 0);
4667 $current = $current->{'args'}->[-1];
4668 push @{$self->{'context_stack'}}, 'line'
4669 unless ($def_commands{$command});
4670 }
4671 $block->{'line_nr'} = $line_nr;
4672 _register_global_command($self, $block, $line_nr);
4673
4674 $line = _start_empty_line_after_command($line, $current, $block);
4675 }
4676 } elsif (defined($brace_commands{$command})) {
4677 push @{$current->{'contents'}}, { 'cmdname' => $command,
4678 'parent' => $current,
4679 'contents' => [] };
4680 $current->{'contents'}->[-1]->{'line_nr'} = $line_nr
4681 if ($keep_line_nr_brace_commands{$command}
4682 and !$self->{'definfoenclose'}->{$command});
4683
4684 if ($in_index_commands{$command}
4685 and (!$current->{'parent'}->{'cmdname'}
4686 or !$self->{'command_index'}
4687 ->{$current->{'parent'}->{'cmdname'}})) {
4688 $self->line_warn(
4689 sprintf(__("\@%s should only appear in an index entry"),
4690 $command), $line_nr);
4691 }
4692
4693 $current = $current->{'contents'}->[-1];
4694 if ($command eq 'click') {
4695 $current->{'extra'}->{'clickstyle'} = $self->{'clickstyle'};
4696 } elsif ($command eq 'kbd') {
4697 if ($self->{'context_stack'}->[-1] eq 'preformatted'
4698 and $self->{'kbdinputstyle'} ne 'distinct') {
4699 $current->{'extra'}->{'code'} = 1;
4700 } elsif ($self->{'kbdinputstyle'} eq 'code'
4701 or ($self->{'kbdinputstyle'} eq 'example'
4702 and $self->_in_code($current->{'parent'}))) {
4703 $current->{'extra'}->{'code'} = 1;
4704 }
4705 }
4706 if ($self->{'definfoenclose'}->{$command}) {
4707 $current->{'type'} = 'definfoenclose_command';
4708 $current->{'extra'}->{'begin'} =
4709 $self->{'definfoenclose'}->{$command}->[0];
4710 $current->{'extra'}->{'end'} =
4711 $self->{'definfoenclose'}->{$command}->[1];
4712 }
4713 } elsif (exists ($no_brace_commands{$command})) {
4714 push @{$current->{'contents'}},
4715 { 'cmdname' => $command, 'parent' => $current };
4716 # FIXME generalize?
4717 if ($command eq '\\' and $self->{'context_stack'}->[-1] ne 'math') {
4718 $self->line_warn(sprintf(__("\@%s should only appear in math context"),
4719 $command), $line_nr);
4720 }
4721 if ($command eq "\n") {
4722 $current = _end_line($self, $current, $line_nr);
4723 last;
4724 }
4725 }
4726 } elsif ($separator_match) {
4727 my $separator = $separator_match;
4728 substr ($line, 0, 1) = '';
4729 print STDERR "SEPARATOR: $separator\n" if ($self->{'DEBUG'});
4730 if ($separator eq '@') {
4731 # this may happen with a @ at the very end of a file, therefore
4732 # not followed by anything.
4733 $self->line_error(__("unexpected \@"), $line_nr);
4734 } elsif ($separator eq '{') {
4735 _abort_empty_line($self, $current);
4736 if ($current->{'cmdname'}
4737 and defined($brace_commands{$current->{'cmdname'}})) {
4738 my $command = $current->{'cmdname'};
4739 $current->{'args'} = [ { 'parent' => $current,
4740 'contents' => [] } ];
4741
4742 if ($brace_commands{$command}
4743 and $brace_commands{$command} =~ /^\d$/
4744 and $brace_commands{$command} > 1) {
4745 $current->{'remaining_args'} = $brace_commands{$command} - 1;
4746 }
4747
4748 $current = $current->{'args'}->[-1];
4749 if ($context_brace_commands{$command}) {
4750 if ($command eq 'caption' or $command eq 'shortcaption') {
4751 my $float;
4752 if (!$current->{'parent'}->{'parent'}
4753 or !$current->{'parent'}->{'parent'}->{'cmdname'}
4754 or $current->{'parent'}->{'parent'}->{'cmdname'} ne 'float') {
4755 $float = $current->{'parent'};
4756 while ($float->{'parent'} and !($float->{'cmdname'}
4757 and $float->{'cmdname'} eq 'float')) {
4758 $float = $float->{'parent'};
4759 }
4760 if (!($float->{'cmdname'} and $float->{'cmdname'} eq 'float')) {
4761 $self->line_error(sprintf(__(
4762 "\@%s is not meaningful outside `\@float' environment"),
4763 $command), $line_nr);
4764 $float = undef;
4765 } else {
4766 $self->line_warn(sprintf(__(
4767 "\@%s should be right below `\@float'"),
4768 $command), $line_nr);
4769 }
4770 } else {
4771 $float = $current->{'parent'}->{'parent'};
4772 }
4773 if ($float) {
4774 if ($float->{'extra'}->{$command}) {
4775 $self->line_warn(sprintf(__("ignoring multiple \@%s"),
4776 $command), $line_nr);
4777 } else {
4778 $current->{'parent'}->{'extra'}->{'float'} = $float;
4779 $float->{'extra'}->{$command} = $current->{'parent'};
4780 }
4781 }
4782 }
4783 push @{$self->{'context_stack'}}, $command;
4784 $line =~ s/([^\S\f\n]*)//;
4785 $current->{'type'} = 'brace_command_context';
4786 push @{$current->{'contents'}}, { 'type' => 'empty_spaces_before_argument',
4787 'text' => $1,
4788 'parent' => $current,
4789 'extra' => {'command' => $current->{'parent'}}
4790 };
4791 } else {
4792 $current->{'type'} = 'brace_command_arg';
4793 if ($brace_commands{$command}
4794 and $brace_commands{$command} =~ /^\d$/
4795 and $brace_commands{$command} > 0) {
4796 push @{$current->{'contents'}},
4797 {'type' => 'empty_spaces_before_argument',
4798 'text' => '',
4799 'parent' => $current,
4800 'extra' => {'command' => $current}
4801 };
4802 }
4803 push @{$self->{'context_stack'}}, $command
4804 if ($command eq 'inlineraw');
4805 }
4806 print STDERR "OPENED \@$current->{'parent'}->{'cmdname'}, remaining: "
4807 .(defined($current->{'parent'}->{'remaining_args'}) ? "remaining: $current->{'parent'}->{'remaining_args'}, " : '')
4808 .($current->{'type'} ? "type: $current->{'type'}" : '')."\n"
4809 if ($self->{'DEBUG'});
4810 } elsif ($current->{'parent'}
4811 and (($current->{'parent'}->{'cmdname'}
4812 and $current->{'parent'}->{'cmdname'} eq 'multitable')
4813 or ($current->{'parent'}->{'type'}
4814 and $current->{'parent'}->{'type'} eq 'def_line'))) {
4815 push @{$current->{'contents'}},
4816 { 'type' => 'bracketed', 'contents' => [],
4817 'parent' => $current };
4818 $current = $current->{'contents'}->[-1];
4819 # we need the line number here in case @ protects end of line
4820 $current->{'line_nr'} = $line_nr
4821 if ($current->{'parent'}->{'parent'}->{'type'}
4822 and $current->{'parent'}->{'parent'}->{'type'} eq 'def_line');
4823 push @{$current->{'contents'}},
4824 {'type' => 'empty_spaces_before_argument',
4825 'text' => '',
4826 'parent' => $current,
4827 'extra' => {'command' => $current}
4828 };
4829 print STDERR "BRACKETED in def/multitable\n" if ($self->{'DEBUG'});
4830 # lone braces accepted right in a rawpreformatted
4831 } elsif ($current->{'type'}
4832 and $current->{'type'} eq 'rawpreformatted') {
4833 push @{$current->{'contents'}}, {'text' => '{',
4834 'parent' => $current };
4835 # matching braces accepted in a rawpreformatted or math or ignored
4836 # code
4837 } elsif ($self->{'context_stack'}->[-1] eq 'math'
4838 or $self->{'context_stack'}->[-1] eq 'rawpreformatted'
4839 or $self->{'context_stack'}->[-1] eq 'inlineraw') {
4840 push @{$current->{'contents'}},
4841 { 'type' => 'bracketed', 'contents' => [],
4842 'parent' => $current, 'line_nr' => $line_nr };
4843 $current = $current->{'contents'}->[-1];
4844 print STDERR "BRACKETED in math\n" if ($self->{'DEBUG'});
4845 } else {
4846 $self->line_error(sprintf(__("misplaced %c"),
4847 ord('{')), $line_nr);
4848 }
4849
4850 } elsif ($separator eq '}') {
4851 _abort_empty_line($self, $current);
4852 if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
4853 $current = $current->{'parent'};
4854 # the following will not happen for footnote if there is
4855 # a paragraph withing the footnote
4856 } elsif ($current->{'parent'}
4857 and $current->{'parent'}->{'cmdname'}
4858 and exists $brace_commands{$current->{'parent'}->{'cmdname'}}) {
4859 # for math and footnote out of paragraph
4860 if ($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
4861 my $context_command = pop @{$self->{'context_stack'}};
4862 if ($context_command ne $current->{'parent'}->{'cmdname'}) {
4863 $self->_bug_message("context $context_command instead of brace command $current->{'parent'}->{'cmdname'}",
4864 $line_nr, $current);
4865 die;
4866 }
4867 }
4868 # first is the arg.
4869
4870 if ($brace_commands{$current->{'parent'}->{'cmdname'}}
4871 and $brace_commands{$current->{'parent'}{'cmdname'}} =~ /^\d$/
4872 and $brace_commands{$current->{'parent'}->{'cmdname'}} > 0
4873 and $current->{'parent'}->{'cmdname'} ne 'math') {
4874 # @inline* always have end spaces considered as normal text
4875 _isolate_last_space($self, $current)
4876 unless ($inline_commands{$current->{'parent'}->{'cmdname'}});
4877 }
4878 my $closed_command = $current->{'parent'}->{'cmdname'};
4879 print STDERR "CLOSING(brace) \@$current->{'parent'}->{'cmdname'}\n"
4880 if ($self->{'DEBUG'});
4881 delete $current->{'parent'}->{'remaining_args'};
4882 if (defined($brace_commands{$closed_command})
4883 and $brace_commands{$closed_command} eq '0'
4884 and @{$current->{'contents'}}) {
4885 $self->line_warn(sprintf(__(
4886 "command \@%s does not accept arguments"),
4887 $closed_command), $line_nr);
4888 }
4889 if ($current->{'parent'}->{'cmdname'} eq 'anchor') {
4890 $current->{'parent'}->{'line_nr'} = $line_nr;
4891 my $parsed_anchor = _parse_node_manual($current);
4892 if (_check_node_label($self, $parsed_anchor,
4893 $current->{'parent'}->{'cmdname'}, $line_nr)) {
4894 _register_label($self, $current->{'parent'}, $parsed_anchor);
4895 if (@{$self->{'regions_stack'}}) {
4896 $current->{'extra'}->{'region'} = $self->{'regions_stack'}->[-1];
4897 }
4898 }
4899 } elsif ($ref_commands{$current->{'parent'}->{'cmdname'}}) {
4900 my $ref = $current->{'parent'};
4901 if (@{$ref->{'args'}}) {
4902 my @args;
4903 for $a (@{$ref->{'args'}}) {
4904 if (@{$a->{'contents'}}) {
4905 push @args, $a->{'contents'};
4906 } else {
4907 push @args, undef;
4908 }
4909 }
4910 if (($closed_command eq 'inforef'
4911 and !defined($args[0]) and !defined($args[2]))
4912 or ($closed_command ne 'inforef'
4913 and !defined($args[0]) and !defined($args[3])
4914 and !defined($args[4]))) {
4915 $self->line_warn(sprintf(__(
4916 "command \@%s missing a node or external manual argument"),
4917 $closed_command), $line_nr);
4918 } else {
4919 my $parsed_ref_node = _parse_node_manual($ref->{'args'}->[0]);
4920 if (defined $parsed_ref_node) {
4921 if ($closed_command ne 'inforef'
4922 and !defined($args[3]) and !defined($args[4])
4923 and !$parsed_ref_node->{'manual_content'}) {
4924 push @{$self->{'internal_references'}}, $ref;
4925 }
4926 $ref->{'extra'}->{'node_argument'} = $parsed_ref_node
4927 }
4928 }
4929 if (defined($args[1])) {
4930 my $normalized_cross_ref_name =
4931 Texinfo::Convert::NodeNameNormalization::normalize_node(
4932 {'contents' => $args[1]});
4933 if ($normalized_cross_ref_name !~ /[^-]/) {
4934 $self->line_warn(sprintf(__(
4935 "in \@%s empty cross reference name after expansion `%s'"),
4936 $closed_command,
4937 Texinfo::Convert::Texinfo::convert({'contents' => $args[1]})),
4938 $line_nr);
4939 }
4940 }
4941 if ($closed_command ne 'inforef' and defined($args[2])) {
4942 my $normalized_cross_ref_title =
4943 Texinfo::Convert::NodeNameNormalization::normalize_node({'contents' => $args[2]});
4944 if ($normalized_cross_ref_title !~ /[^-]/) {
4945 $self->line_warn(sprintf(__(
4946 "in \@%s empty cross reference title after expansion `%s'"),
4947 $closed_command,
4948 Texinfo::Convert::Texinfo::convert({'contents' => $args[2]})),
4949 $line_nr);
4950 }
4951 }
4952 }
4953 } elsif ($current->{'parent'}->{'cmdname'} eq 'image') {
4954 my $image = $current->{'parent'};
4955 if (!@{$image->{'args'}}
4956 or !defined($image->{'args'}->[0])
4957 or scalar(@{$image->{'args'}->[0]->{'contents'}}) == 0) {
4958 $self->line_error(
4959 __("\@image missing filename argument"), $line_nr);
4960 }
4961 $image->{'extra'}->{'input_perl_encoding'}
4962 = $self->{'INPUT_PERL_ENCODING'}
4963 if defined $self->{'INPUT_PERL_ENCODING'};
4964 } elsif($current->{'parent'}->{'cmdname'} eq 'dotless') {
4965 my $dotless = $current->{'parent'};
4966 if (@{$current->{'contents'}}) {
4967 my $text = $current->{'contents'}->[0]->{'text'};
4968 if (!defined ($text)
4969 or ($text ne 'i' and $text ne 'j')) {
4970 $self->line_error(sprintf(
4971 __("%c%s expects `i' or `j' as argument, not `%s'"),
4972 ord('@'), $dotless->{'cmdname'},
4973 Texinfo::Convert::Texinfo::convert($current)), $line_nr);
4974 }
4975 }
4976 } elsif ($explained_commands{$current->{'parent'}->{'cmdname'}}
4977 or $inline_commands{$current->{'parent'}->{'cmdname'}}) {
4978 my $current_command = $current->{'parent'};
4979 if ($inline_commands{$current_command->{'cmdname'}}) {
4980 if ($current_command->{'cmdname'} eq 'inlineraw') {
4981 my $context_command = pop @{$self->{'context_stack'}};
4982 if ($context_command ne $current_command->{'cmdname'}) {
4983 $self->_bug_message("context $context_command instead of inlineraw $current_command->{'cmdname'}",
4984 $line_nr, $current);
4985 die;
4986 }
4987 }
4988 }
4989 if (!@{$current_command->{'args'}}
4990 or !defined($current_command->{'args'}->[0])
4991 or scalar(@{$current_command->{'args'}->[0]->{'contents'}}) == 0) {
4992 $self->line_warn(
4993 sprintf(__("\@%s missing first argument"),
4994 $current_command->{'cmdname'}), $line_nr);
4995 }
4996 } elsif ($current->{'parent'}->{'cmdname'} eq 'errormsg') {
4997 my $error_message_text = $current->{'contents'}->[0]->{'text'};
4998 $self->line_error($error_message_text, $line_nr)
4999 if $error_message_text;
5000 } elsif ($current->{'parent'}->{'cmdname'} eq 'U') {
5001 my $arg;
5002 if ($current->{'contents'}->[0]) {
5003 $arg = $current->{'contents'}->[0]->{'text'};
5004 }
5005 if (!defined($arg) || !$arg) {
5006 $self->line_warn(__("no argument specified for \@U"),
5007 $line_nr);
5008
5009 } elsif ($arg !~ /^[0-9A-Fa-f]+$/) {
5010 $self->line_error(
5011 sprintf(__("non-hex digits in argument for \@U: %s"), $arg),
5012 $line_nr);
5013
5014 } elsif (length ($arg) < 4) {
5015 # Perl doesn't mind, but too much trouble to do in TeX.
5016 $self->line_warn(sprintf(__("fewer than four hex digits in argument for \@U: %s"), $arg),
5017 $line_nr);
5018
5019 } else {
5020 # we don't want to call hex at all if the value isn't
5021 # going to fit; so first use eval to check.
5022 # Since integer overflow is only a warning, have to make
5023 # warnings fatal for the eval to be effective.
5024 eval qq!use warnings FATAL => qw(all); hex("$arg")!;
5025 if ($@) {
5026 # leave clue in case something else went wrong.
5027 warn "\@U hex($arg) eval failed: $@\n" if ($self->{'DEBUG'});
5028 # argument likely exceeds size of integer
5029 }
5030 # ok, value can be given to hex(), so try it.
5031 if ($@ or hex($arg) > 0x10FFFF) {
5032 $self->line_error(
5033 sprintf(__("argument for \@U exceeds Unicode maximum 0x10FFFF: %s"),
5034 $arg),
5035 $line_nr);
5036 }
5037 }
5038
5039 } elsif (_command_with_command_as_argument($current->{'parent'}->{'parent'})
5040 and scalar(@{$current->{'contents'}}) == 0) {
5041 print STDERR "FOR PARENT \@$current->{'parent'}->{'parent'}->{'parent'}->{'cmdname'} command_as_argument braces $current->{'cmdname'}\n" if ($self->{'DEBUG'});
5042 $current->{'parent'}->{'type'} = 'command_as_argument'
5043 if (!$current->{'parent'}->{'type'});
5044 $current->{'parent'}->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
5045 = $current->{'parent'};
5046 } elsif ($current->{'parent'}->{'cmdname'} eq 'sortas') {
5047 my @contents = @{$current->{'contents'}};
5048 my $arg = $current->{'contents'}->[0]->{'text'};
5049 if (defined($arg)) {
5050 my $index_element = $current->{'parent'}->{'parent'}->{'parent'};
5051 if ($index_element and $index_element->{'cmdname'}
5052 and $self->{'command_index'}->{$index_element->{'cmdname'}}) {
5053 $index_element->{'extra'}->{'sortas'} = $arg;
5054 }
5055 }
5056 }
5057 _register_global_command($self, $current->{'parent'}, $line_nr);
5058 if ($command_ignore_space_after{$current->{'parent'}->{'cmdname'}}) {
5059 push @{$current->{'parent'}->{'parent'}->{'contents'}},
5060 {'type' => 'empty_spaces_after_close_brace',
5061 'text' => '',
5062 'parent' => $current->{'parent'}->{'parent'}
5063 };
5064 }
5065 $current = $current->{'parent'}->{'parent'};
5066 $current = _begin_preformatted ($self, $current)
5067 if ($close_preformatted_commands{$closed_command});
5068 # lone braces accepted right in a rawpreformatted
5069 } elsif ($current->{'type'}
5070 and $current->{'type'} eq 'rawpreformatted') {
5071 push @{$current->{'contents'}}, {'text' => '}',
5072 'parent' => $current };
5073 # footnote caption closing, when there is a paragraph inside.
5074 } elsif ($context_brace_commands{$self->{'context_stack'}->[-1]}) {
5075 # closing the context under broader situations
5076 $current = _end_paragraph($self, $current, $line_nr);
5077 if ($current->{'parent'}
5078 and $current->{'parent'}->{'cmdname'}
5079 and $context_brace_commands{$current->{'parent'}->{'cmdname'}}
5080 and $current->{'parent'}->{'cmdname'} eq $self->{'context_stack'}->[-1]) {
5081 my $context_command = pop @{$self->{'context_stack'}};
5082 if ($context_command ne $current->{'parent'}->{'cmdname'}) {
5083 $self->_bug_message("context $context_command instead of brace isolated $current->{'parent'}->{'cmdname'}",
5084 $line_nr, $current);
5085 die;
5086 }
5087 print STDERR "CLOSING(context command) \@$current->{'parent'}->{'cmdname'}\n" if ($self->{'DEBUG'});
5088 my $closed_command = $current->{'parent'}->{'cmdname'};
5089 _register_global_command($self, $current->{'parent'}, $line_nr);
5090 $current = $current->{'parent'}->{'parent'};
5091 $current = _begin_preformatted ($self, $current)
5092 if ($close_preformatted_commands{$closed_command});
5093 }
5094 } else {
5095 $self->line_error(sprintf(__("misplaced %c"),
5096 ord('}')), $line_nr);
5097 }
5098 } elsif ($separator eq ','
5099 and $current->{'parent'}->{'remaining_args'}) {
5100 _abort_empty_line ($self, $current);
5101 _isolate_last_space($self, $current);
5102 my $type = $current->{'type'};
5103 $current = $current->{'parent'};
5104 if ($inline_commands{$current->{'cmdname'}}) {
5105 my $expandp = 0;
5106 if (! $current->{'extra'}->{'format'}) {
5107 my $inline_type;
5108 if (defined $current->{'args'}->[0]
5109 and @{$current->{'args'}->[0]->{'contents'}}) {
5110 $inline_type = $current->{'args'}->[0]->{'contents'}->[0]->{'text'};
5111 }
5112
5113 if (!$inline_type) {
5114 # condition is missing for some reason
5115 print STDERR "INLINE COND MISSING\n"
5116 if ($self->{'DEBUG'});
5117 } elsif ($inline_format_commands{$current->{'cmdname'}}) {
5118 if ($self->{'expanded_formats_hash'}->{$inline_type}) {
5119 $expandp = 1;
5120 $current->{'extra'}->{'expand_index'} = 1;
5121 } else {
5122 $expandp = 0;
5123 }
5124 } elsif (($current->{'cmdname'} eq 'inlineifset'
5125 and exists($self->{'values'}->{$inline_type}))
5126 or ($current->{'cmdname'} eq 'inlineifclear'
5127 and ! exists($self->{'values'}->{$inline_type}))) {
5128 $expandp = 1;
5129 $current->{'extra'}->{'expand_index'} = 1;
5130 } else {
5131 $expandp = 0;
5132 }
5133 $current->{'extra'}->{'format'} = $inline_type;
5134
5135 # Skip first argument for a false @inlinefmtifelse
5136 if (!$expandp and $current->{'cmdname'} eq 'inlinefmtifelse') {
5137 $current->{'extra'}->{'expand_index'} = 2;
5138
5139 # Add a dummy argument for the first argument.
5140 push @{$current->{'args'}}, {'type' => 'elided',
5141 'parent' => $current,
5142 'contents' => []};
5143
5144 # Scan forward to get the next argument.
5145 my $brace_count = 1;
5146 while ($brace_count > 0) {
5147 # Forward to next comma or brace
5148 if ($line =~ s/[^{,}]*([,{}])//) {
5149 if ($1 eq ',' and $brace_count == 1) {
5150 last;
5151 } elsif ($1 eq '{') {
5152 $brace_count++;
5153 } elsif ($1 eq '}') {
5154 $brace_count--;
5155 }
5156 } else {
5157 my $new_text;
5158 ($new_text, $line_nr) = _next_text($self, $line_nr);
5159 if (!$new_text) {
5160 next NEXT_LINE; # error - unbalanced brace
5161 }
5162 $line .= $new_text;
5163 }
5164 }
5165 if ($brace_count == 0) {
5166 # second arg missing
5167 $line = '}' . $line;
5168 }
5169 $current->{'remaining_args'}--;
5170 $expandp = 1;
5171 }
5172 } elsif ($current->{'cmdname'} eq 'inlinefmtifelse') {
5173 # Second arg of @inlinefmtifelse when condition is true.
5174 # Discard second argument.
5175 $expandp = 0;
5176 }
5177 # If this command is not being expanded, add a dummy argument,
5178 # and scan forward to the closing brace.
5179 if (!$expandp) {
5180 push @{$current->{'args'}}, {'type' => 'elided',
5181 'parent' => $current,
5182 'contents' => []};
5183 my $brace_count = 1;
5184 while ($brace_count > 0) {
5185 if ($line =~ s/[^{}]*([{}])//) {
5186 if ($1 eq '{') {
5187 $brace_count++;
5188 } else {
5189 $brace_count--;
5190 }
5191 } else {
5192 my $new_text;
5193 ($new_text, $line_nr) = _next_text($self, $line_nr);
5194 if (!$new_text) {
5195 next NEXT_LINE; # error - unbalanced brace
5196 }
5197 $line .= $new_text;
5198 }
5199 }
5200 $current = $current->{'args'}->[-1];
5201 $line = '}' . $line;
5202 next;
5203 }
5204 }
5205 $current->{'remaining_args'}--;
5206 push @{$current->{'args'}},
5207 { 'type' => $type, 'parent' => $current, 'contents' => [] };
5208 $current = $current->{'args'}->[-1];
5209 push @{$current->{'contents'}},
5210 {'type' => 'empty_spaces_before_argument',
5211 'text' => '',
5212 'parent' => $current,
5213 'extra' => {'command' => $current}
5214 };
5215 } elsif ($separator eq ',' and $current->{'type'}
5216 and $current->{'type'} eq 'line_arg'
5217 and $current->{'parent'}->{'cmdname'}
5218 and $current->{'parent'}->{'cmdname'} eq 'node') {
5219 $self->line_warn(__("superfluous arguments for node"), $line_nr);
5220 # end of menu node (. must be followed by a space to stop the node).
5221 } elsif (($separator =~ /[,\t.]/ and $current->{'type'}
5222 and $current->{'type'} eq 'menu_entry_node')
5223 or ($separator eq ':' and $current->{'type'}
5224 and $current->{'type'} eq 'menu_entry_name')) {
5225 $current = $current->{'parent'};
5226 push @{$current->{'args'}}, { 'type' => 'menu_entry_separator',
5227 'text' => $separator,
5228 'parent' => $current };
5229 } elsif ($separator eq "\f" and $current->{'type'}
5230 and $current->{'type'} eq 'paragraph') {
5231 # form feed stops and restart a paragraph.
5232 $current = $self->_end_paragraph($current);
5233 push @{$current->{'contents'}}, {'text' => $separator,
5234 'type' => 'empty_line',
5235 'parent' => $current };
5236 push @{$current->{'contents'}}, { 'type' => 'empty_line',
5237 'text' => '',
5238 'parent' => $current };
5239
5240 } else {
5241 $current = _merge_text($self, $current, $separator);
5242 }
5243 # Misc text except end of line
5244 } elsif (defined $misc_text) {
5245 my $new_text = $misc_text;
5246 substr ($line, 0, length ($misc_text)) = '';
5247 $current = _merge_text($self, $current, $new_text);
5248 # end of line
5249 } else {
5250 print STDERR "END LINE: ". _print_current($current)."\n"
5251 if ($self->{'DEBUG'});
5252 if ($line =~ s/^(\n)//) {
5253 $current = _merge_text($self, $current, $1);
5254 } else {
5255 if (scalar(@{$self->{'input'}})) {
5256 $self->_bug_message("Text remaining without normal text but `$line'",
5257 $line_nr, $current);
5258 die;
5259 }
5260 }
5261 $current = _end_line($self, $current, $line_nr);
5262 last;
5263 }
5264 }
5265 }
5266 while (@{$self->{'conditionals_stack'}}) {
5267 my $end_conditional = pop @{$self->{'conditionals_stack'}};
5268 $self->line_error(sprintf(__("expected \@end %s"), $end_conditional),
5269 $line_nr);
5270 }
5271 $current = _close_commands($self, $current, $line_nr);
5272
5273 if (@{$self->{'context_stack'}} != 1) {
5274 # This happens in 2 cases in the tests:
5275 # @verb not closed on misc commands line
5276 # def line escaped with @ ending the file
5277 if ($self->{'DEBUG'}) {
5278 print STDERR "CONTEXT_STACK no empty end _parse_texi: ".join('|', @{$self->{'context_stack'}})."\n";
5279 }
5280 @{$self->{'context_stack'}} = ('_root');
5281 }
5282
5283 # Call 'labels_information' to initialize labels.
5284 my $labels = labels_information($self);
5285 Texinfo::Common::complete_indices($self);
5286 return $root;
5287 }
5288
5289 # parse special line @-commands, unmacro, set, clear, clickstyle.
5290 # Also remove spaces or ignore text, as specified in the line_commands hash.
5291 sub _parse_special_misc_command($$$$)
5292 {
5293 my ($self, $line, $command, $line_nr) = @_;
5294
5295 my $args = [];
5296
5297 my $has_comment = 0;
5298 my $remaining;
5299 if ($command eq 'set') {
5300 # REVALUE
5301 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)(\@(c|comment)((\@|\s+).*)?|\s+(.*?))?\s*$/) {
5302 if ($line =~ s/\@(c|comment)((\@|\s+).*)?$//) {
5303 $has_comment = 1;
5304 }
5305 $line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)(\s+(.*?))?\s*$/;
5306 my $name = $1;
5307 my $arg = $3;
5308 $arg = '' if (!defined($arg));
5309 $args = [$name, $arg];
5310 $self->{'values'}->{$name} = $arg;
5311 } elsif ($line !~ /\S/) {
5312 $self->line_error(sprintf(
5313 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5314 } else {
5315 $self->line_error(sprintf(
5316 __("bad name for \@%s"), $command), $line_nr);
5317 }
5318 } elsif ($command eq 'clear') {
5319 # REVALUE
5320 if ($line =~ /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
5321 $args = [$1];
5322 delete $self->{'values'}->{$1};
5323 $has_comment = 1 if (defined($3));
5324 } elsif ($line !~ /\S/) {
5325 $self->line_error(sprintf(
5326 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5327 } else {
5328 $self->line_error(sprintf(
5329 __("bad name for \@%s"), $command), $line_nr);
5330 }
5331 } elsif ($command eq 'unmacro') {
5332 # REMACRO
5333 if ($line =~ /^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
5334 $args = [$1];
5335 delete $self->{'macros'}->{$1};
5336 $has_comment = 1 if (defined($3));
5337 print STDERR "UNMACRO $1\n" if ($self->{'DEBUG'});
5338 } elsif ($line !~ /\S/) {
5339 $self->line_error(sprintf(
5340 __("%c%s requires a name"), ord('@'), $command), $line_nr);
5341 } else {
5342 $self->line_error(sprintf(
5343 __("bad name for \@%s"), $command), $line_nr);
5344 }
5345 } elsif ($command eq 'clickstyle') {
5346 # REMACRO
5347 if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*/) {
5348 $args = ['@'.$1];
5349 $self->{'clickstyle'} = $1;
5350 $remaining = $line;
5351 $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)(\{\})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
5352 $has_comment = 1 if (defined($4));
5353 } else {
5354 $self->line_error (sprintf(__(
5355 "\@%s should only accept an \@-command as argument, not `%s'"),
5356 $command, $line), $line_nr);
5357 }
5358 } else {
5359 die $self->_bug_message("Unknown special command $command", $line_nr);
5360 }
5361 if (defined($remaining)) {
5362 chomp($remaining);
5363 if ($remaining ne '') {
5364 $self->line_warn(sprintf(__(
5365 "remaining argument on \@%s line: %s"),
5366 $command, $remaining), $line_nr);
5367 }
5368 }
5369 return ($args, $has_comment);
5370 }
5371
5372 # at the end of an @-command line with arguments, parse the resulting
5373 # text, to collect aliases, definfoenclose and collect errors on
5374 # wrong arguments.
5375 sub _parse_line_command_args($$$)
5376 {
5377 my ($self, $line_command, $line_nr) = @_;
5378
5379 my $args;
5380
5381 my $command = $line_command->{'cmdname'};
5382 my $arg = $line_command->{'args'}->[0];
5383
5384 if ($self->{'DEBUG'}) {
5385 print STDERR "MISC ARGS \@$command\n";
5386 if (@{$arg->{'contents'}}) {
5387 my $idx = 0;
5388 foreach my $content (@{$arg->{'contents'}}) {
5389 my $name = '';
5390 $name = '@' . $content->{'cmdname'} if ($content->{'cmdname'});
5391 my $type = ', t: ';
5392 $type .= $content->{'type'} if ($content->{'type'});
5393 my $text = ', ';
5394 $type .= $content->{'text'} if ($content->{'text'});
5395 print STDERR " -> $idx $name $type $text\n";
5396 $idx++;
5397 }
5398 }
5399 }
5400
5401 if (!$arg->{'contents'} or !@{$arg->{'contents'}}) {
5402 $self->_command_error($line_command, $line_nr,
5403 __("\@%s missing argument"), $command);
5404 $line_command->{'extra'}->{'missing_argument'} = 1;
5405 return undef;
5406 }
5407
5408 if (@{$arg->{'contents'}} > 1
5409 or (!defined($arg->{'contents'}->[0]->{'text'}))) {
5410 $self->line_error (sprintf(__("superfluous argument to \@%s"),
5411 $command), $line_nr);
5412 }
5413 return undef if (!defined($arg->{'contents'}->[0]->{'text'}));
5414
5415 my $line = $arg->{'contents'}->[0]->{'text'};
5416
5417 if ($command eq 'alias') {
5418 # REMACRO
5419 if ($line =~ s/^([[:alnum:]][[:alnum:]-]*)(\s*=\s*)([[:alnum:]][[:alnum:]-]*)$//) {
5420 my $new_command = $1;
5421 my $existing_command = $3;
5422 $args = [$1, $3];
5423 $self->{'aliases'}->{$new_command} = $existing_command;
5424 if (exists($block_commands{$existing_command})) {
5425 $self->line_warn(sprintf(
5426 __("environment command %s as argument to \@%s"),
5427 $existing_command, $command), $line_nr);
5428 }
5429 } else {
5430 $self->line_error(sprintf(
5431 __("bad argument to \@%s"), $command), $line_nr);
5432 }
5433
5434 } elsif ($command eq 'definfoenclose') {
5435 # REMACRO
5436 if ($line =~ s/^([[:alnum:]][[:alnum:]\-]*)\s*,\s*([^\s,]*)\s*,\s*([^\s,]*)$//) {
5437 $args = [$1, $2, $3 ];
5438 $self->{'definfoenclose'}->{$1} = [ $2, $3 ];
5439 print STDERR "DEFINFOENCLOSE \@$1: $2, $3\n" if ($self->{'DEBUG'});
5440
5441 $brace_commands{$1} = 'style';
5442
5443 # Warning: there is a risk of mixing of data between a built-in
5444 # command and a user command defined with @definfoenclose.
5445 # %keep_line_nr_brace_commands is one example of this.
5446 } else {
5447 $self->line_error(sprintf(
5448 __("bad argument to \@%s"), $command), $line_nr);
5449 }
5450 } elsif ($command eq 'columnfractions') {
5451 my @possible_fractions = split (/\s+/, $line);
5452 if (!@possible_fractions) {
5453 $self->line_error (sprintf(__("empty \@%s"), $command),
5454 $line_nr);
5455 } else {
5456 foreach my $fraction (@possible_fractions) {
5457 if ($fraction =~ /^\d*\.\d+$|^\d+\.?$/) {
5458 push @$args, $fraction;
5459 } else {
5460 $self->line_error (sprintf(
5461 __("column fraction not a number: %s"),
5462 $fraction), $line_nr);
5463 }
5464 }
5465 }
5466 } elsif ($command eq 'sp') {
5467 if ($line =~ /^([0-9]+)$/) {
5468 $args = [$1];
5469 } else {
5470 $self->line_error(sprintf(__("\@sp arg must be numeric, not `%s'"),
5471 $line), $line_nr);
5472 }
5473 } elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
5474 # REMACRO
5475 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
5476 my $name = $1;
5477 if ($forbidden_index_name{$name}) {
5478 $self->line_error(sprintf(
5479 __("reserved index name %s"),$name), $line_nr);
5480 } else {
5481 my $in_code = 0;
5482 $in_code = 1 if ($command eq 'defcodeindex');
5483 $args = [$name];
5484 $self->{'index_names'}->{$name} = {'in_code' => $in_code};
5485 if (!exists($self->{'index_names'}->{$name}->{'name'})) {
5486 $self->{'index_names'}->{$name}->{'name'} = $name;
5487 }
5488 if (!exists($self->{'index_names'}->{$name}->{'contained_indices'})) {
5489 $self->{'index_names'}->{$name}->{'contained_indices'}->{$name} = 1;
5490 }
5491 $self->{'line_commands'}->{$name.'index'} = 'line';
5492 $self->{'no_paragraph_commands'}->{$name.'index'} = 1;
5493 $self->{'valid_nestings'}->{$name.'index'} = \%in_simple_text_commands;
5494 $self->{'command_index'}->{$name.'index'} = $name;
5495 }
5496 } else {
5497 $self->line_error(sprintf(
5498 __("bad argument to \@%s: %s"), $command, $line), $line_nr);
5499 }
5500 } elsif ($command eq 'synindex' || $command eq 'syncodeindex') {
5501 # REMACRO
5502 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)\s+([[:alnum:]][[:alnum:]\-]*)$/) {
5503 my $index_from = $1;
5504 my $index_to = $2;
5505 $self->line_error(sprintf(__("unknown source index in \@%s: %s"),
5506 $command, $index_from), $line_nr)
5507 unless $self->{'index_names'}->{$index_from};
5508 $self->line_error(sprintf(__("unknown destination index in \@%s: %s"),
5509 $command, $index_to), $line_nr)
5510 unless $self->{'index_names'}->{$index_to};
5511 if ($self->{'index_names'}->{$index_from}
5512 and $self->{'index_names'}->{$index_to}) {
5513 my $current_to = $index_to;
5514 # find the merged indices recursively avoiding loops
5515 while ($current_to ne $index_from
5516 and $self->{'merged_indices'}->{$current_to}) {
5517 $current_to = $self->{'merged_indices'}->{$current_to};
5518 }
5519 if ($current_to ne $index_from) {
5520 my $index_from_info = $self->{'index_names'}->{$index_from};
5521 my $index_to_info = $self->{'index_names'}->{$current_to};
5522
5523 my $in_code = 0;
5524 $in_code = 1 if ($command eq 'syncodeindex');
5525 $self->{'merged_indices'}->{$index_from} = $current_to;
5526 $index_from_info->{'in_code'} = $in_code;
5527 foreach my $contained_index (keys %{$index_from_info->{'contained_indices'}}) {
5528 $index_to_info->{'contained_indices'}->{$contained_index} = 1;
5529 $self->{'index_names'}->{$contained_index}->{'merged_in'} = $current_to;
5530 $self->{'merged_indices'}->{$contained_index} = $current_to;
5531 }
5532 delete $index_from_info->{'contained_indices'};
5533 $index_from_info->{'merged_in'} = $current_to;
5534 $index_to_info->{'contained_indices'}->{$index_from} = 1;
5535 $args = [$index_from, $index_to];
5536 } else {
5537 $self->line_warn(sprintf(__(
5538 "\@%s leads to a merging of %s in itself, ignoring"),
5539 $command, $index_from), $line_nr);
5540 }
5541 }
5542 } else {
5543 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5544 $command, $line), $line_nr);
5545 }
5546 } elsif ($command eq 'printindex') {
5547 # REMACRO
5548 if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
5549 my $name = $1;
5550 if (!exists($self->{'index_names'}->{$name})) {
5551 $self->line_error(sprintf(__("unknown index `%s' in \@printindex"),
5552 $name), $line_nr);
5553
5554 } else {
5555 if ($self->{'merged_indices'}->{$name}) {
5556 $self->line_warn(sprintf(__(
5557 "printing an index `%s' merged in another one, `%s'"),
5558 $name, $self->{'merged_indices'}->{$name}),
5559 $line_nr);
5560 }
5561 if (!defined($self->{'current_node'})
5562 and !defined($self->{'current_section'})
5563 and !scalar(@{$self->{'regions_stack'}})) {
5564 $self->line_warn(sprintf(__(
5565 "printindex before document beginning: \@printindex %s"),
5566 $name), $line_nr);
5567 }
5568 $args = [$name];
5569 }
5570 } else {
5571 $self->line_error(sprintf(
5572 __("bad argument to \@%s: %s"), $command, $line), $line_nr);
5573 }
5574 } elsif (grep {$_ eq $command} ('everyheadingmarks', 'everyfootingmarks',
5575 'evenheadingmarks', 'oddheadingmarks',
5576 'evenfootingmarks', 'oddfootingmarks')) {
5577 if ($line eq 'top' or $line eq 'bottom') {
5578 $args = [$line];
5579 } else {
5580 $self->line_error(sprintf(__(
5581 "\@%s arg must be `top' or `bottom', not `%s'"),
5582 $command, $line), $line_nr);
5583 }
5584 } elsif ($command eq 'fonttextsize') {
5585 if ($line eq '10' or $line eq '11') {
5586 $args = [$line];
5587 } else {
5588 $self->line_error(sprintf(__(
5589 "Only \@%s 10 or 11 is supported, not `%s'"),
5590 $command, $line), $line_nr);
5591 }
5592 } elsif ($command eq 'footnotestyle') {
5593 if ($line eq 'separate' or $line eq 'end') {
5594 $args = [$line];
5595 } else {
5596 $self->line_error(sprintf(__(
5597 "\@%s arg must be `separate' or `end', not `%s'"),
5598 $command, $line), $line_nr);
5599 }
5600 } elsif ($command eq 'setchapternewpage') {
5601 if ($line eq 'on' or $line eq 'off' or $line eq 'odd') {
5602 $args = [$1];
5603 } else {
5604 $self->line_error(sprintf(__(
5605 "\@%s arg must be `on', `off' or `odd', not `%s'"),
5606 $command, $line), $line_nr);
5607 }
5608 } elsif ($command eq 'need') { # only a warning
5609 if (($line =~ /^([0-9]+(\.[0-9]*)?)$/) or
5610 ($line =~ /^(\.[0-9]+)$/)) {
5611 $args = [$1];
5612 } else {
5613 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5614 $command, $line), $line_nr);
5615 }
5616 } elsif ($command eq 'paragraphindent') {
5617 if ($line =~ /^([\w\-]+)$/) {
5618 my $value = $1;
5619 if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq 'asis') {
5620 $args = [$1];
5621 } else {
5622 $self->line_error(sprintf(__(
5623 "\@paragraphindent arg must be numeric/`none'/`asis', not `%s'"),
5624 $value), $line_nr);
5625 }
5626 } else {
5627 $self->line_error(sprintf(__(
5628 "\@paragraphindent arg must be numeric/`none'/`asis', not `%s'"),
5629 $line), $line_nr);
5630 }
5631 } elsif ($command eq 'firstparagraphindent') {
5632 if ($line eq 'none' or $line eq 'insert') {
5633 $args = [$line];
5634 } else {
5635 $self->line_error(sprintf(__(
5636 "\@firstparagraphindent arg must be `none' or `insert', not `%s'"),
5637 $line), $line_nr);
5638 }
5639 } elsif ($command eq 'exampleindent') {
5640 if ($line =~ /^([0-9]+)$/) {
5641 $args = [$1];
5642 } elsif ($line =~ /^(asis)$/) {
5643 $args = [$1];
5644 } else {
5645 $self->line_error(sprintf(__(
5646 "\@exampleindent arg must be numeric/`asis', not `%s'"),
5647 $line), $line_nr);
5648 }
5649 } elsif ($command eq 'frenchspacing'
5650 or $command eq 'xrefautomaticsectiontitle'
5651 or $command eq 'codequoteundirected'
5652 or $command eq 'codequotebacktick'
5653 or $command eq 'validatemenus'
5654 or $command eq 'deftypefnnewline') {
5655 if ($line eq 'on' or $line eq 'off') {
5656 $args = [$line];
5657 } else {
5658 $self->line_error(sprintf(__("expected \@%s on or off, not `%s'"),
5659 $command, $line), $line_nr);
5660 }
5661 } elsif ($command eq 'kbdinputstyle') {
5662 if ($line eq 'code' or $line eq 'example' or $line eq 'distinct') {
5663 $self->{'kbdinputstyle'} = $line;
5664 $args = [$line];
5665 } else {
5666 $self->line_error(sprintf(__(
5667 "\@kbdinputstyle arg must be `code'/`example'/`distinct', not `%s'"),
5668 $line), $line_nr);
5669 }
5670 } elsif ($command eq 'allowcodebreaks') {
5671 if ($line eq 'true' or $line eq 'false') {
5672 $args = [$line];
5673 } else {
5674 $self->line_error(sprintf(__(
5675 "\@allowcodebreaks arg must be `true' or `false', not `%s'"),
5676 $line), $line_nr);
5677 }
5678 } elsif ($command eq 'urefbreakstyle') {
5679 if ($line eq 'after' or $line eq 'before' or $line eq 'none') {
5680 $args = [$line];
5681 } else {
5682 $self->line_error(sprintf(__(
5683 "\@urefbreakstyle arg must be `after'/`before'/`none', not `%s'"),
5684 $line), $line_nr);
5685 }
5686 } elsif ($command eq 'headings') {
5687 if ($line eq 'off' or $line eq 'on' or $line eq 'single'
5688 or $line eq 'double' or $line eq 'singleafter' or $line eq 'doubleafter') {
5689 $args = [$line];
5690 } else {
5691 $self->line_error(sprintf(__("bad argument to \@%s: %s"),
5692 $command, $line), $line_nr);
5693 }
5694 }
5695 return $args;
5696 }
5697
5698 1;
5699 __END__
5700 =head1 NAME
5701
5702 Texinfo::Parser - Parse Texinfo code into a Perl tree
5703
5704 =head1 SYNOPSIS
5705
5706 use Texinfo::Parser;
5707 my $parser = Texinfo::Parser::parser();
5708 my $tree = $parser->parse_texi_file("somefile.texi");
5709 my ($errors, $errors_count) = $parser->errors();
5710 foreach my $error_message (@$errors) {
5711 warn $error_message->{'error_line'};
5712 }
5713
5714 my $index_names = $parser->indices_information();
5715 my $float_types_arrays = $parser->floats_information();
5716 my $internal_references_array
5717 = $parser->internal_references_information();
5718 # An hash reference on normalized node/float/anchor names
5719 my $labels_information = $parser->labels_information();
5720 # A hash reference, keys are @-command names, value is an
5721 # array reference holding all the corresponding @-commands.
5722 my $global_commands_information = $parser->global_commands_information();
5723 # a hash reference on some document informations (encodings,
5724 # input file name, dircategory and direntry list, for exampel).
5725 my $global_informations = $parser->global_informations();
5726
5727 =head1 DESCRIPTION
5728
5729 Texinfo::Parser will parse Texinfo text into a perl tree. In one pass
5730 it expands user-defined @-commands, conditionals (@ifset, @ifinfo...)
5731 and @value and constructs the tree. Some extra information is gathered
5732 while doing the tree: for example, the block command associated with @end,
5733 the number of rows in a multitable, or the node associated with a section.
5734
5735
5736
5737 =head1 METHODS
5738
5739 No method is exported in the default case. The module allows both
5740 an object-oriented syntax, or traditional function, with the parser
5741 as an opaque data structure given as an argument to every function.
5742
5743 =head2 Initialization
5744
5745 The following method is used to construct a new C<Texinfo::Parser> object:
5746
5747 =over
5748
5749 =item $parser = Texinfo::Parser::parser($options);
5750
5751 This method creates a new parser. The options may be provided as a hash
5752 reference. There are two types of option. The first type of option
5753 change the way the parser behaves; they are described right here. The
5754 other type of option allows giving the parser some information as if
5755 it came from texinfo code; for example, allow setting aliases (as with
5756 C<@alias>), values (as with C<@set>), or merged indices (as with
5757 C<@synindex>). These options are described below in L</Texinfo Parser options>.
5758
5759 =over
5760
5761 =item expanded_formats
5762
5763 An array reference of the output formats for which C<@ifI<FORMAT>>
5764 conditional blocks should be expanded. Default is empty.
5765
5766 =item include_directories
5767
5768 An array reference of directories in which C<@include> files should be
5769 searched for. Default contains the working directory, F<.>.
5770
5771 =item IGNORE_BEFORE_SETFILENAME
5772
5773 If set, and C<@setfilename> exists, everything before C<@setfilename>
5774 is put in a special container type, @C<preamble_before_setfilename>.
5775 This option is set in the default case.
5776
5777 =item IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME
5778
5779 If set, spaces after an @-command name that take braces are ignored.
5780 Default on.
5781
5782 =item MAX_MACRO_CALL_NESTING
5783
5784 Maximal number of nested user-defined macro calls. Default is 100000.
5785
5786 =item SHOW_MENU
5787
5788 If false, no menu-related errors are reported. Default is true.
5789
5790 =begin :comment
5791
5792 Used by Sectioning only
5793 =item TOP_NODE_UP
5794
5795 Text for the up node of the Top node. The default is C<(dir)>. The
5796 string may contain @-commands.
5797
5798 =end :comment
5799
5800 =back
5801
5802 =back
5803
5804 =head2 Parsing Texinfo text
5805
5806 There are three methods that may be called to parse some Texinfo code:
5807 C<parse_texi_line> for a line, C<parse_texi_text> for a text fragment,
5808 and C<parse_texi_file> for a file.
5809
5810 For all those functions, if the I<$parser> argument is undef, a new
5811 parser object is generated to parse the line. Otherwise the parser given
5812 as an argument is used to parse into a tree.
5813
5814 When C<parse_texi_text> is used, the resulting tree is rooted at
5815 a C<root_line> type container. Otherwise, the resulting tree should be
5816 rooted at a C<text_root> type container if it does not contain nodes or
5817 sections, at a C<document_root> type container otherwise.
5818
5819 =over
5820
5821 =item $tree = parse_texi_line($parser, $text, $first_line_number, $file_name, $macro_name, $fixed_line_number)
5822
5823 This function is used to parse a short fragment of Texinfo code.
5824
5825 I<$text> may be either an array reference of lines, or a text.
5826
5827 The other arguments are optional and allow specifying the position
5828 information of the Texinfo code. I<$first_line_number> is the line number
5829 of the first text line. I<$file_name> is the name of the file the
5830 text comes from. I<$macro> is for the user-defined macro name the text
5831 is expanded from. If I<$fixed_line_number> is set, the line number is
5832 not increased for the different lines, as if the text was the expansion
5833 of a macro.
5834
5835 =item $tree = parse_texi_text ($parser, $text, $line_numbers_specification, $file_name, $macro_name, $fixed_line_number)
5836
5837 This function is used to parse some Texinfo text.
5838
5839 I<$text> may be either an array reference of lines, or a text.
5840
5841 The other arguments are optional and allow specifying the position
5842 information of the Texinfo code. There are two distinct cases for
5843 I<$line_numbers_specification>.
5844
5845 =over
5846
5847 =item 1.
5848
5849 If it is an array reference, it is considered to hold objects describing
5850 the position information of each text line.
5851
5852 =item 2.
5853
5854 If I<$line_numbers_specification> is a scalar, it is the line number of
5855 the first text line. In that case (like for C<parse_texi_text>),
5856 I<$file_name> is the name of the file the text comes from.
5857 and I<$macro> is for the user-defined macro name the text
5858 is expanded from. If I<$fixed_line_number> is set, the line number is
5859 not increased for the different lines, as if the text was the expansion
5860 of a macro.
5861
5862 =back
5863
5864 =item $tree = parse_texi_file($parser, $file_name)
5865
5866 The file with name I<$file_name> is considered to be a Texinfo file and
5867 is parsed into a tree.
5868
5869 undef is returned if the file couldn't be read.
5870
5871 =back
5872
5873 The errors collected during the tree parsing are available through the
5874 C<errors> method. This method comes from C<Texinfo::Report>, and is
5875 described in L<errors|Texinfo::Report/($error_warnings_list, $error_count) = errors ($converter)>.
5876
5877 =head2 Getting information on the document
5878
5879 After parsing some information about the Texinfo code that was processed
5880 is available from the parser.
5881
5882 Some global information is available through C<global_informations>
5883
5884 =over
5885
5886 =item $info = global_informations($parser)
5887
5888 The I<$info> returned is a hash reference. The possible keys are
5889
5890 =over
5891
5892 =item input_file_name
5893
5894 The name of the main Texinfo input file.
5895
5896 =item input_encoding_name
5897
5898 =item input_perl_encoding
5899
5900 C<input_encoding_name> string is the encoding name used for the
5901 Texinfo code.
5902 C<input_perl_encoding> string is a corresponding perl encoding name.
5903
5904 =item dircategory_direntry
5905
5906 An array of successive C<@dircategory> and C<@direntry> as they appear
5907 in the document.
5908
5909 =item novalidate
5910
5911 If set, it is as if C<@novalidate> was set in the document.
5912
5913
5914 =back
5915
5916 =back
5917
5918 Some command lists are available, such that it is possible to go through
5919 the corresponding tree elements without walking the tree. They are
5920 available through C<global_commands_information>
5921
5922 =over
5923
5924 =item $commands = global_commands_information($parser)
5925
5926 I<$commands> is an hash reference. The keys are @-command names. The
5927 associated values are array references containing all the corresponding
5928 tree elements.
5929
5930 =back
5931
5932 All the @-commands that have an associated label (so can be the
5933 target of cross references) - C<@node>, C<@anchor> and C<@float> with
5934 label - have a normalized name associated, constructed as described in the
5935 B<HTML Xref> node in the Texinfo manual. Those normalized labels and
5936 the association with @-commands is available through C<labels_information>:
5937
5938 =over
5939
5940 =item $labels_information = labels_information($parser)
5941
5942 I<$labels_information> is a hash reference whose keys are normalized
5943 labels, and the associated value is the corresponding @-command.
5944
5945 =back
5946
5947 Information on C<@float> is also available, grouped by type of
5948 floats, each type correponding to potential C<@listoffloats>.
5949 This information is available through the method C<floats_information>.
5950
5951 =over
5952
5953 =item $float_types = floats_information($parser)
5954
5955 I<$float_types> is a hash reference whose keys are normalized float
5956 types (the first float argument, or the C<@listoffloats> argument).
5957 The normalization is the same as for node names. The value is the list
5958 of float tree elements appearing in the texinfo document.
5959
5960 =back
5961
5962 Internal references, that is, @-commands that refer to node, anchors
5963 or floats within the document are also available:
5964
5965 =over
5966
5967 =item $internal_references_array = internal_references_information($parser);
5968
5969 The function returns a list of cross-reference commands referring to
5970 the same document.
5971
5972 =back
5973
5974 Information about defined indices, merged indices and index entries is
5975 also available through the C<indices_information> method.
5976
5977 =over
5978
5979 =item indices_information
5980
5981 $index_names = indices_information($parser);
5982
5983 The index names is a hash reference. The keys are
5984
5985 =over
5986
5987 =item in_code
5988
5989 1 if the index entries should be formatted as code, 0 in the opposite case.
5990
5991 =item name
5992
5993 The index name.
5994
5995 =item prefix
5996
5997 An array reference of prefix associated to the index.
5998
5999 =item merged_in
6000
6001 In case the index is merged to another index, this key holds the name of
6002 the index the index is merged into. It takes into account indirectly
6003 merged indices.
6004
6005 =item contained_indices
6006
6007 An hash reference holding names of indices that are merged into the index,
6008 including itself. It also contains indirectly merged indices. This key
6009 is removed if the index is itself later merged to another index.
6010
6011 =item index_entries
6012
6013 An array reference containing index entry structures for index entries
6014 associated with the index. The index entry could be associated to
6015 @-commands like C<@cindex>, or C<@item> in C<@vtable>, or definition
6016 commands entries like C<@deffn>.
6017
6018 The keys of the index entry structures are
6019
6020 =over
6021
6022 =item index_name
6023
6024 The index name.
6025
6026 =item index_at_command
6027
6028 The name of the @-command associated with the index entry.
6029
6030 =item index_type_command
6031
6032 The @-command associated with the index entry allowing to
6033 find the index type.
6034
6035 =item content
6036
6037 An array reference corresponding to the index entry content.
6038
6039 =item content_normalized
6040
6041 An array reference corresponding to the index entry content, independent
6042 of the current language.
6043
6044 =item command
6045
6046 The element in the parsed tree associated with the @-command holding the
6047 index entry.
6048
6049 =item node
6050
6051 The node in the parsed tree containing the index entry.
6052
6053 =item number
6054
6055 The number of the index entry.
6056
6057 =item region
6058
6059 The region command (C<@copying>, C<@titlepage>) containing the index entry,
6060 if it is in such an environement.
6061
6062 =back
6063
6064 =back
6065
6066 The following shows the references corresponding to the default indexes
6067 I<cp> and I<fn>, the I<fn> index having its entries formatted as code and
6068 the indices corresponding to the following texinfo
6069
6070 @defindex some
6071 @defcodeindex code
6072
6073 $index_names = {'cp' => {'name' => 'cp', 'in_code' => 0, },
6074 'fn' => {'name' => 'fn', 'in_code' => 1, },
6075 'some' => {'in_code' => 0},
6076 'code' => {'in_code' => 1}};
6077
6078 If C<name> is not set, it is set to the index name.
6079
6080 =back
6081
6082 =head2 Texinfo Parser options
6083
6084 Setting these options is the same as seeing some Texinfo constructs in the
6085 document.
6086
6087 =over
6088
6089 =item aliases
6090
6091 A hash reference. The key is a command name, the value is the alias, as
6092 could be set by C<@alias>.
6093
6094 =item clickstyle
6095
6096 A string, the command name associated with C<@clickstyle>.
6097
6098 =item documentlanguage
6099
6100 A string corresponding to a document language set by C<@documentlanguage>.
6101
6102 =item INPUT_ENCODING_NAME
6103
6104 =item INPUT_PERL_ENCODING
6105
6106 C<INPUT_ENCODING_NAME> string is the encoding name as set
6107 by C<@documentencoding>.
6108 C<INPUT_PERL_ENCODING> string is a corresponding perl encoding name.
6109 In general those two strings should be set simultaneously.
6110
6111 =item indices
6112
6113 If it is a hash reference, the keys are index names, the values are
6114 index prefix hash references. The index prefix hash reference values are
6115 prefix, the value is set if the corresponding index entries should be
6116 formatted as if in C<@code>. An example is as L</indices_information>.
6117
6118 If it is an array reference, it is a list of index names, as if they were
6119 entered as
6120
6121 @defindex name
6122
6123 =item kbdinputstyle
6124
6125 A string, the C<@kbdinputstyle> style.
6126
6127 =item labels
6128
6129 A hash reference. Keys are normalized node names as described in the
6130 B<HTML Xref> node in the Texinfo manual. Instead of a node, it may also
6131 be a float label or an anchor name. The value is the corresponding
6132 @-command element in the tree.
6133
6134 =item macros
6135
6136 The associated hash reference has as keys user-defined macro names. The
6137 value is the reference on a macro definition element as obtained by
6138 the Parser when parsing a C<@macro>. For example
6139
6140 @macro mymacro{arg}
6141 coucou \arg\ after arg
6142 @end macro
6143
6144 Is associated to a macro definition element
6145
6146 {'cmdname' => 'macro',
6147 'args' => [{'text' => 'mymacro', 'type' => 'macro_name'},
6148 {'text' => 'arg', 'type' => 'macro_arg}],
6149 'contents' => [{'text' => "coucou \arg\ after arg\n", 'type' => 'raw'}],
6150 'extra' => {'arg_line' => " mymacro{arg}\n", }}
6151
6152 = item merged_indices
6153
6154 The associated hash reference holds merged indices information, each key
6155 is merged in the value. Same as setting C<@synindex> or C<syncodeindex>.
6156
6157 =item sections_level
6158
6159 Modifier of the sections level. Same as calling C<@lowersections> or
6160 C<@raisesections>.
6161
6162 =item values
6163
6164 A hash reference. Keys are names, values are the corresponding values.
6165 Same as values set by C<@set>.
6166
6167 =back
6168
6169 =head1 TEXINFO TREE
6170
6171 A Texinfo tree element (called element because node is overloaded in
6172 the Texinfo world) is an hash reference. There are three main categories
6173 of tree element. Tree elements associated with an @-command have a
6174 C<cmdname> key holding the @-command name. Tree elements corresponding
6175 to text fragments have a C<text> key holding the corresponding text.
6176 Finally, the last category is other containers (hereafter called
6177 containers) which in most cases have a C<type> key holding their name.
6178 Text fragments and @-command elements may also have an associated type
6179 when such information is needed.
6180
6181 The children of an @-command or container element are in the array
6182 referred to with the C<args> key or with the C<contents> key. The
6183 C<args> key is for arguments of @-commands, either in braces or on
6184 the rest of the line after the command, depending on the type of command.
6185 C<args> is also used for the elements of a menu entry, as a menu
6186 entry is well-structured with a limited number of arguments.
6187 The C<contents> key array holds the contents of the texinfo
6188 code appearing within a block @-command, within a container,
6189 or within a C<@node> or sectioning @-command.
6190
6191 Another important key for the elements is the C<extra> key which is
6192 associated to a hash reference and holds all kinds of information that
6193 is gathered during the parsing and may help with the conversion.
6194
6195 You can see examples of the tree structure by running makeinfo like
6196 this:
6197
6198 makeinfo -c DUMP_TREE=1 -c TEXINFO_OUTPUT_FORMAT=parse document.texi
6199
6200 For a simpler, more regular representation of the tree structure, you
6201 can do:
6202
6203 makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree document.texi
6204
6205 =head2 Element keys
6206
6207 =over
6208
6209 =item cmdname
6210
6211 The command name of @-command elements.
6212
6213 =item text
6214
6215 The text fragment of text elements.
6216
6217 =item type
6218
6219 The type of the element. For C<@verb> it is the delimiter. But otherwise
6220 it is the type of element considered as a container. Frequent types
6221 encountered are I<paragraph> for a paragraph container,
6222 I<brace_command_arg> for the container holding the brace @-commands
6223 contents, I<line_arg> and I<block_line_arg> contain the arguments
6224 appearing on the line of @-commands. Text fragments may have a type to
6225 give an information of the kind of text fragment, for example
6226 C<empty_spaces_before_argument> is associated to spaces after a brace
6227 opening and before the argument. Many @-commands elements don't have
6228 a type associated.
6229
6230 =item args
6231
6232 Arguments in braces or on @-command line, and the elements of a menu entry.
6233
6234 =item contents
6235
6236 The Texinfo appearing in the element. For block commands, other
6237 containers, C<@node> and sectioning commands.
6238
6239 =item parent
6240
6241 The parent element.
6242
6243 =item line_nr
6244
6245 An hash reference corresponding to information on the location of the
6246 element in the Texinfo input manual. It should only be available for
6247 @-command elements, and only for @-commands that are considered to be
6248 complex enough that the location in the document is needed, for example
6249 to prepare an error message.
6250
6251 The keys of the line number hash references are
6252
6253 =over
6254
6255 =item line_nr
6256
6257 The line number of the @-command.
6258
6259 =item file_name
6260
6261 The file name where @-command appeared.
6262
6263 =item macro
6264
6265 The user macro name the @-command is expanded from.
6266
6267 =back
6268
6269 =item extra
6270
6271 A hash reference holding any additional information.
6272 See L</Information available in the extra key>.
6273
6274 =back
6275
6276 =head2 Element types
6277
6278 =head3 Types for command elements
6279
6280 Some types can be associated with @-commands (in addition to the element
6281 being described by C<cmdname>), although usually there will be no type
6282 at all. As said above, for C<@verb> the type is the delimiter. For a
6283 C<@value> command that is not expanded because there is no corresponding
6284 value set, the type is the value argument string.
6285
6286 The following are the other possible values of C<type> for tree elements
6287 for @-commands.
6288
6289 =over
6290
6291 =item def_line
6292
6293 This type may be associated with a definition command with a x form,
6294 like C<@defunx>, C<@defvrx>. For the form without x, the associated
6295 I<def_line> is the first C<contents> element. It is described in more
6296 details below.
6297
6298 =item command_as_argument
6299
6300 This is the type of a command given in argument of C<@itemize>,
6301 C<@table>, C<@vtable> or C<@ftable>. For example in
6302
6303 @itemize @bullet
6304 @item item
6305 @end itemize
6306
6307 the element corresponding with bullet has the following keys:
6308
6309 'cmdname' => 'bullet'
6310 'type' => 'command_as_argument'
6311
6312 The parent @-command has an entry in extra for the I<command_as_argument>
6313 element:
6314
6315 'cmdname' => 'itemize'
6316 'extra => {'command_as_argument' => $command_element_as_argument}
6317
6318 =item index_entry_command
6319
6320 This is the type of index entry command like C<@cindex>, and, more
6321 importantly user-defined index entry commands. So for example if there
6322 is
6323
6324 @defindex foo
6325 ...
6326
6327 @fooindex index entry
6328
6329 the C<@fooindex> @-command element will have the I<index_entry_command>
6330 type.
6331
6332 =item following_arg
6333
6334 This type is set for non-alphabetic accent @-commands that don't use braces
6335 but instead have their argument right after them, as
6336
6337 @~n
6338
6339 =item space_command_arg
6340
6341 This type is set for accent @-commands that don't use brace but instead
6342 have their argument after some space, as
6343
6344 @ringaccent A
6345
6346 =item definfoenclose_command
6347
6348 This type is set for an @-command that is redefined by C<@definfoenclose>.
6349 The beginning is in C<< {'extra'}->{'begin'} >> and the end in
6350 C<< {'extra'}->{'end'} >>.
6351
6352 =back
6353
6354 =head3 Types for text elements
6355
6356 The text elements may have the following types (or may have no type
6357 at all):
6358
6359 =over
6360
6361 =item empty_line
6362
6363 An empty line (possibly containing whitespace characters only).
6364
6365 =item empty_line_after_command
6366
6367 =item empty_spaces_after_command
6368
6369 The text is spaces for I<empty_spaces_after_command>
6370 or spaces followed by a newline for
6371 I<empty_line_after_command>, appearing after an @-command that
6372 takes an argument on the line or a block @-command.
6373
6374 =item empty_spaces_before_argument
6375
6376 The text is spaces appearing after an opening brace or after a
6377 comma separating a command's arguments.
6378
6379 =item spaces_at_end
6380
6381 Space at the end of an argument to a line command, at the end of an
6382 comma-separated argument for some brace commands, or at the end of
6383 bracketed content on a C<@multitable> line or definition line.
6384
6385 =item empty_spaces_after_close_brace
6386
6387 Spaces appearing after a closing brace, for some rare commands for which
6388 this space should be ignorable (like C<@caption>).
6389
6390 =item empty_spaces_before_paragraph
6391
6392 Space appearing before a paragraph beginning.
6393
6394 =item raw
6395
6396 Text in an environment where it should be kept as is (in C<@verbatim>,
6397 C<@verb>, C<@html>, C<@macro> body).
6398
6399 =item last_raw_newline
6400
6401 The last end of line in a raw block (except for C<@verbatim>).
6402
6403 =item preamble_text
6404
6405 Text appearing before real content, including the C<\input texinfo.tex>.
6406
6407 =item space_at_end_menu_node
6408
6409 =item after_description_line
6410
6411 Space after a node in the menu entry, when there is no description,
6412 and space appearing after the description line.
6413
6414 =back
6415
6416 =head3 Types of container elements
6417
6418 The other types of element are the following. These are containers with
6419 other elements appearing in their C<contents>.
6420
6421 =over
6422
6423 =item text_root
6424
6425 =item document_root
6426
6427 =item root_line
6428
6429 These types correspond to document roots. C<text_root> is the document
6430 root when there is no C<@node> or sectioning command. When
6431 such a command appears, a new root container is used, C<document_root>,
6432 and C<text_root> becomes the first element in the contents of C<document_root>.
6433 C<root_line> is the type of the root tree when parsing Texinfo line
6434 fragments using C<parse_texi_line>.
6435
6436 =item preamble
6437
6438 This container holds the text appearing before the first content, including
6439 the C<\input texinfo.tex> line and following blank lines.
6440
6441 =item preamble_before_setfilename
6442
6443 This container holds everything that appears before C<@setfilename>
6444 if I<IGNORE_BEFORE_SETFILENAME> parser option is set.
6445
6446 =item paragraph
6447
6448 A paragraph. The C<contents> of a paragraph (like other container
6449 elements for Texinfo content) are elements representing the contents of
6450 the paragraph in the order they occur, such as simple text elements
6451 without a C<cmdname> or C<type>, or @-command elements for commands
6452 appearing in the paragraph.
6453
6454 =item preformatted
6455
6456 Texinfo code within a format that is not filled. Happens within some
6457 block commands like C<@example>, but also in menu (in menu descriptions,
6458 menu comments...).
6459
6460 =item brace_command_arg
6461
6462 =item brace_command_context
6463
6464 =item line_arg
6465
6466 =item block_line_arg
6467
6468 Those containers occur within the C<args> array of @-commands taking an
6469 argument. I<brace_command_arg> is used for the arguments to commands
6470 taking arguments surrounded by braces (and in some cases separated by
6471 commas). I<brace_command_context> is used for @-commands with braces
6472 that start a new context (C<@footnote>, C<@caption>, C<@math>).
6473
6474 I<line_arg> is used for commands that take the texinfo code on the
6475 rest of the line as their argument (for example (C<@settitle>, C<@node>,
6476 C<@section> and similar). I<block_line_arg> is similar but is used for
6477 commands that start a new block (which is to be ended with C<@end>).
6478
6479 For example
6480
6481 @code{in code}
6482
6483 leads to
6484
6485 {'cmdname' => 'code',
6486 'args' => [{'type' => 'brace_command_arg',
6487 'contents' => [{'text' => 'in code'}]}]}
6488
6489 =item misc_arg
6490
6491 Used for the arguments to some special line commands whose arguments
6492 aren't subject to the usual macro expansion. For example C<@set>,
6493 C<@clickstyle>, C<@unmacro>, C<@comment>. The argument is associated to
6494 the I<text> key.
6495
6496 =item menu_entry
6497
6498 =item menu_entry_leading_text
6499
6500 =item menu_entry_name
6501
6502 =item menu_entry_separator
6503
6504 =item menu_entry_node
6505
6506 =item menu_entry_description
6507
6508 A I<menu_entry> holds a full menu entry, like
6509
6510 * node:: description.
6511
6512 The different elements of the menu entry are directly in the
6513 I<menu_entry> C<args> array reference.
6514
6515 I<menu_entry_leading_text> holds the star and following spaces.
6516 I<menu_entry_name> is the menu entry name (if present), I<menu_entry_node>
6517 corresponds to the node in the menu entry, I<menu_entry_separator> holds
6518 the text after the node and before the description, in most cases
6519 C<:: >. Lastly, I<menu_entry_description> is for the description.
6520
6521 =item menu_comment
6522
6523 The I<menu_comment> container holds what is between menu entries
6524 in menus. For example in
6525
6526 @menu
6527 Menu title
6528
6529 * entry::
6530
6531 Between entries
6532 * other::
6533 @end menu
6534
6535 Both
6536
6537 Menu title
6538
6539 and
6540
6541 Between entries
6542
6543 will be in I<menu_comment>.
6544
6545 =item macro_name
6546
6547 =item macro_arg
6548
6549 Taken from C<@macro> definition and put in the C<args> key array of
6550 the macro, I<macro_name> is the type of the text fragment corresponding
6551 to the macro name, I<macro_arg> is the type of the text fragments
6552 correponding to macro formal arguments.
6553
6554 =item before_item
6555
6556 A container for content before the first C<@item> of block @-commands
6557 with items (C<@table>, C<@multitable>, C<@enumerate>...).
6558
6559 =item table_entry
6560
6561 =item table_term
6562
6563 =item table_item
6564
6565 =item inter_item
6566
6567 Those containers appear in C<@table>, C<@ftable> and C<@vtable>.
6568 A I<table_entry> container contains an entire row of the table.
6569 It contains a I<table_term> container, which holds all the C<@item> and
6570 C<@itemx> lines. This is followed by a I<table_item> container, which
6571 holds the content that is to go into the second column of the table.
6572
6573 If there is any content before an C<@itemx> (normally only comments,
6574 empty lines or maybe index entries are allowed), it will be in
6575 a container with type I<inter_item>.
6576
6577 =item def_line
6578
6579 =item def_item
6580
6581 =item inter_def_item
6582
6583 The I<def_line> type is either associated with a container within a
6584 definition command, or is the type of a definition command with a x
6585 form, like C<@deffnx>. It holds the definition line arguments.
6586 The container with type I<def_item> holds the definition text content.
6587 Content appearing before a definition command with a x form is in
6588 an I<inter_def_item> container.
6589
6590 =item multitable_head
6591
6592 =item multitable_body
6593
6594 =item row
6595
6596 In C<@multitable>, a I<multitable_head> container contains all the rows
6597 with C<@headitem>, while I<multitable_body> contains the rows associated
6598 with C<@item>. A I<row> container contains the C<@item> and @<tab>
6599 forming a row.
6600
6601 =item bracketed
6602
6603 This a special type containing content in brackets in the context
6604 where they are valid, in C<@math>.
6605
6606 =item bracketed_def_content
6607
6608 Content in brackets on definition command lines.
6609
6610 =item def_aggregate
6611
6612 Contains several elements that together are a single unit on a @def* line.
6613
6614 =item bracketed_multitable_prototype
6615
6616 =item row_prototype
6617
6618 On C<@multitable> line, content in brackets is in
6619 I<bracketed_multitable_prototype>, text not in brackets
6620 is in I<row_prototype>.
6621
6622 =back
6623
6624 =head2 Information available in the extra key
6625
6626 =head3 Extra keys available for more than one @-command
6627
6628 =over
6629
6630 =item end_command
6631
6632 The C<@end> associated to the block @-command.
6633
6634 =item missing_argument
6635
6636 Set for some @-commands with line arguments and a missing argument.
6637
6638 =item arg_line
6639
6640 The string correspond to the line after the @-command
6641 for @-commands that have special arguments on their line,
6642 and for C<@macro> line.
6643
6644 =item text_arg
6645
6646 The string correspond to the line after the @-command for @-commands
6647 that have an argument interpreted as simple text, like C<@setfilename>,
6648 C<@end> or C<@documentencoding>.
6649
6650 =item index_entry
6651
6652 The index entry information (described in L</index_entries>
6653 in details) is associated to @-commands that have an associated
6654 index entry.
6655
6656 =item misc_args
6657
6658 An array holding strings, the arguments of @-commands taking simple
6659 textual arguments as arguments, like C<@everyheadingmarks>,
6660 C<@frenchspacing>, C<@alias>, C<@synindex>, C<@columnfractions>.
6661 Also filled for C<@set>, C<@clickstyle>, C<@unmacro> or C<@comment>
6662 arguments.
6663
6664 =item spaces_before_argument
6665
6666 For @-commands with opening brace followed by spaces held in a
6667 C<empty_spaces_before_argument> element, a reference to those spaces.
6668
6669 =item spaces
6670
6671 For accent commands acting on one letter only, like C<@ringaccent>
6672 appearing like
6673
6674 @ringaccent A
6675
6676 there is a I<spaces> key which holds the spaces appearing between
6677 the command and the argument.
6678
6679 =back
6680
6681 =head3 Extra keys specific of certain @-commands or containers
6682
6683 =over
6684
6685 =item C<@macro>
6686
6687 I<invalid_syntax> is set if there was an error on the C<@macro>
6688 line. I<arg_line> holds the line after C<@macro>.
6689
6690 =item C<@node>
6691
6692 The arguments are in the I<nodes_manuals> array. Each
6693 of the entries is a hash with a I<node_content> key for
6694 an array holding the corresponding content, a I<manual_content> key
6695 if there is an associated external manual name, and a I<normalized>
6696 key for the normalized label, built as specified in the Texinfo manual
6697 in the B<HTML Xref> node.
6698
6699 An I<associated_section> key holds the tree element of the
6700 sectioning command that follows the node.
6701
6702 =item C<@part>
6703
6704 The next sectioning command is in I<part_associated_section>.
6705
6706 =item sectioning command
6707
6708 The node preceding the command is in I<associated_node>.
6709 The part preceding the command is in I<associated_part>.
6710 If the level of the document was modified by C<@raisections>
6711 or C<@lowersections>, the differential level is in I<sections_level>.
6712
6713 =item C<@float>
6714
6715 =item C<@listoffloats>
6716
6717 If float has a second argument, and for C<@listoffloats>
6718 argument there is a I<type> key which is also a hash reference,
6719 with two keys. I<content> is an array holding the associated
6720 contents, I<normalized> holds the normalized float type.
6721
6722 I<caption> and I<shortcaption> holds the corresponding
6723 tree elements for float. The C<@caption> or C<@shortcaption>
6724 have the float tree element stored in I<float>.
6725
6726 =item C<@float>
6727
6728 =item C<@anchor>
6729
6730 @-commands that are targets for cross-references have a I<normalized>
6731 key for the normalized label, built as specified in the Texinfo manual
6732 in the B<HTML Xref> node. There is also a I<node_content> key for
6733 an array holding the corresponding content.
6734
6735 C<@anchor> also has I<region> set to the special region name if
6736 in a special region (C<@copying>, C<@titlepage>).
6737
6738 =item C<@ref>
6739
6740 =item C<@xref>
6741
6742 =item C<@pxref>
6743
6744 =item C<@inforef>
6745
6746 The I<node_argument> entry holds a parsed node entry, like
6747 the one appearing in the I<nodes_manuals> array for C<@node>.
6748
6749 =item C<@abbr>
6750
6751 =item C<@acronym>
6752
6753 The first argument normalized is in I<normalized>.
6754
6755 =item definition command
6756
6757 I<def_command> holds the command name, without x if it is
6758 an x form of a definition command.
6759 I<original_def_cmdname> is the original def command.
6760
6761 If it is an x form, it has I<not_after_command> set if not
6762 appearing after the definition command without x.
6763
6764 =item def_line
6765
6766 For each element in a def_line, the key I<def_role> holds a string
6767 describing the meaning of the element. It is one of
6768 I<category>, I<name>, I<class>, I<type>, I<arg>, I<typearg>,
6769 I<spaces> or I<delimiter>, depending on the definition.
6770
6771 The I<def_parsed_hash> hash reference has these strings as keys,
6772 and the values are the corresponding elements.
6773
6774 =item C<@multitable>
6775
6776 The key I<max_columns> holds the maximal number of columns. If there
6777 are prototypes on the line they are in the array associated with
6778 I<prototypes>. If there is a C<@columnfractions> as argument, then the
6779 I<columnfractions> key is associated with the element for the
6780 @columnfractions command.
6781
6782 =item C<@enumerate>
6783
6784 The extra key I<enumerate_specification> contains the enumerate
6785 argument.
6786
6787 =item C<@itemize>
6788
6789 =item C<@table>
6790
6791 =item C<@vtable>
6792
6793 =item C<@ftable>
6794
6795 The I<command_as_argument> extra key points to the @-command on
6796 as argument on the @-command line.
6797
6798 =item paragraph
6799
6800 The I<indent> or I<noindent> key value is set if the corresponding
6801 @-commands are associated with that paragraph.
6802
6803 =item C<@item> in C<@enumerate> or C<@itemize>
6804
6805 The I<item_number> extra key holds the number of this item.
6806
6807 =item C<@item> and C<@tab> in C<@multitable>
6808
6809 The I<cell_number> index key holds the index of the column of
6810 the cell.
6811
6812 =item row
6813
6814 The I<row_number> index key holds the index of the row in
6815 the C<@multitable>.
6816
6817 =item C<@author>
6818
6819 If in a C<@titlepage>, the titlepage is in I<titlepage>, if in
6820 C<@quotation> or C<@smallquotation>, the corresponding tree element
6821 is in I<quotation>.
6822
6823 The author tree element is in the I<author> array of the C<@titlepage>
6824 or the C<@quotation> or C<@smallquotation> it is associated with.
6825
6826 =item C<@ifclear>
6827
6828 =item C<@ifset>
6829
6830 The original line is in I<line>.
6831
6832 =item C<@end>
6833
6834 The textual argument is in I<command_argument>.
6835 The corresponding @-command is in I<command>.
6836
6837 =item C<@documentencoding>
6838
6839 The argument, normalized is in I<input_encoding_name> if it is recognized.
6840 The corresponding perl encoding name is in I<input_perl_encoding>.
6841
6842 =item C<@click>
6843
6844 In I<clickstyle> there is the current clickstyle command.
6845
6846 =item C<@kbd>
6847
6848 I<code> is set depending on the context and C<@kbdinputstyle>.
6849
6850 =item definfoenclose defined commands
6851
6852 I<begin> holds the string beginning the definfoenclose,
6853 I<end> holds the string ending the definfoenclose.
6854
6855 =item menu_entry
6856
6857 The I<menu_entry_description> and I<menu_entry_name> keys
6858 are associated with the corresponding tree elements. The
6859 I<menu_entry_node> value is a hash with information about the parsed
6860 node entry; its keys are the same as those appearing in the
6861 elements of the I<nodes_manuals> array for C<@node>.
6862
6863 =item empty_line_after_command
6864
6865 The corresponding command is in I<command>.
6866
6867 =item C<@inlinefmt>
6868
6869 =item C<@inlineraw>
6870
6871 =item C<@inlinefmtifelse>
6872
6873 =item C<@inlineifclear>
6874
6875 =item C<@inlineifset>
6876
6877 The first argument is in I<format>. If an argument has been determined
6878 as being expanded by the Parser, the index of this argument is in
6879 I<expand_index>. Index numbering begins at 0, but the first argument is
6880 always the format or flag name, so, if set, it should be 1 or 2 for
6881 C<@inlinefmtifelse>, and 1 for other commands.
6882
6883 =back
6884
6885 =head2 Other information set by the parser
6886
6887 The parser creates an array of nodes and stores this in the
6888 I<nodes> key of the parser object.
6889
6890 Each element in the tree corresponding to a node contaning a menu
6891 has a I<menus> key which refers to an array of references to menu
6892 elements occuring in the node.
6893
6894 These are both used by the C<Texinfo::Structuring> module.
6895
6896
6897
6898 =head1 SEE ALSO
6899
6900 L<Texinfo manual|http://www.gnu.org/s/texinfo/manual/texinfo/>
6901
6902 =head1 AUTHOR
6903
6904 Patrice Dumas, E<lt>pertusus@free.frE<gt>
6905
6906 =cut
6464 @EXPORT = qw(
6565 );
6666
67 $VERSION = '6.5.90';
67 $VERSION = '6.5.91';
6868
6969
7070 my %types_to_enter;
00 # Makefile.am for XS modules
11 #
2 # Copyright 2015, 2016, 2017, 2018 Free Software Foundation, Inc.
2 # Copyright 2015-2019 Free Software Foundation, Inc.
33 #
44 # This file is free software; as a special exception the author gives
55 # unlimited permission to copy and/or distribute it, with or without
3535
3636 PERL_INC = $(PERL_CONF_archlibexp)/CORE
3737
38 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap
39
40 EXTRA_DIST+= TestXS.pm fail.pl
38 # note that passing `-typemap parsetexi/typemap' doesn't work as xsubpp
39 # seems to work relative to the subdirectory
40 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap -typemap typemap
4141
4242 .xs.c:
4343 $(XSUBPP) $(XSUBPPARGS) $< > $*.xsc && mv $*.xsc $*.c
44
45 EXTRA_DIST+= TestXS.pm fail.pl typemap
4446
4547 # -------------------------------------------------------
4648
7072 CLEANFILES += MiscXS.c
7173 EXTRA_DIST += MiscXS.xs
7274
73
74 # Override these variables set by configure at the top level, because
75 # the compiler used in this subdirectory might be different.
76 # PERL_EXT_var are user variables, allowing configuring at the top-level
77 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
78
79 CFLAGS = $(PERL_EXT_CFLAGS)
80 CPPFLAGS = $(PERL_EXT_CPPFLAGS)
81 LDFLAGS = $(PERL_EXT_LDFLAGS)
8275
8376 AM_CFLAGS = $(PERL_CONF_ccflags)
8477
112105
113106 # EXTRA_DIST += $(perl_specific_files)
114107
115 ##########################
116 SUBDIRS += parsetexi
108 ########################## parsetexi
117109
110 p=parsetexi
111
112 modulesdir = $(pkgdatadir)/Texinfo/XS/parsetexi
113 dist_modules_DATA = $p/Parsetexi.pm
114
115
116 if HAVE_ICONV
117 xs_LTLIBRARIES += Parsetexi.la
118 endif
119
120 Parsetexi_la_CFLAGS = $(AM_CFLAGS)
121 Parsetexi_la_CFLAGS += -DVERSION=\"$(VERSION)\" "-I$(PERL_INC)"
122
123
124 Parsetexi_la_SOURCES= parsetexi/Parsetexi.c \
125 parsetexi/api.c \
126 parsetexi/api.h \
127 parsetexi/parser.c \
128 parsetexi/parser.h \
129 parsetexi/tree_types.h \
130 parsetexi/element_types.c \
131 parsetexi/element_types.h \
132 parsetexi/commands.c \
133 parsetexi/commands.h \
134 parsetexi/command_ids.h \
135 parsetexi/input.c \
136 parsetexi/input.h \
137 parsetexi/tree.c \
138 parsetexi/tree.h \
139 parsetexi/close.c \
140 parsetexi/text.c \
141 parsetexi/text.h \
142 parsetexi/context_stack.c \
143 parsetexi/context_stack.h \
144 parsetexi/debug.c \
145 parsetexi/convert.c \
146 parsetexi/convert.h \
147 parsetexi/end_line.c \
148 parsetexi/separator.c \
149 parsetexi/multitable.c \
150 parsetexi/indices.c \
151 parsetexi/indices.h \
152 parsetexi/macro.c \
153 parsetexi/macro.h \
154 parsetexi/handle_commands.c \
155 parsetexi/handle_commands.h \
156 parsetexi/def.c \
157 parsetexi/def.h \
158 parsetexi/extra.c \
159 parsetexi/menus.c \
160 parsetexi/labels.c \
161 parsetexi/labels.h \
162 parsetexi/errors.c \
163 parsetexi/errors.h \
164 parsetexi/counter.c \
165 parsetexi/counter.h
166 EXTRA_DIST += $p/command_data.c
167
168 Parsetexi_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
169 Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBICONV)
170
171 BUILT_SOURCES=parsetexi/element_types.c \
172 parsetexi/element_types.h \
173 parsetexi/command_data.c \
174 parsetexi/command_ids.h
175
176 # Need to be distributed
177 EXTRA_DIST+=$p/element_types.txt $p/element_types.awk \
178 $p/command_data.txt $p/command_data.awk
179
180 # For reference
181 EXTRA_DIST+=$p/Common.pm $p/Parser-5556.pm
182
183 EXTRA_DIST+=$p/complete_tree.pl
184
185 # Notes
186 EXTRA_DIST+=$p/debug_perl.txt $p/makeinfo-debug.txt
187
188 $(srcdir)/$p/element_types.c $(srcdir)/$p/element_types.h: $p/element_types.txt $p/element_types.awk
189 awk -v srcdir=$(srcdir)/$p -f $(srcdir)/$p/element_types.awk \
190 $(srcdir)/$p/element_types.txt
191
192 $(srcdir)/$p/command_data.c $(srcdir)/$p/command_ids.h: $p/command_data.txt $p/command_data.awk
193 awk -v srcdir=$(srcdir)/$p -f $(srcdir)/$p/command_data.awk \
194 $(srcdir)/$p/command_data.txt
195
0 # Makefile.in generated by automake 1.15 from Makefile.am.
0 # Makefile.in generated by automake 1.16 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1212 # PARTICULAR PURPOSE.
1313
1414 @SET_MAKE@
15
1516
1617 VPATH = @srcdir@
1718 am__is_gnu_make = { \
8788 POST_UNINSTALL = :
8889 build_triplet = @build@
8990 host_triplet = @host@
91 @HAVE_ICONV_TRUE@am__append_1 = Parsetexi.la
9092 subdir = .
9193 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
9294 am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/00gnulib.m4 \
143145 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
144146 $(ACLOCAL_M4)
145147 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
146 $(am__configure_deps) $(am__DIST_COMMON)
148 $(am__configure_deps) $(dist_modules_DATA) $(am__DIST_COMMON)
147149 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
148150 configure.lineno config.status.lineno
149151 mkinstalldirs = $(install_sh) -d
177179 || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
178180 $(am__cd) "$$dir" && rm -f $$files; }; \
179181 }
180 am__installdirs = "$(DESTDIR)$(xsdir)"
182 am__installdirs = "$(DESTDIR)$(xsdir)" "$(DESTDIR)$(modulesdir)"
181183 LTLIBRARIES = $(xs_LTLIBRARIES)
182184 MiscXS_la_LIBADD =
183185 am_MiscXS_la_OBJECTS = MiscXS_la-MiscXS.lo MiscXS_la-misc.lo
189191 MiscXS_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
190192 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(MiscXS_la_CFLAGS) \
191193 $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
194 Parsetexi_la_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.la
195 am__dirstamp = $(am__leading_dot)dirstamp
196 am_Parsetexi_la_OBJECTS = parsetexi/Parsetexi_la-Parsetexi.lo \
197 parsetexi/Parsetexi_la-api.lo parsetexi/Parsetexi_la-parser.lo \
198 parsetexi/Parsetexi_la-element_types.lo \
199 parsetexi/Parsetexi_la-commands.lo \
200 parsetexi/Parsetexi_la-input.lo parsetexi/Parsetexi_la-tree.lo \
201 parsetexi/Parsetexi_la-close.lo parsetexi/Parsetexi_la-text.lo \
202 parsetexi/Parsetexi_la-context_stack.lo \
203 parsetexi/Parsetexi_la-debug.lo \
204 parsetexi/Parsetexi_la-convert.lo \
205 parsetexi/Parsetexi_la-end_line.lo \
206 parsetexi/Parsetexi_la-separator.lo \
207 parsetexi/Parsetexi_la-multitable.lo \
208 parsetexi/Parsetexi_la-indices.lo \
209 parsetexi/Parsetexi_la-macro.lo \
210 parsetexi/Parsetexi_la-handle_commands.lo \
211 parsetexi/Parsetexi_la-def.lo parsetexi/Parsetexi_la-extra.lo \
212 parsetexi/Parsetexi_la-menus.lo \
213 parsetexi/Parsetexi_la-labels.lo \
214 parsetexi/Parsetexi_la-errors.lo \
215 parsetexi/Parsetexi_la-counter.lo
216 Parsetexi_la_OBJECTS = $(am_Parsetexi_la_OBJECTS)
217 Parsetexi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
218 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(Parsetexi_la_CFLAGS) \
219 $(CFLAGS) $(Parsetexi_la_LDFLAGS) $(LDFLAGS) -o $@
220 @HAVE_ICONV_TRUE@am_Parsetexi_la_rpath = -rpath $(xsdir)
192221 TestXS_la_LIBADD =
193222 am_TestXS_la_OBJECTS = TestXS_la-TestXS.lo
194223 TestXS_la_OBJECTS = $(am_TestXS_la_OBJECTS)
219248 am__v_at_1 =
220249 DEFAULT_INCLUDES = -I.@am__isrc@
221250 depcomp = $(SHELL) $(top_srcdir)/depcomp
222 am__depfiles_maybe = depfiles
251 am__maybe_remake_depfiles = depfiles
252 am__depfiles_remade = ./$(DEPDIR)/MiscXS_la-MiscXS.Plo \
253 ./$(DEPDIR)/MiscXS_la-misc.Plo \
254 ./$(DEPDIR)/TestXS_la-TestXS.Plo \
255 ./$(DEPDIR)/XSParagraph_la-XSParagraph.Plo \
256 ./$(DEPDIR)/XSParagraph_la-text.Plo \
257 ./$(DEPDIR)/XSParagraph_la-xspara.Plo \
258 parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Plo \
259 parsetexi/$(DEPDIR)/Parsetexi_la-api.Plo \
260 parsetexi/$(DEPDIR)/Parsetexi_la-close.Plo \
261 parsetexi/$(DEPDIR)/Parsetexi_la-commands.Plo \
262 parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Plo \
263 parsetexi/$(DEPDIR)/Parsetexi_la-convert.Plo \
264 parsetexi/$(DEPDIR)/Parsetexi_la-counter.Plo \
265 parsetexi/$(DEPDIR)/Parsetexi_la-debug.Plo \
266 parsetexi/$(DEPDIR)/Parsetexi_la-def.Plo \
267 parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Plo \
268 parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Plo \
269 parsetexi/$(DEPDIR)/Parsetexi_la-errors.Plo \
270 parsetexi/$(DEPDIR)/Parsetexi_la-extra.Plo \
271 parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Plo \
272 parsetexi/$(DEPDIR)/Parsetexi_la-indices.Plo \
273 parsetexi/$(DEPDIR)/Parsetexi_la-input.Plo \
274 parsetexi/$(DEPDIR)/Parsetexi_la-labels.Plo \
275 parsetexi/$(DEPDIR)/Parsetexi_la-macro.Plo \
276 parsetexi/$(DEPDIR)/Parsetexi_la-menus.Plo \
277 parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Plo \
278 parsetexi/$(DEPDIR)/Parsetexi_la-parser.Plo \
279 parsetexi/$(DEPDIR)/Parsetexi_la-separator.Plo \
280 parsetexi/$(DEPDIR)/Parsetexi_la-text.Plo \
281 parsetexi/$(DEPDIR)/Parsetexi_la-tree.Plo
223282 am__mv = mv -f
224283 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
225284 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
239298 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
240299 am__v_CCLD_0 = @echo " CCLD " $@;
241300 am__v_CCLD_1 =
242 SOURCES = $(MiscXS_la_SOURCES) $(TestXS_la_SOURCES) \
243 $(XSParagraph_la_SOURCES)
244 DIST_SOURCES = $(MiscXS_la_SOURCES) $(TestXS_la_SOURCES) \
245 $(XSParagraph_la_SOURCES)
301 SOURCES = $(MiscXS_la_SOURCES) $(Parsetexi_la_SOURCES) \
302 $(TestXS_la_SOURCES) $(XSParagraph_la_SOURCES)
303 DIST_SOURCES = $(MiscXS_la_SOURCES) $(Parsetexi_la_SOURCES) \
304 $(TestXS_la_SOURCES) $(XSParagraph_la_SOURCES)
246305 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
247306 ctags-recursive dvi-recursive html-recursive info-recursive \
248307 install-data-recursive install-dvi-recursive \
256315 n|no|NO) false;; \
257316 *) (install-info --version) >/dev/null 2>&1;; \
258317 esac
318 DATA = $(dist_modules_DATA)
259319 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
260320 distclean-recursive maintainer-clean-recursive
261321 am__recursive_targets = \
263323 $(RECURSIVE_CLEAN_TARGETS) \
264324 $(am__extra_recursive_targets)
265325 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
266 cscope distdir dist dist-all distcheck
326 cscope distdir distdir-am dist dist-all distcheck
267327 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
268328 $(LISP)config.in
269329 # Read a list of newline-separated strings from the standard input,
350410 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
351411 CC = @CC@
352412 CCDEPMODE = @CCDEPMODE@
353
354 # Override these variables set by configure at the top level, because
355 # the compiler used in this subdirectory might be different.
356 # PERL_EXT_var are user variables, allowing configuring at the top-level
357 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
358 CFLAGS = $(PERL_EXT_CFLAGS)
413 CFLAGS = @CFLAGS@
359414 CPP = @CPP@
360 CPPFLAGS = $(PERL_EXT_CPPFLAGS)
415 CPPFLAGS = @CPPFLAGS@
361416 CYGPATH_W = @CYGPATH_W@
362417 DEFS = @DEFS@
363418 DEPDIR = @DEPDIR@
614669 INSTALL_SCRIPT = @INSTALL_SCRIPT@
615670 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
616671 LD = @LD@
617 LDFLAGS = $(PERL_EXT_LDFLAGS)
672 LDFLAGS = @LDFLAGS@
618673 LIBICONV = @LIBICONV@
619674 LIBOBJS = @LIBOBJS@
620675 LIBS = @LIBS@
814869
815870 # Makefile.am for XS modules
816871 #
817 # Copyright 2015, 2016, 2017, 2018 Free Software Foundation, Inc.
872 # Copyright 2015-2019 Free Software Foundation, Inc.
818873 #
819874 # This file is free software; as a special exception the author gives
820875 # unlimited permission to copy and/or distribute it, with or without
825880 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
826881 #
827882 AUTOMAKE_OPTIONS = foreign subdir-objects
828 EXTRA_DIST = gnulib/m4/gnulib-cache.m4 TestXS.pm fail.pl TestXS.xs \
829 XSParagraph.xs MiscXS.xs
883
884 # Need to be distributed
885
886 # For reference
887
888 # Notes
889 EXTRA_DIST = gnulib/m4/gnulib-cache.m4 TestXS.pm fail.pl typemap \
890 TestXS.xs XSParagraph.xs MiscXS.xs $p/command_data.c \
891 $p/element_types.txt $p/element_types.awk $p/command_data.txt \
892 $p/command_data.awk $p/Common.pm $p/Parser-5556.pm \
893 $p/complete_tree.pl $p/debug_perl.txt $p/makeinfo-debug.txt
830894
831895 ######################## Gnulib ################################
832896 AM_CPPFLAGS = \
838902 $(TERMLIBS) $(LIBINTL) $(LIBICONV)
839903
840904 ACLOCAL_AMFLAGS = -I gnulib/m4
841
842 # EXTRA_DIST += $(perl_specific_files)
843
844 ##########################
845 SUBDIRS = gnulib/lib parsetexi
905 SUBDIRS = gnulib/lib
846906
847907 ################### End Gnulib section #########################
848908 xsdir = $(pkglibdir)
849909 PERL_INC = $(PERL_CONF_archlibexp)/CORE
850 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap
910
911 # note that passing `-typemap parsetexi/typemap' doesn't work as xsubpp
912 # seems to work relative to the subdirectory
913 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap -typemap typemap
851914
852915 # -------------------------------------------------------
853916 CLEANFILES = TestXS.c XSParagraph.c MiscXS.c
854 xs_LTLIBRARIES = XSParagraph.la TestXS.la MiscXS.la
917 xs_LTLIBRARIES = XSParagraph.la TestXS.la MiscXS.la $(am__append_1)
855918 XSParagraph_la_SOURCES = XSParagraph.c xspara.c xspara.h \
856919 text.c text.h ppport.h
857920
876939 MANIFEST \
877940 prepare_standalone_perl_module.sh
878941
879 all: config.h
942
943 # EXTRA_DIST += $(perl_specific_files)
944
945 ########################## parsetexi
946 p = parsetexi
947 modulesdir = $(pkgdatadir)/Texinfo/XS/parsetexi
948 dist_modules_DATA = $p/Parsetexi.pm
949 Parsetexi_la_CFLAGS = $(AM_CFLAGS) -DVERSION=\"$(VERSION)\" \
950 "-I$(PERL_INC)"
951 Parsetexi_la_SOURCES = parsetexi/Parsetexi.c \
952 parsetexi/api.c \
953 parsetexi/api.h \
954 parsetexi/parser.c \
955 parsetexi/parser.h \
956 parsetexi/tree_types.h \
957 parsetexi/element_types.c \
958 parsetexi/element_types.h \
959 parsetexi/commands.c \
960 parsetexi/commands.h \
961 parsetexi/command_ids.h \
962 parsetexi/input.c \
963 parsetexi/input.h \
964 parsetexi/tree.c \
965 parsetexi/tree.h \
966 parsetexi/close.c \
967 parsetexi/text.c \
968 parsetexi/text.h \
969 parsetexi/context_stack.c \
970 parsetexi/context_stack.h \
971 parsetexi/debug.c \
972 parsetexi/convert.c \
973 parsetexi/convert.h \
974 parsetexi/end_line.c \
975 parsetexi/separator.c \
976 parsetexi/multitable.c \
977 parsetexi/indices.c \
978 parsetexi/indices.h \
979 parsetexi/macro.c \
980 parsetexi/macro.h \
981 parsetexi/handle_commands.c \
982 parsetexi/handle_commands.h \
983 parsetexi/def.c \
984 parsetexi/def.h \
985 parsetexi/extra.c \
986 parsetexi/menus.c \
987 parsetexi/labels.c \
988 parsetexi/labels.h \
989 parsetexi/errors.c \
990 parsetexi/errors.h \
991 parsetexi/counter.c \
992 parsetexi/counter.h
993
994 Parsetexi_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
995 Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBICONV)
996 BUILT_SOURCES = parsetexi/element_types.c \
997 parsetexi/element_types.h \
998 parsetexi/command_data.c \
999 parsetexi/command_ids.h
1000
1001 all: $(BUILT_SOURCES) config.h
8801002 $(MAKE) $(AM_MAKEFLAGS) all-recursive
8811003
8821004 .SUFFIXES:
9021024 echo ' $(SHELL) ./config.status'; \
9031025 $(SHELL) ./config.status;; \
9041026 *) \
905 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
906 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
1027 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
1028 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
9071029 esac;
9081030
9091031 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
9671089
9681090 MiscXS.la: $(MiscXS_la_OBJECTS) $(MiscXS_la_DEPENDENCIES) $(EXTRA_MiscXS_la_DEPENDENCIES)
9691091 $(AM_V_CCLD)$(MiscXS_la_LINK) -rpath $(xsdir) $(MiscXS_la_OBJECTS) $(MiscXS_la_LIBADD) $(LIBS)
1092 parsetexi/$(am__dirstamp):
1093 @$(MKDIR_P) parsetexi
1094 @: > parsetexi/$(am__dirstamp)
1095 parsetexi/$(DEPDIR)/$(am__dirstamp):
1096 @$(MKDIR_P) parsetexi/$(DEPDIR)
1097 @: > parsetexi/$(DEPDIR)/$(am__dirstamp)
1098 parsetexi/Parsetexi_la-Parsetexi.lo: parsetexi/$(am__dirstamp) \
1099 parsetexi/$(DEPDIR)/$(am__dirstamp)
1100 parsetexi/Parsetexi_la-api.lo: parsetexi/$(am__dirstamp) \
1101 parsetexi/$(DEPDIR)/$(am__dirstamp)
1102 parsetexi/Parsetexi_la-parser.lo: parsetexi/$(am__dirstamp) \
1103 parsetexi/$(DEPDIR)/$(am__dirstamp)
1104 parsetexi/Parsetexi_la-element_types.lo: parsetexi/$(am__dirstamp) \
1105 parsetexi/$(DEPDIR)/$(am__dirstamp)
1106 parsetexi/Parsetexi_la-commands.lo: parsetexi/$(am__dirstamp) \
1107 parsetexi/$(DEPDIR)/$(am__dirstamp)
1108 parsetexi/Parsetexi_la-input.lo: parsetexi/$(am__dirstamp) \
1109 parsetexi/$(DEPDIR)/$(am__dirstamp)
1110 parsetexi/Parsetexi_la-tree.lo: parsetexi/$(am__dirstamp) \
1111 parsetexi/$(DEPDIR)/$(am__dirstamp)
1112 parsetexi/Parsetexi_la-close.lo: parsetexi/$(am__dirstamp) \
1113 parsetexi/$(DEPDIR)/$(am__dirstamp)
1114 parsetexi/Parsetexi_la-text.lo: parsetexi/$(am__dirstamp) \
1115 parsetexi/$(DEPDIR)/$(am__dirstamp)
1116 parsetexi/Parsetexi_la-context_stack.lo: parsetexi/$(am__dirstamp) \
1117 parsetexi/$(DEPDIR)/$(am__dirstamp)
1118 parsetexi/Parsetexi_la-debug.lo: parsetexi/$(am__dirstamp) \
1119 parsetexi/$(DEPDIR)/$(am__dirstamp)
1120 parsetexi/Parsetexi_la-convert.lo: parsetexi/$(am__dirstamp) \
1121 parsetexi/$(DEPDIR)/$(am__dirstamp)
1122 parsetexi/Parsetexi_la-end_line.lo: parsetexi/$(am__dirstamp) \
1123 parsetexi/$(DEPDIR)/$(am__dirstamp)
1124 parsetexi/Parsetexi_la-separator.lo: parsetexi/$(am__dirstamp) \
1125 parsetexi/$(DEPDIR)/$(am__dirstamp)
1126 parsetexi/Parsetexi_la-multitable.lo: parsetexi/$(am__dirstamp) \
1127 parsetexi/$(DEPDIR)/$(am__dirstamp)
1128 parsetexi/Parsetexi_la-indices.lo: parsetexi/$(am__dirstamp) \
1129 parsetexi/$(DEPDIR)/$(am__dirstamp)
1130 parsetexi/Parsetexi_la-macro.lo: parsetexi/$(am__dirstamp) \
1131 parsetexi/$(DEPDIR)/$(am__dirstamp)
1132 parsetexi/Parsetexi_la-handle_commands.lo: parsetexi/$(am__dirstamp) \
1133 parsetexi/$(DEPDIR)/$(am__dirstamp)
1134 parsetexi/Parsetexi_la-def.lo: parsetexi/$(am__dirstamp) \
1135 parsetexi/$(DEPDIR)/$(am__dirstamp)
1136 parsetexi/Parsetexi_la-extra.lo: parsetexi/$(am__dirstamp) \
1137 parsetexi/$(DEPDIR)/$(am__dirstamp)
1138 parsetexi/Parsetexi_la-menus.lo: parsetexi/$(am__dirstamp) \
1139 parsetexi/$(DEPDIR)/$(am__dirstamp)
1140 parsetexi/Parsetexi_la-labels.lo: parsetexi/$(am__dirstamp) \
1141 parsetexi/$(DEPDIR)/$(am__dirstamp)
1142 parsetexi/Parsetexi_la-errors.lo: parsetexi/$(am__dirstamp) \
1143 parsetexi/$(DEPDIR)/$(am__dirstamp)
1144 parsetexi/Parsetexi_la-counter.lo: parsetexi/$(am__dirstamp) \
1145 parsetexi/$(DEPDIR)/$(am__dirstamp)
1146
1147 Parsetexi.la: $(Parsetexi_la_OBJECTS) $(Parsetexi_la_DEPENDENCIES) $(EXTRA_Parsetexi_la_DEPENDENCIES)
1148 $(AM_V_CCLD)$(Parsetexi_la_LINK) $(am_Parsetexi_la_rpath) $(Parsetexi_la_OBJECTS) $(Parsetexi_la_LIBADD) $(LIBS)
9701149
9711150 TestXS.la: $(TestXS_la_OBJECTS) $(TestXS_la_DEPENDENCIES) $(EXTRA_TestXS_la_DEPENDENCIES)
9721151 $(AM_V_CCLD)$(TestXS_la_LINK) -rpath $(xsdir) $(TestXS_la_OBJECTS) $(TestXS_la_LIBADD) $(LIBS)
9761155
9771156 mostlyclean-compile:
9781157 -rm -f *.$(OBJEXT)
1158 -rm -f parsetexi/*.$(OBJEXT)
1159 -rm -f parsetexi/*.lo
9791160
9801161 distclean-compile:
9811162 -rm -f *.tab.c
9821163
983 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MiscXS_la-MiscXS.Plo@am__quote@
984 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MiscXS_la-misc.Plo@am__quote@
985 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestXS_la-TestXS.Plo@am__quote@
986 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-XSParagraph.Plo@am__quote@
987 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-text.Plo@am__quote@
988 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-xspara.Plo@am__quote@
1164 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MiscXS_la-MiscXS.Plo@am__quote@ # am--include-marker
1165 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MiscXS_la-misc.Plo@am__quote@ # am--include-marker
1166 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestXS_la-TestXS.Plo@am__quote@ # am--include-marker
1167 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-XSParagraph.Plo@am__quote@ # am--include-marker
1168 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-text.Plo@am__quote@ # am--include-marker
1169 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSParagraph_la-xspara.Plo@am__quote@ # am--include-marker
1170 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Plo@am__quote@ # am--include-marker
1171 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-api.Plo@am__quote@ # am--include-marker
1172 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-close.Plo@am__quote@ # am--include-marker
1173 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-commands.Plo@am__quote@ # am--include-marker
1174 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Plo@am__quote@ # am--include-marker
1175 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-convert.Plo@am__quote@ # am--include-marker
1176 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-counter.Plo@am__quote@ # am--include-marker
1177 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-debug.Plo@am__quote@ # am--include-marker
1178 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-def.Plo@am__quote@ # am--include-marker
1179 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Plo@am__quote@ # am--include-marker
1180 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Plo@am__quote@ # am--include-marker
1181 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-errors.Plo@am__quote@ # am--include-marker
1182 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-extra.Plo@am__quote@ # am--include-marker
1183 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Plo@am__quote@ # am--include-marker
1184 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-indices.Plo@am__quote@ # am--include-marker
1185 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-input.Plo@am__quote@ # am--include-marker
1186 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-labels.Plo@am__quote@ # am--include-marker
1187 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-macro.Plo@am__quote@ # am--include-marker
1188 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-menus.Plo@am__quote@ # am--include-marker
1189 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Plo@am__quote@ # am--include-marker
1190 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-parser.Plo@am__quote@ # am--include-marker
1191 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-separator.Plo@am__quote@ # am--include-marker
1192 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-text.Plo@am__quote@ # am--include-marker
1193 @AMDEP_TRUE@@am__include@ @am__quote@parsetexi/$(DEPDIR)/Parsetexi_la-tree.Plo@am__quote@ # am--include-marker
1194
1195 $(am__depfiles_remade):
1196 @$(MKDIR_P) $(@D)
1197 @echo '# dummy' >$@-t && $(am__mv) $@-t $@
1198
1199 am--depfiles: $(am__depfiles_remade)
9891200
9901201 .c.o:
9911202 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
10251236 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
10261237 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(MiscXS_la_CFLAGS) $(CFLAGS) -c -o MiscXS_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
10271238
1239 parsetexi/Parsetexi_la-Parsetexi.lo: parsetexi/Parsetexi.c
1240 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-Parsetexi.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Tpo -c -o parsetexi/Parsetexi_la-Parsetexi.lo `test -f 'parsetexi/Parsetexi.c' || echo '$(srcdir)/'`parsetexi/Parsetexi.c
1241 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Plo
1242 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/Parsetexi.c' object='parsetexi/Parsetexi_la-Parsetexi.lo' libtool=yes @AMDEPBACKSLASH@
1243 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1244 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-Parsetexi.lo `test -f 'parsetexi/Parsetexi.c' || echo '$(srcdir)/'`parsetexi/Parsetexi.c
1245
1246 parsetexi/Parsetexi_la-api.lo: parsetexi/api.c
1247 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-api.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-api.Tpo -c -o parsetexi/Parsetexi_la-api.lo `test -f 'parsetexi/api.c' || echo '$(srcdir)/'`parsetexi/api.c
1248 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-api.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-api.Plo
1249 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/api.c' object='parsetexi/Parsetexi_la-api.lo' libtool=yes @AMDEPBACKSLASH@
1250 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1251 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-api.lo `test -f 'parsetexi/api.c' || echo '$(srcdir)/'`parsetexi/api.c
1252
1253 parsetexi/Parsetexi_la-parser.lo: parsetexi/parser.c
1254 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-parser.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-parser.Tpo -c -o parsetexi/Parsetexi_la-parser.lo `test -f 'parsetexi/parser.c' || echo '$(srcdir)/'`parsetexi/parser.c
1255 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-parser.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-parser.Plo
1256 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/parser.c' object='parsetexi/Parsetexi_la-parser.lo' libtool=yes @AMDEPBACKSLASH@
1257 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1258 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-parser.lo `test -f 'parsetexi/parser.c' || echo '$(srcdir)/'`parsetexi/parser.c
1259
1260 parsetexi/Parsetexi_la-element_types.lo: parsetexi/element_types.c
1261 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-element_types.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Tpo -c -o parsetexi/Parsetexi_la-element_types.lo `test -f 'parsetexi/element_types.c' || echo '$(srcdir)/'`parsetexi/element_types.c
1262 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Plo
1263 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/element_types.c' object='parsetexi/Parsetexi_la-element_types.lo' libtool=yes @AMDEPBACKSLASH@
1264 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1265 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-element_types.lo `test -f 'parsetexi/element_types.c' || echo '$(srcdir)/'`parsetexi/element_types.c
1266
1267 parsetexi/Parsetexi_la-commands.lo: parsetexi/commands.c
1268 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-commands.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-commands.Tpo -c -o parsetexi/Parsetexi_la-commands.lo `test -f 'parsetexi/commands.c' || echo '$(srcdir)/'`parsetexi/commands.c
1269 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-commands.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-commands.Plo
1270 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/commands.c' object='parsetexi/Parsetexi_la-commands.lo' libtool=yes @AMDEPBACKSLASH@
1271 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1272 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-commands.lo `test -f 'parsetexi/commands.c' || echo '$(srcdir)/'`parsetexi/commands.c
1273
1274 parsetexi/Parsetexi_la-input.lo: parsetexi/input.c
1275 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-input.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-input.Tpo -c -o parsetexi/Parsetexi_la-input.lo `test -f 'parsetexi/input.c' || echo '$(srcdir)/'`parsetexi/input.c
1276 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-input.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-input.Plo
1277 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/input.c' object='parsetexi/Parsetexi_la-input.lo' libtool=yes @AMDEPBACKSLASH@
1278 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1279 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-input.lo `test -f 'parsetexi/input.c' || echo '$(srcdir)/'`parsetexi/input.c
1280
1281 parsetexi/Parsetexi_la-tree.lo: parsetexi/tree.c
1282 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-tree.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-tree.Tpo -c -o parsetexi/Parsetexi_la-tree.lo `test -f 'parsetexi/tree.c' || echo '$(srcdir)/'`parsetexi/tree.c
1283 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-tree.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-tree.Plo
1284 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/tree.c' object='parsetexi/Parsetexi_la-tree.lo' libtool=yes @AMDEPBACKSLASH@
1285 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1286 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-tree.lo `test -f 'parsetexi/tree.c' || echo '$(srcdir)/'`parsetexi/tree.c
1287
1288 parsetexi/Parsetexi_la-close.lo: parsetexi/close.c
1289 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-close.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-close.Tpo -c -o parsetexi/Parsetexi_la-close.lo `test -f 'parsetexi/close.c' || echo '$(srcdir)/'`parsetexi/close.c
1290 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-close.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-close.Plo
1291 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/close.c' object='parsetexi/Parsetexi_la-close.lo' libtool=yes @AMDEPBACKSLASH@
1292 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1293 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-close.lo `test -f 'parsetexi/close.c' || echo '$(srcdir)/'`parsetexi/close.c
1294
1295 parsetexi/Parsetexi_la-text.lo: parsetexi/text.c
1296 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-text.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-text.Tpo -c -o parsetexi/Parsetexi_la-text.lo `test -f 'parsetexi/text.c' || echo '$(srcdir)/'`parsetexi/text.c
1297 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-text.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-text.Plo
1298 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/text.c' object='parsetexi/Parsetexi_la-text.lo' libtool=yes @AMDEPBACKSLASH@
1299 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1300 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-text.lo `test -f 'parsetexi/text.c' || echo '$(srcdir)/'`parsetexi/text.c
1301
1302 parsetexi/Parsetexi_la-context_stack.lo: parsetexi/context_stack.c
1303 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-context_stack.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Tpo -c -o parsetexi/Parsetexi_la-context_stack.lo `test -f 'parsetexi/context_stack.c' || echo '$(srcdir)/'`parsetexi/context_stack.c
1304 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Plo
1305 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/context_stack.c' object='parsetexi/Parsetexi_la-context_stack.lo' libtool=yes @AMDEPBACKSLASH@
1306 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1307 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-context_stack.lo `test -f 'parsetexi/context_stack.c' || echo '$(srcdir)/'`parsetexi/context_stack.c
1308
1309 parsetexi/Parsetexi_la-debug.lo: parsetexi/debug.c
1310 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-debug.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-debug.Tpo -c -o parsetexi/Parsetexi_la-debug.lo `test -f 'parsetexi/debug.c' || echo '$(srcdir)/'`parsetexi/debug.c
1311 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-debug.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-debug.Plo
1312 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/debug.c' object='parsetexi/Parsetexi_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
1313 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1314 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-debug.lo `test -f 'parsetexi/debug.c' || echo '$(srcdir)/'`parsetexi/debug.c
1315
1316 parsetexi/Parsetexi_la-convert.lo: parsetexi/convert.c
1317 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-convert.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-convert.Tpo -c -o parsetexi/Parsetexi_la-convert.lo `test -f 'parsetexi/convert.c' || echo '$(srcdir)/'`parsetexi/convert.c
1318 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-convert.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-convert.Plo
1319 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/convert.c' object='parsetexi/Parsetexi_la-convert.lo' libtool=yes @AMDEPBACKSLASH@
1320 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1321 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-convert.lo `test -f 'parsetexi/convert.c' || echo '$(srcdir)/'`parsetexi/convert.c
1322
1323 parsetexi/Parsetexi_la-end_line.lo: parsetexi/end_line.c
1324 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-end_line.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Tpo -c -o parsetexi/Parsetexi_la-end_line.lo `test -f 'parsetexi/end_line.c' || echo '$(srcdir)/'`parsetexi/end_line.c
1325 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Plo
1326 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/end_line.c' object='parsetexi/Parsetexi_la-end_line.lo' libtool=yes @AMDEPBACKSLASH@
1327 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1328 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-end_line.lo `test -f 'parsetexi/end_line.c' || echo '$(srcdir)/'`parsetexi/end_line.c
1329
1330 parsetexi/Parsetexi_la-separator.lo: parsetexi/separator.c
1331 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-separator.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-separator.Tpo -c -o parsetexi/Parsetexi_la-separator.lo `test -f 'parsetexi/separator.c' || echo '$(srcdir)/'`parsetexi/separator.c
1332 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-separator.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-separator.Plo
1333 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/separator.c' object='parsetexi/Parsetexi_la-separator.lo' libtool=yes @AMDEPBACKSLASH@
1334 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1335 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-separator.lo `test -f 'parsetexi/separator.c' || echo '$(srcdir)/'`parsetexi/separator.c
1336
1337 parsetexi/Parsetexi_la-multitable.lo: parsetexi/multitable.c
1338 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-multitable.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Tpo -c -o parsetexi/Parsetexi_la-multitable.lo `test -f 'parsetexi/multitable.c' || echo '$(srcdir)/'`parsetexi/multitable.c
1339 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Plo
1340 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/multitable.c' object='parsetexi/Parsetexi_la-multitable.lo' libtool=yes @AMDEPBACKSLASH@
1341 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1342 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-multitable.lo `test -f 'parsetexi/multitable.c' || echo '$(srcdir)/'`parsetexi/multitable.c
1343
1344 parsetexi/Parsetexi_la-indices.lo: parsetexi/indices.c
1345 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-indices.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-indices.Tpo -c -o parsetexi/Parsetexi_la-indices.lo `test -f 'parsetexi/indices.c' || echo '$(srcdir)/'`parsetexi/indices.c
1346 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-indices.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-indices.Plo
1347 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/indices.c' object='parsetexi/Parsetexi_la-indices.lo' libtool=yes @AMDEPBACKSLASH@
1348 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1349 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-indices.lo `test -f 'parsetexi/indices.c' || echo '$(srcdir)/'`parsetexi/indices.c
1350
1351 parsetexi/Parsetexi_la-macro.lo: parsetexi/macro.c
1352 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-macro.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-macro.Tpo -c -o parsetexi/Parsetexi_la-macro.lo `test -f 'parsetexi/macro.c' || echo '$(srcdir)/'`parsetexi/macro.c
1353 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-macro.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-macro.Plo
1354 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/macro.c' object='parsetexi/Parsetexi_la-macro.lo' libtool=yes @AMDEPBACKSLASH@
1355 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1356 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-macro.lo `test -f 'parsetexi/macro.c' || echo '$(srcdir)/'`parsetexi/macro.c
1357
1358 parsetexi/Parsetexi_la-handle_commands.lo: parsetexi/handle_commands.c
1359 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-handle_commands.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Tpo -c -o parsetexi/Parsetexi_la-handle_commands.lo `test -f 'parsetexi/handle_commands.c' || echo '$(srcdir)/'`parsetexi/handle_commands.c
1360 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Plo
1361 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/handle_commands.c' object='parsetexi/Parsetexi_la-handle_commands.lo' libtool=yes @AMDEPBACKSLASH@
1362 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1363 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-handle_commands.lo `test -f 'parsetexi/handle_commands.c' || echo '$(srcdir)/'`parsetexi/handle_commands.c
1364
1365 parsetexi/Parsetexi_la-def.lo: parsetexi/def.c
1366 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-def.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-def.Tpo -c -o parsetexi/Parsetexi_la-def.lo `test -f 'parsetexi/def.c' || echo '$(srcdir)/'`parsetexi/def.c
1367 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-def.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-def.Plo
1368 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/def.c' object='parsetexi/Parsetexi_la-def.lo' libtool=yes @AMDEPBACKSLASH@
1369 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1370 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-def.lo `test -f 'parsetexi/def.c' || echo '$(srcdir)/'`parsetexi/def.c
1371
1372 parsetexi/Parsetexi_la-extra.lo: parsetexi/extra.c
1373 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-extra.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-extra.Tpo -c -o parsetexi/Parsetexi_la-extra.lo `test -f 'parsetexi/extra.c' || echo '$(srcdir)/'`parsetexi/extra.c
1374 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-extra.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-extra.Plo
1375 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/extra.c' object='parsetexi/Parsetexi_la-extra.lo' libtool=yes @AMDEPBACKSLASH@
1376 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1377 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-extra.lo `test -f 'parsetexi/extra.c' || echo '$(srcdir)/'`parsetexi/extra.c
1378
1379 parsetexi/Parsetexi_la-menus.lo: parsetexi/menus.c
1380 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-menus.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-menus.Tpo -c -o parsetexi/Parsetexi_la-menus.lo `test -f 'parsetexi/menus.c' || echo '$(srcdir)/'`parsetexi/menus.c
1381 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-menus.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-menus.Plo
1382 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/menus.c' object='parsetexi/Parsetexi_la-menus.lo' libtool=yes @AMDEPBACKSLASH@
1383 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1384 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-menus.lo `test -f 'parsetexi/menus.c' || echo '$(srcdir)/'`parsetexi/menus.c
1385
1386 parsetexi/Parsetexi_la-labels.lo: parsetexi/labels.c
1387 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-labels.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-labels.Tpo -c -o parsetexi/Parsetexi_la-labels.lo `test -f 'parsetexi/labels.c' || echo '$(srcdir)/'`parsetexi/labels.c
1388 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-labels.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-labels.Plo
1389 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/labels.c' object='parsetexi/Parsetexi_la-labels.lo' libtool=yes @AMDEPBACKSLASH@
1390 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1391 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-labels.lo `test -f 'parsetexi/labels.c' || echo '$(srcdir)/'`parsetexi/labels.c
1392
1393 parsetexi/Parsetexi_la-errors.lo: parsetexi/errors.c
1394 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-errors.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-errors.Tpo -c -o parsetexi/Parsetexi_la-errors.lo `test -f 'parsetexi/errors.c' || echo '$(srcdir)/'`parsetexi/errors.c
1395 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-errors.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-errors.Plo
1396 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/errors.c' object='parsetexi/Parsetexi_la-errors.lo' libtool=yes @AMDEPBACKSLASH@
1397 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1398 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-errors.lo `test -f 'parsetexi/errors.c' || echo '$(srcdir)/'`parsetexi/errors.c
1399
1400 parsetexi/Parsetexi_la-counter.lo: parsetexi/counter.c
1401 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT parsetexi/Parsetexi_la-counter.lo -MD -MP -MF parsetexi/$(DEPDIR)/Parsetexi_la-counter.Tpo -c -o parsetexi/Parsetexi_la-counter.lo `test -f 'parsetexi/counter.c' || echo '$(srcdir)/'`parsetexi/counter.c
1402 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) parsetexi/$(DEPDIR)/Parsetexi_la-counter.Tpo parsetexi/$(DEPDIR)/Parsetexi_la-counter.Plo
1403 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parsetexi/counter.c' object='parsetexi/Parsetexi_la-counter.lo' libtool=yes @AMDEPBACKSLASH@
1404 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1405 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o parsetexi/Parsetexi_la-counter.lo `test -f 'parsetexi/counter.c' || echo '$(srcdir)/'`parsetexi/counter.c
1406
10281407 TestXS_la-TestXS.lo: TestXS.c
10291408 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(TestXS_la_CFLAGS) $(CFLAGS) -MT TestXS_la-TestXS.lo -MD -MP -MF $(DEPDIR)/TestXS_la-TestXS.Tpo -c -o TestXS_la-TestXS.lo `test -f 'TestXS.c' || echo '$(srcdir)/'`TestXS.c
10301409 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/TestXS_la-TestXS.Tpo $(DEPDIR)/TestXS_la-TestXS.Plo
10581437
10591438 clean-libtool:
10601439 -rm -rf .libs _libs
1440 -rm -rf parsetexi/.libs parsetexi/_libs
10611441
10621442 distclean-libtool:
10631443 -rm -f libtool config.lt
1444 install-dist_modulesDATA: $(dist_modules_DATA)
1445 @$(NORMAL_INSTALL)
1446 @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \
1447 if test -n "$$list"; then \
1448 echo " $(MKDIR_P) '$(DESTDIR)$(modulesdir)'"; \
1449 $(MKDIR_P) "$(DESTDIR)$(modulesdir)" || exit 1; \
1450 fi; \
1451 for p in $$list; do \
1452 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
1453 echo "$$d$$p"; \
1454 done | $(am__base_list) | \
1455 while read files; do \
1456 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(modulesdir)'"; \
1457 $(INSTALL_DATA) $$files "$(DESTDIR)$(modulesdir)" || exit $$?; \
1458 done
1459
1460 uninstall-dist_modulesDATA:
1461 @$(NORMAL_UNINSTALL)
1462 @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \
1463 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
1464 dir='$(DESTDIR)$(modulesdir)'; $(am__uninstall_files_from_dir)
10641465
10651466 # This directory's subdirectories are mostly independent; you can cd
10661467 # into them and run 'make' without going through this Makefile.
11681569 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
11691570 -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
11701571
1171 distdir: $(DISTFILES)
1572 distdir: $(BUILT_SOURCES)
1573 $(MAKE) $(AM_MAKEFLAGS) distdir-am
1574
1575 distdir-am: $(DISTFILES)
11721576 $(am__remove_distdir)
11731577 test -d "$(distdir)" || mkdir "$(distdir)"
11741578 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
12331637 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
12341638 || chmod -R a+r "$(distdir)"
12351639 dist-gzip: distdir
1236 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
1640 tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
12371641 $(am__post_remove_distdir)
12381642
12391643 dist-bzip2: distdir
12591663 @echo WARNING: "Support for shar distribution archives is" \
12601664 "deprecated." >&2
12611665 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
1262 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
1666 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
12631667 $(am__post_remove_distdir)
12641668
12651669 dist-zip: distdir
12771681 distcheck: dist
12781682 case '$(DIST_ARCHIVES)' in \
12791683 *.tar.gz*) \
1280 GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
1684 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
12811685 *.tar.bz2*) \
12821686 bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
12831687 *.tar.lz*) \
12871691 *.tar.Z*) \
12881692 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
12891693 *.shar.gz*) \
1290 GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
1694 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
12911695 *.zip*) \
12921696 unzip $(distdir).zip ;;\
12931697 esac
13571761 $(distcleancheck_listfiles) ; \
13581762 exit 1; } >&2
13591763 check-am: all-am
1360 check: check-recursive
1361 all-am: Makefile $(LTLIBRARIES) config.h
1764 check: $(BUILT_SOURCES)
1765 $(MAKE) $(AM_MAKEFLAGS) check-recursive
1766 all-am: Makefile $(LTLIBRARIES) $(DATA) config.h
13621767 installdirs: installdirs-recursive
13631768 installdirs-am:
1364 for dir in "$(DESTDIR)$(xsdir)"; do \
1769 for dir in "$(DESTDIR)$(xsdir)" "$(DESTDIR)$(modulesdir)"; do \
13651770 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
13661771 done
1367 install: install-recursive
1772 install: $(BUILT_SOURCES)
1773 $(MAKE) $(AM_MAKEFLAGS) install-recursive
13681774 install-exec: install-exec-recursive
13691775 install-data: install-data-recursive
13701776 uninstall: uninstall-recursive
13911797 distclean-generic:
13921798 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
13931799 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1800 -rm -f parsetexi/$(DEPDIR)/$(am__dirstamp)
1801 -rm -f parsetexi/$(am__dirstamp)
13941802
13951803 maintainer-clean-generic:
13961804 @echo "This command is intended for maintainers to use"
13971805 @echo "it deletes files that may require special tools to rebuild."
1806 -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
13981807 clean: clean-recursive
13991808
14001809 clean-am: clean-generic clean-libtool clean-xsLTLIBRARIES \
14021811
14031812 distclean: distclean-recursive
14041813 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
1405 -rm -rf ./$(DEPDIR)
1814 -rm -f ./$(DEPDIR)/MiscXS_la-MiscXS.Plo
1815 -rm -f ./$(DEPDIR)/MiscXS_la-misc.Plo
1816 -rm -f ./$(DEPDIR)/TestXS_la-TestXS.Plo
1817 -rm -f ./$(DEPDIR)/XSParagraph_la-XSParagraph.Plo
1818 -rm -f ./$(DEPDIR)/XSParagraph_la-text.Plo
1819 -rm -f ./$(DEPDIR)/XSParagraph_la-xspara.Plo
1820 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Plo
1821 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-api.Plo
1822 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-close.Plo
1823 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-commands.Plo
1824 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Plo
1825 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-convert.Plo
1826 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-counter.Plo
1827 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-debug.Plo
1828 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-def.Plo
1829 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Plo
1830 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Plo
1831 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-errors.Plo
1832 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-extra.Plo
1833 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Plo
1834 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-indices.Plo
1835 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-input.Plo
1836 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-labels.Plo
1837 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-macro.Plo
1838 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-menus.Plo
1839 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Plo
1840 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-parser.Plo
1841 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-separator.Plo
1842 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-text.Plo
1843 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-tree.Plo
14061844 -rm -f Makefile
14071845 distclean-am: clean-am distclean-compile distclean-generic \
14081846 distclean-hdr distclean-libtool distclean-tags
14191857
14201858 info-am:
14211859
1422 install-data-am: install-xsLTLIBRARIES
1860 install-data-am: install-dist_modulesDATA install-xsLTLIBRARIES
14231861 @$(NORMAL_INSTALL)
14241862 $(MAKE) $(AM_MAKEFLAGS) install-data-hook
14251863 install-dvi: install-dvi-recursive
14511889 maintainer-clean: maintainer-clean-recursive
14521890 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
14531891 -rm -rf $(top_srcdir)/autom4te.cache
1454 -rm -rf ./$(DEPDIR)
1892 -rm -f ./$(DEPDIR)/MiscXS_la-MiscXS.Plo
1893 -rm -f ./$(DEPDIR)/MiscXS_la-misc.Plo
1894 -rm -f ./$(DEPDIR)/TestXS_la-TestXS.Plo
1895 -rm -f ./$(DEPDIR)/XSParagraph_la-XSParagraph.Plo
1896 -rm -f ./$(DEPDIR)/XSParagraph_la-text.Plo
1897 -rm -f ./$(DEPDIR)/XSParagraph_la-xspara.Plo
1898 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-Parsetexi.Plo
1899 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-api.Plo
1900 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-close.Plo
1901 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-commands.Plo
1902 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-context_stack.Plo
1903 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-convert.Plo
1904 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-counter.Plo
1905 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-debug.Plo
1906 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-def.Plo
1907 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-element_types.Plo
1908 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-end_line.Plo
1909 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-errors.Plo
1910 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-extra.Plo
1911 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-handle_commands.Plo
1912 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-indices.Plo
1913 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-input.Plo
1914 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-labels.Plo
1915 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-macro.Plo
1916 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-menus.Plo
1917 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-multitable.Plo
1918 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-parser.Plo
1919 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-separator.Plo
1920 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-text.Plo
1921 -rm -f parsetexi/$(DEPDIR)/Parsetexi_la-tree.Plo
14551922 -rm -f Makefile
14561923 maintainer-clean-am: distclean-am maintainer-clean-generic
14571924
14681935
14691936 ps-am:
14701937
1471 uninstall-am: uninstall-xsLTLIBRARIES
1472
1473 .MAKE: $(am__recursive_targets) all install-am install-data-am \
1474 install-strip
1938 uninstall-am: uninstall-dist_modulesDATA uninstall-xsLTLIBRARIES
1939
1940 .MAKE: $(am__recursive_targets) all check install install-am \
1941 install-data-am install-strip
14751942
14761943 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
1477 am--refresh check check-am clean clean-cscope clean-generic \
1478 clean-libtool clean-xsLTLIBRARIES cscope cscopelist-am ctags \
1479 ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \
1480 dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
1481 distclean-compile distclean-generic distclean-hdr \
1482 distclean-libtool distclean-tags distcleancheck distdir \
1483 distuninstallcheck dvi dvi-am html html-am info info-am \
1484 install install-am install-data install-data-am \
1485 install-data-hook install-dvi install-dvi-am install-exec \
1486 install-exec-am install-html install-html-am install-info \
1487 install-info-am install-man install-pdf install-pdf-am \
1488 install-ps install-ps-am install-strip install-xsLTLIBRARIES \
1489 installcheck installcheck-am installdirs installdirs-am \
1490 maintainer-clean maintainer-clean-generic mostlyclean \
1491 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
1492 pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
1944 am--depfiles am--refresh check check-am clean clean-cscope \
1945 clean-generic clean-libtool clean-xsLTLIBRARIES cscope \
1946 cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
1947 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
1948 distcheck distclean distclean-compile distclean-generic \
1949 distclean-hdr distclean-libtool distclean-tags distcleancheck \
1950 distdir distuninstallcheck dvi dvi-am html html-am info \
1951 info-am install install-am install-data install-data-am \
1952 install-data-hook install-dist_modulesDATA install-dvi \
1953 install-dvi-am install-exec install-exec-am install-html \
1954 install-html-am install-info install-info-am install-man \
1955 install-pdf install-pdf-am install-ps install-ps-am \
1956 install-strip install-xsLTLIBRARIES installcheck \
1957 installcheck-am installdirs installdirs-am maintainer-clean \
1958 maintainer-clean-generic mostlyclean mostlyclean-compile \
1959 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1960 tags tags-am uninstall uninstall-am uninstall-dist_modulesDATA \
14931961 uninstall-xsLTLIBRARIES
14941962
14951963 .PRECIOUS: Makefile
15071975 @HOST_NEEDS_NO_UNDEFINED_TRUE@ # `(gnulib)Libtool and Windows'. The -L and -l options after it show
15081976 @HOST_NEEDS_NO_UNDEFINED_TRUE@ # where to find the undefined symbols.
15091977
1978 $(srcdir)/$p/element_types.c $(srcdir)/$p/element_types.h: $p/element_types.txt $p/element_types.awk
1979 awk -v srcdir=$(srcdir)/$p -f $(srcdir)/$p/element_types.awk \
1980 $(srcdir)/$p/element_types.txt
1981
1982 $(srcdir)/$p/command_data.c $(srcdir)/$p/command_ids.h: $p/command_data.txt $p/command_data.awk
1983 awk -v srcdir=$(srcdir)/$p -f $(srcdir)/$p/command_data.awk \
1984 $(srcdir)/$p/command_data.txt
1985
15101986 # Tell versions [3.59,3.63) of GNU make to not export all variables.
15111987 # Otherwise a system limit (for SysV at least) may be exceeded.
15121988 .NOEXPORT:
0 # generated automatically by aclocal 1.15 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
0 # generated automatically by aclocal 1.16 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
33
44 # This file is free software; the Free Software Foundation
55 # gives unlimited permission to copy and/or distribute it,
1919 If you have problems, you may need to regenerate the build system entirely.
2020 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
2121
22 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
22 # po.m4 serial 24 (gettext-0.19)
23 dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc.
24 dnl This file is free software; the Free Software Foundation
25 dnl gives unlimited permission to copy and/or distribute it,
26 dnl with or without modifications, as long as this notice is preserved.
27 dnl
28 dnl This file can be used in projects which are not available under
29 dnl the GNU General Public License or the GNU Library General Public
30 dnl License but which still want to provide support for the GNU gettext
31 dnl functionality.
32 dnl Please note that the actual code of the GNU gettext library is covered
33 dnl by the GNU Library General Public License, and the rest of the GNU
34 dnl gettext package is covered by the GNU General Public License.
35 dnl They are *not* in the public domain.
36
37 dnl Authors:
38 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
39 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
40
41 AC_PREREQ([2.60])
42
43 dnl Checks for all prerequisites of the po subdirectory.
44 AC_DEFUN([AM_PO_SUBDIRS],
45 [
46 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
47 AC_REQUIRE([AC_PROG_INSTALL])dnl
48 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
49 AC_REQUIRE([AC_PROG_SED])dnl
50 AC_REQUIRE([AM_NLS])dnl
51
52 dnl Release version of the gettext macros. This is used to ensure that
53 dnl the gettext macros and po/Makefile.in.in are in sync.
54 AC_SUBST([GETTEXT_MACRO_VERSION], [0.19])
55
56 dnl Perform the following tests also if --disable-nls has been given,
57 dnl because they are needed for "make dist" to work.
58
59 dnl Search for GNU msgfmt in the PATH.
60 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
61 dnl The second test excludes FreeBSD msgfmt.
62 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
63 [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
64 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
65 :)
66 AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
67
68 dnl Test whether it is GNU msgfmt >= 0.15.
69 changequote(,)dnl
70 case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
71 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
72 *) MSGFMT_015=$MSGFMT ;;
73 esac
74 changequote([,])dnl
75 AC_SUBST([MSGFMT_015])
76 changequote(,)dnl
77 case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
78 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
79 *) GMSGFMT_015=$GMSGFMT ;;
80 esac
81 changequote([,])dnl
82 AC_SUBST([GMSGFMT_015])
83
84 dnl Search for GNU xgettext 0.12 or newer in the PATH.
85 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
86 dnl The second test excludes FreeBSD xgettext.
87 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
88 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
89 (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
90 :)
91 dnl Remove leftover from FreeBSD xgettext call.
92 rm -f messages.po
93
94 dnl Test whether it is GNU xgettext >= 0.15.
95 changequote(,)dnl
96 case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
97 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
98 *) XGETTEXT_015=$XGETTEXT ;;
99 esac
100 changequote([,])dnl
101 AC_SUBST([XGETTEXT_015])
102
103 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
104 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
105 [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
106
107 dnl Installation directories.
108 dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
109 dnl have to define it here, so that it can be used in po/Makefile.
110 test -n "$localedir" || localedir='${datadir}/locale'
111 AC_SUBST([localedir])
112
113 dnl Support for AM_XGETTEXT_OPTION.
114 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
115 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
116
117 AC_CONFIG_COMMANDS([po-directories], [[
118 for ac_file in $CONFIG_FILES; do
119 # Support "outfile[:infile[:infile...]]"
120 case "$ac_file" in
121 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
122 esac
123 # PO directories have a Makefile.in generated from Makefile.in.in.
124 case "$ac_file" in */Makefile.in)
125 # Adjust a relative srcdir.
126 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
127 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
128 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
129 # In autoconf-2.13 it is called $ac_given_srcdir.
130 # In autoconf-2.50 it is called $srcdir.
131 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
132 case "$ac_given_srcdir" in
133 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
134 /*) top_srcdir="$ac_given_srcdir" ;;
135 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
136 esac
137 # Treat a directory as a PO directory if and only if it has a
138 # POTFILES.in file. This allows packages to have multiple PO
139 # directories under different names or in different locations.
140 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
141 rm -f "$ac_dir/POTFILES"
142 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
143 gt_tab=`printf '\t'`
144 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
145 POMAKEFILEDEPS="POTFILES.in"
146 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
147 # on $ac_dir but don't depend on user-specified configuration
148 # parameters.
149 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
150 # The LINGUAS file contains the set of available languages.
151 if test -n "$OBSOLETE_ALL_LINGUAS"; then
152 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
153 fi
154 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
155 # Hide the ALL_LINGUAS assignment from automake < 1.5.
156 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
157 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
158 else
159 # The set of available languages was given in configure.in.
160 # Hide the ALL_LINGUAS assignment from automake < 1.5.
161 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
162 fi
163 # Compute POFILES
164 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
165 # Compute UPDATEPOFILES
166 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
167 # Compute DUMMYPOFILES
168 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
169 # Compute GMOFILES
170 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
171 case "$ac_given_srcdir" in
172 .) srcdirpre= ;;
173 *) srcdirpre='$(srcdir)/' ;;
174 esac
175 POFILES=
176 UPDATEPOFILES=
177 DUMMYPOFILES=
178 GMOFILES=
179 for lang in $ALL_LINGUAS; do
180 POFILES="$POFILES $srcdirpre$lang.po"
181 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
182 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
183 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
184 done
185 # CATALOGS depends on both $ac_dir and the user's LINGUAS
186 # environment variable.
187 INST_LINGUAS=
188 if test -n "$ALL_LINGUAS"; then
189 for presentlang in $ALL_LINGUAS; do
190 useit=no
191 if test "%UNSET%" != "$LINGUAS"; then
192 desiredlanguages="$LINGUAS"
193 else
194 desiredlanguages="$ALL_LINGUAS"
195 fi
196 for desiredlang in $desiredlanguages; do
197 # Use the presentlang catalog if desiredlang is
198 # a. equal to presentlang, or
199 # b. a variant of presentlang (because in this case,
200 # presentlang can be used as a fallback for messages
201 # which are not translated in the desiredlang catalog).
202 case "$desiredlang" in
203 "$presentlang"*) useit=yes;;
204 esac
205 done
206 if test $useit = yes; then
207 INST_LINGUAS="$INST_LINGUAS $presentlang"
208 fi
209 done
210 fi
211 CATALOGS=
212 if test -n "$INST_LINGUAS"; then
213 for lang in $INST_LINGUAS; do
214 CATALOGS="$CATALOGS $lang.gmo"
215 done
216 fi
217 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
218 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
219 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
220 if test -f "$f"; then
221 case "$f" in
222 *.orig | *.bak | *~) ;;
223 *) cat "$f" >> "$ac_dir/Makefile" ;;
224 esac
225 fi
226 done
227 fi
228 ;;
229 esac
230 done]],
231 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
232 # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
233 # from automake < 1.5.
234 eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
235 # Capture the value of LINGUAS because we need it to compute CATALOGS.
236 LINGUAS="${LINGUAS-%UNSET%}"
237 ])
238 ])
239
240 dnl Postprocesses a Makefile in a directory containing PO files.
241 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
242 [
243 # When this code is run, in config.status, two variables have already been
244 # set:
245 # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
246 # - LINGUAS is the value of the environment variable LINGUAS at configure
247 # time.
248
249 changequote(,)dnl
250 # Adjust a relative srcdir.
251 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
252 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
253 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
254 # In autoconf-2.13 it is called $ac_given_srcdir.
255 # In autoconf-2.50 it is called $srcdir.
256 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
257 case "$ac_given_srcdir" in
258 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
259 /*) top_srcdir="$ac_given_srcdir" ;;
260 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
261 esac
262
263 # Find a way to echo strings without interpreting backslash.
264 if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
265 gt_echo='echo'
266 else
267 if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
268 gt_echo='printf %s\n'
269 else
270 echo_func () {
271 cat <<EOT
272 $*
273 EOT
274 }
275 gt_echo='echo_func'
276 fi
277 fi
278
279 # A sed script that extracts the value of VARIABLE from a Makefile.
280 tab=`printf '\t'`
281 sed_x_variable='
282 # Test if the hold space is empty.
283 x
284 s/P/P/
285 x
286 ta
287 # Yes it was empty. Look if we have the expected variable definition.
288 /^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
289 # Seen the first line of the variable definition.
290 s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
291 ba
292 }
293 bd
294 :a
295 # Here we are processing a line from the variable definition.
296 # Remove comment, more precisely replace it with a space.
297 s/#.*$/ /
298 # See if the line ends in a backslash.
299 tb
300 :b
301 s/\\$//
302 # Print the line, without the trailing backslash.
303 p
304 tc
305 # There was no trailing backslash. The end of the variable definition is
306 # reached. Clear the hold space.
307 s/^.*$//
308 x
309 bd
310 :c
311 # A trailing backslash means that the variable definition continues in the
312 # next line. Put a nonempty string into the hold space to indicate this.
313 s/^.*$/P/
314 x
315 :d
316 '
317 changequote([,])dnl
318
319 # Set POTFILES to the value of the Makefile variable POTFILES.
320 sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
321 POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
322 # Compute POTFILES_DEPS as
323 # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
324 POTFILES_DEPS=
325 for file in $POTFILES; do
326 POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
327 done
328 POMAKEFILEDEPS=""
329
330 if test -n "$OBSOLETE_ALL_LINGUAS"; then
331 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
332 fi
333 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
334 # The LINGUAS file contains the set of available languages.
335 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
336 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
337 else
338 # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
339 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
340 ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
341 fi
342 # Hide the ALL_LINGUAS assignment from automake < 1.5.
343 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
344 # Compute POFILES
345 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
346 # Compute UPDATEPOFILES
347 # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
348 # Compute DUMMYPOFILES
349 # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
350 # Compute GMOFILES
351 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
352 # Compute PROPERTIESFILES
353 # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
354 # Compute CLASSFILES
355 # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
356 # Compute QMFILES
357 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
358 # Compute MSGFILES
359 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
360 # Compute RESOURCESDLLFILES
361 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
362 case "$ac_given_srcdir" in
363 .) srcdirpre= ;;
364 *) srcdirpre='$(srcdir)/' ;;
365 esac
366 POFILES=
367 UPDATEPOFILES=
368 DUMMYPOFILES=
369 GMOFILES=
370 PROPERTIESFILES=
371 CLASSFILES=
372 QMFILES=
373 MSGFILES=
374 RESOURCESDLLFILES=
375 for lang in $ALL_LINGUAS; do
376 POFILES="$POFILES $srcdirpre$lang.po"
377 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
378 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
379 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
380 PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
381 CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
382 QMFILES="$QMFILES $srcdirpre$lang.qm"
383 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
384 MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
385 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
386 RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
387 done
388 # CATALOGS depends on both $ac_dir and the user's LINGUAS
389 # environment variable.
390 INST_LINGUAS=
391 if test -n "$ALL_LINGUAS"; then
392 for presentlang in $ALL_LINGUAS; do
393 useit=no
394 if test "%UNSET%" != "$LINGUAS"; then
395 desiredlanguages="$LINGUAS"
396 else
397 desiredlanguages="$ALL_LINGUAS"
398 fi
399 for desiredlang in $desiredlanguages; do
400 # Use the presentlang catalog if desiredlang is
401 # a. equal to presentlang, or
402 # b. a variant of presentlang (because in this case,
403 # presentlang can be used as a fallback for messages
404 # which are not translated in the desiredlang catalog).
405 case "$desiredlang" in
406 "$presentlang"*) useit=yes;;
407 esac
408 done
409 if test $useit = yes; then
410 INST_LINGUAS="$INST_LINGUAS $presentlang"
411 fi
412 done
413 fi
414 CATALOGS=
415 JAVACATALOGS=
416 QTCATALOGS=
417 TCLCATALOGS=
418 CSHARPCATALOGS=
419 if test -n "$INST_LINGUAS"; then
420 for lang in $INST_LINGUAS; do
421 CATALOGS="$CATALOGS $lang.gmo"
422 JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
423 QTCATALOGS="$QTCATALOGS $lang.qm"
424 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
425 TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
426 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
427 CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
428 done
429 fi
430
431 sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
432 tab=`printf '\t'`
433 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
434 # Add dependencies that cannot be formulated as a simple suffix rule.
435 for lang in $ALL_LINGUAS; do
436 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
437 cat >> "$ac_file.tmp" <<EOF
438 $frobbedlang.msg: $lang.po
439 ${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
440 ${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
441 EOF
442 done
443 fi
444 if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
445 # Add dependencies that cannot be formulated as a simple suffix rule.
446 for lang in $ALL_LINGUAS; do
447 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
448 cat >> "$ac_file.tmp" <<EOF
449 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
450 ${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
451 ${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
452 EOF
453 done
454 fi
455 if test -n "$POMAKEFILEDEPS"; then
456 cat >> "$ac_file.tmp" <<EOF
457 Makefile: $POMAKEFILEDEPS
458 EOF
459 fi
460 mv "$ac_file.tmp" "$ac_file"
461 ])
462
463 dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
464 AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
465 [
466 XGETTEXT_EXTRA_OPTIONS=
467 ])
468
469 dnl Registers an option to be passed to xgettext in the po subdirectory.
470 AC_DEFUN([AM_XGETTEXT_OPTION],
471 [
472 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
473 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
474 ])
475
476 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
23477 #
24478 # This file is free software; the Free Software Foundation
25479 # gives unlimited permission to copy and/or distribute it,
31485 # generated from the m4 files accompanying Automake X.Y.
32486 # (This private macro should not be called outside this file.)
33487 AC_DEFUN([AM_AUTOMAKE_VERSION],
34 [am__api_version='1.15'
488 [am__api_version='1.16'
35489 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36490 dnl require some minimum version. Point them to the right macro.
37 m4_if([$1], [1.15], [],
491 m4_if([$1], [1.16], [],
38492 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39493 ])
40494
50504 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51505 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52506 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53 [AM_AUTOMAKE_VERSION([1.15])dnl
507 [AM_AUTOMAKE_VERSION([1.16])dnl
54508 m4_ifndef([AC_AUTOCONF_VERSION],
55509 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56510 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57511
58512 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
59513
60 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
514 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
61515 #
62516 # This file is free software; the Free Software Foundation
63517 # gives unlimited permission to copy and/or distribute it,
109563
110564 # AM_CONDITIONAL -*- Autoconf -*-
111565
112 # Copyright (C) 1997-2014 Free Software Foundation, Inc.
566 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
113567 #
114568 # This file is free software; the Free Software Foundation
115569 # gives unlimited permission to copy and/or distribute it,
140594 Usually this means the macro was only invoked conditionally.]])
141595 fi])])
142596
143 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
597 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
144598 #
145599 # This file is free software; the Free Software Foundation
146600 # gives unlimited permission to copy and/or distribute it,
331785
332786 # Generate code to set up dependency tracking. -*- Autoconf -*-
333787
334 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
335 #
336 # This file is free software; the Free Software Foundation
337 # gives unlimited permission to copy and/or distribute it,
338 # with or without modifications, as long as this notice is preserved.
339
788 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
789 #
790 # This file is free software; the Free Software Foundation
791 # gives unlimited permission to copy and/or distribute it,
792 # with or without modifications, as long as this notice is preserved.
340793
341794 # _AM_OUTPUT_DEPENDENCY_COMMANDS
342795 # ------------------------------
345798 # Older Autoconf quotes --file arguments for eval, but not when files
346799 # are listed without --file. Let's play safe and only enable the eval
347800 # if we detect the quoting.
348 case $CONFIG_FILES in
349 *\'*) eval set x "$CONFIG_FILES" ;;
350 *) set x $CONFIG_FILES ;;
351 esac
801 # TODO: see whether this extra hack can be removed once we start
802 # requiring Autoconf 2.70 or later.
803 AS_CASE([$CONFIG_FILES],
804 [*\'*], [eval set x "$CONFIG_FILES"],
805 [*], [set x $CONFIG_FILES])
352806 shift
353 for mf
807 # Used to flag and report bootstrapping failures.
808 am_rc=0
809 for am_mf
354810 do
355811 # Strip MF so we end up with the name of the file.
356 mf=`echo "$mf" | sed -e 's/:.*$//'`
357 # Check whether this is an Automake generated Makefile or not.
358 # We used to match only the files named 'Makefile.in', but
359 # some people rename them; so instead we look at the file content.
360 # Grep'ing the first line is not enough: some people post-process
361 # each Makefile.in and add a new line on top of each file to say so.
362 # Grep'ing the whole file is not good either: AIX grep has a line
812 am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
813 # Check whether this is an Automake generated Makefile which includes
814 # dependency-tracking related rules and includes.
815 # Grep'ing the whole file directly is not great: AIX grep has a line
363816 # limit of 2048, but all sed's we know have understand at least 4000.
364 if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
365 dirpart=`AS_DIRNAME("$mf")`
366 else
367 continue
368 fi
369 # Extract the definition of DEPDIR, am__include, and am__quote
370 # from the Makefile without running 'make'.
371 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
372 test -z "$DEPDIR" && continue
373 am__include=`sed -n 's/^am__include = //p' < "$mf"`
374 test -z "$am__include" && continue
375 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
376 # Find all dependency output files, they are included files with
377 # $(DEPDIR) in their names. We invoke sed twice because it is the
378 # simplest approach to changing $(DEPDIR) to its actual value in the
379 # expansion.
380 for file in `sed -n "
381 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
382 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
383 # Make sure the directory exists.
384 test -f "$dirpart/$file" && continue
385 fdir=`AS_DIRNAME(["$file"])`
386 AS_MKDIR_P([$dirpart/$fdir])
387 # echo "creating $dirpart/$file"
388 echo '# dummy' > "$dirpart/$file"
389 done
817 sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
818 || continue
819 am_dirpart=`AS_DIRNAME(["$am_mf"])`
820 am_filepart=`AS_BASENAME(["$am_mf"])`
821 AM_RUN_LOG([cd "$am_dirpart" \
822 && sed -e '/# am--include-marker/d' "$am_filepart" \
823 | $MAKE -f - am--depfiles]) || am_rc=$?
390824 done
825 if test $am_rc -ne 0; then
826 AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
827 for automatic dependency tracking. Try re-running configure with the
828 '--disable-dependency-tracking' option to at least be able to build
829 the package (albeit without support for automatic dependency tracking).])
830 fi
831 AS_UNSET([am_dirpart])
832 AS_UNSET([am_filepart])
833 AS_UNSET([am_mf])
834 AS_UNSET([am_rc])
835 rm -f conftest-deps.mk
391836 }
392837 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
393838
396841 # -----------------------------
397842 # This macro should only be invoked once -- use via AC_REQUIRE.
398843 #
399 # This code is only required when automatic dependency tracking
400 # is enabled. FIXME. This creates each '.P' file that we will
401 # need in order to bootstrap the dependency handling code.
844 # This code is only required when automatic dependency tracking is enabled.
845 # This creates each '.Po' and '.Plo' makefile fragment that we'll need in
846 # order to bootstrap the dependency handling code.
402847 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
403848 [AC_CONFIG_COMMANDS([depfiles],
404849 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
405 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
406 ])
850 [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
407851
408852 # Do all the work for Automake. -*- Autoconf -*-
409853
410 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
854 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
411855 #
412856 # This file is free software; the Free Software Foundation
413857 # gives unlimited permission to copy and/or distribute it,
494938 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
495939 # For better backward compatibility. To be removed once Automake 1.9.x
496940 # dies out for good. For more background, see:
497 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
498 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
941 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
942 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
499943 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
500944 # We need awk for the "check" target (and possibly the TAP driver). The
501945 # system "awk" is bad on some platforms.
5621006 Aborting the configuration process, to ensure you take notice of the issue.
5631007
5641008 You can download and install GNU coreutils to get an 'rm' implementation
565 that behaves properly: <http://www.gnu.org/software/coreutils/>.
1009 that behaves properly: <https://www.gnu.org/software/coreutils/>.
5661010
5671011 If you want to complete the configuration process using your problematic
5681012 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
6041048 done
6051049 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6061050
607 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
1051 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
6081052 #
6091053 # This file is free software; the Free Software Foundation
6101054 # gives unlimited permission to copy and/or distribute it,
6251069 fi
6261070 AC_SUBST([install_sh])])
6271071
628 # Copyright (C) 2003-2014 Free Software Foundation, Inc.
1072 # Copyright (C) 2003-2018 Free Software Foundation, Inc.
6291073 #
6301074 # This file is free software; the Free Software Foundation
6311075 # gives unlimited permission to copy and/or distribute it,
6461090
6471091 # Check to see how 'make' treats includes. -*- Autoconf -*-
6481092
649 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
1093 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
6501094 #
6511095 # This file is free software; the Free Software Foundation
6521096 # gives unlimited permission to copy and/or distribute it,
6541098
6551099 # AM_MAKE_INCLUDE()
6561100 # -----------------
657 # Check to see how make treats includes.
1101 # Check whether make has an 'include' directive that can support all
1102 # the idioms we need for our automatic dependency tracking code.
6581103 AC_DEFUN([AM_MAKE_INCLUDE],
659 [am_make=${MAKE-make}
660 cat > confinc << 'END'
1104 [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
1105 cat > confinc.mk << 'END'
6611106 am__doit:
662 @echo this is the am__doit target
1107 @echo this is the am__doit target >confinc.out
6631108 .PHONY: am__doit
6641109 END
665 # If we don't find an include directive, just comment out the code.
666 AC_MSG_CHECKING([for style of include used by $am_make])
6671110 am__include="#"
6681111 am__quote=
669 _am_result=none
670 # First try GNU make style include.
671 echo "include confinc" > confmf
672 # Ignore all kinds of additional output from 'make'.
673 case `$am_make -s -f confmf 2> /dev/null` in #(
674 *the\ am__doit\ target*)
675 am__include=include
676 am__quote=
677 _am_result=GNU
678 ;;
679 esac
680 # Now try BSD make style include.
681 if test "$am__include" = "#"; then
682 echo '.include "confinc"' > confmf
683 case `$am_make -s -f confmf 2> /dev/null` in #(
684 *the\ am__doit\ target*)
685 am__include=.include
686 am__quote="\""
687 _am_result=BSD
688 ;;
689 esac
690 fi
691 AC_SUBST([am__include])
692 AC_SUBST([am__quote])
693 AC_MSG_RESULT([$_am_result])
694 rm -f confinc confmf
695 ])
1112 # BSD make does it like this.
1113 echo '.include "confinc.mk" # ignored' > confmf.BSD
1114 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
1115 echo 'include confinc.mk # ignored' > confmf.GNU
1116 _am_result=no
1117 for s in GNU BSD; do
1118 AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
1119 AS_CASE([$?:`cat confinc.out 2>/dev/null`],
1120 ['0:this is the am__doit target'],
1121 [AS_CASE([$s],
1122 [BSD], [am__include='.include' am__quote='"'],
1123 [am__include='include' am__quote=''])])
1124 if test "$am__include" != "#"; then
1125 _am_result="yes ($s style)"
1126 break
1127 fi
1128 done
1129 rm -f confinc.* confmf.*
1130 AC_MSG_RESULT([${_am_result}])
1131 AC_SUBST([am__include])])
1132 AC_SUBST([am__quote])])
6961133
6971134 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
6981135
699 # Copyright (C) 1997-2014 Free Software Foundation, Inc.
1136 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
7001137 #
7011138 # This file is free software; the Free Software Foundation
7021139 # gives unlimited permission to copy and/or distribute it,
7351172
7361173 # Helper functions for option handling. -*- Autoconf -*-
7371174
738 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
1175 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
7391176 #
7401177 # This file is free software; the Free Software Foundation
7411178 # gives unlimited permission to copy and/or distribute it,
7641201 AC_DEFUN([_AM_IF_OPTION],
7651202 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7661203
767 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
1204 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
7681205 #
7691206 # This file is free software; the Free Software Foundation
7701207 # gives unlimited permission to copy and/or distribute it,
8111248 # For backward compatibility.
8121249 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8131250
814 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
1251 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
8151252 #
8161253 # This file is free software; the Free Software Foundation
8171254 # gives unlimited permission to copy and/or distribute it,
8301267
8311268 # Check to make sure that the build environment is sane. -*- Autoconf -*-
8321269
833 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
1270 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
8341271 #
8351272 # This file is free software; the Free Software Foundation
8361273 # gives unlimited permission to copy and/or distribute it,
9111348 rm -f conftest.file
9121349 ])
9131350
914 # Copyright (C) 2009-2014 Free Software Foundation, Inc.
1351 # Copyright (C) 2009-2018 Free Software Foundation, Inc.
9151352 #
9161353 # This file is free software; the Free Software Foundation
9171354 # gives unlimited permission to copy and/or distribute it,
9711408 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9721409 ])
9731410
974 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
1411 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
9751412 #
9761413 # This file is free software; the Free Software Foundation
9771414 # gives unlimited permission to copy and/or distribute it,
9991436 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10001437 AC_SUBST([INSTALL_STRIP_PROGRAM])])
10011438
1002 # Copyright (C) 2006-2014 Free Software Foundation, Inc.
1439 # Copyright (C) 2006-2018 Free Software Foundation, Inc.
10031440 #
10041441 # This file is free software; the Free Software Foundation
10051442 # gives unlimited permission to copy and/or distribute it,
10181455
10191456 # Check how to create a tarball. -*- Autoconf -*-
10201457
1021 # Copyright (C) 2004-2014 Free Software Foundation, Inc.
1458 # Copyright (C) 2004-2018 Free Software Foundation, Inc.
10221459 #
10231460 # This file is free software; the Free Software Foundation
10241461 # gives unlimited permission to copy and/or distribute it,
648648 PERL_EXT_LDFLAGS
649649 PERL_EXT_CPPFLAGS
650650 PERL_EXT_CFLAGS
651 HAVE_ICONV_FALSE
652 HAVE_ICONV_TRUE
651653 HOST_NEEDS_NO_UNDEFINED_FALSE
652654 HOST_NEEDS_NO_UNDEFINED_TRUE
653655 LT_SYS_LIBRARY_PATH
10451047 AMDEPBACKSLASH
10461048 AMDEP_FALSE
10471049 AMDEP_TRUE
1048 am__quote
10491050 am__include
10501051 DEPDIR
10511052 OBJEXT
11211122 PACKAGE_TARNAME
11221123 PACKAGE_NAME
11231124 PATH_SEPARATOR
1124 SHELL'
1125 SHELL
1126 am__quote'
11251127 ac_subst_files=''
11261128 ac_user_opts='
11271129 enable_option_checking
28952897 ac_compiler_gnu=$ac_cv_c_compiler_gnu
28962898
28972899
2898 am__api_version='1.15'
2900 am__api_version='1.16'
28992901
29002902 ac_aux_dir=
29012903 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
34403442
34413443 # For better backward compatibility. To be removed once Automake 1.9.x
34423444 # dies out for good. For more background, see:
3443 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
3444 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
3445 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
3446 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
34453447 mkdir_p='$(MKDIR_P)'
34463448
34473449 # We need awk for the "check" target (and possibly the TAP driver). The
34923494 Aborting the configuration process, to ensure you take notice of the issue.
34933495
34943496 You can download and install GNU coreutils to get an 'rm' implementation
3495 that behaves properly: <http://www.gnu.org/software/coreutils/>.
3497 that behaves properly: <https://www.gnu.org/software/coreutils/>.
34963498
34973499 If you want to complete the configuration process using your problematic
34983500 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
35843586
35853587
35863588
3589 # PERL_EXT_var are user variables, allowing configuring at the top-level
3590 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
3591
35873592 if test -n "$PERL_EXT_CC" ; then
35883593 CC=$PERL_EXT_CC
35893594 else
36003605
36013606 CC=$conf_value
36023607 fi
3608
3609 # Override these variables set by configure at the top level, because
3610 # the compiler used in this subdirectory might be different. Change
3611 # these now so they are used in the gnulib checks.
3612
3613 CFLAGS=$PERL_EXT_CFLAGS
3614 CPPFLAGS=$PERL_EXT_CPPFLAGS
3615 LDFLAGS=$PERL_EXT_LDFLAGS
36033616
36043617 # Wipe cache values in case -C was given at the top level
36053618 ac_cv_prog_CC= ; unset ac_cv_prog_CC
44574470
44584471 ac_config_commands="$ac_config_commands depfiles"
44594472
4460
4461 am_make=${MAKE-make}
4462 cat > confinc << 'END'
4473 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
4474 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
4475 cat > confinc.mk << 'END'
44634476 am__doit:
4464 @echo this is the am__doit target
4477 @echo this is the am__doit target >confinc.out
44654478 .PHONY: am__doit
44664479 END
4467 # If we don't find an include directive, just comment out the code.
4468 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
4469 $as_echo_n "checking for style of include used by $am_make... " >&6; }
44704480 am__include="#"
44714481 am__quote=
4472 _am_result=none
4473 # First try GNU make style include.
4474 echo "include confinc" > confmf
4475 # Ignore all kinds of additional output from 'make'.
4476 case `$am_make -s -f confmf 2> /dev/null` in #(
4477 *the\ am__doit\ target*)
4478 am__include=include
4479 am__quote=
4480 _am_result=GNU
4481 ;;
4482 # BSD make does it like this.
4483 echo '.include "confinc.mk" # ignored' > confmf.BSD
4484 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
4485 echo 'include confinc.mk # ignored' > confmf.GNU
4486 _am_result=no
4487 for s in GNU BSD; do
4488 { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
4489 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
4490 ac_status=$?
4491 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4492 (exit $ac_status); }
4493 case $?:`cat confinc.out 2>/dev/null` in #(
4494 '0:this is the am__doit target') :
4495 case $s in #(
4496 BSD) :
4497 am__include='.include' am__quote='"' ;; #(
4498 *) :
4499 am__include='include' am__quote='' ;;
4500 esac ;; #(
4501 *) :
4502 ;;
44824503 esac
4483 # Now try BSD make style include.
4484 if test "$am__include" = "#"; then
4485 echo '.include "confinc"' > confmf
4486 case `$am_make -s -f confmf 2> /dev/null` in #(
4487 *the\ am__doit\ target*)
4488 am__include=.include
4489 am__quote="\""
4490 _am_result=BSD
4491 ;;
4492 esac
4493 fi
4494
4495
4496 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
4497 $as_echo "$_am_result" >&6; }
4498 rm -f confinc confmf
4504 if test "$am__include" != "#"; then
4505 _am_result="yes ($s style)"
4506 break
4507 fi
4508 done
4509 rm -f confinc.* confmf.*
4510 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
4511 $as_echo "${_am_result}" >&6; }
44994512
45004513 # Check whether --enable-dependency-tracking was given.
45014514 if test "${enable_dependency_tracking+set}" = set; then :
1021010223 esac
1021110224
1021210225
10226 XGETTEXT_EXTRA_OPTIONS=
10227
10228
1021310229 GNULIB_BTOWC=0;
1021410230 GNULIB_WCTOB=0;
1021510231 GNULIB_MBSINIT=0;
1197711993
1197811994
1197911995
11996 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=asprintf:2:c-format"
11997
11998
11999
12000 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=vasprintf:2:c-format"
12001
12002
1198012003
1198112004
1198212005
1974919772 fi
1975019773
1975119774
19775 if test "x$am_func_iconv" = "xyes"; then
19776 HAVE_ICONV_TRUE=
19777 HAVE_ICONV_FALSE='#'
19778 else
19779 HAVE_ICONV_TRUE='#'
19780 HAVE_ICONV_FALSE=
19781 fi
19782
19783
1975219784 # User variables for a Perl XS extension, which may be different, for
1975319785 # example if the Perl interpreter being used was compiled with a
1975419786 # different compiler. Also in top-level configure.ac.
1983619868
1983719869 fi # not disable_xs
1983819870
19839 ac_config_files="$ac_config_files Makefile gnulib/lib/Makefile parsetexi/Makefile"
19871 ac_config_files="$ac_config_files Makefile gnulib/lib/Makefile"
1984019872
1984119873 cat >confcache <<\_ACEOF
1984219874 # This file is a shell script that caches the results of configure
2004020072 as_fn_error $? "conditional \"HOST_NEEDS_NO_UNDEFINED\" was never defined.
2004120073 Usually this means the macro was only invoked conditionally." "$LINENO" 5
2004220074 fi
20075 if test -z "${HAVE_ICONV_TRUE}" && test -z "${HAVE_ICONV_FALSE}"; then
20076 as_fn_error $? "conditional \"HAVE_ICONV\" was never defined.
20077 Usually this means the macro was only invoked conditionally." "$LINENO" 5
20078 fi
2004320079
2004420080 : "${CONFIG_STATUS=./config.status}"
2004520081 ac_write_fail=0
2062220658 #
2062320659 # INIT-COMMANDS
2062420660 #
20625 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
20661 AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
2062620662
2062720663
2062820664 # The HP-UX ksh and POSIX shell print the target directory to stdout
2092020956 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
2092120957 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
2092220958 "gnulib/lib/Makefile") CONFIG_FILES="$CONFIG_FILES gnulib/lib/Makefile" ;;
20923 "parsetexi/Makefile") CONFIG_FILES="$CONFIG_FILES parsetexi/Makefile" ;;
2092420959
2092520960 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
2092620961 esac
2152021555 # Older Autoconf quotes --file arguments for eval, but not when files
2152121556 # are listed without --file. Let's play safe and only enable the eval
2152221557 # if we detect the quoting.
21523 case $CONFIG_FILES in
21524 *\'*) eval set x "$CONFIG_FILES" ;;
21525 *) set x $CONFIG_FILES ;;
21526 esac
21558 # TODO: see whether this extra hack can be removed once we start
21559 # requiring Autoconf 2.70 or later.
21560 case $CONFIG_FILES in #(
21561 *\'*) :
21562 eval set x "$CONFIG_FILES" ;; #(
21563 *) :
21564 set x $CONFIG_FILES ;; #(
21565 *) :
21566 ;;
21567 esac
2152721568 shift
21528 for mf
21569 # Used to flag and report bootstrapping failures.
21570 am_rc=0
21571 for am_mf
2152921572 do
2153021573 # Strip MF so we end up with the name of the file.
21531 mf=`echo "$mf" | sed -e 's/:.*$//'`
21532 # Check whether this is an Automake generated Makefile or not.
21533 # We used to match only the files named 'Makefile.in', but
21534 # some people rename them; so instead we look at the file content.
21535 # Grep'ing the first line is not enough: some people post-process
21536 # each Makefile.in and add a new line on top of each file to say so.
21537 # Grep'ing the whole file is not good either: AIX grep has a line
21574 am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
21575 # Check whether this is an Automake generated Makefile which includes
21576 # dependency-tracking related rules and includes.
21577 # Grep'ing the whole file directly is not great: AIX grep has a line
2153821578 # limit of 2048, but all sed's we know have understand at least 4000.
21539 if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
21540 dirpart=`$as_dirname -- "$mf" ||
21541 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
21542 X"$mf" : 'X\(//\)[^/]' \| \
21543 X"$mf" : 'X\(//\)$' \| \
21544 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
21545 $as_echo X"$mf" |
21579 sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
21580 || continue
21581 am_dirpart=`$as_dirname -- "$am_mf" ||
21582 $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
21583 X"$am_mf" : 'X\(//\)[^/]' \| \
21584 X"$am_mf" : 'X\(//\)$' \| \
21585 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
21586 $as_echo X"$am_mf" |
2154621587 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
2154721588 s//\1/
2154821589 q
2156021601 q
2156121602 }
2156221603 s/.*/./; q'`
21563 else
21564 continue
21565 fi
21566 # Extract the definition of DEPDIR, am__include, and am__quote
21567 # from the Makefile without running 'make'.
21568 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
21569 test -z "$DEPDIR" && continue
21570 am__include=`sed -n 's/^am__include = //p' < "$mf"`
21571 test -z "$am__include" && continue
21572 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
21573 # Find all dependency output files, they are included files with
21574 # $(DEPDIR) in their names. We invoke sed twice because it is the
21575 # simplest approach to changing $(DEPDIR) to its actual value in the
21576 # expansion.
21577 for file in `sed -n "
21578 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
21579 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
21580 # Make sure the directory exists.
21581 test -f "$dirpart/$file" && continue
21582 fdir=`$as_dirname -- "$file" ||
21583 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
21584 X"$file" : 'X\(//\)[^/]' \| \
21585 X"$file" : 'X\(//\)$' \| \
21586 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
21587 $as_echo X"$file" |
21588 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
21604 am_filepart=`$as_basename -- "$am_mf" ||
21605 $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
21606 X"$am_mf" : 'X\(//\)$' \| \
21607 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
21608 $as_echo X/"$am_mf" |
21609 sed '/^.*\/\([^/][^/]*\)\/*$/{
2158921610 s//\1/
2159021611 q
2159121612 }
21592 /^X\(\/\/\)[^/].*/{
21613 /^X\/\(\/\/\)$/{
2159321614 s//\1/
2159421615 q
2159521616 }
21596 /^X\(\/\/\)$/{
21597 s//\1/
21598 q
21599 }
21600 /^X\(\/\).*/{
21617 /^X\/\(\/\).*/{
2160121618 s//\1/
2160221619 q
2160321620 }
2160421621 s/.*/./; q'`
21605 as_dir=$dirpart/$fdir; as_fn_mkdir_p
21606 # echo "creating $dirpart/$file"
21607 echo '# dummy' > "$dirpart/$file"
21608 done
21622 { echo "$as_me:$LINENO: cd "$am_dirpart" \
21623 && sed -e '/# am--include-marker/d' "$am_filepart" \
21624 | $MAKE -f - am--depfiles" >&5
21625 (cd "$am_dirpart" \
21626 && sed -e '/# am--include-marker/d' "$am_filepart" \
21627 | $MAKE -f - am--depfiles) >&5 2>&5
21628 ac_status=$?
21629 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21630 (exit $ac_status); } || am_rc=$?
2160921631 done
21632 if test $am_rc -ne 0; then
21633 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
21634 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
21635 as_fn_error $? "Something went wrong bootstrapping makefile fragments
21636 for automatic dependency tracking. Try re-running configure with the
21637 '--disable-dependency-tracking' option to at least be able to build
21638 the package (albeit without support for automatic dependency tracking).
21639 See \`config.log' for more details" "$LINENO" 5; }
21640 fi
21641 { am_dirpart=; unset am_dirpart;}
21642 { am_filepart=; unset am_filepart;}
21643 { am_mf=; unset am_mf;}
21644 { am_rc=; unset am_rc;}
21645 rm -f conftest-deps.mk
2161021646 }
2161121647 ;;
2161221648 "libtool":C)
00 # configure.ac for XSParagraph
11 #
2 # Copyright 2015, 2016, 2017 Free Software Foundation, Inc.
2 # Copyright 2015-2019 Free Software Foundation, Inc.
33 #
44 # This file is free software; as a special exception the author gives
55 # unlimited permission to copy and/or distribute it, with or without
5757 # "make dist" will work.
5858 if test x$disable_xs != xyes; then
5959 AC_PATH_PROG([PERL], [perl])
60
61 # PERL_EXT_var are user variables, allowing configuring at the top-level
62 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
6063
6164 if test -n "$PERL_EXT_CC" ; then
6265 CC=$PERL_EXT_CC
6770 lookup_perl_conf([cc])
6871 CC=$conf_value
6972 fi
73
74 # Override these variables set by configure at the top level, because
75 # the compiler used in this subdirectory might be different. Change
76 # these now so they are used in the gnulib checks.
77
78 CFLAGS=$PERL_EXT_CFLAGS
79 CPPFLAGS=$PERL_EXT_CPPFLAGS
80 LDFLAGS=$PERL_EXT_LDFLAGS
7081
7182 # Wipe cache values in case -C was given at the top level
7283 ac_cv_prog_CC= ; unset ac_cv_prog_CC
96107 esac
97108 AM_CONDITIONAL([HOST_NEEDS_NO_UNDEFINED],
98109 [test "x$host_needs_no_undefined" = "xyes"])
110
111 AM_CONDITIONAL([HAVE_ICONV],
112 [test "x$am_func_iconv" = "xyes"])
99113
100114 # User variables for a Perl XS extension, which may be different, for
101115 # example if the Perl interpreter being used was compiled with a
140154 AC_CONFIG_HEADERS([config.h:config.in])
141155 fi # not disable_xs
142156
143 AC_CONFIG_FILES([Makefile gnulib/lib/Makefile parsetexi/Makefile])
157 AC_CONFIG_FILES([Makefile gnulib/lib/Makefile])
144158 AC_OUTPUT
0 # Makefile.in generated by automake 1.15 from Makefile.am.
0 # Makefile.in generated by automake 1.16 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
214214 am__v_at_1 =
215215 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
216216 depcomp = $(SHELL) $(top_srcdir)/depcomp
217 am__depfiles_maybe = depfiles
217 am__maybe_remake_depfiles = depfiles
218 am__depfiles_remade = ./$(DEPDIR)/asnprintf.Plo \
219 ./$(DEPDIR)/asprintf.Plo ./$(DEPDIR)/float.Plo \
220 ./$(DEPDIR)/getdelim.Plo ./$(DEPDIR)/getline.Plo \
221 ./$(DEPDIR)/itold.Plo ./$(DEPDIR)/memchr.Plo \
222 ./$(DEPDIR)/printf-args.Plo ./$(DEPDIR)/printf-parse.Plo \
223 ./$(DEPDIR)/rawmemchr.Plo ./$(DEPDIR)/strchrnul.Plo \
224 ./$(DEPDIR)/strndup.Plo ./$(DEPDIR)/strnlen.Plo \
225 ./$(DEPDIR)/vasnprintf.Plo ./$(DEPDIR)/vasprintf.Plo \
226 ./$(DEPDIR)/xsize.Plo
218227 am__mv = mv -f
219228 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
220229 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
257266 $(RECURSIVE_CLEAN_TARGETS) \
258267 $(am__extra_recursive_targets)
259268 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
260 distdir
269 distdir distdir-am
261270 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
262271 # Read a list of newline-separated strings from the standard input,
263272 # and print each of them once, without duplicates. Input order is
858867 *config.status*) \
859868 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
860869 *) \
861 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
862 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
870 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
871 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
863872 esac;
864873
865874 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
894903 distclean-compile:
895904 -rm -f *.tab.c
896905
897 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Plo@am__quote@
898 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Plo@am__quote@
899 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@
900 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdelim.Plo@am__quote@
901 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getline.Plo@am__quote@
902 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Plo@am__quote@
903 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Plo@am__quote@
904 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Plo@am__quote@
905 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Plo@am__quote@
906 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmemchr.Plo@am__quote@
907 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strchrnul.Plo@am__quote@
908 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Plo@am__quote@
909 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Plo@am__quote@
910 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Plo@am__quote@
911 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Plo@am__quote@
912 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsize.Plo@am__quote@
906 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Plo@am__quote@ # am--include-marker
907 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Plo@am__quote@ # am--include-marker
908 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@ # am--include-marker
909 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdelim.Plo@am__quote@ # am--include-marker
910 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getline.Plo@am__quote@ # am--include-marker
911 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Plo@am__quote@ # am--include-marker
912 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Plo@am__quote@ # am--include-marker
913 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Plo@am__quote@ # am--include-marker
914 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Plo@am__quote@ # am--include-marker
915 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmemchr.Plo@am__quote@ # am--include-marker
916 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strchrnul.Plo@am__quote@ # am--include-marker
917 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Plo@am__quote@ # am--include-marker
918 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Plo@am__quote@ # am--include-marker
919 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Plo@am__quote@ # am--include-marker
920 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Plo@am__quote@ # am--include-marker
921 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsize.Plo@am__quote@ # am--include-marker
922
923 $(am__depfiles_remade):
924 @$(MKDIR_P) $(@D)
925 @echo '# dummy' >$@-t && $(am__mv) $@-t $@
926
927 am--depfiles: $(am__depfiles_remade)
913928
914929 .c.o:
915930 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
10371052 distclean-tags:
10381053 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
10391054
1040 distdir: $(DISTFILES)
1055 distdir: $(BUILT_SOURCES)
1056 $(MAKE) $(AM_MAKEFLAGS) distdir-am
1057
1058 distdir-am: $(DISTFILES)
10411059 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
10421060 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
10431061 list='$(DISTFILES)'; \
11401158 clean-noinstLTLIBRARIES mostlyclean-am
11411159
11421160 distclean: distclean-recursive
1143 -rm -rf ./$(DEPDIR)
1161 -rm -f ./$(DEPDIR)/asnprintf.Plo
1162 -rm -f ./$(DEPDIR)/asprintf.Plo
1163 -rm -f ./$(DEPDIR)/float.Plo
1164 -rm -f ./$(DEPDIR)/getdelim.Plo
1165 -rm -f ./$(DEPDIR)/getline.Plo
1166 -rm -f ./$(DEPDIR)/itold.Plo
1167 -rm -f ./$(DEPDIR)/memchr.Plo
1168 -rm -f ./$(DEPDIR)/printf-args.Plo
1169 -rm -f ./$(DEPDIR)/printf-parse.Plo
1170 -rm -f ./$(DEPDIR)/rawmemchr.Plo
1171 -rm -f ./$(DEPDIR)/strchrnul.Plo
1172 -rm -f ./$(DEPDIR)/strndup.Plo
1173 -rm -f ./$(DEPDIR)/strnlen.Plo
1174 -rm -f ./$(DEPDIR)/vasnprintf.Plo
1175 -rm -f ./$(DEPDIR)/vasprintf.Plo
1176 -rm -f ./$(DEPDIR)/xsize.Plo
11441177 -rm -f Makefile
11451178 distclean-am: clean-am distclean-compile distclean-generic \
11461179 distclean-tags
11861219 installcheck-am:
11871220
11881221 maintainer-clean: maintainer-clean-recursive
1189 -rm -rf ./$(DEPDIR)
1222 -rm -f ./$(DEPDIR)/asnprintf.Plo
1223 -rm -f ./$(DEPDIR)/asprintf.Plo
1224 -rm -f ./$(DEPDIR)/float.Plo
1225 -rm -f ./$(DEPDIR)/getdelim.Plo
1226 -rm -f ./$(DEPDIR)/getline.Plo
1227 -rm -f ./$(DEPDIR)/itold.Plo
1228 -rm -f ./$(DEPDIR)/memchr.Plo
1229 -rm -f ./$(DEPDIR)/printf-args.Plo
1230 -rm -f ./$(DEPDIR)/printf-parse.Plo
1231 -rm -f ./$(DEPDIR)/rawmemchr.Plo
1232 -rm -f ./$(DEPDIR)/strchrnul.Plo
1233 -rm -f ./$(DEPDIR)/strndup.Plo
1234 -rm -f ./$(DEPDIR)/strnlen.Plo
1235 -rm -f ./$(DEPDIR)/vasnprintf.Plo
1236 -rm -f ./$(DEPDIR)/vasprintf.Plo
1237 -rm -f ./$(DEPDIR)/xsize.Plo
11901238 -rm -f Makefile
11911239 maintainer-clean-am: distclean-am maintainer-clean-generic
11921240
12081256 .MAKE: $(am__recursive_targets) all check install install-am \
12091257 install-strip
12101258
1211 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
1212 check-am clean clean-generic clean-libtool \
1259 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
1260 am--depfiles check check-am clean clean-generic clean-libtool \
12131261 clean-noinstLIBRARIES clean-noinstLTLIBRARIES cscopelist-am \
12141262 ctags ctags-am distclean distclean-compile distclean-generic \
12151263 distclean-libtool distclean-tags distdir dvi dvi-am html \
+0
-566
tp/Texinfo/XS/parsetexi/ChangeLog less more
0 2016-12-102-10vin Smith <gavinsmith0123@gmail.com>
1
2 * Parsetexi.pm: Use Texinfo::XSLoader module.
3
4 2016-11-12 Gavin Smith <gavinsmith0123@gmail.com>
5
6 * convert.c (convert_to_normalized): Remove.
7
8 2016-09-21 Gavin Smith <gavinsmith0123@gmail.com>
9
10 * input.c (convert_to_utf8): Start on converting the character
11 encoding of the input.
12
13 2016-07-09 Gavin Smith <gavinsmith0123@gmail.com>
14
15 * convert.c (convert_to_texinfo): New function.
16 (text_convert): Remove.
17
18 2016-06-13 Gavin Smith <gavinsmith0123@gmail.com>
19
20 * Makefile.am (bin_PROGRAMS): Add an independent 'parsetexi'
21 executable again. This will be useful for finding bugs with
22 valgrind.
23
24 2016-05-25 Gavin Smith <gavinsmith0123@gmail.com>
25
26 * context_stack.c: Implement region stack.
27
28 2016-05-22 Gavin Smith <gavinsmith0123@gmail.com>
29
30 * parser.c (mark_and_warn_invalid): Implement.
31
32 2016-05-14 Gavin Smith <gavinsmith0123@gmail.com>
33
34 * Parsetexi.pm: Remove commented-out code to use other methods
35 of getting data from C code.
36
37 2016-03-31 Gavin Smith <gavinsmith0123@gmail.com>
38
39 * texi2any-2-C.pl: Remove file.
40
41 2016-03-31 Gavin Smith <gavinsmith0123@gmail.com>
42
43 * parser.c (process_remaining_on_line): Handle nested @macro.
44
45 2016-03-28 Gavin Smith <gavinsmith0123@gmail.com>
46
47 * Makefile.am: Disable standalone parsetexi program, as building it
48 doesn't work.
49 * command_data.awk: Fix command data for commands given by
50 backslash escapes.
51
52 2016-03-27 Gavin Smith <gavinsmith0123@gmail.com>
53
54 Replace MakeMaker build system with automake/libtool one, copied
55 from XSParagraph.
56 * Parsetexi: Remove subdirectory.
57 * Parsetexi/Parsetexi.xs,
58 * Parsetexi/lib/Parsetexi.pm: Move to top level.
59
60 2015-12-05 Gavin Smith <gavinsmith0123@gmail.com>
61
62 * commands.h (CF_global, CF_global_unique): New flags.
63
64 2015-12-05 Gavin Smith <gavinsmith0123@gmail.com>
65
66 * errors.c (command_warnf, command_errorf): Implement.
67
68 2015-12-01 Gavin Smith <gavinsmith0123@gmail.com>
69
70 * separator.c (remove_empty_content_arguments): Implement.
71
72 2015-12-01 Gavin Smith <gavinsmith0123@gmail.com>
73
74 * api.c (parse_text): Use new function input_push_text_with_line_nos
75 to keep track of line numbers (for tests).
76
77 2015-11-30 Gavin Smith <gavinsmith0123@gmail.com>
78
79 * Parsetexi/lib/Parsetexi.pm (parser): Set conf keys on parser
80 object.
81
82 2015-11-29 Gavin Smith <gavinsmith0123@gmail.com>
83
84 * Parsetexi/lib/Parsetexi.pm (parse_texi_text): Add function.
85
86 2015-11-29 Gavin Smith <gavinsmith0123@gmail.com>
87
88 Update so works again.
89
90 * texi2any-C.pl, texi2any-C-2.pl: Replaced, to match most
91 recent revision.
92 * Parsetexi/lib/Parsetexi.pm: Set 'level' value from value in
93 'extra'.
94 * Match changes made in the main code on 2015-10-02 to make
95 @heading affected by @lowersections.
96
97 2015-06-18 Gavin Smith <gavinsmith0123@gmail.com>
98
99 * parser.c (process_remaining_on_line) <@value> Add element to
100 tree for unexpanded value.
101 * api.c (element_to_perl_hash): Output 'type' as name for
102 unexpanded @value.
103
104 2015-06-15 Gavin Smith <gavinsmith0123@gmail.com>
105
106 * Parsetexi/Parsetexi.xs,
107 * api.c (build_global_info): New function.
108 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Fetch the
109 "global information," including the @documentencoding.
110
111 * parser.c (global_info): New struct variable.
112 * end_line.c (end_line_misc_line) <@documentencoding> Save
113 document encoding.
114
115 2015-04-10 Gavin Smith <gavinsmith0123@gmail.com>
116
117 * end_line.c (end_line_starting_block): Call
118 register_command_arg.
119 * parser.c (process_remaining_on_line) <command with command as
120 argument, like @itemize @bullet>: Set command_as_argument extra
121 value.
122
123 2015-04-10 Gavin Smith <gavinsmith0123@gmail.com>
124
125 * Parsetexi/lib/Parsetexi.pm (parser): Add code to receive
126 "values" configuration value.
127 (parse_texi_line): First implementation.
128 * Parsetexi/Parsetexi.xs (parse_string, store_value)
129 (wipe_values): Expose.
130 * api.c (parse_string): New function.
131 * macro.c (wipe_values): New function.
132
133 2015-04-09 Gavin Smith <gavinsmith0123@gmail.com>
134
135 * end_line.c (parse_line_command_args) <CM_synindex>: Record
136 index synonym.
137 * api.c (build_single_index_data): Create "contained_indices"
138 and "merged_in".
139
140 2015-03-23 Gavin Smith <gavinsmith0123@gmail.com>
141
142 * tree_types.h (enum extra_type): Add extra_def_args.
143 (DEF_ARGS_EXTRA): New type.
144 * api.c (element_to_perl_hash),
145 * dump_perl.c (dump_extra): Handle extra_def_args.
146 * def.c (parse_def, next_bracketed_or_word): First
147 implementations.
148 * end_line.c <ET_def_line>: Call parse_def. Don't record the
149 index entry yet.
150
151 2015-03-14 Gavin Smith <gavinsmith0123@gmail.com>
152
153 * close.c (close_command_cleanup): @multitable handling.
154
155 2015-03-07 Gavin Smith <gavinsmith0123@gmail.com>
156
157 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Handle warnings
158 as well as error messages.
159 * close.c (close_command_cleanup) <CF_blockitem>: More complete.
160 * multitable.c (gather_previous_item): Implement.
161
162 2015-03-06 Gavin Smith <gavinsmith0123@gmail.com>
163
164 * counter.c: New file.
165 * commands.h (command_name): New macro.
166
167 2015-03-01 Gavin Smith <gavinsmith0123@gmail.com>
168
169 * end_line.c (parse_line_commanad_args) <CM_defindex>: Call
170 add_index.
171 * handle_commands.c (handle_misc_command) <CM_node>: Set
172 remaining_args on element.
173 * api.c (element_to_perl_hash): Output 'line_nr'.
174
175 2015-02-27 Gavin Smith <gavinsmith0123@gmail.com>
176
177 * tree_types.h (enum extra_type): Add extra_deleted.
178 * parser.c (abort_empty_line): Remove "spaces_before_argument"
179 extra value.
180 (process_remaining_on_line): Add check for empty input ("EMPTY
181 TEXT").
182
183 2015-02-22 Gavin Smith <gavinsmith0123@gmail.com>
184
185 * macro.c (store_value, fetch_value): New functions.
186 * end_line.c (parse_special_misc_command): First implementation.
187 Handle @value.
188 * handle_commands.c (handle_misc_command) <MISC_special etc.>:
189 More complete.
190 * parser.c (process_remaining_on_line): Handle @value.
191
192 2015-02-18 Gavin Smith <gavinsmith0123@gmail.com>
193
194 * api.c (build_index_data): New function.
195
196 2015-02-16 Gavin Smith <gavinsmith0123@gmail.com>
197
198 * api.c (build_texinfo_tree, build_label_list): New functions,
199 to construct Perl objects directly in memory, as a possible
200 replacement for using "eval" in Perl.
201 * Makefile.am (AM_CFLAGS): Add flags for linking with Perl
202 libraries.
203
204 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Add another
205 way to get data from C program (disabled). (Indices not done
206 yet.)
207
208 2015-02-14 Gavin Smith <gavinsmith0123@gmail.com>
209
210 * tree.c (insert_into_contents): Update parent field of inserted
211 element.
212
213 2015-02-14 Gavin Smith <gavinsmith0123@gmail.com>
214
215 * input.c, Parsetexi/Parsetexi.xs (add_include_directory): New
216 function.
217 * Parsetexi/lib/Parsetexi.pm (parser): Call it.
218 * input.c (input_push_file): Look through list of include
219 directories.
220
221 2015-02-13 Gavin Smith <gavinsmith0123@gmail.com>
222
223 * parser.c (abort_empty_line) <ET_empty_line>: Clear type of
224 ET_empty_line element as intended, instead of deleting it.
225
226 2015-02-12 Gavin Smith <gavinsmith0123@gmail.com>
227
228 * separator.c (register_command_arg): New function.
229 (handle_close_brace, handle_comma) <brace commands with positive
230 number of args>: Call it.
231 * extra.c (add_extra_key_contents_array): New function.
232
233 2015-02-12 Gavin Smith <gavinsmith0123@gmail.com>
234
235 * command_data.txt <brace commands>: Add arg types for all
236 commands (some of these could change).
237
238 2015-02-03 Gavin Smith <gavinsmith0123@gmail.com>
239
240 * parser.c (process_remaining_on_line): Handle @verb.
241
242 2015-02-02 Gavin Smith <gavinsmith0123@gmail.com>
243
244 * parser.c (isolate_last_space, start_empty_line_after_command):
245 Add comments.
246 (big_loop, process_remaining_on_line): Function renamed.
247 <no brace after brace command>: Add commented-out code and
248 comment.
249 * separator.c (handle_open_brace): Set "spaces_before_argument"
250 extra value.
251
252 2015-02-02 Gavin Smith <gavinsmith0123@gmail.com>
253
254 * end_line.c (parse_line_command_args): More complete
255 implementation.
256 (is_decimal_numer): New function split from
257 parse_line_command_args.
258
259 * parser.c (read_command_name): Return null if not looking at a
260 valid command name.
261
262 2015-02-01 Gavin Smith <gavinsmith0123@gmail.com>
263
264 * errors.c: New file.
265 (line_error, line_errorf, dump_errors): New functions.
266 * end_line.c (parse_line_command_args) <@sp>: Call line_errorf
267 if argument is malformed.
268
269 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Fetch error
270 messages.
271
272 * dump_perl.c (dump_line_nr): Arguments changed.
273 * test-files/error.texi: New test file.
274
275 2015-01-31 Gavin Smith <gavinsmith0123@gmail.com>
276
277 * command_data.txt: Specify argument types of the other "misc"
278 commands.
279 * end_line.c (parse_line_command_args): More complete
280 implementation.
281 * parser.c (digit_chars): New variable.
282
283 2015-01-30 Gavin Smith <gavinsmith0123@gmail.com>
284
285 * end_line.c (end_line_misc_line): Set "misc_content" key as
286 intended, instead of "misc_args".
287 <sectioning commands>: Set "level" extra value.
288 * handle_commands.c (handle_misc_command): Add comment.
289
290 * command_data.txt: Add "sectioning" flag for sectioning
291 commands. Add "majorheading". Say that "@printindex" takes 1
292 argument.
293 * end_line.c (parse_line_command_args) <printindex>: Handle.
294
295 * Parsetexi/lib/Parsetexi.pm (_add_parents): Set 'level' value
296 on elements.
297
298 2015-01-24 Gavin Smith <gavinsmith0123@gmail.com>
299
300 * end_line.c (end_line_starting_block, end_line_misc_line):
301 Split functions out of end_line.
302
303 2015-01-24 Gavin Smith <gavinsmith0123@gmail.com>
304
305 * dump_perl.c: In all functions, output to a TEXT object instead
306 of printing to standard output.
307 * parser.c (parse_texi_file): Return type changed.
308
309 * dump_perl.c, Parsetexi/Parsetexi.xs (dump_tree_to_string_1)
310 (dump_tree_to_string_2, dump_tree_to_string_3)
311 (dump_root_element_1, dump_root_element_2): New functions.
312 * Parsetexi/lib/Parsetexi.pm: Call XSUB parse_file and then
313 these new functions, instead of capturing output of separate
314 "parsetexi" executable. Get and eval data from each
315 node/top-level element separately, which is faster than eval-ing
316 a dump of the the entire dump at once.
317
318 2015-01-23 Gavin Smith <gavinsmith0123@gmail.com>
319
320 * indices.c (enter_index_entry): Set 'number' field on index
321 entry.
322 * dump_perl.c (dump_entries_of_index): Output 'number' key for
323 index entry.
324
325 * handle_commands.c (handle_misc_command) <item of enumerate>:
326 Set 'item_number" key (incorrectly).
327
328 * separator.c (handle_open_brace) <brace_command_arg>: Require
329 more than one parameter before adding
330 ET_empty_spaces_before_argument.
331
332 * Parsetexi/lib/Parsetexi.pm (_find_menus_of_node): Don't set
333 'associated_section' by mistake.
334
335 2015-01-23 Gavin Smith <gavinsmith0123@gmail.com>
336
337 * Parsetexi/lib/Parsetexi.pm: Update a comment.
338 * end_line.c (end_line): Check return value of lookup_command
339 correctly.
340
341 * Parsetexi/Parsetexi.xs, Parsetexi/lib/Parsetexi.pm: Remove
342 constant loading code.
343
344 2015-01-23 Gavin Smith <gavinsmith0123@gmail.com>
345
346 * tree_types.h (enum extra_type): Add extra_string value.
347 * extra.c (add_extra_string): New function.
348 * dump_perl.c (dump_extra) <extra_string>: Support.
349
350 * end_line.c (parse_line_command_args): New function.
351 <CM_columnfractions>: Split argument line up by whitespace.
352
353 * end_line.c (end_line) <ET_misc_line_arg>: Call
354 parse_line_command_args, and store result in "misc_args" key.
355 <@multitable @columnfractions>: Copy "misc_args" key into
356 "columnfractions" key.
357 <@multitable prototype line>: Set 'prototypes' extra key,
358 copying from contents of argument container.
359
360 * handle_commands.c (handle_misc_command): Set "cell_number"
361 extra keys for a multitable (not correctly yet).
362 * end_line.c (end_line) <CM_enumerate>: Output
363 "enumerate_specification" key.
364
365 * command_data.txt: Add @heading. Remove root flag from heading
366 commands.
367 * command_data.awk: Correct output of CM_APOSTROPHE symbol.
368
369 2015-01-22 Gavin Smith <gavinsmith0123@gmail.com>
370
371 * parser.c (big_loop) <reading @ command>: Don't advance the
372 line pointer until we are sure we want to process the command
373 name that was just read (and not, for example, do stuff with
374 menus).
375
376 2015-01-21 Gavin Smith <gavinsmith0123@gmail.com>
377
378 * tree_types.h (enum extra_type): New values 'extra_node_spec',
379 'extra_node_spec_array'.
380 (NODE_SPEC_EXTRA): New type.
381 * extra.c (add_extra_node_spec, add_extra_node_spec_array): New
382 functions.
383 * dump_perl.c (dump_extra): Output these two new types of extra
384 key.
385
386 * end_line.c (parse_node_manual): New function.
387
388 * menus.c (register_extra_menu_entry_information): Call
389 parse_node_manual and call add_extra_node_spec with the result.
390 * end_line.c (end_line) <@node>: Create 'nodes_manuals' array
391 and call add_extra_node_spec_array.
392
393 * Parsetexi/lib/Parsetexi.pm (_find_menus_of_node): Don't set
394 any of the 'menu_entry_node' values.
395 (_complete_node_list): Don't set 'node_content' on any of the
396 'nodes_manuals' entries. Set 'normalized' on each node from
397 the first 'nodes_manuals' entry.
398
399 * tree.c (remove_from_contents): New function.
400
401 2015-01-19 Gavin Smith <gavinsmith0123@gmail.com>
402
403 * dump_perl.c (dump_extra) <extra_index_entry>: Don't output
404 current indent.
405 <extra_misc_args>: Escape backslashes and single quotes in
406 output.
407
408 2015-01-19 Gavin Smith <gavinsmith0123@gmail.com>
409
410 * command_data.awk: Output #define's into generated
411 commands_id.h file to give more readable alternatives for the
412 CM_hex_?? enum command_id values.
413 * convert.c (convert_to_normalized): More complete
414 implementation.
415
416 2015-01-18 Gavin Smith <gavinsmith0123@gmail.com>
417
418 * tree_types.h (INDEX_ENTRY_REF): New type.
419 * indices.c (enter_index_entry): Create an INDEX_ENTRY_REF
420 object and store it instead of a pointer to an INDEX_ENTRY,
421 because the latter could be become invalid when the containing
422 array was reallocated.
423 * extra.c (add_extra_key_index_entry): Take an INDEX_ENTRY_REF
424 argument.
425 * indices.c (enter_index_entry): Call to
426 add_extra_key_index_entry updated.
427 * dump_perl.c (dump_extra) <index entry>: Get stored value as an
428 INDEX_ENTRY_REF.
429
430 * parser.c (parse_texi): Always return the root of the tree.
431
432 2015-01-14 Gavin Smith <gavinsmith0123@gmail.com>
433
434 First support of outputting an index.
435
436 * extra.c (add_extra_key_misc_args, add_extra_key_index_entry):
437 New functions.
438 * tree_types.h (INDEX, INDEX_ENTRY): New types.
439 * commands.h (CF_index_entry_command): New flag.
440
441 * indices.c (associate_command_to_index, index_of_command): New
442 functions.
443 (init_index_commands): Call associate_command_to_index for each
444 index command.
445 (enter_index_entry): New function.
446
447 * end_line.c (trim_spaces_comment_from_content): New function.
448 (end_line): Call it in two places.
449 (end_line) <misc args>: Add "misc_args" extra key, and call
450 enter_index_entry for index commands.
451
452 * dump_perl.c (dump_indices_information): New function.
453 (dump_route_to_element): Take extra argument saying which text
454 buffer to write to.
455 (dump_extra): Handle two extra types of extra key,
456 extra_index_entry and extra_misc_args. For extra_index_entry,
457 dump to tree_to_indices_dump variable.
458 (dump_tree_to_perl): Call dump_indices_information, and output
459 tree_to_indices_dump afterwards.
460
461 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Set
462 'index_names' from output of parsetexi.
463
464 * test-files/index.texi: New test file.
465
466 2015-01-12 Gavin Smith <gavinsmith0123@gmail.com>
467
468 All files: Add copyright and licensing notices.
469
470 2014-12-20 Gavin Smith <gavinsmith0123@gmail.com>
471
472 * labels.c: New file.
473
474 * end_line.c (end_line) <@node>: Call register_label.
475 * dump_perl.c (dump_tree_to_perl): Dump information about
476 labels.
477 * Parsetexi/lib/Parsetexi.pm: Set 'labels_information' from
478 dump.
479
480 * convert.c (convert_to_normalized): Stub added.
481
482 2014-12-19 Gavin Smith <gavinsmith0123@gmail.com>
483
484 * element_types.txt: Add menu_entry and menu_star types.
485 * menus.c: New file.
486 (handle_menu, enter_menu_entry_node): Add functions.
487 * parser.c (big_loop): Call handle_menu in menus.c.
488
489 * handle_commands.c (handle_block_command) <menu commands>:
490 Outline of menu handling.
491 * separator.c (handle_separator): Handle separators inside a
492 menu entry.
493 * end_line.c (end_line): Start processing a menu at end of
494 "@menu" line. Handle end of a line inside a menu.
495
496 * Parsetexi/lib/Parsetexi.pm: Complete 'menus' arrays for each
497 node element, and 'menu_entry' 'extra' keys on menu entries.
498
499 * parser.c (isolate_last_space): Take an extra argument giving
500 type of whitespace element.
501 * tree.c (destroy_element): Free the contents and args arrays.
502 (pop_element_from_args): New function.
503
504 2014-12-17 Gavin Smith <gavinsmith0123@gmail.com>
505
506 * tree_types.h (LINE_NR): Fields added to struct.
507 * input.c (line_nr): New variable.
508 (next_text, input_push_text, input_push_file): Update line_nr.
509 * handle_commands.c (handle_misc_command): Record current line
510 number.
511 * dump_perl.c (dump_element): Dump line number if one was
512 recorded. This allows error messages to be printed when
513 makeinfo is run.
514
515 2014-12-14 Gavin Smith <gavinsmith0123@gmail.com>
516
517 * Parsetexi/lib/Parsetexi.pm: Put Texinfo::Report in @ISA.
518 (parser): Set 'gettext' on parser object.
519
520 * tree_types.h (enum route_element_type): New value
521 route_not_in_tree.
522 * dump_perl.c (dump_extra): If extra key marked as not in tree,
523 dump it in the main tree output.
524 * end_line.c (@node): Create a new element with some whitespace
525 elements removed from its contents, and save this as
526 "node_content".
527
528 2014-12-14 Gavin Smith <gavinsmith0123@gmail.com>
529
530 * parser.c (current_node, current_section): New variables.
531 * end_line.c (end_line) <@node>: Set current_node.
532 <root commands>: Set 'associated_node' and 'associated_section'
533 keys, and set current_section.
534
535 * extra.c (lookup_extra_key): New function.
536
537 2014-12-14 Gavin Smith <gavinsmith0123@gmail.com>
538
539 * tree_types.h (ELEMENT): Add fields to save information about
540 'extra' keys on an element.
541 * extra.c: New file.
542 * dump_perl.c (dump_tree_to_perl): Dump lines filling in 'extra'
543 keys at the end.
544 * tree_types.h (ELEMENT): Extra fields added to aid dumping.
545
546 * end_line.c <@node>: Call 'add_extra_key_contents' to set
547 "node_content" key.
548 * Parsetexi/lib/Parsetexi.pm (_complete_node_list): Comment out
549 code setting "node_content" keys on node elements.
550
551 * text.c (text_printf): New function.
552
553 2014-12-12 Gavin Smith <gavinsmith0123@gmail.com>
554
555 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Set
556 'node_content' extra key on each node element as well as in the
557 elements in the 'node_manuals' array. This means that node
558 names appear in the node information line in the Info output.
559
560 2014-12-12 Gavin Smith <gavinsmith0123@gmail.com>
561
562 * Parsetexi/lib/Parsetexi.pm (parse_texi_file): Set
563 'input_file_name' in document information. This allows running
564 "./makeinfo test-files/hello.texi", and getting an output file
565 "hello.info".
6767 @EXPORT = qw(
6868 );
6969
70 $VERSION = '5.1.90';
70 $VERSION = '6.5.91';
7171
7272 # i18n
7373 sub N__($)
+0
-111
tp/Texinfo/XS/parsetexi/Makefile.am less more
0 AUTOMAKE_OPTIONS=foreign subdir-objects
1
2 ACLOCAL_AMFLAGS=-I m4
3
4 EXTRA_DIST=
5 CLEANFILES =
6
7 modulesdir = $(pkgdatadir)/Texinfo/XS/parsetexi
8 dist_modules_DATA = Parsetexi.pm
9
10
11 xsdir = $(pkglibdir)
12
13 PERL_INC = $(PERL_CONF_archlibexp)/CORE
14
15 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap -typemap typemap
16
17 .xs.c:
18 $(XSUBPP) $(XSUBPPARGS) $< > $*.xsc && mv $*.xsc $*.c
19
20 # bin_PROGRAMS=parsetexi
21 xs_LTLIBRARIES = Parsetexi.la
22
23 CLEANFILES += Parsetexi.c
24 EXTRA_DIST += Parsetexi.xs typemap
25
26 # Override these variables set by configure at the top level, because
27 # the compiler used in this subdirectory might be different.
28 # PERL_EXT_var are user variables, allowing configuring at the top-level
29 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
30
31 CFLAGS = $(PERL_EXT_CFLAGS)
32 CPPFLAGS = $(PERL_EXT_CPPFLAGS)
33 LDFLAGS = $(PERL_EXT_LDFLAGS)
34
35 AM_CFLAGS = $(PERL_CONF_ccflags)
36
37 Parsetexi_la_CFLAGS = $(AM_CFLAGS)
38 Parsetexi_la_CFLAGS += -DVERSION=\"$(VERSION)\" "-I$(PERL_INC)"
39
40 AM_LDFLAGS = -no-undefined -L$(PERL_INC) $(PERL_CONF_libperl)
41 AM_LDFLAGS += -avoid-version -module $(PERL_CONF_ccdlflags)
42 # The -no-undefined flag is for MS-Windows. See info node
43 # `(gnulib)Libtool and Windows'. The -L and -l options after it show
44 # where to find the undefined symbols.
45
46
47 Parsetexi_la_SOURCES= Parsetexi.c \
48 api.c api.h \
49 parser.c parser.h tree_types.h \
50 element_types.c element_types.h \
51 commands.c commands.h \
52 command_ids.h \
53 input.c input.h \
54 tree.c tree.h close.c \
55 text.c text.h \
56 context_stack.c context_stack.h \
57 debug.c \
58 convert.c convert.h \
59 end_line.c \
60 separator.c \
61 multitable.c \
62 indices.c indices.h \
63 macro.c macro.h \
64 handle_commands.c handle_commands.h \
65 def.c def.h \
66 extra.c \
67 menus.c \
68 labels.c labels.h \
69 errors.c errors.h \
70 counter.c counter.h
71 EXTRA_DIST += command_data.c
72
73 Parsetexi_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
74 Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBICONV)
75
76 AM_CPPFLAGS = \
77 -I$(top_srcdir) \
78 -I$(top_srcdir)/gnulib/lib \
79 -I$(top_builddir)/gnulib/lib
80
81 # parsetexi_SOURCES=$(Parsetexi_la_SOURCES) main.c
82 # parsetexi_CFLAGS = -DVERSION=\"$(VERSION)\" "-I$(PERL_INC)"
83 #
84 # # TODO: should -lpthread come from the Perl conf?
85 # parsetexi_LDFLAGS = $(AM_LDFLAGS) -lpthread
86
87
88 BUILT_SOURCES=element_types.c element_types.h \
89 command_data.c command_ids.h
90
91 # Need to be distributed
92 EXTRA_DIST+=element_types.txt element_types.awk \
93 command_data.txt command_data.awk
94
95 # For reference
96 EXTRA_DIST+=Common.pm Parser-5556.pm
97
98 EXTRA_DIST+=complete_tree.pl
99
100 # Notes
101 EXTRA_DIST+=debug_perl.txt makeinfo-debug.txt
102
103 $(srcdir)/element_types.c $(srcdir)/element_types.h: element_types.txt element_types.awk
104 awk -v srcdir=$(srcdir) -f $(srcdir)/element_types.awk \
105 $(srcdir)/element_types.txt
106
107 $(srcdir)/command_data.c $(srcdir)/command_ids.h: command_data.txt command_data.awk
108 awk -v srcdir=$(srcdir) -f $(srcdir)/command_data.awk \
109 $(srcdir)/command_data.txt
110
+0
-1369
tp/Texinfo/XS/parsetexi/Makefile.in less more
0 # Makefile.in generated by automake 1.15 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
4
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16
17 VPATH = @srcdir@
18 am__is_gnu_make = { \
19 if test -z '$(MAKELEVEL)'; then \
20 false; \
21 elif test -n '$(MAKE_HOST)'; then \
22 true; \
23 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
24 true; \
25 else \
26 false; \
27 fi; \
28 }
29 am__make_running_with_option = \
30 case $${target_option-} in \
31 ?) ;; \
32 *) echo "am__make_running_with_option: internal error: invalid" \
33 "target option '$${target_option-}' specified" >&2; \
34 exit 1;; \
35 esac; \
36 has_opt=no; \
37 sane_makeflags=$$MAKEFLAGS; \
38 if $(am__is_gnu_make); then \
39 sane_makeflags=$$MFLAGS; \
40 else \
41 case $$MAKEFLAGS in \
42 *\\[\ \ ]*) \
43 bs=\\; \
44 sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
45 | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
46 esac; \
47 fi; \
48 skip_next=no; \
49 strip_trailopt () \
50 { \
51 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
52 }; \
53 for flg in $$sane_makeflags; do \
54 test $$skip_next = yes && { skip_next=no; continue; }; \
55 case $$flg in \
56 *=*|--*) continue;; \
57 -*I) strip_trailopt 'I'; skip_next=yes;; \
58 -*I?*) strip_trailopt 'I';; \
59 -*O) strip_trailopt 'O'; skip_next=yes;; \
60 -*O?*) strip_trailopt 'O';; \
61 -*l) strip_trailopt 'l'; skip_next=yes;; \
62 -*l?*) strip_trailopt 'l';; \
63 -[dEDm]) skip_next=yes;; \
64 -[JT]) skip_next=yes;; \
65 esac; \
66 case $$flg in \
67 *$$target_option*) has_opt=yes; break;; \
68 esac; \
69 done; \
70 test $$has_opt = yes
71 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
72 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
73 pkgdatadir = $(datadir)/@PACKAGE@
74 pkgincludedir = $(includedir)/@PACKAGE@
75 pkglibdir = $(libdir)/@PACKAGE@
76 pkglibexecdir = $(libexecdir)/@PACKAGE@
77 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
78 install_sh_DATA = $(install_sh) -c -m 644
79 install_sh_PROGRAM = $(install_sh) -c
80 install_sh_SCRIPT = $(install_sh) -c
81 INSTALL_HEADER = $(INSTALL_DATA)
82 transform = $(program_transform_name)
83 NORMAL_INSTALL = :
84 PRE_INSTALL = :
85 POST_INSTALL = :
86 NORMAL_UNINSTALL = :
87 PRE_UNINSTALL = :
88 POST_UNINSTALL = :
89 build_triplet = @build@
90 host_triplet = @host@
91 subdir = parsetexi
92 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
93 am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/00gnulib.m4 \
94 $(top_srcdir)/gnulib/m4/absolute-header.m4 \
95 $(top_srcdir)/gnulib/m4/alloca.m4 \
96 $(top_srcdir)/gnulib/m4/errno_h.m4 \
97 $(top_srcdir)/gnulib/m4/exponentd.m4 \
98 $(top_srcdir)/gnulib/m4/extensions.m4 \
99 $(top_srcdir)/gnulib/m4/extern-inline.m4 \
100 $(top_srcdir)/gnulib/m4/float_h.m4 \
101 $(top_srcdir)/gnulib/m4/getdelim.m4 \
102 $(top_srcdir)/gnulib/m4/getline.m4 \
103 $(top_srcdir)/gnulib/m4/gnulib-common.m4 \
104 $(top_srcdir)/gnulib/m4/gnulib-comp.m4 \
105 $(top_srcdir)/gnulib/m4/host-cpu-c-abi.m4 \
106 $(top_srcdir)/gnulib/m4/iconv.m4 \
107 $(top_srcdir)/gnulib/m4/include_next.m4 \
108 $(top_srcdir)/gnulib/m4/intmax_t.m4 \
109 $(top_srcdir)/gnulib/m4/inttypes_h.m4 \
110 $(top_srcdir)/gnulib/m4/lib-ld.m4 \
111 $(top_srcdir)/gnulib/m4/lib-link.m4 \
112 $(top_srcdir)/gnulib/m4/lib-prefix.m4 \
113 $(top_srcdir)/gnulib/m4/libtool.m4 \
114 $(top_srcdir)/gnulib/m4/limits-h.m4 \
115 $(top_srcdir)/gnulib/m4/longlong.m4 \
116 $(top_srcdir)/gnulib/m4/ltoptions.m4 \
117 $(top_srcdir)/gnulib/m4/ltsugar.m4 \
118 $(top_srcdir)/gnulib/m4/ltversion.m4 \
119 $(top_srcdir)/gnulib/m4/lt~obsolete.m4 \
120 $(top_srcdir)/gnulib/m4/memchr.m4 \
121 $(top_srcdir)/gnulib/m4/mmap-anon.m4 \
122 $(top_srcdir)/gnulib/m4/multiarch.m4 \
123 $(top_srcdir)/gnulib/m4/off_t.m4 \
124 $(top_srcdir)/gnulib/m4/printf.m4 \
125 $(top_srcdir)/gnulib/m4/rawmemchr.m4 \
126 $(top_srcdir)/gnulib/m4/size_max.m4 \
127 $(top_srcdir)/gnulib/m4/ssize_t.m4 \
128 $(top_srcdir)/gnulib/m4/stddef_h.m4 \
129 $(top_srcdir)/gnulib/m4/stdint.m4 \
130 $(top_srcdir)/gnulib/m4/stdint_h.m4 \
131 $(top_srcdir)/gnulib/m4/stdio_h.m4 \
132 $(top_srcdir)/gnulib/m4/strchrnul.m4 \
133 $(top_srcdir)/gnulib/m4/string_h.m4 \
134 $(top_srcdir)/gnulib/m4/strndup.m4 \
135 $(top_srcdir)/gnulib/m4/strnlen.m4 \
136 $(top_srcdir)/gnulib/m4/sys_types_h.m4 \
137 $(top_srcdir)/gnulib/m4/vasnprintf.m4 \
138 $(top_srcdir)/gnulib/m4/vasprintf.m4 \
139 $(top_srcdir)/gnulib/m4/warn-on-use.m4 \
140 $(top_srcdir)/gnulib/m4/wchar_h.m4 \
141 $(top_srcdir)/gnulib/m4/wchar_t.m4 \
142 $(top_srcdir)/gnulib/m4/wint_t.m4 \
143 $(top_srcdir)/gnulib/m4/xsize.m4 $(top_srcdir)/configure.ac
144 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
145 $(ACLOCAL_M4)
146 DIST_COMMON = $(srcdir)/Makefile.am $(dist_modules_DATA) \
147 $(am__DIST_COMMON)
148 mkinstalldirs = $(install_sh) -d
149 CONFIG_HEADER = $(top_builddir)/config.h
150 CONFIG_CLEAN_FILES =
151 CONFIG_CLEAN_VPATH_FILES =
152 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
153 am__vpath_adj = case $$p in \
154 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
155 *) f=$$p;; \
156 esac;
157 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
158 am__install_max = 40
159 am__nobase_strip_setup = \
160 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
161 am__nobase_strip = \
162 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
163 am__nobase_list = $(am__nobase_strip_setup); \
164 for p in $$list; do echo "$$p $$p"; done | \
165 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
166 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
167 if (++n[$$2] == $(am__install_max)) \
168 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
169 END { for (dir in files) print dir, files[dir] }'
170 am__base_list = \
171 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
172 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
173 am__uninstall_files_from_dir = { \
174 test -z "$$files" \
175 || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
176 || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
177 $(am__cd) "$$dir" && rm -f $$files; }; \
178 }
179 am__installdirs = "$(DESTDIR)$(xsdir)" "$(DESTDIR)$(modulesdir)"
180 LTLIBRARIES = $(xs_LTLIBRARIES)
181 Parsetexi_la_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.la
182 am_Parsetexi_la_OBJECTS = Parsetexi_la-Parsetexi.lo \
183 Parsetexi_la-api.lo Parsetexi_la-parser.lo \
184 Parsetexi_la-element_types.lo Parsetexi_la-commands.lo \
185 Parsetexi_la-input.lo Parsetexi_la-tree.lo \
186 Parsetexi_la-close.lo Parsetexi_la-text.lo \
187 Parsetexi_la-context_stack.lo Parsetexi_la-debug.lo \
188 Parsetexi_la-convert.lo Parsetexi_la-end_line.lo \
189 Parsetexi_la-separator.lo Parsetexi_la-multitable.lo \
190 Parsetexi_la-indices.lo Parsetexi_la-macro.lo \
191 Parsetexi_la-handle_commands.lo Parsetexi_la-def.lo \
192 Parsetexi_la-extra.lo Parsetexi_la-menus.lo \
193 Parsetexi_la-labels.lo Parsetexi_la-errors.lo \
194 Parsetexi_la-counter.lo
195 Parsetexi_la_OBJECTS = $(am_Parsetexi_la_OBJECTS)
196 AM_V_lt = $(am__v_lt_@AM_V@)
197 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
198 am__v_lt_0 = --silent
199 am__v_lt_1 =
200 Parsetexi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
201 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(Parsetexi_la_CFLAGS) \
202 $(CFLAGS) $(Parsetexi_la_LDFLAGS) $(LDFLAGS) -o $@
203 AM_V_P = $(am__v_P_@AM_V@)
204 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
205 am__v_P_0 = false
206 am__v_P_1 = :
207 AM_V_GEN = $(am__v_GEN_@AM_V@)
208 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
209 am__v_GEN_0 = @echo " GEN " $@;
210 am__v_GEN_1 =
211 AM_V_at = $(am__v_at_@AM_V@)
212 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
213 am__v_at_0 = @
214 am__v_at_1 =
215 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
216 depcomp = $(SHELL) $(top_srcdir)/depcomp
217 am__depfiles_maybe = depfiles
218 am__mv = mv -f
219 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
220 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
221 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
222 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
223 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
224 $(AM_CFLAGS) $(CFLAGS)
225 AM_V_CC = $(am__v_CC_@AM_V@)
226 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
227 am__v_CC_0 = @echo " CC " $@;
228 am__v_CC_1 =
229 CCLD = $(CC)
230 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
231 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
232 $(AM_LDFLAGS) $(LDFLAGS) -o $@
233 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
234 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
235 am__v_CCLD_0 = @echo " CCLD " $@;
236 am__v_CCLD_1 =
237 SOURCES = $(Parsetexi_la_SOURCES)
238 DIST_SOURCES = $(Parsetexi_la_SOURCES)
239 am__can_run_installinfo = \
240 case $$AM_UPDATE_INFO_DIR in \
241 n|no|NO) false;; \
242 *) (install-info --version) >/dev/null 2>&1;; \
243 esac
244 DATA = $(dist_modules_DATA)
245 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
246 # Read a list of newline-separated strings from the standard input,
247 # and print each of them once, without duplicates. Input order is
248 # *not* preserved.
249 am__uniquify_input = $(AWK) '\
250 BEGIN { nonempty = 0; } \
251 { items[$$0] = 1; nonempty = 1; } \
252 END { if (nonempty) { for (i in items) print i; }; } \
253 '
254 # Make sure the list of sources is unique. This is necessary because,
255 # e.g., the same source file might be shared among _SOURCES variables
256 # for different programs/libraries.
257 am__define_uniq_tagged_files = \
258 list='$(am__tagged_files)'; \
259 unique=`for i in $$list; do \
260 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
261 done | $(am__uniquify_input)`
262 ETAGS = etags
263 CTAGS = ctags
264 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
265 ChangeLog README TODO
266 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
267 ACLOCAL = @ACLOCAL@
268 ALLOCA = @ALLOCA@
269 ALLOCA_H = @ALLOCA_H@
270 AMTAR = @AMTAR@
271 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
272 APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
273 AR = @AR@
274 ARFLAGS = @ARFLAGS@
275 AUTOCONF = @AUTOCONF@
276 AUTOHEADER = @AUTOHEADER@
277 AUTOMAKE = @AUTOMAKE@
278 AWK = @AWK@
279 BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
280 BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
281 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
282 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
283 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
284 CC = @CC@
285 CCDEPMODE = @CCDEPMODE@
286
287 # Override these variables set by configure at the top level, because
288 # the compiler used in this subdirectory might be different.
289 # PERL_EXT_var are user variables, allowing configuring at the top-level
290 # with e.g. "./configure CFLAGS='-g -O0' PERL_EXT_CFLAGS='-g'".
291 CFLAGS = $(PERL_EXT_CFLAGS)
292 CPP = @CPP@
293 CPPFLAGS = $(PERL_EXT_CPPFLAGS)
294 CYGPATH_W = @CYGPATH_W@
295 DEFS = @DEFS@
296 DEPDIR = @DEPDIR@
297 DLLTOOL = @DLLTOOL@
298 DSYMUTIL = @DSYMUTIL@
299 DUMPBIN = @DUMPBIN@
300 ECHO_C = @ECHO_C@
301 ECHO_N = @ECHO_N@
302 ECHO_T = @ECHO_T@
303 EGREP = @EGREP@
304 EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
305 EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
306 ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
307 ENOLINK_VALUE = @ENOLINK_VALUE@
308 EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
309 EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
310 ERRNO_H = @ERRNO_H@
311 EXEEXT = @EXEEXT@
312 FGREP = @FGREP@
313 FLOAT_H = @FLOAT_H@
314 GNULIB_BTOWC = @GNULIB_BTOWC@
315 GNULIB_DPRINTF = @GNULIB_DPRINTF@
316 GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@
317 GNULIB_FCLOSE = @GNULIB_FCLOSE@
318 GNULIB_FDOPEN = @GNULIB_FDOPEN@
319 GNULIB_FFLUSH = @GNULIB_FFLUSH@
320 GNULIB_FFSL = @GNULIB_FFSL@
321 GNULIB_FFSLL = @GNULIB_FFSLL@
322 GNULIB_FGETC = @GNULIB_FGETC@
323 GNULIB_FGETS = @GNULIB_FGETS@
324 GNULIB_FOPEN = @GNULIB_FOPEN@
325 GNULIB_FPRINTF = @GNULIB_FPRINTF@
326 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
327 GNULIB_FPURGE = @GNULIB_FPURGE@
328 GNULIB_FPUTC = @GNULIB_FPUTC@
329 GNULIB_FPUTS = @GNULIB_FPUTS@
330 GNULIB_FREAD = @GNULIB_FREAD@
331 GNULIB_FREOPEN = @GNULIB_FREOPEN@
332 GNULIB_FSCANF = @GNULIB_FSCANF@
333 GNULIB_FSEEK = @GNULIB_FSEEK@
334 GNULIB_FSEEKO = @GNULIB_FSEEKO@
335 GNULIB_FTELL = @GNULIB_FTELL@
336 GNULIB_FTELLO = @GNULIB_FTELLO@
337 GNULIB_FWRITE = @GNULIB_FWRITE@
338 GNULIB_GETC = @GNULIB_GETC@
339 GNULIB_GETCHAR = @GNULIB_GETCHAR@
340 GNULIB_GETDELIM = @GNULIB_GETDELIM@
341 GNULIB_GETLINE = @GNULIB_GETLINE@
342 GNULIB_MBRLEN = @GNULIB_MBRLEN@
343 GNULIB_MBRTOWC = @GNULIB_MBRTOWC@
344 GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
345 GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
346 GNULIB_MBSCHR = @GNULIB_MBSCHR@
347 GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
348 GNULIB_MBSINIT = @GNULIB_MBSINIT@
349 GNULIB_MBSLEN = @GNULIB_MBSLEN@
350 GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
351 GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
352 GNULIB_MBSNRTOWCS = @GNULIB_MBSNRTOWCS@
353 GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
354 GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
355 GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
356 GNULIB_MBSRTOWCS = @GNULIB_MBSRTOWCS@
357 GNULIB_MBSSEP = @GNULIB_MBSSEP@
358 GNULIB_MBSSPN = @GNULIB_MBSSPN@
359 GNULIB_MBSSTR = @GNULIB_MBSSTR@
360 GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
361 GNULIB_MEMCHR = @GNULIB_MEMCHR@
362 GNULIB_MEMMEM = @GNULIB_MEMMEM@
363 GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
364 GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
365 GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@
366 GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@
367 GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@
368 GNULIB_PCLOSE = @GNULIB_PCLOSE@
369 GNULIB_PERROR = @GNULIB_PERROR@
370 GNULIB_POPEN = @GNULIB_POPEN@
371 GNULIB_PRINTF = @GNULIB_PRINTF@
372 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
373 GNULIB_PUTC = @GNULIB_PUTC@
374 GNULIB_PUTCHAR = @GNULIB_PUTCHAR@
375 GNULIB_PUTS = @GNULIB_PUTS@
376 GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@
377 GNULIB_REMOVE = @GNULIB_REMOVE@
378 GNULIB_RENAME = @GNULIB_RENAME@
379 GNULIB_RENAMEAT = @GNULIB_RENAMEAT@
380 GNULIB_SCANF = @GNULIB_SCANF@
381 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
382 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
383 GNULIB_STDIO_H_NONBLOCKING = @GNULIB_STDIO_H_NONBLOCKING@
384 GNULIB_STDIO_H_SIGPIPE = @GNULIB_STDIO_H_SIGPIPE@
385 GNULIB_STPCPY = @GNULIB_STPCPY@
386 GNULIB_STPNCPY = @GNULIB_STPNCPY@
387 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
388 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
389 GNULIB_STRDUP = @GNULIB_STRDUP@
390 GNULIB_STRERROR = @GNULIB_STRERROR@
391 GNULIB_STRERROR_R = @GNULIB_STRERROR_R@
392 GNULIB_STRNCAT = @GNULIB_STRNCAT@
393 GNULIB_STRNDUP = @GNULIB_STRNDUP@
394 GNULIB_STRNLEN = @GNULIB_STRNLEN@
395 GNULIB_STRPBRK = @GNULIB_STRPBRK@
396 GNULIB_STRSEP = @GNULIB_STRSEP@
397 GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
398 GNULIB_STRSTR = @GNULIB_STRSTR@
399 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
400 GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@
401 GNULIB_TMPFILE = @GNULIB_TMPFILE@
402 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
403 GNULIB_VDPRINTF = @GNULIB_VDPRINTF@
404 GNULIB_VFPRINTF = @GNULIB_VFPRINTF@
405 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
406 GNULIB_VFSCANF = @GNULIB_VFSCANF@
407 GNULIB_VPRINTF = @GNULIB_VPRINTF@
408 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
409 GNULIB_VSCANF = @GNULIB_VSCANF@
410 GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
411 GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
412 GNULIB_WCPCPY = @GNULIB_WCPCPY@
413 GNULIB_WCPNCPY = @GNULIB_WCPNCPY@
414 GNULIB_WCRTOMB = @GNULIB_WCRTOMB@
415 GNULIB_WCSCASECMP = @GNULIB_WCSCASECMP@
416 GNULIB_WCSCAT = @GNULIB_WCSCAT@
417 GNULIB_WCSCHR = @GNULIB_WCSCHR@
418 GNULIB_WCSCMP = @GNULIB_WCSCMP@
419 GNULIB_WCSCOLL = @GNULIB_WCSCOLL@
420 GNULIB_WCSCPY = @GNULIB_WCSCPY@
421 GNULIB_WCSCSPN = @GNULIB_WCSCSPN@
422 GNULIB_WCSDUP = @GNULIB_WCSDUP@
423 GNULIB_WCSFTIME = @GNULIB_WCSFTIME@
424 GNULIB_WCSLEN = @GNULIB_WCSLEN@
425 GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@
426 GNULIB_WCSNCAT = @GNULIB_WCSNCAT@
427 GNULIB_WCSNCMP = @GNULIB_WCSNCMP@
428 GNULIB_WCSNCPY = @GNULIB_WCSNCPY@
429 GNULIB_WCSNLEN = @GNULIB_WCSNLEN@
430 GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@
431 GNULIB_WCSPBRK = @GNULIB_WCSPBRK@
432 GNULIB_WCSRCHR = @GNULIB_WCSRCHR@
433 GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@
434 GNULIB_WCSSPN = @GNULIB_WCSSPN@
435 GNULIB_WCSSTR = @GNULIB_WCSSTR@
436 GNULIB_WCSTOK = @GNULIB_WCSTOK@
437 GNULIB_WCSWIDTH = @GNULIB_WCSWIDTH@
438 GNULIB_WCSXFRM = @GNULIB_WCSXFRM@
439 GNULIB_WCTOB = @GNULIB_WCTOB@
440 GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
441 GNULIB_WMEMCHR = @GNULIB_WMEMCHR@
442 GNULIB_WMEMCMP = @GNULIB_WMEMCMP@
443 GNULIB_WMEMCPY = @GNULIB_WMEMCPY@
444 GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@
445 GNULIB_WMEMSET = @GNULIB_WMEMSET@
446 GREP = @GREP@
447 HAVE_BTOWC = @HAVE_BTOWC@
448 HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
449 HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@
450 HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@
451 HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@
452 HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@
453 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
454 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
455 HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
456 HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
457 HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
458 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
459 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
460 HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
461 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
462 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
463 HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
464 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
465 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
466 HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@
467 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
468 HAVE_DPRINTF = @HAVE_DPRINTF@
469 HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@
470 HAVE_FEATURES_H = @HAVE_FEATURES_H@
471 HAVE_FFSL = @HAVE_FFSL@
472 HAVE_FFSLL = @HAVE_FFSLL@
473 HAVE_FSEEKO = @HAVE_FSEEKO@
474 HAVE_FTELLO = @HAVE_FTELLO@
475 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
476 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
477 HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
478 HAVE_MBRLEN = @HAVE_MBRLEN@
479 HAVE_MBRTOWC = @HAVE_MBRTOWC@
480 HAVE_MBSINIT = @HAVE_MBSINIT@
481 HAVE_MBSLEN = @HAVE_MBSLEN@
482 HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
483 HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
484 HAVE_MEMCHR = @HAVE_MEMCHR@
485 HAVE_MEMPCPY = @HAVE_MEMPCPY@
486 HAVE_PCLOSE = @HAVE_PCLOSE@
487 HAVE_POPEN = @HAVE_POPEN@
488 HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
489 HAVE_RENAMEAT = @HAVE_RENAMEAT@
490 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
491 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
492 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
493 HAVE_STDINT_H = @HAVE_STDINT_H@
494 HAVE_STPCPY = @HAVE_STPCPY@
495 HAVE_STPNCPY = @HAVE_STPNCPY@
496 HAVE_STRCASESTR = @HAVE_STRCASESTR@
497 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
498 HAVE_STRPBRK = @HAVE_STRPBRK@
499 HAVE_STRSEP = @HAVE_STRSEP@
500 HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
501 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
502 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
503 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
504 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
505 HAVE_VASPRINTF = @HAVE_VASPRINTF@
506 HAVE_VDPRINTF = @HAVE_VDPRINTF@
507 HAVE_WCHAR_H = @HAVE_WCHAR_H@
508 HAVE_WCHAR_T = @HAVE_WCHAR_T@
509 HAVE_WCPCPY = @HAVE_WCPCPY@
510 HAVE_WCPNCPY = @HAVE_WCPNCPY@
511 HAVE_WCRTOMB = @HAVE_WCRTOMB@
512 HAVE_WCSCASECMP = @HAVE_WCSCASECMP@
513 HAVE_WCSCAT = @HAVE_WCSCAT@
514 HAVE_WCSCHR = @HAVE_WCSCHR@
515 HAVE_WCSCMP = @HAVE_WCSCMP@
516 HAVE_WCSCOLL = @HAVE_WCSCOLL@
517 HAVE_WCSCPY = @HAVE_WCSCPY@
518 HAVE_WCSCSPN = @HAVE_WCSCSPN@
519 HAVE_WCSDUP = @HAVE_WCSDUP@
520 HAVE_WCSFTIME = @HAVE_WCSFTIME@
521 HAVE_WCSLEN = @HAVE_WCSLEN@
522 HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@
523 HAVE_WCSNCAT = @HAVE_WCSNCAT@
524 HAVE_WCSNCMP = @HAVE_WCSNCMP@
525 HAVE_WCSNCPY = @HAVE_WCSNCPY@
526 HAVE_WCSNLEN = @HAVE_WCSNLEN@
527 HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
528 HAVE_WCSPBRK = @HAVE_WCSPBRK@
529 HAVE_WCSRCHR = @HAVE_WCSRCHR@
530 HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
531 HAVE_WCSSPN = @HAVE_WCSSPN@
532 HAVE_WCSSTR = @HAVE_WCSSTR@
533 HAVE_WCSTOK = @HAVE_WCSTOK@
534 HAVE_WCSWIDTH = @HAVE_WCSWIDTH@
535 HAVE_WCSXFRM = @HAVE_WCSXFRM@
536 HAVE_WINT_T = @HAVE_WINT_T@
537 HAVE_WMEMCHR = @HAVE_WMEMCHR@
538 HAVE_WMEMCMP = @HAVE_WMEMCMP@
539 HAVE_WMEMCPY = @HAVE_WMEMCPY@
540 HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
541 HAVE_WMEMSET = @HAVE_WMEMSET@
542 INCLUDE_NEXT = @INCLUDE_NEXT@
543 INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
544 INSTALL = @INSTALL@
545 INSTALL_DATA = @INSTALL_DATA@
546 INSTALL_PROGRAM = @INSTALL_PROGRAM@
547 INSTALL_SCRIPT = @INSTALL_SCRIPT@
548 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
549 LD = @LD@
550 LDFLAGS = $(PERL_EXT_LDFLAGS)
551 LIBICONV = @LIBICONV@
552 LIBOBJS = @LIBOBJS@
553 LIBS = @LIBS@
554 LIBTOOL = @LIBTOOL@
555 LIMITS_H = @LIMITS_H@
556 LIPO = @LIPO@
557 LN_S = @LN_S@
558 LTLIBICONV = @LTLIBICONV@
559 LTLIBOBJS = @LTLIBOBJS@
560 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
561 MAKEINFO = @MAKEINFO@
562 MANIFEST_TOOL = @MANIFEST_TOOL@
563 MKDIR_P = @MKDIR_P@
564 NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
565 NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@
566 NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@
567 NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
568 NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
569 NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
570 NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
571 NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
572 NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
573 NEXT_ERRNO_H = @NEXT_ERRNO_H@
574 NEXT_FLOAT_H = @NEXT_FLOAT_H@
575 NEXT_LIMITS_H = @NEXT_LIMITS_H@
576 NEXT_STDDEF_H = @NEXT_STDDEF_H@
577 NEXT_STDINT_H = @NEXT_STDINT_H@
578 NEXT_STDIO_H = @NEXT_STDIO_H@
579 NEXT_STRING_H = @NEXT_STRING_H@
580 NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
581 NEXT_WCHAR_H = @NEXT_WCHAR_H@
582 NM = @NM@
583 NMEDIT = @NMEDIT@
584 OBJDUMP = @OBJDUMP@
585 OBJEXT = @OBJEXT@
586 OTOOL = @OTOOL@
587 OTOOL64 = @OTOOL64@
588 PACKAGE = @PACKAGE@
589 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
590 PACKAGE_NAME = @PACKAGE_NAME@
591 PACKAGE_STRING = @PACKAGE_STRING@
592 PACKAGE_TARNAME = @PACKAGE_TARNAME@
593 PACKAGE_URL = @PACKAGE_URL@
594 PACKAGE_VERSION = @PACKAGE_VERSION@
595 PATH_SEPARATOR = @PATH_SEPARATOR@
596 PERL = @PERL@
597 PERL_CONF_archlibexp = @PERL_CONF_archlibexp@
598 PERL_CONF_cc = @PERL_CONF_cc@
599 PERL_CONF_cccdlflags = @PERL_CONF_cccdlflags@
600 PERL_CONF_ccdlflags = @PERL_CONF_ccdlflags@
601 PERL_CONF_ccflags = @PERL_CONF_ccflags@
602 PERL_CONF_libperl = @PERL_CONF_libperl@
603 PERL_CONF_privlibexp = @PERL_CONF_privlibexp@
604 PERL_EXT_CC = @PERL_EXT_CC@
605 PERL_EXT_CFLAGS = @PERL_EXT_CFLAGS@
606 PERL_EXT_CPPFLAGS = @PERL_EXT_CPPFLAGS@
607 PERL_EXT_LDFLAGS = @PERL_EXT_LDFLAGS@
608 PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
609 PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
610 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
611 RANLIB = @RANLIB@
612 REPLACE_BTOWC = @REPLACE_BTOWC@
613 REPLACE_DPRINTF = @REPLACE_DPRINTF@
614 REPLACE_FCLOSE = @REPLACE_FCLOSE@
615 REPLACE_FDOPEN = @REPLACE_FDOPEN@
616 REPLACE_FFLUSH = @REPLACE_FFLUSH@
617 REPLACE_FOPEN = @REPLACE_FOPEN@
618 REPLACE_FPRINTF = @REPLACE_FPRINTF@
619 REPLACE_FPURGE = @REPLACE_FPURGE@
620 REPLACE_FREOPEN = @REPLACE_FREOPEN@
621 REPLACE_FSEEK = @REPLACE_FSEEK@
622 REPLACE_FSEEKO = @REPLACE_FSEEKO@
623 REPLACE_FTELL = @REPLACE_FTELL@
624 REPLACE_FTELLO = @REPLACE_FTELLO@
625 REPLACE_GETDELIM = @REPLACE_GETDELIM@
626 REPLACE_GETLINE = @REPLACE_GETLINE@
627 REPLACE_ITOLD = @REPLACE_ITOLD@
628 REPLACE_MBRLEN = @REPLACE_MBRLEN@
629 REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
630 REPLACE_MBSINIT = @REPLACE_MBSINIT@
631 REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
632 REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
633 REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
634 REPLACE_MEMCHR = @REPLACE_MEMCHR@
635 REPLACE_MEMMEM = @REPLACE_MEMMEM@
636 REPLACE_NULL = @REPLACE_NULL@
637 REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
638 REPLACE_PERROR = @REPLACE_PERROR@
639 REPLACE_POPEN = @REPLACE_POPEN@
640 REPLACE_PRINTF = @REPLACE_PRINTF@
641 REPLACE_REMOVE = @REPLACE_REMOVE@
642 REPLACE_RENAME = @REPLACE_RENAME@
643 REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
644 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
645 REPLACE_SPRINTF = @REPLACE_SPRINTF@
646 REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@
647 REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
648 REPLACE_STPNCPY = @REPLACE_STPNCPY@
649 REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
650 REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
651 REPLACE_STRDUP = @REPLACE_STRDUP@
652 REPLACE_STRERROR = @REPLACE_STRERROR@
653 REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
654 REPLACE_STRNCAT = @REPLACE_STRNCAT@
655 REPLACE_STRNDUP = @REPLACE_STRNDUP@
656 REPLACE_STRNLEN = @REPLACE_STRNLEN@
657 REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
658 REPLACE_STRSTR = @REPLACE_STRSTR@
659 REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
660 REPLACE_TMPFILE = @REPLACE_TMPFILE@
661 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
662 REPLACE_VDPRINTF = @REPLACE_VDPRINTF@
663 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
664 REPLACE_VPRINTF = @REPLACE_VPRINTF@
665 REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
666 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
667 REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
668 REPLACE_WCSFTIME = @REPLACE_WCSFTIME@
669 REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
670 REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
671 REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
672 REPLACE_WCTOB = @REPLACE_WCTOB@
673 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
674 SED = @SED@
675 SET_MAKE = @SET_MAKE@
676 SHELL = @SHELL@
677 SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
678 SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
679 STDDEF_H = @STDDEF_H@
680 STDINT_H = @STDINT_H@
681 STRIP = @STRIP@
682 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
683 VERSION = @VERSION@
684 WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
685 WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
686 WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@
687 WINT_T_SUFFIX = @WINT_T_SUFFIX@
688 XSPARAGRAPH_INTERFACE_VERSION = @XSPARAGRAPH_INTERFACE_VERSION@
689 XSUBPP = @XSUBPP@
690 abs_builddir = @abs_builddir@
691 abs_srcdir = @abs_srcdir@
692 abs_top_builddir = @abs_top_builddir@
693 abs_top_srcdir = @abs_top_srcdir@
694 ac_ct_AR = @ac_ct_AR@
695 ac_ct_CC = @ac_ct_CC@
696 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
697 am__include = @am__include@
698 am__leading_dot = @am__leading_dot@
699 am__quote = @am__quote@
700 am__tar = @am__tar@
701 am__untar = @am__untar@
702 bindir = @bindir@
703 build = @build@
704 build_alias = @build_alias@
705 build_cpu = @build_cpu@
706 build_os = @build_os@
707 build_vendor = @build_vendor@
708 builddir = @builddir@
709 datadir = @datadir@
710 datarootdir = @datarootdir@
711 docdir = @docdir@
712 dvidir = @dvidir@
713 exec_prefix = @exec_prefix@
714 gl_LIBOBJS = @gl_LIBOBJS@
715 gl_LTLIBOBJS = @gl_LTLIBOBJS@
716 gltests_LIBOBJS = @gltests_LIBOBJS@
717 gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
718 gltests_WITNESS = @gltests_WITNESS@
719 host = @host@
720 host_alias = @host_alias@
721 host_cpu = @host_cpu@
722 host_os = @host_os@
723 host_vendor = @host_vendor@
724 htmldir = @htmldir@
725 includedir = @includedir@
726 infodir = @infodir@
727 install_sh = @install_sh@
728 libdir = @libdir@
729 libexecdir = @libexecdir@
730 localedir = @localedir@
731 localstatedir = @localstatedir@
732 mandir = @mandir@
733 mkdir_p = @mkdir_p@
734 oldincludedir = @oldincludedir@
735 pdfdir = @pdfdir@
736 prefix = @prefix@
737 program_transform_name = @program_transform_name@
738 psdir = @psdir@
739 sbindir = @sbindir@
740 sharedstatedir = @sharedstatedir@
741 srcdir = @srcdir@
742 sysconfdir = @sysconfdir@
743 target_alias = @target_alias@
744 top_build_prefix = @top_build_prefix@
745 top_builddir = @top_builddir@
746 top_srcdir = @top_srcdir@
747 AUTOMAKE_OPTIONS = foreign subdir-objects
748 ACLOCAL_AMFLAGS = -I m4
749
750 # Need to be distributed
751
752 # For reference
753
754 # Notes
755 EXTRA_DIST = Parsetexi.xs typemap command_data.c element_types.txt \
756 element_types.awk command_data.txt command_data.awk Common.pm \
757 Parser-5556.pm complete_tree.pl debug_perl.txt \
758 makeinfo-debug.txt
759 CLEANFILES = Parsetexi.c
760 modulesdir = $(pkgdatadir)/Texinfo/XS/parsetexi
761 dist_modules_DATA = Parsetexi.pm
762 xsdir = $(pkglibdir)
763 PERL_INC = $(PERL_CONF_archlibexp)/CORE
764 XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap -typemap typemap
765
766 # bin_PROGRAMS=parsetexi
767 xs_LTLIBRARIES = Parsetexi.la
768 AM_CFLAGS = $(PERL_CONF_ccflags)
769 Parsetexi_la_CFLAGS = $(AM_CFLAGS) -DVERSION=\"$(VERSION)\" \
770 "-I$(PERL_INC)"
771 AM_LDFLAGS = -no-undefined -L$(PERL_INC) $(PERL_CONF_libperl) \
772 -avoid-version -module $(PERL_CONF_ccdlflags)
773 # The -no-undefined flag is for MS-Windows. See info node
774 # `(gnulib)Libtool and Windows'. The -L and -l options after it show
775 # where to find the undefined symbols.
776 Parsetexi_la_SOURCES = Parsetexi.c \
777 api.c api.h \
778 parser.c parser.h tree_types.h \
779 element_types.c element_types.h \
780 commands.c commands.h \
781 command_ids.h \
782 input.c input.h \
783 tree.c tree.h close.c \
784 text.c text.h \
785 context_stack.c context_stack.h \
786 debug.c \
787 convert.c convert.h \
788 end_line.c \
789 separator.c \
790 multitable.c \
791 indices.c indices.h \
792 macro.c macro.h \
793 handle_commands.c handle_commands.h \
794 def.c def.h \
795 extra.c \
796 menus.c \
797 labels.c labels.h \
798 errors.c errors.h \
799 counter.c counter.h
800
801 Parsetexi_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
802 Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBICONV)
803 AM_CPPFLAGS = \
804 -I$(top_srcdir) \
805 -I$(top_srcdir)/gnulib/lib \
806 -I$(top_builddir)/gnulib/lib
807
808
809 # parsetexi_SOURCES=$(Parsetexi_la_SOURCES) main.c
810 # parsetexi_CFLAGS = -DVERSION=\"$(VERSION)\" "-I$(PERL_INC)"
811 #
812 # # TODO: should -lpthread come from the Perl conf?
813 # parsetexi_LDFLAGS = $(AM_LDFLAGS) -lpthread
814 BUILT_SOURCES = element_types.c element_types.h \
815 command_data.c command_ids.h
816
817 all: $(BUILT_SOURCES)
818 $(MAKE) $(AM_MAKEFLAGS) all-am
819
820 .SUFFIXES:
821 .SUFFIXES: .c .lo .o .obj .xs
822 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
823 @for dep in $?; do \
824 case '$(am__configure_deps)' in \
825 *$$dep*) \
826 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
827 && { if test -f $@; then exit 0; else break; fi; }; \
828 exit 1;; \
829 esac; \
830 done; \
831 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign parsetexi/Makefile'; \
832 $(am__cd) $(top_srcdir) && \
833 $(AUTOMAKE) --foreign parsetexi/Makefile
834 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
835 @case '$?' in \
836 *config.status*) \
837 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
838 *) \
839 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
840 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
841 esac;
842
843 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
844 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
845
846 $(top_srcdir)/configure: $(am__configure_deps)
847 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
848 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
849 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
850 $(am__aclocal_m4_deps):
851
852 install-xsLTLIBRARIES: $(xs_LTLIBRARIES)
853 @$(NORMAL_INSTALL)
854 @list='$(xs_LTLIBRARIES)'; test -n "$(xsdir)" || list=; \
855 list2=; for p in $$list; do \
856 if test -f $$p; then \
857 list2="$$list2 $$p"; \
858 else :; fi; \
859 done; \
860 test -z "$$list2" || { \
861 echo " $(MKDIR_P) '$(DESTDIR)$(xsdir)'"; \
862 $(MKDIR_P) "$(DESTDIR)$(xsdir)" || exit 1; \
863 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(xsdir)'"; \
864 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(xsdir)"; \
865 }
866
867 uninstall-xsLTLIBRARIES:
868 @$(NORMAL_UNINSTALL)
869 @list='$(xs_LTLIBRARIES)'; test -n "$(xsdir)" || list=; \
870 for p in $$list; do \
871 $(am__strip_dir) \
872 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(xsdir)/$$f'"; \
873 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(xsdir)/$$f"; \
874 done
875
876 clean-xsLTLIBRARIES:
877 -test -z "$(xs_LTLIBRARIES)" || rm -f $(xs_LTLIBRARIES)
878 @list='$(xs_LTLIBRARIES)'; \
879 locs=`for p in $$list; do echo $$p; done | \
880 sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
881 sort -u`; \
882 test -z "$$locs" || { \
883 echo rm -f $${locs}; \
884 rm -f $${locs}; \
885 }
886
887 Parsetexi.la: $(Parsetexi_la_OBJECTS) $(Parsetexi_la_DEPENDENCIES) $(EXTRA_Parsetexi_la_DEPENDENCIES)
888 $(AM_V_CCLD)$(Parsetexi_la_LINK) -rpath $(xsdir) $(Parsetexi_la_OBJECTS) $(Parsetexi_la_LIBADD) $(LIBS)
889
890 mostlyclean-compile:
891 -rm -f *.$(OBJEXT)
892
893 distclean-compile:
894 -rm -f *.tab.c
895
896 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-Parsetexi.Plo@am__quote@
897 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-api.Plo@am__quote@
898 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-close.Plo@am__quote@
899 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-commands.Plo@am__quote@
900 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-context_stack.Plo@am__quote@
901 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-convert.Plo@am__quote@
902 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-counter.Plo@am__quote@
903 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-debug.Plo@am__quote@
904 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-def.Plo@am__quote@
905 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-element_types.Plo@am__quote@
906 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-end_line.Plo@am__quote@
907 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-errors.Plo@am__quote@
908 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-extra.Plo@am__quote@
909 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-handle_commands.Plo@am__quote@
910 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-indices.Plo@am__quote@
911 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-input.Plo@am__quote@
912 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-labels.Plo@am__quote@
913 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-macro.Plo@am__quote@
914 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-menus.Plo@am__quote@
915 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-multitable.Plo@am__quote@
916 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-parser.Plo@am__quote@
917 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-separator.Plo@am__quote@
918 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-text.Plo@am__quote@
919 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parsetexi_la-tree.Plo@am__quote@
920
921 .c.o:
922 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
923 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
924 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
925 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
926 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
927 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
928
929 .c.obj:
930 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
931 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
932 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
933 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
934 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
935 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
936
937 .c.lo:
938 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
939 @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
940 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
941 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
942 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
943 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
944
945 Parsetexi_la-Parsetexi.lo: Parsetexi.c
946 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-Parsetexi.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-Parsetexi.Tpo -c -o Parsetexi_la-Parsetexi.lo `test -f 'Parsetexi.c' || echo '$(srcdir)/'`Parsetexi.c
947 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-Parsetexi.Tpo $(DEPDIR)/Parsetexi_la-Parsetexi.Plo
948 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='Parsetexi.c' object='Parsetexi_la-Parsetexi.lo' libtool=yes @AMDEPBACKSLASH@
949 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
950 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-Parsetexi.lo `test -f 'Parsetexi.c' || echo '$(srcdir)/'`Parsetexi.c
951
952 Parsetexi_la-api.lo: api.c
953 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-api.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-api.Tpo -c -o Parsetexi_la-api.lo `test -f 'api.c' || echo '$(srcdir)/'`api.c
954 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-api.Tpo $(DEPDIR)/Parsetexi_la-api.Plo
955 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='api.c' object='Parsetexi_la-api.lo' libtool=yes @AMDEPBACKSLASH@
956 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
957 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-api.lo `test -f 'api.c' || echo '$(srcdir)/'`api.c
958
959 Parsetexi_la-parser.lo: parser.c
960 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-parser.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-parser.Tpo -c -o Parsetexi_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c
961 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-parser.Tpo $(DEPDIR)/Parsetexi_la-parser.Plo
962 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parser.c' object='Parsetexi_la-parser.lo' libtool=yes @AMDEPBACKSLASH@
963 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
964 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c
965
966 Parsetexi_la-element_types.lo: element_types.c
967 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-element_types.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-element_types.Tpo -c -o Parsetexi_la-element_types.lo `test -f 'element_types.c' || echo '$(srcdir)/'`element_types.c
968 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-element_types.Tpo $(DEPDIR)/Parsetexi_la-element_types.Plo
969 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='element_types.c' object='Parsetexi_la-element_types.lo' libtool=yes @AMDEPBACKSLASH@
970 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
971 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-element_types.lo `test -f 'element_types.c' || echo '$(srcdir)/'`element_types.c
972
973 Parsetexi_la-commands.lo: commands.c
974 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-commands.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-commands.Tpo -c -o Parsetexi_la-commands.lo `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
975 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-commands.Tpo $(DEPDIR)/Parsetexi_la-commands.Plo
976 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='commands.c' object='Parsetexi_la-commands.lo' libtool=yes @AMDEPBACKSLASH@
977 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
978 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-commands.lo `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
979
980 Parsetexi_la-input.lo: input.c
981 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-input.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-input.Tpo -c -o Parsetexi_la-input.lo `test -f 'input.c' || echo '$(srcdir)/'`input.c
982 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-input.Tpo $(DEPDIR)/Parsetexi_la-input.Plo
983 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='input.c' object='Parsetexi_la-input.lo' libtool=yes @AMDEPBACKSLASH@
984 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
985 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-input.lo `test -f 'input.c' || echo '$(srcdir)/'`input.c
986
987 Parsetexi_la-tree.lo: tree.c
988 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-tree.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-tree.Tpo -c -o Parsetexi_la-tree.lo `test -f 'tree.c' || echo '$(srcdir)/'`tree.c
989 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-tree.Tpo $(DEPDIR)/Parsetexi_la-tree.Plo
990 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tree.c' object='Parsetexi_la-tree.lo' libtool=yes @AMDEPBACKSLASH@
991 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
992 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-tree.lo `test -f 'tree.c' || echo '$(srcdir)/'`tree.c
993
994 Parsetexi_la-close.lo: close.c
995 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-close.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-close.Tpo -c -o Parsetexi_la-close.lo `test -f 'close.c' || echo '$(srcdir)/'`close.c
996 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-close.Tpo $(DEPDIR)/Parsetexi_la-close.Plo
997 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='close.c' object='Parsetexi_la-close.lo' libtool=yes @AMDEPBACKSLASH@
998 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
999 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-close.lo `test -f 'close.c' || echo '$(srcdir)/'`close.c
1000
1001 Parsetexi_la-text.lo: text.c
1002 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-text.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-text.Tpo -c -o Parsetexi_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c
1003 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-text.Tpo $(DEPDIR)/Parsetexi_la-text.Plo
1004 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='text.c' object='Parsetexi_la-text.lo' libtool=yes @AMDEPBACKSLASH@
1005 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1006 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c
1007
1008 Parsetexi_la-context_stack.lo: context_stack.c
1009 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-context_stack.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-context_stack.Tpo -c -o Parsetexi_la-context_stack.lo `test -f 'context_stack.c' || echo '$(srcdir)/'`context_stack.c
1010 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-context_stack.Tpo $(DEPDIR)/Parsetexi_la-context_stack.Plo
1011 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='context_stack.c' object='Parsetexi_la-context_stack.lo' libtool=yes @AMDEPBACKSLASH@
1012 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1013 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-context_stack.lo `test -f 'context_stack.c' || echo '$(srcdir)/'`context_stack.c
1014
1015 Parsetexi_la-debug.lo: debug.c
1016 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-debug.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-debug.Tpo -c -o Parsetexi_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
1017 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-debug.Tpo $(DEPDIR)/Parsetexi_la-debug.Plo
1018 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='debug.c' object='Parsetexi_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
1019 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1020 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
1021
1022 Parsetexi_la-convert.lo: convert.c
1023 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-convert.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-convert.Tpo -c -o Parsetexi_la-convert.lo `test -f 'convert.c' || echo '$(srcdir)/'`convert.c
1024 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-convert.Tpo $(DEPDIR)/Parsetexi_la-convert.Plo
1025 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='convert.c' object='Parsetexi_la-convert.lo' libtool=yes @AMDEPBACKSLASH@
1026 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1027 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-convert.lo `test -f 'convert.c' || echo '$(srcdir)/'`convert.c
1028
1029 Parsetexi_la-end_line.lo: end_line.c
1030 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-end_line.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-end_line.Tpo -c -o Parsetexi_la-end_line.lo `test -f 'end_line.c' || echo '$(srcdir)/'`end_line.c
1031 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-end_line.Tpo $(DEPDIR)/Parsetexi_la-end_line.Plo
1032 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='end_line.c' object='Parsetexi_la-end_line.lo' libtool=yes @AMDEPBACKSLASH@
1033 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1034 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-end_line.lo `test -f 'end_line.c' || echo '$(srcdir)/'`end_line.c
1035
1036 Parsetexi_la-separator.lo: separator.c
1037 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-separator.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-separator.Tpo -c -o Parsetexi_la-separator.lo `test -f 'separator.c' || echo '$(srcdir)/'`separator.c
1038 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-separator.Tpo $(DEPDIR)/Parsetexi_la-separator.Plo
1039 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='separator.c' object='Parsetexi_la-separator.lo' libtool=yes @AMDEPBACKSLASH@
1040 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1041 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-separator.lo `test -f 'separator.c' || echo '$(srcdir)/'`separator.c
1042
1043 Parsetexi_la-multitable.lo: multitable.c
1044 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-multitable.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-multitable.Tpo -c -o Parsetexi_la-multitable.lo `test -f 'multitable.c' || echo '$(srcdir)/'`multitable.c
1045 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-multitable.Tpo $(DEPDIR)/Parsetexi_la-multitable.Plo
1046 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='multitable.c' object='Parsetexi_la-multitable.lo' libtool=yes @AMDEPBACKSLASH@
1047 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1048 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-multitable.lo `test -f 'multitable.c' || echo '$(srcdir)/'`multitable.c
1049
1050 Parsetexi_la-indices.lo: indices.c
1051 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-indices.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-indices.Tpo -c -o Parsetexi_la-indices.lo `test -f 'indices.c' || echo '$(srcdir)/'`indices.c
1052 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-indices.Tpo $(DEPDIR)/Parsetexi_la-indices.Plo
1053 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='indices.c' object='Parsetexi_la-indices.lo' libtool=yes @AMDEPBACKSLASH@
1054 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1055 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-indices.lo `test -f 'indices.c' || echo '$(srcdir)/'`indices.c
1056
1057 Parsetexi_la-macro.lo: macro.c
1058 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-macro.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-macro.Tpo -c -o Parsetexi_la-macro.lo `test -f 'macro.c' || echo '$(srcdir)/'`macro.c
1059 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-macro.Tpo $(DEPDIR)/Parsetexi_la-macro.Plo
1060 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='macro.c' object='Parsetexi_la-macro.lo' libtool=yes @AMDEPBACKSLASH@
1061 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1062 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-macro.lo `test -f 'macro.c' || echo '$(srcdir)/'`macro.c
1063
1064 Parsetexi_la-handle_commands.lo: handle_commands.c
1065 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-handle_commands.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-handle_commands.Tpo -c -o Parsetexi_la-handle_commands.lo `test -f 'handle_commands.c' || echo '$(srcdir)/'`handle_commands.c
1066 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-handle_commands.Tpo $(DEPDIR)/Parsetexi_la-handle_commands.Plo
1067 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='handle_commands.c' object='Parsetexi_la-handle_commands.lo' libtool=yes @AMDEPBACKSLASH@
1068 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1069 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-handle_commands.lo `test -f 'handle_commands.c' || echo '$(srcdir)/'`handle_commands.c
1070
1071 Parsetexi_la-def.lo: def.c
1072 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-def.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-def.Tpo -c -o Parsetexi_la-def.lo `test -f 'def.c' || echo '$(srcdir)/'`def.c
1073 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-def.Tpo $(DEPDIR)/Parsetexi_la-def.Plo
1074 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='def.c' object='Parsetexi_la-def.lo' libtool=yes @AMDEPBACKSLASH@
1075 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1076 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-def.lo `test -f 'def.c' || echo '$(srcdir)/'`def.c
1077
1078 Parsetexi_la-extra.lo: extra.c
1079 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-extra.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-extra.Tpo -c -o Parsetexi_la-extra.lo `test -f 'extra.c' || echo '$(srcdir)/'`extra.c
1080 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-extra.Tpo $(DEPDIR)/Parsetexi_la-extra.Plo
1081 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='extra.c' object='Parsetexi_la-extra.lo' libtool=yes @AMDEPBACKSLASH@
1082 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1083 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-extra.lo `test -f 'extra.c' || echo '$(srcdir)/'`extra.c
1084
1085 Parsetexi_la-menus.lo: menus.c
1086 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-menus.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-menus.Tpo -c -o Parsetexi_la-menus.lo `test -f 'menus.c' || echo '$(srcdir)/'`menus.c
1087 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-menus.Tpo $(DEPDIR)/Parsetexi_la-menus.Plo
1088 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='menus.c' object='Parsetexi_la-menus.lo' libtool=yes @AMDEPBACKSLASH@
1089 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1090 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-menus.lo `test -f 'menus.c' || echo '$(srcdir)/'`menus.c
1091
1092 Parsetexi_la-labels.lo: labels.c
1093 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-labels.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-labels.Tpo -c -o Parsetexi_la-labels.lo `test -f 'labels.c' || echo '$(srcdir)/'`labels.c
1094 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-labels.Tpo $(DEPDIR)/Parsetexi_la-labels.Plo
1095 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='labels.c' object='Parsetexi_la-labels.lo' libtool=yes @AMDEPBACKSLASH@
1096 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1097 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-labels.lo `test -f 'labels.c' || echo '$(srcdir)/'`labels.c
1098
1099 Parsetexi_la-errors.lo: errors.c
1100 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-errors.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-errors.Tpo -c -o Parsetexi_la-errors.lo `test -f 'errors.c' || echo '$(srcdir)/'`errors.c
1101 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-errors.Tpo $(DEPDIR)/Parsetexi_la-errors.Plo
1102 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='errors.c' object='Parsetexi_la-errors.lo' libtool=yes @AMDEPBACKSLASH@
1103 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1104 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-errors.lo `test -f 'errors.c' || echo '$(srcdir)/'`errors.c
1105
1106 Parsetexi_la-counter.lo: counter.c
1107 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -MT Parsetexi_la-counter.lo -MD -MP -MF $(DEPDIR)/Parsetexi_la-counter.Tpo -c -o Parsetexi_la-counter.lo `test -f 'counter.c' || echo '$(srcdir)/'`counter.c
1108 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Parsetexi_la-counter.Tpo $(DEPDIR)/Parsetexi_la-counter.Plo
1109 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='counter.c' object='Parsetexi_la-counter.lo' libtool=yes @AMDEPBACKSLASH@
1110 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1111 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Parsetexi_la_CFLAGS) $(CFLAGS) -c -o Parsetexi_la-counter.lo `test -f 'counter.c' || echo '$(srcdir)/'`counter.c
1112
1113 mostlyclean-libtool:
1114 -rm -f *.lo
1115
1116 clean-libtool:
1117 -rm -rf .libs _libs
1118 install-dist_modulesDATA: $(dist_modules_DATA)
1119 @$(NORMAL_INSTALL)
1120 @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \
1121 if test -n "$$list"; then \
1122 echo " $(MKDIR_P) '$(DESTDIR)$(modulesdir)'"; \
1123 $(MKDIR_P) "$(DESTDIR)$(modulesdir)" || exit 1; \
1124 fi; \
1125 for p in $$list; do \
1126 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
1127 echo "$$d$$p"; \
1128 done | $(am__base_list) | \
1129 while read files; do \
1130 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(modulesdir)'"; \
1131 $(INSTALL_DATA) $$files "$(DESTDIR)$(modulesdir)" || exit $$?; \
1132 done
1133
1134 uninstall-dist_modulesDATA:
1135 @$(NORMAL_UNINSTALL)
1136 @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \
1137 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
1138 dir='$(DESTDIR)$(modulesdir)'; $(am__uninstall_files_from_dir)
1139
1140 ID: $(am__tagged_files)
1141 $(am__define_uniq_tagged_files); mkid -fID $$unique
1142 tags: tags-am
1143 TAGS: tags
1144
1145 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
1146 set x; \
1147 here=`pwd`; \
1148 $(am__define_uniq_tagged_files); \
1149 shift; \
1150 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
1151 test -n "$$unique" || unique=$$empty_fix; \
1152 if test $$# -gt 0; then \
1153 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
1154 "$$@" $$unique; \
1155 else \
1156 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
1157 $$unique; \
1158 fi; \
1159 fi
1160 ctags: ctags-am
1161
1162 CTAGS: ctags
1163 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
1164 $(am__define_uniq_tagged_files); \
1165 test -z "$(CTAGS_ARGS)$$unique" \
1166 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
1167 $$unique
1168
1169 GTAGS:
1170 here=`$(am__cd) $(top_builddir) && pwd` \
1171 && $(am__cd) $(top_srcdir) \
1172 && gtags -i $(GTAGS_ARGS) "$$here"
1173 cscopelist: cscopelist-am
1174
1175 cscopelist-am: $(am__tagged_files)
1176 list='$(am__tagged_files)'; \
1177 case "$(srcdir)" in \
1178 [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
1179 *) sdir=$(subdir)/$(srcdir) ;; \
1180 esac; \
1181 for i in $$list; do \
1182 if test -f "$$i"; then \
1183 echo "$(subdir)/$$i"; \
1184 else \
1185 echo "$$sdir/$$i"; \
1186 fi; \
1187 done >> $(top_builddir)/cscope.files
1188
1189 distclean-tags:
1190 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
1191
1192 distdir: $(DISTFILES)
1193 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
1194 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
1195 list='$(DISTFILES)'; \
1196 dist_files=`for file in $$list; do echo $$file; done | \
1197 sed -e "s|^$$srcdirstrip/||;t" \
1198 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
1199 case $$dist_files in \
1200 */*) $(MKDIR_P) `echo "$$dist_files" | \
1201 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
1202 sort -u` ;; \
1203 esac; \
1204 for file in $$dist_files; do \
1205 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
1206 if test -d $$d/$$file; then \
1207 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
1208 if test -d "$(distdir)/$$file"; then \
1209 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
1210 fi; \
1211 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
1212 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
1213 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
1214 fi; \
1215 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
1216 else \
1217 test -f "$(distdir)/$$file" \
1218 || cp -p $$d/$$file "$(distdir)/$$file" \
1219 || exit 1; \
1220 fi; \
1221 done
1222 check-am: all-am
1223 check: $(BUILT_SOURCES)
1224 $(MAKE) $(AM_MAKEFLAGS) check-am
1225 all-am: Makefile $(LTLIBRARIES) $(DATA)
1226 installdirs:
1227 for dir in "$(DESTDIR)$(xsdir)" "$(DESTDIR)$(modulesdir)"; do \
1228 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
1229 done
1230 install: $(BUILT_SOURCES)
1231 $(MAKE) $(AM_MAKEFLAGS) install-am
1232 install-exec: install-exec-am
1233 install-data: install-data-am
1234 uninstall: uninstall-am
1235
1236 install-am: all-am
1237 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
1238
1239 installcheck: installcheck-am
1240 install-strip:
1241 if test -z '$(STRIP)'; then \
1242 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1243 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1244 install; \
1245 else \
1246 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1247 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1248 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
1249 fi
1250 mostlyclean-generic:
1251
1252 clean-generic:
1253 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
1254
1255 distclean-generic:
1256 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
1257 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1258
1259 maintainer-clean-generic:
1260 @echo "This command is intended for maintainers to use"
1261 @echo "it deletes files that may require special tools to rebuild."
1262 -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
1263 clean: clean-am
1264
1265 clean-am: clean-generic clean-libtool clean-xsLTLIBRARIES \
1266 mostlyclean-am
1267
1268 distclean: distclean-am
1269 -rm -rf ./$(DEPDIR)
1270 -rm -f Makefile
1271 distclean-am: clean-am distclean-compile distclean-generic \
1272 distclean-tags
1273
1274 dvi: dvi-am
1275
1276 dvi-am:
1277
1278 html: html-am
1279
1280 html-am:
1281
1282 info: info-am
1283
1284 info-am:
1285
1286 install-data-am: install-dist_modulesDATA install-xsLTLIBRARIES
1287
1288 install-dvi: install-dvi-am
1289
1290 install-dvi-am:
1291
1292 install-exec-am:
1293
1294 install-html: install-html-am
1295
1296 install-html-am:
1297
1298 install-info: install-info-am
1299
1300 install-info-am:
1301
1302 install-man:
1303
1304 install-pdf: install-pdf-am
1305
1306 install-pdf-am:
1307
1308 install-ps: install-ps-am
1309
1310 install-ps-am:
1311
1312 installcheck-am:
1313
1314 maintainer-clean: maintainer-clean-am
1315 -rm -rf ./$(DEPDIR)
1316 -rm -f Makefile
1317 maintainer-clean-am: distclean-am maintainer-clean-generic
1318
1319 mostlyclean: mostlyclean-am
1320
1321 mostlyclean-am: mostlyclean-compile mostlyclean-generic \
1322 mostlyclean-libtool
1323
1324 pdf: pdf-am
1325
1326 pdf-am:
1327
1328 ps: ps-am
1329
1330 ps-am:
1331
1332 uninstall-am: uninstall-dist_modulesDATA uninstall-xsLTLIBRARIES
1333
1334 .MAKE: all check install install-am install-strip
1335
1336 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
1337 clean-libtool clean-xsLTLIBRARIES cscopelist-am ctags ctags-am \
1338 distclean distclean-compile distclean-generic \
1339 distclean-libtool distclean-tags distdir dvi dvi-am html \
1340 html-am info info-am install install-am install-data \
1341 install-data-am install-dist_modulesDATA install-dvi \
1342 install-dvi-am install-exec install-exec-am install-html \
1343 install-html-am install-info install-info-am install-man \
1344 install-pdf install-pdf-am install-ps install-ps-am \
1345 install-strip install-xsLTLIBRARIES installcheck \
1346 installcheck-am installdirs maintainer-clean \
1347 maintainer-clean-generic mostlyclean mostlyclean-compile \
1348 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1349 tags tags-am uninstall uninstall-am uninstall-dist_modulesDATA \
1350 uninstall-xsLTLIBRARIES
1351
1352 .PRECIOUS: Makefile
1353
1354
1355 .xs.c:
1356 $(XSUBPP) $(XSUBPPARGS) $< > $*.xsc && mv $*.xsc $*.c
1357
1358 $(srcdir)/element_types.c $(srcdir)/element_types.h: element_types.txt element_types.awk
1359 awk -v srcdir=$(srcdir) -f $(srcdir)/element_types.awk \
1360 $(srcdir)/element_types.txt
1361
1362 $(srcdir)/command_data.c $(srcdir)/command_ids.h: command_data.txt command_data.awk
1363 awk -v srcdir=$(srcdir) -f $(srcdir)/command_data.awk \
1364 $(srcdir)/command_data.txt
1365
1366 # Tell versions [3.59,3.63) of GNU make to not export all variables.
1367 # Otherwise a system limit (for SysV at least) may be exceeded.
1368 .NOEXPORT:
8686 @EXPORT = qw(
8787 );
8888
89 $VERSION = '5.1.90';
89 $VERSION = '6.5.91';
9090
9191 sub N__($)
9292 {
55 *
66 */
77
8 #line 1 "Parsetexi.xs"
8 #line 1 "parsetexi/Parsetexi.xs"
99 #define PERL_NO_GET_CONTEXT
1010 #include "EXTERN.h"
1111 #include "perl.h"
1818 #include "api.h"
1919 #include "errors.h"
2020 #include "macro.h"
21 #include "handle_commands.h"
2122
2223 HV *build_texinfo_tree (void);
2324 AV *build_label_list (void);
2728 HV *build_global_info (void);
2829 HV *build_global_info2 (void);
2930
30 #line 32 "Parsetexi.c"
31 #line 33 "parsetexi/Parsetexi.c"
3132 #ifndef PERL_UNUSED_VAR
3233 # define PERL_UNUSED_VAR(var) if (0) var = var
3334 #endif
171172 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
172173 #endif
173174
174 #line 176 "Parsetexi.c"
175 #line 177 "parsetexi/Parsetexi.c"
175176
176177 XS_EUPXS(XS_Parsetexi_dump_errors); /* prototype to pass -Wmissing-prototypes */
177178 XS_EUPXS(XS_Parsetexi_dump_errors)
447447 Texinfo::XSLoader::init (
448448 "Texinfo::Parser",
449449 "Parsetexi",
450 undef,
450 "Texinfo::ParserNonXS",
451451 "Parsetexi",
452452 1);
453453 } # end BEGIN
454454
455455 END {
456 reset_parser (); # for debugging memory leaks
456 #reset_parser (); # for debugging memory leaks
457457 }
458458
459459 # This "use" statement is all the way down here because Texinfo::Report
+0
-127
tp/Texinfo/XS/parsetexi/Parsetexi.xs less more
0 #define PERL_NO_GET_CONTEXT
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 #include "ppport.h"
6
7 #include "tree_types.h"
8 #include "tree.h"
9 #include "api.h"
10 #include "errors.h"
11 #include "macro.h"
12
13 HV *build_texinfo_tree (void);
14 AV *build_label_list (void);
15 AV *build_internal_xref_list (void);
16 HV *build_float_list (void);
17 HV *build_index_data (void);
18 HV *build_global_info (void);
19 HV *build_global_info2 (void);
20
21 MODULE = Parsetexi PACKAGE = Parsetexi
22
23 PROTOTYPES: ENABLE
24
25 char *
26 dump_errors ()
27
28 void
29 wipe_errors ()
30
31 int
32 parse_file(filename)
33 char * filename
34
35 void
36 parse_string(string)
37 char * string
38
39 void
40 parse_text(string)
41 char * string
42
43 void
44 store_value (name, value)
45 char *name
46 char *value
47
48 void
49 wipe_values ()
50
51 void
52 reset_context_stack ()
53
54 void
55 init_index_commands ()
56
57 ELEMENT *
58 get_root()
59
60 char *
61 element_type_name(e)
62 ELEMENT *e
63
64 int
65 num_contents_children(e)
66 ELEMENT *e
67
68 int
69 num_args_children (e)
70 ELEMENT *e
71
72 ELEMENT *
73 contents_child_by_index (e, index)
74 ELEMENT *e
75 int index
76
77 void
78 add_include_directory (filename)
79 char *filename
80
81 HV *
82 build_texinfo_tree ()
83
84 AV *
85 build_label_list ()
86
87 AV *
88 build_internal_xref_list ()
89
90 HV *
91 build_float_list ()
92
93 HV *
94 build_index_data ()
95
96 HV *
97 build_global_info ()
98
99 HV *
100 build_global_info2 ()
101
102 void
103 reset_parser ()
104
105 void
106 clear_expanded_formats ()
107
108 void
109 add_expanded_format (format)
110 char *format
111
112 void
113 conf_set_show_menu (int i)
114
115 void
116 conf_set_CPP_LINE_DIRECTIVES (int i)
117
118 void
119 conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i)
120
121 void
122 set_documentlanguage (value)
123 char *value
124
125 void
126 set_debug (int i)
+0
-60
tp/Texinfo/XS/parsetexi/README less more
0 This is an experimental program intended to replicate the functionality
1 in tp/Texinfo/Parser.pm.
2
3
4 Set TEXINFO_XS_PARSER in environment to use.
5
6 =====================================================================
7 Notes -
8
9 should be able to debug with gdb. Add
10
11 ./configure PERL_EXT_CFLAGS='-g -O0'
12
13 For individual tests can do "gdb perl" followed by e.g.
14
15 (gdb) r -w t/27float.t comment_space_comand_in_float
16
17 After a single run can set breakpoints.
18
19 How to debug with valgrind -
20 export PERL5LIB to the value in the makeinfo script
21
22 with alias VAL='valgrind --log-file=val.log', can do e.g.
23
24 VAL perl ./texi2any-C.pl texinfo.texi
25
26 also
27
28 valgrind --vgdb-error=0 perl texi2any-C.pl texinfo.texi
29
30 =====================================================================
31
32 To see contents of leaked memory
33
34 Run with valgrind, e.g.
35
36 s=../../tp
37 export srcdir=$s builddir=. top_srcdir=../../ top_builddir=..
38 export TEXINFO_XS_PARSER=1
39 valgrind --leak-check=full --vgdb-error=0 --vgdb-stop-at=exit \
40 perl -w $s/t/18itemize.t
41
42 at end of run, in gdb:
43
44 (gdb) monitor leak_check definiteleak any
45 ==10409== 480 (80 direct, 400 indirect) bytes in 1 blocks are definitely lost in loss record 3,261 of 4,374
46
47 ...
48
49 (gbd) monitor block_list 3261
50
51
52 Get log files specific to tests with
53
54 $ grep '^\['\' $s/t/18itemize.t | sed -e 's/^..//' -e 's/..$//' >test-list
55 $ for t in `cat test-list` ; do valgrind --log-file=val.log.$t \
56 --leak-check=full perl -w $s/t/18itemize.t $t ; done
57
58
59
+0
-204
tp/Texinfo/XS/parsetexi/TODO less more
0 * conditionals on @set/@value, output format
1 * implement command_warn properly
2 * floats
3 * Check everywhere we store values, we check properly what to do if the
4 values are already defined.
5 * check valid nestings
6 * Implement more parser options
7 * Character encoding issues - read and pass to Perl correctly.
8 * gnulib integration for strrchr, strchrnul, asprintf, etc. Eliminate
9 #define _GNU_SOURCE.
10 * gettext integration
11 * figure out what to do with parse_texi_line, etc. Integration with the
12 test suites.
13 * find where "strlen" and "text_append" are used and try to remove them, for
14 efficiency. Also newSVpv (..., 0);
15 * Add "TODO" anywhere in the code with explanations of what is not done yet.
16
17 ================================================================
18
19 Texinfo::Report::gdt and parse_texi_line -
20
21 Multiple Texinfo::Parser objects are created in a run of texi2any. The
22 main one is to parse the input file, but it is also used by gdt - the
23 string translation function. (I haven't ruled out that it is also used
24 somewhere else as well.)
25
26 This makes replacing the Texinfo::Parser module more complicated.
27
28 gdt parses pieces Texinfo code that are the translations of strings in
29 po_document/texinfo_document.pot. It does this by adding "@value"
30 before strings surrounded by braces, and then calling "parse_texi_line"
31 with these @value's set to the appropriate value. These values could be
32 a string, a hash reference (representing a tree element), or an array
33 reference (representing a "content array" of tree elements).
34
35 parse_texi_line returns a Perl Texinfo tree which is at last converted
36 into the output Info/HTML/etc.
37
38 These values that are not strings are a challenge for how they can be
39 passed back into C. We have code (in api.c) to translate our C
40 representations of the Texinfo tree to Perl data structures, but not
41 vice versa.
42
43 We deal with this by leaving the @value's undefined, letting an element
44 representing a use of an unused @value appear in the parse tree, and
45 then substituting in the parse trees for the @value's afterwards, in
46 Texinfo::Report::gdt. See diff below.
47
48 Other suggestions:
49 * Don't call parse_texi_line at all. This would be a simplification of
50 the overall structure of the makeinfo program and might not lose much
51 flexibility in return. Most of the strings in texinfo_document.pot
52 don't use any Texinfo commands, and the others could be expressed
53 directly in the output format, e.g. instead of
54
55 msgid "{category} on {class}: @strong{{name}}
56
57 it could be
58
59 msgid "{category} on {class}: <strong>{name}</strong>"
60
61 Some of the translation strings use Texinfo commands for characters,
62 e.g. "@'e". This would have to be replaced with whatever method other
63 programs using gettext use for special characters. It would also stop
64 translation strings being reused across output formats, creating more
65 work for translators.
66
67 * Write code translating Perl tree elements into C data structures and
68 allow them to be passed to the parser as @value's. I am very reluctant
69 to do this.
70
71 To use the current implementation, do the following to
72 tp/Texinfo/Report.pm:
73
74 Index: Texinfo/Report.pm
75 ===================================================================
76 --- Texinfo/Report.pm (revision 6344)
77 +++ Texinfo/Report.pm (working copy)
78 @@ -49,6 +49,7 @@ use File::Basename;
79 use Locale::Messages;
80 # to be able to load a parser if none was given to gdt.
81 use Texinfo::Parser;
82 +use Parsetexi;
83
84 # return the errors and warnings
85 sub errors($)
86 @@ -244,7 +245,8 @@ sub _encode_i18n_string($$)
87 return Encode::decode($encoding, $string);
88 }
89
90 -# handle translations of in-document strings.
91 +# Get document translation - handle translations of in-document strings.
92 +# Return a parsed Texinfo tree
93 sub gdt($$;$$)
94 {
95 my $self = shift;
96 @@ -376,7 +378,11 @@ sub gdt($$;$$)
97 $translation_result =~ s/\{($re)\}/\@value\{_$1\}/g;
98 foreach my $substitution(keys %$context) {
99 #print STDERR "$translation_result $substitution $context->{$substitution}\n";
100 - $parser_conf->{'values'}->{'_'.$substitution} = $context->{$substitution};
101 + if (!ref($context->{$substitution})) {
102 + #warn "setting $substitution to $context->{$substitution}\n";
103 + $parser_conf->{'values'}->{'_'.$substitution}
104 + = $context->{$substitution};
105 + }
106 }
107 }
108
109 @@ -399,7 +405,8 @@ sub gdt($$;$$)
110 }
111 }
112 #my $parser = Texinfo::Parser::parser($parser_conf);
113 - my $parser = Texinfo::Parser::simple_parser($parser_conf);
114 + #my $parser = Texinfo::Parser::simple_parser($parser_conf);
115 + my $parser = Parsetexi::parser($parser_conf);
116 if ($parser->{'DEBUG'}) {
117 print STDERR "GDT $translation_result\n";
118 }
119 @@ -411,10 +418,67 @@ sub gdt($$;$$)
120 } else {
121 $tree = $parser->parse_texi_line($translation_result);
122 }
123 + #warn '--------------------------------------', "\n";
124 + #warn Texinfo::Parser::_print_tree ($tree);
125 + $tree = _substitute ($tree, $context);
126 + #warn Texinfo::Parser::_print_tree ($tree);
127 + #warn '--------------------------------------', "\n";
128 return $tree;
129 }
130
131 +sub _substitute_element_array ($$);
132 +sub _substitute_element_array ($$) {
133 + my $array = shift; my $context = shift;
134
135 + # "the push @{$current->{'contents'}}, {}; prevents a trailing
136 + # text to be merged, to avoid having the value tree modified."
137 +
138 + # It's not necessary now, but we are yet to update the test
139 + # results to remove the extra {}'s.
140 +
141 + @{$array} = map {
142 + if ($_->{'cmdname'} and $_->{'cmdname'} eq 'value'
143 + and $_->{'type'}
144 + ) {
145 + my $name = $_->{'type'};
146 + $name =~ s/^_//;
147 + if (ref($context->{$name}) eq 'HASH') {
148 + ( $context->{$name} , {} );
149 + } elsif (ref($context->{$name}) eq 'ARRAY') {
150 + ( @{$context->{$name}} , {} );
151 + }
152 + } else {
153 + _substitute($_, $context);
154 + ( $_ );
155 + }
156 + } @{$array};
157 +}
158 +
159 +sub _substitute ($$);
160 +sub _substitute ($$) {
161 + my $tree = shift; my $context = shift;
162 +
163 + if ($tree->{'contents'}) {
164 + _substitute_element_array ($tree->{'contents'}, $context);
165 + }
166 +
167 + if ($tree->{'args'}) {
168 + _substitute_element_array ($tree->{'args'}, $context);
169 + }
170 +
171 + # Used for @email and @url
172 + if ($tree->{'extra'} and $tree->{'extra'}{'brace_command_contents'}) {
173 + for my $arg (@{$tree->{'extra'}{'brace_command_contents'}}) {
174 + if ($arg) {
175 + _substitute_element_array ($arg, $context);
176 + }
177 + }
178 + }
179 +
180 + return $tree;
181 +}
182 +
183 +
184 1;
185
186 __END__
187
188
189 ===================================================================
190
191
192 Integration with rest of Perl code:
193
194 Passing data as Perl code to be evaluated in very slow, which limits the
195 speed-up that is obtained. One way round this would be to access the
196 parse tree in the Perl code through an API. This would be done in two
197 stages:
198
199 * Convert makeinfo backends to use a Perl stub for the C API. The C
200 parser will not be used at this point.
201 * Substitute the XS API implementation for the Perl API when the C
202 parser is good enough.
203
3232 #include "labels.h"
3333 #include "indices.h"
3434 #include "api.h"
35 #include "errors.h"
3635
3736 ELEMENT *Root;
3837
353352 case extra_contents:
354353 case extra_contents_oot:
355354 {
356 int j;
357355 if (f)
358356 STORE(build_perl_array (&f->contents));
359357 break;
362360 {
363361 /* Like extra_contents, but this time output an array
364362 of arrays (instead of an array). */
365 int j, k;
363 int j;
366364 AV *av;
367365 av = newAV ();
368366 STORE(newRV_inc ((SV *)av));
424422 break;
425423 case extra_node_spec_array:
426424 {
427 int j;
428425 AV *av;
429426 NODE_SPEC_EXTRA **array;
430427 av = newAV ();
11 extern ELEMENT *Root;
22 extern CONF conf;
33
4 void parse_text (char *);
5 void parse_string(char *);
46 int parse_file (char *filename);
57 ELEMENT *get_root (void);
68 char *element_type_name (ELEMENT *element);
810 int num_args_children (ELEMENT *e);
911 void reset_parser (void);
1012 void reset_parser_except_conf (void);
13 void set_debug (int);
14 void wipe_values (void);
1115
1216 /* In parser.c */
1317 void set_documentlanguage (char *);
2529 void reset_context_stack (void);
2630
2731 void conf_set_show_menu (int i);
32 void conf_set_CPP_LINE_DIRECTIVES (int i);
33 void conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i);
2834 void reset_conf (void);
1818 #include <string.h>
1919
2020 #include "parser.h"
21 #include "errors.h"
2221
2322 /* Possibly print an error message, and return CURRENT->parent. */
2423 static ELEMENT *
162161 && current->contents.number > 0)
163162 {
164163 int have_leading_spaces = 0;
165 ELEMENT *before_item;
164 ELEMENT *before_item = 0;
166165 if (current->contents.number >= 2
167166 && current->contents.list[0]->type == ET_empty_line_after_command
168167 && current->contents.list[1]->type == ET_before_item)
1515 #include <config.h>
1616 #include <stdlib.h>
1717
18 #include "tree_types.h"
19 #include "context_stack.h"
20 #include "api.h"
18 #include "parser.h"
2119
2220 static enum context *stack;
2321 static size_t top; /* One above last pushed context. */
9191 if (e->args.number > 0)
9292 {
9393 int braces, arg_nr, i;
94 static char s[2];
9594 braces = (e->args.list[0]->type == ET_brace_command_arg
9695 || e->args.list[0]->type == ET_brace_command_context);
9796 if (braces)
172172 for (i = starting_idx; i < current->contents.number; i++)
173173 {
174174 ELEMENT *e = current->contents.list[i];
175 int j;
176175 char *p;
177176 ELEMENT *new;
178177 int len;
219218 for (i = starting_idx; i < current->contents.number; i++)
220219 {
221220 ELEMENT *e = current->contents.list[i];
222 int j;
223221 char *p;
224222 ELEMENT *new;
225223 int len;
270268 int contents_idx = 0;
271269 int type, next_type;
272270 int i;
273 ELEMENT *e, *e1;
274 enum command_id original_command = CM_NONE;
271 ELEMENT *e, *e1;
275272
276273 ret = malloc (sizeof (DEF_INFO));
277274 memset (ret, 0, sizeof (DEF_INFO));
284281 split_def_args (current, contents_idx);
285282
286283 /* Check for "def alias" - for example @defun for @deffn. */
287 if (command_data(command).flags & CF_def_alias) // 2387
284 if (command_data(command).flags & CF_def_alias)
288285 {
289286 char *category;
290287 int i;
300297 @deffn Function */
301298
302299 category = def_aliases[i].category;
303 original_command = command;
304300 command = def_aliases[i].command;
305301
306302 /* Used when category text has a space in it. */
0 /* end_line.c -- what to do at the end of a whole line of input
0 /* end_line.c -- what to do at the end of a whole line of input */
11 /* Copyright 2010-2019 Free Software Foundation, Inc.
22
33 This program is free software: you can redistribute it and/or modify
2525 #include "convert.h"
2626 #include "labels.h"
2727 #include "indices.h"
28 #include "errors.h"
2928
3029 void
3130 check_internal_node (NODE_SPEC_EXTRA *nse)
4645 if (!nse || !nse->node_content || nse->node_content->contents.number == 0)
4746 {
4847 line_error ("empty argument in @%s", command_name(cmd));
48 return 0;
4949 }
5050 else
5151 return 1;
285285 is an array of the arguments. For some commands, there is further
286286 processing of the arguments (for example, for an @alias, remember the
287287 alias.) */
288 // 5475
289288 ELEMENT *
290289 parse_line_command_args (ELEMENT *line_command)
291290 {
299298 ELEMENT *line_args;
300299 enum command_id cmd;
301300 char *line;
302 int i;
303301
304302 cmd = line_command->cmd;
305303 if (arg->contents.number == 0)
12421240 }
12431241 }
12441242
1245 /* 3052 - if no command_as_argument given, default to @bullet for
1243 /* if no command_as_argument given, default to @bullet for
12461244 @itemize, and @asis for @table. */
12471245 if (current->cmd == CM_itemize
12481246 && (current->args.number == 0
12491247 || current->args.list[0]->contents.number == 0))
12501248 {
1251 ELEMENT *e, *contents, *contents2;
1249 ELEMENT *e;
12521250
12531251 e = new_element (ET_command_as_argument_inserted);
12541252 e->cmd = CM_bullet;
12581256 else if (item_line_command (current->cmd)
12591257 && !lookup_extra (current, "command_as_argument"))
12601258 {
1261 ELEMENT *e, *contents, *contents2;
1259 ELEMENT *e;
12621260
12631261 e = new_element (ET_command_as_argument_inserted);
12641262 e->cmd = CM_asis;
12731271 }
12741272 } /* CF_blockitem */
12751273
1276 // 3077
12771274 if (command_flags(current) & CF_menu)
12781275 {
12791276 /* Start reading a menu. Processing will continue in
12901287 return current;
12911288 }
12921289
1293 // 3100
12941290 /* Actions to be taken at the end of an argument to a line command
12951291 not starting a block. @end is processed in here. */
12961292 static ELEMENT *
13221318 abort ();
13231319 }
13241320
1325 // 3114
13261321 debug ("MISC END %s", command_name(cmd));
13271322
13281323 if (arg_type > 0)
13311326 if (args)
13321327 add_extra_misc_args (current, "misc_args", args);
13331328 }
1334 else if (arg_type == LINE_text) /* 3118 */
1329 else if (arg_type == LINE_text)
13351330 {
13361331 char *text = 0;
13371332 int superfluous_arg = 0;
1338 int i;
13391333
13401334 if (current->args.number > 0)
13411335 text = convert_to_text (current->args.list[0], &superfluous_arg);
13431337 if (!text || !strcmp (text, ""))
13441338 {
13451339 if (!superfluous_arg)
1346 line_warn ("@%s missing argument", command_name(cmd)); // 3123
1340 line_warn ("@%s missing argument", command_name(cmd));
13471341 add_extra_integer (current, "missing_argument", 1);
13481342 free (text);
13491343 }
17591753 /* Index commands */
17601754 if (command_flags(current) & CF_index_entry_command)
17611755 {
1762 ELEMENT *contents;
1763 contents = last_args_child(current);
1764
1765 // 3274
17661756 enter_index_entry (current->cmd, current->cmd, current,
17671757 current->args.list[0]);
17681758 current->type = ET_index_entry_command;
21592149 else
21602150 {
21612151 ELEMENT *index_entry = 0; /* Index entry text. */
2162 char *label;
2163 int i;
21642152
21652153 add_extra_def_info (current->parent, "def_parsed_hash", def_info);
21662154
2121 #include "tree_types.h"
2222 #include "input.h"
2323 #include "text.h"
24 #include "errors.h"
2524
2625 typedef struct {
2726 char *message;
0
10 void line_error (char *format, ...);
21 void line_warn (char *format, ...);
32 void command_error (ELEMENT *e, char *format, ...);
2020 #include "parser.h"
2121 #include "input.h"
2222 #include "text.h"
23 #include "errors.h"
2423
2524 /* Return a containing @itemize or @enumerate if inside it. */
2625 // 1847
9493 arg_spec = command_data(cmd).data;
9594 if (arg_spec == OTHER_noarg)
9695 {
97 int only_in_headings = 0;
9896 if (command_data(cmd).flags & CF_in_heading)
9997 {
10098 line_error ("@%s should only appear in heading or footing",
10199 command_name(cmd));
102 only_in_headings = 1;
103100 }
104101
105102 misc = new_element (ET_NONE);
262259 {
263260 /* Start a new paragraph if not in one already. */
264261 int spaces;
265 enum element_type t;
266262 ELEMENT *paragraph;
267263
268264 /* Check if if we should change an ET_empty_line_after_command
1919 #include <stdlib.h>
2020 #include <stdio.h>
2121 #include <string.h>
22 #if HAVE_ICONV
23 # include <iconv.h>
24 #endif
22 #include <iconv.h>
2523 #include <errno.h>
2624 #include <sys/stat.h>
2725
105103 return 0;
106104 }
107105
108
109 /* TODO: integrate with gnulib */
110 #define ICONV_CONST
111106
112107 static iconv_t iconv_from_latin1 = (iconv_t) 0;
113108 static iconv_t iconv_from_latin2;
1212 int expanding_macro (char *macro);
1313 int top_file_index (void);
1414 char *locate_include_file (char *filename);
15 void set_input_encoding (char *encoding);
1516
1617 char *save_string (char *string);
1718 void free_small_strings (void);
1717 #include <config.h>
1818 #include <stdlib.h>
1919 #include <string.h>
20 #include <ctype.h>
2021
2122 #include "parser.h"
2223 #include "tree.h"
2324 #include "text.h"
2425 #include "input.h"
25 #include "errors.h"
2626 #include "convert.h"
2727
2828 static MACRO *macro_list;
376376 return arg_list;
377377 }
378378
379 // 2063
380379 /* ARGUMENTS are the arguments used in the macro invocation. EXPANDED gets the
381380 result of the expansion. */
382381 static void
383382 expand_macro_body (MACRO *macro_record, char *arguments[], TEXT *expanded)
384383 {
385 char *arg;
386384 int pos; /* Index into arguments. */
387 int i; /* Index into macro contents. */
388385 ELEMENT *macro;
389386 char *macrobody;
390387 char *ptext;
423420 bs = strchr (ptext, '\\');
424421 if (!bs)
425422 {
426 // error - malformed
423 // TODO: error - malformed
427424 return;
428425 abort ();
429426 }
44 enum command_id cmd_id);
55 void delete_macro (char *name);
66 MACRO *lookup_macro (enum command_id cmd);
7 void wipe_macros (void);
78
89 void store_value (char *name, char *value);
910 char *fetch_value (char *name, int len);
11 void clear_value (char *name, int len);
1012 INFO_ENCLOSE *lookup_infoenclose (enum command_id cmd);
1113 void add_infoenclose (enum command_id cmd, char *begin, char *end);
1214
1919 #include "parser.h"
2020 #include "input.h"
2121 #include "text.h"
22 #include "convert.h"
23 #include "labels.h"
2224
2325 /* Save 'menu_entry_name' 'menu_entry_node', and 'menu_entry_description'
2426 extra keys on the top-level @menu element. */
1414
1515 #include <config.h>
1616 #include "parser.h"
17 #include "errors.h"
1817
1918 /* Return the parent if in an item_line command, @*table */
2019 ELEMENT *
6463 gather_previous_item (ELEMENT *current, enum command_id next_command)
6564 {
6665 ELEMENT *gathered;
67 enum command_id type;
66 enum element_type type;
6867 int i, contents_count;
6968
7069 if (last_contents_child(current)
2323 #include "input.h"
2424 #include "tree.h"
2525 #include "api.h"
26 #include "errors.h"
2726
2827
2928 /* Utility functions */
171170 GLOBAL_CASE(urefbreakstyle);
172171 GLOBAL_CASE(xrefautomaticsectiontitle);
173172 #undef GLOBAL_CASE
173 default:
174 /* do nothing; just silence -Wswitch about lots of un-covered cases */
175 break;
174176 }
175177 /* TODO: Check if all of these are necessary. */
176178 return 1;
185187 current->line_nr = line_nr;
186188 switch (cmd)
187189 {
188 extern int input_number;
189190 case CM_setfilename:
190191 /* Check if we are inside an @include, and if so, do nothing. */
191192 if (top_file_index () > 0)
225226 GLOBAL_UNIQUE_CASE(title);
226227 #undef GLOBAL_UNIQUE_CASE
227228 /* NOTE: Same list in api.c:build_global_info2 and wipe_global_info. */
229 default:
230 /* do nothing; just silence -Wswitch about lots of un-covered cases */
231 break;
228232 }
229233 if (where)
230234 {
972976 }
973977 }
974978
975 /* line 3725 */
976979 /* *LINEP is a pointer into the line being processed. It is advanced past any
977980 bytes processed. Return 0 when we need to read a new line. */
978981 int
989992
990993 /********* BLOCK_raw or (ignored) BLOCK_conditional ******************/
991994 /* If in raw block, or ignored conditional block. */
992 // 3727
993995 if (command_flags(current) & CF_block
994996 && (command_data(current->cmd).data == BLOCK_raw
995997 || command_data(current->cmd).data == BLOCK_conditional))
996 { /* 3730 */
998 {
997999 /* Check if we are using a macro within a macro. */
9981000 if (current->cmd == CM_macro || current->cmd == CM_rmacro)
9991001 {
10531055 if (is_end_current_command (current, &line, &end_cmd))
10541056 {
10551057 ELEMENT *last_child;
1056 ELEMENT *raw_command = current;
10571058 char *tmp = 0;
10581059
10591060 last_child = last_contents_child (current);
15661567 msg = "move your @shortcontents and @contents command if "
15671568 "you want the contents after the title page";
15681569 break;
1570 default:
1571 break;
15691572 }
15701573 if (!msg)
15711574 line_warn ("@%s is obsolete.", command_name(cmd));
33 #include "commands.h"
44 #include "handle_commands.h"
55 #include "def.h"
6 #include "errors.h"
67
78 /* In commands.c */
89 int close_paragraph_command (enum command_id cmd_id);
6768 ELEMENT *command);
6869 ELEMENT *begin_paragraph (ELEMENT *current);
6970 int format_expanded_p (char *format);
71 int is_end_current_command (ELEMENT *current, char **line,
72 enum command_id *end_cmd);
7073
7174 /* Return values */
7275 #define GET_A_NEW_LINE 0
113116 void add_extra_float_type (ELEMENT *e, char *key, EXTRA_FLOAT_TYPE *value);
114117 void add_extra_string (ELEMENT *e, char *key, char *value);
115118 void add_extra_string_dup (ELEMENT *e, char *key, char *value);
119 void add_extra_integer (ELEMENT *e, char *key, int value);
116120 KEY_PAIR *lookup_extra (ELEMENT *e, char *key);
117121
118122 /* In menus.c */
1919 #include "parser.h"
2020 #include "tree.h"
2121 #include "text.h"
22 #include "errors.h"
2322 #include "convert.h"
2423 #include "input.h"
2524 #include "labels.h"
303302 }
304303 free (parsed_anchor);
305304 }
306 else if (command_data(closed_command).flags & CF_ref) // 5062
305 else if (command_data(closed_command).flags & CF_ref)
307306 {
308307 ELEMENT *ref = current->parent;
309 KEY_PAIR *k;
310308 if (ref->args.number > 0)
311309 {
312310 if ((closed_command == CM_inforef
387385 }
388386 }
389387 }
390 else if (closed_command == CM_image) // 5109
388 else if (closed_command == CM_image)
391389 {
392390 ELEMENT *image = current->parent;
393 KEY_PAIR *k;
394391 if (image->args.number == 0
395392 || image->args.list[0]->contents.number == 0)
396393 {
1717 void text_append_n (TEXT *t, char *s, size_t len);
1818 void text_printf (TEXT *t, char *format, ...);
1919 void text_alloc (TEXT *t, size_t len);
20 void text_reset (TEXT *t);
2021
2122 #define text_base(t) ((t)->space ? (t)->text : (char *) 0)
+0
-1
tp/Texinfo/XS/parsetexi/typemap less more
0 ELEMENT * T_UV
(New empty file)
2222
2323 our $TEXINFO_XS;
2424
25 our $VERSION = '6.5.90';
25 our $VERSION = '6.5.91';
2626
2727 our $disable_XS;
2828
238238 warn "falling back to pure Perl module\n";
239239 }
240240 if (!defined $fallback_module) {
241 die "no fallback module for $full_module_name";
241 warn "no fallback module for $full_module_name\n";
242 die "unset the TEXINFO_XS and TEXINFO_XS_PARSER environment variables "
243 ."to use the pure Perl modules\n";
242244 }
243245
244246 # Fall back to using the Perl code.