[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5952] add parsetexi to repository
From: |
Gavin D. Smith |
Subject: |
[5952] add parsetexi to repository |
Date: |
Wed, 10 Dec 2014 01:35:36 +0000 |
Revision: 5952
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5952
Author: gavin
Date: 2014-12-10 01:35:34 +0000 (Wed, 10 Dec 2014)
Log Message:
-----------
add parsetexi to repository
Added Paths:
-----------
trunk/parsetexi/
trunk/parsetexi/Common.pm
trunk/parsetexi/Makefile.am
trunk/parsetexi/Makefile.in
trunk/parsetexi/Parser-5556.pm
trunk/parsetexi/README
trunk/parsetexi/aclocal.m4
trunk/parsetexi/close.c
trunk/parsetexi/command_data.awk
trunk/parsetexi/command_data.txt
trunk/parsetexi/command_ids.h
trunk/parsetexi/commands.c
trunk/parsetexi/commands.h
trunk/parsetexi/compile
trunk/parsetexi/complete_tree.pl
trunk/parsetexi/configure
trunk/parsetexi/configure.ac
trunk/parsetexi/context_stack.c
trunk/parsetexi/context_stack.h
trunk/parsetexi/convert.c
trunk/parsetexi/debug.c
trunk/parsetexi/debug_perl.txt
trunk/parsetexi/def.c
trunk/parsetexi/def.h
trunk/parsetexi/depcomp
trunk/parsetexi/element_types.awk
trunk/parsetexi/element_types.c
trunk/parsetexi/element_types.h
trunk/parsetexi/element_types.txt
trunk/parsetexi/end_line.c
trunk/parsetexi/handle_commands.c
trunk/parsetexi/handle_commands.h
trunk/parsetexi/indices.c
trunk/parsetexi/input.c
trunk/parsetexi/input.h
trunk/parsetexi/install-sh
trunk/parsetexi/macro.c
trunk/parsetexi/main.c
trunk/parsetexi/makeinfo-debug.txt
trunk/parsetexi/missing
trunk/parsetexi/multitable.c
trunk/parsetexi/parser.c
trunk/parsetexi/parser.h
trunk/parsetexi/separator.c
trunk/parsetexi/text.c
trunk/parsetexi/text.h
trunk/parsetexi/tree.c
trunk/parsetexi/tree.h
trunk/parsetexi/tree_types.h
Added: trunk/parsetexi/Common.pm
===================================================================
--- trunk/parsetexi/Common.pm (rev 0)
+++ trunk/parsetexi/Common.pm 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,2636 @@
+# Common.pm: definition of commands. Common code of other Texinfo modules.
+#
+# Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Original author: Patrice Dumas <address@hidden>
+# Parts (also from Patrice Dumas) come from texi2html.pl or texi2html.init.
+
+package Texinfo::Common;
+
+use strict;
+
+# for unicode/layer support in binmode
+use 5.006;
+
+# to determine the null file
+use Config;
+use File::Spec;
+
+use Texinfo::Documentlanguages;
+
+# debugging
+use Carp qw(cluck);
+
+require Exporter;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
address@hidden = qw(Exporter);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration use Texinfo::Covert::Text ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+definition_category
+expand_verbatiminclude
+expand_today
+float_name_caption
+is_content_empty
+move_index_entries_after_items_in_tree
+normalize_top_node_name
+numbered_heading
+protect_comma_in_tree
+protect_first_parenthesis
+protect_hashchar_at_line_beginning
+protect_colon_in_tree
+protect_node_after_label_in_tree
+trim_spaces_comment_from_content
+valid_tree_transformation
+) ] );
+
address@hidden = ( @{ $EXPORT_TAGS{'all'} } );
+
address@hidden = qw(
+);
+
+$VERSION = '5.1.90';
+
+# i18n
+sub N__($)
+{
+ return $_[0];
+}
+
+# determine the null devices
+my $default_null_device = File::Spec->devnull();
+our %null_device_file = (
+ $default_null_device => 1
+);
+# special case, djgpp recognizes both null devices
+if ($Config{osname} eq 'dos' and $Config{osvers} eq 'djgpp') {
+ $null_device_file{'/dev/null'} = 1;
+ $null_device_file{'NUL'} = 1;
+}
+
+# these are the default values for the parser state that may be
+# initialized to values given by the user.
+# They are defined here, because they are used below and we
+# don't want Texinfo::Common to use Texinfo::Parser.
+our %default_parser_state_configuration = (
+ # this is the initial context. It is put at the bottom of the
+ # 'context_stack'. It is not clear if this is really useful to be
+ # able to customize that value.
+ 'context' => '_root',
+ 'expanded_formats' => [],
+ 'gettext' => sub {return $_[0];},
+ 'pgettext' => sub {return $_[1];},
+ 'include_directories' => [ '.' ],
+ # these are the user-added indices. May be an array reference on names
+ # or an hash reference in the same format than %index_names below
+ 'indices' => [],
+ # the following are dynamically modified during the document parsing.
+ 'aliases' => {}, # key is a command name value is the alias
+ 'clickstyle' => 'arrow',
+ 'documentlanguage' => undef,
+ # Current documentlanguage set by
+ # @documentlanguage
+ 'explained_commands' => {}, # the key is a command name, either acronym
+ # or abbr, the value is a hash. The key hash
+ # is a normalized first argument of the
+ # corresponding command, the value is the
+ # contents array of the previous command with
+ # this first arg and a second arg.
+ 'kbdinputstyle' => 'distinct',
+ 'labels' => {}, # keys are normalized label names, as described
+ # in the `HTML Xref' node. Value should be
+ # a node/anchor or float in the tree.
+ 'macros' => {}, # the key is the user-defined macro name. The
+ # value is the reference on a macro element
+ # as obtained by parsing the @macro
+ 'merged_indices' => {}, # the key is merged in the value
+ 'novalidate' => 0, # same as setting @novalidate.
+ 'sections_level' => 0, # modified by raise/lowersections
+ 'values' => {'txicommandconditionals' => 1},
+ # the key is the name, the value the @set name
+ # argument. A Texinfo tree may also be used.
+);
+
+# command-line options
+#my @command_line_settable_at_commands = ('footnotestyle', 'novalidate',
+# 'documentlanguage', 'paragraphindent');
+
+
+# FIXME maybe this should better be set as texinfo passed to texi2any as
+# texi2dvi --command
+
+# customization options
+our %document_settable_at_commands = (
+ 'allowcodebreaks' => 'true',
+ 'clickstyle' => '@arrow',
+ 'codequotebacktick' => 'off',
+ 'codequoteundirected' => 'off',
+ 'contents' => 0,
+ 'deftypefnnewline' => 'off',
+ 'documentencoding' => 'us-ascii',
+ 'documentlanguage' => 'en',
+ # is N ems in TeX, 0.4 in.
+ 'exampleindent' => 5,
+ 'firstparagraphindent' => 'none',
+ 'frenchspacing' => 'off',
+ 'headings' => 'on',
+ 'kbdinputstyle' => 'distinct',
+ 'paragraphindent' => 3,
+ 'shortcontents' => 0,
+ 'urefbreakstyle' => 'after',
+ 'xrefautomaticsectiontitle' => 'off',
+);
+
+# those should be unique
+our %document_settable_unique_at_commands = (
+ # when passed through a configuration variable, documentdescription
+ # should be already formatted for HTML
+ 'documentdescription' => undef,
+ 'evenfootingmarks' => undef,
+ 'evenheadingmarks' => undef,
+ 'everyfootingmarks' => 'bottom',
+ 'everyheadingmarks' => 'bottom',
+ 'fonttextsize' => 11,
+ 'footnotestyle' => 'end',
+ 'novalidate' => 0,
+ 'oddfootingmarks' => undef,
+ 'oddheadingmarks' => undef,
+ # FIXME not clear here.
+ 'pagesizes' => undef,
+ 'setchapternewpage' => 'on',
+ 'setcontentsaftertitlepage' => 0,
+ 'setfilename' => undef,
+ 'setshortcontentsaftertitlepage' => 0,
+ 'everyheading' => undef,
+ 'everyfooting' => undef,
+ 'evenheading' => undef,
+ 'evenfooting' => undef,
+ 'oddheading' => undef,
+ 'oddfooting' => undef,
+);
+
+my @command_line_settables = ('FILLCOLUMN', 'SPLIT', 'SPLIT_SIZE',
+ 'HEADERS',
+ 'MACRO_EXPAND', 'NUMBER_SECTIONS',
+ 'NUMBER_FOOTNOTES', 'NODE_FILES',
+ 'NO_WARN', 'VERBOSE',
+ 'TRANSLITERATE_FILE_NAMES', 'ERROR_LIMIT', 'ENABLE_ENCODING',
+ 'FORCE', 'INTERNAL_LINKS', 'OUTFILE', 'SUBDIR', 'OUT',
+ 'SILENT', 'CASE_INSENSITIVE_FILENAMES',
+);
+
+# documented in the Texinfo::Parser pod section
+# all are lower cased in texi2any.pl
+my @parser_options = map {uc($_)} (keys(%default_parser_state_configuration));
+
+my @obsolete_variables = ('TOP_HEADING_AT_BEGINNING', 'USE_SECTIONS',
+ 'IDX_SUMMARY', 'I18N_PERL_HASH', 'USE_UNICODE', 'USE_NLS',
+ 'USE_UP_FOR_ADJACENT_NODES', 'SEPARATE_DESCRIPTION',
+ 'NEW_CROSSREF_STYLE', 'SHORT_REF', 'IGNORE_PREAMBLE_TEXT',
+ 'OUT_ENCODING',
+ 'IN_ENCODING', 'DEFAULT_ENCODING');
+
+my @variable_settables_not_used = ('COMPLETE_IMAGE_PATHS', 'TOC_FILE',
+ 'SPLIT_INDEX');
+
+my @formats_settable = (
+);
+
+my @variable_string_settables = (
+ 'DEBUG', 'FRAMES', 'FRAMESET_DOCTYPE', 'DOCTYPE', 'TEST', 'DUMP_TEXI',
+ 'TOP_FILE', 'SHOW_MENU', 'USE_NODES', 'TOC_LINKS', 'SHORTEXTN',
+ 'PREFIX', 'DEF_TABLE', 'L2H', 'MONOLITHIC',
+ 'L2H_L2H', 'L2H_SKIP', 'L2H_TMP', 'L2H_FILE', 'L2H_CLEAN',
+ 'L2H_HTML_VERSION', 'EXTERNAL_DIR', 'USE_ISO',
+ 'VERTICAL_HEAD_NAVIGATION', 'INLINE_CONTENTS', 'NODE_FILE_EXTENSION',
+ 'NO_CSS', 'INLINE_CSS_STYLE', 'USE_TITLEPAGE_FOR_TITLE',
+ 'SIMPLE_MENU', 'EXTENSION', 'INLINE_INSERTCOPYING', 'USE_NUMERIC_ENTITY',
+ 'ENABLE_ENCODING_USE_ENTITY', 'ICONS',
+ 'USE_UNIDECODE', 'DATE_IN_HEADER', 'OPEN_QUOTE_SYMBOL',
+ 'CLOSE_QUOTE_SYMBOL', 'TOP_NODE_UP', 'TOP_NODE_UP_URL', 'TOP_NODE_FILE',
+ 'TOP_NODE_FILE_TARGET', 'SHOW_TITLE', 'WORDS_IN_PAGE',
+ 'HEADER_IN_TABLE', 'USE_ACCESSKEY', 'USE_REL_REV', 'USE_LINKS',
+ 'OVERVIEW_LINK_TO_TOC', 'AVOID_MENU_REDUNDANCY', 'NODE_NAME_IN_MENU',
+ 'NODE_NAME_IN_INDEX', 'NO_USE_SETFILENAME', 'USE_SETFILENAME_EXTENSION',
+ 'COMPLEX_FORMAT_IN_TABLE',
+ 'IGNORE_BEFORE_SETFILENAME', 'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME',
+ 'USE_NODE_TARGET',
+ 'PROGRAM_NAME_IN_FOOTER', 'NODE_FILENAMES',
+ 'EXTERNAL_CROSSREF_SPLIT', 'BODYTEXT',
+ 'CSS_LINES', 'RENAMED_NODES_REDIRECTIONS', 'RENAMED_NODES_FILE',
+ 'CPP_LINE_DIRECTIVES',
+ 'TEXI2DVI', 'DUMP_TREE', 'MAX_MACRO_CALL_NESTING',
+ 'INPUT_ENCODING_NAME', 'INPUT_PERL_ENCODING',
+ 'OUTPUT_ENCODING_NAME', 'OUTPUT_PERL_ENCODING',
+ 'PACKAGE_VERSION',
+ 'PACKAGE_AND_VERSION', 'PACKAGE_URL', 'PACKAGE', 'PACKAGE_NAME', 'PROGRAM',
+ 'PRE_BODY_CLOSE', 'AFTER_BODY_OPEN', 'PRE_ABOUT', 'AFTER_ABOUT',
+ 'EXTRA_HEAD', 'DO_ABOUT',
+ 'DEFAULT_RULE', 'BIG_RULE',
+ 'MENU_ENTRY_COLON', 'INDEX_ENTRY_COLON', 'MENU_SYMBOL',
+ 'MAX_HEADER_LEVEL', 'CHAPTER_HEADER_LEVEL',
+ 'FOOTNOTE_END_HEADER_LEVEL', 'FOOTNOTE_SEPARATE_HEADER_LEVEL',
+ 'USE_UP_NODE_FOR_ELEMENT_UP',
+ 'BEFORE_OVERVIEW', 'AFTER_OVERVIEW',
+ 'BEFORE_TOC_LINES', 'AFTER_TOC_LINES',
+ 'SORT_ELEMENT_COUNT', 'SORT_ELEMENT_COUNT_WORDS',
+ 'KEEP_TOP_EXTERNAL_REF',
+ 'TEXI2HTML', 'IMAGE_LINK_PREFIX', 'FIX_TEXINFO',
+ 'TREE_TRANSFORMATIONS', 'BASEFILENAME_LENGTH',
+ 'TEXTCONTENT_COMMENT', 'XREF_USE_FLOAT_LABEL', 'XREF_USE_NODE_NAME_ARG',
+ 'MACRO_BODY_IGNORES_LEADING_SPACE', 'CHECK_HTMLXREF',
+ 'TEXINFO_DTD_VERSION', 'TEXINFO_COLUMN_FOR_DESCRIPTION',
+ 'TEXINFO_OUTPUT_FORMAT', 'INFO_SPECIAL_CHARS_WARNING',
+ 'INDEX_SPECIAL_CHARS_WARNING',
+);
+# Not strings.
+# FIXME To be documented somewhere, but where?
+my @variable_other_settables = (
+ 'LINKS_BUTTONS', 'TOP_BUTTONS', 'SECTION_BUTTONS', 'BUTTONS_TEXT',
+ 'BUTTONS_ACCESSKEY', 'BUTTONS_REL', 'BUTTONS_GOTO',
+ 'CHAPTER_FOOTER_BUTTONS', 'SECTION_FOOTER_BUTTONS',
+ 'NODE_FOOTER_BUTTONS',
+ 'MISC_BUTTONS', 'CHAPTER_BUTTONS', 'BUTTONS_NAME',
+ 'BUTTONS_EXAMPLE', 'SPECIAL_ELEMENTS_NAME', 'SPECIAL_ELEMENTS_CLASS',
+ 'ACTIVE_ICONS', 'PASSIVE_ICONS',
+ 'CSS_FILES', 'CSS_REFS',
+ 'GLOBAL_COMMANDS',
+);
+
+my %valid_options;
+foreach my $var (keys(%document_settable_at_commands),
+ keys(%document_settable_unique_at_commands),
+ @command_line_settables, @variable_string_settables,
+ @variable_other_settables, @parser_options,
+ @formats_settable,
+ @obsolete_variables, @variable_settables_not_used) {
+ $valid_options{$var} = 1;
+}
+
+my %obsolete_options;
+foreach my $var (@obsolete_variables) {
+ $obsolete_options{$var} = 1;
+}
+
+sub valid_option($)
+{
+ my $option = shift;
+ return $valid_options{$option};
+}
+
+sub obsolete_option($)
+{
+ my $option = shift;
+ return $obsolete_options{$option};
+}
+
+my %customization_variable_classes = (
+ 'document_settable_at_commands' => [
sort(keys(%document_settable_at_commands)) ],
+ 'document_settable_unique_at_commands' => [
sort(keys(%document_settable_unique_at_commands)) ],
+ 'command_line_settables' => address@hidden,
+ 'variable_string_settables' => address@hidden,
+ 'variable_other_settables' => address@hidden,
+ 'parser_options' => address@hidden,
+ #'formats_settable' => address@hidden,
+ 'obsolete_variables' => address@hidden,
+ 'variable_settables_not_used' => address@hidden,
+);
+
+my @secondary_customization_variables = (
+ 'obsolete_variables', 'variable_settables_not_used'
+);
+sub _customization_variable_classes(;$)
+{
+ my $print_all = shift;
+ my $result = '';
+ foreach my $type (sort(keys(%customization_variable_classes))) {
+ next if (!$print_all
+ and grep {$_ eq $type} @secondary_customization_variables);
+ foreach my $variable (@{$customization_variable_classes{$type}}) {
+ $result .= "$variable\t$type\n";
+ }
+ }
+ return $result;
+}
+
+my %valid_tree_transformations;
+foreach my $valid_transformation ('simple_menus',
+ 'fill_gaps_in_sectioning', 'move_index_entries_after_items',
+ 'insert_nodes_for_sectioning_commands',
+ 'complete_tree_nodes_menus', 'regenerate_master_menu',
+ 'indent_menu_descriptions') {
+ $valid_tree_transformations{$valid_transformation} = 1;
+}
+
+sub valid_tree_transformation ($)
+{
+ my $transformation = shift;
+ return 1 if (defined($transformation)
+ and $valid_tree_transformations{$transformation});
+ return 0;
+}
+
+our %no_brace_commands; # commands never taking braces
+%no_brace_commands = (
+ '*', "\n",
+ ' ', ' ',
+ "\t", ' ',
+ "\n", ' ',
+ '-', '', # hyphenation hint
+ '|', '', # used in formatting commands @evenfooting and friends
+ '/', '',
+ ':', '',
+ '!', '!',
+ '?', '?',
+ '.', '.',
+ '@', '@',
+ '}', '}',
+ '{', '{',
+ '\\', '\\', # should only appear in math
+);
+
+
+# commands taking a line as argument or no argument.
+# sectioning commands and def* commands are added below.
+# index commands are added dynamically.
+#
+# The values signification is:
+# special: no value and macro expansion, all the line is used, and
+# analysed during parsing (_parse_special_misc_command)
+# lineraw: no value and macro expansion, the line is kept as-is, not
+# analysed
+# skipline: no argument, everything else on the line is skipped
+# skipspace: no argument, following spaces are skipped.
+# noarg: no argument
+# text: the line is parsed as texinfo, and the argument is converted
+# to simple text (in _end_line)
+# line: the line is parsed as texinfo
+# a number: the line is parsed as texinfo and the result should be plain
+# text maybe followed by a comment; the result is analysed
+# during parsing (_parse_line_command_args).
+# The number is an indication of the number of arguments of
+# the command.
+#
+# Beware that @item and @itemx may be like 'line' or 'skipspace' depending
+# on the context.
+our %misc_commands = (
+ 'node' => 'line', # special arg
+ 'bye' => 'skipline', # no arg
+ 'end' => 'text',
+ # set, clear
+ 'set' => 'special', # special arg
+ 'clear' => 'special', # special arg
+ 'unmacro' => 'special',
+ # comments
+ 'comment' => 'lineraw',
+ 'c' => 'lineraw',
+ # special
+ 'definfoenclose' => 3,
+ 'alias' => 2,
+ # number of arguments is not known in advance.
+ 'columnfractions' => 1,
+ # file names
+ 'setfilename' => 'text',
+ 'verbatiminclude' => 'text',
+ 'include' => 'text',
+
+ 'raisesections' => 'skipline', # no arg
+ 'lowersections' => 'skipline', # no arg
+ 'contents' => 'skipline', # no arg
+ 'shortcontents' => 'skipline', # no arg
+ 'summarycontents' => 'skipline', # no arg
+ 'insertcopying' => 'noarg', # no arg
+ 'clickstyle' => 'special', # arg should be an @-command
+ # more relevant in preamble
+ 'setcontentsaftertitlepage' => 'skipline', # no arg
+ 'setshortcontentsaftertitlepage' => 'skipline', # no arg
+ 'documentencoding' => 'text', # or 1?
+ 'novalidate' => 'skipline', # no arg
+ 'dircategory' => 'line', # line. Position with regard
+ # with direntry is significant
+ 'pagesizes' => 'line', # can have 2 args
+ # or one? 200mm,150mm 11.5in
+ 'finalout' => 'skipline', # no arg
+ 'paragraphindent' => 1, # arg none asis
+ # or a number and forbids anything else on the line
+ 'firstparagraphindent' => 1, # none insert
+ 'frenchspacing' => 1, # on off
+ 'codequoteundirected' => 1, # on off
+ 'codequotebacktick' => 1, # on off
+ 'xrefautomaticsectiontitle' => 1, # on off
+ 'deftypefnnewline' => 1, # on off
+ 'fonttextsize' => 1, # 10 11
+ 'allowcodebreaks' => 1, # false or true
+ 'exampleindent' => 1, # asis or a number
+ 'footnotestyle' => 1, # end and separate, nothing else on the line
+ 'urefbreakstyle' => 1, # after|before|none
+ 'afourpaper' => 'skipline', # no arg
+ 'afivepaper' => 'skipline', # no arg
+ 'afourlatex' => 'skipline', # no arg
+ 'afourwide' => 'skipline', # no arg
+ 'headings' => 1, #off on single double singleafter doubleafter
+ # interacts with setchapternewpage
+ 'setchapternewpage' => 1, # off on odd
+
+ # only relevant in TeX, and special
+ 'everyheading' => 'lineraw', # @*heading @*footing use @|
+ 'everyfooting' => 'lineraw', # + @thispage @thissectionname
+ 'evenheading' => 'lineraw', # @thissectionnum @thissection
+ 'evenfooting' => 'lineraw', # @thischaptername @thischapternum
+ 'oddheading' => 'lineraw', # @thischapter @thistitle @thisfile
+ 'oddfooting' => 'lineraw',
+
+ 'smallbook' => 'skipline', # no arg
+ 'syncodeindex' => 2, # args are index identifiers
+ 'synindex' => 2,
+ 'defindex' => 1, # one identifier arg
+ 'defcodeindex' => 1, # one identifier arg
+ 'documentlanguage' => 'text', # language code arg
+ 'kbdinputstyle' => 1, # code example distinct
+ 'everyheadingmarks' => 1, # top bottom
+ 'everyfootingmarks' => 1,
+ 'evenheadingmarks' => 1,
+ 'oddheadingmarks' => 1,
+ 'evenfootingmarks' => 1,
+ 'oddfootingmarks' => 1,
+ # not valid for info (should be in @iftex)
+ 'cropmarks' => 'skipline', # no arg
+
+ # formatting
+ 'center' => 'line',
+ 'printindex' => 1,
+ 'listoffloats' => 'line',
+ # especially in titlepage
+# 'shorttitle' => 'line',
+ 'shorttitlepage' => 'line',
+ 'settitle' => 'line',
+ 'author' => 'line',
+ 'subtitle' => 'line',
+ 'title' => 'line',
+ 'sp' => 1, # numerical arg
+ 'page' => 'skipline', # no arg (pagebreak)
+ 'need' => 1, # one numerical/real arg
+ # formatting
+ 'noindent' => 'skipspace', # no arg
+ 'indent' => 'skipspace',
+ 'exdent' => 'line',
+ 'headitem' => 'skipspace',
+ 'item' => 'skipspace', # or line, depending on the context
+ 'itemx' => 'skipspace', # or line, depending on the context
+ 'tab' => 'skipspace',
+ # only valid in heading or footing
+ 'thischapter' => 'noarg',
+ 'thischaptername' => 'noarg',
+ 'thischapternum' => 'noarg',
+ 'thisfile' => 'noarg',
+ 'thispage' => 'noarg',
+ 'thistitle' => 'noarg',
+ # not valid for info (should be in @iftex)
+ 'vskip' => 'lineraw', # arg line in TeX
+ # obsolete @-commands.
+ 'refill' => 'noarg', # no arg (obsolete, to be ignored)
+ # Remove spaces and end of lines after the
+ # commands? If no, they can lead to empty lines
+ 'quote-arg' => 'skipline',
+ 'allow-recursion' => 'skipline',
+);
+
+# key is index name, keys of the reference value are the prefixes.
+# value associated with the prefix is 0 if the prefix is not a code-like
+# prefix, 1 if it is a code-like prefix (set by defcodeindex/syncodeindex).
+#our %index_names = (
+# 'cp' => {'cp' => 0, 'c' => 0},
+# 'fn' => {'fn' => 1, 'f' => 1},
+# 'vr' => {'vr' => 1, 'v' => 1},
+# 'ky' => {'ky' => 1, 'k' => 1},
+# 'pg' => {'pg' => 1, 'p' => 1},
+# 'tp' => {'tp' => 1, 't' => 1}
+#);
+
+our %index_names = (
+ 'cp' => {'prefix' => ['c'], 'in_code' => 0},
+ 'fn' => {'prefix' => ['f'], 'in_code' => 1},
+ 'vr' => {'prefix' => ['v'], 'in_code' => 1},
+ 'ky' => {'prefix' => ['k'], 'in_code' => 1},
+ 'pg' => {'prefix' => ['p'], 'in_code' => 1},
+ 'tp' => {'prefix' => ['t'], 'in_code' => 1},
+);
+
+foreach my $index(keys(%index_names)) {
+ $index_names{$index}->{'name'} = $index;
+ push @{$index_names{$index}->{'prefix'}}, $index;
+}
+
+our %default_index_commands;
+# all the commands are readded dynamically in the Parser.
+foreach my $index_name (keys (%index_names)) {
+ foreach my $index_prefix (@{$index_names{$index_name}->{'prefix'}}) {
+ next if ($index_prefix eq $index_name);
+ # only put the one letter versions in the hash.
+ $misc_commands{$index_prefix.'index'} = 'line';
+ $default_index_commands{$index_prefix.'index'} = 1;
+ }
+}
+
+# command with braces. Value is the max number of arguments.
+our %brace_commands;
+
+our %letter_no_arg_commands;
+foreach my $letter_no_arg_command ('aa','AA','ae','oe','AE','OE','o','O',
+ 'ss','l','L','DH','dh','TH','th') {
+ $letter_no_arg_commands{$letter_no_arg_command} = 1;
+ $brace_commands{$letter_no_arg_command} = 0;
+}
+
+foreach my $no_arg_command ('TeX','LaTeX','bullet','copyright',
+ 'registeredsymbol','dots','enddots','equiv','error','expansion','arrow',
+ 'minus','point','print','result','today',
+ 'exclamdown','questiondown','pounds','ordf','ordm',
+ 'atchar', 'lbracechar', 'rbracechar', 'backslashchar', 'hashchar', 'comma',
+ 'euro', 'geq','leq','tie','textdegree','click',
+ 'quotedblleft','quotedblright','quoteleft','quoteright','quotedblbase',
+ 'quotesinglbase','guillemetleft','guillemetright','guillemotleft',
+ 'guillemotright','guilsinglleft','guilsinglright') {
+ $brace_commands{$no_arg_command} = 0;
+}
+
+# accent commands. They may be called with and without braces.
+our %accent_commands;
+foreach my $accent_command ('"','~','^','`',"'",',','=',
+ 'ringaccent','H','dotaccent','u','ubaraccent',
+ 'udotaccent','v','ogonek','tieaccent', 'dotless') {
+ $accent_commands{$accent_command} = 1;
+ $brace_commands{$accent_command} = 1;
+}
+
+our %style_commands;
+foreach my $style_command ('asis','cite','clicksequence',
+ 'dfn', 'emph',
+ 'sc', 't', 'var',
+ 'headitemfont', 'code', 'command', 'env', 'file', 'kbd',
+ 'option', 'samp', 'strong') {
+ $brace_commands{$style_command} = 1;
+ $style_commands{$style_command} = 1;
+}
+
+our %regular_font_style_commands;
+foreach my $command ('r', 'i', 'b', 'sansserif', 'slanted') {
+ $regular_font_style_commands{$command} = 1;
+ $brace_commands{$command} = 1;
+ $style_commands{$command} = 1;
+}
+
+foreach my $one_arg_command (
+ 'ctrl','dmn', 'w', 'key',
+ 'titlefont','hyphenation','anchor','errormsg') {
+ $brace_commands{$one_arg_command} = 1;
+}
+
+our %code_style_commands;
+foreach my $command ('code', 'command', 'env', 'file', 'kbd', 'key', 'option',
+ 'samp', 'indicateurl', 'verb', 't') {
+ $code_style_commands{$command} = 1;
+ $brace_commands{$command} = 1;
+}
+
+
+# Commands that enclose full texts
+our %context_brace_commands;
+foreach my $context_brace_command ('footnote', 'caption', 'shortcaption',
'math') {
+ $context_brace_commands{$context_brace_command} = $context_brace_command;
+ $brace_commands{$context_brace_command} = 1;
+}
+
+our %explained_commands;
+foreach my $explained_command ('abbr', 'acronym') {
+ $explained_commands{$explained_command} = 1;
+ $brace_commands{$explained_command} = 2;
+}
+
+our %inline_format_commands;
+our %inline_commands;
+foreach my $inline_format_command ('inlineraw', 'inlinefmt',
+ 'inlinefmtifelse') {
+ $inline_format_commands{$inline_format_command} = 1;
+ $brace_commands{$inline_format_command} = 2;
+ $inline_commands{$inline_format_command} = 1;
+}
+
+$brace_commands{'inlinefmtifelse'} = 3;
+
+our %inline_conditional_commands;
+foreach my $inline_conditional_command ('inlineifclear', 'inlineifset') {
+ $inline_conditional_commands{$inline_conditional_command} = 1;
+ $brace_commands{$inline_conditional_command} = 2;
+ $inline_commands{$inline_conditional_command} = 1;
+}
+
+# 'inlineset', 'inlineclear'
+#$brace_commands{'inlineclear'} = 1;
+
+foreach my $two_arg_command('email') {
+ $brace_commands{$two_arg_command} = 2;
+}
+
+foreach my $three_arg_command('uref','url','inforef') {
+ $brace_commands{$three_arg_command} = 3;
+}
+
+foreach my $five_arg_command('xref','ref','pxref','image') {
+ $brace_commands{$five_arg_command} = 5;
+}
+
+
+# some classification to help converters
+our %ref_commands;
+foreach my $ref_command ('xref','ref','pxref','inforef') {
+ $ref_commands{$ref_command} = 1;
+}
+
+
+our %in_heading_commands;
+foreach my $in_heading_command ('thischapter', 'thischaptername',
+ 'thischapternum', 'thisfile', 'thispage', 'thistitle') {
+ $in_heading_commands{$in_heading_command} = 1;
+}
+
+# brace command that is not replaced with text.
+my %unformatted_brace_commands;
+foreach my $unformatted_brace_command ('anchor', 'shortcaption',
+ 'caption', 'hyphenation', 'errormsg') {
+ $unformatted_brace_commands{$unformatted_brace_command} = 1;
+}
+
+
+# commands delimiting blocks, with an @end.
+# Value is either the number of arguments on the line separated by
+# commas or the type of command, 'raw', 'def' or 'multitable'.
+our %block_commands;
+
+# commands that have a possible content before an item
+our %block_item_commands;
+
+sub gdt($)
+{
+ return $_[0];
+}
+
+our %def_map = (
+ # basic commands.
+ # 'arg' and 'argtype' are for everything appearing after the other
+ # arguments.
+ 'deffn', [ 'category', 'name', 'arg' ],
+ 'defvr', [ 'category', 'name' ],
+ 'deftypefn', [ 'category', 'type', 'name', 'argtype' ],
+ 'deftypeop', [ 'category', 'class' , 'type', 'name', 'argtype' ],
+ 'deftypevr', [ 'category', 'type', 'name' ],
+ 'defcv', [ 'category', 'class' , 'name' ],
+ 'deftypecv', [ 'category', 'class' , 'type', 'name' ],
+ 'defop', [ 'category', 'class' , 'name', 'arg' ],
+ 'deftp', [ 'category', 'name', 'argtype' ],
+ # shortcuts
+ 'defun', {'deffn' => gdt('Function')},
+ 'defmac', {'deffn' => gdt('Macro')},
+ 'defspec', {'deffn' => '{'.gdt('Special Form').'}'},
+ 'defvar', {'defvr' => gdt('Variable')},
+ 'defopt', {'defvr' => '{'.gdt('User Option').'}'},
+ 'deftypefun', {'deftypefn' => gdt('Function')},
+ 'deftypevar', {'deftypevr' => gdt('Variable')},
+ 'defivar', {'defcv' => '{'.gdt('Instance Variable').'}'},
+ 'deftypeivar', {'deftypecv' => '{'.gdt('Instance Variable').'}'},
+ 'defmethod', {'defop' => gdt('Method')},
+ 'deftypemethod', {'deftypeop' => gdt('Method')},
+);
+
+# the type of index, f: function, v: variable, t: type
+my %index_type_def = (
+ 'f' => ['deffn', 'deftypefn', 'deftypeop', 'defop'],
+ 'v' => ['defvr', 'deftypevr', 'defcv', 'deftypecv' ],
+ 't' => ['deftp']
+);
+
+our %command_index_prefix;
+
+$command_index_prefix{'vtable'} = 'v';
+$command_index_prefix{'ftable'} = 'f';
+
+foreach my $index_type (keys %index_type_def) {
+ foreach my $def (@{$index_type_def{$index_type}}) {
+ $command_index_prefix{$def} = $index_type;
+ }
+}
+
+our %def_commands;
+our %def_aliases;
+foreach my $def_command(keys %def_map) {
+ if (ref($def_map{$def_command}) eq 'HASH') {
+ my ($real_command) = keys (%{$def_map{$def_command}});
+ $command_index_prefix{$def_command} = $command_index_prefix{$real_command};
+ $def_aliases{$def_command} = $real_command;
+ }
+ $block_commands{$def_command} = 'def';
+ $misc_commands{$def_command.'x'} = 'line';
+ $def_commands{$def_command} = 1;
+ $def_commands{$def_command.'x'} = 1;
+ $command_index_prefix{$def_command.'x'} =
$command_index_prefix{$def_command};
+}
+
+#print STDERR "".Data::Dumper->Dump([\%def_aliases]);
+#print STDERR "".Data::Dumper->Dump([\%def_prepended_content]);
+
+$block_commands{'multitable'} = 'multitable';
+$block_item_commands{'multitable'} = 1;
+
+# block commands in which menu entry and menu comments appear
+our %menu_commands;
+foreach my $menu_command ('menu', 'detailmenu', 'direntry') {
+ $menu_commands{$menu_command} = 1;
+ $block_commands{$menu_command} = 0;
+};
+
+our %align_commands;
+foreach my $align_command('raggedright', 'flushleft', 'flushright') {
+ $block_commands{$align_command} = 0;
+ $align_commands{$align_command} = 1;
+}
+$align_commands{'center'} = 1;
+
+foreach my $block_command(
+ 'cartouche', 'group', 'indentedblock', 'smallindentedblock') {
+ $block_commands{$block_command} = 0;
+}
+
+our %region_commands;
+foreach my $block_command('titlepage', 'copying', 'documentdescription') {
+ $block_commands{$block_command} = 0;
+ $region_commands{$block_command} = 1;
+}
+
+our %preformatted_commands;
+our %preformatted_code_commands;
+foreach my $preformatted_command(
+ 'example', 'smallexample', 'lisp', 'smalllisp') {
+ $block_commands{$preformatted_command} = 0;
+ $preformatted_commands{$preformatted_command} = 1;
+ $preformatted_code_commands{$preformatted_command} = 1;
+}
+
+foreach my $preformatted_command(
+ 'display', 'smalldisplay', 'format', 'smallformat') {
+ $block_commands{$preformatted_command} = 0;
+ $preformatted_commands{$preformatted_command} = 1;
+}
+
+our %format_raw_commands;
+foreach my $format_raw_command('html', 'tex', 'xml', 'docbook') {
+ $block_commands{$format_raw_command} = 0;
+ $format_raw_commands{$format_raw_command} = 1;
+}
+
+our %raw_commands;
+# macro/rmacro are special
+foreach my $raw_command ('verbatim',
+ 'ignore', 'macro', 'rmacro') {
+ $block_commands{$raw_command} = 'raw';
+ $raw_commands{$raw_command} = 1;
+}
+
+our %texinfo_output_formats;
+foreach my $command (keys(%format_raw_commands), 'info', 'plaintext') {
+ $block_commands{'if' . $command} = 'conditional';
+ $block_commands{'ifnot' . $command} = 'conditional';
+ $texinfo_output_formats{$command} = $command;
+}
+
+$block_commands{'ifset'} = 'conditional';
+$block_commands{'ifclear'} = 'conditional';
+
+$block_commands{'ifcommanddefined'} = 'conditional';
+$block_commands{'ifcommandnotdefined'} = 'conditional';
+
+# 'macro' ?
+foreach my $block_command_one_arg('table', 'ftable', 'vtable',
+ 'itemize', 'enumerate', 'quotation', 'smallquotation') {
+ $block_commands{$block_command_one_arg} = 1;
+ $block_item_commands{$block_command_one_arg} = 1
+ unless ($block_command_one_arg =~ /quotation/);
+}
+
+$block_commands{'float'} = 2;
+
+# commands that forces closing an opened paragraph.
+our %close_paragraph_commands;
+
+foreach my $block_command (keys(%block_commands)) {
+ $close_paragraph_commands{$block_command} = 1
+ unless ($block_commands{$block_command} eq 'raw' or
+ $block_commands{$block_command} eq 'conditional'
+ or $format_raw_commands{$block_command});
+}
+
+$close_paragraph_commands{'verbatim'} = 1;
+
+foreach my $close_paragraph_command ('titlefont', 'insertcopying', 'sp',
+ 'verbatiminclude', 'page', 'item', 'itemx', 'tab', 'headitem',
+ 'printindex', 'listoffloats', 'center', 'dircategory', 'contents',
+ 'shortcontents', 'summarycontents', 'caption', 'shortcaption',
+ 'setfilename', 'exdent') {
+ $close_paragraph_commands{$close_paragraph_command} = 1;
+}
+
+foreach my $close_paragraph_command (keys(%def_commands)) {
+ $close_paragraph_commands{$close_paragraph_command} = 1;
+}
+
+our %item_container_commands;
+foreach my $item_container_command ('itemize', 'enumerate') {
+ $item_container_commands{$item_container_command} = 1;
+}
+our %item_line_commands;
+foreach my $item_line_command ('table', 'ftable', 'vtable') {
+ $item_line_commands{$item_line_command} = 1;
+}
+
+our %deprecated_commands = (
+ 'ctrl' => '',
+ 'allow-recursion' => N__('recursion is always allowed'),
+ 'quote-arg' => N__('arguments are quoted by default'),
+);
+
+my %unformatted_block_commands;
+foreach my $unformatted_block_command ('ignore', 'macro', 'rmacro') {
+ $unformatted_block_commands{$unformatted_block_command} = 1;
+}
+
+
+# commands that should only appear at the root level and contain up to
+# the next root command. @node and sectioning commands.
+our %root_commands;
+
+our %command_structuring_level = (
+ 'top', 0,
+ 'chapter', 1,
+ 'unnumbered', 1,
+ 'chapheading', 1,
+ 'appendix', 1,
+ 'section', 2,
+ 'unnumberedsec', 2,
+ 'heading', 2,
+ 'appendixsec', 2,
+ 'subsection', 3,
+ 'unnumberedsubsec', 3,
+ 'subheading', 3,
+ 'appendixsubsec', 3,
+ 'subsubsection', 4,
+ 'unnumberedsubsubsec', 4,
+ 'subsubheading', 4,
+ 'appendixsubsubsec', 4,
+ );
+
+our %level_to_structuring_command;
+
+{
+ my $sections = [ ];
+ my $appendices = [ ];
+ my $unnumbered = [ ];
+ my $headings = [ ];
+ foreach my $command (keys (%command_structuring_level)) {
+ if ($command =~ /^appendix/) {
+ $level_to_structuring_command{$command} = $appendices;
+ } elsif ($command =~ /^unnumbered/ or $command eq 'top') {
+ $level_to_structuring_command{$command} = $unnumbered;
+ } elsif ($command =~ /section$/ or $command eq 'chapter') {
+ $level_to_structuring_command{$command} = $sections;
+ } else {
+ $level_to_structuring_command{$command} = $headings;
+ }
+
$level_to_structuring_command{$command}->[$command_structuring_level{$command}]
+ = $command;
+ }
+ $level_to_structuring_command{'appendixsection'} = $appendices;
+ $level_to_structuring_command{'majorheading'} = $headings;
+ $level_to_structuring_command{'centerchap'} = $unnumbered;
+}
+
+
+# out of the main hierarchy
+$command_structuring_level{'part'} = 0;
+# this are synonyms
+$command_structuring_level{'appendixsection'} = 2;
+# command_structuring_level{'majorheading'} is also 1 and not 0
+$command_structuring_level{'majorheading'} = 1;
+$command_structuring_level{'centerchap'} = 1;
+
+our %sectioning_commands;
+
+foreach my $sectioning_command (keys (%command_structuring_level)) {
+ $misc_commands{$sectioning_command} = 'line';
+ if ($sectioning_command =~ /heading/) {
+ $close_paragraph_commands{$sectioning_command} = 1;
+ } else {
+ $root_commands{$sectioning_command} = 1;
+ }
+ $sectioning_commands{$sectioning_command} = 1;
+}
+
+# misc commands that may be formatted as text.
+# index commands may be too, but index command may be added with
+# @def*index so they are not added here.
+my %formatted_misc_commands;
+foreach my $formatted_misc_command ('insertcopying', 'contents',
+ 'shortcontents', 'summarycontents', 'center', 'printindex',
+ 'listoffloats', 'shorttitlepage', 'settitle',
+ 'author', 'subtitle', 'title', 'sp', 'exdent', 'headitem', 'item',
+ 'itemx', 'tab', 'node', keys(%sectioning_commands)) {
+ $formatted_misc_commands{$formatted_misc_command} = 1;
+}
+
+$root_commands{'node'} = 1;
+
+our %all_commands;
+foreach my $command (
+ keys(%Texinfo::Common::block_commands),
+ keys(%Texinfo::Common::brace_commands),
+ keys(%Texinfo::Common::misc_commands),
+ keys(%Texinfo::Common::no_brace_commands),
+ qw(value),
+ ) {
+ $all_commands{$command} = 1;
+}
+
+our @MONTH_NAMES =
+ (
+ 'January', 'February', 'March', 'April', 'May',
+ 'June', 'July', 'August', 'September', 'October',
+ 'November', 'December'
+ );
+
+sub locate_include_file($$)
+{
+ my $self = shift;
+ my $text = shift;
+ my $file;
+
+ my $ignore_include_directories = 0;
+
+ my ($volume, $directories, $filename) = File::Spec->splitpath($text);
+ my @directories = File::Spec->splitdir($directories);
+
+ #print STDERR "$self $text @{$self->{'include_directories'}}\n";
+ # If the path is absolute or begins with . or .., do not search in
+ # include directories.
+ if (File::Spec->file_name_is_absolute($text)) {
+ $ignore_include_directories = 1;
+ } else {
+ foreach my $dir (@directories) {
+ if ($dir eq File::Spec->updir() or $dir eq File::Spec->curdir()) {
+ $ignore_include_directories = 1;
+ last;
+ } elsif ($dir ne '') {
+ last;
+ }
+ }
+ }
+
+ #if ($text =~ m,^(/|\./|\.\./),) {
+ if ($ignore_include_directories) {
+ $file = $text if (-e $text and -r $text);
+ } else {
+ my @dirs;
+ if ($self) {
+ @dirs = @{$self->{'include_directories'}};
+ } else {
+ # no object with directory list and not an absolute path, never succeed
+ return undef;
+ }
+ foreach my $include_dir (@{$self->{'include_directories'}}) {
+ my ($include_volume, $include_directories, $include_filename)
+ = File::Spec->splitpath($include_dir, 1);
+
+ my $possible_file = File::Spec->catpath($include_volume,
+ File::Spec->catdir(File::Spec->splitdir($include_directories),
+ @directories), $filename);
+ #$file = "$include_dir/$text" if (-e "$include_dir/$text" and -r
"$include_dir/$text");
+ $file = "$possible_file" if (-e "$possible_file" and -r
"$possible_file");
+ last if (defined($file));
+ }
+ }
+ return $file;
+}
+
+sub open_out($$;$)
+{
+ my $self = shift;
+ my $file = shift;
+ my $encoding = shift;
+
+ if (!defined($encoding) and $self
+ and defined($self->get_conf('OUTPUT_PERL_ENCODING'))) {
+ $encoding = $self->get_conf('OUTPUT_PERL_ENCODING');
+ }
+
+ if ($file eq '-') {
+ binmode(STDOUT, ":encoding($encoding)") if ($encoding);
+ if ($self) {
+ $self->{'unclosed_files'}->{$file} = \*STDOUT;
+ }
+ return \*STDOUT;
+ }
+ my $filehandle = do { local *FH };
+ if (!open ($filehandle, '>', $file)) {
+ return undef;
+ }
+ if ($encoding) {
+ if ($encoding eq 'utf8' or $encoding eq 'utf-8-strict') {
+ binmode($filehandle, ':utf8');
+ } else { # FIXME also right for shiftijs or similar encodings?
+ binmode($filehandle, ':bytes');
+ }
+ binmode($filehandle, ":encoding($encoding)");
+ }
+ if ($self) {
+ push @{$self->{'opened_files'}}, $file;
+ $self->{'unclosed_files'}->{$file} = $filehandle;
+ #print STDERR "OOOOOOO $file ".join('|',@{$self->{'opened_files'}})."\n";
+ #cluck;
+ }
+ return $filehandle;
+}
+
+sub warn_unknown_language($$) {
+ my $lang = shift;
+ my $gettext = shift;
+
+ my @messages = ();
+ my $lang_code = $lang;
+ my $region_code;
+
+ if ($lang =~ /^([a-z]+)_([A-Z]+)/) {
+ $lang_code = $1;
+ $region_code = $2;
+ }
+
+ if (! $Texinfo::Documentlanguages::language_codes{$lang_code}) {
+ push @messages, sprintf(&$gettext(N__("%s is not a valid language code")),
+ $lang_code);
+ }
+ if (defined($region_code)
+ and ! $Texinfo::Documentlanguages::region_codes{$region_code}) {
+ push @messages, sprintf(&$gettext(N__("%s is not a valid region code")),
+ $region_code);
+ }
+ return @messages;
+}
+
+my %possible_split = (
+ 'chapter' => 1,
+ 'section' => 1,
+ 'node' => 1,
+);
+
+sub warn_unknown_split($$) {
+ my $split = shift;
+ my $gettext = shift;
+
+ my @messages = ();
+ if ($split and !$possible_split{$split}) {
+ push @messages, sprintf(&$gettext(N__("%s is not a valid split
possibility")),
+ $split);
+ }
+ return @messages;
+}
+
+# This should do the job, or at least don't do wrong if $self
+# is not defined, as could be the case if called from
+# Texinfo::Convert::Text.
+sub expand_verbatiminclude($$)
+{
+ my $self = shift;
+ my $current = shift;
+
+ return unless ($current->{'extra'} and
defined($current->{'extra'}->{'text_arg'}));
+ my $text = $current->{'extra'}->{'text_arg'};
+ my $file = locate_include_file($self, $text);
+
+ my $verbatiminclude;
+
+ if (defined($file)) {
+ if (!open(VERBINCLUDE, $file)) {
+ if ($self) {
+ $self->line_error(sprintf($self->__("could not read %s: %s"), $file,
$!),
+ $current->{'line_nr'});
+ }
+ } else {
+ if ($self and defined($self->get_conf('INPUT_PERL_ENCODING'))) {
+ binmode(VERBINCLUDE, ":encoding(".
+ $self->get_conf('INPUT_PERL_ENCODING').")");
+ }
+ $verbatiminclude = { 'cmdname' => 'verbatim',
+ 'parent' => $current->{'parent'},
+ 'extra' =>
+ {'text_arg' => $current->{'extra'}->{'text_arg'}} };
+ while (<VERBINCLUDE>) {
+ push @{$verbatiminclude->{'contents'}},
+ {'type' => 'raw', 'text' => $_ };
+ }
+ if (!close (VERBINCLUDE)) {
+ if ($self) {
+ $self->document_warn(sprintf($self->__(
+ "error on closing address@hidden file %s: %s"),
+ $file, $!));
+ }
+ }
+ }
+ } elsif ($self) {
+ $self->line_error(sprintf($self->__("address@hidden: could not find %s"),
+ $current->{'cmdname'}, $text), $current->{'line_nr'});
+ }
+ return $verbatiminclude;
+}
+
+sub definition_category($$)
+{
+ my $self = shift;
+ my $current = shift;
+
+ return undef if (!$current->{'extra'} or !$current->{'extra'}->{'def_args'});
+
+ my $arg_category = $current->{'extra'}->{'def_parsed_hash'}->{'category'};
+ my $arg_class = $current->{'extra'}->{'def_parsed_hash'}->{'class'};
+
+ return $arg_category
+ if (!defined($arg_class));
+
+ my $style =
+ $command_index_prefix{$current->{'extra'}->{'def_command'}};
+ if ($style eq 'f') {
+ if ($self) {
+ return $self->gdt('{category} on {class}', { 'category' => $arg_category,
+ 'class' => $arg_class });
+ } else {
+ return {'contents' => [$arg_category, {'text' => ' on '}, $arg_class]};
+ }
+ } elsif ($style eq 'v') {
+ if ($self) {
+ return $self->gdt('{category} of {class}', { 'category' => $arg_category,
+ 'class' => $arg_class });
+ } else {
+ return {'contents' => [$arg_category, {'text' => ' of '}, $arg_class]};
+ }
+ }
+}
+
+sub expand_today($)
+{
+ my $self = shift;
+ if ($self->get_conf('TEST')) {
+ return {'text' => 'a sunny day'};
+ }
+ my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
+ = localtime(time);
+ $year += ($year < 70) ? 2000 : 1900;
+ return $self->gdt('{month} {day}, {year}',
+ { 'month' => $self->gdt($MONTH_NAMES[$mon]),
+ 'day' => $mday, 'year' => $year });
+}
+
+sub translated_command_tree($$)
+{
+ my $self = shift;
+ my $cmdname = shift;
+ if ($self->{'translated_commands'}->{$cmdname}) {
+ return $self->gdt($self->{'translated_commands'}->{$cmdname});
+ }
+ return undef;
+}
+
+sub numbered_heading($$$;$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $text = shift;
+ my $numbered = shift;
+
+ my $number;
+ if (defined($current->{'number'}) and ($numbered or !defined($numbered))) {
+ $number = $current->{'number'};
+ }
+
+ my $result;
+ if ($self) {
+ if (defined($number)) {
+ if ($current->{'cmdname'} eq 'appendix' and $current->{'level'} == 1) {
+ $result = $self->gdt('Appendix {number} {section_title}',
+ {'number' => $number, 'section_title' => $text},
+ 'translated_text');
+ } else {
+ $result = $self->gdt('{number} {section_title}',
+ {'number' => $number, 'section_title' => $text},
+ 'translated_text');
+ }
+ } else {
+ $result = $text;
+ }
+ } else {
+ $result = $text;
+ $result = $number.' '.$result if (defined($number));
+ if ($current->{'cmdname'} eq 'appendix' and $current->{'level'} == 1) {
+ $result = 'Appendix '.$result;
+ }
+ }
+ chomp ($result);
+ return $result;
+}
+
+sub definition_arguments_content($)
+{
+ my $root = shift;
+ my $result;
+
+ return undef if (!defined($root->{'extra'})
+ or !defined($root->{'extra'}->{'def_args'}));
+ my @args = @{$root->{'extra'}->{'def_args'}};
+ while (@args) {
+ last if ($args[0]->[0] ne 'spaces'
+ and !$root->{'extra'}->{'def_parsed_hash'}->{$args[0]->[0]});
+ shift @args;
+ }
+ if (@args) {
+ foreach my $arg (@args) {
+ push @$result, $arg->[1];
+ }
+ }
+ return $result;
+}
+
+# find the accent commands stack and the innermost text contents
+sub find_innermost_accent_contents($;$)
+{
+ my $current = shift;
+ my $encoding = shift;
+ my @accent_commands = ();
+ my $debug = 0;
+ ACCENT:
+ while (1) {
+ # the following can happen if called with a bad tree
+ if (!$current->{'cmdname'}
+ or !$accent_commands{$current->{'cmdname'}}) {
+ #print STDERR "BUG: Not an accent command in accent\n";
+ cluck "BUG: Not an accent command in accent\n";
+ #print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
+ #print STDERR Data::Dumper->Dump([$current]);
+ last;
+ }
+ push @accent_commands, $current;
+ # A bogus accent, that may happen
+ if (!$current->{'args'}) {
+ return ([], address@hidden);
+ }
+ my $arg = $current->{'args'}->[0];
+ if (!$arg->{'contents'}) {
+ print STDERR "BUG: No content in accent command\n";
+ #print STDERR Data::Dumper->Dump([$current]);
+ #print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
+ return ([], address@hidden);
+ }
+ # inside the argument of an accent
+ my $text_contents = [];
+ foreach my $content (@{$arg->{'contents'}}) {
+ if (!($content->{'extra'} and $content->{'extra'}->{'invalid_nesting'})
+ and !($content->{'cmdname'} and ($content->{'cmdname'} eq 'c'
+ or $content->{'cmdname'} eq 'comment'))) {
+ if ($content->{'cmdname'} and $accent_commands{$content->{'cmdname'}})
{
+ $current = $content;
+ next ACCENT;
+ } else {
+ push @$text_contents, $content;
+ }
+ }
+ }
+ # we go here if there was no nested accent
+ return ($text_contents, address@hidden);
+ }
+}
+
+sub trim_spaces_comment_from_content($)
+{
+ my $contents = shift;
+ shift @$contents
+ if ($contents->[0] and $contents->[0]->{'type'}
+ and ($contents->[0]->{'type'} eq 'empty_line_after_command'
+ or $contents->[0]->{'type'} eq 'empty_spaces_after_command'
+ or $contents->[0]->{'type'} eq 'empty_spaces_before_argument'
+ or $contents->[0]->{'type'} eq 'empty_space_at_end_def_bracketed'
+ or $contents->[0]->{'type'} eq 'empty_spaces_after_close_brace'));
+
+ while (@$contents
+ and (($contents->[-1]->{'cmdname'}
+ and ($contents->[-1]->{'cmdname'} eq 'c'
+ or $contents->[-1]->{'cmdname'} eq 'comment'))
+ or ($contents->[-1]->{'type'}
+ and ($contents->[-1]->{'type'} eq 'spaces_at_end'
+ or $contents->[-1]->{'type'} eq
'space_at_end_block_command')))) {
+ pop @$contents;
+ }
+}
+
+sub float_name_caption($$)
+{
+ my $self = shift;
+ my $root = shift;
+
+ my $caption;
+ if ($root->{'extra'}->{'caption'}) {
+ $caption = $root->{'extra'}->{'caption'};
+ } elsif ($root->{'extra'}->{'shortcaption'}) {
+ $caption = $root->{'extra'}->{'shortcaption'};
+ }
+ #if ($self->get_conf('DEBUG')) {
+ # my $caption_texi =
+ # Texinfo::Convert::Texinfo::convert({ 'contents' =>
$caption->{'contents'}});
+ # print STDERR " CAPTION: $caption_texi\n";
+ #}
+ my $type;
+ if ($root->{'extra'}->{'type'}->{'normalized'} ne '') {
+ $type = {'contents' => $root->{'extra'}->{'type'}->{'content'}};
+ }
+
+ my $prepended;
+ if ($type) {
+ if ($caption) {
+ if (defined($root->{'number'})) {
+ $prepended = $self->gdt('{float_type} {float_number}: ',
+ {'float_type' => $type,
+ 'float_number' => $root->{'number'}});
+ } else {
+ $prepended = $self->gdt('{float_type}: ',
+ {'float_type' => $type});
+ }
+ } else {
+ if (defined($root->{'number'})) {
+ $prepended = $self->gdt("{float_type} {float_number}\n",
+ {'float_type' => $type,
+ 'float_number' => $root->{'number'}});
+ } else {
+ $prepended = $self->gdt("{float_type}\n",
+ {'float_type' => $type});
+ }
+ }
+ } elsif (defined($root->{'number'})) {
+ if ($caption) {
+ $prepended = $self->gdt('{float_number}: ',
+ {'float_number' => $root->{'number'}});
+ } else {
+ $prepended = $self->gdt("{float_number}\n",
+ {'float_number' => $root->{'number'}});
+ }
+ }
+ return ($caption, $prepended);
+}
+
+# decompose a decimal number on a given base.
+sub _decompose_integer($$)
+{
+ my $number = shift;
+ my $base = shift;
+ my @result = ();
+
+ while ($number >= 0) {
+ my $factor = $number % $base;
+ push (@result, $factor);
+ $number = int(($number - $factor) / $base) - 1;
+ }
+ return @result;
+}
+
+sub enumerate_item_representation($$)
+{
+ my $specification = shift;
+ my $number = shift;
+
+ if ($specification =~ /^[0-9]+$/) {
+ return $specification + $number -1;
+ }
+
+ my $result = '';
+ my $base_letter = ord('a');
+ $base_letter = ord('A') if (ucfirst($specification) eq $specification);
+ my @letter_ords = _decompose_integer(ord($specification) - $base_letter +
$number - 1, 26);
+ foreach my $ord (@letter_ords) {
+ $result = chr($base_letter + $ord) . $result;
+ }
+ return $result;
+}
+
+sub is_content_empty($;$);
+sub is_content_empty($;$)
+{
+ my $tree = shift;
+ my $do_not_ignore_index_entries = shift;
+ if (!defined($tree) or !exists($tree->{'contents'})) {
+ return 1;
+ }
+ foreach my $content (@{$tree->{'contents'}}) {
+ #print STDERR _print_current($content);
+ if ($content->{'cmdname'}) {
+ if ($content->{'type'} and $content->{'type'} eq 'index_entry_command') {
+ if ($do_not_ignore_index_entries) {
+ return 0;
+ } else {
+ next;
+ }
+ }
+ if (exists($misc_commands{$content->{'cmdname'}})) {
+ my @truc = keys(%formatted_misc_commands);
+ if ($formatted_misc_commands{$content->{'cmdname'}}) {
+ return 0;
+ } else {
+ next;
+ }
+ } elsif ($unformatted_brace_commands{$content->{'cmdname'}}
+ or $unformatted_block_commands{$content->{'cmdname'}}) {
+ next;
+ } else {
+ return 0;
+ }
+ }
+ if ($content->{'type'}) {
+ if ($content->{'type'} eq 'paragraph') {
+ return 0;
+ }
+ }
+ if ($content->{'text'} and $content->{'text'} =~ /\S/) {
+ return 0;
+ }
+ if (not is_content_empty($content, $do_not_ignore_index_entries)) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+our %htmlxref_entries = (
+ 'node' => [ 'node', 'section', 'chapter', 'mono' ],
+ 'section' => [ 'section', 'chapter','node', 'mono' ],
+ 'chapter' => [ 'chapter', 'section', 'node', 'mono' ],
+ 'mono' => [ 'mono', 'chapter', 'section', 'node' ],
+);
+
+sub parse_htmlxref_files($$)
+{
+ my $self = shift;
+ my $files = shift;
+ my $htmlxref;
+
+ foreach my $file (@$files) {
+ print STDERR "html refs config file: $file\n" if
($self->get_conf('DEBUG'));
+ unless (open (HTMLXREF, $file)) {
+ $self->document_warn(
+ sprintf($self->__("could not open html refs config file %s: %s"),
+ $file, $!));
+ next;
+ }
+ my $line_nr = 0;
+ my %variables;
+ while (my $hline = <HTMLXREF>) {
+ my $line = $hline;
+ $line_nr++;
+ next if $hline =~ /^\s*#/;
+ #$hline =~ s/[#]\s.*//;
+ $hline =~ s/^\s*//;
+ next if $hline =~ /^\s*$/;
+ chomp ($hline);
+ if ($hline =~ s/^\s*(\w+)\s*=\s*//) {
+ # handle variables
+ my $var = $1;
+ my $re = join '|', map { quotemeta $_ } keys %variables;
+ $hline =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1}
+ : "\${$1}"/ge;
+ $variables{$var} = $hline;
+ next;
+ }
+ my @htmlxref = split /\s+/, $hline;
+ my $manual = shift @htmlxref;
+ my $split_or_mono = shift @htmlxref;
+ #print STDERR "$split_or_mono
$Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
+ if (!defined($split_or_mono)) {
+ $self->file_line_warn($self->__("missing type"), $file, $line_nr);
+ next;
+ } elsif (!defined($htmlxref_entries{$split_or_mono})) {
+ $self->file_line_warn(sprintf($self->__("unrecognized type: %s"),
+ $split_or_mono), $file, $line_nr);
+ next;
+ }
+ my $href = shift @htmlxref;
+ next if (exists($htmlxref->{$manual}->{$split_or_mono}));
+
+ if (defined($href)) { # substitute 'variables'
+ my $re = join '|', map { quotemeta $_ } keys %variables;
+ $href =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1}
+ : "\${$1}"/ge;
+ $href =~ s/\/*$// if ($split_or_mono ne 'mono');
+ }
+ $htmlxref->{$manual}->{$split_or_mono} = $href;
+ }
+ if (!close (HTMLXREF)) {
+ $self->document_warn(sprintf($self->__(
+ "error on closing html refs config file %s: %s"),
+ $file, $!));
+ }
+ }
+ return $htmlxref;
+}
+
+sub parse_renamed_nodes_file($$;$$)
+{
+ my $self = shift;
+ my $renamed_nodes_file = shift;
+ # if not given they are automatically created
+ my $renamed_nodes = shift;
+ my $renamed_nodes_lines = shift;
+
+ if (open(RENAMEDFILE, "<$renamed_nodes_file")) {
+ if ($self->get_conf('INPUT_PERL_ENCODING')) {
+ binmode(RENAMEDFILE, ":encoding(".
+ $self->get_conf('INPUT_PERL_ENCODING').")");
+ }
+ my $renamed_nodes_line_nr = 0;
+ my @old_names = ();
+ while (<RENAMEDFILE>) {
+ $renamed_nodes_line_nr++;
+ next unless (/\S/);
+ next if (/address@hidden/);
+ if (s/address@hidden@\{\}\s+(\S)/$1/) {
+ chomp;
+ if (scalar(@old_names)) {
+ foreach my $old_node_name (@old_names) {
+ $renamed_nodes->{$old_node_name} = $_;
+ }
+ $renamed_nodes_lines->{$_} = $renamed_nodes_line_nr;
+ @old_names = ();
+ } else {
+ $self->file_line_warn($self->__("no node to be renamed"),
+ $renamed_nodes_file, $renamed_nodes_line_nr);
+ }
+ } else {
+ chomp;
+ s/^\s*//;
+ $renamed_nodes_lines->{$_} = $renamed_nodes_line_nr;
+ push @old_names, $_;
+ }
+ }
+ if (scalar(@old_names)) {
+ $self->file_line_warn($self->__("nodes without a new name at the end of
file"),
+ $renamed_nodes_file, $renamed_nodes_line_nr);
+ }
+ if (!close(RENAMEDFILE)) {
+ $self->document_warn(sprintf($self->__p(
+ "see HTML Xref Link Preservation in the Texinfo manual for context",
+ "error on closing node-renaming configuration file %s: %s"),
+ $renamed_nodes_file, $!));
+ }
+ } else {
+ $self->document_warn(sprintf($self->__("could not open %s: %s"),
+ $renamed_nodes_file, $!));
+ }
+ return ($renamed_nodes, $renamed_nodes_lines);
+}
+
+sub collect_renamed_nodes($$;$$)
+{
+ my $self = shift;
+ my $basename = shift;
+ my $renamed_nodes = shift;
+ my $renamed_nodes_lines = shift;
+
+ my $renamed_nodes_file;
+ if (defined($self->get_conf('RENAMED_NODES_FILE'))) {
+ $renamed_nodes_file = $self->get_conf('RENAMED_NODES_FILE');
+ } elsif (-f $basename . '-noderename.cnf') {
+ $renamed_nodes_file = $basename . '-noderename.cnf';
+ }
+ if (defined($renamed_nodes_file)) {
+ my ($renamed_nodes, $renamed_nodes_lines)
+ = parse_renamed_nodes_file($self, $renamed_nodes_file, $renamed_nodes,
+ $renamed_nodes_lines);
+ return ($renamed_nodes, $renamed_nodes_lines, $renamed_nodes_file);
+ }
+ return (undef, undef, undef);
+}
+
+sub normalize_top_node_name($)
+{
+ my $node = shift;
+ if ($node =~ /^top$/i) {
+ return 'Top';
+ }
+ return $node;
+}
+
+sub _convert_text_options($)
+{
+ my $self = shift;
+ my %options;
+ if ($self->get_conf('ENABLE_ENCODING')) {
+ if ($self->get_conf('OUTPUT_ENCODING_NAME')) {
+ $options{'enabled_encoding'} = $self->get_conf('OUTPUT_ENCODING_NAME');
+ } elsif ($self->get_conf('INPUT_ENCODING_NAME')) {
+ $options{'enabled_encoding'} = $self->get_conf('INPUT_ENCODING_NAME');
+ }
+ }
+ $options{'TEST'} = 1 if ($self->get_conf('TEST'));
+ $options{'NUMBER_SECTIONS'} = $self->get_conf('NUMBER_SECTIONS');
+ $options{'converter'} = $self;
+ $options{'expanded_formats_hash'} = $self->{'expanded_formats_hash'};
+ return %options;
+}
+
+sub count_bytes($$;$)
+{
+ my $self = shift;
+ my $string = shift;
+ my $encoding = shift;
+
+ if (!defined($encoding) and $self and
$self->get_conf('OUTPUT_PERL_ENCODING')) {
+ $encoding = $self->get_conf('OUTPUT_PERL_ENCODING');
+ }
+
+ if ($encoding and $encoding ne 'ascii') {
+ return length(Encode::encode($encoding, $string));
+ } else {
+ return length($string);
+ #my $length = length($string);
+ #$string =~ s/\n/\\n/g;
+ #$string =~ s/\f/\\f/g;
+ #print STDERR "Count($length): $string\n";
+ #return $length;
+ }
+ # FIXME is the following required for correct count of end of lines?
+ #if ($encoding) {
+ # return length(Encode::encode($encoding, $string));
+ #} else {
+ # return length(Encode::encode('ascii', $string));
+ #}
+}
+
+# TODO
+# also recurse into
+# extra->misc_args, extra->args_index
+# extra->index_entry extra->type
+#
+# extra that should point to other elements:
+# command_as_argument
+# @block_command_line_contents @brace_command_contents @misc_content
end_command
+# associated_section part_associated_section associated_node associated_part
+# @prototypes @columnfractions titlepage quotation @author command
+# menu_entry_description menu_entry_name
+#
+# should point to other elements, or be copied. And some should be recursed
+# into too.
+# extra->type->content
+# extra->nodes_manuals->[]
+# extra->node_content
+# extra->node_argument
+# extra->explanation_contents
+# extra->menu_entry_node
+# extra->def_arg
+
+
+sub _copy_tree($$$);
+sub _copy_tree($$$)
+{
+ my $current = shift;
+ my $parent = shift;
+ my $reference_associations = shift;
+ my $new = {};
+ $reference_associations->{$current} = $new;
+ $new->{'parent'} = $parent if ($parent);
+ foreach my $key ('type', 'cmdname', 'text') {
+ $new->{$key} = $current->{$key} if (exists($current->{$key}));
+ }
+ foreach my $key ('args', 'contents') {
+ if ($current->{$key}) {
+ if (ref($current->{$key}) ne 'ARRAY') {
+ my $command_or_type = '';
+ if ($new->{'cmdname'}) {
+ $command_or_type = '@'.$new->{'cmdname'};
+ } elsif ($new->{'type'}) {
+ $command_or_type = $new->{'type'};
+ }
+ print STDERR "Not an array [$command_or_type] $key
".ref($current->{$key})."\n";
+ }
+ $new->{$key} = [];
+ $reference_associations->{$current->{$key}} = $new->{$key};
+ foreach my $child (@{$current->{$key}}) {
+ push @{$new->{$key}}, _copy_tree($child, $new,
$reference_associations);
+ }
+ }
+ }
+ if ($current->{'extra'}) {
+ $new->{'extra'} = {};
+ foreach my $key (keys %{$current->{'extra'}}) {
+ if ($current->{'cmdname'} and $current->{'cmdname'} eq 'multitable'
+ and $key eq 'prototypes') {
+ $new->{'extra'}->{$key} = [];
+ $reference_associations->{$current->{'extra'}->{$key}} = $new->{$key};
+ foreach my $child (@{$current->{'extra'}->{$key}}) {
+ push @{$new->{'extra'}->{$key}},
+ _copy_tree($child, $new, $reference_associations);
+ }
+ } elsif (!ref($current->{'extra'}->{$key})) {
+ $new->{'extra'}->{$key} = $current->{'extra'}->{$key};
+ }
+ }
+ }
+ return $new;
+}
+
+# Not used.
+sub _collect_references($$);
+sub _collect_references($$)
+{
+ my $current = shift;
+ my $references = shift;
+ foreach my $key ('args', 'contents') {
+ if ($current->{$key}) {
+ $references->{$current->{$key}} = $current->{$key};
+ foreach my $child (@{$current->{$key}}) {
+ $references->{$child} = $child;
+ _collect_references($child, $references);
+ }
+ }
+ }
+}
+
+sub _substitute_references_in_array($$$);
+sub _substitute_references_in_array($$$)
+{
+ my $array = shift;
+ my $reference_associations = shift;
+ my $context = shift;
+
+ my $result = [];
+ my $index = 0;
+ foreach my $item (@{$array}) {
+ if (!ref($item)) {
+ push @{$result}, $item;
+ } elsif ($reference_associations->{$item}) {
+ push @{$result}, $reference_associations->{$item};
+ } elsif (ref($item) eq 'ARRAY') {
+ push @$result,
+ _substitute_references_in_array($item, $reference_associations,
+ "$context [$index]");
+ } elsif (defined($item->{'text'})) {
+ my $new_text = _copy_tree($item, undef, $reference_associations);
+ substitute_references($item, $new_text, $reference_associations);
+ push @{$result}, $new_text;
+ } else {
+ print STDERR "Trouble with $context [$index] (".ref($item).")\n";
+ push @{$result}, undef;
+ }
+ $index++;
+ }
+ return $result;
+}
+
+sub substitute_references($$$);
+sub substitute_references($$$)
+{
+ my $current = shift;
+ my $new = shift;
+ my $reference_associations = shift;
+
+ foreach my $key ('args', 'contents') {
+ if ($new->{$key}) {
+ my $index = 0;
+ foreach my $child (@{$new->{$key}}) {
+ substitute_references($child, $current->{$key}->[$index],
+ $reference_associations);
+ $index++;
+ }
+ }
+ }
+ if ($current->{'extra'}) {
+ foreach my $key (keys %{$current->{'extra'}}) {
+ if (ref($current->{'extra'}->{$key})) {
+ my $command_or_type = '';
+ if ($new->{'cmdname'}) {
+ $command_or_type = '@'.$new->{'cmdname'};
+ } elsif ($new->{'type'}) {
+ $command_or_type = $new->{'type'};
+ }
+
+ if ($current->{'cmdname'} and $current->{'cmdname'} eq 'multitable'
+ and $key eq 'prototypes') {
+ my $index = 0;
+ foreach my $child (@{$new->{'extra'}->{$key}}) {
+ substitute_references($child,
$current->{'extra'}->{$key}->[$index],
+ $reference_associations);
+ $index++;
+ }
+ } elsif ($reference_associations->{$current->{'extra'}->{$key}}) {
+ $new->{'extra'}->{$key}
+ = $reference_associations->{$current->{'extra'}->{$key}};
+ #print STDERR "Done [$command_or_type]: $key\n";
+ } else {
+ if (ref($current->{'extra'}->{$key}) eq 'ARRAY') {
+
+ #print STDERR "Array $command_or_type -> $key\n";
+ $new->{'extra'}->{$key} = _substitute_references_in_array(
+ $current->{'extra'}->{$key}, $reference_associations,
+ "[$command_or_type]{$key}");
+ } else {
+ if (($current->{'cmdname'}
+ and ($current->{'cmdname'} eq 'listoffloats'
+ or $current->{'cmdname'} eq 'float')
+ and $key eq 'type')
+ or ($key eq 'index_entry')
+ or ($current->{'type'}
+ and $current->{'type'} eq 'menu_entry'
+ and $key eq 'menu_entry_node')) {
+ foreach my $type_key (keys(%{$current->{'extra'}->{$key}})) {
+ if (!ref($current->{'extra'}->{$key}->{$type_key})) {
+ $new->{'extra'}->{$key}->{$type_key}
+ = $current->{'extra'}->{$key}->{$type_key};
+ } elsif
($reference_associations->{$current->{'extra'}->{$key}->{$type_key}}) {
+ $new->{'extra'}->{$key}->{$type_key}
+ =
$reference_associations->{$current->{'extra'}->{$key}->{$type_key}};
+ } elsif (ref($current->{'extra'}->{$key}->{$type_key}) eq
'ARRAY') {
+ $new->{'extra'}->{$key}->{$type_key}
+ = _substitute_references_in_array(
+ $current->{'extra'}->{$key}->{$type_key},
+ $reference_associations,
+ "[$command_or_type]{$key}{$type_key}");
+ } else {
+ print STDERR "Not substituting [$command_or_type]{$key}:
$type_key\n";
+ }
+ }
+ } else {
+ print STDERR "Not substituting [$command_or_type]: $key
($current->{'extra'}->{$key})\n";
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+sub copy_tree($;$)
+{
+ my $current = shift;
+ my $parent = shift;
+ my $reference_associations = {};
+ my $copy = _copy_tree($current, $parent, $reference_associations);
+ substitute_references($current, $copy, $reference_associations);
+ return $copy;
+}
+
+sub modify_tree($$$;$);
+sub modify_tree($$$;$)
+{
+ my $self = shift;
+ my $tree = shift;
+ my $operation = shift;
+ my $argument = shift;
+ #print STDERR "modify_tree tree: $tree\n";
+
+ if ($tree->{'args'}) {
+ my @args = @{$tree->{'args'}};
+ for (my $i = 0; $i <= $#args; $i++) {
+ my @new_args = &$operation($self, 'arg', $args[$i], $argument);
+ modify_tree($self, $args[$i], $operation, $argument);
+ # this puts the new args at the place of the old arg using the
+ # offset from the end of the array
+ splice (@{$tree->{'args'}}, $i - $#args -1, 1, @new_args);
+ #foreach my $arg (@new_args) {
+ # modify_tree($self, $arg, $operation);
+ #}
+ }
+ }
+ if ($tree->{'contents'}) {
+ my @contents = @{$tree->{'contents'}};
+ for (my $i = 0; $i <= $#contents; $i++) {
+ my @new_contents = &$operation($self, 'content', $contents[$i],
$argument);
+ modify_tree($self, $contents[$i], $operation, $argument);
+ # this puts the new contents at the place of the old content using the
+ # offset from the end of the array
+ splice (@{$tree->{'contents'}}, $i - $#contents -1, 1, @new_contents);
+ #foreach my $content (@new_contents) {
+ # modify_tree($self, $content, $operation);
+ #}
+ }
+ }
+ return $tree;
+}
+
+sub _protect_comma($$$)
+{
+ my $self = shift;
+ my $type = shift;
+ my $current = shift;
+
+ return _protect_text($current, quotemeta(','));
+}
+
+sub protect_comma_in_tree($)
+{
+ my $tree = shift;
+ return modify_tree(undef, $tree, \&_protect_comma);
+}
+
+sub _new_asis_command_with_text($$;$)
+{
+ my $text = shift;
+ my $parent = shift;
+ my $text_type = shift;
+ my $new_command = {'cmdname' => 'asis', 'parent' => $parent };
+ push @{$new_command->{'args'}}, {'type' => 'brace_command_arg',
+ 'parent' => $new_command};
+ push @{$new_command->{'args'}->[0]->{'contents'}}, {
+ 'text' => $text,
+ 'parent' => $new_command->{'args'}->[0]};
+ if (defined($text_type)) {
+ $new_command->{'args'}->[0]->{'contents'}->[0]->{'type'} = $text_type;
+ }
+ return $new_command;
+}
+
+sub _protect_text($$)
+{
+ my $current = shift;
+ my $to_protect = shift;
+
+ #print STDERR "$to_protect: $current "._print_current($current)."\n";
+ if (defined($current->{'text'}) and $current->{'text'} =~ /$to_protect/
+ and !(defined($current->{'type'}) and $current->{'type'} eq 'raw')) {
+ my @result = ();
+ my $remaining_text = $current->{'text'};
+ while ($remaining_text) {
+ if ($remaining_text =~ s/^(.*?)(($to_protect)+)//) {
+ if ($1 ne '') {
+ push @result, {'text' => $1, 'parent' => $current->{'parent'}};
+ $result[-1]->{'type'} = $current->{'type'}
+ if defined($current->{'type'});
+ }
+ if ($to_protect eq quotemeta(',')) {
+ for (my $i = 0; $i < length($2); $i++) {
+ push @result, {'cmdname' => 'comma', 'parent' =>
$current->{'parent'},
+ 'args' => [{'type' => 'brace_command_arg'}]};
+ }
+ } else {
+ push @result, _new_asis_command_with_text($2, $current->{'parent'},
+ $current->{'type'});
+ }
+ } else {
+ push @result, {'text' => $remaining_text, 'parent' =>
$current->{'parent'}};
+ $result[-1]->{'type'} = $current->{'type'}
+ if defined($current->{'type'});
+ last;
+ }
+ }
+ #print STDERR "Result: @result\n";
+ return @result;
+ } else {
+ #print STDERR "No change: $current\n";
+ return ($current);
+ }
+}
+
+sub _protect_colon($$$)
+{
+ my $self = shift;
+ my $type = shift;
+ my $current = shift;
+
+ return _protect_text ($current, quotemeta(':'));
+}
+
+sub protect_colon_in_tree($)
+{
+ my $tree = shift;
+ return modify_tree(undef, $tree, \&_protect_colon);
+}
+
+sub _protect_node_after_label($$$)
+{
+ my $self = shift;
+ my $type = shift;
+ my $current = shift;
+
+ return _protect_text ($current, '['. quotemeta(".\t,") .']');
+}
+
+sub protect_node_after_label_in_tree($)
+{
+ my $tree = shift;
+ return modify_tree(undef, $tree, \&_protect_node_after_label);
+}
+
+sub _is_cpp_line($)
+{
+ my $text = shift;
+ return 1 if ($text =~ /^\s*#\s*(line)? (\d+)(( "([^"]+)")(\s+\d+)*)?\s*$/);
+ return 0;
+}
+
+sub _protect_hashchar_at_line_beginning($$$)
+{
+ my $self = shift;
+ my $type = shift;
+ my $current = shift;
+
+ #print STDERR "$type $current "._print_current($current)."\n";
+ # if the next is a hash character at line beginning, mark it
+ if (defined($current->{'text'}) and $current->{'text'} =~ /\n$/
+ and $current->{'parent'} and $current->{'parent'}->{'contents'}) {
+ my $parent = $current->{'parent'};
+ #print STDERR "End of line in $current, parent $parent:
(@{$parent->{'contents'}})\n";
+ my $current_found = 0;
+ foreach my $content (@{$parent->{'contents'}}) {
+ if ($current_found) {
+ #print STDERR "after $current: $content $content->{'text'}\n";
+ if ($content->{'text'} and _is_cpp_line($content->{'text'})) {
+ $content->{'extra'}->{'_protect_hashchar'} = 1;
+ }
+ last;
+ } elsif ($content eq $current) {
+ $current_found = 1;
+ }
+ }
+ }
+
+ my $protect_hash = 0;
+ # if marked, or first and a cpp_line protect a leading hash character
+ if ($current->{'extra'} and $current->{'extra'}->{'_protect_hashchar'}) {
+ delete $current->{'extra'}->{'_protect_hashchar'};
+ if (!scalar(keys(%{$current->{'extra'}}))) {
+ delete $current->{'extra'};
+ }
+ $protect_hash = 1;
+ } elsif ($current->{'parent'} and $current->{'parent'}->{'contents'}
+ and $current->{'parent'}->{'contents'}->[0]
+ and $current->{'parent'}->{'contents'}->[0] eq $current
+ and $current->{'text'}
+ and _is_cpp_line($current->{'text'})) {
+ $protect_hash = 1;
+ }
+ if ($protect_hash) {
+ my @result = ();
+ if ($current->{'type'} and $current->{'type'} eq 'raw') {
+ if ($self) {
+ my $parent = $current->{'parent'};
+ while ($parent) {
+ if ($parent->{'cmdname'} and $parent->{'line_nr'}) {
+ $self->line_warn(sprintf($self->__(
+ "could not protect hash character in address@hidden"),
+ $parent->{'cmdname'}), $parent->{'line_nr'});
+ last;
+ }
+ $parent = $parent->{'parent'};
+ }
+ }
+ } else {
+ $current->{'text'} =~ s/^(\s*)#//;
+ if ($1 ne '') {
+ push @result, {'text' => $1, 'parent' => $current->{'parent'}};
+ }
+ push @result, {'cmdname' => 'hashchar', 'parent' => $current->{'parent'},
+ 'args' => [{'type' => 'brace_command_arg'}]};
+ }
+ push @result, $current;
+ return @result;
+ } else {
+ return ($current);
+ }
+}
+
+sub protect_hashchar_at_line_beginning($$)
+{
+ my $self = shift;
+ my $tree = shift;
+ return modify_tree($self, $tree, \&_protect_hashchar_at_line_beginning);
+}
+
+sub protect_first_parenthesis($)
+{
+ my $contents = shift;
+ return undef if (!defined ($contents));
+ my @contents = @$contents;
+ my $brace;
+ if ($contents[0] and $contents->[0]{'text'} and $contents[0]->{'text'} =~
/^\(/) {
+ if ($contents[0]->{'text'} !~ /^\($/) {
+ $brace = shift @contents;
+ my $brace_text = $brace->{'text'};
+ $brace_text =~ s/^\(//;
+ unshift @contents, { 'text' => $brace_text, 'type' => $brace->{'type'},
+ 'parent' => $brace->{'parent'} } if $brace_text ne
'';
+ } else {
+ $brace = shift @contents;
+ }
+ unshift @contents, _new_asis_command_with_text('(', $brace->{'parent'},
+ $brace->{'type'});
+ }
+ return address@hidden;
+}
+
+sub find_parent_root_command($$)
+{
+ my $parser = shift;
+ my $current = shift;
+
+ my $root_command;
+ while (1) {
+ if ($current->{'cmdname'}) {
+ if ($root_commands{$current->{'cmdname'}}) {
+ return $current;
+ } elsif ($region_commands{$current->{'cmdname'}}) {
+ if ($current->{'cmdname'} eq 'copying' and $parser
+ and $parser->{'extra'} and $parser->{'extra'}->{'insertcopying'}) {
+ foreach my $insertcopying(@{$parser->{'extra'}->{'insertcopying'}}) {
+ my $root_command
+ = $parser->find_parent_root_command($insertcopying);
+ return $root_command if (defined($root_command));
+ }
+ } else {
+ return undef;
+ }
+ }
+ }
+ if ($current->{'parent'}) {
+ $current = $current->{'parent'};
+ } else {
+ return undef;
+ }
+ }
+ # Should never get there
+ return undef;
+}
+
+# for debugging
+sub _print_current($)
+{
+ my $current = shift;
+ if (ref($current) ne 'HASH') {
+ return "_print_current: $current not a hash\n";
+ }
+ my $type = '';
+ my $cmd = '';
+ my $parent_string = '';
+ my $text = '';
+ $type = "($current->{'type'})" if (defined($current->{'type'}));
+ $cmd = "address@hidden>{'cmdname'}" if (defined($current->{'cmdname'}));
+ $cmd .= "($current->{'level'})" if (defined($current->{'level'}));
+ $text = "[text: $current->{'text'}]" if (defined($current->{'text'}));
+ if ($current->{'parent'}) {
+ my $parent = $current->{'parent'};
+ my $parent_cmd = '';
+ my $parent_type = '';
+ $parent_cmd = "address@hidden>{'cmdname'}" if
(defined($parent->{'cmdname'}));
+ $parent_type = "($parent->{'type'})" if (defined($parent->{'type'}));
+ $parent_string = " <- $parent_cmd$parent_type\n";
+ }
+ my $args = '';
+ my $contents = '';
+ $args = "args(".scalar(@{$current->{'args'}}).')' if $current->{'args'};
+ $contents = "contents(".scalar(@{$current->{'contents'}}).')'
+ if $current->{'contents'};
+ if ("$cmd$type" ne '') {
+ return "$cmd$type : $text $args $contents\n$parent_string";
+ } else {
+ return "$text $args $contents\n$parent_string";
+ }
+}
+
+sub move_index_entries_after_items($) {
+ # enumerate or itemize
+ my $current = shift;
+
+ return unless ($current->{'contents'});
+
+ my $previous;
+ foreach my $item (@{$current->{'contents'}}) {
+ #print STDERR "Before proceeding: $previous $item->{'cmdname'}
(@{$previous->{'contents'}})\n" if ($previous and $previous->{'contents'});
+ if (defined($previous) and $item->{'cmdname'}
+ and $item->{'cmdname'} eq 'item'
+ and $previous->{'contents'} and scalar(@{$previous->{'contents'}})) {
+
+ my $previous_ending_container;
+ if ($previous->{'contents'}->[-1]->{'type'}
+ and ($previous->{'contents'}->[-1]->{'type'} eq 'paragraph'
+ or $previous->{'contents'}->[-1]->{'type'} eq 'preformatted')) {
+ $previous_ending_container = $previous->{'contents'}->[-1];
+ } else {
+ $previous_ending_container = $previous;
+ }
+
+ my @gathered_index_entries;
+
+ #print STDERR "Gathering for item $item in previous $previous
($previous_ending_container)\n";
+ while ($previous_ending_container->{'contents'}->[-1]
+ and (($previous_ending_container->{'contents'}->[-1]->{'type'}
+ and
$previous_ending_container->{'contents'}->[-1]->{'type'} eq
'index_entry_command')
+ or
($previous_ending_container->{'contents'}->[-1]->{'cmdname'}
+ and
($previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'c'
+ or
$previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'comment')))) {
+ unshift @gathered_index_entries, pop
@{$previous_ending_container->{'contents'}};
+ }
+ #print STDERR "Gathered: @gathered_index_entries\n";
+ if (scalar(@gathered_index_entries)) {
+ # put back leading comments
+ while ($gathered_index_entries[0]
+ and (!$gathered_index_entries[0]->{'type'}
+ or $gathered_index_entries[0]->{'type'} ne
'index_entry_command')) {
+ #print STDERR "Putting back $gathered_index_entries[0]
$gathered_index_entries[0]->{'cmdname'}\n";
+ push @{$previous_ending_container->{'contents'}},
+ shift @gathered_index_entries;
+ }
+
+ # We have the index entries of the previous @item or before item.
+ # Now put them right after the current @item command.
+ if (scalar(@gathered_index_entries)) {
+ my $item_container;
+ if ($item->{'contents'} and $item->{'contents'}->[0]
+ and $item->{'contents'}->[0]->{'type'}
+ and $item->{'contents'}->[0]->{'type'} eq 'preformatted') {
+ $item_container = $item->{'contents'}->[0];
+ } else {
+ $item_container = $item;
+ }
+ foreach my $entry(@gathered_index_entries) {
+ $entry->{'parent'} = $item_container;
+ }
+ if ($item_container->{'contents'}
+ and $item_container->{'contents'}->[0]
+ and $item_container->{'contents'}->[0]->{'type'}) {
+ if ($item_container->{'contents'}->[0]->{'type'} eq
'empty_line_after_command') {
+
+ unshift @gathered_index_entries, shift
@{$item_container->{'contents'}};
+ } elsif ($item_container->{'contents'}->[0]->{'type'} eq
'empty_spaces_after_command') {
+ unshift @gathered_index_entries, shift
@{$item_container->{'contents'}};
+ $gathered_index_entries[0]->{'type'} =
'empty_line_after_command';
+ $gathered_index_entries[0]->{'text'} .= "\n";
+ }
+ }
+ unshift @{$item_container->{'contents'}}, @gathered_index_entries;
+ }
+ }
+ }
+ $previous = $item;
+ }
+}
+
+sub _move_index_entries_after_items($$$)
+{
+ my $self = shift;
+ my $type = shift;
+ my $current = shift;
+
+ if ($current->{'cmdname'} and ($current->{'cmdname'} eq 'enumerate'
+ or $current->{'cmdname'} eq 'itemize')) {
+ move_index_entries_after_items($current);
+ }
+ return ($current);
+}
+
+sub move_index_entries_after_items_in_tree($)
+{
+ my $tree = shift;
+ return modify_tree(undef, $tree, \&_move_index_entries_after_items);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Texinfo::Common - Classification of commands and miscellaneous methods
+
+=head1 SYNOPSIS
+
+ use Texinfo::Common qw(expand_today expand_verbatiminclude);
+ if ($Texinfo::Common::accent_commands{$a_command}) {
+ print STDERR "$a_command is an accent command\n";
+ }
+
+ my $today_tree = expand_today($converter);
+ my $verbatiminclude_tree
+ = expand_verbatiminclude(undef, $verbatiminclude);
+
+=head1 DESCRIPTION
+
+Texinfo::Common holds interesting hashes classifying Texinfo @-commands,
+as well as miscellaneous methods that may be useful for any backend
+converting texinfo trees.
+
+It also defines, as our variable a hash for default indices,
+named C<%index_names>. The format of this hash is described in
+L<Texinfo::Parser/indices_information>.
+
+=head1 COMMAND CLASSES
+
+Hashes are defined as C<our> variables, and are therefore available
+outside of the module.
+
+The key of the hashes are @-command names without the @. The
+following hashes are available:
+
+=over
+
+=item %all_commands
+
+All the @-commands.
+
+=item %no_brace_commands
+
+Commands without brace with a single character as name, like C<*>
+or C<:>. The value is an ascii representation of the command. It
+may be an empty string.
+
+=item %misc_commands
+
+Command that do not take braces and are not block commands either, like
+C<@node>, C<@chapter>, C<@cindex>, C<@deffnx>, C<@end>, C<@footnotestyle>,
+C<@set>, C<@settitle>, C<@indent>, C<@definfoenclose>, C<@comment> and many
+others.
+
+=item %default_index_commands
+
+Index entry commands corresponding to default indices. For example
+C<@cindex>.
+
+=item %root_commands
+
+Commands that are at the root of a Texinfo document, namely
+C<@node> and sectioning commands, except heading commands.
+
+=item %sectioning_commands
+
+All the sectioning and heading commands.
+
+=item %brace_commands
+
+The commands that take braces. The associated value is the maximum
+number of arguments.
+
+=item %letter_no_arg_commands
+
address@hidden with braces but no argument corresponding to letters,
+like C<@AA{}> or C<@ss{}> or C<@o{}>.
+
+=item %accent_commands
+
+Accent @-commands taking an argument, like C<@'> or C<@ringaccent>
+including C<@dotless> and C<@tieaccent>.
+
+=item %style_commands
+
+Commands that mark a fragment of texinfo, like C<@strong>,
+C<@cite>, C<@code> or C<@asis>.
+
+=item %code_style_commands
+
+I<style_commands> that have their argument in code style, like
+C<@code>.
+
+=item %regular_font_style_commands
+
+I<style_commands> that have their argument in regular font, like
+C<@r> or C<@slanted>.
+
+=item %context_brace_commands
+
address@hidden with brace like C<@footnote>, C<@caption> and C<@math>
+whose argument is outside of the main text flow in one way or another.
+
+=item %ref_commands
+
+Cross reference @-command referencing nodes, like C<@xref>.
+
+=item %explained_commands
+
address@hidden whose second argument explain first argument and further
address@hidden call without first argument, as C<@abbr> and C<@acronym>.
+
+=item %block commands
+
+Commands delimiting a block with a closing C<@end>. The value
+is I<conditional> for C<@if> commands, I<def> for definition
+commands like C<@deffn>, I<raw> for @-commands that have no expansion
+of @-commands in their bodies and I<multitable> for C<@multitable>.
+Otherwise it is set to the number of arguments separated by commas
+that may appear on the @-command line. That means 0 in most cases,
+1 for C<@quotation> and 2 for C<@float>.
+
+=item %raw_commands
+
address@hidden that have no expansion of @-commands in their bodies,
+as C<@macro>, C<@verbatim> or C<@ignore>.
+
+=item %format_raw_commands
+
address@hidden associated with raw output format, like C<@html>, or
+C<@docbook>.
+
+=item %texinfo_output_formats
+
+Cannonical output formats that have associated conditionals. In
+practice C<%format_raw_commands> plus C<info> and C<plaintext>.
+
+=item %def_commands
+
+=item %def_aliases
+
+Definition commands. C<%def_aliases> associates an aliased command
+to the original command, for example C<defun> is associated to C<deffn>.
+
+=item %menu_commands
+
address@hidden with menu entries.
+
+=item %align_commands
+
address@hidden related with alignement of text.
+
+=item %region_commands
+
+Block @-commands that enclose full text regions, like C<@titlepage>.
+
+=item %preformatted_commands
+
+=item %preformatted_code_commands
+
+I<%preformatted_commands> is for commands whose content should not
+be filled, like C<@example> or C<@display>. If the command is meant
+for code, it is also in I<%preformatted_code_commands>, like C<@example>.
+
+=item %item_container_commands
+
+Commands holding C<@item> with C<@item> that contains blocks of text,
+like C<@itemize>.
+
+=item %item_line_commands
+
+Commands with C<@item> that have their arguments on their lines, like
+C<@ftable>.
+
+=back
+
+=head1 METHODS
+
+No method is exported in the default case.
+
+Most methods takes a I<$converter> as argument, sometime optionally,
+to get some information and use methods for error reporting,
+see L<Texinfo::Convert::Converter> and L<Texinfo::Report>.
+
+=over
+
+=item $tree = expand_today($converter)
+
+Expand today's date, as a texinfo tree with translations.
+
+=item $tree = expand_verbatiminclude($converter, $verbatiminclude)
+
+The I<$converter> argument may be undef. I<$verbatiminclude> is a
+C<@verbatiminclude> tree element. This function returns a
+C<@verbatim> tree elements after finding the included file and
+reading it. If I<$converter> is not defined, the document encoding
+is not taken into account when reading the file.
+
+=item $tree = definition_category($converter, $def_line)
+
+The I<$converter> argument may be undef. I<$def_line> is a
+C<def_line> texinfo tree container. This function
+returns a texinfo tree corresponding to the category of the
+I<$def_line> taking the class into account, if there is one.
+If I<$converter> is not defined, the resulting string won't be
+translated.
+
+=item $result = is_content_empty($tree, $do_not_ignore_index_entries)
+
+Return true if the C<$tree> has content that could be formatted.
+C<$do_not_ignore_index_entries> is optional. If set, index entries
+are considered to be formatted.
+
+=item $result = numbered_heading ($converter, $heading_element, $heading_text,
$do_number)
+
+The I<$converter> argument may be undef. I<$heading_element> is
+a heading command tree element. I<$heading_text> is the already
+formatted heading text. if the I<$do_number> optional argument is
+defined and false, no number is used and the text is returned as is.
+This function returns the heading with a number and the appendix
+part if needed. If I<$converter> is not defined, the resulting
+string won't be translated.
+
+=item ($caption, $prepended) = float_name_caption ($converter, $float)
+
+I<$float> is a texinfo tree C<@float> element. This function
+returns the caption that should be used for the float formatting
+and the I<$prepended> texinfo tree combining the type and label
+of the float.
+
+=item $text = enumerate_item_representation($specification, $number)
+
+This function returns the number or letter correponding to item
+number I<$number> for an C<@enumerate> specification I<$specification>,
+appearing on an C<@enumerate> line. For example
+
+ enumerate_item_representation('c', 3)
+
+is C<e>.
+
+=item trim_spaces_comment_from_content($contents)
+
+Remove empty spaces after commands or braces at begin and
+spaces and comments at end from a content array, modifying it.
+
+=item $normalized_name = normalize_top_node_name ($node_string)
+
+Normalize the node name string given in argument, by normalizing
+Top node case.
+
+=item protect_comma_in_tree($tree)
+
+Protect comma characters, replacing C<,> with @comma{} in tree.
+
+=item protect_colon_in_tree($tree)
+
+=item protect_node_after_label_in_tree($tree)
+
+Protect colon with C<protect_colon_in_tree> and characters that
+are special in node names after a label in menu entries (tab
+dot and comma) with C<protect_node_after_label_in_tree>.
+The protection is achieved by putting protected characters
+in C<@asis{}>.
+
+=item $contents_result = protect_first_parenthesis ($contents)
+
+Return a contents array reference with first parenthesis in the
+contents array reference protected.
+
+=item protect_hashchar_at_line_beginning($parser, $tree)
+
+Protect hash character at beginning of line if the line is a cpp
+line directive. The I<$parser> argument maybe undef, if it is
+defined it is used for error reporting in case an hash character
+could not be protected because it appeared in a raw environment.
+
+=item move_index_entries_after_items_in_tree($tree)
+
+In C<@enumerate> and C<@itemize> from the tree, move index entries
+appearing just before C<@item> after the C<@item>. Comment lines
+between index entries are moved too.
+
+=item $command = find_parent_root_command($parser, $tree_element)
+
+Find the parent root command of a tree element (sectioning command or node).
+The C<$parser> argument is optional, it is used to continue
+through C<@insertcopying> if in a C<@copying>.
+
+=item valid_tree_transformation($name)
+
+Return true if the I<$name> is a known tree transformation name
+that may be passed with C<TREE_TRANSFORMATIONS> to modify a texinfo
+tree.
+
+=back
+
+=head1 SEE ALSO
+
+L<Texinfo::Parser>, L<Texinfo::Convert::Converter> and L<Texinfo::Report>.
+
+=head1 AUTHOR
+
+Patrice Dumas, E<lt>address@hidden<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+=cut
+
Added: trunk/parsetexi/Makefile.am
===================================================================
--- trunk/parsetexi/Makefile.am (rev 0)
+++ trunk/parsetexi/Makefile.am 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,42 @@
+AUTOMAKE_OPTIONS=foreign
+
+bin_PROGRAMS=parsetexi
+
+parsetexi_SOURCES=main.c parser.c parser.h tree_types.h \
+ element_types.c element_types.h \
+ commands.c commands.h \
+ command_ids.h \
+ input.c input.h \
+ tree.c tree.h close.c \
+ text.c text.h \
+ context_stack.c context_stack.h \
+ debug.c \
+ convert.c \
+ end_line.c \
+ separator.c \
+ multitable.c \
+ indices.c \
+ macro.c \
+ handle_commands.c handle_commands.h \
+ def.c def.h
+
+
+BUILT_SOURCES=element_types.h command_data.c command_ids.h
+
+# Need to be distributed
+EXTRA_DIST=element_types.txt element_types.awk \
+ command_data.txt command_data.awk
+
+# For reference
+EXTRA_DIST+=Common.pm Parser-5556.pm
+
+EXTRA_DIST+=complete_tree.pl
+
+# Notes
+EXTRA_DIST+=debug_perl.txt makeinfo-debug.txt
+
+element_types.c element_types.h: element_types.txt element_types.awk
+ awk -f element_types.awk element_types.txt >element_types.h
+
+command_data.c command_ids.h: command_data.txt command_data.awk
+ awk -f command_data.awk command_data.txt >command_ids.h
Added: trunk/parsetexi/Makefile.in
===================================================================
--- trunk/parsetexi/Makefile.in (rev 0)
+++ trunk/parsetexi/Makefile.in 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,761 @@
+# Makefile.in generated by automake 1.99a from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
address@hidden@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = parsetexi$(EXEEXT)
+subdir = .
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) depcomp README \
+ compile install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_parsetexi_OBJECTS = main.$(OBJEXT) parser.$(OBJEXT) \
+ element_types.$(OBJEXT) commands.$(OBJEXT) input.$(OBJEXT) \
+ tree.$(OBJEXT) close.$(OBJEXT) text.$(OBJEXT) \
+ context_stack.$(OBJEXT) debug.$(OBJEXT) convert.$(OBJEXT) \
+ end_line.$(OBJEXT) separator.$(OBJEXT) multitable.$(OBJEXT) \
+ indices.$(OBJEXT) macro.$(OBJEXT) handle_commands.$(OBJEXT) \
+ def.$(OBJEXT)
+parsetexi_OBJECTS = $(am_parsetexi_OBJECTS)
+parsetexi_LDADD = $(LDADD)
+AM_V_P = $(address@hidden@)
+am__v_P_ = $(address@hidden@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(address@hidden@)
+am__v_GEN_ = $(address@hidden@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(address@hidden@)
+am__v_at_ = $(address@hidden@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = address@hidden@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+am__set_depbase = depbase=`echo $@ | sed
's|[^/]*$$|$(DEPDIR)/&|;s|\.[^.]*$$||'`
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(address@hidden@)
+am__v_CC_ = $(address@hidden@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(address@hidden@)
+am__v_CCLD_ = $(address@hidden@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(parsetexi_SOURCES)
+DIST_SOURCES = $(parsetexi_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+AM_RECURSIVE_TARGETS = cscope
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+parsetexi_SOURCES = main.c parser.c parser.h tree_types.h \
+ element_types.c element_types.h \
+ commands.c commands.h \
+ command_ids.h \
+ input.c input.h \
+ tree.c tree.h close.c \
+ text.c text.h \
+ context_stack.c context_stack.h \
+ debug.c \
+ convert.c \
+ end_line.c \
+ separator.c \
+ multitable.c \
+ indices.c \
+ macro.c \
+ handle_commands.c handle_commands.h \
+ def.c def.h
+
+BUILT_SOURCES = element_types.h command_data.c command_ids.h
+
+# Need to be distributed
+
+# For reference
+
+# Notes
+EXTRA_DIST = element_types.txt element_types.awk command_data.txt \
+ command_data.awk Common.pm Parser-5556.pm complete_tree.pl \
+ debug_perl.txt makeinfo-debug.txt
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure
$(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files
'$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files
"$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+parsetexi$(EXEEXT): $(parsetexi_OBJECTS) $(parsetexi_DEPENDENCIES)
$(EXTRA_parsetexi_DEPENDENCIES)
+ @rm -f parsetexi$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(parsetexi_OBJECTS) $(parsetexi_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ $(AM_V_CC)$(am__set_depbase) && \
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< && \
address@hidden@ $(am__mv) $$depbase.Tpo $$depbase.Po
address@hidden@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@'
libtool=no @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(address@hidden@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
address@hidden@ $(AM_V_CC)$(am__set_depbase) && \
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@
$$($(CYGPATH_W) $<) && \
address@hidden@ $(am__mv) $$depbase.Tpo $$depbase.Po
address@hidden@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@'
libtool=no @AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(address@hidden@)$(COMPILE) -c -o $@ $$($(CYGPATH_W) $<)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files
$(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx
{} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx
{} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c
>$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c
>$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9}
>$(distdir).tar.lz
+ $(am__post_remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c
>$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e
's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=.. --prefix="$$dc_install_base" \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base"
\
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s
\
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s
\
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f
$(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
+ clean-binPROGRAMS clean-cscope clean-generic cscope \
+ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+ dist-gzip dist-lzip dist-xz dist-zip distcheck distclean \
+ distclean-compile distclean-generic distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+element_types.c element_types.h: element_types.txt element_types.awk
+ awk -f element_types.awk element_types.txt >element_types.h
+
+command_data.c command_ids.h: command_data.txt command_data.awk
+ awk -f command_data.awk command_data.txt >command_ids.h
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: trunk/parsetexi/Parser-5556.pm
===================================================================
--- trunk/parsetexi/Parser-5556.pm (rev 0)
+++ trunk/parsetexi/Parser-5556.pm 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,7078 @@
+# Parser.pm: parse texinfo code into a tree.
+#
+# Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Original author: Patrice Dumas <address@hidden>
+# Parts (also from Patrice Dumas) come from texi2html.pl or texi2html.init.
+
+# The organization of the file is the following:
+# module definitions.
+# default parser state. With explanation of the internal structures.
+# initializations, determination of command types.
+# user visible subroutines.
+# internal subroutines, doing the parsing.
+
+package Texinfo::Parser;
+
+# We need the unicode stuff.
+use 5.006;
+use strict;
+
+# debug
+use Carp qw(cluck);
+
+use Data::Dumper;
+
+# to detect if an encoding may be used to open the files
+use Encode;
+
+# for fileparse
+use File::Basename;
+
+#use POSIX qw(setlocale LC_ALL LC_CTYPE LC_MESSAGES);
+
+# commands definitions
+use Texinfo::Common;
+# Error reporting and counting, translation of strings.
+use Texinfo::Report;
+# encoding_alias
+use Texinfo::Encoding;
+
+# to expand file names in @include and similar @-commands
+use Texinfo::Convert::Text;
+# to normalize node name, anchor, float arg, listoffloats and first *ref
argument.
+use Texinfo::Convert::NodeNameNormalization;
+# in error messages, and for macro body expansion
+use Texinfo::Convert::Texinfo;
+
+require Exporter;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
address@hidden = qw(Exporter Texinfo::Report);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration use Texinfo::Parser ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+ parser
+ parse_texi_text
+ parse_texi_line
+ parse_texi_file
+ indices_information
+ floats_information
+ internal_references_information
+ labels_information
+ global_commands_information
+ global_informations
+) ] );
+
address@hidden = ( @{ $EXPORT_TAGS{'all'} } );
+
address@hidden = qw(
+);
+
+$VERSION = '5.1.90';
+
+sub N__($)
+{
+ return $_[0];
+}
+
+#sub __($$)
+#{
+# my $self = shift;
+# return &{$self->{'gettext'}}(@_);
+#}
+
+# Customization variables obeyed by the Parser, and the default values.
+our %default_customization_values = (
+ 'TEST' => 0,
+ 'DEBUG' => 0, # if >= 10, tree is printed in texi2any.pl after parsing.
+ # If >= 100 tree is printed every line.
+ 'SHOW_MENU' => 1, # if false no menu error related.
+ 'INLINE_INSERTCOPYING' => 0,
+ 'IGNORE_BEFORE_SETFILENAME' => 1,
+ 'MACRO_BODY_IGNORES_LEADING_SPACE' => 0,
+ 'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME' => 1,
+ 'INPUT_PERL_ENCODING' => undef, # input perl encoding name, set from
+ #
@documentencoding in the default case
+ 'INPUT_ENCODING_NAME' => undef, # encoding name normalized as preferred
+ # IANA, set from
@documentencoding in the default
+ # case
+ 'CPP_LINE_DIRECTIVES' => 1, # handle cpp like synchronization lines
+ 'MAX_MACRO_CALL_NESTING' => 100000, # max number of nested macro calls
+ 'GLOBAL_COMMANDS' => [], # list of commands registered
+ # This is not used directly, but passed to Convert::Text through
+ # Texinfo::Common::_convert_text_options
+ 'ENABLE_ENCODING' => 1, # output accented and special characters
+ # based on
@documentencoding
+ # following are used in Texinfo::Structuring
+ 'TOP_NODE_UP' => '(dir)', # up node of Top node
+ 'SIMPLE_MENU' => 0, # not used in the parser but in structuring
+ 'USE_UP_NODE_FOR_ELEMENT_UP' => 0, # Use node up for Up if there is no
+ #
section up.
+);
+
+my %parser_default_configuration =
(%Texinfo::Common::default_parser_state_configuration,
+
%default_customization_values);
+
+# the other possible keys for the parser state are:
+#
+# expanded_formats_hash each key comes from expanded_formats value is 1
+# index_names a structure holding the link between index
+# names, prefixes, merged indices,
+# initial value is %index_names in Texinfo::Common.
+# context_stack stack of the contexts, more recent on top.
+# 'line' is added when on a line or
+# block @-command line,
+# 'def' is added instead if on a definition line.
+# 'preformatted' is added in block commands
+# where there is no paragraphs and spaces are kept
+# (format, example, display...)
+# 'rawpreformatted' is added in raw block commands
+# (html, xml, docbook...)
+# 'menu' is added in menu commands
+# 'math', 'footnote', 'caption', 'shortcaption',
+# 'inlineraw' are also added when in those commands
+# conditionals_stack a stack of conditional commands that are expanded.
+# raw_formats_stack a stack of 1 or 0 for raw formats (@html... or
+# @inlineraw), is 0 if within a raw format that is
+# not expanded.
+# macro_stack stack of macros being expanded (more recent first)
+# definfoenclose an hash, key is the command name, value is an array
+# reference with 2 values, beginning and ending.
+# input a stack, with last at bottom. Holds the opened files
+# or text. Pending macro expansion or text expansion
+# is also in that structure.
+# misc_commands the same than %misc_commands in Texinfo::Common,
+# but with index entry commands dynamically added
+# close_paragraph_commands same than %close_paragraph_commands, but with
+# insertcopying removed if INLINE_INSERTCOPYING
+# close_preformatted_commands same than %close_preformatted_commands, but
with
+# insertcopying removed if INLINE_INSERTCOPYING
+# no_paragraph_commands the same than %default_no_paragraph_commands
+# below, with index
+# entry commands dynamically added
+# simple_text_commands the same than %simple_text_commands below, but
+# with index entry commands dynamically added
+# current_node last seen node.
+# current_section last seen section.
+# nodes list of nodes.
+# command_index_prefix associate a command name to an index prefix.
+# prefix_to_index_name associate an index prefix to the index name.
+# floats key is the normalized float type, value is an array
+# reference holding all the floats.
+# internal_references an array holding all the internal references.
+
+# set points to the value set when initializing, for
+# configuration items that are not to be overriden
+# by @-commands. For example documentlanguage.
+
+# A line information is an hash reference with the keys:
+# line_nr the line number
+# file_name the file name
+# macro if in a macro expansion, the name of the macro
+#
+# A text fragment information is a 2 element array reference, the first is the
+# text fragment, the second is the line information.
+
+# The input structure is an array, the first is the most recently included
+# file. The last element may be a file if the parsing is done on a file,
+# with parse_texi_file, or simply pending text, if called as parse_texi_text.
+# each element of the array is a hash reference. The key are:
+# pending an array reference containing pending text fragments, either the
+# text given as parse_texi_text or macro expansion text.
+# name file name
+# line_nr current line number in the file
+# fh filehandle for the file
+
+# content is not copied but reference is copied when duplicating a parser.
+my %tree_informations;
+foreach my $tree_information ('values', 'macros', 'explained_commands',
'labels') {
+ $tree_informations{$tree_information} = 1;
+}
+
+# The commands in initialization_overrides are not set in the document if
+# set at the parser initialization.
+my %initialization_overrides = (
+ 'INPUT_ENCODING_NAME' => 1,
+ 'documentlanguage' => 1,
+);
+
+my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %misc_commands = %Texinfo::Common::misc_commands;
+my %brace_commands = %Texinfo::Common::brace_commands;
+my %accent_commands = %Texinfo::Common::accent_commands;
+my %context_brace_commands = %Texinfo::Common::context_brace_commands;
+my %block_commands = %Texinfo::Common::block_commands;
+my %block_item_commands = %Texinfo::Common::block_item_commands;
+my %close_paragraph_commands = %Texinfo::Common::close_paragraph_commands;
+my %def_map = %Texinfo::Common::def_map;
+my %def_commands = %Texinfo::Common::def_commands;
+my %def_aliases = %Texinfo::Common::def_aliases;
+my %menu_commands = %Texinfo::Common::menu_commands;
+my %preformatted_commands = %Texinfo::Common::preformatted_commands;
+my %format_raw_commands = %Texinfo::Common::format_raw_commands;
+my %item_container_commands = %Texinfo::Common::item_container_commands;
+my %item_line_commands = %Texinfo::Common::item_line_commands;
+my %deprecated_commands = %Texinfo::Common::deprecated_commands;
+my %root_commands = %Texinfo::Common::root_commands;
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+my %command_index_prefix = %Texinfo::Common::command_index_prefix;
+my %command_structuring_level = %Texinfo::Common::command_structuring_level;
+my %ref_commands = %Texinfo::Common::ref_commands;
+my %region_commands = %Texinfo::Common::region_commands;
+my %code_style_commands = %Texinfo::Common::code_style_commands;
+my %in_heading_commands = %Texinfo::Common::in_heading_commands;
+my %explained_commands = %Texinfo::Common::explained_commands;
+my %inline_format_commands = %Texinfo::Common::inline_format_commands;
+my %inline_commands = %Texinfo::Common::inline_commands;
+my %inline_conditional_commands =
%Texinfo::Common::inline_conditional_commands;
+my %all_commands = %Texinfo::Common::all_commands;
+
+# equivalence between a @set flag and an @@-command
+my %set_flag_command_equivalent = (
+ 'txicodequoteundirected' => 'codequoteundirected',
+ 'txicodequotebacktick' => 'codequotebacktick',
+# 'txideftypefnnl' => 'deftypefnnewline',
+);
+
+
+# keep line information for those commands.
+my %keep_line_nr_brace_commands = %context_brace_commands;
+foreach my $keep_line_nr_brace_command ('titlefont', 'anchor') {
+ $keep_line_nr_brace_commands{$keep_line_nr_brace_command} = 1;
+}
+foreach my $brace_command (keys (%brace_commands)) {
+ $keep_line_nr_brace_commands{$brace_command} = 1
+ if ($brace_commands{$brace_command} > 1);
+}
+
+my %type_with_paragraph;
+foreach my $type ('before_item', 'text_root', 'document_root',
+ 'brace_command_context') {
+ $type_with_paragraph{$type} = 1;
+}
+
+my %command_ignore_space_after;
+foreach my $command ('anchor', 'hyphenation', 'caption', 'shortcaption') {
+ $command_ignore_space_after{$command} = 1;
+}
+
+my %global_multiple_commands;
+foreach my $global_multiple_command (
+ 'author', 'footnote', 'hyphenation', 'insertcopying', 'printindex',
+ 'subtitle','titlefont', 'listoffloats', 'detailmenu', 'part',
+ keys(%Texinfo::Common::document_settable_at_commands), ) {
+ $global_multiple_commands{$global_multiple_command} = 1;
+}
+
+my %global_unique_commands;
+foreach my $global_unique_command (
+ 'copying', 'settitle',
+ 'shorttitlepage', 'title', 'titlepage', 'top',
+ keys(%Texinfo::Common::document_settable_unique_at_commands), ) {
+ $global_unique_commands{$global_unique_command} = 1;
+}
+
+my %index_names = %Texinfo::Common::index_names;
+
+# index names that cannot be set by the user.
+my %forbidden_index_name = ();
+
+foreach my $name(keys(%index_names)) {
+ foreach my $prefix (@{$index_names{$name}->{'prefix'}}) {
+ $forbidden_index_name{$prefix} = 1;
+ }
+}
+
+foreach my $other_forbidden_index_name ('info','ps','pdf','htm',
+ 'html', 'log','aux','dvi','texi','txi','texinfo','tex','bib') {
+ $forbidden_index_name{$other_forbidden_index_name} = 1;
+}
+
+# @-commands that do not start a paragraph
+my %default_no_paragraph_commands;
+# @-commands that should be at a line beginning
+my %begin_line_commands;
+
+foreach my $command ('node', 'end') {
+ $begin_line_commands{$command} = $command;
+}
+
+foreach my $no_paragraph_command ('titlefont', 'caption', 'shortcaption',
+ 'image', '*', 'hyphenation', 'anchor', 'errormsg') {
+ $default_no_paragraph_commands{$no_paragraph_command} = 1;
+}
+
+foreach my $no_paragraph_command (keys(%misc_commands)) {
+ $default_no_paragraph_commands{$no_paragraph_command} = 1;
+ $begin_line_commands{$no_paragraph_command} = 1;
+}
+
+# verbatiminclude is not said to begin at the beginning of the line
+# in the manual
+foreach my $misc_not_begin_line ('comment', 'c', 'sp', 'refill',
+ 'noindent',
'indent', 'columnfractions',
+ 'tab', 'item',
'headitem', 'verbatiminclude',
+ 'set', 'clear',
+ 'vskip',
keys(%in_heading_commands)) {
+ delete $begin_line_commands{$misc_not_begin_line};
+}
+
+my %block_arg_commands;
+foreach my $block_command (keys(%block_commands)) {
+ $begin_line_commands{$block_command} = 1;
+ $default_no_paragraph_commands{$block_command} = 1;
+ $block_arg_commands{$block_command} = 1
+ if ($block_commands{$block_command} ne 'raw');
+# and ! $format_raw_commands{$block_command});
+}
+
+my %close_preformatted_commands = %close_paragraph_commands;
+foreach my $no_close_preformatted('sp') {
+ delete $close_preformatted_commands{$no_close_preformatted};
+}
+# FIXME to close preformated or not to close?
+#foreach my $format_raw_command(keys(%format_raw_commands)) {
+# $close_preformatted_commands{$format_raw_command} = 1;
+#}
+
+# commands that may appear in accents
+my %in_accent_commands = %accent_commands;
+foreach my $brace_command(keys(%brace_commands)) {
+ $in_accent_commands{$brace_command} = 1 if
(!$brace_commands{$brace_command});
+}
+foreach my $no_brace_command (keys(%no_brace_commands)) {
+ $in_accent_commands{$no_brace_command} = 1;
+}
+$in_accent_commands{'c'} = 1;
+$in_accent_commands{'comment'} = 1;
+
+# commands that may appear in texts arguments
+my %in_full_text_commands;
+foreach my $command (keys(%brace_commands), keys(%no_brace_commands)) {
+ $in_full_text_commands{$command} = 1;
+}
+foreach my $misc_command_in_full_text('c', 'comment', 'refill', 'noindent',
+ 'indent', 'columnfractions',
'set', 'clear', 'end') {
+ $in_full_text_commands{$misc_command_in_full_text} = 1;
+}
+
+foreach my $out_format (keys(%format_raw_commands)) {
+ $in_full_text_commands{$out_format} = 1;
+}
+delete $in_full_text_commands{'caption'};
+delete $in_full_text_commands{'shortcaption'};
+foreach my $block_command (keys(%block_commands)) {
+ $in_full_text_commands{$block_command} = 1
+ if ($block_commands{$block_command} eq 'conditional');
+}
+
+# commands that may happen on lines where everything is
+# permitted
+my %in_full_line_commands = %in_full_text_commands;
+foreach my $not_in_full_line_commands('noindent', 'indent') {
+ delete $in_full_line_commands{$not_in_full_line_commands};
+}
+
+# commands that may happen on sectioning commands
+my %in_full_line_commands_no_refs = %in_full_line_commands;
+foreach my $not_in_full_line_commands_no_refs ('titlefont',
+
'anchor', 'footnote', 'verb') {
+ delete $in_full_line_commands_no_refs{$not_in_full_line_commands_no_refs};
+}
+
+# commands that may happen in simple text arguments
+my %in_simple_text_commands = %in_full_line_commands_no_refs;
+foreach my $not_in_simple_text_command('xref', 'ref', 'pxref', 'inforef') {
+ delete $in_simple_text_commands{$not_in_simple_text_command};
+}
+
+# commands that only accept simple text as argument in any context.
+my %simple_text_commands;
+foreach my $misc_command(keys(%misc_commands)) {
+ if ($misc_commands{$misc_command} =~ /^\d+$/
+ or ($misc_commands{$misc_command} eq 'line'
+ and !($sectioning_commands{$misc_command}
+ or $def_commands{$misc_command}))
+ or $misc_commands{$misc_command} eq 'text') {
+ $simple_text_commands{$misc_command} = 1;
+ }
+}
+
+my %full_line_commands_no_refs = (%sectioning_commands,
+
%def_commands);
+
+delete $simple_text_commands{'center'};
+delete $simple_text_commands{'exdent'};
+foreach my $command ('titlefont', 'anchor', 'xref','ref','pxref',
+ 'inforef', 'shortcaption', 'math',
'indicateurl',
+ 'email', 'uref', 'url', 'image',
'abbr', 'acronym',
+ 'dmn', 'ctrl', 'errormsg') {
+ $simple_text_commands{$command} = 1;
+}
+
+# commands that accept full text, but no block or top-level commands
+my %full_text_commands;
+foreach my $brace_command (keys (%brace_commands)) {
+ if ($brace_commands{$brace_command} == 1
+ and !$simple_text_commands{$brace_command}
+ and !$context_brace_commands{$brace_command}
+ and !$accent_commands{$brace_command}) {
+ $full_text_commands{$brace_command} = 1;
+ }
+}
+
+# commands that accept almost the same than in full text, except
+# what do not make sense on a line.
+my %full_line_commands;
+$full_line_commands{'center'} = 1;
+$full_line_commands{'exdent'} = 1;
+$full_line_commands{'item'} = 1;
+$full_line_commands{'itemx'} = 1;
+
+# Fill the valid nestings hash. All commands not in that hash
+# are considered to accept anything within. There are additional
+# context tests, to make sure, for instance that we are testing
+# @-commands on the block, misc or node @-command line and not
+# in the content.
+# index entry commands are dynamically set as in_simple_text_commands
+my %default_valid_nestings;
+
+foreach my $command (keys(%accent_commands)) {
+ $default_valid_nestings{$command} = \%in_accent_commands;
+}
+foreach my $command (keys(%full_text_commands)) {
+ $default_valid_nestings{$command} = \%in_full_text_commands;
+}
+foreach my $command (keys(%simple_text_commands)) {
+ $default_valid_nestings{$command} = \%in_simple_text_commands;
+}
+foreach my $command (keys(%full_line_commands)) {
+ $default_valid_nestings{$command} = \%in_full_line_commands;
+}
+foreach my $command (keys(%full_line_commands_no_refs)) {
+ $default_valid_nestings{$command} = \%in_full_line_commands_no_refs;
+}
+# Only for block commands with line arguments
+foreach my $command (keys(%block_commands)) {
+ if ($block_commands{$command} and $block_commands{$command} ne 'raw'
+ and $block_commands{$command} ne 'conditional'
+ and !$def_commands{$command}) {
+ $default_valid_nestings{$command} = \%in_simple_text_commands;
+ }
+}
+
+
+my @preformatted_contexts = ('preformatted', 'rawpreformatted');
+my %preformatted_contexts;
+foreach my $preformatted_context (@preformatted_contexts) {
+ $preformatted_contexts{$preformatted_context} = 1;
+}
+
+# contexts on the context_stack stack where empty line don't trigger
+# paragraph
+my %no_paragraph_contexts;
+foreach my $no_paragraph_context ('math', 'menu', @preformatted_contexts,
+ 'def',
'inlineraw') {
+ $no_paragraph_contexts{$no_paragraph_context} = 1;
+};
+
+
+
+# Format a bug message
+sub _bug_message($$;$$)
+{
+ my $self = shift;
+ my $message = shift;
+ my $line_number = shift;
+ my $current = shift;
+
+ my $line_message = '';
+ if ($line_number) {
+ my $file = $line_number->{'file_name'};
+ $line_message
+ = "last location:
$line_number->{'file_name'}:$line_number->{'line_nr'}";
+ if ($line_number->{'macro'} ne '') {
+ $line_message .= " (possibly involving $line_number->{'macro'})";
+ }
+ $line_message .= "\n";
+ }
+ my $message_context_stack = "context_stack:
(@{$self->{'context_stack'}})\n";
+ my $current_element_message = '';
+ if ($current) {
+ $current_element_message = "current: ". _print_current($current);
+ }
+ warn "You found a bug: $message\n\n".
+ "Additional informations:\n".
+ $line_message.$message_context_stack.$current_element_message;
+
+}
+
+# simple deep copy of a structure
+sub _deep_copy($)
+{
+ my $struct = shift;
+ my $string = Data::Dumper->Dump([$struct], ['struct']);
+ eval $string;
+ return $struct;
+}
+
+# return true if effect of global commands should be ignored.
+sub _ignore_global_commands($)
+{
+ my $self = shift;
+ return !$self->{'expanded_formats_stack'}->[-1];
+}
+
+# enter all the commands associated with an index name using the prefix
+# list
+sub _register_index_commands($$)
+{
+ my $self = shift;
+ my $index_name = shift;
+ if (!$self->{'index_names'}->{$index_name}->{'prefix'}) {
+ $self->{'index_names'}->{$index_name}->{'prefix'} = [$index_name];
+ }
+ if (!exists($self->{'index_names'}->{$index_name}->{'name'})) {
+ $self->{'index_names'}->{$index_name}->{'name'} = $index_name;
+ }
+ if (!exists($self->{'index_names'}->{$index_name}->{'contained_indices'}))
{
+
$self->{'index_names'}->{$index_name}->{'contained_indices'}->{$index_name} = 1;
+ }
+ foreach my $prefix (@{$self->{'index_names'}->{$index_name}->{'prefix'}}) {
+ $self->{'misc_commands'}->{$prefix.'index'} = 'line';
+ $self->{'no_paragraph_commands'}->{$prefix.'index'} = 1;
+ $self->{'valid_nestings'}->{$prefix.'index'} =
\%in_simple_text_commands;
+ $self->{'command_index_prefix'}->{$prefix.'index'} = $prefix;
+ $self->{'prefix_to_index_name'}->{$prefix} = $index_name;
+ }
+}
+
+# initialization entry point. Set up a parser.
+# The last argument, optional, is a hash provided by the user to change
+# the default values for what is present in %parser_default_configuration.
+# The exact arguments of the function depend on how it was called,
+# in a object oriented way or not.
+sub parser(;$$)
+{
+ my $class = shift;
+ my $conf;
+
+ my $parser = _deep_copy(\%parser_default_configuration);
+ # _deep_copy doesn't handle subs
+ $parser->{'gettext'} = $parser_default_configuration{'gettext'};
+ $parser->{'pgettext'} = $parser_default_configuration{'pgettext'};
+
+ # called not object-oriented
+ if (ref($class) eq 'HASH') {
+ #print STDERR "Not oo\n"
+ $conf = $class;
+ bless $parser;
+
+ } elsif (ref($class)) {
+ # called on an existing parser, interpreted as a duplication
+ my $old_parser = $class;
+ $class = ref($class);
+ foreach my $key (keys(%parser_default_configuration)) {
+ if ($tree_informations{$key}) {
+ if (defined($old_parser->{$key})) {
+ foreach my $info_key (keys(%{$old_parser->{$key}})) {
+ $parser->{$key}->{$info_key}
+ = $old_parser->{$key}->{$info_key};
+ }
+ }
+ } else {
+ $parser->{$key} = _deep_copy($old_parser->{$key});
+ }
+ }
+ #$parser = _deep_copy($old_parser);
+ $parser->{'gettext'} = $old_parser->{'gettext'};
+ $parser->{'pgettext'} = $old_parser->{'pgettext'};
+ bless $parser, $class;
+ $conf = shift;
+
+ } elsif (defined($class)) {
+ bless $parser, $class;
+ $conf = shift;
+ } else {
+ bless $parser;
+ $conf = shift;
+ }
+
+ if (defined($conf)) {
+ foreach my $key (keys(%$conf)) {
+ if (exists($parser_default_configuration{$key})) {
+ if (ref($conf->{$key}) ne 'CODE' and $key ne 'values') {
+ $parser->{$key} = _deep_copy($conf->{$key});
+ } else {
+ $parser->{$key} = $conf->{$key};
+ }
+ if ($initialization_overrides{$key}) {
+ $parser->{'set'}->{$key} = $parser->{$key};
+ }
+ } else {
+ warn "$key not a possible customization in
Texinfo::Parser::parser\n";
+ }
+ }
+ }
+ #foreach my $value (keys %{$parser->{'values'}}) {
+ # print STDERR " -> $value $parser->{'values'}->{$value}\n";
+ #}
+ # Now initialize command hash that are dynamically modified, notably
+ # those for index commands, and lists, based on defaults and user provided.
+ $parser->{'misc_commands'} = _deep_copy (\%misc_commands);
+ $parser->{'valid_nestings'} = _deep_copy (\%default_valid_nestings);
+ $parser->{'no_paragraph_commands'} = { %default_no_paragraph_commands };
+ $parser->{'index_names'} = _deep_copy (\%index_names);
+ $parser->{'command_index_prefix'} = {%command_index_prefix};
+ $parser->{'close_paragraph_commands'} = {%close_paragraph_commands};
+ $parser->{'close_preformatted_commands'} = {%close_preformatted_commands};
+ if ($parser->{'INLINE_INSERTCOPYING'}) {
+ delete $parser->{'close_paragraph_commands'}->{'insercopying'};
+ delete $parser->{'close_preformatted_commands'}->{'insercopying'};
+ }
+ # a hash is simply concatenated. It should be like %index_names.
+ if (ref($parser->{'indices'}) eq 'HASH') {
+ %{$parser->{'index_names'}} = (%{$parser->{'index_names'}},
+
%{$parser->{'indices'}});
+ } else { # an array holds index names defined with @defindex
+ foreach my $name (@{$parser->{'indices'}}) {
+ $parser->{'index_names'}->{$name} = {'in_code' => 0};
+ }
+ }
+ foreach my $index (keys (%{$parser->{'index_names'}})) {
+ $parser->_register_index_commands($index);
+ }
+ if ($parser->{'merged_indices'}) {
+ foreach my $index_from (keys (%{$parser->{'merged_indices'}})) {
+ my $index_to = $parser->{'merged_indices'}->{$index_from};
+ if (defined($parser->{'index_names'}->{$index_from})
+ and defined($parser->{'index_names'}->{$index_to})) {
+ $parser->{'index_names'}->{$index_from}->{'merged_in'} =
$index_to;
+
$parser->{'index_names'}->{$index_to}->{'contained_indices'}->{$index_from} = 1;
+ }
+ }
+ }
+ foreach my $explained_command(keys(%explained_commands)) {
+ if (!defined($parser->{'explained_commands'}->{$explained_command})) {
+ $parser->{'explained_commands'}->{$explained_command} = {};
+ }
+ }
+ $parser->{'context_stack'} = [ $parser->{'context'} ];
+ $parser->{'regions_stack'} = [];
+ $parser->{'macro_stack'} = [];
+ $parser->{'conditionals_stack'} = [];
+ $parser->{'expanded_formats_stack'} = [1];
+
+ # turn the array to a hash for speed. Not sure it really matters for such
+ # a small array.
+ foreach my $expanded_format(@{$parser->{'expanded_formats'}}) {
+ $parser->{'expanded_formats_hash'}->{$expanded_format} = 1;
+ }
+
+ %{$parser->{'global_commands'}} = %global_multiple_commands;
+
+ foreach my $global_command (@{$parser->{'GLOBAL_COMMANDS'}}) {
+ $parser->{'global_commands'}->{$global_command} = 1;
+ }
+
+ $parser->Texinfo::Report::new;
+
+ return $parser;
+}
+
+sub get_conf($$)
+{
+ my $self = shift;
+ my $var = shift;
+ return $self->{$var};
+}
+
+# split a scalar text in an array lines.
+sub _text_to_lines($)
+{
+ my $text = shift;
+ die if (!defined($text));
+ my $had_final_end_line = chomp($text);
+ my $lines = [ map {$_."\n"} split (/\n/, $text, -1) ];
+ $lines = [''] if (address@hidden);
+ chomp($lines->[-1]) unless ($had_final_end_line);
+ return $lines;
+}
+
+# construct a text fragments array matching a lines array, based on information
+# supplied.
+# If $fixed_line_number is set the line number is not increased, otherwise
+# it is increased, beginning at $first_line.
+sub _complete_line_nr($$;$$$)
+{
+ my $lines = shift;
+ my $first_line = shift;
+ my $file = shift;
+ my $macro = shift;
+ my $fixed_line_number = shift;
+
+ $macro = '' if (!defined($macro));
+ $file = '' if (!defined($file));
+ my $new_lines = [];
+
+ if (defined($first_line)) {
+ my $line_index = $first_line;
+ foreach my $index(0..scalar(@$lines)-1) {
+ $line_index = $index+$first_line if (!$fixed_line_number);
+ $new_lines->[$index] = [ $lines->[$index],
+ { 'line_nr' =>
$line_index,
+ 'file_name' =>
$file, 'macro' => $macro } ];
+ }
+ } else {
+ foreach my $line (@$lines) {
+ push @$new_lines, [ $line ];
+ }
+ }
+ return $new_lines;
+}
+
+# entry point for text fragments.
+# Used in tests.
+# Note that it has no associated root type a opposed to parse_texi_line
+# and parse_texi_file.
+sub parse_texi_text($$;$$$$)
+{
+ my $self = shift;
+ my $text = shift;
+ my $lines_nr = shift;
+ my $file = shift;
+ my $macro = shift;
+ my $fixed_line_number = shift;
+
+ return undef if (!defined($text));
+
+ my $lines_array = [];
+ if (!ref($text)) {
+ $text = _text_to_lines($text);
+ }
+ $lines_nr = [] if (!defined($lines_nr));
+ if (!ref($lines_nr)) {
+ #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
+ $lines_array = _complete_line_nr($text, $lines_nr, $file,
+
$macro, $fixed_line_number);
+ } else {
+ while (@$text) {
+ my $line_nr = shift @$lines_nr;
+ my $line = shift @$text;
+ push @$lines_array, [$line, $line_nr];
+ }
+ }
+
+ $self = parser() if (!defined($self));
+ $self->{'input'} = [{'pending' => $lines_array}];
+ my $tree = $self->_parse_texi();
+ return $tree;
+}
+
+# Not used for now, as a @contents after the first sectioning command
+# is correct if not using TeX.
+sub _check_contents_location($$)
+{
+ my $self = shift;
+ my $tree = shift;
+
+ my $commands = $self->global_commands_information();
+ return unless ($commands);
+ # Find the last sectioning command
+ my $index = -1;
+ my %ending_root_commands;
+ my $found = 0;
+ while ($tree->{'contents'}->[$index]) {
+ if (defined($tree->{'contents'}->[$index]->{'cmdname'})) {
+ $ending_root_commands{$tree->{'contents'}->[$index]} = 1;
+ if
($sectioning_commands{$tree->{'contents'}->[$index]->{'cmdname'}}) {
+ $found = 1;
+ last;
+ }
+ }
+ $index--;
+ }
+ return if (!$found);
+
+ #print STDERR "ending_root_commands
".join('|',keys(%ending_root_commands))."\n";
+ #print STDERR "tree contents: ".join('|', @{$tree->{'contents'}})."\n";
+ foreach my $command ('contents', 'shortcontents', 'summarycontents') {
+ if ($commands->{$command}) {
+ foreach my $current (@{$commands->{$command}}) {
+ my $root_command =
$self->Texinfo::Common::find_parent_root_command($current);
+ #print STDERR "root_command for $current->{'cmdname'}:
$root_command\n";
+ if (defined($root_command)
+ and !$ending_root_commands{$root_command}) {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden should only appear at
beginning or end of document"),
+
$current->{'cmdname'}), $current->{'line_nr'});
+ }
+ }
+ }
+ }
+}
+
+# parse a texi file
+sub parse_texi_file($$)
+{
+ my $self = shift;
+ my $file_name = shift;
+
+ my $filehandle = do { local *FH };
+ if (! open($filehandle, $file_name)) {
+ $self->document_error(sprintf($self->__("could not open %s: %s"),
+
$file_name, $!));
+ return undef;
+ }
+ my $line_nr = 0;
+ my $line;
+ my @first_lines;
+
+ my $pending_first_texi_line;
+ # the first line not empty and not with \input is kept in
+ # $pending_first_texi_line and put in the pending lines just below
+ while ($line = <$filehandle>) {
+ $line_nr++;
+ if ($line =~ /^ *\\input/ or $line =~ /^\s*$/) {
+ $line =~ s/\x{7F}.*\s*//;
+ push @first_lines, $line;
+ } else {
+ $pending_first_texi_line = $line;
+ last;
+ }
+ }
+ my $root = { 'contents' => [], 'type' => 'text_root' };
+ if (@first_lines) {
+ push @{$root->{'contents'}}, { 'type' => 'preamble', 'contents' => []
};
+ foreach my $line (@first_lines) {
+ push @{$root->{'contents'}->[-1]->{'contents'}},
+ { 'text'
=> $line,
+
'type' => 'preamble_text' };
+ }
+ }
+ my ($directories, $suffix);
+ ($file_name, $directories, $suffix) = fileparse($file_name)
+ if ($self->{'TEST'});
+ $self = parser() if (!defined($self));
+ $self->{'input'} = [{
+ 'pending' => [[$pending_first_texi_line, {'line_nr' => $line_nr,
+ 'macro' => '',
'file_name' => $file_name}]],
+ 'name' => $file_name,
+ 'line_nr' => $line_nr,
+ 'fh' => $filehandle
+ }];
+ $self->{'info'}->{'input_file_name'} = $file_name;
+ my $tree = $self->_parse_texi($root);
+
+ # Find 'text_root', which contains everything before first node/section.
+ # if there are elements, 'text_root' is the first content, otherwise it
+ # is the root.
+ my $text_root;
+ if ($tree->{'type'} eq 'text_root') {
+ $text_root = $tree;
+ } elsif ($tree->{'contents'} and $tree->{'contents'}->[0]
+ and $tree->{'contents'}->[0]->{'type'} eq 'text_root') {
+ $text_root = $tree->{'contents'}->[0];
+ }
+
+ # Put everything before @setfilename in a special type. This allows to
+ # ignore everything before @setfilename.
+ if ($self->{'IGNORE_BEFORE_SETFILENAME'} and $text_root and
+ $self->{'extra'} and $self->{'extra'}->{'setfilename'}
+ and $self->{'extra'}->{'setfilename'}->{'parent'} eq $text_root) {
+ my $before_setfilename = {'type' => 'preamble_before_setfilename',
+ 'parent' =>
$text_root,
+ 'contents' => []};
+ while ($text_root->{'contents'}->[0] ne
$self->{'extra'}->{'setfilename'}) {
+ my $content = shift @{$text_root->{'contents'}};
+ $content->{'parent'} = $before_setfilename;
+ push @{$before_setfilename->{'contents'}}, $content;
+ }
+ unshift (@{$text_root->{'contents'}}, $before_setfilename)
+ if (@{$before_setfilename->{'contents'}});
+ }
+ #$self->_check_contents_location($tree);
+
+ return $tree;
+}
+
+sub parse_texi_line($$;$$$$)
+{
+ my $self = shift;
+ my $text = shift;
+ my $lines_nr = shift;
+ my $file = shift;
+ my $macro = shift;
+ my $fixed_line_number = shift;
+
+ return undef if (!defined($text));
+
+ if (!ref($text)) {
+ $text = _text_to_lines($text);
+ }
+ #$file =~ s/^.*\/// if (defined($file) and $self->{'TEST'});
+ my $lines_array = _complete_line_nr($text, $lines_nr, $file,
+
$macro, $fixed_line_number);
+
+ $self = parser() if (!defined($self));
+ $self->{'input'} = [{'pending' => $lines_array}];
+ my $tree = $self->_parse_texi({'contents' => [], 'type' => 'root_line'});
+ return $tree;
+}
+
+# return indices informations
+sub indices_information($)
+{
+ my $self = shift;
+ return ($self->{'index_names'}, $self->{'merged_indices'});
+ #return ($self->{'index_names'}, $self->{'merged_indices'},
$self->{'index_entries'});
+}
+
+sub floats_information($)
+{
+ my $self = shift;
+ return $self->{'floats'};
+}
+
+sub internal_references_information($)
+{
+ my $self = shift;
+ return $self->{'internal_references'};
+}
+
+sub global_commands_information($)
+{
+ my $self = shift;
+ return $self->{'extra'};
+}
+
+# @ dircategory_direntry
+# @ unassociated_menus
+# perl_encoding
+# input_encoding_name
+# input_file_name
+sub global_informations($)
+{
+ my $self = shift;
+ return $self->{'info'};
+}
+
+sub labels_information($)
+{
+ my $self = shift;
+ return $self->{'labels'};
+}
+
+# Following are the internal subroutines. The most important are
+# _parse_texi: the main parser loop.
+# _end_line: called at an end of line. Handling of @include lines is
+# done here.
+# _next_text: present the next text fragment, from pending text or line,
+# as described above.
+
+# for debugging
+sub _print_current($)
+{
+ my $current = shift;
+ return Texinfo::Common::_print_current($current);
+}
+
+# for debugging
+sub _print_command_args_texi($)
+{
+ my $current = shift;
+ return '' if (!$current->{'cmdname'});
+ my $args = '';
+ my $with_brace;
+ if ($current->{'args'} and @{$current->{'args'}}) {
+ $with_brace
+ = ($current->{'args'}->[0]->{'type'} eq 'brace_command_arg'
+ or $current->{'args'}->[0]->{'type'} eq
'brace_command_context');
+ $args .= '{' if ($with_brace);
+ foreach my $arg (@{$current->{'args'}}) {
+ $args .= Texinfo::Convert::Texinfo::convert($arg).', ';
+ }
+ $args =~ s/, $//;
+ }
+ chomp($args);
+ if ($with_brace) {
+ $args .= '}';
+ }
+ return '@'.$current->{'cmdname'} .$args."\n";
+}
+
+sub _print_current_keys($)
+{
+ my $current = shift;
+ my $string = _print_current($current);
+ foreach my $key (keys (%$current)) {
+ $string .= " $key: $current->{$key}\n";
+ }
+ if ($current->{'extra'}) {
+ $string .= " EXTRA\n";
+ foreach my $key (keys (%{$current->{'extra'}})) {
+ $string .= " $key: $current->{'extra'}->{$key}\n";
+ }
+ }
+ return $string;
+}
+
+# For debugging
+my @kept_keys = ('contents', 'cmdname', 'type', 'text', 'args');
+my %kept_keys;
+foreach my $key (@kept_keys) {
+ $kept_keys{$key} = 1;
+}
+sub _filter_print_keys { [grep {$kept_keys{$_}} ( sort keys %{$_[0]} )] };
+sub _print_tree($)
+{
+ my $tree = shift;
+ local $Data::Dumper::Sortkeys = \&_filter_print_keys;
+ local $Data::Dumper::Purity = 1;
+ local $Data::Dumper::Indent = 1;
+
+ return Data::Dumper->Dump([$tree]);
+}
+
+sub _register_global_command($$$$)
+{
+ my $self = shift;
+ my $command = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ if ($command eq 'summarycontents' and
!$self->{'global_commands'}->{$command}) {
+ $command = 'shortcontents';
+ }
+ if ($self->{'global_commands'}->{$command} and $command ne 'author') {
+ push @{$self->{'extra'}->{$command}}, $current
+ unless (_ignore_global_commands($self));
+ $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
+ return 1;
+ } elsif ($global_unique_commands{$command}) {
+ # setfilename ignored in an included file
+ $current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
+ if ($command eq 'setfilename'
+ and scalar(@{$self->{'input'}}) > 1) {
+ } elsif (exists ($self->{'extra'}->{$current->{'cmdname'}})) {
+ $self->line_warn(sprintf($self->__('multiple @%s'),
+
$current->{'cmdname'}), $line_nr);
+ } else {
+ $self->{'extra'}->{$current->{'cmdname'}} = $current
+ unless
(_ignore_global_commands($self));
+ }
+ return 1;
+ }
+ return 0;
+}
+
+# parse a @macro line
+sub _parse_macro_command_line($$$$$;$)
+{
+ my $self = shift;
+ my $command = shift;
+ my $line = shift;
+ my $parent = shift;
+ my $line_nr = shift;
+ my $macro = { 'cmdname' => $command, 'parent' => $parent, 'contents' => [],
+ 'extra' => {'arg_line' => $line}, 'line_nr' =>
$line_nr };
+ # REMACRO
+ if ($line =~ /^\s+([[:alnum:]][[:alnum:]-]*)\s*(.*)/) {
+ my $macro_name = $1;
+ my $args_def = $2;
+ my @args;
+
+ if ($args_def =~ s/^\s*{\s*(.*?)\s*}\s*//) {
+ @args = split(/\s*,\s*/, $1);
+ }
+
+ # accept an @-command after the arguments in case there is a @c or
+ # @comment
+ if ($args_def =~ /address@hidden/) {
+ $self->line_error(sprintf($self->__("bad syntax for address@hidden
argument: %s"),
+ $command,
$args_def),
+ $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
+ }
+ print STDERR "MACRO address@hidden $macro_name\n" if
($self->{'DEBUG'});
+
+ $macro->{'args'} = [
+ { 'type' => 'macro_name', 'text' => $macro_name,
+ 'parent' => $macro } ];
+ my $index = 0;
+ foreach my $formal_arg (@args) {
+ push @{$macro->{'args'}},
+ { 'type' => 'macro_arg', 'text' => $formal_arg,
+ 'parent' => $macro};
+ if ($formal_arg !~ /^[\w\-]+$/) {
+ $self->line_error(sprintf($self->__("bad or empty
address@hidden formal argument: %s"),
+
$command, $formal_arg), $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
+ }
+ $macro->{'extra'}->{'args_index'}->{$formal_arg} = $index;
+ $index++;
+ }
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
+ }
+ return $macro;
+}
+
+# start a paragraph if in a context where paragraphs are to be started.
+sub _begin_paragraph($$;$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+
+ # !$current->{'type'} is true for @-commands. In fact it is unclear
+ # that there may be cases of !$current->{'type'} and !$current->{'cmdname'}
+ if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
+ and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
+ if (!defined($current->{'contents'})) {
+ $self->_bug_message("contents undef", $line_nr, $current);
+ die;
+ }
+
+ # find whether an @indent precedes the paragraph
+ my $indent;
+ if (scalar(@{$current->{'contents'}})) {
+ my $index = scalar(@{$current->{'contents'}}) -1;
+ while ($index >= 0
+ and !($current->{'contents'}->[$index]->{'type'}
+ and ($current->{'contents'}->[$index]->{'type'} eq
'empty_line'
+ or
$current->{'contents'}->[$index]->{'type'} eq 'paragraph'))
+ and !($current->{'contents'}->[$index]->{'cmdname'}
+ and
$self->{'close_paragraph_commands'}->{$current->{'contents'}->[$index]->{'cmdname'}}))
{
+ if ($current->{'contents'}->[$index]->{'cmdname'}
+ and ($current->{'contents'}->[$index]->{'cmdname'} eq
'indent'
+ or $current->{'contents'}->[$index]->{'cmdname'}
eq 'noindent')) {
+ $indent = $current->{'contents'}->[$index]->{'cmdname'};
+ last;
+ }
+ $index--;
+ }
+ }
+ push @{$current->{'contents'}},
+ { 'type' => 'paragraph', 'parent' => $current,
'contents' => [] };
+ $current->{'contents'}->[-1]->{'extra'}->{$indent} = 1 if ($indent);
+ $current = $current->{'contents'}->[-1];
+ print STDERR "PARAGRAPH\n" if ($self->{'DEBUG'});
+ return $current;
+ }
+ return 0;
+}
+
+sub _begin_preformatted($)
+{
+ my $self = shift;
+ my $current = shift;
+ if ($preformatted_contexts{$self->{'context_stack'}->[-1]}) {
+ push @{$current->{'contents'}},
+ { 'type' => $self->{'context_stack'}->[-1],
+ 'parent' => $current, 'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ print STDERR "PREFORMATTED $self->{'context_stack'}->[-1]\n" if
($self->{'DEBUG'});
+ }
+ return $current;
+}
+
+# wrapper around line_warn. Set line_nr to be the line_nr of the command,
+# corresponding to the opening of the command. Call line_warn with
+# sprintf if needed.
+sub _command_warn($$$$;@)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $message = shift;
+
+ if ($current->{'line_nr'}) {
+ $line_nr = $current->{'line_nr'};
+ }
+ if (@_) {
+ $self->line_warn(sprintf($message, @_), $line_nr);
+ } else {
+ $self->line_warn($message, $line_nr);
+ }
+}
+
+sub _command_error($$$$;@)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $message = shift;
+
+ # use the beginning of the @-command for the error message
+ # line number if available.
+ # FIXME line_nr currently not registered for regular brace commands
+ if ($current->{'line_nr'}) {
+ $line_nr = $current->{'line_nr'};
+ }
+ if (@_) {
+ $self->line_error(sprintf($message, @_), $line_nr);
+ } else {
+ $self->line_error($message, $line_nr);
+ }
+}
+
+# currently doesn't do much more than
+# return $_[1]->{'parent'}
+sub _close_brace_command($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
+
+ if ($current->{'cmdname'} ne 'verb' or $current->{'type'} eq '') {
+ if (defined($closed_command)) {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden %s seen before address@hidden
closing brace"),
+ $closed_command, $current->{'cmdname'});
+ } elsif (defined($interrupting_command)) {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden seen before address@hidden closing
brace"),
+ $interrupting_command,
$current->{'cmdname'});
+
+ } else {
+ $self->_command_error($current, $line_nr,
+ $self->__("%c%s missing close brace"), ord('@'),
$current->{'cmdname'});
+ }
+ } else {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden missing closing delimiter sequence:
%s}"),
+ $current->{'cmdname'}, $current->{'type'});
+ }
+ $current = $current->{'parent'};
+ return $current;
+}
+
+sub _in_code($$)
+{
+ my $self = shift;
+ my $current = shift;
+
+ while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
+ and exists
$brace_commands{$current->{'parent'}->{'cmdname'}}
+ and !exists
$context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+ return 1 if ($code_style_commands{$current->{'parent'}->{'cmdname'}});
+ $current = $current->{'parent'}->{'parent'};
+ }
+ return 0;
+}
+
+# close brace commands, that don't set a new context (ie @caption, @footnote)
+sub _close_all_style_commands($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
+
+ while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
+ and exists
$brace_commands{$current->{'parent'}->{'cmdname'}}
+ and !exists
$context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+ $current = _close_brace_command($self, $current->{'parent'}, $line_nr,
+
$closed_command, $interrupting_command);
+ }
+ return $current;
+}
+
+# close brace commands except for @caption, @footnote then the paragraph
+sub _end_paragraph($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
+
+ $current = _close_all_style_commands($self, $current, $line_nr,
+
$closed_command, $interrupting_command);
+ if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
+ print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
+ $current = $current->{'parent'};
+ }
+ return $current;
+}
+
+# close brace commands except for @caption, @footnote then the preformatted
+sub _end_preformatted($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
+
+ $current = _close_all_style_commands($self, $current, $line_nr,
+
$closed_command, $interrupting_command);
+ if ($current->{'type'} and $preformatted_contexts{$current->{'type'}}) {
+ print STDERR "CLOSE PREFORMATTED $current->{'type'}\n" if
($self->{'DEBUG'});
+ # completly remove void preformatted contexts
+ if (address@hidden>{'contents'}}) {
+ my $removed = pop @{$current->{'parent'}->{'contents'}};
+ print STDERR "popping $removed->{'type'}\n" if ($self->{'DEBUG'});
+ }
+ $current = $current->{'parent'};
+ }
+ return $current;
+}
+
+# check that there are no text holding environment (currently
+# checking only paragraphs and preformatted) in contents
+sub _check_no_text($)
+{
+ my $current = shift;
+ my $after_paragraph = 0;
+ foreach my $content (@{$current->{'contents'}}) {
+ if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
+ $after_paragraph = 1;
+ last;
+ } elsif ($content->{'type'} and
$preformatted_contexts{$content->{'type'}}) {
+ foreach my $preformatted_content (@{$content->{'contents'}}) {
+ if ((defined($preformatted_content->{'text'})
+ and $preformatted_content->{'text'} =~ /\S/)
+ or ($preformatted_content->{'cmdname'}
+ and ($preformatted_content->{'cmdname'} ne 'c'
+ and
$preformatted_content->{'cmdname'} ne 'comment')
+ and !($preformatted_content->{'type'}
+ and
$preformatted_content->{'type'} eq 'index_entry_command'))) {
+ $after_paragraph = 1;
+ last;
+ }
+ }
+ last if ($after_paragraph);
+ }
+ }
+ return $after_paragraph;
+}
+
+# put everything after the last @item/@itemx in an item_table type container
+# and distinguish table_term and table_entry.
+sub _gather_previous_item($$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $next_command = shift;
+ my $line_nr = shift;
+
+ # nothing to do in that case.
+ if ($current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq 'before_item') {
+ if ($next_command and $next_command eq 'itemx') {
+ $self->line_warn(sprintf($self->__("address@hidden should not
begin address@hidden"),
+
$current->{'cmdname'}), $line_nr);
+ }
+ return;
+ }
+ #print STDERR "GATHER "._print_current($current)."\n";
+ my $type;
+ # if before an itemx, the type is different since there should not be
+ # real content, so it may be treated differently
+ if ($next_command and $next_command eq 'itemx') {
+ $type = 'inter_item';
+ } else {
+ $type = 'table_item';
+ }
+ my $table_gathered = {'type' => $type,
+ 'contents' => []};
+ # remove everything that is not an @item/@items or before_item to
+ # put it in the table_item, starting from the end.
+ my $contents_count = scalar(@{$current->{'contents'}});
+ for (my $i = 0; $i < $contents_count; $i++) {
+ #print STDERR "_gather_previous_item $i on $contents_count:
"._print_current($current->{'contents'}->[-1])."\n";
+ if ($current->{'contents'}->[-1]->{'cmdname'}
+ and ($current->{'contents'}->[-1]->{'cmdname'} eq 'item'
+ or ($current->{'contents'}->[-1]->{'cmdname'} eq
'itemx'))) {
+ last;
+ } else {
+ my $item_content = pop @{$current->{'contents'}};
+ $item_content->{'parent'} = $table_gathered;
+ unshift @{$table_gathered->{'contents'}}, $item_content;
+ }
+ }
+ if ($type eq 'table_item') {
+ my $table_entry = {'type' => 'table_entry',
+ 'parent' => $current,
+ 'contents' => []};
+ my $table_term = {'type' => 'table_term',
+ 'parent' => $table_entry,
+ 'contents' => []};
+ push @{$table_entry->{'contents'}}, $table_term;
+ my $contents_count = scalar(@{$current->{'contents'}});
+ for (my $i = 0; $i < $contents_count; $i++) {
+ if ($current->{'contents'}->[-1]->{'type'}
+ and ($current->{'contents'}->[-1]->{'type'} eq
'before_item'
+ or $current->{'contents'}->[-1]->{'type'} eq
'table_entry')) {
+ last;
+ } else {
+ my $item_content = pop @{$current->{'contents'}};
+ $item_content->{'parent'} = $table_term;
+ unshift @{$table_term->{'contents'}}, $item_content;
+ # debug
+ if (! (($item_content->{'cmdname'}
+ and ($item_content->{'cmdname'} eq 'itemx'
+ or $item_content->{'cmdname'} eq
'item'))
+ or ($item_content->{'type'}
+ and $item_content->{'type'} eq
'inter_item'))) {
+ $self->_bug_message("wrong element in table term",
$line_nr,
+ $item_content);
+ }
+ }
+ }
+ push @{$current->{'contents'}}, $table_entry;
+ if (scalar(@{$table_gathered->{'contents'}})) {
+ push @{$table_entry->{'contents'}}, $table_gathered;
+ $table_gathered->{'parent'} = $table_entry;
+ }
+ } else {
+ my $after_paragraph = _check_no_text($table_gathered);
+ if ($after_paragraph) {
+ $self->line_error($self->__("address@hidden must follow
address@hidden"), $line_nr);
+ }
+ if (scalar(@{$table_gathered->{'contents'}})) {
+ push @{$current->{'contents'}}, $table_gathered;
+ $table_gathered->{'parent'} = $current;
+ }
+ }
+}
+
+# Starting from the end, gather everything util the def_line to put in
+# a def_item
+sub _gather_def_item($;$)
+{
+ my $current = shift;
+ my $next_command = shift;
+ my $type;
+ # means that we are between a @def*x and a @def
+ if ($next_command) {
+ $type = 'inter_def_item';
+ } else {
+ $type = 'def_item';
+ }
+
+ # This may happen for a construct like
+ # @deffnx a b @section
+ # but otherwise the end of line will lead to the command closing
+ return if (!$current->{'cmdname'} or $current->{'cmdname'} =~ /x$/);
+ #print STDERR "_gather_def_item($type) in "._print_current($current)."\n";
+ my $def_item = {'type' => $type,
+ 'parent' => $current,
+ 'contents' => []};
+ # remove everything that is not a def_line to put it in the def_item,
+ # starting from the end.
+ my $contents_count = scalar(@{$current->{'contents'}});
+ for (my $i = 0; $i < $contents_count; $i++) {
+ #print STDERR "_gather_def_item $type ($i on $contents_count)
"._print_current($current->{'contents'}->[-1])."\n";
+ if ($current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq 'def_line') {
+ # and
!$current->{'contents'}->[-1]->{'extra'}->{'not_after_command'}) {
+ last;
+ } else {
+ my $item_content = pop @{$current->{'contents'}};
+ $item_content->{'parent'} = $def_item;
+ unshift @{$def_item->{'contents'}}, $item_content;
+ }
+ }
+ if (scalar(@{$def_item->{'contents'}})) {
+ push @{$current->{'contents'}}, $def_item;
+ }
+}
+
+# close formats
+sub _close_command_cleanup($$$) {
+ my $self = shift;
+ my $current = shift;
+
+ return unless ($current->{'cmdname'});
+ # remove the dynamic counters in multitable, they are not of use in the
final
+ # tree. Also determine the multitable_body and multitable_head with
+ # @item or @headitem rows.
+ if ($current->{'cmdname'} eq 'multitable') {
+ my $in_head_or_rows;
+ my @contents = @{$current->{'contents'}};
+ $current->{'contents'} = [];
+ foreach my $row (@contents) {
+ if ($row->{'type'} and $row->{'type'} eq 'row') {
+ delete $row->{'cells_count'};
+ if ($row->{'contents'}->[0]->{'cmdname'} eq 'headitem') {
+ if (!$in_head_or_rows) {
+ push @{$current->{'contents'}}, {'type' =>
'multitable_head',
+
'parent' => $current};
+ $in_head_or_rows = 1;
+ }
+ } elsif ($row->{'contents'}->[0]->{'cmdname'} eq 'item') {
+ if (!defined($in_head_or_rows) or $in_head_or_rows) {
+ push @{$current->{'contents'}}, {'type' =>
'multitable_body',
+
'parent' => $current};
+ $in_head_or_rows = 0;
+ }
+ }
+ push @{$current->{'contents'}->[-1]->{'contents'}}, $row;
+ $row->{'parent'} = $current->{'contents'}->[-1];
+ } else {
+ push @{$current->{'contents'}}, $row;
+ $in_head_or_rows = undef;
+ }
+ }
+ delete $current->{'rows_count'};
+ } elsif ($item_container_commands{$current->{'cmdname'}}) {
+ delete $current->{'items_count'};
+ }
+
+ # put everything after the last @def*x command in a def_item type
container.
+ if ($def_commands{$current->{'cmdname'}}) {
+ # At this point the end command hasn't been added to the command
contents.
+ # so checks cannot be done at this point.
+ _gather_def_item($current);
+ }
+
+ if ($item_line_commands{$current->{'cmdname'}}) {
+ # At this point the end command hasn't been added to the command
contents.
+ # so checks cannot be done at this point.
+ if (@{$current->{'contents'}}) {
+ $self->_gather_previous_item($current);
+ }
+ }
+
+ # put end out of before_item, and replace it at the end of the parent.
+ # remove empty before_item.
+ # warn if not empty before_item, but format is empty
+ if ($block_item_commands{$current->{'cmdname'}}) {
+ if (@{$current->{'contents'}}) {
+ my $leading_spaces = 0;
+ my $before_item;
+ if ($current->{'contents'}->[0]->{'type'}
+ and $current->{'contents'}->[0]->{'type'} eq
'empty_line_after_command'
+ and $current->{'contents'}->[1]
+ and $current->{'contents'}->[1]->{'type'}
+ and $current->{'contents'}->[1]->{'type'} eq
'before_item') {
+ $leading_spaces = 1;
+ $before_item = $current->{'contents'}->[1];
+ } elsif ($current->{'contents'}->[0]->{'type'}
+ and $current->{'contents'}->[0]->{'type'} eq
'before_item') {
+ $before_item = $current->{'contents'}->[0];
+ }
+ if ($before_item) {
+ if ($current->{'extra'}->{'end_command'}
+ and @{$before_item->{'contents'}}
+ and $before_item->{'contents'}->[-1] eq
$current->{'extra'}->{'end_command'}) {
+ my $end = pop @{$before_item->{'contents'}};
+ $end->{'parent'} = $current;
+ push @{$current->{'contents'}}, $end;
+ }
+ # remove empty before_items
+ if (address@hidden>{'contents'}}) {
+ if ($leading_spaces) {
+ my $space = shift @{$current->{'contents'}};
+ shift @{$current->{'contents'}};
+ unshift @{$current->{'contents'}}, $space;
+ } else {
+ shift @{$current->{'contents'}};
+ }
+ } else {
+ # warn if not empty before_item, but format is empty
+ my $empty_before_item = 1;
+ foreach my $before_item_content
(@{$before_item->{'contents'}}) {
+ if (!$before_item_content->{'cmdname'} or
+ ($before_item_content->{'cmdname'} ne 'c'
+ and $before_item_content->{'cmdname'} ne
'comment')) {
+ $empty_before_item = 0;
+ last;
+ }
+ }
+ if (!$empty_before_item) {
+ my $empty_format = 1;
+ foreach my $format_content (@{$current->{'contents'}})
{
+ next if ($format_content eq $before_item);
+ if (($format_content->{'cmdname'} and
+ ($format_content->{'cmdname'} ne 'c'
+ and $format_content->{'cmdname'} ne
'comment'
+ and $format_content->{'cmdname'} ne
'end'))
+ or ($format_content->{'type'} and
+ ($format_content->{'type'} ne
'empty_line_after_command'))) {
+ $empty_format = 0;
+ last;
+ }
+ }
+ if ($empty_format) {
+ $self->line_warn(sprintf($self->__("address@hidden
has text but no address@hidden"),
+
$current->{'cmdname'}), $current->{'line_nr'});
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+# close the current command, with error messages and give the parent.
+# If the last argument is given it is the command being closed if
+# hadn't there be an error, currently only block command, used for a
+# better error message.
+sub _close_current($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
+
+ if ($current->{'cmdname'}) {
+ print STDERR "CLOSING(_close_current) address@hidden>{'cmdname'}\n" if
($self->{'DEBUG'});
+ if (exists($brace_commands{$current->{'cmdname'}})) {
+ pop @{$self->{'context_stack'}}
+ if (exists $context_brace_commands{$current->{'cmdname'}});
+ $current = _close_brace_command($self, $current, $line_nr,
+
$closed_command, $interrupting_command);
+ } elsif (exists($block_commands{$current->{'cmdname'}})) {
+ if (defined($closed_command)) {
+ $self->line_error(sprintf($self->__("address@hidden' expected
`%s', but saw `%s'"),
+
$current->{'cmdname'}, $closed_command), $line_nr);
+ } elsif ($interrupting_command) {
+ $self->line_error(sprintf($self->__("address@hidden seen
before address@hidden %s"),
+
$interrupting_command, $current->{'cmdname'}),
+ $line_nr);
+ } else {
+ $self->line_error(sprintf($self->__("no matching `%cend %s'"),
+
ord('@'), $current->{'cmdname'}), $line_nr);
+ if ($block_commands{$current->{'cmdname'}} eq 'conditional') {
+ # in this case we are within an ignored conditional
+ my $conditional = pop
@{$current->{'parent'}->{'contents'}};
+ }
+ }
+ if ($preformatted_commands{$current->{'cmdname'}}
+ or $menu_commands{$current->{'cmdname'}}
+ or $format_raw_commands{$current->{'cmdname'}}) {
+ my $context = pop @{$self->{'context_stack'}};
+ pop @{$self->{'expanded_formats_stack'}}
+ if ($format_raw_commands{$current->{'cmdname'}});
+ }
+ pop @{$self->{'regions_stack'}}
+ if ($region_commands{$current->{'cmdname'}});
+ $current = $current->{'parent'};
+ } else {
+ # There @item and @tab commands are closed, and also line commands
+ # with invalid content
+ $current = $current->{'parent'};
+ }
+ } elsif ($current->{'type'}) {
+ print STDERR "CLOSING type $current->{'type'}\n" if ($self->{'DEBUG'});
+ if ($current->{'type'} eq 'bracketed') {
+ $self->_command_error($current, $line_nr,
+ $self->__("misplaced
%c"), ord('{'));
+ } elsif ($current->{'type'} eq 'menu_comment'
+ or $current->{'type'} eq 'menu_entry_description') {
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'preformatted') {
+ $self->_bug_message("context $context instead of
preformatted",
+ $line_nr, $current);
+ }
+ # close empty menu_comment
+ if (address@hidden>{'contents'}}) {
+ pop @{$current->{'parent'}->{'contents'}};
+ }
+ } elsif ($current->{'type'} eq 'misc_line_arg'
+ or $current->{'type'} eq 'block_line_arg') {
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'line' and $context ne 'def') {
+ $self->_bug_message("context $context instead of line or def",
+ $line_nr, $current);
+ die;
+ }
+ }
+ $current = $current->{'parent'};
+ } else { # Should never go here.
+ $current = $current->{'parent'} if ($current->{'parent'});
+ $self->_bug_message("No type nor cmdname when closing",
+ $line_nr, $current);
+ }
+ return $current;
+}
+
+# a closed_command arg means closing until that command is found.
+# no command arg means closing until the root or a root_command
+# is found.
+sub _close_commands($$$;$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;;
+
+ $current = _end_paragraph($self, $current, $line_nr, $closed_command,
+ $interrupting_command);
+ $current = _end_preformatted($self, $current, $line_nr, $closed_command,
+
$interrupting_command);
+
+ # stop if the command is found
+ while (!($closed_command and $current->{'cmdname'}
+ and $current->{'cmdname'} eq $closed_command)
+ # stop if at the root
+ and $current->{'parent'}
+ # stop if in a root command
+ # or in a context_brace_commands and searching for a specific
+ # end block command (with $closed_command set).
+ # This second condition means that a footnote is not closed when
+ # looking for the end of a block command, but is closed when
+ # completly closing the stack.
+ and !($current->{'cmdname'}
+ and ($root_commands{$current->{'cmdname'}}
+ or ($closed_command and
$current->{'parent'}->{'cmdname'}
+ and
$context_brace_commands{$current->{'parent'}->{'cmdname'}})))){
+ $self->_close_command_cleanup($current);
+ $current = $self->_close_current($current, $line_nr, $closed_command,
+
$interrupting_command);
+ }
+
+ my $closed_element;
+ if ($closed_command and $current->{'cmdname'}
+ and $current->{'cmdname'} eq $closed_command) {
+ if ($preformatted_commands{$current->{'cmdname'}}) {
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'preformatted') {
+ $self->_bug_message("context $context instead of preformatted
for $closed_command",
+ $line_nr, $current);
+ }
+ } elsif ($format_raw_commands{$current->{'cmdname'}}) {
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'rawpreformatted') {
+ $self->_bug_message("context $context instead of
rawpreformatted for $closed_command",
+ $line_nr, $current);
+ }
+ pop @{$self->{'expanded_formats_stack'}};
+ } elsif ($menu_commands{$current->{'cmdname'}}) {
+ my $context = pop @{$self->{'context_stack'}};
+ # may be in menu, but context is preformatted if in a preformatted
too.
+ if ($context ne 'menu' and $context ne 'preformatted') {
+ $self->_bug_message("context $context instead of preformatted
or menu for $closed_command",
+ $line_nr, $current);
+ }
+ }
+ #print STDERR "close context $context for $current->{'cmdname'}\n"
+ # if ($self->{'DEBUG'});
+ pop @{$self->{'regions_stack'}}
+ if ($region_commands{$current->{'cmdname'}});
+ $closed_element = $current;
+ #$self->_close_command_cleanup($current);
+ $current = $current->{'parent'};
+ } elsif ($closed_command) {
+ $self->line_error(sprintf($self->__("unmatched `%c%s'"),
+ ord('@'), "end
$closed_command"), $line_nr);
+ }
+ return ($closed_element, $current);
+}
+
+# begin paragraph if needed. If not try to merge with the previous
+# content if it is also some text.
+sub _merge_text($$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $text = shift;
+
+ my $paragraph;
+
+ my $no_merge_with_following_text = 0;
+ if ($text =~ /\S/) {
+ my $leading_spaces;
+ if ($text =~ /^(\s+)/) {
+ $leading_spaces = $1;
+ }
+ if ($current->{'contents'} and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and ($current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_before_argument'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_after_close_brace')) {
+ $no_merge_with_following_text = 1;
+ }
+ if (_abort_empty_line($self, $current, $leading_spaces)) {
+ $text =~ s/^(\s+)//;
+ }
+
+ $paragraph = _begin_paragraph($self, $current);
+ $current = $paragraph if ($paragraph);
+ }
+
+ if (!defined($current->{'contents'})) {
+ $self->_bug_message("No contents in _merge_text",
+ undef, $current);
+ die;
+ }
+
+ if (@{$current->{'contents'}}
+ and exists($current->{'contents'}->[-1]->{'text'})
+ and $current->{'contents'}->[-1]->{'text'} !~ /\n/
+ and !$no_merge_with_following_text) {
+ $current->{'contents'}->[-1]->{'text'} .= $text;
+ print STDERR "MERGED TEXT: $text|||\n" if ($self->{'DEBUG'});
+ } else {
+ push @{$current->{'contents'}}, { 'text' => $text, 'parent' =>
$current };
+ print STDERR "NEW TEXT: $text|||\n" if ($self->{'DEBUG'});
+ }
+ return $current;
+}
+
+# return the parent if in a item_container command, itemize or enumerate
+sub _item_container_parent($)
+{
+ my $current = shift;
+ if ((($current->{'cmdname'} and $current->{'cmdname'} eq 'item')
+ or ($current->{'type'} and $current->{'type'} eq 'before_item'))
+ and ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
+ and
$item_container_commands{$current->{'parent'}->{'cmdname'}})) {
+ return ($current->{'parent'});
+ }
+ return undef;
+}
+
+# return the parent if in a item_line command, @*table
+sub _item_line_parent($)
+{
+ my $current = shift;
+ if ($current->{'cmdname'} and ($current->{'cmdname'} eq 'item'
+ or $current->{'cmdname'} eq 'itemx')) {
+ $current = $current->{'parent'}->{'parent'};
+ } elsif ($current->{'type'} and $current->{'type'} eq 'before_item'
+ and $current->{'parent'}) {
+ $current = $current->{'parent'};
+ }
+ return $current if ($current->{'cmdname'}
+ and
$item_line_commands{$current->{'cmdname'}});
+ return undef;
+}
+
+# return the parent if in a multitable
+sub _item_multitable_parent($)
+{
+ my $current = shift;
+ if (($current->{'cmdname'} and ($current->{'cmdname'} eq 'headitem'
+ or $current->{'cmdname'} eq 'item' or $current->{'cmdname'} eq
'tab'))
+ and $current->{'parent'} and $current->{'parent'}->{'parent'}) {
+ $current = $current->{'parent'}->{'parent'};
+ } elsif ($current->{'type'} and $current->{'type'} eq 'before_item'
+ and $current->{'parent'}) {
+ $current = $current->{'parent'};
+ }
+ return $current if ($current->{'cmdname'}
+ and $current->{'cmdname'} eq
'multitable');
+ return undef;
+}
+
+# returns next text fragment, be it pending from a macro expansion or
+# text or file
+sub _next_text($$$)
+{
+ my $self = shift;
+ my $line_nr = shift;
+ my $current = shift;
+
+ while (@{$self->{'input'}}) {
+ my $input = $self->{'input'}->[0];
+ if (@{$input->{'pending'}}) {
+ my $new_text = shift @{$input->{'pending'}};
+ if ($new_text->[1] and $new_text->[1]->{'end_macro'}) {
+ delete $new_text->[1]->{'end_macro'};
+ my $top_macro = shift @{$self->{'macro_stack'}};
+ print STDERR "SHIFT MACRO_STACK(@{$self->{'macro_stack'}}):
$top_macro->{'args'}->[0]->{'text'}\n"
+ if ($self->{'DEBUG'});
+ }
+ return ($new_text->[0], $new_text->[1]);
+ } elsif ($input->{'fh'}) {
+ my $fh = $input->{'fh'};
+ my $line = <$fh>;
+ while (defined($line)) {
+ # add an end of line if there is none at the end of file
+ if (eof($fh) and $line !~ /\n/) {
+ $line .= "\n";
+ }
+ $line =~ s/\x{7F}.*\s*//;
+ if ($self->{'CPP_LINE_DIRECTIVES'}
+ # no cpp directives in ignored/macro/verbatim
+ and defined ($current)
+ and not
+ (($current->{'cmdname'}
+ and $block_commands{$current->{'cmdname'}}
+ and ($block_commands{$current->{'cmdname'}} eq
'raw'
+ or
$block_commands{$current->{'cmdname'}} eq 'conditional'))
+ or
+ ($current->{'parent'} and
$current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq 'verb')
+ )
+ and $line =~ /^\s*#\s*(line)? (\d+)((
"([^"]+)")(\s+\d+)*)?\s*$/) {
+ $input->{'line_nr'} = $2;
+ if (defined($5)) {
+ $input->{'name'} = $5;
+ }
+ $line = <$fh>;
+ } else {
+ $input->{'line_nr'}++;
+ return ($line, {'line_nr' => $input->{'line_nr'},
+ 'file_name' =>
$input->{'name'},
+ 'macro' => ''});
+ }
+ }
+ }
+ my $previous_input = shift(@{$self->{'input'}});
+ # Don't close STDIN
+ if ($previous_input->{'fh'} and $previous_input->{'name'} ne '-') {
+ if (!close($previous_input->{'fh'})) {
+ $self->document_warn(sprintf($self->__("error on closing %s:
%s"),
+
$previous_input->{'name'}, $!));
+
+ }
+ }
+ }
+
+ return (undef, $line_nr);
+}
+
+# collect text and line numbers until an end of line is found.
+sub _new_line($$$)
+{
+ my $self = shift;
+ my $line_nr = shift;
+ my $current = shift;
+ my $new_line = '';
+
+ while (1) {
+ my $new_text;
+ ($new_text, $line_nr) = _next_text($self, $line_nr, $current);
+ if (!defined($new_text)) {
+ $new_line = undef if ($new_line eq '');
+ last;
+ }
+
+ $new_line .= $new_text;
+
+ my $chomped_text = $new_text;
+ last if chomp($chomped_text);
+ }
+ return ($new_line, $line_nr);
+}
+
+sub _expand_macro_arguments($$$$)
+{
+ my $self = shift;
+ my $macro = shift;
+ my $line = shift;
+ my $line_nr = shift;
+ my $braces_level = 1;
+ my $arguments = [ '' ];
+ my $arg_nr = 0;
+ my $args_total = scalar(@{$macro->{'args'}}) -1;
+ my $name = $macro->{'args'}->[0]->{'text'};
+
+ my $line_nr_orig = $line_nr;
+
+ while (1) {
+ if ($line =~ s/([^\\{},]*)([\\{},])//) {
+ my $separator = $2;
+ $arguments->[-1] .= $1;
+ if ($separator eq '\\') {
+ if ($line =~ s/^(.)//) {
+ my $protected_char = $1;
+ if ($protected_char !~ /[\\{},]/) {
+ $arguments->[-1] .= '\\';
+ }
+ $arguments->[-1] .= $protected_char;
+
+ print STDERR "MACRO ARG: $separator: $protected_char\n" if
($self->{'DEBUG'});
+ } else {
+ $arguments->[-1] .= '\\';
+ print STDERR "MACRO ARG: $separator\n" if
($self->{'DEBUG'});
+ }
+ } elsif ($separator eq ',') {
+ if ($braces_level == 1) {
+ if (scalar(@$arguments) < $args_total) {
+ push @$arguments, '';
+ $line =~ s/^[^\S\f]*//;
+ print STDERR "MACRO NEW ARG\n" if ($self->{'DEBUG'});
+ } else {
+ # implicit quoting when there is one argument.
+ if ($args_total != 1) {
+ $self->line_error(sprintf($self->__(
+
"macro `%s' called with too many args"),
+
$name), $line_nr);
+ }
+ $arguments->[-1] .= ',';
+ }
+ } else {
+ $arguments->[-1] .= ',';
+ }
+ } elsif ($separator eq '}') {
+ $braces_level--;
+ last if ($braces_level == 0);
+ $arguments->[-1] .= $separator;
+ } elsif ($separator eq '{') {
+ $braces_level++;
+ $arguments->[-1] .= $separator;
+ }
+ } else {
+ print STDERR "MACRO ARG end of line\n" if ($self->{'DEBUG'});
+ $arguments->[-1] .= $line;
+
+ ($line, $line_nr) = _new_line($self, $line_nr, $macro);
+ if (!defined($line)) {
+ $self->line_error(sprintf($self->__("address@hidden missing
close brace"),
+ $name), $line_nr_orig);
+ return ($arguments, "\n", $line_nr);
+ }
+ }
+ }
+ if ($args_total == 0 and $arguments->[0] =~ /[\S\f]/) {
+ $self->line_error(sprintf($self->__(
+ "macro `%s' declared without argument called
with an argument"),
+ $name),
$line_nr);
+ }
+ print STDERR "END MACRO ARGS EXPANSION(".scalar(@$arguments)."): ".
+ join("|\n", @$arguments) ."|\n" if
($self->{'DEBUG'});
+ return ($arguments, $line, $line_nr);
+}
+
+sub _expand_macro_body($$$$) {
+ my $self = shift;
+ my $macro = shift;
+ my $args = shift;
+ my $line_nr = shift;
+
+ my $macrobody = $macro->{'extra'}->{'macrobody'};
+ my $args_total = scalar(@{$macro->{'args'}}) -1;
+ my $args_index = $macro->{'extra'}->{'args_index'};
+
+ my $i;
+ for ($i=0; $i<=$args_total; $i++) {
+ $args->[$i] = "" unless (defined($args->[$i]));
+ }
+
+ my $result = '';
+ while ($macrobody ne '') {
+ if ($macrobody =~ s/^([^\\]*)\\//o) {
+ $result .= $1;
+ if ($macrobody =~ s/^\\//) {
+ $result .= '\\';
+ } elsif ($macrobody =~ s/^([^\\]*)\\//) {
+ my $arg = $1;
+ if (defined($args_index->{$arg})) {
+ $result .= $args->[$args_index->{$arg}];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "\\ in address@hidden expansion followed `%s' instead of
parameter name or \\"),
+
$macro->{'args'}->[0]->{'text'}, $arg), $line_nr);
+ $result .= '\\' . $arg;
+ }
+ }
+ next;
+ }
+ $result .= $macrobody;
+ last;
+ }
+ return $result;
+}
+
+# each time a new line appeared, a container is opened to hold the text
+# consisting only of spaces. This container is removed here, typically
+# this is called when non-space happens on a line.
+sub _abort_empty_line($$;$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $additional_text = shift;
+ $additional_text = '' if (!defined($additional_text));
+ if ($current->{'contents'} and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_before_argument'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_after_close_brace')) {
+ print STDERR "ABORT EMPTY additional text |$additional_text|, current
|$current->{'contents'}->[-1]->{'text'}|\n" if ($self->{'DEBUG'});
+ $current->{'contents'}->[-1]->{'text'} .= $additional_text;
+ # remove empty 'empty*before'.
+ if ($current->{'contents'}->[-1]->{'text'} eq '') {
+ # as we remove 'empty_spaces_before_argument',
'spaces_before_argument'
+ # is removed from 'extra' too.
+ if ($current->{'extra'}
+ and $current->{'extra'}->{'spaces_before_argument'}
+ and $current->{'extra'}->{'spaces_before_argument'}
+ eq $current->{'contents'}->[-1]) {
+ delete ($current->{'extra'}->{'spaces_before_argument'});
+ delete ($current->{'extra'}) if
!(keys(%{$current->{'extra'}}));
+ }
+ pop @{$current->{'contents'}}
+ } elsif ($current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
+ # exactly the same condition than to begin a paragraph
+ if ((!$current->{'type'} or
$type_with_paragraph{$current->{'type'}})
+ and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]})
{
+ $current->{'contents'}->[-1]->{'type'} =
'empty_spaces_before_paragraph';
+ } else {
+ delete $current->{'contents'}->[-1]->{'type'};
+ }
+ } elsif ($current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command') {
+ $current->{'contents'}->[-1]->{'type'} =
'empty_spaces_after_command';
+ }
+ return 1;
+ }
+ return 0;
+}
+
+# isolate last space in a command to help expansion disregard unuseful spaces.
+sub _isolate_last_space($$;$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $type = shift;
+ $type = 'spaces_at_end' if (!defined($type));
+ if ($current->{'contents'} and @{$current->{'contents'}}) {
+ my $index = -1;
+ # we ignore space before a misc command that is last on line.
+ # This is primarily to tag spaces before comments, but this will
+ # also tag and, in most converter lead to removal of spaces
+ # before any misc command, which is not really problematic as
+ # in most cases, if it is not a comment, we are in an invalid
+ # nesting of misc command on another @-command line.
+ $index = -2
+ if (scalar(@{$current->{'contents'}}) > 1
+ and $current->{'contents'}->[-1]->{'cmdname'}
+ and
$self->{'misc_commands'}->{$current->{'contents'}->[-1]->{'cmdname'}});
+ if (defined($current->{'contents'}->[$index]->{'text'})
+ and !$current->{'contents'}->[$index]->{'type'}
+ and $current->{'contents'}->[$index]->{'text'} =~ /\s+$/) {
+ if ($current->{'contents'}->[$index]->{'text'} !~ /\S/) {
+ $current->{'contents'}->[$index]->{'type'} = $type;
+ } else {
+ $current->{'contents'}->[$index]->{'text'} =~ s/(\s+)$//;
+ my $spaces = $1;
+ my $new_spaces = { 'text' => $spaces, 'parent' => $current,
+ 'type' => $type };
+ if ($index == -1) {
+ push @{$current->{'contents'}}, $new_spaces;
+ } else {
+ splice (@{$current->{'contents'}}, $index+1, 0,
$new_spaces);
+ }
+ }
+ }
+ }
+}
+
+# used to put a node name in error messages.
+sub _node_extra_to_texi($)
+{
+ my $node = shift;
+ my $result = '';
+ if ($node->{'manual_content'}) {
+ $result = '('.Texinfo::Convert::Texinfo::convert({'contents'
+ =>
$node->{'manual_content'}}) .')';
+ }
+ if ($node->{'node_content'}) {
+ $result .= Texinfo::Convert::Texinfo::convert ({'contents'
+
=> $node->{'node_content'}});
+ }
+ return $result;
+}
+
+sub _find_end_brace($$)
+{
+ my $text = shift;
+ my $braces_count = shift;
+
+ my $before = '';
+ while ($braces_count > 0 and length($text)) {
+ if ($text =~ s/([^()]*)([()])//) {
+ $before .= $1.$2;
+ my $brace = $2;
+ if ($brace eq '(') {
+ $braces_count++;
+ } else {
+ $braces_count--;
+ if ($braces_count == 0) {
+ return ($before, $text, 0);
+ }
+ }
+ } else {
+ $before .= $text;
+ $text = '';
+ }
+ }
+ return ($before, undef, $braces_count);
+}
+
+# This only counts opening braces, and returns 0 once all the parentheses
+# are closed
+sub _count_opened_tree_braces($$);
+sub _count_opened_tree_braces($$)
+{
+ my $current = shift;
+ my $braces_count = shift;
+ if (defined($current->{'text'})) {
+ my ($before, $after);
+ ($before, $after, $braces_count) = _find_end_brace($current->{'text'},
+
$braces_count);
+ }
+ if ($current->{'args'}) {
+ foreach my $arg (@{$current->{'args'}}) {
+ $braces_count = _count_opened_tree_braces($arg, $braces_count);
+ return $braces_count if ($braces_count == 0);
+ }
+ }
+ if ($current->{'contents'}) {
+ foreach my $content (@{$current->{'contents'}}) {
+ $braces_count = _count_opened_tree_braces($content, $braces_count);
+ return $braces_count if ($braces_count == 0);
+ }
+ }
+ return $braces_count;
+}
+
+# retrieve a leading manual name in parentheses, if there is one.
+sub _parse_node_manual($)
+{
+ my $node = shift;
+ my @contents = @{$node->{'contents'}};
+ _trim_spaces_comment_from_content(address@hidden);
+
+ my $manual;
+ my $result;
+#print STDERR "RRR $contents[0] and $contents[0]->{'text'} \n";
+ if ($contents[0] and $contents[0]->{'text'} and $contents[0]->{'text'} =~
/^\(/) {
+ my $braces_count = 1;
+ if ($contents[0]->{'text'} !~ /^\($/) {
+ my $brace = shift @contents;
+ my $brace_text = $brace->{'text'};
+ $brace_text =~ s/^\(//;
+ unshift @contents, { 'text' => $brace_text, 'type' =>
$brace->{'type'},
+ 'parent' =>
$brace->{'parent'} } if $brace_text ne '';
+ } else {
+ shift @contents;
+ }
+ while(@contents) {
+ my $content = shift @contents;
+ if (!defined($content->{'text'}) or $content->{'text'} !~ /\)/) {
+ push @$manual, $content;
+ $braces_count = _count_opened_tree_braces($content,
$braces_count);
+ # This is an error, braces were closed in a command
+ if ($braces_count == 0) {
+ last;
+ }
+ } else {
+ my ($before, $after);
+ ($before, $after, $braces_count) =
_find_end_brace($content->{'text'},
+
$braces_count);
+ if ($braces_count == 0) {
+ $before =~ s/\)$//;
+ push @$manual, { 'text' => $before, 'parent' =>
$content->{'parent'} }
+ if ($before ne '');
+ $after =~ s/^\s*//;
+ unshift @contents, { 'text' => $after, 'parent' =>
$content->{'parent'} }
+ if ($after ne '');
+ last;
+ } else {
+ push @$manual, $content;
+ }
+ }
+ }
+ $result->{'manual_content'} = $manual if (defined($manual));
+ }
+ if (@contents) {
+ $result->{'node_content'} = address@hidden;
+ $result->{'normalized'} =
+
Texinfo::Convert::NodeNameNormalization::normalize_node({'contents' =>
address@hidden);
+ }
+ return $result;
+}
+
+sub _parse_float_type($)
+{
+ my $current = shift;
+ if (@{$current->{'args'}}) {
+ my @type_contents = @{$current->{'args'}->[0]->{'contents'}};
+ _trim_spaces_comment_from_content(address@hidden);
+ if (@type_contents) {
+ my $normalized
+ = Texinfo::Convert::NodeNameNormalization::normalize_node(
+
{'contents' => address@hidden);
+ $current->{'extra'}->{'type'}->{'content'} = address@hidden;
+ if ($normalized =~ /[^-]/) {
+ $current->{'extra'}->{'type'}->{'normalized'} = $normalized;
+ return 1;
+ }
+ }
+ }
+ $current->{'extra'}->{'type'}->{'normalized'} = '';
+ return 0;
+}
+
+# used for definition line parsing
+sub _next_bracketed_or_word($$)
+{
+ my $self = shift;
+ my $contents = shift;
+ return undef if (!scalar(@{$contents}));
+ my $spaces;
+ $spaces = shift @{$contents} if (defined($contents->[0]->{'text'}) and
+
$contents->[0]->{'text'} !~ /\S/);
+ if (defined($spaces)) {
+ $spaces->{'type'} = 'spaces';
+ chomp $spaces->{'text'};
+ $spaces = undef if ($spaces->{'text'} eq '');
+ }
+ return ($spaces, undef) if (!scalar(@{$contents}));
+
+ #print STDERR "BEFORE PROCESSING
".Texinfo::Convert::Texinfo::convert({'contents' => $contents});
+ if ($contents->[0]->{'type'} and $contents->[0]->{'type'} eq 'bracketed') {
+ #print STDERR "Return bracketed\n";
+ my $bracketed = shift @{$contents};
+ $self->_isolate_last_space($bracketed,
'empty_space_at_end_def_bracketed');
+ my $bracketed_def_content = { 'contents' => $bracketed->{'contents'},
+ 'parent'
=> $bracketed->{'parent'},
+ 'type' =>
'bracketed_def_content', };
+ if ($bracketed->{'extra'} and
$bracketed->{'extra'}->{'spaces_before_argument'}) {
+ $bracketed_def_content->{'extra'}->{'spaces_before_argument'}
+ = $bracketed->{'extra'}->{'spaces_before_argument'};
+ }
+ return ($spaces, $bracketed_def_content);
+ } elsif ($contents->[0]->{'cmdname'}) {
+ #print STDERR "Return command $contents->[0]->{'cmdname'}\n";
+ return ($spaces, shift @{$contents});
+ } else {
+ #print STDERR "Process $contents->[0]->{'text'}\n";
+ $contents->[0]->{'text'} =~ s/^(\s*)//;
+ my $space_text = $1;
+ $spaces = {'text' => $space_text, 'type' => 'spaces'} if ($space_text);
+ $contents->[0]->{'text'} =~ s/^(\S+)//;
+ shift @{$contents} if ($contents->[0]->{'text'} eq '');
+ return ($spaces, {'text' => $1});
+ }
+}
+
+# definition line parsing
+sub _parse_def($$$)
+{
+ my $self = shift;
+ my $command = shift;
+ my $contents = shift;
+
+ my @contents = @$contents;
+ shift @contents if ($contents[0] and $contents[0]->{'type'}
+ and $contents[0]->{'type'} eq
'empty_spaces_after_command');
+ if ($def_aliases{$command}) {
+ my $real_command = $def_aliases{$command};
+ my $prepended = $def_map{$command}->{$real_command};
+ my @prepended_content;
+
+ my $text;
+ my $in_bracketed;
+ if ($prepended =~ /^\{/) {
+ $text = $prepended;
+ $text =~ s/\{([^\}]+)\}/$1/;
+ $in_bracketed = 1;
+ } else {
+ $text = $prepended;
+ }
+ my $tree = $self->gdt($text);
+ if ($in_bracketed or @{$tree->{'contents'}} > 1) {
+ my $bracketed = { 'type' => 'bracketed' };
+ $bracketed->{'contents'} = $tree->{'contents'};
+ foreach my $content (@{$tree->{'contents'}}) {
+ $content->{'parent'} = $bracketed;
+ }
+ @prepended_content = ($bracketed);
+ } else {
+ @prepended_content = (@{$tree->{'contents'}});
+ }
+ push @prepended_content, { 'text' => ' ' };
+
+ unshift @contents, @prepended_content;
+
+ $command = $def_aliases{$command};
+ }
+ foreach (my $i = 0; $i < scalar(@contents); $i++) {
+ # copy, to avoid changing the original
+ $contents[$i] = {'text' => $contents[$i]->{'text'}}
+ if (defined($contents[$i]->{'text'}));
+ }
+ my @result;
+ my @args = @{$def_map{$command}};
+ my $arg_type;
+ # Even when $arg_type is not set, that is for def* that is not documented
+ # to take args, everything is as is arg_type was set to arg.
+ $arg_type = pop @args if ($args[-1] eq 'arg' or $args[-1] eq 'argtype');
+ foreach my $arg (@args) {
+ #print STDERR "$command $arg"._print_current($contents[0]);
+ #foreach my $content (@contents) {print STDERR "
"._print_current($content)};
+ #print STDERR " contents ->".Texinfo::Convert::Texinfo::convert
({'contents' => address@hidden);
+ my ($spaces, $next) = $self->_next_bracketed_or_word(address@hidden);
+ last if (!defined($next));
+ #print STDERR "NEXT[$arg]
".Texinfo::Convert::Texinfo::convert($next)."\n";
+ push @result, ['spaces', $spaces] if (defined($spaces));
+ push @result, [$arg, $next];
+ }
+
+ my @args_results;
+ while (@contents) {
+ my ($spaces, $next) = $self->_next_bracketed_or_word(address@hidden);
+ push @args_results, ['spaces', $spaces] if (defined($spaces));
+ last if (!defined($next));
+ if (defined($next->{'text'})) {
+ while (1) {
+ if ($next->{'text'} =~ s/^([^\[\](),]+)//) {
+ push @args_results, ['arg', {'text' => $1}];
+ } elsif ($next->{'text'} =~ s/^([\[\](),])//) {
+ push @args_results, ['delimiter',
+ {'text' => $1, 'type' =>
'delimiter'}];
+ } else {
+ last;
+ }
+ }
+ } else {
+ push @args_results, [ 'arg', $next ];
+ }
+ }
+ if ($arg_type and $arg_type eq 'argtype') {
+ my $next_is_type = 1;
+ foreach my $arg(@args_results) {
+ if ($arg->[0] eq 'spaces') {
+ } elsif ($arg->[0] eq 'delimiter') {
+ $next_is_type = 1;
+ } elsif ($arg->[1]->{'cmdname'} and $arg->[1]->{'cmdname'} ne
'code') {
+ $next_is_type = 1;
+ } elsif ($next_is_type) {
+ $arg->[0] = 'typearg';
+ $next_is_type = 0;
+ } else {
+ $next_is_type = 1;
+ }
+ }
+ }
+ return address@hidden, @args_results];
+}
+
+# register a label, that is something that may be the target of a reference
+# and must be unique in the document. Corresponds with @node, @anchor and
+# @float second arg.
+sub _register_label($$$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $label = shift;
+ my $line_nr = shift;
+ my $normalized = $label->{'normalized'};
+ if (_ignore_global_commands($self)) {
+ $current->{'extra'}->{'normalized'} = $normalized;
+ $current->{'extra'}->{'node_content'} = $label->{'node_content'};
+ return 0;
+ } elsif ($self->{'labels'}->{$normalized}) {
+ $self->line_error(sprintf($self->__("address@hidden `%s' previously
defined"),
+ $current->{'cmdname'},
+
Texinfo::Convert::Texinfo::convert({'contents' =>
+
$label->{'node_content'}})),
+ $line_nr);
+ $self->line_error(sprintf($self->__("here is the previous definition
as address@hidden"),
+
$self->{'labels'}->{$normalized}->{'cmdname'}),
+
$self->{'labels'}->{$normalized}->{'line_nr'}, 1);
+ return 0;
+ } else {
+ $current->{'extra'}->{'normalized'} = $normalized;
+ $current->{'extra'}->{'node_content'} = $label->{'node_content'};
+ $self->{'labels'}->{$normalized} = $current;
+ return 1;
+ }
+}
+
+sub _non_bracketed_contents($)
+{
+ my $current = shift;
+ if ($current->{'type'} and $current->{'type'} eq 'bracketed') {
+ my $new = {};
+ $new->{'contents'} = $current->{'contents'} if ($current->{'parent'});
+ $new->{'parent'} = $current->{'parent'} if ($current->{'parent'});
+ return $new;
+ } else {
+ return $current;
+ }
+}
+
+# store an index entry.
+# $current is the command element.
+# $content holds the actual content.
+# for index entries and v|ftable items, it is the index entry content,
+# for def, it is the parsed arguments, based on the definition line
+# arguments.
+sub _enter_index_entry($$$$$$$)
+{
+ my $self = shift;
+ my $command_container = shift;
+ my $command = shift;
+ my $current = shift;
+ my $content = shift;
+ my $content_normalized = shift;
+ my $line_nr = shift;
+
+ $content_normalized = $content if (!defined($content_normalized));
+
+ my $prefix = $self->{'command_index_prefix'}->{$command_container};
+ my $index_name = $self->{'prefix_to_index_name'}->{$prefix};
+ my $index = $self->{'index_names'}->{$index_name};
+
+ my $number;
+ unless (_ignore_global_commands($self)) {
+ $number = (defined($index->{'index_entries'})
+ ? (scalar(@{$index->{'index_entries'}}) + 1)
+ : 1);
+ }
+ my $index_entry = { 'index_name' => $index_name,
+ 'index_at_command' => $command,
+ 'index_type_command' =>
$command_container,
+ 'index_prefix' => $prefix,
+ 'content' => $content,
+ 'content_normalized' =>
$content_normalized,
+ 'command' => $current,
+ 'number' => $number,
+ };
+ if (@{$self->{'regions_stack'}}) {
+ $index_entry->{'region'} = $self->{'regions_stack'}->[-1];
+ } elsif ($self->{'current_node'}) {
+ $index_entry->{'node'} = $self->{'current_node'};
+ } elsif (!$self->{'current_section'}) {
+ $self->line_warn(sprintf($self->__("entry for index `%s' outside of
any node"),
+ $index_name),
$line_nr);
+ }
+ #print STDERR "INDEX ENTRY address@hidden>{'cmdname'}
$index_name($number)\n";
+ unless (_ignore_global_commands($self)) {
+ push @{$index->{'index_entries'}}, $index_entry;
+ }
+ $current->{'extra'}->{'index_entry'} = $index_entry;
+}
+
+# This is always called at command closing.
+sub _remove_empty_content_arguments($)
+{
+ my $current = shift;
+ my $type;
+ if ($current->{'extra'}) {
+ if ($current->{'extra'}->{'block_command_line_contents'}) {
+ $type = 'block_command_line_contents';
+ } elsif ($current->{'extra'}->{'brace_command_contents'}) {
+ $type = 'brace_command_contents';
+ }
+ }
+ if ($type) {
+ while (@{$current->{'extra'}->{$type}}
+ and not defined($current->{'extra'}->{$type}->[-1])) {
+ pop @{$current->{'extra'}->{$type}};
+ }
+ delete $current->{'extra'}->{$type} if
(address@hidden>{'extra'}->{$type}});
+ delete $current->{'extra'} if (!keys(%{$current->{'extra'}}));
+ }
+}
+
+sub _strip_macrobody_leading_space($$)
+{
+ my $self = shift;
+ my $text = shift;
+ if ($self->{'MACRO_BODY_IGNORES_LEADING_SPACE'}) {
+ $text =~ s/^\s*//mg;
+ }
+ return $text;
+}
+
+# close constructs and do stuff at end of line (or end of the document)
+sub _end_line($$$);
+sub _end_line($$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+
+ my $current_old = $current;
+
+ my $included_file = 0;
+
+ # a line consisting only of spaces.
+ if ($current->{'contents'} and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
+ print STDERR "END EMPTY LINE\n" if ($self->{'DEBUG'});
+ if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
+ my $empty_line = pop @{$current->{'contents'}};
+ $current = _end_paragraph($self, $current, $line_nr);
+ push @{$current->{'contents'}}, $empty_line;
+ $empty_line->{'parent'} = $current;
+ } elsif ($current->{'type'}
+ and $current->{'type'} eq 'preformatted'
+ and $current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq
'menu_entry_description') {
+ my $empty_line = pop @{$current->{'contents'}};
+ if ($current->{'type'} eq 'preformatted') {
+ my $empty_preformatted = (address@hidden>{'contents'}});
+ $current = $current->{'parent'};
+ pop @{$current->{'contents'}} if ($empty_preformatted);
+ }
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'preformatted') {
+ $self->_bug_message("context $context instead of preformatted
in empty line after menu_entry_description",
+ $line_nr, $current);
+ }
+
+ # first parent is menu_entry
+ $current = $current->{'parent'}->{'parent'};
+
+ push @{$current->{'contents'}}, { 'type' => 'menu_comment',
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ push @{$current->{'contents'}}, { 'type' => 'preformatted',
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ push @{$current->{'contents'}}, { 'type' =>
'after_description_line',
+
'text' => $empty_line->{'text'},
+
'parent' => $current };
+ push @{$self->{'context_stack'}}, 'preformatted';
+ print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if
($self->{'DEBUG'});
+ } elsif (!$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
+ $current = _end_paragraph($self, $current, $line_nr);
+ }
+
+ # end of a menu line.
+ } elsif ($current->{'type'}
+ and ($current->{'type'} eq 'menu_entry_name'
+ or $current->{'type'} eq 'menu_entry_node')) {
+ my $empty_menu_entry_node = 0;
+ my $end_comment;
+ if ($current->{'type'} eq 'menu_entry_node') {
+ if (@{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'cmdname'}
+ and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
+ or $current->{'contents'}->[-1]->{'cmdname'} eq
'comment')) {
+ $end_comment = pop @{$current->{'contents'}};
+ }
+ if (address@hidden>{'contents'}}
+ # empty if only the end of line or spaces
+ or (@{$current->{'contents'}} == 1
+ and
defined($current->{'contents'}->[-1]->{'text'})
+ and $current->{'contents'}->[-1]->{'text'} !~
/\S/)) {
+ $empty_menu_entry_node = 1;
+ push @{$current->{'contents'}}, $end_comment if ($end_comment);
+ }
+ }
+ # we abort the menu entry if there is no node name
+ if ($empty_menu_entry_node
+ or $current->{'type'} eq 'menu_entry_name') {
+ my $description_or_menu_comment;
+ print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'DEBUG'});
+ my $menu = $current->{'parent'}->{'parent'};
+ my $menu_entry = pop @{$menu->{'contents'}};
+ if (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
+ and $menu->{'contents'}->[-1]->{'type'} eq 'menu_entry') {
+ my $entry = $menu->{'contents'}->[-1];
+ my $description;
+ foreach my $entry_element (reverse(@{$entry->{'args'}})) {
+ if ($entry_element->{'type'} eq 'menu_entry_description') {
+ $description = $entry_element;
+ last;
+ }
+ }
+ if ($description) {
+ $description_or_menu_comment = $description;
+ } else {
+ # Normally this cannot happen
+ $self->_bug_message("No description in menu_entry",
+ $line_nr,
$current);
+ push @{$entry->{'args'}}, {'type' =>
'menu_entry_description',
+
'parent' => $entry,
+
'contents' => [] };
+ $description_or_menu_comment = $entry->{'args'}->[-1];
+ }
+ } elsif (@{$menu->{'contents'}} and
$menu->{'contents'}->[-1]->{'type'}
+ and $menu->{'contents'}->[-1]->{'type'} eq 'menu_comment') {
+ $description_or_menu_comment = $menu->{'contents'}->[-1];
+ }
+ if ($description_or_menu_comment) {
+ $current = $description_or_menu_comment;
+ if ($current->{'contents'}->[-1] and
$current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'preformatted') {
+ $current = $current->{'contents'}->[-1];
+ } else {
+ # this should not happen
+ $self->_bug_message("description or menu comment not in
preformatted",
+ $line_nr,
$current);
+ push @{$current->{'contents'}}, {'type' => 'preformatted',
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ }
+ push @{$self->{'context_stack'}}, 'preformatted';
+ } else {
+ push @{$menu->{'contents'}}, {'type' => 'menu_comment',
+
'parent' => $menu,
+
'contents' => [] };
+ $current = $menu->{'contents'}->[-1];
+ push @{$current->{'contents'}}, {'type' => 'preformatted',
+ 'parent'
=> $current,
+ 'contents'
=> [] };
+ $current = $current->{'contents'}->[-1];
+ push @{$self->{'context_stack'}}, 'preformatted';
+ print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
+ }
+ while (@{$menu_entry->{'args'}}) {
+ my $arg = shift @{$menu_entry->{'args'}};
+ if (defined($arg->{'text'})) {
+ $current = _merge_text($self, $current, $arg->{'text'});
+ } else {
+ while (@{$arg->{'contents'}}) {
+ my $content = shift @{$arg->{'contents'}};
+ if (defined($content->{'text'})) {
+ $current = _merge_text($self, $current,
+
$content->{'text'});
+ $content = undef;
+ } else {
+ $content->{'parent'} = $current;
+ push @{$current->{'contents'}}, $content;
+ }
+ }
+ }
+ $arg = undef;
+ }
+ # MENU_COMMENT open
+ $menu_entry = undef;
+ } else {
+ print STDERR "MENU ENTRY END LINE\n" if ($self->{'DEBUG'});
+ $current = $current->{'parent'};
+ $current = _enter_menu_entry_node($self, $current, $line_nr);
+ if (defined($end_comment)) {
+ $end_comment->{'parent'} = $current;
+ push @{$current->{'contents'}}, $end_comment;
+ }
+ }
+ # def line
+ } elsif ($current->{'parent'}
+ and $current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq 'def_line') {
+ my $def_context = pop @{$self->{'context_stack'}};
+ if ($def_context ne 'def') {
+ $self->_bug_message("context $def_context instead of def",
+ $line_nr, $current);
+ die;
+ }
+ my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
+ my $arguments = $self->_parse_def($def_command,
+
$current->{'contents'});
+ if (scalar(@$arguments)) {
+ $current->{'parent'}->{'extra'}->{'def_args'} = $arguments;
+ my $def_parsed_hash;
+ foreach my $arg (@$arguments) {
+ die if (!defined($arg->[0]));
+ last if ($arg->[0] eq 'arg' or $arg->[0] eq 'typearg'
+ or $arg->[0] eq 'delimiter');
+ next if ($arg->[0] eq 'spaces');
+ # change of type is done in _parse_def.
+ #if ($arg->[1]->{'type'} and $arg->[1]->{'type'} eq
'bracketed') {
+ # $def_parsed_hash->{$arg->[0]} = { 'contents' =>
$arg->[1]->{'contents'},
+ # 'type' =>
'bracketed_def_content',
+ # 'parent' =>
$arg->[1]->{'parent'}};
+ #} else {
+ # $def_parsed_hash->{$arg->[0]} = $arg->[1];
+ #}
+ $def_parsed_hash->{$arg->[0]} = $arg->[1];
+ }
+ $current->{'parent'}->{'extra'}->{'def_parsed_hash'} =
$def_parsed_hash;
+ # do an standard index entry tree
+ my $index_entry;
+ if (defined($def_parsed_hash->{'name'})) {
+ $index_entry = $def_parsed_hash->{'name'}
+ # empty bracketed
+ unless ($def_parsed_hash->{'name'}->{'type'}
+ and $def_parsed_hash->{'name'}->{'type'}
eq 'bracketed_def_content'
+ and
(!$def_parsed_hash->{'name'}->{'contents'}
+ or
(!scalar(@{$def_parsed_hash->{'name'}->{'contents'}}))
+ or
(scalar(@{$def_parsed_hash->{'name'}->{'contents'}}) == 1
+ and
defined($def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'})
+ and
$def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'} !~ /\S/)));
+ }
+ if (defined($index_entry)) {
+ my $index_contents_normalized;
+ if ($def_parsed_hash->{'class'}) {
+ if ($command_index_prefix{$def_command} eq 'f') {
+ $index_entry = $self->gdt('{name} on {class}',
+ {'name' =>
$def_parsed_hash->{'name'},
+ 'class'
=> $def_parsed_hash->{'class'}});
+ $index_contents_normalized
+ =
[_non_bracketed_contents($def_parsed_hash->{'name'}),
+ { 'text' => ' on '},
+
_non_bracketed_contents($def_parsed_hash->{'class'})];
+ } elsif ($command_index_prefix{$def_command} eq 'v'
+ and $def_command ne 'defcv') {
+ $index_entry = $self->gdt('{name} of {class}',
+
{'name' => $def_parsed_hash->{'name'},
+
'class' => $def_parsed_hash->{'class'}});
+ $index_contents_normalized
+ =
[_non_bracketed_contents($def_parsed_hash->{'name'}),
+ { 'text' => ' of '},
+
_non_bracketed_contents($def_parsed_hash->{'class'})];
+ }
+ }
+ $index_contents_normalized = [$index_entry]
+ if (!defined($index_contents_normalized));
+ my $index_contents;
+ # 'root_line' is the container returned by gdt.
+ if ($index_entry->{'type'} and $index_entry->{'type'} eq
'root_line') {
+ $index_contents = $index_entry->{'contents'};
+ } else {
+ $index_contents = [$index_entry];
+ }
+ _enter_index_entry($self,
+ $current->{'parent'}->{'extra'}->{'def_command'},
+ $current->{'parent'}->{'extra'}->{'original_def_cmdname'},
+ $current->{'parent'}, $index_contents,
+ $index_contents_normalized, $line_nr);
+ } else {
+ $self->_command_warn($current->{'parent'}, $line_nr,
+ $self->__('missing name for @%s'),
+
$current->{'parent'}->{'extra'}->{'original_def_cmdname'});
+ }
+ } else {
+ $self->_command_warn($current->{'parent'}, $line_nr,
+ $self->__('missing category for @%s'),
+ $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
+ }
+ $current = $current->{'parent'}->{'parent'};
+ $current = $self->_begin_preformatted($current);
+
+ # other block command lines
+ } elsif ($current->{'type'}
+ and $current->{'type'} eq 'block_line_arg') {
+ my $empty_text;
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'line') {
+ $self->_bug_message("context $context instead of line in
block_line_arg",
+ $line_nr, $current);
+ }
+ # @multitable args
+ if ($current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq
'multitable') {
+ # parse the prototypes and put them in a special arg
+ my @prototype_row;
+ # do the same but keeping spaces information
+ my @prototype_line;
+ foreach my $content (@{$current->{'contents'}}) {
+ if ($content->{'type'} and $content->{'type'} eq 'bracketed') {
+ push @prototype_row, { 'contents' =>
$content->{'contents'},
+ 'parent' =>
$content->{'parent'},
+ 'type' =>
'bracketed_multitable_prototype'};
+ push @prototype_line, $content;
+ } elsif ($content->{'text'}) {
+ if ($content->{'text'} =~ /\S/) {
+ foreach my $prototype (split /\s+/,
$content->{'text'}) {
+ push @prototype_row, { 'text' => $prototype,
+ 'type' =>
'row_prototype' } unless ($prototype eq '');
+ }
+ }
+ # The regexp breaks between characters, with a non space
followed
+ # by a space or a space followed by non space. It is like
\b, but
+ # for \s \S, and not \w \W.
+ foreach my $prototype_or_space (split
/(?<=\S)(?=\s)|(?=\S)(?<=\s)/,
+
$content->{'text'}) {
+ if ($prototype_or_space =~ /\S/) {
+ push @prototype_line, {'text' =>
$prototype_or_space,
+
'type' => 'row_prototype' };
+ } elsif ($prototype_or_space =~ /\s/) {
+ push @prototype_line, {'text' =>
$prototype_or_space,
+
'type' => 'prototype_space' };
+ }
+ }
+ } else {
+ # FIXME could this happen? Should be a debug message?
+ if (!$content->{'cmdname'}) {
+ $self->_command_warn($current, $line_nr,
+ $self->__("unexpected argument on
address@hidden line: %s"),
+ $current->{'cmdname'},
+ Texinfo::Convert::Texinfo::convert({ $content->{'contents'}
}));
+ } elsif ($content->{'cmdname'} eq 'c'
+ or $content->{'cmdname'} eq 'comment') {
+ } else {
+ push @prototype_row, $content;
+ push @prototype_line, $content;
+ }
+ }
+ }
+
+ my $multitable = $current->{'parent'};
+ $multitable->{'extra'}->{'max_columns'} = scalar(@prototype_row);
+ if (!scalar(@prototype_row)) {
+ $self->_command_warn($multitable, $line_nr,
+ $self->__("empty
multitable"));
+ }
+ $multitable->{'extra'}->{'prototypes'} = address@hidden;
+ $multitable->{'extra'}->{'prototypes_line'} = address@hidden;
+
+ } else {
+ $self->_isolate_last_space($current, 'space_at_end_block_command');
+ $self->_register_command_arg($current,
'block_command_line_contents');
+ }
+ # @float args
+ if ($current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq
'float') {
+ my $float = $current->{'parent'};
+ $float->{'line_nr'} = $line_nr;
+ my $type = '';
+ if (@{$float->{'args'}}) {
+ if ($float->{'args'}->[1]) {
+ my $float_label =
_parse_node_manual($float->{'args'}->[1]);
+ _check_internal_node($self, $float_label, $line_nr);
+ if (defined($float_label) and
$float_label->{'node_content'}
+ and $float_label->{'normalized'} =~ /[^-]/) {
+ _register_label($self, $float, $float_label, $line_nr);
+ }
+ }
+ _parse_float_type($float);
+ $type = $float->{'extra'}->{'type'}->{'normalized'};
+ }
+ push @{$self->{'floats'}->{$type}}, $float
+ unless (_ignore_global_commands($self));
+ $float->{'float_section'} = $self->{'current_section'}
+ if (defined($self->{'current_section'}));
+ }
+ $current = $current->{'parent'};
+ delete $current->{'remaining_args'};
+ # don't consider empty argument of block @-commands as argument,
+ # reparent them as contents
+ if ($current->{'args'}->[0]->{'contents'}->[0]
+ and $current->{'args'}->[0]->{'contents'}->[0]->{'type'}
+ and $current->{'args'}->[0]->{'contents'}->[0]->{'type'} eq
'empty_line_after_command')
+ {
+ my $empty_text = $current->{'args'}->[0]->{'contents'}->[0];
+ $empty_text->{'parent'} = $current;
+ unshift @{$current->{'contents'}}, $empty_text;
+ delete $current->{'args'};
+ }
+ # Additionally, remove empty arguments as far as possible
+ _remove_empty_content_arguments($current);
+
+ if ($current->{'cmdname'}
+ and $block_item_commands{$current->{'cmdname'}}) {
+ if ($current->{'cmdname'} eq 'enumerate') {
+ my $spec = 1;
+ if ($current->{'extra'}->{'block_command_line_contents'}
+ and
defined($current->{'extra'}->{'block_command_line_contents'}->[0])) {
+ if
(scalar(@{$current->{'extra'}->{'block_command_line_contents'}->[0]}) > 1) {
+ $self->_command_error($current, $line_nr,
+ $self->__("superfluous
argument to address@hidden"),
+ $current->{'cmdname'});
+ }
+ my $arg =
$current->{'extra'}->{'block_command_line_contents'}->[0]->[0];
+ if (!defined($arg->{'text'}) or $arg->{'text'} !~
/^(([[:digit:]]+)|([[:alpha:]]+))$/) {
+ $self->_command_error($current, $line_nr,
+ $self->__("bad argument to
address@hidden"),
+ $current->{'cmdname'});
+ } else {
+ $spec = $arg->{'text'};
+ }
+ }
+ $current->{'extra'}->{'enumerate_specification'} = $spec;
+ } elsif ($item_line_commands{$current->{'cmdname'}}) {
+ if (!$current->{'extra'}
+ or !$current->{'extra'}->{'command_as_argument'}) {
+ $self->_command_error($current, $line_nr,
+ $self->__("%s requires an argument: the formatter
for %citem"),
+ $current->{'cmdname'}, ord('@'));
+ } elsif
(!$brace_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
+ and
!$self->{'definfoenclose'}->{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}})
{
+ $self->_command_error($current, $line_nr,
+ $self->__("command address@hidden not accepting
argument in brace should not be on address@hidden line"),
+
$current->{'extra'}->{'command_as_argument'}->{'cmdname'},
+ $current->{'cmdname'});
+ delete $current->{'extra'}->{'command_as_argument'};
+ }
+ }
+ # This code checks that the command_as_argument of the @itemize
+ # is alone on the line, otherwise it is not a command_as_argument.
+ if ($current->{'extra'}
+ and $current->{'extra'}->{'command_as_argument'}
+ and $current->{'cmdname'} eq 'itemize') {
+ my @args = @{$current->{'args'}->[0]->{'contents'}};
+ while (@args) {
+ my $arg = shift @args;
+ last if ($arg eq
$current->{'extra'}->{'command_as_argument'});
+ }
+ while (@args) {
+ my $arg = shift @args;
+ if (!(($arg->{'cmdname'}
+ and ($arg->{'cmdname'} eq 'c'
+ or $arg->{'cmdname'} eq 'comment'))
+ or (defined($arg->{'text'}) and $arg->{'text'}
!~ /\S/))) {
+ #print STDERR " -> stop at "._print_current($arg)."\n";
+ delete
$current->{'extra'}->{'command_as_argument'}->{'type'};
+ delete $current->{'extra'}->{'command_as_argument'};
+ last;
+ }
+ }
+ }
+ if ($current->{'extra'}
+ and $current->{'extra'}->{'command_as_argument'}
+ and
$accent_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
+ and ($current->{'cmdname'} eq 'itemize'
+ or $item_line_commands{$current->{'cmdname'}})) {
+ $self->_command_warn($current, $line_nr,
+ $self->__("accent command address@hidden' not
allowed as address@hidden argument"),
+
$current->{'extra'}->{'command_as_argument'}->{'cmdname'},
+ $current->{'cmdname'});
+ delete $current->{'extra'}->{'command_as_argument'};
+ delete $current->{'extra'}->{'block_command_line_contents'};
+ }
+ if (!$current->{'extra'}->{'block_command_line_contents'}
+ and $current->{'cmdname'} eq 'itemize') {
+ $current->{'extra'}->{'block_command_line_contents'} = [
+ [ { 'cmdname' => 'bullet',
+ 'type' => 'command_as_argument',
+ 'parent' => $current }
+ ]
+ ];
+ $current->{'extra'}->{'command_as_argument'} =
+
$current->{'extra'}->{'block_command_line_contents'}->[0]->[0];
+ } elsif ($item_line_commands{$current->{'cmdname'}} and
+ ! $current->{'extra'}->{'command_as_argument'}) {
+ $current->{'extra'}->{'block_command_line_contents'} = [
+ [ { 'cmdname' => 'asis',
+ 'type' => 'command_as_argument',
+ 'parent' => $current }
+ ]
+ ];
+ $current->{'extra'}->{'command_as_argument'} =
+
$current->{'extra'}->{'block_command_line_contents'}->[0]->[0];
+ }
+ push @{$current->{'contents'}}, { 'type' => 'before_item',
+ 'contents' => [], 'parent', $current };
+ $current = $current->{'contents'}->[-1];
+ }
+ if ($current->{'cmdname'} and $menu_commands{$current->{'cmdname'}}) {
+ push @{$current->{'contents'}}, {'type' => 'menu_comment',
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
+ push @{$self->{'context_stack'}}, 'preformatted';
+ }
+ $current = $self->_begin_preformatted($current);
+
+ # if we are after a @end verbatim, we must restart a preformatted if
needed,
+ # since there is no @end command explicitly associated to raw commands
+ # it won't be done elsewhere.
+ } elsif ($current->{'contents'}
+ and $current->{'contents'}->[-1]
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command'
+ and $current->{'contents'}->[-1]->{'extra'}
+ and $current->{'contents'}->[-1]->{'extra'}->{'command'}
+ and
$current->{'contents'}->[-1]->{'extra'}->{'command'}->{'cmdname'} eq
'verbatim') {
+ $current = $self->_begin_preformatted($current);
+ # misc command line arguments
+ # Never go here if skipline/noarg/...
+ } elsif ($current->{'type'}
+ and $current->{'type'} eq 'misc_line_arg') {
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'line') {
+ $self->_bug_message("context $context instead of line in
misc_line_arg",
+ $line_nr, $current);
+ }
+ $self->_isolate_last_space($current);
+
+ # first parent is the @command, second is the parent
+ $current = $current->{'parent'};
+ my $misc_cmd = $current;
+ my $command = $current->{'cmdname'};
+ my $end_command;
+ print STDERR "MISC END address@hidden" if ($self->{'DEBUG'});
+ if ($self->{'misc_commands'}->{$command} =~ /^\d$/) {
+ my $args = _parse_line_command_args($self, $current, $line_nr);
+ $current->{'extra'}->{'misc_args'} = $args if (defined($args));
+ } elsif ($self->{'misc_commands'}->{$command} eq 'text') {
+ my $text = Texinfo::Convert::Text::convert($current->{'args'}->[0],
+
{'code' => 1,
+
Texinfo::Common::_convert_text_options($self)});
+ if ($text eq '') {
+ $self->_command_warn($current, $line_nr,
+
$self->__("address@hidden missing argument"), $command);
+ $current->{'extra'}->{'missing_argument'} = 1;
+ } else {
+ $current->{'extra'}->{'text_arg'} = $text;
+ if ($command eq 'end') {
+ # REMACRO
+ my $line = $text;
+ if ($line =~ s/^([[:alnum:]][[:alnum:]-]+)//) {
+ $end_command = $1;
+
+ if (!exists $block_commands{$end_command}) {
+ $self->_command_warn($current, $line_nr,
+ $self->__("unknown
address@hidden %s"), $end_command);
+ $end_command = undef;
+ } else {
+ print STDERR "END BLOCK $end_command\n" if
($self->{'DEBUG'});
+ if ($block_commands{$end_command} eq
'conditional') {
+ if (@{$self->{'conditionals_stack'}}
+ and $self->{'conditionals_stack'}->[-1] eq
$end_command) {
+ pop @{$self->{'conditionals_stack'}};
+ } else {
+ $self->_command_error($current, $line_nr,
+ $self->__("unmatched
`%c%s'"), ord('@'), 'end');
+ $end_command = undef;
+ }
+ }
+ $current->{'extra'}->{'command_argument'} =
$end_command
+ if (defined($end_command));
+ }
+ if ($line =~ /\S/ and defined($end_command)) {
+ my $texi_line
+ =
Texinfo::Convert::Texinfo::convert($current->{'args'}->[0]);
+ $texi_line =~ s/^\s*([[:alnum:]][[:alnum:]-]+)//;
+ $self->_command_error($current, $line_nr,
+
$self->__("superfluous argument to address@hidden %s: %s"),
+ $command,
$end_command, $texi_line);
+ }
+ } else {
+ $self->_command_error($current, $line_nr,
+ $self->__("bad
argument to address@hidden: %s"),
+ $command, $line);
+ }
+ } elsif ($command eq 'include') {
+ my $file = Texinfo::Common::locate_include_file($self,
$text) ;
+ if (defined($file)) {
+ my $filehandle = do { local *FH };
+ if (open ($filehandle, $file)) {
+ $included_file = 1;
+ binmode($filehandle,
":encoding($self->{'INPUT_PERL_ENCODING'})")
+ if (defined($self->{'INPUT_PERL_ENCODING'}));
+ print STDERR "Included $file($filehandle)\n" if
($self->{'DEBUG'});
+ unshift @{$self->{'input'}}, {
+ 'name' => $file,
+ 'line_nr' => 0,
+ 'pending' => [],
+ 'fh' => $filehandle };
+ } else {
+ $self->_command_error($current, $line_nr,
+
$self->__("address@hidden: could not open %s: %s"),
+ $command, $text,
$!);
+ }
+ } else {
+ $self->_command_error($current, $line_nr,
+
$self->__("address@hidden: could not find %s"),
+ $command, $text);
+ }
+ } elsif ($command eq 'documentencoding') {
+ my ($texinfo_encoding, $perl_encoding, $input_encoding)
+ = Texinfo::Encoding::encoding_alias($text);
+ $self->_command_warn($current, $line_nr,
+ $self->__("encoding `%s' is not a canonical
texinfo encoding"),
+ $text)
+ if (!$texinfo_encoding or $texinfo_encoding ne
lc($text));
+ if (! _ignore_global_commands($self)) {
+ if ($input_encoding) {
+ $current->{'extra'}->{'input_encoding_name'} =
$input_encoding;
+ }
+ if (!$perl_encoding) {
+ $self->_command_warn($current, $line_nr,
+ $self->__("unrecognized encoding name
`%s'"), $text);
+ } else {
+ $current->{'extra'}->{'input_perl_encoding'} =
$perl_encoding;
+
+ if ($input_encoding) {
+ if (!$self->{'set'}->{'INPUT_ENCODING_NAME'}) {
+ $self->{'INPUT_ENCODING_NAME'} =
$input_encoding;
+ $self->{'info'}->{'input_encoding_name'} =
$input_encoding;
+ }
+ }
+
+ if (!$self->{'set'}->{'INPUT_PERL_ENCODING'}) {
+ $self->{'INPUT_PERL_ENCODING'} =
$perl_encoding;
+ $self->{'info'}->{'input_perl_encoding'} =
$perl_encoding;
+ foreach my $input (@{$self->{'input'}}) {
+ binmode($input->{'fh'},
":encoding($perl_encoding)") if ($input->{'fh'});
+ }
+ }
+ }
+ }
+ } elsif ($command eq 'documentlanguage') {
+ my @messages =
Texinfo::Common::warn_unknown_language($text,
+
$self->{'gettext'});
+ foreach my $message(@messages) {
+ $self->_command_warn($current, $line_nr, $message);
+ }
+ if (!$self->{'set'}->{'documentlanguage'}
+ and !_ignore_global_commands($self)) {
+ $self->{'documentlanguage'} = $text;
+ }
+ }
+ }
+ } elsif ($command eq 'node') {
+ foreach my $arg (@{$current->{'args'}}) {
+ my $node = _parse_node_manual($arg);
+ push @{$current->{'extra'}->{'nodes_manuals'}}, $node;
+ }
+ if (_check_node_label($self,
$current->{'extra'}->{'nodes_manuals'}->[0],
+ $command, $line_nr)) {
+ if (_register_label($self, $current,
+
$current->{'extra'}->{'nodes_manuals'}->[0], $line_nr)) {
+ $self->{'current_node'} = $current;
+ push @{$self->{'nodes'}}, $current;
+ }
+ }
+ } elsif ($command eq 'listoffloats') {
+ # Empty listoffloats is allowed
+ _parse_float_type($current);
+ #if (!_parse_float_type($current)) {
+ # $self->line_error (sprintf($self->__("address@hidden missing
argument"),
+ # $command), $line_nr);
+ #}
+ # handle all the other 'line' commands. Here just check that they
+ # have an argument and prepare contents without spaces.
+ } else {
+ my @contents = @{$current->{'args'}->[0]->{'contents'}};
+ _trim_spaces_comment_from_content(address@hidden);
+ # empty @top is allowed
+ if (!scalar(@contents) and $command ne 'top') {
+ $self->_command_warn($current, $line_nr,
+ $self->__("address@hidden missing argument"),
$command);
+ $current->{'extra'}->{'missing_argument'} = 1;
+ } else {
+ $current->{'extra'}->{'misc_content'} = address@hidden;
+ if (($command eq 'item' or $command eq 'itemx')
+ and
$self->{'command_index_prefix'}->{$current->{'parent'}->{'cmdname'}}) {
+ _enter_index_entry($self,
$current->{'parent'}->{'cmdname'},
+ $command, $current,
+
$current->{'extra'}->{'misc_content'},
+ undef, $line_nr);
+ } elsif
($self->{'command_index_prefix'}->{$current->{'cmdname'}}) {
+ _enter_index_entry($self, $current->{'cmdname'},
+
$current->{'cmdname'}, $current,
+
$current->{'extra'}->{'misc_content'},
+ undef, $line_nr);
+ $current->{'type'} = 'index_entry_command';
+ }
+ }
+ if (defined($command_structuring_level{$command})) {
+ $current->{'level'} = $command_structuring_level{$command};
+ }
+ }
+ $current = $current->{'parent'};
+ if ($end_command) {
+ print STDERR "END COMMAND $end_command\n" if ($self->{'DEBUG'});
+ my $end = pop @{$current->{'contents'}};
+ if ($block_commands{$end_command} ne 'conditional') {
+ my $closed_command;
+ ($closed_command, $current)
+ = _close_commands($self, $current, $line_nr, $end_command);
+ my $inline_copying;
+ if ($closed_command) {
+ $misc_cmd->{'extra'}->{'command'} = $closed_command;
+ $closed_command->{'extra'}->{'end_command'} = $misc_cmd;
+ $self->_close_command_cleanup($closed_command);
+ $end->{'parent'} = $closed_command;
+
+ # register @insertcopying as a macro if
INLINE_INSERTCOPYING is set.
+ if ($end_command eq 'copying' and
$self->{'INLINE_INSERTCOPYING'}) {
+ # remove the end of line following @copying.
+ my @contents = @{$closed_command->{'contents'}};
+ shift @contents if ($contents[0] and
$contents[0]->{'type'}
+ and ($contents[0]->{'type'} eq
'empty_line_after_command'
+ or $contents[0]->{'type'} eq
'empty_spaces_after_command'));
+ # the macrobody is the @copying content converted to
Texinfo.
+ my $body = Texinfo::Convert::Texinfo::convert(
+ {'contents' =>
address@hidden);
+
+ #chomp ($body);
+ $self->{'macros'}->{'insertcopying'} = {
+ 'args' => [{'text' => 'insertcopying',
'type' => 'macro_name'}],
+ 'cmdname' => 'macro',
+ 'extra' => {'macrobody' =>
+
$self->_strip_macrobody_leading_space($body)}
+ };
+ $inline_copying = 1;
+ print STDERR "INLINE_INSERTCOPYING as macro\n" if
($self->{'DEBUG'});
+ }
+ push @{$closed_command->{'contents'}}, $end;
+
+ # closing a menu command, but still in a menu. Open a
menu_comment
+ if ($menu_commands{$closed_command->{'cmdname'}}
+ and $self->{'context_stack'}->[-1] eq 'menu') {
+ print STDERR "CLOSE MENU but still in menu context\n"
+ if ($self->{'DEBUG'});
+ push @{$current->{'contents'}}, {'type' =>
'menu_comment',
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ push @{$self->{'context_stack'}}, 'preformatted';
+ }
+ } else {
+ #print STDERR "LLLLLLLLLLLL Cannot be here...\n";
+ }
+ $current = $self->_begin_preformatted($current)
+ if ($close_preformatted_commands{$end_command});
+ }
+ } else {
+ $current = $self->_begin_preformatted($current)
+ if ($close_preformatted_commands{$command});
+ }
+ # if a file was included, remove completly the include file command.
+ # Also ignore @setfilename in included file, as said in the manual.
+ if ($included_file or ($command eq 'setfilename'
+ and
scalar(@{$self->{'input'}}) > 1)) {
+ # TODO keep the information with sourcemark
+ pop @{$current->{'contents'}};
+ } elsif ($command eq 'setfilename'
+ and ($self->{'current_node'} or
$self->{'current_section'})) {
+ $self->_command_warn($misc_cmd, $line_nr,
+ $self->__("address@hidden after the first
element"), $command);
+ # columnfractions
+ } elsif ($command eq 'columnfractions') {
+ # in a multitable, we are in a block_line_arg
+ if (!$current->{'parent'} or !$current->{'parent'}->{'cmdname'}
+ or $current->{'parent'}->{'cmdname'} ne
'multitable') {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden only meaningful on a
address@hidden line"),
+ $command);
+ } else {
+ # This is the multitable block_line_arg line context
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'line') {
+ $self->_bug_message("context $context instead of line for
multitable",
+ $line_nr,
$current);
+ }
+ $current = $current->{'parent'};
+ $current->{'extra'}->{'max_columns'} = 0;
+ if (defined($misc_cmd->{'extra'}->{'misc_args'})) {
+ $current->{'extra'}->{'max_columns'} =
+ scalar(@{$misc_cmd->{'extra'}->{'misc_args'}});
+ $current->{'extra'}->{'columnfractions'} =
$misc_cmd->{'extra'}->{'misc_args'};
+ }
+ push @{$current->{'contents'}}, { 'type' => 'before_item',
+ 'contents' => [], 'parent', $current };
+ $current = $current->{'contents'}->[-1];
+ }
+ } elsif ($root_commands{$command}) {
+ $current = $current->{'contents'}->[-1];
+ delete $current->{'remaining_args'};
+ $current->{'contents'} = [];
+
+ # we never should be in a raw format bock, so we don't check for
+ # _ignore_global_commands($self)
+ # associate the section (not part) with the current node.
+ if ($command ne 'node' and $command ne 'part') {
+ if ($self->{'current_node'}
+ and
!$self->{'current_node'}->{'extra'}->{'associated_section'}) {
+ $self->{'current_node'}->{'extra'}->{'associated_section'}
= $current;
+ $current->{'extra'}->{'associated_node'} =
$self->{'current_node'};
+ }
+ if ($self->{'current_parts'}) {
+ $current->{'extra'}->{'associated_part'} =
$self->{'current_parts'}->[-1];
+ foreach my $part (@{$self->{'current_parts'}}) {
+ $part->{'extra'}->{'part_associated_section'} =
$current;
+ if ($current->{'cmdname'} eq 'top') {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden should not be associated
with address@hidden"),
+ $part->{'cmdname'}), $part->{'line_nr'});
+ }
+ }
+ delete $self->{'current_parts'};
+ }
+ $self->{'current_section'} = $current;
+ } elsif ($command eq 'part') {
+ push @{$self->{'current_parts'}}, $current;
+ if ($self->{'current_node'}
+ and
!$self->{'current_node'}->{'extra'}->{'associated_section'}) {
+ $self->line_warn (sprintf($self->__(
+ "address@hidden precedes address@hidden, but parts may
not be associated with nodes"),
+
$command), $line_nr);
+ }
+ }
+ }
+ # do that last in order to have the line processed if one of the above
+ # case is also set.
+ } elsif (
+ $current->{'contents'}
+ and (scalar(@{$current->{'contents'}}) == 1
+ and (($current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command'))
+ or (scalar(@{$current->{'contents'}}) == 2
+ and $current->{'contents'}->[-1]->{'cmdname'}
+ and ($current->{'contents'}->[-1]->{'cmdname'}
eq 'c'
+ or
$current->{'contents'}->[-1]->{'cmdname'} eq 'comment')
+ and $current->{'contents'}->[-2]
+ and $current->{'contents'}->[-2]->{'type'}
+ and $current->{'contents'}->[-2]->{'type'} eq
'empty_line_after_command'))) {
+ # empty line after a @menu or before a preformatted. Reparent to the
menu
+ # or other format
+ if ($current->{'type'}
+ and $preformatted_contexts{$current->{'type'}}) {
+ my $parent = $current->{'parent'};
+ if ($parent->{'type'} and $parent->{'type'} eq 'menu_comment'
+ and scalar(@{$parent->{'contents'}}) == 1) {
+ $parent = $parent->{'parent'};
+ }
+ my $to_reparent = pop @{$parent->{'contents'}};
+ print STDERR "LINE AFTER COMMAND IN PREFORMATTED
($to_reparent->{'type'})\n" if ($self->{'DEBUG'});
+ while (@{$current->{'contents'}}) {
+ my $content = shift @{$current->{'contents'}};
+ $content->{'parent'} = $parent;
+ push @{$parent->{'contents'}}, $content;
+ }
+ push @{$parent->{'contents'}}, $to_reparent;
+ }
+ }
+
+ # this happens if there is a nesting of line @-commands on a line.
+ # they are reprocessed here.
+ if ($self->{'context_stack'}->[-1] eq 'line'
+ or $self->{'context_stack'}->[-1] eq 'def') {
+ print STDERR "Still opened line command
$self->{'context_stack'}->[-1]:"._print_current($current)
+ if ($self->{'DEBUG'});
+ if ($self->{'context_stack'}->[-1] eq 'def') {
+ while ($current->{'parent'} and !($current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq 'def_line')) {
+ $current = $self->_close_current($current, $line_nr);
+ }
+ } else {
+ while ($current->{'parent'} and !($current->{'type'}
+ and ($current->{'type'} eq 'block_line_arg'
+ or $current->{'type'} eq
'misc_line_arg'))) {
+ $current = $self->_close_current($current, $line_nr);
+ }
+ }
+
+ # check for infinite loop bugs...
+ if ($current eq $current_old) {
+ my $indent = '- ';
+ my $tree_msg = $indent . _print_current($current);
+ while ($current->{'parent'}) {
+ $indent = '-'.$indent;
+ $current = $current->{'parent'};
+ $tree_msg .= $indent . _print_current($current);
+ }
+ $self->_bug_message("Nothing closed while a line context
remains\n$tree_msg",
+ $line_nr);
+ die;
+ }
+
+ $current = $self->_end_line($current, $line_nr);
+ }
+ return $current;
+}
+
+# $command may be undef if we are after a wrong misc command such as
+# a buggy @tab.
+sub _start_empty_line_after_command($$$) {
+ my $line = shift;
+ my $current = shift;
+ my $command = shift;
+ $line =~ s/^([^\S\r\n]*)//;
+ push @{$current->{'contents'}}, { 'type' => 'empty_line_after_command',
+ 'text'
=> $1,
+
'parent' => $current,
+ };
+ if (defined($command)) {
+ $current->{'contents'}->[-1]->{'extra'} = {'command' => $command};
+ $command->{'extra'}->{'spaces_after_command'} =
$current->{'contents'}->[-1];
+ }
+ return $line;
+}
+
+sub _check_empty_node($$$$)
+{
+ my $self = shift;
+ my $parsed_node = shift;
+ my $command = shift;
+ my $line_nr = shift;
+ if (!defined($parsed_node) or !$parsed_node->{'node_content'}) {
+ $self->line_error (sprintf($self->__("empty argument in
address@hidden"),
+ $command), $line_nr);
+ return 0;
+ } elsif ($parsed_node->{'normalized'} !~ /[^-]/) {
+ $self->line_error (sprintf($self->__("empty node name after expansion
`%s'"),
+ Texinfo::Convert::Texinfo::convert({'contents'
+
=> $parsed_node->{'node_content'}})),
+ $line_nr);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+sub _check_internal_node($$$)
+{
+ my $self = shift;
+ my $parsed_node = shift;
+ my $line_nr = shift;
+ if ($parsed_node and $parsed_node->{'manual_content'}) {
+ $self->line_error (sprintf($self->__("syntax for an external node used
for `%s'"),
+ _node_extra_to_texi($parsed_node)), $line_nr)
+ }
+}
+
+sub _check_node_label($$$$)
+{
+ my $self = shift;
+ my $parsed_node = shift;
+ my $command = shift;
+ my $line_nr = shift;
+ _check_internal_node($self, $parsed_node, $line_nr);
+ return _check_empty_node($self, $parsed_node, $command, $line_nr);
+}
+
+sub _register_extra_menu_entry_information($$;$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+
+ foreach my $arg (@{$current->{'args'}}) {
+ if ($arg->{'type'} eq 'menu_entry_name') {
+ $current->{'extra'}->{'menu_entry_name'} = $arg;
+ my $normalized_menu_entry_name =
+ Texinfo::Convert::NodeNameNormalization::normalize_node($arg);
+ if ($normalized_menu_entry_name !~ /[^-]/) {
+ $self->line_warn(sprintf($self->__("empty menu entry name in
`%s'"),
+ Texinfo::Convert::Texinfo::convert($current)), $line_nr);
+ }
+ } elsif ($arg->{'type'} eq 'menu_entry_node') {
+ $self->_isolate_last_space($arg, 'space_at_end_menu_node');
+ my $parsed_entry_node = _parse_node_manual($arg);
+ if (! defined($parsed_entry_node)) {
+ if ($self->{'SHOW_MENU'}) {
+ $self->line_error ($self->__("empty node name in menu
entry"), $line_nr);
+ }
+ } else {
+ $current->{'extra'}->{'menu_entry_node'} = $parsed_entry_node;
+ }
+ } elsif ($arg->{'type'} eq 'menu_entry_description') {
+ $current->{'extra'}->{'menu_entry_description'} = $arg;
+ }
+ }
+}
+
+sub _enter_menu_entry_node($$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $line_nr = shift;
+ my $description = { 'type' => 'menu_entry_description',
+ 'contents' => [],
+ 'parent' => $current };
+ push @{$current->{'args'}}, $description;
+ _register_extra_menu_entry_information($self, $current, $line_nr);
+ $current->{'line_nr'} = $line_nr;
+ $current = $description;
+ push @{$current->{'contents'}}, {'type' => 'preformatted',
+ 'parent'
=> $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ push @{$self->{'context_stack'}}, 'preformatted';
+ return $current;
+}
+
+sub _register_command_arg($$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $type = shift;
+ my @contents = @{$current->{'contents'}};
+ _trim_spaces_comment_from_content(address@hidden);
+ if (scalar(@contents)) {
+ push @{$current->{'parent'}->{'extra'}->{$type}}, address@hidden;
+ } else {
+ push @{$current->{'parent'}->{'extra'}->{$type}}, undef;
+ }
+}
+
+sub _command_with_command_as_argument($)
+{
+ my $current = shift;
+ return ($current and $current->{'type'}
+ and $current->{'type'} eq 'block_line_arg'
+ and $current->{'parent'}
+ and $current->{'parent'}->{'cmdname'} and
+ ($current->{'parent'}->{'cmdname'} eq 'itemize'
+ or $item_line_commands{$current->{'parent'}->{'cmdname'}})
+ and (scalar(@{$current->{'contents'}}) == 1
+ or (scalar(@{$current->{'contents'}}) == 2
+ and defined($current->{'contents'}->[0]->{'text'})
+ and $current->{'contents'}->[0]->{'text'}
+ =~
/^[^\S\r\n]*/)))
+}
+
+# $marked_as_invalid_command may be undef, if there is no
+# tree element because the @-command construct is incorrect, for example
+# wrong @tab.
+sub _mark_and_warn_invalid($$$$$)
+{
+ my $self = shift;
+ my $command = shift;
+ my $invalid_parent = shift;
+ my $line_nr = shift;
+ my $marked_as_invalid_command = shift;
+
+ if (defined($invalid_parent)) {
+ $self->line_warn(sprintf($self->__("address@hidden should not appear
in address@hidden"),
+ $command, $invalid_parent), $line_nr);
+ $marked_as_invalid_command->{'extra'}->{'invalid_nesting'} = 1
+ if (defined($marked_as_invalid_command));
+ }
+}
+# the different types
+#c 'menu_entry'
+#c 'menu_entry'
+# t 'menu_entry_leading_text'
+#
+#t 'macro_arg_name'
+#t 'macro_arg_args'
+#
+#t 'raw'
+#
+#t 'misc_arg'
+#c 'misc_line_arg'
+#
+#c 'block_line_arg'
+#
+#c 'brace_command_arg'
+#c 'brace_command_context'
+#
+#c 'before_item' what comes after @*table, @itemize, @enumerate before
+# an @item
+#
+#c 'paragraph'
+#
+#a 'def_line'
+#
+#special for @verb, type is the character
+
+# the main subroutine
+sub _parse_texi($;$)
+{
+ my $self = shift;
+ my $root = shift;
+
+ $root = { 'contents' => [], 'type' => 'text_root' } if (!defined($root));
+ my $current = $root;
+
+ my $line_nr;
+
+ NEXT_LINE:
+ while (1) {
+ my $line;
+ ($line, $line_nr) = _next_text($self, $line_nr, $current);
+ last if (!defined($line));
+
+ if ($self->{'DEBUG'}) {
+ $current->{'HERE !!!!'} = 1; # marks where we are in the tree
+ if ($self->{'DEBUG'} >= 100) {
+ local $Data::Dumper::Indent = 1;
+ local $Data::Dumper::Purity = 1;
+ print STDERR "".Data::Dumper->Dump([$root], ['$root']);
+ }
+ my $line_text = '';
+ $line_text = "$line_nr->{'line_nr'}.$line_nr->{'macro'}" if
($line_nr);
+ print STDERR "NEW LINE(".join('|',
@{$self->{'context_stack'}}).":@{$self->{'conditionals_stack'}}:$line_text):
$line";
+ #print STDERR "CONTEXT_STACK
".join('|',@{$self->{'context_stack'}})."\n";
+ delete $current->{'HERE !!!!'};
+ }
+
+ if (not
+ # raw format or verb
+ (($current->{'cmdname'}
+ and $block_commands{$current->{'cmdname'}}
+ and ($block_commands{$current->{'cmdname'}} eq 'raw'
+ or $block_commands{$current->{'cmdname'}} eq
'conditional'))
+ or
+ ($current->{'parent'} and
$current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq 'verb')
+ )
+ # not def line
+ and $self->{'context_stack'}->[-1] ne 'def') {
+ print STDERR "BEGIN LINE\n" if ($self->{'DEBUG'});
+ $line =~ s/^([^\S\r\n]*)//;
+ push @{$current->{'contents'}}, { 'type' => 'empty_line',
+
'text' => $1,
+
'parent' => $current };
+ }
+
+ while (1) {
+ # in a raw or ignored conditional block command
+ if ($current->{'cmdname'} and
+ $block_commands{$current->{'cmdname'}} and
+ ($block_commands{$current->{'cmdname'}} eq 'raw'
+ or $block_commands{$current->{'cmdname'}} eq
'conditional')) {
+ # r?macro may be nested
+ if (($current->{'cmdname'} eq 'macro'
+ or $current->{'cmdname'} eq 'rmacro')
+ and $line =~ /address@hidden/) {
+ $line =~ s/\s*\@(r?macro)//;
+ push @{$current->{'contents'}}, { 'cmdname' => $1,
+
'parent' => $current,
+
'contents' => [],
+ 'extra' => {'arg_line' =>
$line }};
+ $current = $current->{'contents'}->[-1];
+ last;
+ # ifclear/ifset may be nested
+ } elsif (($current->{'cmdname'} eq 'ifclear'
+ or $current->{'cmdname'} eq 'ifset'
+ or $current->{'cmdname'} eq
'ifcommanddefined'
+ or $current->{'cmdname'} eq
'ifcommandnotdefined')
+ and $line =~ /address@hidden>{'cmdname'}/) {
+ $line =~ s/\s*\@($current->{'cmdname'})//;
+ push @{$current->{'contents'}}, { 'cmdname' => $1,
+
'parent' => $current,
+
'contents' => [],
+ 'extra' => {'line' => $line
}};
+ $current = $current->{'contents'}->[-1];
+ last;
+ } elsif ($line =~ /^(\s*?)address@hidden([a-zA-Z][\w-]*)/
+ and ($2 eq $current->{'cmdname'})) {
+ my $end_command = $2;
+ my $raw_command = $current;
+ $line =~ s/^(\s*?)(address@hidden>{'cmdname'})//;
+ if ($1 eq '') {
+ # FIXME exclude other formats, like @macro, @ifset,
@ignore?
+ if ($current->{'cmdname'} ne 'verbatim'
+ and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'raw') {
+ if ($current->{'contents'}->[-1]->{'text'} =~
s/(\n)//) {
+ push @{$current->{'contents'}}, {'type' =>
'last_raw_newline',
+
'text' => $1, 'parent' => $current};
+ }
+ }
+ } else {
+ push @{$current->{'contents'}},
+ { 'text' => $1, 'type' => 'raw', 'parent' =>
$current };
+ $self->line_warn(sprintf($self->__("address@hidden %s
should only appear at a line beginning"),
+
$end_command), $line_nr);
+ }
+ # if there is a user defined macro that expandes to
spaces, there
+ # will be a spurious warning.
+ $self->line_warn(sprintf($self->
+ __("superfluous argument to address@hidden %s:
%s"), 'end', $end_command,
+
$line), $line_nr)
+ if ($line =~ /\S/ and $line !~
/address@hidden(omment)?\b/);
+ # store toplevel macro specification
+ if (($end_command eq 'macro' or $end_command eq 'rmacro')
+ and (! $current->{'parent'}
+ or !$current->{'parent'}->{'cmdname'}
+ or ($current->{'parent'}->{'cmdname'}
ne 'macro'
+ and
$current->{'parent'}->{'cmdname'} ne 'rmacro'))) {
+ $current->{'extra'}->{'macrobody'} =
+ $self->_strip_macrobody_leading_space(
+ Texinfo::Convert::Texinfo::convert({ 'contents'
+
=> $current->{'contents'} }));
+ if ($current->{'args'} and $current->{'args'}->[0]
+ and !_ignore_global_commands($self)) {
+ my $name = $current->{'args'}->[0]->{'text'};
+ if (exists($self->{'macros'}->{$name})) {
+ $self->line_warn(sprintf($self->__("macro `%s'
previously defined"),
+
$name), $current->{'line_nr'});
+ $self->line_warn(sprintf($self->__(
+ "here is
the previous definition of `%s'"),
+ $name),
$self->{'macros'}->{$name}->{'line_nr'});
+ }
+ if ($all_commands{$name}) {
+ $self->line_warn(sprintf($self->__(
+
"redefining Texinfo language command: address@hidden"),
+
$name), $current->{'line_nr'});
+ }
+ $self->{'macros'}->{$name} = $current
+ unless
($current->{'extra'}->{'invalid_syntax'});
+ }
+ }
+ $current = $current->{'parent'};
+ if ($block_commands{$end_command} eq 'conditional') {
+ # don't store ignored @if*
+ my $conditional = pop @{$current->{'contents'}};
+ if (!defined($conditional->{'cmdname'}
+ or $conditional->{'cmdname'} ne $end_command))
{
+ $self->_bug_message("Ignored command is not the
conditional $end_command",
+
$line_nr, $conditional);
+ die;
+ }
+ # Ignore until end of line
+ if ($line !~ /\n/) {
+ ($line, $line_nr) = _new_line($self, $line_nr,
$conditional);
+ print STDERR "IGNORE CLOSE line: $line" if
($self->{'DEBUG'});
+ }
+ print STDERR "CLOSED conditional $end_command\n" if
($self->{'DEBUG'});
+ last;
+ } else {
+ print STDERR "CLOSED raw $end_command\n" if
($self->{'DEBUG'});
+ $line = _start_empty_line_after_command($line,
$current, $raw_command);
+ }
+ } else {
+ if (@{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command'
+ and $current->{'contents'}->[-1]->{'text'} !~ /\n/
+ and $line !~ /\S/) {
+ $current->{'contents'}->[-1]->{'text'} .= $line;
+ } else {
+ push @{$current->{'contents'}},
+ { 'text' => $line, 'type' => 'raw', 'parent' =>
$current };
+ }
+ last;
+ }
+ # in @verb. type should be 'brace_command_arg'
+ } elsif ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq 'verb') {
+ # collect the first character if not already done
+ if (!defined($current->{'parent'}->{'type'})) {
+ if ($line =~ /^$/) {
+ $current->{'parent'}->{'type'} = '';
+ $self->line_error(sprintf($self->
+ __("address@hidden without associated
character"), 'verb'), $line_nr);
+ } else {
+ $line =~ s/^(.)//;
+ $current->{'parent'}->{'type'} = $1;
+ }
+ }
+ my $char = quotemeta($current->{'parent'}->{'type'});
+ if ($line =~ s/^(.*?)$char\}/\}/) {
+ push @{$current->{'contents'}},
+ { 'text' => $1, 'type' => 'raw', 'parent' =>
$current }
+ if ($1 ne '');
+ print STDERR "END VERB\n" if ($self->{'DEBUG'});
+ } else {
+ push @{$current->{'contents'}},
+ { 'text' => $line, 'type' => 'raw', 'parent' =>
$current };
+ print STDERR "LINE VERB: $line" if ($self->{'DEBUG'});
+ last;
+ }
+ }
+
+ # this mostly happens in the following cases:
+ # after expansion of user defined macro that doesn't end with EOL
+ # after a protection of @\n in @def* line
+ # at the end of an expanded Texinfo fragment
+ while ($line eq '') {
+ print STDERR "EMPTY TEXT\n"
+ if ($self->{'DEBUG'});
+ ($line, $line_nr) = _next_text($self, $line_nr, $current);
+ if (!defined($line)) {
+ # end of the file or of a text fragment.
+ $current = _end_line ($self, $current, $line_nr);
+ # It may happen that there is an @include file on the
line, it
+ # will be picked up at NEXT_LINE, beginning a new line
+ next NEXT_LINE;
+ }
+ }
+
+ # handle user defined macros before anything else since
+ # their expansion may lead to changes in the line
+ # REMACRO
+ if ($line =~ /^\@([[:alnum:]][[:alnum:]-]*)/
+ and ($self->{'macros'}->{$1}
+ or (exists $self->{'aliases'}->{$1}
and
+
$self->{'macros'}->{$self->{'aliases'}->{$1}}))) {
+ $line =~ s/^\@([[:alnum:]][[:alnum:]-]*)//o;
+ my $command = $1;
+ my $alias_command;
+ if (exists($self->{'aliases'}->{$command})) {
+ $alias_command = $command;
+ $command = $self->{'aliases'}->{$command};
+ }
+
+ my $expanded_macro = $self->{'macros'}->{$command};
+ my $args_number = scalar(@{$expanded_macro->{'args'}}) -1;
+ my $arguments = [];
+ if ($line =~ s/^\s*{[^\S\f]*//) { # macro with args
+ ($arguments, $line, $line_nr) =
+ _expand_macro_arguments($self, $expanded_macro, $line,
$line_nr);
+ } elsif (($args_number >= 2) or ($args_number <1)) {
+ # as agreed on the bug-texinfo mailing list, no warn when zero
+ # arg and not called with {}.
+ $self->line_warn(sprintf($self->__(
+ "address@hidden defined with zero or more than one argument should be
invoked with {}"),
+
$command), $line_nr)
+ if ($args_number >= 2);
+ } else {
+ if ($line !~ /\n/) {
+ ($line, $line_nr) = _new_line($self, $line_nr,
$expanded_macro);
+ $line = '' if (!defined($line));
+ }
+ $line =~ s/^[^\S\f]*// if ($line =~ /[\S\f]/);
+ my $has_end_of_line = chomp $line;
+ $arguments = [$line];
+ $line = "\n" if ($has_end_of_line);
+ }
+ my $expanded = _expand_macro_body ($self, $expanded_macro,
+
$arguments, $line_nr);
+ print STDERR "MACROBODY: $expanded".'||||||'."\n"
+ if ($self->{'DEBUG'});
+ # empty result. It is ignored here.
+ if ($expanded eq '') {
+ next;
+ }
+ if ($self->{'MAX_MACRO_CALL_NESTING'}
+ and scalar(@{$self->{'macro_stack'}}) >
$self->{'MAX_MACRO_CALL_NESTING'}) {
+ $self->line_warn(sprintf($self->__(
+"macro call nested too deeply (set MAX_NESTED_MACROS to override; current
value %d)"),
+
$self->{'MAX_MACRO_CALL_NESTING'}), $line_nr);
+ next;
+ }
+ if ($expanded_macro->{'cmdname'} eq 'macro') {
+ my $found = 0;
+ foreach my $macro (@{$self->{'macro_stack'}}) {
+ if ($macro->{'args'}->[0]->{'text'} eq $command) {
+ $self->line_error(sprintf($self->__(
+ "recursive call of macro %s is not allowed; use
address@hidden if needed"),
+
$command), $line_nr);
+ $found = 1;
+ last;
+ }
+ }
+ next if ($found);
+ }
+
+ unshift @{$self->{'macro_stack'}}, $expanded_macro;
+ print STDERR "UNSHIFT MACRO_STACK:
$expanded_macro->{'args'}->[0]->{'text'}\n"
+ if ($self->{'DEBUG'});
+ my $expanded_lines = _text_to_lines($expanded);
+ chomp ($expanded_lines->[-1]);
+ pop @$expanded_lines if ($expanded_lines->[-1] eq '');
+ print STDERR "MACRO EXPANSION LINES: ".join('|',
@$expanded_lines)
+
."|\nEND LINES MACRO EXPANSION\n" if ($self->{'DEBUG'});
+ next if (address@hidden);
+ my $new_lines = _complete_line_nr($expanded_lines,
+ $line_nr->{'line_nr'},
$line_nr->{'file_name'},
+
$expanded_macro->{'args'}->[0]->{'text'}, 1);
+ $line_nr->{'end_macro'} = 1;
+ unshift @{$self->{'input'}->[0]->{'pending'}}, [$line,
$line_nr];
+ my $new_text = shift @$new_lines;
+ ($line, $line_nr) = ($new_text->[0], $new_text->[1]);
+ unshift @{$self->{'input'}->[0]->{'pending'}}, @$new_lines;
+
+ # Now handle all the cases that may lead to command closing
+ # or following character association with an @-command, especially
+ # accent command, that is handle @-command with braces that don't
+ # always need a brace.
+
+ # The condition below is only caught right after command opening,
+ # otherwise we are in the 'args' and not right in the command
container.
+ } elsif ($current->{'cmdname'} and
+ (defined($brace_commands{$current->{'cmdname'}}) or
+ $self->{'definfoenclose'}->{$current->{'cmdname'}})
+ and $line !~ /^{/) {
+ # special case for @-command as argument of @itemize or
@*table.
+ if (_command_with_command_as_argument($current->{'parent'})) {
+ delete $current->{'contents'};
+ print STDERR "FOR PARENT
address@hidden>{'parent'}->{'parent'}->{'cmdname'} command_as_argument
$current->{'cmdname'}\n" if ($self->{'DEBUG'});
+ $current->{'type'} = 'command_as_argument' if
(!$current->{'type'});
+
$current->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
+ = $current;
+ $current = $current->{'parent'};
+ # now accent commands
+ } elsif ($accent_commands{$current->{'cmdname'}}) {
+ if ($line =~ /^[^\S\r\n]/) {
+ if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
+ $line =~ s/^([^\S\r\n]+)//;
+ $current->{'extra'}->{'spaces'} = ''
+ if (!defined($current->{'extra'}->{'spaces'}));
+ $current->{'extra'}->{'spaces'} .= $1;
+ } else {
+ $self->line_warn(sprintf($self->
+ __("accent command address@hidden' must not be
followed by whitespace"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ }
+ } elsif ($line =~ /^\@/) {
+ $self->line_error(sprintf($self->
+ __("use braces to give a command as an argument to
address@hidden"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ } elsif ($line =~ s/^(.)//o) {
+ print STDERR "ACCENT address@hidden>{'cmdname'}\n"
+ if ($self->{'DEBUG'});
+ my $following_arg = {'type' => 'following_arg',
+ 'parent' =>
$current};
+ $following_arg->{'contents'} = [{ 'text' => $1,
+
'parent' => $following_arg } ];
+ $current->{'args'} = [ $following_arg ];
+ if ($current->{'cmdname'} eq 'dotless' and $1 ne 'i'
and $1 ne 'j') {
+ $self->line_error(sprintf($self->
+ __("%c%s expects `i' or `j' as argument, not
`%s'"),
+ ord('@'), $current->{'cmdname'}, $1),
$line_nr);
+ }
+ if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
+ $current->{'args'}->[-1]->{'type'} =
'space_command_arg';
+ }
+ delete $current->{'contents'};
+ $current = $current->{'parent'};
+ } else { # The accent is at end of line
+ # whitespace for commands with letter.
+ print STDERR "STRANGE ACC
address@hidden>{'cmdname'}\n" if ($self->{'DEBUG'});
+ $self->line_warn(sprintf($self->
+ __("accent command address@hidden' must not be
followed by new line"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ }
+ next;
+ } else {
+ # ignore space after a braced @-command like TeX does
+ if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
+ and $line =~ s/^\s+//) {
+ next;
+ }
+ $self->line_error(sprintf($self->__("address@hidden
expected braces"),
+ $current->{'cmdname'}),
$line_nr);
+ $current = $current->{'parent'};
+ }
+ # maybe a menu entry beginning: a * at the beginning of a menu line
+ } elsif ($line =~ /^\*/ and $current->{'type'}
+ and $current->{'type'} eq 'preformatted'
+ and $current->{'parent'}->{'type'}
+ and ($current->{'parent'}->{'type'} eq
'menu_comment'
+ or $current->{'parent'}->{'type'} eq
'menu_entry_description')
+ and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'empty_line'
+ and $current->{'contents'}->[-1]->{'text'} eq
'') {
+ print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
+ _abort_empty_line($self, $current);
+ $line =~ s/^\*//;
+ push @{$current->{'contents'}}, { 'type' => 'menu_star',
+
'text' => '*' };
+ # a space after a * at the beginning of a menu line
+ } elsif ($line =~ /^\s+/ and $current->{'contents'}
+ and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'menu_star') {
+ print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
+ # this is the menu star collected previously
+ pop @{$current->{'contents'}};
+ $line =~ s/^(\s+)//;
+ my $leading_text = '*' . $1;
+ if ($current->{'type'} eq 'preformatted'
+ and $current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq 'menu_comment') {
+ my $menu = $current->{'parent'}->{'parent'};
+ if (address@hidden>{'contents'}}) {
+ pop @{$current->{'parent'}->{'contents'}};
+ if (!scalar(@{$current->{'parent'}->{'contents'}})) {
+ pop @{$menu->{'contents'}};
+ }
+ }
+ $current = $menu;
+ #print STDERR "Close MENU_COMMENT because new menu
entry\n";
+ } else {
+ # first parent preformatted, third is menu_entry
+ if ($current->{'type'} ne 'preformatted'
+ or $current->{'parent'}->{'type'} ne
'menu_entry_description'
+ or $current->{'parent'}->{'parent'}->{'type'} ne
'menu_entry'
+ or
!$menu_commands{$current->{'parent'}->{'parent'}->{'parent'}->{'cmdname'}}) {
+ $self->_bug_message("Not in menu comment nor
description",
+ $line_nr,
$current);
+ }
+ $current = $current->{'parent'}->{'parent'}->{'parent'};
+ }
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'preformatted') {
+ $self->_bug_message("context $context instead of
preformatted after menu leading star",
+ $line_nr,
$current);
+ }
+ push @{$current->{'contents'}}, { 'type' => 'menu_entry',
+
'parent' => $current,
+
};
+ $current = $current->{'contents'}->[-1];
+ $current->{'args'} = [ { 'type' => 'menu_entry_leading_text',
+ 'text' =>
$leading_text,
+ 'parent' =>
$current },
+ { 'type' =>
'menu_entry_name',
+ 'contents'
=> [],
+ 'parent' =>
$current } ];
+ $current = $current->{'args'}->[-1];
+ # * followed by something else than a space.
+ } elsif ($current->{'contents'} and @{$current->{'contents'}}
+ and $current->{'contents'}->[-1]->{'type'}
+ and $current->{'contents'}->[-1]->{'type'} eq
'menu_star') {
+ print STDERR "ABORT MENU STAR ($line)\n" if ($self->{'DEBUG'});
+ delete $current->{'contents'}->[-1]->{'type'};
+ # after a separator in menu
+ } elsif ($current->{'args'} and @{$current->{'args'}}
+ and $current->{'args'}->[-1]->{'type'}
+ and $current->{'args'}->[-1]->{'type'} eq
'menu_entry_separator') {
+ my $separator = $current->{'args'}->[-1]->{'text'};
+ # separator is ::, we concatenate and let the while restart
+ # in order to collect spaces below
+ if ($separator eq ':' and $line =~ s/^(:)//) {
+ $current->{'args'}->[-1]->{'text'} .= $1;
+ # a . not followed by a space. Not a separator.
+ } elsif ($separator eq '.' and $line =~ /^\S/) {
+ pop @{$current->{'args'}};
+ $current = $current->{'args'}->[-1];
+ $current = _merge_text($self, $current, $separator);
+ # here we collect spaces following separators.
+ } elsif ($line =~ s/^([^\S\r\n]+)//) {
+ # FIXME a trailing end of line could be considered to be
part
+ # of the separator. Right now it is part of the
description,
+ # since it is catched (in the next while) as one of the
case below
+ $current->{'args'}->[-1]->{'text'} .= $1;
+ # now handle the menu part that was closed
+ } elsif ($separator =~ /^::/) {
+ print STDERR "MENU NODE no entry $separator\n" if
($self->{'DEBUG'});
+ # it was previously registered as menu_entry_name, it is
+ # changed to node
+ $current->{'args'}->[-2]->{'type'} = 'menu_entry_node';
+ $current = _enter_menu_entry_node($self, $current,
$line_nr);
+ # end of the menu entry name
+ } elsif ($separator =~ /^:/) {
+ print STDERR "MENU ENTRY $separator\n" if
($self->{'DEBUG'});
+ push @{$current->{'args'}}, { 'type' => 'menu_entry_node',
+
'contents' => [],
+
'parent' => $current };
+ $current = $current->{'args'}->[-1];
+ # anything else is the end of the menu node following a
menu_entry_name
+ } else {
+ print STDERR "MENU NODE $separator\n" if
($self->{'DEBUG'});
+ $current = _enter_menu_entry_node($self, $current,
$line_nr);
+ }
+ # REMACRO
+ } elsif ($line =~
s/^\@(["'address@hidden,\.!\?\s\*\-\^`=:\|\/\\])//o
+ or $line =~ s/^\@([[:alnum:]][[:alnum:]-]*)//o) {
+ my $command = $1;
+ my $alias_command;
+ if (exists($self->{'aliases'}->{$command})) {
+ $alias_command = $command;
+ $command = $self->{'aliases'}->{$command};
+ }
+ print STDERR "COMMAND $command\n" if ($self->{'DEBUG'});
+
+
+ if ($command eq 'value') {
+ $line =~ s/^\s*//
+ if
($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'});
+ # REVALUE
+ if ($line =~ s/^{([\w\-][^\s{\\}~`\^+"<>|@]*)}//) {
+ my $value = $1;
+ if (exists($self->{'values'}->{$value})) {
+ if (!defined($self->{'values'}->{$value})) {
+ print STDERR "BUG? $value exists but not
defined\n";
+ } elsif (!ref($self->{'values'}->{$value})) {
+ $line = $self->{'values'}->{$value} . $line;
+ # the push @{$current->{'contents'}}, {}; prevents
a trailing
+ # text to be merged, to avoid having the value
tree modified.
+ } elsif (ref($self->{'values'}->{$value}) eq
'ARRAY') {
+ # we don't know for sure, but if we don't do
it here it
+ # won't be done
+ _abort_empty_line($self, $current);
+ foreach my $content
(@{$self->{'values'}->{$value}}) {
+ push @{$current->{'contents'}}, $content;
+ }
+ push @{$current->{'contents'}}, {};
+ } elsif (ref($self->{'values'}->{$value}) eq
'HASH') {
+ # we don't know for sure, but if we don't do
it here it
+ # won't be done
+ _abort_empty_line($self, $current);
+ my $content = $self->{'values'}->{$value};
+ push @{$current->{'contents'}}, $content;
+ push @{$current->{'contents'}}, {};
+ }
+ } else {
+ # caller should expand something along
+ # gdt('@{No value for `{value}\'@}', {'value' =>
$value}, {'keep_texi'=> 1});
+ push @{$current->{'contents'}}, { 'cmdname' =>
'value',
+
'type' => $value };
+ $self->line_warn(
+ sprintf($self->__("undefined flag: %s"),
$value), $line_nr);
+ }
+ } else {
+ $self->line_error($self->__("bad syntax for
address@hidden"), $line_nr);
+ }
+ next;
+ }
+
+ if (defined($deprecated_commands{$command})) {
+ if ($deprecated_commands{$command} eq '') {
+ $self->line_warn(sprintf($self->__("%c%s is
obsolete."),
+ ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_warn(sprintf($self->__("%c%s is obsolete;
%s"),
+ ord('@'), $command,
+
$self->__($deprecated_commands{$command})), $line_nr);
+ }
+ }
+
+ if (not _abort_empty_line($self, $current)
+ and $begin_line_commands{$command}) {
+ $self->line_warn(
+ sprintf($self->__("address@hidden should only
appear at a line beginning"),
+ $command), $line_nr);
+ }
+
+ my $invalid_parent;
+ # error messages for forbidden constructs, like @node in @r,
+ # block command on line command, @xref in @anchor or node...
+ if ($current->{'parent'}) {
+ if ($current->{'parent'}->{'cmdname'}) {
+ if
(defined($self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}})
+ and
!$self->{'valid_nestings'}->{$current->{'parent'}->{'cmdname'}}->{$command}
+ # we make sure that we are on a root @-command
line and
+ # not in contents
+ and
(!$root_commands{$current->{'parent'}->{'cmdname'}}
+ or ($current->{'type'}
+ and $current->{'type'} eq
'misc_line_arg'))
+ # we make sure that we are on a block
@-command line and
+ # not in contents
+ and
(!($block_commands{$current->{'parent'}->{'cmdname'}})
+ or ($current->{'type'}
+ and $current->{'type'} eq
'block_line_arg'))
+ # we make sure that we are on an @item/@itemx
line and
+ # not in an @enumerate, @multitable or
@itemize @item.
+ and (($current->{'parent'}->{'cmdname'} ne
'itemx'
+ and
$current->{'parent'}->{'cmdname'} ne 'item')
+ or ($current->{'type'}
+ and
$current->{'type'} eq 'misc_line_arg'))) {
+ $invalid_parent =
$current->{'parent'}->{'cmdname'};
+ }
+ } elsif ($self->{'context_stack'}->[-1] eq 'def'
+ # FIXME instead of hardcoding
in_full_line_commands_no_refs
+ # it would be better to use the parent command
valid_nesting.
+ and
!$in_full_line_commands_no_refs{$command}) {
+ my $def_block = $current;
+ while ($def_block->{'parent'} and
(!$def_block->{'parent'}->{'type'}
+ or
$def_block->{'parent'}->{'type'} ne 'def_line')) {
+ $def_block = $def_block->{'parent'};
+ }
+
+ $invalid_parent =
$def_block->{'parent'}->{'parent'}->{'cmdname'};
+ }
+ }
+
+ # special case with @ followed by a newline protecting end of
lines
+ # in @def*
+ last if ($self->{'context_stack'}->[-1] eq 'def' and $command
eq "\n");
+
+ unless ($self->{'no_paragraph_commands'}->{$command}) {
+ my $paragraph = _begin_paragraph($self, $current,
$line_nr);
+ $current = $paragraph if ($paragraph);
+ }
+
+ if ($self->{'close_paragraph_commands'}->{$command}) {
+ $current = _end_paragraph($self, $current, $line_nr);
+ }
+ if ($self->{'close_preformatted_commands'}->{$command}) {
+ $current = _end_preformatted($self, $current, $line_nr);
+ }
+
+ # commands without braces and not block commands, ie no @end
+ if (defined($self->{'misc_commands'}->{$command})) {
+ if ($root_commands{$command} or $command eq 'bye') {
+ $current = _close_commands($self, $current, $line_nr,
undef,
+
$command);
+ # root_level commands leads to setting a new root
+ # for the whole document and stuffing the preceding
text
+ # as the first content, this is done only once.
+ if ($current->{'type'} and $current->{'type'} eq
'text_root') {
+ if ($command ne 'bye') {
+ $root = { 'type' => 'document_root',
'contents' => [$current] };
+ $current->{'parent'} = $root;
+ $current = $root;
+ }
+ } else {
+ die if (!defined($current->{'parent'}));
+ $current = $current->{'parent'};
+ }
+ }
+
+ # noarg skipline skipspace text line lineraw /^\d$/
+ my $arg_spec = $self->{'misc_commands'}->{$command};
+ my $misc;
+
+ if ($arg_spec eq 'noarg') {
+ my $ignored = 0;
+ my $only_in_headings = 0;
+ if ($command eq 'insertcopying') {
+ my $parent = $current;
+ while ($parent) {
+ if ($parent->{'cmdname'} and
$parent->{'cmdname'} eq 'copying') {
+ $self->line_error(
+ sprintf($self->__("address@hidden
not allowed inside address@hidden' block"),
+ $command,
$parent->{'cmdname'}), $line_nr);
+ $ignored = 1;
+ last;
+ }
+ $parent = $parent->{'parent'};
+ }
+ } elsif ($in_heading_commands{$command}) {
+ $self->line_error(
+ sprintf($self->__("address@hidden should only
appear in heading or footing"),
+ $command), $line_nr);
+ $only_in_headings = 1;
+ }
+ if (!$ignored) {
+ $misc = {'cmdname' => $command,
+ 'parent' => $current};
+ push @{$current->{'contents'}}, $misc;
+ # also sets invalid_nesting in that case
+ $misc->{'extra'}->{'invalid_nesting'} = 1 if
($only_in_headings);
+ $self->_register_global_command($command, $misc,
$line_nr);
+ }
+ $self->_mark_and_warn_invalid($command,
$invalid_parent,
+
$line_nr, $misc);
+ $current = $self->_begin_preformatted($current)
+ if ($close_preformatted_commands{$command});
+
+ # all the cases using the raw line
+ } elsif ($arg_spec eq 'skipline' or $arg_spec eq 'lineraw'
+ or $arg_spec eq 'special') {
+ # complete the line if there was a user macro expansion
+ if ($line !~ /\n/) {
+ my ($new_line, $new_line_nr) = _new_line($self,
$line_nr, undef);
+ $line .= $new_line if (defined($new_line));
+ }
+ $misc = {'cmdname' => $command,
+ 'parent' => $current};
+ my $args = [];
+ my $has_comment;
+ if ($arg_spec eq 'lineraw' or $arg_spec eq 'skipline')
{
+ $args = [ $line ];
+ } elsif ($arg_spec eq 'special') {
+ ($args, $has_comment)
+ = $self->_parse_special_misc_command($line,
$command, $line_nr);
+ $misc->{'extra'}->{'arg_line'} = $line;
+ }
+
+ # if using the @set txi* instead of a proper
@-command, replace
+ # by the tree obtained with the @-command. Even though
+ # _end_line is called below, as $current is not
misc_line_arg
+ # there should not be anything done in addition than
what is
+ # done for @clear or @set.
+ if (($command eq 'set' or $command eq 'clear')
+ and scalar(@$args) >= 1
+ and
$set_flag_command_equivalent{$args->[0]}) {
+ my $arg;
+ if ($command eq 'set') {
+ $arg = 'on';
+ } else {
+ $arg = 'off';
+ }
+ $command =
$set_flag_command_equivalent{$args->[0]};
+ $misc = {'cmdname' => $command,
+ 'parent' => $current,
+ 'line_nr' => $line_nr,
+ 'extra' => {'misc_args' =>
[$arg]}};
+ my $misc_line_args = {'type' => 'misc_line_arg',
+ 'parent' => $misc};
+ $misc->{'args'} = [$misc_line_args];
+ my $spaces_after_command
+ = { 'type' => 'empty_spaces_after_command',
+ 'text' => ' ',
+ 'parent' => $misc_line_args,
+ 'extra' => {'command' => $misc} };
+ $misc->{'extra'}->{'spaces_after_command'}
+ = $spaces_after_command;
+ $misc_line_args->{'contents'} = [
$spaces_after_command,
+ { 'text' => $arg,
+ 'parent' => $misc_line_args, },
+ { 'text' => "\n",
+ 'parent' => $misc_line_args,
+ 'type' => 'spaces_at_end', } ];
+ push @{$current->{'contents'}}, $misc;
+ } else {
+ push @{$current->{'contents'}}, $misc;
+ foreach my $arg (@$args) {
+ push @{$misc->{'args'}},
+ { 'type' => 'misc_arg', 'text' => $arg,
+ 'parent' =>
$current->{'contents'}->[-1] };
+ }
+ $misc->{'extra'}->{'misc_args'} = $args
+ if (scalar(@$args) and $arg_spec ne
'skipline');
+ }
+ if (! _ignore_global_commands($self)) {
+ if ($command eq 'raisesections') {
+ $self->{'sections_level'}++;
+ } elsif ($command eq 'lowersections') {
+ $self->{'sections_level'}--;
+ } elsif ($command eq 'novalidate') {
+ $self->{'novalidate'} = 1;
+ }
+ }
+ $self->_mark_and_warn_invalid($command,
$invalid_parent,
+
$line_nr, $misc);
+ $self->_register_global_command($command, $misc,
$line_nr);
+ # the end of line is ignored for special commands
+ if ($arg_spec ne 'special' or !$has_comment) {
+ $current = _end_line($self, $current, $line_nr);
+ }
+
+ last NEXT_LINE if ($command eq 'bye');
+ # Even if _end_line is called, it is not done since
there is
+ # no misc_line_arg
+ $current = $self->_begin_preformatted($current)
+ if ($close_preformatted_commands{$command});
+ last;
+ } else {
+ # $arg_spec is text, line, skipspace or a number
+ my $line_arg = 0;
+ $line_arg = 1 if ($arg_spec ne 'skipspace');
+ if ($command eq 'item' or $command eq 'itemx'
+ or $command eq 'headitem' or $command eq 'tab') {
+ my $parent;
+ # itemize or enumerate
+ if ($parent = _item_container_parent($current)) {
+ if ($command eq 'item') {
+ print STDERR "ITEM_CONTAINER\n" if
($self->{'DEBUG'});
+ $parent->{'items_count'}++;
+ $misc = { 'cmdname' => $command, 'parent'
=> $parent,
+ 'contents' => [],
+ 'extra' =>
+ {'item_number' =>
$parent->{'items_count'}} };
+ push @{$parent->{'contents'}}, $misc;
+ $current = $parent->{'contents'}->[-1];
+ } else {
+ $self->line_error(sprintf($self->__(
+
"address@hidden not meaningful inside address@hidden' block"),
+
$command, $parent->{'cmdname'}), $line_nr);
+ }
+ $current =
$self->_begin_preformatted($current);
+ # *table
+ } elsif ($parent = _item_line_parent($current)) {
+ if ($command eq 'item' or $command eq 'itemx')
{
+ print STDERR "ITEM_LINE\n" if
($self->{'DEBUG'});
+ $current = $parent;
+ $self->_gather_previous_item($current,
$command, $line_nr);
+ $misc = { 'cmdname' => $command, 'parent'
=> $current };
+ push @{$current->{'contents'}}, $misc;
+ # since in the %misc_commands hash the
entry for those
+ # commands is 'skipspace' we set $line_arg
here.
+ $line_arg = 1;
+ } else {
+ $self->line_error(sprintf($self->__(
+
"address@hidden not meaningful inside address@hidden' block"),
+
$command, $parent->{'cmdname'}), $line_nr);
+ $current =
$self->_begin_preformatted($current);
+ }
+ # multitable
+ } elsif ($parent =
_item_multitable_parent($current)) {
+ if ($command eq 'item' or $command eq
'headitem'
+ or $command eq 'tab') {
+ if (!$parent->{'extra'}->{'max_columns'}) {
+ $self->line_warn(
+
sprintf($self->__("address@hidden in empty multitable"),
+ $command),
$line_nr);
+ } elsif ($command eq 'tab') {
+ my $row = $parent->{'contents'}->[-1];
+ die if (!$row->{'type'});
+ if ($row->{'type'} eq 'before_item') {
+
$self->line_error($self->__("address@hidden before address@hidden"), $line_nr);
+ } elsif ($row->{'cells_count'} >=
$parent->{'extra'}->{'max_columns'}) {
+
$self->line_error(sprintf($self->__(
+ "too many columns
in multitable item (max %d)"),
+
$parent->{'extra'}->{'max_columns'}), $line_nr);
+ } else {
+ $row->{'cells_count'}++;
+ $misc = { 'cmdname' => $command,
+ 'parent' =>
$row,
+ 'contents' =>
[],
+ 'extra' =>
+ {'cell_number' =>
$row->{'cells_count'}} };
+ push @{$row->{'contents'}}, $misc;
+ $current =
$row->{'contents'}->[-1];
+ #$current =
$self->_begin_preformatted($current);
+ print STDERR "TAB\n" if
($self->{'DEBUG'});
+ }
+ } else {
+ print STDERR "ROW\n" if
($self->{'DEBUG'});
+ $parent->{'rows_count'}++;
+ my $row = { 'type' => 'row',
'contents' => [],
+ 'cells_count'
=> 1,
+ 'extra' =>
{'row_number' => $parent->{'rows_count'} },
+ 'parent' =>
$parent };
+ push @{$parent->{'contents'}}, $row;
+ $misc = { 'cmdname' => $command,
+ 'parent' => $row,
+ 'contents' => [],
+ 'extra' =>
{'cell_number' => 1}};
+ push @{$row->{'contents'}}, $misc;
+ $current = $row->{'contents'}->[-1];
+ }
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden not
meaningful inside address@hidden' block"),
+ $command,
$parent->{'cmdname'}), $line_nr);
+ }
+ $current =
$self->_begin_preformatted($current);
+ } elsif ($command eq 'tab') {
+ $self->line_error($self->__(
+ "ignoring address@hidden
outside of multitable"), $line_nr);
+ $current =
$self->_begin_preformatted($current);
+ } else {
+ $self->line_error (sprintf($self->__(
+ "address@hidden outside of table or
list"), $command), $line_nr);
+ $current =
$self->_begin_preformatted($current);
+ }
+ $misc->{'line_nr'} = $line_nr if (defined($misc));
+ } else {
+ $misc = { 'cmdname' => $command, 'parent' =>
$current,
+ 'line_nr' => $line_nr };
+ push @{$current->{'contents'}}, $misc;
+ if ($self->{'sections_level'} and
$root_commands{$command}
+ and $command ne 'node' and $command ne
'part') {
+
$current->{'contents'}->[-1]->{'extra'}->{'sections_level'}
+ = $self->{'sections_level'};
+ }
+ # def*x
+ if ($def_commands{$command}) {
+ my $base_command = $command;
+ $base_command =~ s/x$//;
+ # check that the def*x is first after @def*,
no paragraph
+ # in-between.
+ my $after_paragraph = _check_no_text($current);
+ push @{$self->{'context_stack'}}, 'def';
+ $current->{'contents'}->[-1]->{'type'} =
'def_line';
+ $current->{'contents'}->[-1]->{'extra'} =
+ {'def_command' => $base_command,
+ 'original_def_cmdname' => $command};
+ if ($current->{'cmdname'}
+ and $current->{'cmdname'} eq
$base_command) {
+ pop @{$current->{'contents'}};
+ _gather_def_item($current, $command);
+ push @{$current->{'contents'}}, $misc;
+ }
+ if (!$current->{'cmdname'}
+ or $current->{'cmdname'} ne
$base_command
+ or $after_paragraph) {
+ $self->line_error(sprintf($self->__(
+
"must be after address@hidden' to use address@hidden'"),
+
$base_command, $command), $line_nr);
+
$current->{'contents'}->[-1]->{'extra'}->{'not_after_command'} = 1;
+ }
+ }
+ }
+ # a container for what is on the @-command line,
considered to
+ # be the @-command argument
+ if ($line_arg) {
+ $current = $current->{'contents'}->[-1];
+ $current->{'args'} = [{ 'type' => 'misc_line_arg',
+
'contents' => [],
+
'parent' => $current }];
+ # @node is the only misc command with args
separated with comma
+ # FIXME a 3 lingering here deep into the code may
not
+ # be very wise... However having a hash only for
one @-command
+ # is not very appealing either...
+ if ($command eq 'node') {
+ $current->{'remaining_args'} = 3;
+ } elsif ($command eq 'author') {
+ my $parent = $current;
+ my $found;
+ while ($parent->{'parent'}) {
+ $parent = $parent->{'parent'};
+ last if ($parent->{'type'}
+ and $parent->{'type'} eq
'brace_command_context');
+ if ($parent->{'cmdname'}) {
+ if ($parent->{'cmdname'} eq
'titlepage') {
+ push
@{$self->{'extra'}->{'author'}}, $current;
+ $current->{'extra'}->{'titlepage'}
= $parent;
+ $found = 1;
+ } elsif ($parent->{'cmdname'} eq
'quotation' or
+ $parent->{'cmdname'} eq
'smallquotation') {
+ push
@{$parent->{'extra'}->{'authors'}}, $current;
+ $current->{'extra'}->{'quotation'}
= $parent;
+ $found = 1;
+ }
+ last if ($found);
+ }
+ }
+ if (!$found) {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden not meaningful outside
address@hidden' and address@hidden' environments"),
+ $command),
$current->{'line_nr'});
+ }
+ } elsif ($command eq 'dircategory' and
$self->{'current_node'}) {
+ $self->line_warn($self->__("address@hidden
after first node"),
+ $line_nr);
+ }
+
+ $current = $current->{'args'}->[-1];
+ push @{$self->{'context_stack'}}, 'line'
+ unless ($def_commands{$command});
+ }
+ $line = _start_empty_line_after_command($line,
$current, $misc);
+ }
+ $self->_mark_and_warn_invalid($command, $invalid_parent,
+
$line_nr, $misc);
+
+ $self->_register_global_command($command, $misc, $line_nr);
+ if ($command eq 'dircategory'
+ and ! _ignore_global_commands($self)) {
+ push @{$self->{'info'}->{'dircategory_direntry'}},
$misc;
+ }
+ # @-command with matching @end opening
+ } elsif (exists($block_commands{$command})) {
+ if ($command eq 'macro' or $command eq 'rmacro') {
+ my $macro = _parse_macro_command_line($self, $command,
$line,
+ $current,
$line_nr);
+ push @{$current->{'contents'}}, $macro;
+ $self->_mark_and_warn_invalid($command,
$invalid_parent,
+
$line_nr, $current->{'contents'}->[-1]);
+ $current = $current->{'contents'}->[-1];
+ last;
+ } elsif ($block_commands{$command} eq 'conditional') {
+ my $ifvalue_true = 0;
+ if ($command eq 'ifclear' or $command eq 'ifset') {
+ # REVALUE
+ if ($line =~
/^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
+ my $name = $1;
+ if ((exists($self->{'values'}->{$name}) and
$command eq 'ifset')
+ or
(!exists($self->{'values'}->{$name})
+ and $command eq 'ifclear')) {
+ $ifvalue_true = 1;
+ }
+ print STDERR "CONDITIONAL address@hidden
$name: $ifvalue_true\n" if ($self->{'DEBUG'});
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ }
+ } elsif ($command eq 'ifcommanddefined'
+ or $command eq
'ifcommandnotdefined') {
+ # REMACRO
+ if ($line =~
/^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
+ my $name = $1;
+ my $command_is_defined = (
+
exists($Texinfo::Common::all_commands{$name})
+ or $self->{'macros'}->{$name}
+ or $self->{'definfoenclose'}->{$name}
+ or $self->{'aliases'}->{$name}
+ or $self->{'command_index_prefix'}->{$name}
+ );
+ if (($command_is_defined
+ and $command eq 'ifcommanddefined')
+ or (! $command_is_defined
+ and $command eq
'ifcommandnotdefined')) {
+ $ifvalue_true = 1;
+ }
+ print STDERR "CONDITIONAL address@hidden
$name: $ifvalue_true\n" if ($self->{'DEBUG'});
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ }
+ } elsif ($command =~ /^ifnot(.*)/) {
+ $ifvalue_true = 1 if
!($self->{'expanded_formats_hash'}->{$1}
+ # exception as explained in the
texinfo manual
+ or ($1 eq 'info'
+ and
$self->{'expanded_formats_hash'}->{'plaintext'}));
+ print STDERR "CONDITIONAL address@hidden format
$1: $ifvalue_true\n" if ($self->{'DEBUG'});
+ } else {
+ die unless ($command =~ /^if(.*)/);
+ $ifvalue_true = 1 if
($self->{'expanded_formats_hash'}->{$1}
+ or ($1 eq 'info'
+ and
$self->{'expanded_formats_hash'}->{'plaintext'}));
+ print STDERR "CONDITIONAL address@hidden format
$1: $ifvalue_true\n" if ($self->{'DEBUG'});
+ }
+ if ($ifvalue_true) {
+ push @{$self->{'conditionals_stack'}}, $command;
+ } else {
+ push @{$current->{'contents'}}, { 'cmdname' =>
$command,
+
'parent' => $current,
+
'contents' => [] };
+ $current = $current->{'contents'}->[-1];
+ }
+ # FIXME(Karl) ignore what is remaining on the line, to
eat
+ # the end of line?
+ last;
+ } else {
+ my $block;
+ # a menu command closes a menu_comment, but not the
other
+ # block commands. This won't catch menu commands
buried in
+ # other formats (that are incorrect anyway).
+ if ($menu_commands{$command} and $current->{'type'}
+ and ($current->{'type'} eq 'menu_comment'
+ or $current->{'type'} eq
'menu_entry_description')) {
+
+ my $menu;
+
+ $menu = $current->{'parent'};
+ pop @{$menu->{'contents'}}
+ if (address@hidden>{'contents'}});
+
+ my $context = pop @{$self->{'context_stack'}};
+ if ($context ne 'preformatted') {
+ $self->_bug_message("context $context instead
of preformatted in new menu",
+
$line_nr, $current);
+ }
+
+ if ($menu->{'type'} and $menu->{'type'} eq
'menu_entry') {
+ $menu = $menu->{'parent'};
+ }
+
+ $current = $menu;
+ }
+ # the def command holds a line_def* which corresponds
with the
+ # definition line. This allows to have a treatement
similar
+ # with def*x.
+ if ($def_commands{$command}) {
+ push @{$self->{'context_stack'}}, 'def';
+ $block = { 'parent' => $current,
+ 'cmdname' => $command,
+ 'contents' => [] };
+ push @{$current->{'contents'}}, $block;
+ $current = $current->{'contents'}->[-1];
+ push @{$current->{'contents'}}, {
+
'type' => 'def_line',
+
'parent' => $current,
+
'line_nr' => $line_nr,
+
'extra' =>
+
{'def_command' => $command,
+
'original_def_cmdname' => $command}
+
};
+ } else {
+ $block = { 'cmdname' => $command,
+ 'parent' => $current,
+ 'contents' => [] };
+ push @{$current->{'contents'}}, $block;
+ }
+ $current = $current->{'contents'}->[-1];
+
+ if ($block_arg_commands{$command}) {
+ if ($preformatted_commands{$command}) {
+ push @{$self->{'context_stack'}},
'preformatted';
+ } elsif ($format_raw_commands{$command}) {
+ push @{$self->{'context_stack'}},
'rawpreformatted';
+ if
($self->{'expanded_formats_hash'}->{$command}
+ and
$self->{'expanded_formats_stack'}->[-1]) {
+ push @{$self->{'expanded_formats_stack'}},
$command;
+ } else {
+ push @{$self->{'expanded_formats_stack'}},
0;
+ }
+ }
+ if ($region_commands{$command}) {
+ if (@{$self->{'regions_stack'}}) {
+ $self->line_error(
+ sprintf($self->__("region %s inside region %s is
not allowed"),
+ $command,
$self->{'regions_stack'}->[-1]->{'cmdname'}),
+
$line_nr);
+ }
+ push @{$self->{'regions_stack'}}, $block;
+ }
+ if ($menu_commands{$command}) {
+ if ($self->{'context_stack'}->[-1] eq
'preformatted') {
+ push @{$self->{'context_stack'}},
'preformatted';
+ } else {
+ push @{$self->{'context_stack'}}, 'menu';
+ }
+ if (! _ignore_global_commands($self)) {
+ push
@{$self->{'info'}->{'dircategory_direntry'}}, $block
+ if ($command eq 'direntry');
+ if ($self->{'current_node'}) {
+ if ($command eq 'direntry') {
+ if ($self->{'SHOW_MENU'}) {
+
$self->line_warn($self->__("address@hidden after first node"),
+ $line_nr);
+ }
+ } elsif ($command eq 'menu') {
+ push
@{$self->{'current_node'}->{'menus'}}, $current;
+ }
+ } elsif ($command ne 'direntry') {
+ if ($self->{'SHOW_MENU'}) {
+
$self->line_error(sprintf($self->__("address@hidden seen before first
address@hidden"),
+
$command), $line_nr);
+ $self->line_error($self->__(
+ "perhaps your address@hidden node should be wrapped in
address@hidden rather than address@hidden"),
+
$line_nr, 1);
+ }
+ if ($command eq 'menu') {
+ push
@{$self->{'info'}->{'unassociated_menus'}}, $current;
+ }
+ }
+ }
+ }
+ $current->{'args'} = [ {
+ 'type' => 'block_line_arg',
+ 'contents' => [],
+ 'parent' => $current } ];
+
+ $current->{'remaining_args'} =
$block_commands{$command} -1
+ if ($block_commands{$command} =~ /^\d+$/
+ and $block_commands{$command} -1 > 0);
+ $current = $current->{'args'}->[-1];
+ push @{$self->{'context_stack'}}, 'line'
+ unless ($def_commands{$command});
+ }
+ $block->{'line_nr'} = $line_nr;
+ $self->_mark_and_warn_invalid($command,
$invalid_parent,
+
$line_nr, $block);
+ $self->_register_global_command($command, $block,
$line_nr);
+
+ $line = _start_empty_line_after_command($line,
$current, $block);
+ }
+ } elsif (defined($brace_commands{$command})
+ or
defined($self->{'definfoenclose'}->{$command})) {
+
+ push @{$current->{'contents'}}, { 'cmdname' => $command,
+
'parent' => $current,
+
'contents' => [] };
+ $current->{'contents'}->[-1]->{'line_nr'} = $line_nr
+ if ($keep_line_nr_brace_commands{$command});
+ $self->_mark_and_warn_invalid($command, $invalid_parent,
+
$line_nr, $current->{'contents'}->[-1]);
+ $current = $current->{'contents'}->[-1];
+ if ($command eq 'click') {
+ $current->{'extra'}->{'clickstyle'} =
$self->{'clickstyle'};
+ } elsif ($command eq 'kbd') {
+ if ($self->{'context_stack'}->[-1] eq 'preformatted'
+ and $self->{'kbdinputstyle'} ne 'distinct') {
+ $current->{'extra'}->{'code'} = 1;
+ } elsif ($self->{'kbdinputstyle'} eq 'code'
+ or ($self->{'kbdinputstyle'} eq
'example'
+ and
$self->_in_code($current->{'parent'}))) {
+ $current->{'extra'}->{'code'} = 1;
+ }
+ }
+ if ($self->{'definfoenclose'}->{$command}) {
+ $current->{'type'} = 'definfoenclose_command';
+ $current->{'extra'} = {
+ 'begin' =>
$self->{'definfoenclose'}->{$command}->[0],
+ 'end' =>
$self->{'definfoenclose'}->{$command}->[1] };
+ }
+ } elsif (exists ($no_brace_commands{$command})) {
+ push @{$current->{'contents'}},
+ { 'cmdname' => $command, 'parent' =>
$current };
+ # FIXME generalize?
+ if ($command eq '\\' and $self->{'context_stack'}->[-1] ne
'math') {
+ $self->line_warn(sprintf($self->__("address@hidden
should only appear in math context"),
+
$command), $line_nr);
+ }
+ if ($command eq "\n") {
+ $current = _end_line($self, $current, $line_nr);
+ last;
+ }
+ } else {
+ $self->line_error(sprintf($self->__("unknown command
`%s'"),
+
$command), $line_nr);
+ }
+
+ } elsif ($line =~ s/^([{}@,:\t.\f])//) {
+ my $separator = $1;
+ print STDERR "SEPARATOR: $separator\n" if ($self->{'DEBUG'});
+ if ($separator eq '@') {
+ # this may happen with a @ at the very end of a file,
therefore
+ # not followed by anything.
+ $self->line_error($self->__("unexpected \@"), $line_nr);
+ } elsif ($separator eq '{') {
+ _abort_empty_line($self, $current);
+ if ($current->{'cmdname'}
+ and
(defined($brace_commands{$current->{'cmdname'}})
+ or
$self->{'definfoenclose'}->{$current->{'cmdname'}})) {
+ my $command = $current->{'cmdname'};
+ $current->{'args'} = [ { 'parent' => $current,
+
'contents' => [] } ];
+ $current->{'remaining_args'} =
$brace_commands{$command} -1
+ if ($brace_commands{$command} and
$brace_commands{$command} -1);
+ $current->{'line_nr'} = $line_nr if
($brace_commands{$command});
+ if ($self->{'definfoenclose'}->{$command}) {
+ $current->{'remaining_args'} = 0;
+ }
+ $current = $current->{'args'}->[-1];
+ if ($context_brace_commands{$command}) {
+ if ($command eq 'caption' or $command eq
'shortcaption') {
+ my $float;
+ if (!$current->{'parent'}->{'parent'}
+ or
!$current->{'parent'}->{'parent'}->{'cmdname'}
+ or
$current->{'parent'}->{'parent'}->{'cmdname'} ne 'float') {
+ $float = $current->{'parent'};
+ while ($float->{'parent'} and
!($float->{'cmdname'}
+
and $float->{'cmdname'} eq 'float')) {
+ $float = $float->{'parent'};
+ }
+ if (!($float->{'cmdname'} and
$float->{'cmdname'} eq 'float')) {
+ $self->line_error(sprintf($self->__(
+ "address@hidden is not
meaningful outside address@hidden' environment"),
+
$command), $line_nr);
+ $float = undef;
+ } else {
+ $self->line_warn(sprintf($self->__(
+
"address@hidden should be right below address@hidden'"),
+
$command), $line_nr);
+ }
+ } else {
+ $float = $current->{'parent'}->{'parent'};
+ }
+ if ($float) {
+ if ($float->{'extra'}->{$command}) {
+
$self->line_warn(sprintf($self->__("ignoring multiple address@hidden"),
+
$command), $line_nr);
+ } else {
+
$current->{'parent'}->{'extra'}->{'float'} = $float;
+ $float->{'extra'}->{$command} =
$current->{'parent'};
+ }
+ }
+ }
+ push @{$self->{'context_stack'}}, $command;
+ $line =~ s/([^\S\f\n]*)//;
+ $current->{'type'} = 'brace_command_context';
+ push @{$current->{'contents'}}, { 'type' =>
'empty_spaces_before_argument',
+
'text' => $1,
+
'parent' => $current };
+
$current->{'parent'}->{'extra'}->{'spaces_before_argument'}
+ = $current->{'contents'}->[-1];
+ } else {
+ $current->{'type'} = 'brace_command_arg';
+ if ($brace_commands{$command}
+ and ($brace_commands{$command} > 1
+ or
$simple_text_commands{$command})) {
+ push @{$current->{'contents'}},
+ {'type' => 'empty_spaces_before_argument',
+ 'text' => '' };
+
$current->{'parent'}->{'extra'}->{'spaces_before_argument'}
+ = $current->{'contents'}->[-1];
+ }
+ if ($inline_commands{$command}) {
+ # this is changed when the first argument is
known.
+ push @{$self->{'expanded_formats_stack'}}, 0;
+ push @{$self->{'context_stack'}}, $command
+ if ($command eq 'inlineraw');
+ }
+ }
+ print STDERR "OPENED
address@hidden>{'parent'}->{'cmdname'}, remaining: "
+
.(defined($current->{'parent'}->{'remaining_args'}) ? "remaining:
$current->{'parent'}->{'remaining_args'}, " : '')
+ .($current->{'type'} ? "type: $current->{'type'}"
: '')."\n"
+ if ($self->{'DEBUG'});
+ } elsif ($current->{'parent'}
+ and (($current->{'parent'}->{'cmdname'}
+ and
$current->{'parent'}->{'cmdname'} eq 'multitable')
+ or
($current->{'parent'}->{'type'}
+ and
$current->{'parent'}->{'type'} eq 'def_line'))) {
+ push @{$current->{'contents'}},
+ { 'type' => 'bracketed', 'contents' => [],
+ 'parent' => $current };
+ $current = $current->{'contents'}->[-1];
+ # we need the line number here in case @ protects end
of line
+ $current->{'line_nr'} = $line_nr
+ if ($current->{'parent'}->{'parent'}->{'type'}
+ and
$current->{'parent'}->{'parent'}->{'type'} eq 'def_line');
+ push @{$current->{'contents'}},
+ {'type' => 'empty_spaces_before_argument',
+ 'text' => '' };
+ print STDERR "BRACKETED in def/multitable\n" if
($self->{'DEBUG'});
+ $current->{'extra'}->{'spaces_before_argument'}
+ = $current->{'contents'}->[-1];
+
+ # lone braces accepted right in a rawpreformatted
+ } elsif ($current->{'type'}
+ and $current->{'type'} eq
'rawpreformatted') {
+ push @{$current->{'contents'}}, {'text' => '{' };
+ # matching braces accepted in a rawpreformatted or math or
ignored
+ # code
+ } elsif ($self->{'context_stack'}->[-1] eq 'math'
+ or $self->{'context_stack'}->[-1] eq
'rawpreformatted'
+ or $self->{'context_stack'}->[-1] eq
'inlineraw'
+ or $self->_ignore_global_commands()) {
+ push @{$current->{'contents'}},
+ { 'type' => 'bracketed', 'contents' => [],
+ 'parent' => $current, 'line_nr' =>
$line_nr };
+ $current = $current->{'contents'}->[-1];
+ print STDERR "BRACKETED in math\n" if
($self->{'DEBUG'});
+ } else {
+ $self->line_error(sprintf($self->__("misplaced %c"),
+
ord('{')), $line_nr);
+ }
+
+ } elsif ($separator eq '}') {
+ _abort_empty_line($self, $current);
+ #print STDERR "GGGGG". _print_current ($current);
+ if ($current->{'type'} and ($current->{'type'} eq
'bracketed')) {
+ $current = $current->{'parent'};
+ # the following will not happen for footnote if there is
+ # a paragraph withing the footnote
+ } elsif ($current->{'parent'}
+ and $current->{'parent'}->{'cmdname'}
+ and (exists
$brace_commands{$current->{'parent'}->{'cmdname'}}
+ or
$self->{'definfoenclose'}->{$current->{'parent'}->{'cmdname'}})) {
+ # for math and footnote out of paragraph
+ if
($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+ my $context_command = pop
@{$self->{'context_stack'}};
+ if ($context_command ne
$current->{'parent'}->{'cmdname'}) {
+ $self->_bug_message("context $context_command
instead of brace command $current->{'parent'}->{'cmdname'}",
+
$line_nr, $current);
+ die;
+ }
+ }
+ # first is the arg.
+
+ if ($brace_commands{$current->{'parent'}->{'cmdname'}}
+ and
($brace_commands{$current->{'parent'}->{'cmdname'}} > 1
+ or
$simple_text_commands{$current->{'parent'}->{'cmdname'}})
+ and $current->{'parent'}->{'cmdname'} ne
'math') {
+ # @inline* always have end spaces considered as
normal text
+ $self->_isolate_last_space($current)
+ unless
($inline_commands{$current->{'parent'}->{'cmdname'}});
+ $self->_register_command_arg($current,
'brace_command_contents');
+ # Remove empty arguments, as far as possible
+ _remove_empty_content_arguments($current);
+ }
+ my $closed_command = $current->{'parent'}->{'cmdname'};
+ print STDERR "CLOSING(brace)
address@hidden>{'parent'}->{'cmdname'}\n"
+ if ($self->{'DEBUG'});
+ delete $current->{'parent'}->{'remaining_args'};
+ if (defined($brace_commands{$closed_command})
+ and $brace_commands{$closed_command} == 0
+ and @{$current->{'contents'}}) {
+ $self->line_warn(sprintf($self->__(
+ "command
address@hidden does not accept arguments"),
+
$closed_command), $line_nr);
+ }
+ if ($current->{'parent'}->{'cmdname'} eq 'anchor') {
+ $current->{'parent'}->{'line_nr'} = $line_nr;
+ my $parsed_anchor = _parse_node_manual($current);
+ if (_check_node_label($self, $parsed_anchor,
+
$current->{'parent'}->{'cmdname'}, $line_nr)) {
+ _register_label($self, $current->{'parent'},
+ $parsed_anchor, $line_nr);
+ if (@{$self->{'regions_stack'}}) {
+ $current->{'extra'}->{'region'} =
$self->{'regions_stack'}->[-1];
+ }
+ }
+ } elsif
($ref_commands{$current->{'parent'}->{'cmdname'}}) {
+ my $ref = $current->{'parent'};
+ if (@{$ref->{'args'}}) {
+ my @args =
@{$ref->{'extra'}->{'brace_command_contents'}};
+ if (($closed_command eq 'inforef'
+ and !defined($args[0]) and
!defined($args[2]))
+ or ($closed_command ne 'inforef'
+ and !defined($args[0]) and
!defined($args[3])
+ and !defined($args[4]))) {
+ $self->line_warn(sprintf($self->__(
+ "command address@hidden missing a
node or external manual argument"),
+
$closed_command), $line_nr);
+ } else {
+ my $parsed_ref_node =
_parse_node_manual($ref->{'args'}->[0]);
+ $ref->{'extra'}->{'node_argument'} =
$parsed_ref_node
+ if (defined($parsed_ref_node));
+ if ($closed_command ne 'inforef'
+ and !defined($args[3]) and
!defined($args[4])
+ and
!$parsed_ref_node->{'manual_content'}
+ and !
_ignore_global_commands($self)) {
+ push
@{$self->{'internal_references'}}, $ref;
+ }
+ }
+ if (defined($args[1])) {
+ my $normalized_cross_ref_name =
+
Texinfo::Convert::NodeNameNormalization::normalize_node(
+
{'contents' => $args[1]});
+ if ($normalized_cross_ref_name !~ /[^-]/) {
+ $self->line_warn(sprintf($self->__(
+ "in address@hidden empty cross
reference name after expansion `%s'"),
+ $closed_command,
+
Texinfo::Convert::Texinfo::convert({'contents' => $args[1]})),
+ $line_nr);
+ }
+ }
+ if ($closed_command ne 'inforef' and
defined($args[2])) {
+ my $normalized_cross_ref_title =
+
Texinfo::Convert::NodeNameNormalization::normalize_node({'contents' =>
$args[2]});
+ if ($normalized_cross_ref_title !~ /[^-]/)
{
+ $self->line_warn(sprintf($self->__(
+ "in address@hidden empty cross
reference title after expansion `%s'"),
+ $closed_command,
+
Texinfo::Convert::Texinfo::convert({'contents' => $args[2]})),
+ $line_nr);
+ }
+ }
+ }
+ } elsif ($current->{'parent'}->{'cmdname'} eq 'image')
{
+ my $image = $current->{'parent'};
+ if (address@hidden>{'args'}}
+ or
address@hidden>{'extra'}->{'brace_command_contents'}}
+ or
!defined($image->{'extra'}->{'brace_command_contents'}->[0])) {
+ $self->line_error(
+ $self->__("address@hidden missing
filename argument"), $line_nr);
+ }
+ } elsif($current->{'parent'}->{'cmdname'} eq
'dotless') {
+ my $dotless = $current->{'parent'};
+ if (@{$current->{'contents'}}) {
+ my $text =
$current->{'contents'}->[0]->{'text'};
+ if (!defined ($text)
+ or ($text ne 'i' and $text ne 'j')) {
+ $self->line_error(sprintf($self->
+ __("%c%s expects `i' or `j' as
argument, not `%s'"),
+ ord('@'), $dotless->{'cmdname'},
+
Texinfo::Convert::Texinfo::convert($current)), $line_nr);
+ }
+ }
+ } elsif
($explained_commands{$current->{'parent'}->{'cmdname'}}
+ or
$inline_commands{$current->{'parent'}->{'cmdname'}}) {
+ my $current_command = $current->{'parent'};
+ if
($inline_commands{$current_command->{'cmdname'}}) {
+ if ($current_command->{'cmdname'} eq
'inlineraw') {
+ my $context_command = pop
@{$self->{'context_stack'}};
+ if ($context_command ne
$current_command->{'cmdname'}) {
+ $self->_bug_message("context
$context_command instead of inlineraw $current_command->{'cmdname'}",
+
$line_nr, $current);
+ die;
+ }
+ }
+ pop @{$self->{'expanded_formats_stack'}};
+ }
+ if (address@hidden>{'args'}}
+ or
address@hidden>{'extra'}->{'brace_command_contents'}}
+ or
!defined($current_command->{'extra'}->{'brace_command_contents'}->[0])) {
+ $self->line_warn(
+ sprintf($self->__("address@hidden
missing first argument"),
+
$current_command->{'cmdname'}), $line_nr);
+ } else {
+ if
($explained_commands{$current_command->{'cmdname'}}) {
+ my $normalized_type
+ =
Texinfo::Convert::NodeNameNormalization::normalize_node(
+ {'contents' =>
+
$current_command->{'extra'}->{'brace_command_contents'}->[0]});
+
$current_command->{'extra'}->{'normalized'} = $normalized_type;
+ if
(!$current_command->{'extra'}->{'brace_command_contents'}->[1]) {
+ if
($self->{'explained_commands'}->{$current_command->{'cmdname'}}->{$normalized_type})
{
+
$current_command->{'extra'}->{'explanation_contents'}
+ =
$self->{'explained_commands'}->{$current_command->{'cmdname'}}->{$normalized_type};
+ }
+ } elsif (! _ignore_global_commands($self))
{
+
$self->{'explained_commands'}->{$current_command->{'cmdname'}}->{$normalized_type}
+ =
$current_command->{'extra'}->{'brace_command_contents'}->[1];
+ }
+ }# else {
+ # my $argument
+ # =
Texinfo::Convert::Text::convert({'contents' =>
+ #
$current_command->{'extra'}->{'brace_command_contents'}->[0]},
+ #
{Texinfo::Common::_convert_text_options($self)});
+ # $current_command->{'extra'}->{'format'} =
$argument;
+ #}
+ }
+ } elsif ($current->{'parent'}->{'cmdname'} eq
'errormsg') {
+ if (! _ignore_global_commands($self)) {
+ my $error_message_text
+ = Texinfo::Convert::Text::convert($current,
+
{Texinfo::Common::_convert_text_options($self)});
+ $self->line_error($error_message_text,
$line_nr);
+ }
+ } elsif
(_command_with_command_as_argument($current->{'parent'}->{'parent'})
+ and scalar(@{$current->{'contents'}}) == 0) {
+ print STDERR "FOR PARENT
address@hidden>{'parent'}->{'parent'}->{'parent'}->{'cmdname'}
command_as_argument braces $current->{'cmdname'}\n" if ($self->{'DEBUG'});
+ $current->{'parent'}->{'type'} =
'command_as_argument'
+ if (!$current->{'parent'}->{'type'});
+
$current->{'parent'}->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'}
+ = $current->{'parent'};
+ }
+
$self->_register_global_command($current->{'parent'}->{'cmdname'},
+
$current->{'parent'}, $line_nr);
+ if
($command_ignore_space_after{$current->{'parent'}->{'cmdname'}}) {
+ push
@{$current->{'parent'}->{'parent'}->{'contents'}},
+ {'type' => 'empty_spaces_after_close_brace',
+ 'text' => '' };
+ }
+ $current = $current->{'parent'}->{'parent'};
+ $current = $self->_begin_preformatted ($current)
+ if
($close_preformatted_commands{$closed_command});
+ # lone braces accepted right in a rawpreformatted
+ } elsif ($current->{'type'}
+ and $current->{'type'} eq
'rawpreformatted') {
+ push @{$current->{'contents'}}, {'text' => '}' };
+ # footnote caption closing, when there is a paragraph
inside.
+ } elsif
($context_brace_commands{$self->{'context_stack'}->[-1]}) {
+ # closing the context under broader situations
+ $current = _end_paragraph($self, $current, $line_nr);
+ if ($current->{'parent'}
+ and $current->{'parent'}->{'cmdname'}
+ and
$context_brace_commands{$current->{'parent'}->{'cmdname'}}
+ and $current->{'parent'}->{'cmdname'} eq
$self->{'context_stack'}->[-1]) {
+ my $context_command = pop
@{$self->{'context_stack'}};
+ if ($context_command ne
$current->{'parent'}->{'cmdname'}) {
+ $self->_bug_message("context $context_command
instead of brace isolated $current->{'parent'}->{'cmdname'}",
+
$line_nr, $current);
+ die;
+ }
+ print STDERR "CLOSING(context command)
address@hidden>{'parent'}->{'cmdname'}\n" if ($self->{'DEBUG'});
+ my $closed_command =
$current->{'parent'}->{'cmdname'};
+
$self->_register_global_command($current->{'parent'}->{'cmdname'},
+
$current->{'parent'}, $line_nr);
+ $current = $current->{'parent'}->{'parent'};
+ $current = $self->_begin_preformatted ($current)
+ if
($close_preformatted_commands{$closed_command});
+ }
+ } else {
+ $self->line_error(sprintf($self->__("misplaced %c"),
+
ord('}')), $line_nr);
+ }
+ } elsif ($separator eq ','
+ and
$current->{'parent'}->{'remaining_args'}) {
+ _abort_empty_line ($self, $current);
+ if ($brace_commands{$current->{'parent'}->{'cmdname'}}
+ and
($brace_commands{$current->{'parent'}->{'cmdname'}} > 1
+ or
$simple_text_commands{$current->{'parent'}->{'cmdname'}})) {
+ $self->_isolate_last_space($current);
+ $self->_register_command_arg($current,
'brace_command_contents');
+ } else {
+ $self->_isolate_last_space($current);
+ if (exists
$block_commands{$current->{'parent'}->{'cmdname'}}) {
+ $self->_register_command_arg($current,
'block_command_line_contents');
+ }
+ }
+ my $type = $current->{'type'};
+ $current = $current->{'parent'};
+ if ($inline_commands{$current->{'cmdname'}}) {
+ if (! $current->{'extra'}->{'format'}) {
+ # change the top of the raw_formats_stack now that
we know the
+ # first arg of the inlineraw
+ my $inline_type
+ = Texinfo::Convert::Text::convert({'contents'
=>
+
$current->{'extra'}->{'brace_command_contents'}->[0]},
+
{Texinfo::Common::_convert_text_options($self)});
+ if ($self->{'expanded_formats_stack'}->[-2]) {
+ if
($inline_format_commands{$current->{'cmdname'}}) {
+ if
($self->{'expanded_formats_hash'}->{$inline_type}) {
+
$self->{'expanded_formats_stack'}->[-1] = $inline_type;
+ $current->{'extra'}->{'expand_index'}
= 1;
+ } else {
+
$self->{'expanded_formats_stack'}->[-1] = 0;
+ }
+ } elsif (($current->{'cmdname'} eq
'inlineifset'
+ and
exists($self->{'values'}->{$inline_type}))
+ or ($current->{'cmdname'} eq
'inlineifclear'
+ and !
exists($self->{'values'}->{$inline_type}))) {
+ $self->{'expanded_formats_stack'}->[-1]
+ = "$current->{'cmdname'}
$inline_type";
+ $current->{'extra'}->{'expand_index'} = 1;
+ } else {
+ $self->{'expanded_formats_stack'}->[-1] =
0;
+ }
+ } else {
+ $self->{'expanded_formats_stack'}->[-1] = 0;
+ }
+ $current->{'extra'}->{'format'} = $inline_type;
+ } else {
+ # happens for the second arg of inlinefmtifelse
+ my $inline_type = $current->{'extra'}->{'format'};
+ if ($self->{'expanded_formats_stack'}->[-2]
+ and !
($self->{'expanded_formats_hash'}->{$inline_type})) {
+ $self->{'expanded_formats_stack'}->[-1] =
$inline_type;
+ $current->{'extra'}->{'expand_index'} = 2;
+ } else {
+ $self->{'expanded_formats_stack'}->[-1] = 0;
+ }
+ }
+ }
+ $current->{'remaining_args'}--;
+ push @{$current->{'args'}},
+ { 'type' => $type, 'parent' => $current,
'contents' => [] };
+ #if ($inline_commands{$current->{'cmdname'}}
+ # and ! $self->{'expanded_formats_stack'}->[-1]) {
+ # $current->{'args'}->[-1]->{'extra'}->{'ignore'} = 1;
+ #}
+ $current = $current->{'args'}->[-1];
+ push @{$current->{'contents'}},
+ {'type' => 'empty_spaces_before_argument',
+ 'text' => '' };
+ } elsif ($separator eq ',' and $current->{'type'}
+ and $current->{'type'} eq 'misc_line_arg'
+ and $current->{'parent'}->{'cmdname'}
+ and $current->{'parent'}->{'cmdname'} eq 'node') {
+ $self->line_warn($self->__("superfluous arguments for
node"), $line_nr);
+ # end of menu node (. must be followed by a space to stop the
node).
+ } elsif (($separator =~ /[,\t.]/ and $current->{'type'}
+ and $current->{'type'} eq 'menu_entry_node')
+ or ($separator eq ':' and $current->{'type'}
+ and $current->{'type'} eq
'menu_entry_name')) {
+ $current = $current->{'parent'};
+ push @{$current->{'args'}}, { 'type' =>
'menu_entry_separator',
+ 'text' =>
$separator,
+ 'parent' =>
$current };
+ } elsif ($separator eq "\f" and $current->{'type'}
+ and $current->{'type'} eq 'paragraph') {
+ # form feed stops and restart a paragraph.
+ $current = $self->_end_paragraph($current);
+ push @{$current->{'contents'}}, {'text' => $separator,
+
'type' => 'empty_line',
+
'parent' => $current };
+ push @{$current->{'contents'}}, { 'type' => 'empty_line',
+
'text' => '',
+
'parent' => $current };
+
+ } else {
+ $current = _merge_text($self, $current, $separator);
+ }
+ # Misc text except end of line
+ } elsif ($line =~ s/^([^{}@,:\t.\n\f]+)//) {
+ my $new_text = $1;
+ $current = _merge_text($self, $current, $new_text);
+ # end of line
+ } else {
+ if ($self->{'DEBUG'}) {
+ print STDERR "END LINE: ". _print_current($current)."\n";
+ }
+ if ($line =~ s/^(\n)//) {
+ $current = _merge_text($self, $current, $1);
+ } else {
+ if (scalar(@{$self->{'input'}})) {
+ $self->_bug_message("Text remaining without normal
text but `$line'",
+ $line_nr,
$current);
+ die;
+ }
+ }
+ #print STDERR "END LINE AFTER MERGE END OF LINE: ".
_print_current($current)."\n";
+ $current = _end_line($self, $current, $line_nr);
+ last;
+ }
+ }
+ }
+ while (@{$self->{'conditionals_stack'}}) {
+ my $end_conditional = pop @{$self->{'conditionals_stack'}};
+ $self->line_error(sprintf($self->__("expected address@hidden %s"),
$end_conditional),
+ $line_nr);
+ }
+ $current = _close_commands($self, $current, $line_nr);
+
+ if (@{$self->{'context_stack'}} != 1) {
+ # This happens in 2 cases in the tests:
+ # @verb not closed on misc commands line
+ # def line escaped with @ ending the file
+ if ($self->{'DEBUG'}) {
+ print STDERR "CONTEXT_STACK no empty end _parse_texi: ".join('|',
@{$self->{'context_stack'}})."\n";
+ }
+ @{$self->{'context_stack'}} = ($self->{'context'});
+ }
+ if (@{$self->{'expanded_formats_stack'}} != 1) {
+ if ($self->{'DEBUG'}) {
+ print STDERR "EXPANDED_FORMATS_STACK no empty end _parse_texi:
".join('|', @{$self->{'expanded_formats_stack'}})."\n";
+ }
+ @{$self->{'expanded_formats_stack'}} =
($self->{'expanded_formats_stack'}->[0]);
+ }
+ return $root;
+}
+
+
+# parse special line @-commands, unmacro, set, clear, clickstyle.
+# Also remove spaces or ignore text, as specified in the misc_commands hash.
+sub _parse_special_misc_command($$$$)
+{
+ my $self = shift;
+ my $line = shift;
+ my $command = shift;
+ my $line_nr = shift;
+ my $args = [];
+
+ my $has_comment = 0;
+ my $remaining;
+ if ($command eq 'set') {
+ # REVALUE
+ #if ($line =~ s/^\s+([\w\-]+)(\s+(.*?))\s*$//) {
+ if ($line =~
/^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)(\@(c|comment)((\@|\s+).*)?|[^\S\f]+(.*?))?[^\S\f]*$/)
{
+ if ($line =~ s/\@(c|comment)((\@|\s+).*)?$//) {
+ $has_comment = 1;
+ }
+ $line =~
/^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)([^\S\f]+(.*?))?[^\S\f]*$/;
+ my $name = $1;
+ my $arg = $3;
+ $arg = '' if (!defined($arg));
+ $args = [$name, $arg];
+ $self->{'values'}->{$name} = $arg
+ unless(_ignore_global_commands($self));
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ }
+ } elsif ($command eq 'clear') {
+ # REVALUE
+ if ($line =~
/^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
+ $args = [$1];
+ delete $self->{'values'}->{$1}
+ unless(_ignore_global_commands($self));
+ $has_comment = 1 if (defined($3));
+ #$remaining = $line;
+ #$remaining =~ s/^\s+([\w\-]+)\s*(\@(c|comment)((\@|\s+).*)?)?//;
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ }
+ } elsif ($command eq 'unmacro') {
+ # REMACRO
+ if ($line =~
/^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
+ $args = [$1];
+ delete $self->{'macros'}->{$1}
+ unless(_ignore_global_commands($self));
+ $has_comment = 1 if (defined($3));
+ print STDERR "UNMACRO $1\n" if ($self->{'DEBUG'});
+ } elsif ($line !~ /\S/) {
+ $self->line_error(sprintf($self->
+ __("%c%s requires a name"), ord('@'),
$command), $line_nr);
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad name for address@hidden"),
$command), $line_nr);
+ }
+ } elsif ($command eq 'clickstyle') {
+ # REMACRO
+ if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*/) {
+ $args = ['@'.$1];
+ $self->{'clickstyle'} = $1
+ unless(_ignore_global_commands($self));
+ $remaining = $line;
+ $remaining =~
s/^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
+ $has_comment = 1 if (defined($4));
+ } else {
+ $self->line_error (sprintf($self->__(
+ "address@hidden should only accept a
address@hidden as argument, not `%s'"),
+ $command,
$line), $line_nr);
+ }
+ } else {
+ die $self->_bug_message("Unknown special command $command", $line_nr);
+ }
+ if (defined($remaining)) {
+ chomp($remaining);
+ if ($remaining ne '') {
+ $self->line_warn(sprintf($self->__(
+ "remaining argument on
address@hidden line: %s"),
+ $command, $remaining),
$line_nr);
+ }
+ }
+ return ($args, $has_comment);
+}
+
+sub _trim_spaces_comment_from_content($)
+{
+ Texinfo::Common::trim_spaces_comment_from_content($_[0]);
+}
+
+# at the end of a @-command line with arguments, parse the resulting
+# text, to collect aliases, definfoenclose and collect errors on
+# wrong arguments.
+sub _parse_line_command_args($$$)
+{
+ my $self = shift;
+ my $line_command = shift;
+ my $line_nr = shift;
+
+ my $args;
+
+ my $command = $line_command->{'cmdname'};
+ my $arg = $line_command->{'args'}->[0];
+
+ if ($self->{'DEBUG'}) {
+ print STDERR "MISC ARGS address@hidden";
+ if (@{$arg->{'contents'}}) {
+ my $idx = 0;
+ foreach my $content (@{$arg->{'contents'}}) {
+ my $name = '';
+ $name = '@' . $content->{'cmdname'} if ($content->{'cmdname'});
+ my $type = ', t: ';
+ $type .= $content->{'type'} if ($content->{'type'});
+ my $text = ', ';
+ $type .= $content->{'text'} if ($content->{'text'});
+ print STDERR " -> $idx $name $type $text\n";
+ $idx++;
+ }
+ }
+ }
+
+ my @contents = @{$arg->{'contents'}};
+
+ _trim_spaces_comment_from_content(address@hidden);
+
+ if (! @contents) {
+ $self->_command_error($line_command, $line_nr,
+ $self->__("address@hidden missing argument"),
$command);
+ $line_command->{'extra'}->{'missing_argument'} = 1;
+ return undef;
+ }
+
+ if (@contents > 1
+ or (!defined($contents[0]->{'text'}))) {
+ $self->line_error (sprintf($self->__("superfluous argument to
address@hidden"),
+ $command), $line_nr);
+ }
+ return undef if (!defined($contents[0]->{'text'}));
+
+ my $line = $contents[0]->{'text'};
+
+ if ($command eq 'alias') {
+ # REMACRO
+ if ($line =~
s/^([[:alnum:]][[:alnum:]-]*)(\s*=\s*)([[:alnum:]][[:alnum:]-]*)$//) {
+ my $new_command = $1;
+ my $existing_command = $3;
+ $args = [$1, $3];
+ $self->{'aliases'}->{$new_command} = $existing_command
+ unless (_ignore_global_commands($self));
+ if (exists($block_commands{$existing_command})) {
+ $self->line_warn(sprintf($self->
+ __("environment
command %s as argument to address@hidden"),
+ $existing_command,
$command), $line_nr);
+ }
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad argument to
address@hidden"), $command), $line_nr);
+ }
+
+ } elsif ($command eq 'definfoenclose') {
+ # REMACRO
+ if ($line =~
s/^([[:alnum:]][[:alnum:]\-]*)\s*,\s*([^\s,]*)\s*,\s*([^\s,]*)$//) {
+ $args = [$1, $2, $3 ];
+ $self->{'definfoenclose'}->{$1} = [ $2, $3 ]
+ unless (_ignore_global_commands($self));
+ print STDERR "DEFINFOENCLOSE address@hidden: $2, $3\n" if
($self->{'DEBUG'});
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad argument
to address@hidden"), $command), $line_nr);
+ }
+ } elsif ($command eq 'columnfractions') {
+ my @possible_fractions = split (/\s+/, $line);
+ if (address@hidden) {
+ $self->line_error (sprintf($self->__("empty address@hidden"),
$command),
+ $line_nr);
+ } else {
+ foreach my $fraction (@possible_fractions) {
+ if ($fraction =~ /^(\d*\.\d+)|(\d+)\.?$/) {
+ push @$args, $fraction;
+ } else {
+ $self->line_error (sprintf($self->
+ __("column
fraction not a number: %s"),
+ $fraction),
$line_nr);
+ }
+ }
+ }
+ } elsif ($command eq 'sp') {
+ if ($line =~ /^([0-9]+)$/) {
+ $args = [$1];
+ } else {
+ $self->line_error(sprintf($self->__("address@hidden arg must be
numeric, not `%s'"),
+ $line),
$line_nr);
+ }
+ } elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
+ # REMACRO
+ if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
+ my $name = $1;
+ if ($forbidden_index_name{$name}) {
+ $self->line_error(sprintf($self->
+ __("reserved
index name %s"),$name), $line_nr);
+ } else {
+ my $in_code = 0;
+ $in_code = 1 if ($command eq 'defcodeindex');
+ $args = [$name];
+ if (! _ignore_global_commands($self)) {
+ $self->{'index_names'}->{$name} = {'in_code' => $in_code};
+ $self->_register_index_commands($name);
+ }
+ }
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad argument to address@hidden:
%s"), $command, $line), $line_nr);
+ }
+ } elsif ($command eq 'synindex' || $command eq 'syncodeindex') {
+ # REMACRO
+ if ($line =~
/^([[:alnum:]][[:alnum:]\-]*)\s+([[:alnum:]][[:alnum:]\-]*)$/) {
+ my $index_from = $1;
+ my $index_to = $2;
+ $self->line_error(sprintf($self->__("unknown source index in
address@hidden: %s"),
+ $command,
$index_from), $line_nr)
+ unless $self->{'index_names'}->{$index_from};
+ $self->line_error(sprintf($self->__("unknown destination index in
address@hidden: %s"),
+ $command,
$index_to), $line_nr)
+ unless $self->{'index_names'}->{$index_to};
+ if ($self->{'index_names'}->{$index_from}
+ and $self->{'index_names'}->{$index_to}) {
+ my $current_to = $index_to;
+ # find the merged indices recursively avoiding loops
+ while ($current_to ne $index_from
+ and $self->{'merged_indices'}->{$current_to}) {
+ $current_to = $self->{'merged_indices'}->{$current_to};
+ }
+ if ($current_to ne $index_from) {
+ my $index_from_info =
$self->{'index_names'}->{$index_from};
+ my $index_to_info = $self->{'index_names'}->{$current_to};
+
+ my $in_code = 0;
+ $in_code = 1 if ($command eq 'syncodeindex');
+ if (! _ignore_global_commands($self)) {
+ $self->{'merged_indices'}->{$index_from} = $current_to;
+ $index_from_info->{'in_code'} = $in_code;
+ foreach my $contained_index (keys
%{$index_from_info->{'contained_indices'}}) {
+
$index_to_info->{'contained_indices'}->{$contained_index} = 1;
+
$self->{'index_names'}->{$contained_index}->{'merged_in'} = $current_to;
+ }
+ $index_from_info->{'merged_in'} = $current_to;
+ $index_to_info->{'contained_indices'}->{$index_from} =
1;
+ }
+ $args = [$index_from, $index_to];
+ } else {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden leads to a
merging of %s in itself, ignoring"),
+ $command,
$index_from), $line_nr);
+ }
+ }
+ } else {
+ $self->line_error(sprintf($self->__("bad argument to
address@hidden: %s"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'printindex') {
+ # REMACRO
+ if ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
+ my $name = $1;
+ if (!exists($self->{'index_names'}->{$name})) {
+ $self->line_error(sprintf($self->__("unknown index `%s' in
address@hidden"),
+
$name), $line_nr);
+
+ } else {
+ if ($self->{'merged_indices'}->{$name}) {
+ $self->line_warn(sprintf($self->__(
+ "printing an index `%s' merged
in another one `%s'"),
+ $name,
$self->{'merged_indices'}->{$name}),
+ $line_nr);
+ }
+ if (!defined($self->{'current_node'})
+ and !defined($self->{'current_section'})
+ and !scalar(@{$self->{'regions_stack'}})) {
+ $self->line_warn(sprintf($self->__(
+ "printindex before document
beginning: address@hidden %s"),
+
$name), $line_nr);
+ }
+ $args = [$name];
+ }
+ } else {
+ $self->line_error(sprintf($self->
+ __("bad argument to address@hidden:
%s"), $command, $line), $line_nr);
+ }
+ } elsif (grep {$_ eq $command} ('everyheadingmarks', 'everyfootingmarks',
+
'evenheadingmarks', 'oddheadingmarks',
+
'evenfootingmarks', 'oddfootingmarks')) {
+ if ($line eq 'top' or $line eq 'bottom') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be `top'
or `bottom', not `%s'"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'fonttextsize') {
+ if ($line eq '10' or $line eq '11') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "Only address@hidden 10 or 11
is supported, not `%s'"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'footnotestyle') {
+ if ($line eq 'separate' or $line eq 'end') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg
must be `separate' or `end', not `%s'"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'setchapternewpage') {
+ if ($line eq 'on' or $line eq 'off' or $line eq 'odd') {
+ $args = [$1];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must
be `on', `off' or `odd', not `%s'"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'need') { # only a warning
+ if (($line =~ /^([0-9]+(\.[0-9]*)?)$/) or
+ ($line =~ /^(\.[0-9]+)$/)) {
+ $args = [$1];
+ } else {
+ $self->line_error(sprintf($self->__("bad argument to
address@hidden: %s"),
+ $command,
$line), $line_nr);
+ }
+ } elsif ($command eq 'paragraphindent') {
+ if ($line =~ /^([\w\-]+)$/) {
+ my $value = $1;
+ if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq
'asis') {
+ $args = [$1];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be numeric/`none'/`asis', not
`%s'"),
+
$value), $line_nr);
+ }
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be numeric/`none'/`asis',
not `%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'firstparagraphindent') {
+ if ($line eq 'none' or $line eq 'insert') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be `none' or `insert', not `%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'exampleindent') {
+ if ($line =~ /^([0-9]+)/) {
+ $args = [$1];
+ } elsif ($line =~ /^(asis)$/) {
+ $args = [$1];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be numeric/`asis', not `%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'frenchspacing'
+ or $command eq 'xrefautomaticsectiontitle'
+ or $command eq 'codequoteundirected'
+ or $command eq 'codequotebacktick'
+ or $command eq 'deftypefnnewline') {
+ if ($line eq 'on' or $line eq 'off') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__("expected address@hidden on or
off, not `%s'"),
+
$command, $line), $line_nr);
+ }
+ } elsif ($command eq 'kbdinputstyle') {
+ if ($line eq 'code' or $line eq 'example' or $line eq 'distinct') {
+ $self->{'kbdinputstyle'} = $line
+ unless (_ignore_global_commands($self));
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be `code'/`example'/`distinct', not
`%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'allowcodebreaks') {
+ if ($line eq 'true' or $line eq 'false') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be `true' or `false',
not `%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'urefbreakstyle') {
+ if ($line eq 'after' or $line eq 'before' or $line eq 'none') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__(
+ "address@hidden arg must be `after'/`before'/`none', not
`%s'"),
+
$line), $line_nr);
+ }
+ } elsif ($command eq 'headings') {
+ if ($line eq 'off' or $line eq 'on' or $line eq 'single'
+ or $line eq 'double' or $line eq 'singleafter' or $line eq
'doubleafter') {
+ $args = [$line];
+ } else {
+ $self->line_error(sprintf($self->__("bad argument to
address@hidden: %s"),
+ $command,
$line), $line_nr);
+ }
+ }
+ return $args;
+}
+
+1;
+__END__
+=head1 NAME
+
+Texinfo::Parser - Parse Texinfo code in a Perl tree
+
+=head1 SYNOPSIS
+
+ use Texinfo::Parser;
+ my $parser = Texinfo::Parser::parser();
+ my $tree = $parser->parse_texi_file("somefile.texi");
+ my ($errors, $errors_count) = $parser->errors();
+ foreach my $error_message (@$errors) {
+ warn $error_message->{'error_line'};
+ }
+
+ my ($index_names, $merged_indices_hash)
+ = $parser->indices_information();
+ my $float_types_arrays = $parser->floats_information();
+ my $internal_references_array
+ = $parser->internal_references_information();
+ # An hash reference on normalized node/float/anchor names
+ my $labels_information = $parser->labels_information();
+ # A hash reference, keys are @-command names, value is an
+ # array reference holding all the corresponding @-commands.
+ my $global_commands_information = $parser->global_commands_information();
+ # a hash reference on some document informations (encodings,
+ # input file name, dircategory and direntry list, for exampel).
+ my $global_informations = $parser->global_informations();
+
+=head1 DESCRIPTION
+
+Texinfo::Parser will parse Texinfo text into a perl tree. In one pass
+it expands user defined @-commands, conditionals (@ifset, @ifinfo...)
+and @value and constructs the tree. Some extra information is gathered
+while doing the tree, for example the block command associated with @end,
+the number of row in a multitable, the node associated with a section.
+
+
+
+=head1 METHODS
+
+No method is exported in the default case. The module allows both
+an object oriented syntax, or traditional function, with the parser
+as an opaque data structure given in argument to every function.
+
+=head2 Initialization
+
+The following method is used to construct a new C<Texinfo::Parser> object:
+
+=over
+
+=item $parser = Texinfo::Parser::parser($options);
+
+This method creates a new parser. The options may be provided as a hash
+reference. There are two types of options. The first type of options
+change the way the parser behave, they are described right here. The
+other type of options allow to give to the parser some information as if
+it came from texinfo code, for example allow to set aliases (as with
+C<@alias>), values (as with C<@set>), merged indices (as with
+C<@synindex>). These options are described below in L</Texinfo Parser
options>.
+
+=over
+
+=item expanded_formats
+
+An array reference of the output formats for which C<@ifI<FORMAT>>
+conditional blocks should be expanded. Default is empty.
+
+The raw block formats (within C<@html> blocks, for example) are
+always kept.
+
+=item gettext
+
+If set, the function reference is used to translate error and warning
+messages. It takes a string as argument and returns a string. The default
+function returns the error message as is.
+
+=item GLOBAL_COMMANDS
+
+The associated value is a reference on an array. All the commands in the
+array are collected during parsing. They are afterwards available
+through L<global_informations|/$info = global_informations($parser)>.
+
+=item include_directories
+
+An array reference of directories in which C<@include> files should be
+searched for. Default contains the working directory, F<.>.
+
+=item INLINE_INSERTCOPYING
+
+If set, C<@insertcopying> is replaced by the C<@copying> content as if
+C<@insertcopying> was a user-defined macro. In the default case, it is
+considered to be a simple @-command and kept as is in the tree.
+
+=item IGNORE_BEFORE_SETFILENAME
+
+If set, and C<@setfilename> exists, everything before C<@setfilename>
+is put in a special container type, @C<preamble_before_setfilename>.
+This option is set in the default case.
+
+=item IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME
+
+If set, spaces after an @-commande name that take braces are ignored.
+Default on.
+
+=item MACRO_BODY_IGNORES_LEADING_SPACE
+
+If set, leading spaces are stripped from user defined macro bodies.
+
+=item MAX_MACRO_CALL_NESTING
+
+Maximal number of nested user-defined macro calls. Default is 100000.
+
+=item SHOW_MENU
+
+If false, no menu related error are reported. Default is true.
+
+=begin :comment
+
+Used by Sectioning only
+=item TOP_NODE_UP
+
+Text for the up node of the Top node. The default is C<(dir)>. The
+string may contain @-commands.
+
+=end :comment
+
+=back
+
+=back
+
+=head2 Parsing Texinfo text
+
+There are three methods that may be called to parse some Texinfo code,
+C<parse_texi_line> for a line, C<parse_texi_text> for a text fragment,
+and C<parse_texi_file> for a file.
+
+For all those functions, if the I<$parser> argument is undef, a new
+parser object is generated to parse the line, otherwise the parser given
+in argument is used to parse into a tree.
+
+When C<parse_texi_text> is used, the resulting tree is rooted at
+a C<root_line> type container. Otherwise, the resulting tree should be
+rooted at a C<text_root> type container if it do not contain nodes or
+sections, at a C<document_root> type container otherwise.
+
+=over
+
+=item $tree = parse_texi_line($parser, $text, $first_line_number, $file_name,
$macro_name, $fixed_line_number)
+
+This function is used to parse a short fragment of Texinfo code.
+
+I<$text> may be either an array reference of lines, or a text.
+
+The other arguments are optional and allow to specify the position
+information of the Texinfo code. I<$first_line_number> is the line number
+of the first text line. I<$file_name> is the name of the file the
+text comes from. I<$macro> is for the user-defined macro name the text
+is expanded from. If I<$fixed_line_number> is set, the line number is
+not increased for the different lines, as if the text was the expansion
+of a macro.
+
+=item $tree = parse_texi_text ($parser, $text, $line_numbers_specification,
$file_name, $macro_name, $fixed_line_number)
+
+This function is used to parse some Texinfo text.
+
+I<$text> may be either an array reference of lines, or a text.
+
+The other arguments are optional and allow to specify the position
+information of the Texinfo code. There are two distinct cases for
+I<$line_numbers_specification>.
+
+=over
+
+=item 1.
+
+If it is an array reference, it is considered to hold objects describing
+the position information of each text lines.
+
+=item 2.
+
+If I<$line_numbers_specification> is a scalar, it is the line number of
+the first text line. In that case (like for C<parse_texi_text>),
+I<$file_name> is the name of the file the text comes from.
+I<$macro> is for the user-defined macro name the text
+is expanded from. If I<$fixed_line_number> is set, the line number is
+not increased for the different lines, as if the text was the expansion
+of a macro.
+
+=back
+
+=item $tree = parse_texi_file($parser, $file_name)
+
+The file with name I<$file_name> is considered to be a Texinfo file and
+is parsed into a tree.
+
+undef is returned if the file couldn't be read.
+
+=back
+
+The errors collected during the tree parsing are available through the
+C<errors> method. This method comes from C<Texinfo::Report>, and is
+described in L<errors|Texinfo::Report/($error_warnings_list, $error_count) =
errors ($converter)>.
+
+=head2 Getting informations on the document
+
+After parsing some informations about the Texinfo code that was processed
+are available from the parser.
+
+Some global informations is available through C<global_informations>
+
+=over
+
+=item $info = global_informations($parser)
+
+The I<$info> returned is a hash reference. The possible keys are
+
+=over
+
+=item input_file_name
+
+The name of the main Texinfo input file.
+
+=item input_encoding_name
+
+=item input_perl_encoding
+
+C<input_encoding_name> string is the encoding name used for the
+Texinfo code.
+C<input_perl_encoding> string is a corresponding perl encoding name.
+
+=item dircategory_direntry
+
+An array of successive C<@dircategory> and C<@direntry> as they appear
+in the document.
+
+=item unassociated_menus
+
+An array of menus that are not associated with a node.
+
+=back
+
+=back
+
+Some command lists are available, such that it is possible to go through
+the corresponding tree elements without walking the tree. They are
+available through C<global_commands_information>
+
+=over
+
+=item $commands = global_commands_information($parser)
+
+I<$commands> is an hash reference. The keys are @-command names. The
+associated values are array references containing all the corresponding
+tree elements.
+
+=back
+
+All the @-commands that have an associated label, that can be the
+target of cross references, C<@node>, C<@anchor> and C<@float> with
+label have a normalized name associated, constructed as described in the
+B<HTML Xref> node in the Texinfo manual. Those normalized labels and
+the association with @-commands is available through C<labels_information>:
+
+=over
+
+=item $labels_information = labels_information($parser)
+
+I<$labels_information> is a hash reference whose keys are normalized
+labels, and the associated value is the corresponding @-command.
+
+=back
+
+Information on C<@float> is also available, grouped by type of
+floats, each type correponding to potential C<@listoffloats>.
+This information is available through the method C<floats_information>.
+
+=over
+
+=item $float_types = floats_information($parser)
+
+I<$float_types> is a hash reference whose keys are normalized float
+types (the first float argument, or the C<@listoffloats> argument).
+The normalization is the same than for node names. The value is the list
+of float tree elements appearing in the texinfo document.
+
+=back
+
+Internal references, that is, @-commands that refers to node, anchors
+or floats within the document are also available:
+
+=over
+
+=item $internal_references_array = internal_references_information($parser);
+
+The function returns a list of cross reference commands referring to
+the same document.
+
+=back
+
+Information about defined indices, merged indices and index entries is
+also available through the C<indices_information> method.
+
+=over
+
+=item indices_information
+
+ ($index_names, $merged_indices_hash)
+ = indices_information($parser);
+
+The index names is a hash reference. The keys are
+
+=over
+
+=item in_code
+
+1 if the index entries should be formatted as code, 0 in the opposite case.
+
+=item name
+
+The index name.
+
+=item prefix
+
+An array reference of prefix associated to the index.
+
+=item merged_in
+
+In case the index is merged to another index, this key holds the name of
+the index the index is merged into. It takes into account indirectly
+merged indices.
+
+=item contained_indices
+
+An hash reference holding names of indices that are merged to the index,
+including itself. It also contains indirectly merged indices. This key
+is present even if the index is itself later merged to another index.
+
+=item index_entries
+
+An array reference containing index entry structures for index entries
+associated with the index. The index entry could be associated to
address@hidden like C<@cindex>, or C<@item> in C<@vtable>, or definition
+commands entries like C<@deffn>.
+
+The keys of the index entry structures are
+
+=over
+
+=item index_name
+
+The index name.
+
+=item index_prefix
+
+The associated index prefix.
+
+=item index_at_command
+
+The name of the @-command associated with the index entry.
+
+=item index_type_command
+
+The @-command associated with the index entry allowing to
+find the index type.
+
+=item content
+
+An array reference corresponding to the index entry content.
+
+=item content_normalized
+
+An array reference corresponding to the index entry content, independent
+of the current language.
+
+=item command
+
+The element in the parsed tree associated with the @-command holding the
+index entry.
+
+=item node
+
+The node in the parsed tree containing the index entry.
+
+=item number
+
+The number of the index entry.
+
+=item region
+
+The region command (C<@copying>, C<@titlepage>) containing the index entry,
+if it is in such an environement.
+
+=back
+
+=back
+
+The following shows the references corresponding with the default indexes
+I<cp> and I<fn>, the I<fn> index having its entries formatted as code and
+the indices corresponding to the following texinfo
+
+ @defindex some
+ @defcodeindex code
+
+ $index_names = {'cp' => {'name' => 'cp', 'in_code' => 0,
+
'prefix' => ['c', 'cp']},
+ 'fn' => {'name' => 'fn', 'in_code' => 1,
+
'prefix' => ['f', 'fn']},
+ 'some' => {'in_code' => 0},
+ 'code' => {'in_code' => 1}};
+
+If C<name> is not set, it is set to the index name. If C<prefix> is
+not set, it is set to an array containing the index name.
+
+I<$merged_indices_hash> is a hash reference, the key is an index
+name merged in the value.
+
+=back
+
+=head2 Texinfo Parser options
+
+Setting those options is the same as seeing some Texinfo constructs in the
+document.
+
+=over
+
+=item aliases
+
+A hash reference. The key is a command name, the value is the alias, as
+could be set by C<@alias>.
+
+=item clickstyle
+
+A string, the command name associated with C<@clickstyle>.
+
+=item documentlanguage
+
+A string corresponding to a document language set by C<@documentlanguage>.
+
+=item explained_commands
+
+A hash reference of explained commands (currently abbr or acronym).
+The value is also a hash reference. The key of this hash is a normalized
+first argument of these commands, the value is a content array
+corresponding to the explanation associated with this first argument.
+
+For example giving as an option:
+
+ 'explained_commands'
+ => {'acronym' => {'EU' => [{'text' => 'European Union'}]}
+
+is the same as having the following texinfo code in the document:
+
+ @acronym{EU, European Union}
+
+=item INPUT_ENCODING_NAME
+
+=item INPUT_PERL_ENCODING
+
+C<INPUT_ENCODING_NAME> string is the encoding name as set
+by C<@documentencoding>.
+C<INPUT_PERL_ENCODING> string is a corresponding perl encoding name.
+In general those two strings should be set simultaneously.
+
+=item indices
+
+If it is a hash reference, the keys are index names, the values are
+index prefix hash references. The index prefix hash reference values are
+prefix, the value is set if the corresponding index entries should be
+formatted as if in C<@code>. An example is as L</indices_information>.
+
+If it is an array reference, it is a list of index names, as if they were
+entered as
+
+ @defindex name
+
+=item kbdinputstyle
+
+A string, the C<@kbdinputstyle> style.
+
+=item labels
+
+A hash reference. Keys are normalized node names as described in the
+B<HTML Xref> node in the Texinfo manual. Instead of a node, it may also
+be a float label or an anchor name. The value is the corresponding
address@hidden element in the tree.
+
+=item macros
+
+The associated hash reference has as key user-defined macro names. The
+value is the reference on a macro definition element as obtained by
+the Parser when parsing a C<@macro>. For example
+
+ @macro mymacro{arg}
+ coucou \arg\ after arg
+ @end macro
+
+Is associated to a macro definition element
+
+ {'cmdname' => 'macro',
+ 'args' => [{'text' => 'mymacro', 'type' => 'macro_name'},
+ {'text' => 'arg', 'type' => 'macro_arg}],
+ 'contents' => [{'text' => "coucou \arg\ after arg\n", 'type' => 'raw'}],
+ 'extra' => {'arg_line' => " mymacro{arg}\n",
+ 'macrobody' => "coucou \arg\ after arg\n"}}
+
+= item merged_indices
+
+The associated hash reference holds merged indices information, each key
+is merged in the value. Same as setting C<@synindex> or C<syncodeindex>.
+
+=item novalidate
+
+If set, it is as if C<@novalidate> was set in the document.
+
+=item sections_level
+
+Modifier of the sections level. Same as calling C<@lowersections> or
+C<@raisesections>.
+
+=item values
+
+A hash reference. Keys are names, values are the corresponding values.
+Same as values set by C<@set>.
+
+=back
+
+=head1 TEXINFO TREE
+
+A Texinfo tree element (called element because node is overloaded in
+the Texinfo world) is an hash reference. There are three main category
+of tree element. Tree elements associated with an @-command have a
+C<cmdname> key holding the @-command name. Tree element corresponding
+to text fragments have a C<text> key holding the corresponding text.
+The last category corresponds to other containers (hereafter called
+containers). In most case these containers have a C<type> key holding
+their name. Text fragments and @-command elements may also have an
+associated type when such information is needed.
+
+The children of @-command or container elements are in the array
+correponding with the C<args> key or with the C<contents> key. The
+C<args> key is for arguments of @-commands, in braces or on the @-command
+line. C<args> is also used for the elements of a menu entry, as a menu
+entry is well structured with a limited number of arguments.
+The C<contents> key array holds the contents of the texinfo
+code appearing within a block @-command, within a container,
+within a C<@node> or sectioning @-command.
+
+Another important key for the elements is the C<extra> key which is
+associated to a hash reference and holds all kinds of informations gathered
+during the parsing and that may help with the conversion.
+
+=head2 Element keys
+
+=over
+
+=item cmdname
+
+The command name of @-command elements.
+
+=item text
+
+The text fragment of text elements.
+
+=item type
+
+The type of the element. For C<@verb> it is the delimiter. But otherwise
+it is the type of element considered as a container. Frequent types
+encountered are I<paragraph> for a paragraph container,
+I<brace_command_arg> for the container holding the brace @-commands
+contents, I<misc_line_arg> and I<block_line_arg> contain the arguments
+appearing on the line of @-commands. Text fragments may have a type to
+give an information of the kind of text fragment, for example
+C<empty_spaces_before_argument> is associated to spaces after a brace
+opening and before the argument. Many @-commands elements don't have
+a type associated.
+
+=item args
+
+Arguments in braces or on @-command line, and the elements of a menu entry.
+
+=item contents
+
+The Texinfo appearing in the element. For block commands, other
+containers, C<@node> and sectioning commands.
+
+=item parent
+
+The parent element.
+
+=item line_nr
+
+An hash reference corresponding to information on the location of the
+element in the Texinfo input manual. It should only be available for
address@hidden elements, and only for @-commands that are considered to be
+complex enough that the location in the document is needed, for example
+to prepare an error message.
+
+The keys of the line number hash references are
+
+=over
+
+=item line_nr
+
+The line number of the @-command.
+
+=item file_name
+
+The file name where @-command appeared.
+
+=item macro
+
+The user macro name the @-command is expanded from.
+
+=back
+
+=item extra
+
+A hash reference holding any additional information.
+See L</Information available in the extra key>.
+
+=back
+
+=head2 The containers and types
+
+Some types are associated with @-commands. As said above, for C<@verb>
+the type is the delimiter. For a C<@value> command that is not
+expanded because there is no corresponding value set, the type is the
+value argument string.
+
+The following types also happen for @-commands:
+
+=over
+
+=item def_line
+
+This type may be associated with a definition command with a x form,
+like C<@defunx>, C<@defvrx>. For the form without x, the associated
+I<def_line> is the first C<contents> element. It is described in more
+details below.
+
+=item command_as_argument
+
+This is the type of a command given in argument of C<@itemize>,
+C<@table>, C<@vtable> or C<@ftable>. For example in
+
+ @itemize @bullet
+ @item item
+ @end itemize
+
+the element corresponding with bullet has the following keys:
+
+ 'cmdname' => 'bullet'
+ 'type' => 'command_as_argument'
+
+The parent @-command has an entry in extra for the I<command_as_argument>
+element:
+
+ 'cmdname' => 'itemize'
+ 'extra => {'command_as_argument' => $command_element_as_argument}
+
+=item index_entry_command
+
+This is the type of index entry command like C<@cindex>, and, more
+importantly user defined index entry commands. So for example if there
+is
+
+ @defindex foo
+ ...
+
+ @fooindex index entry
+
+the C<@fooindex> @-command element will have the I<index_entry_command>
+type.
+
+=item following_arg
+
+This type is set for non alphabetic accent @-commands that don't use brace
+but instead have their argument right after them, as
+
+ @~n
+
+=item space_command_arg
+
+This type is set for accent @-commands that don't use brace but instead
+have their argument after some space, as
+
+ @ringaccent A
+
+=item definfoenclose_command
+
+This type is set for an @-command that is redefined by C<@definfoenclose>.
+The beginning is in C<< {'extra'}->{'begin'} >> and the end in
+C<< {'extra'}->{'end'} >>.
+
+=back
+
+The text elements may be associated to the following types:
+
+=over
+
+=item empty_line
+
+An empty line.
+
+=item raw
+
+Text in an environment where it should be kept as is (in C<@verbatim>,
+C<@verb>, C<@html>, C<@macro> body).
+
+=item last_raw_newline
+
+The last end of line in a raw block (except for C<@verbatim>).
+
+=item empty_line_after_command
+
+=item empty_spaces_after_command
+
+The text is spaces for I<empty_spaces_after_command>
+or spaces followed by a newline for
+I<empty_line_after_command>, appearing after a @-command that
+takes an argument on the line or a block
address@hidden
+
+=item spaces_at_end
+
+Space at the end of a @-command line, at the end of some @-commands
+with braces or at the end of a bracketed content on a
+C<@multitable> line.
+
+=item empty_space_at_end_def_bracketed
+
+Space at the end of a bracketed content on definition line.
+
+=item space_at_end_block_command
+
+Space at the end of a block @-command line.
+
+=item empty_spaces_before_argument
+
+The text is spaces appearing after an opening brace of after a
+comma separated @-command arguments.
+
+=item empty_spaces_after_close_brace
+
+Spaces appearing after a closing brace, for some rare commands for which
+this space should be ignorable (like C<@caption>).
+
+=item empty_spaces_before_paragraph
+
+Space appearing before a paragraph beginning.
+
+=item preamble_text
+
+Text appearing before real content, including the C<\input texinfo.tex>.
+
+=item space_at_end_menu_node
+
+=item after_description_line
+
+Space after a node in the menu entry, when there is no description,
+and space appearing after the description line.
+
+=back
+
+Other special types are described in the following.
+
+=over
+
+=item text_root
+
+=item document_root
+
+=item root_line
+
+These types correspond to document roots. C<text_root> is the document
+root when there is no C<@node> or sectioning command. When
+such a command appears, a new root container is used, C<document_root>,
+and C<text_root> becomes the first content of C<document_root>.
+C<root_line> is the type of the root tree when parsing Texinfo line
+fragments using C<parse_texi_line>.
+
+=item preamble
+
+This container holds the text appearing before the first content, including
+the C<\input texinfo.tex> line and following blank lines.
+
+=item preamble_before_setfilename
+
+This container holds everything that appears before C<@setfilename>
+if I<IGNORE_BEFORE_SETFILENAME> parser option is set.
+
+=item paragraph
+
+A paragraph.
+
+=item preformatted
+
+Texinfo code within a format that is not filled. Happens within some
+block commands as C<@example>, but also in menu (in menu descriptions,
+menu comments...).
+
+=item brace_command_arg
+
+=item brace_command_context
+
+=item block_line_arg
+
+=item misc_line_arg
+
+Those containers are within C<args> of @-commands with braces for
+I<brace_command_arg>, @-commands with braces that start a new context
+(C<@footnote>, C<@caption>, C<@math>) for I<brace_command_context>,
+block command argument on their line for I<block_line_arg> and
+other commands that take texinfo code as argument on their line
+(C<@settitle>, C<@node>, C<@section> and similar) for I<misc_line_arg>.
+They hold the content of the command argument.
+
+For example
+
+ @code{in code}
+
+leads to
+
+ {'cmdname' => 'code',
+ 'args' => [{'type' => 'brace_command_arg',
+ 'contents' => [{'text' => 'in code'}]}]}
+
+=item misc_arg
+
+Argument of @-command taking specific textual arguments on the line.
+For example C<@set>, C<@clickstyle>, C<@unmacro>, C<@comment>.
+The argument is associated to the I<text> key.
+
+=item menu_entry
+
+=item menu_entry_leading_text
+
+=item menu_entry_name
+
+=item menu_entry_separator
+
+=item menu_entry_node
+
+=item menu_entry_description
+
+A I<menu_entry> holds a full menu entry, like
+
+ * node:: description.
+
+The different elements of the menu entry are directly in the
+I<menu_entry> C<args> array reference.
+
+I<menu_entry_leading_text> holds the star and following spaces.
+I<menu_entry_name> is the menu entry name (if present), I<menu_entry_node>
+corresponds to the node in the menu entry, I<menu_entry_separator> holds
+the text after the node and before the description, in most case
+C<:: >. Last I<menu_entry_description> is for the description.
+
+=item menu_comment
+
+The I<menu_comment> container holds what is between menu entries
+in menus. For example in
+
+ @menu
+ Menu title
+
+ * entry::
+
+ Between entries
+ * other::
+ @end menu
+
+Both
+
+ Menu title
+
+and
+
+ Between entries
+
+will be in I<menu_comment>.
+
+=item macro_name
+
+=item macro_arg
+
+Taken from C<@macro> definition and put in the C<args> key array of
+the macro, I<macro_name> is the type of the text fragment corresponding
+to the macro name, I<macro_arg> is the type of the text fragments
+correponding to macro formal arguments.
+
+=item before_item
+
+A container for content before the first C<@item> of block @-commands
+with items (C<@table>, C<@multitable>, C<@enumerate>...).
+
+=item table_entry
+
+=item table_term
+
+=item table_item
+
+=item inter_item
+
+Those containers appear in C<@table>, C<@ftable> and C<@vtable>.
+A I<table_entry> container contains C<@item> and C<@itemx> and
+the text following the C<@item> and C<@itemx> entries. A I<table_term>
+container holds all the C<@item> and C<@itemx> of the I<table_entry>.
+The I<table_item> container holds the content following the I<table_term>.
+If there is some content before an C<@itemx> (normally only comments,
+empty lines or maybe index entriees are allowed), it will be in
+a container with type I<inter_item>.
+
+=item def_line
+
+=item def_item
+
+=item inter_def_item
+
+The I<def_line> type is either associated with a container within a
+definition command, or is the type of a definition command with a x
+form, like C<@deffnx>. It holds the definition line arguments.
+The container with type I<def_item> holds the definition text content.
+Content appearing before a definition command with a x form is in
+an I<inter_def_item> container.
+
+=item multitable_head
+
+=item multitable_body
+
+=item row
+
+In C<@multitable>, a I<multitable_head> container contains all the row
+with C<@headitem>, while I<multitable_body> contains the rows associated
+with C<@item>. A I<row> container contains the C<@item> and @<tab>
+forming a row.
+
+=item bracketed
+
+This a special type containing content in brackets in the context
+where they are valid, in C<@math>.
+
+=item bracketed_def_content
+
+Content in brackets on definition command lines.
+
+=item bracketed_multitable_prototype
+
+=item row_prototype
+
+On C<@multitable> line, content in brackets is in
+I<bracketed_multitable_prototype>, text not in brackets
+is in I<row_prototype>.
+
+=back
+
+=head2 Information available in the extra key
+
+Some extra keys are available for more than one @-command:
+
+=over
+
+=item block_command_line_contents
+
+=item brace_command_contents
+
+An array associated with block @-commands or @-commands with braces
+taking more than one argument or with a simple text content
+(C<@anchor>, C<@titlefont>, C<@dmn>). Each of the element of the
+array is either undef, if there is no argument at that place,
+or an array reference holding the argument contents.
+
+=item misc_content
+
+The contents of an @-command taking regular Texinfo code as
+argument, like C<@sttitle> or C<@exdent>.
+
+=item end_command
+
+The C<@end> associated to the block @-command.
+
+=item missing_argument
+
+Set for some @-commands with line arguments and a missing argument.
+
+=item invalid_nesting
+
+Set if the @-command appears in a context it shouldn't appear in,
+like a block @-command on sectioning @-command line.
+
+=item arg_line
+
+The string correspond to the line after the @-command
+for @-commands that have special arguments on their line,
+and for C<@macro> line.
+
+=item text_arg
+
+The string correspond to the line after the @-command for @-commands
+that have an argument interpreted as simple text, like C<@setfilename>,
+C<@end> or C<@documentencoding>.
+
+=item index_entry
+
+The index entry information (described in L</index_entries>
+in details) is associated to @-commands that have an associated
+index entry.
+
+=item misc_args
+
+An array holding strings, the arguments of @-commands taking simple
+textual arguments as arguments, like C<@everyheadingmarks>,
+C<@frenchspacing>, C<@alias>, C<@synindex>, C<@columnfractions>.
+Also filled for C<@set>, C<@clickstyle>, C<@unmacro> or C<@comment>
+arguments.
+
+=item spaces_after_command
+
+For @-commands followed by spaces, a reference to the corresponding
+text element.
+
+=item spaces_before_argument
+
+For @-commands with opening brace followed by spaces held in a
+C<empty_spaces_before_argument> element, a reference to that element.
+
+=item spaces
+
+For accent commands consisting in letter only, like C<@ringaccent>
+appearing like
+
+ @ringaccent A
+
+there is a I<spaces> key which holds the spaces appearing between
+the command and the argument.
+
+=back
+
+Then there are extra keys specific of @-commands or containers.
+
+=over
+
+=item C<@macro>
+
+I<invalid_syntax> is set if there was an error on the C<@macro>
+line. The key I<args_index> associates format arguments with
+their index on the @macro line formal arguments definition.
+The I<macrobody> holds the @macro body. I<arg_line> holds the
+line after C<@macro>.
+
+=item C<@node>
+
+The arguments are in the I<nodes_manuals> array. Each
+of the entry has a I<node_content> key for
+an array holding the corresponding content, a I<manual_content>
+if there is an associated external manual name, and I<normalized>
+key for the normalized label, built as specified in the Texinfo manual
+in the B<HTML Xref> node.
+
+An I<associated_section> key holds the tree element of the
+sectioning command that follows the node.
+
+=item C<@part>
+
+The next sectioning command is in I<part_associated_section>.
+
+=item sectioning command
+
+The node preceding the command is in I<associated_node>.
+The part preceding the command is in I<associated_part>.
+If the level of the document was modified by C<@raisections>
+or C<@lowersections>, the differential level is in I<sections_level>.
+
+=item C<@float>
+
+=item C<@listoffloats>
+
+If float has a second argument, and for C<@listoffloats>
+argument there is a I<type> key which is also a hash reference,
+with two keys. I<content> is an array holding the associated
+contents, I<normalized> holds the normalized float type.
+
+I<caption> and I<shortcaption> holds the corresponding
+tree elements for float. The C<@caption> or C<@shortcaption>
+have the float tree element stored in I<float>.
+
+=item C<@float>
+
+=item C<@anchor>
+
address@hidden that are targets for cross references have a I<normalized>
+key for the normalized label, built as specified in the Texinfo manual
+in the B<HTML Xref> node. There is also a I<node_content> key for
+an array holding the corresponding content.
+
+C<@anchor> also has I<region> set to the special region name if
+in a special region (C<@copying>, C<@titlepage>).
+
+=item C<@ref>
+
+=item C<@xref>
+
+=item C<@pxref>
+
+=item C<@inforef>
+
+The I<node_argument> entry holds a parsed node entry, like
+the one appearing in the I<nodes_manuals> array for C<@node>.
+
+=item C<@abbr>
+
+=item C<@acronym>
+
+The first argument normalized is in I<normalized>. If there is no
+second argument, but a second argument appeared previously for the
+same first argument, the second argument content of the previous
+command is stored in I<explanation_contents>.
+
+=item definition command
+
+I<def_command> holds the command name, without x if it is
+an x form of a definition command.
+I<original_def_cmdname> is the original def command.
+
+If it is an x form, it has I<not_after_command> set if not
+appearing after the definition command without x.
+
+=item def_line
+
+The I<def_arg> extra key holds an array reference corresponding to
+the parsed definition line argument. Each of the the element of the
+array is a two element array reference. The first element is the type
+which could be I<spaces> for a space, types specific of the
+definition, like I<category>, I<name>, I<class>, I<type>, and, at the
+end, a mix of I<arg>, I<typearg>, I<delimiter> depending on the definition.
+The second element is a hash reference holding the content of the
+type.
+
+The I<def_parsed_hash> hash reference has as key the type specific
+of the definition, and as value the corresponding content tree.
+
+=item C<@multitable>
+
+The key I<max_columns> holds the maximal number of columns. If there
+are prototypes on the line they are in the array associated with
+I<prototypes>. In that case, I<prototypes_line> also holds this
+information, and, in addition, keeps spaces with type C<prototype_space>.
+If there is a C<@columnfractions> as argument, then the
+I<columnfractions> key is associated with the array of columnfractions
+arguments, holding all the column fractions.
+
+=item C<@enumerate>
+
+The extra key I<enumerate_specification> contains the enumerate
+argument.
+
+=item C<@itemize>
+
+=item C<@table>
+
+=item C<@vtable>
+
+=item C<@ftable>
+
+The I<command_as_argument> extra key points on the @-command on
+as argument on the @-command line.
+
+=item paragraph
+
+The I<indent> or I<noindent> key value is set if the corresponding
address@hidden are associated with that paragraph.
+
+=item C<@item> in C<@enumerate> or C<@itemize>
+
+The I<item_number> extra key holds the number of this item.
+
+=item C<@item> and C<@tab> in C<@multitable>
+
+The I<cell_count> index key holds the index of the column of
+the cell.
+
+=item row
+
+The I<row_number> index key holds the index of the row in
+the C<@multitable>.
+
+=item C<@author>
+
+If in a C<@titlepage>, the titlepage is in I<titlepage>, if in
+C<@quotation> or C<@smallquotation>, the corresponding tree element
+is in I<quotation>.
+
+The author tree element is in the I<author> array of the C<@titlepage>
+or the C<@quotation> or C<@smallquotation> it is associated with.
+
+=item C<@ifclear>
+
+=item C<@ifset>
+
+The original line is in I<line>.
+
+=item C<@end>
+
+The textual argument is in I<command_argument>.
+The corresponding @-command is in I<command>.
+
+=item C<@documentencoding>
+
+The argument, normalized is in I<input_encoding_name> if it is recognized.
+The corresponding perl encoding name is in I<input_perl_encoding>.
+
+=item C<@click>
+
+In I<clickstyle> there is the current clickstyle command.
+
+=item C<@kbd>
+
+I<code> is set depending on the context and C<@kbdinputstyle>.
+
+=item definfoenclose defined commands
+
+I<begin> holds the string beginning the definfoenclose,
+I<end> holds the string ending the definfoenclose.
+
+=item menu_entry
+
+The I<menu_entry_description> and I<menu_entry_name> keys
+are associated with the corresponding tree elements. The
+I<menu_entry_node> holds the parsed node entry, like
+the one appearing in the I<nodes_manuals> array for C<@node>.
+
+=item empty_line_after_command
+
+The corresponding command is in I<command>.
+
+=item C<@inlinefmt>
+
+=item C<@inlineraw>
+
+=item C<@inlinefmtifelse>
+
+=item C<@inlineifclear>
+
+=item C<@inlineifset>
+
+The first argument is in I<format>. If an argument has been determined
+as being expanded by the Parser, the index of this argument is in
+I<expand_index>. Index numbering begins at 0, but the first argument is
+always the format or flag name, so, if set, it should be 1 or 2 for
+C<@inlinefmtifelse>, and 1 for other commands.
+
+=back
+
+=head1 SEE ALSO
+
+L<Texinfo manual|http://www.gnu.org/s/texinfo/manual/texinfo/>
+
+=begin :comment
+
+Mention other useful documentation such as the documentation of
+related modules or operating system documentation (such as man pages
+in UNIX), or any relevant external documentation such as RFCs or
+standards.
+
+If you have a mailing list set up for your module, mention it here.
+
+If you have a web site set up for your module, mention it here.
+
+=end :comment
+
+=head1 AUTHOR
+
+Patrice Dumas, E<lt>address@hidden<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+=cut
Added: trunk/parsetexi/README
===================================================================
--- trunk/parsetexi/README (rev 0)
+++ trunk/parsetexi/README 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,3 @@
+This is an experimental program intended to replicate the functionality
+in tp/Parser.pm. How it will be integrated into makeinfo is still
+unknown.
Added: trunk/parsetexi/aclocal.m4
===================================================================
--- trunk/parsetexi/aclocal.m4 (rev 0)
+++ trunk/parsetexi/aclocal.m4 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,1123 @@
+# generated automatically by aclocal 1.99a -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS],
[])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically
'autoreconf'.])])
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.99a'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.99a], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.99a])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR], [AC_SUBST([DEPDIR], [.deps])])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null
2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Without this, packages using Gettext 0.18.2 might break horribly.
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean"
there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell address@hidden about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg"
>`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+ [whether $CC understands -c and -o together],
+ [am_cv_prog_cc_c_o],
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+ ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf -
"'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf -
"'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
+
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
Added: trunk/parsetexi/close.c
===================================================================
--- trunk/parsetexi/close.c (rev 0)
+++ trunk/parsetexi/close.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,148 @@
+#include <stdlib.h>
+
+#include "parser.h"
+
+/* In parser.c. */
+ELEMENT *end_paragraph (ELEMENT *current);
+
+// 1512
+void
+close_command_cleanup (ELEMENT *current)
+{
+ if (!current->cmd)
+ return;
+
+ if (current->cmd == CM_multitable)
+ {
+ }
+
+ /* Put everything after the last @def*x command in a def_item type
+ container. */
+ if (command_data(current->cmd).flags & CF_def)
+ {
+ /* "At this point the end command hasn't been added to the command
+ contents, so checks cannot be done at this point." */
+ gather_def_item (current);
+ }
+
+ /* "item_line" commands */
+ if (current->cmd == CM_table
+ || current->cmd == CM_ftable
+ || current->cmd == CM_vtable)
+ {
+ /* "At this point the end command hasn't been added to the command
+ contents, so checks cannot be done at this point." */
+ if (current->contents.number > 0)
+ ;//gather_previous_item (current);
+ }
+
+ // 1570
+ if (command_data(current->cmd).flags & CF_blockitem)
+ {
+ } // 1635
+}
+
+/* 1638 - 1794 */
+
+/* 1642 */
+static ELEMENT *
+close_current (ELEMENT *current)
+{
+ /* Element is a command */
+ if (current->cmd)
+ {
+ debug ("CLOSING (close_current) %s", command_data(current->cmd).cmdname);
+ current = current->parent; /* TODO */
+ }
+ else if (current->type != ET_NONE)
+ {
+ enum context c;
+ switch (current->type)
+ {
+ case ET_bracketed:
+ /* error */
+ break;
+ case ET_menu_comment:
+ case ET_menu_entry_description:
+ c = pop_context ();
+ if (c != ct_preformatted)
+ {
+ /* error */
+ }
+
+ /* close empty menu_comment */
+
+ break;
+ case ET_misc_line_arg:
+ case ET_block_line_arg:
+ c = pop_context ();
+ if (c != ct_line && c != ct_def)
+ {
+ /* error */
+ abort ();
+ }
+ break;
+ }
+ current = current->parent;
+ }
+ else
+ {
+ if (current->parent)
+ current = current->parent;
+ /* error */
+ }
+
+ return current;
+}
+
+/* 1725 */
+/* Return lowest level ancestor of CURRENT containing a CLOSED_COMMAND
+ element. Set CLOSED_ELEMENT to the element itself. INTERRUPTING is used
in
+ close_brace_command 1246 to display an error message. Remove a context
from
+ context stack if it was added by this command. */
+ELEMENT *
+close_commands (ELEMENT *current, enum command_id closed_command,
+ ELEMENT **closed_element, enum command_id interrupting)
+{
+ *closed_element = 0;
+ current = end_paragraph (current);
+ current = end_preformatted (current);
+
+ while (current->parent
+ && (!closed_command || current->cmd != closed_command)
+ /* Stop if in a root command. */
+ && !(current->cmd && command_flags(current) & CF_root))
+ {
+ close_command_cleanup (current);
+ current = close_current (current);
+ }
+
+ if (closed_command && current->cmd == closed_command)
+ {
+ /* 1758 - various error messages */
+ if (command_data(current->cmd).flags & CF_preformatted)
+ {
+ if (pop_context () != ct_preformatted)
+ abort ();
+ }
+ else if (command_data(current->cmd).flags & CF_format_raw)
+ {
+ if (pop_context () != ct_rawpreformatted)
+ abort ();
+ // pop expanded formats stack
+ }
+ else if (command_data(current->cmd).flags & CF_menu)
+ {
+ enum context c;
+ c = pop_context ();
+ if (c != ct_menu && c != ct_preformatted)
+ abort ();
+ }
+
+ // 1784 maybe pop regions stack
+ *closed_element = current;
+ current = current->parent; /* 1788 */
+ }
+
+ return current;
+}
Added: trunk/parsetexi/command_data.awk
===================================================================
--- trunk/parsetexi/command_data.awk (rev 0)
+++ trunk/parsetexi/command_data.awk 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,106 @@
+#######################################################
+# From gawk manual
+# ord.awk --- do ord and chr
+
+# Global identifiers:
+# _ord_: numerical values indexed by characters
+# _ord_init: function to initialize _ord_
+
+BEGIN { _ord_init() }
+
+function _ord_init( low, high, i, t)
+{
+ low = sprintf("%c", 7) # BEL is ascii 7
+ if (low == "\a") { # regular ascii
+ low = 0
+ high = 127
+ } else if (sprintf("%c", 128 + 7) == "\a") {
+ # ascii, mark parity
+ low = 128
+ high = 255
+ } else { # ebcdic(!)
+ low = 0
+ high = 255
+ }
+
+ for (i = low; i <= high; i++) {
+ t = sprintf("%c", i)
+ _ord_[t] = i
+ }
+}
+
+function ord(str, c)
+{
+ # only first character is of interest
+ c = substr(str, 1, 1)
+ return _ord_[c]
+}
+
+#######################################################
+
+
+BEGIN {
+ bs_escapes["\\n"] = "\n"
+ bs_escapes["\\f"] = "\f"
+ bs_escapes["\\t"] = "\t"
+ bs_escapes["\\\\"] = "\\"
+ bs_escapes["\\\""] = "\""
+ bs_escapes["\\x20"] = " "
+
+ for (v in bs_escapes) {
+ inv_bs_escapes[bs_escapes[v]] = v
+ }
+
+ print "/* This file automatically generated by command_data.awk */"
+ print "enum command_id {"
+ print "CM_NONE,"
+ print
+}
+
+!/^$/ && !/^#/ {
+ if ($1 in bs_escapes)
+ commands[bs_escapes[$1]] = $2
+ else
+ commands[$1] = $2
+ data[$1] = $3
+}
+
+END {
+ print "COMMAND builtin_command_data[] = {" >"command_data.c"
+
+ print "0, 0, 0," >"command_data.c"
+
+ # We want the output sorted so we can use bsearch
+ PROCINFO["sorted_in"]="@ind_str_asc"
+ for (c in commands) {
+ # Single character commands with unusual names
+ if (c ~ /^[^[:alpha:]]$/) {
+ if (c in inv_bs_escapes) {
+ c2 = inv_bs_escapes[c]
+ } else
+ c2 = c
+ printf "CM_hex_%02x,\n", ord(c)
+ } else {
+ c2 = c
+ print "CM_" c ","
+ }
+
+ if (commands[c] != "") {
+ flags = "CF_" commands[c]
+ gsub (/,/, " | CF_", flags)
+ } else {
+ flags = "0"
+ }
+
+ if (data[c] != "") {
+ command_data = data[c]
+ } else {
+ command_data = "0"
+ }
+ print "\"" c2 "\", " flags ", " command_data "," > "command_data.c"
+ }
+ print "};" >"command_data.c"
+ print "};"
+}
+
+
Added: trunk/parsetexi/command_data.txt
===================================================================
--- trunk/parsetexi/command_data.txt (rev 0)
+++ trunk/parsetexi/command_data.txt 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,476 @@
+# Information from tp/Texinfo/Common.pm
+
+# Not in Common.pm
+value brace
+
+##############################################################
+# line 353 - no brace commands - single letter commands
+
+* nobrace
+# space
+\x20 nobrace
+\t nobrace
+\n nobrace
+- nobrace
+| nobrace
+/ nobrace
+: nobrace
+! nobrace
+? nobrace
+. nobrace
+@ nobrace
+} nobrace
+{ nobrace
+\\ nobrace
+
+##############################################################
+# line 405 - misc commands. line commands without an @end.
+node misc MISC_line
+bye misc MISC_skipline
+end misc MISC_text
+# set, clear
+set misc
+clear misc
+unmacro misc
+# comments
+c misc MISC_lineraw
+comment misc MISC_lineraw
+# special
+definfoenclose misc
+alias misc
+# number of arguments is not known in advance.
+columnfractions misc 1
+# file names
+setfilename misc MISC_text
+verbatiminclude misc MISC_text
+include misc MISC_text
+
+raisesections misc MISC_skipline
+lowersections misc MISC_skipline
+contents misc MISC_skipline
+shortcontents misc MISC_skipline
+summarycontents misc MISC_skipline
+insertcopying misc
+clickstyle misc
+# more relevant in preamble
+setcontentsaftertitlepage misc MISC_skipline
+setshortcontentsaftertitlepage misc MISC_skipline
+documentencoding misc MISC_text
+novalidate misc MISC_skipline
+dircategory misc MISC_line
+# with direntry is significant
+pagesizes misc MISC_line
+# or one? 200mm,150mm 11.5in
+finalout misc MISC_skipline
+paragraphindent misc
+# or a number and forbids anything else on the line
+firstparagraphindent misc
+frenchspacing misc
+codequoteundirected misc
+codequotebacktick misc
+xrefautomaticsectiontitle misc
+deftypefnnewline misc
+fonttextsize misc
+allowcodebreaks misc
+exampleindent misc
+footnotestyle misc
+urefbreakstyle misc
+afourpaper misc MISC_skipline
+afivepaper misc MISC_skipline
+afourlatex misc MISC_skipline
+afourwide misc MISC_skipline
+headings misc
+# interacts with setchapternewpage
+setchapternewpage misc
+
+# only relevant in TeX, and special
+everyheading misc MISC_lineraw
+everyfooting misc MISC_lineraw
+evenheading misc MISC_lineraw
+evenfooting misc MISC_lineraw
+oddheading misc MISC_lineraw
+oddfooting misc MISC_lineraw
+
+smallbook misc MISC_skipline
+syncodeindex misc
+synindex misc
+defindex misc
+defcodeindex misc
+documentlanguage misc MISC_text
+kbdinputstyle misc
+everyheadingmarks misc
+everyfootingmarks misc
+evenheadingmarks misc
+oddheadingmarks misc
+evenfootingmarks misc
+oddfootingmarks misc
+# not valid for info (should be in @iftex)
+cropmarks misc MISC_skipline
+
+# formatting
+center misc MISC_line
+printindex misc
+listoffloats misc MISC_line
+# especially in titlepage
+# shorttitle
+shorttitlepage misc MISC_line
+settitle misc MISC_line
+author misc MISC_line
+subtitle misc MISC_line
+title misc MISC_line
+sp misc
+page misc MISC_skipline
+need misc
+# formatting
+noindent misc
+indent misc
+exdent misc MISC_line
+headitem misc MISC_skipspace
+item misc MISC_skipspace
+itemx misc MISC_skipspace
+tab misc MISC_skipspace
+# only valid in heading or footing
+thischapter misc
+thischaptername misc
+thischapternum misc
+thisfile misc
+thispage misc
+thistitle misc
+# not valid for info (should be in @iftex)
+vskip misc MISC_lineraw
+# obsolete @-commands.
+refill misc
+# Remove spaces and end of lines after the
+# commands? If no, they can lead to empty lines
+# TODO: Check what these two are.
+#quote-arg misc MISC_skipline
+#allow-recursion misc MISC_skipline
+
+# line 515
+##########################################################
+
+
+##########################################################
+#
+# line 555 - brace commands
+#
+##########################################################
+
+# letter_no_arg_commands
+aa brace 0
+AA brace 0
+ae brace 0
+oe brace 0
+AE brace 0
+OE brace 0
+o brace 0
+O brace 0
+ss brace 0
+l brace 0
+L brace 0
+DH brace 0
+dh brace 0
+TH brace 0
+th brace 0
+
+# no arg commands
+TeX brace 0
+LaTeX brace 0
+bullet brace 0
+copyright brace 0
+registeredsymbol brace 0
+dots brace 0
+enddots brace 0
+equiv brace 0
+error brace 0
+expansion brace 0
+arrow brace 0
+minus brace 0
+point brace 0
+print brace 0
+result brace 0
+today brace 0
+exclamdown brace 0
+questiondown brace 0
+pounds brace 0
+ordf brace 0
+ordm brace 0
+atchar brace 0
+lbracechar brace 0
+rbracechar brace 0
+backslashchar brace 0
+hashchar brace 0
+comma brace 0
+euro brace 0
+geq brace 0
+leq brace 0
+tie brace 0
+textdegree brace 0
+click brace 0
+quotedblleft brace 0
+quotedblright brace 0
+quoteleft brace 0
+quoteright brace 0
+quotedblbase brace 0
+quotesinglbase brace 0
+guillemetleft brace 0
+guillemetright brace 0
+guillemotleft brace 0
+guillemotright brace 0
+guilsinglleft brace 0
+guilsinglright brace 0
+
+# accent commands - can be called with or without braces
+# do we need both "brace" and "accent"?
+# there is special casing on line 3998
+\" brace,accent
+~ brace,accent
+^ brace,accent
+` brace,accent
+' brace,accent
+, brace,accent
+= brace,accent
+ringaccent brace,accent
+H brace,accent
+dotaccent brace,accent
+u brace,accent
+ubaraccent brace,accent
+udotaccent brace,accent
+v brace,accent
+ogonek brace,accent
+tieaccent brace,accent
+dotless brace,accent
+
+# Style commands
+asis brace
+cite brace
+clicksequence brace
+dfn brace
+emph brace
+sc brace
+t brace
+var brace
+headitemfont brace
+code brace
+command brace
+env brace
+file brace
+kbd brace
+option brace
+samp brace
+strong brace
+
+# Regular font style commands 595
+r brace
+i brace
+b brace
+sansserif brace
+slanted brace
+
+# One arg commands
+ctrl brace 1
+dmn brace 1
+w brace 1
+key brace 1
+titlefont brace 1
+hyphenation brace 1
+anchor brace 1
+errormsg brace 1
+
+# code style commands
+code brace
+command brace
+env brace
+file brace
+kbd brace
+key brace
+option brace
+samp brace
+indicateurl brace
+verb brace
+t brace
+
+# context brace commands - commands that enclose full texts
+footnote brace,context_brace
+caption brace,context_brace
+shortcaption brace,context_brace
+math brace,context_brace
+
+# explained commands 624
+abbr brace
+acronym brace
+
+# inline format command
+inlineraw brace,inline
+inlinefmt brace,inline
+inlinefmtifelse brace,inline
+
+# inline conditional commands
+inlineifclear brace,inline
+inlineifset brace,inline
+
+email brace 2
+
+uref brace 3
+url brace 3
+inforef brace,ref 3
+
+xref brace,ref 5
+ref brace,ref 5
+pxref brace,ref 5
+image brace 5
+
+# line 660
+
+
+##########################################################
+# line 687 - "block commands"
+
+# def* commands
+deffn block,def
+defvr block,def
+deftypefn block,def
+deftypeop block,def
+deftypevr block,def
+defcv block,def
+deftypecv block,def
+defop block,def
+deftp block,def
+# shortcuts
+defun block,def
+defmac block,def
+defspec block,def
+defvar block,def
+defopt block,def
+deftypefun block,def
+deftypevar block,def
+defivar block,def
+deftypeivar block,def
+defmethod block,def
+deftypemethod block,def
+
+# def*x
+deffnx misc,def
+defvrx misc,def
+deftypefnx misc,def
+deftypeopx misc,def
+deftypevrx misc,def
+defcvx misc,def
+deftypecvx misc,def
+defopx misc,def
+deftpx misc,def
+# shortcuts
+defunx misc,def
+defmacx misc,def
+defspecx misc,def
+defvarx misc,def
+defoptx misc,def
+deftypefunx misc,def
+deftypevarx misc,def
+defivarx misc,def
+deftypeivarx misc,def
+defmethodx misc,def
+deftypemethodx misc,def
+
+# 760
+multitable block,blockitem BLOCK_multitable
+
+# menu commands
+menu block
+detailmenu block
+direntry block
+
+# align commands
+raggedright block
+flushleft block
+flushright block
+
+# 777
+cartouche block
+group block
+indentedblock block
+smallindentedblock block
+
+# region commands
+titlepage block
+copying block
+documentdescription block
+
+# preformatted commands
+example block,preformatted,preformatted_code
+smallexample block,preformatted,preformatted_code
+lisp block,preformatted,preformatted_code
+smalllisp block,preformatted,preformatted_code
+display block,preformatted
+smalldisplay block,preformatted
+format block,preformatted
+smallformat block,preformatted
+
+# format raw commands
+html block,format_raw
+tex block,format_raw
+xml block,format_raw
+docbook block,format_raw
+
+# raw commands 811
+verbatim block BLOCK_raw
+ignore block BLOCK_raw
+macro block BLOCK_raw
+rmacro block BLOCK_raw
+
+# line 815
+
+# line 831
+table block,blockitem 1
+ftable block,blockitem 1
+vtable block,blockitem 1
+itemize block,blockitem 1
+enumerate block,blockitem 1
+quotation block 1
+smallquotation block 1
+
+float block 2
+
+##################################################################
+# Conditional commands
+ifhtml block BLOCK_conditional
+ifnothtml block BLOCK_conditional
+iftex block BLOCK_conditional
+ifnottex block BLOCK_conditional
+ifxml block BLOCK_conditional
+ifnotxml block BLOCK_conditional
+ifdocbook block BLOCK_conditional
+ifnotdocbook block BLOCK_conditional
+ifinfo block BLOCK_conditional
+ifnotinfo block BLOCK_conditional
+ifplaintext block BLOCK_conditional
+ifnotplaintext block BLOCK_conditional
+ifset block BLOCK_conditional
+ifclear block BLOCK_conditional
+ifcommanddefined block BLOCK_conditional
+ifcommandnotdefined block BLOCK_conditional
+
+##########################################################
+# Root commands - line 887
+node root,misc MISC_line
+top root,misc MISC_line
+chapter root,misc MISC_line
+unnumbered root,misc MISC_line
+chapheading root,misc MISC_line
+appendix root,misc MISC_line
+section root,misc MISC_line
+unnumberedsec root,misc MISC_line
+appendixsec root,misc MISC_line
+subsection root,misc MISC_line
+unnumberedsubsec root,misc MISC_line
+subheading root,misc MISC_line
+appendixsubsec root,misc MISC_line
+subsubsection root,misc MISC_line
+unnumberedsubsubsec root,misc MISC_line
+subsubheading root,misc MISC_line
+appendixsubsubsec root,misc MISC_line
+
+part root,misc MISC_line
+appendixsection root,misc MISC_line
+centerchap root,misc MISC_line
+
Added: trunk/parsetexi/command_ids.h
===================================================================
--- trunk/parsetexi/command_ids.h (rev 0)
+++ trunk/parsetexi/command_ids.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,354 @@
+/* This file automatically generated by command_data.awk */
+enum command_id {
+CM_NONE,
+
+CM_hex_09,
+CM_hex_0a,
+CM_hex_20,
+CM_hex_21,
+CM_hex_22,
+CM_hex_27,
+CM_hex_2a,
+CM_hex_2c,
+CM_hex_2d,
+CM_hex_2e,
+CM_hex_2f,
+CM_hex_3a,
+CM_hex_3d,
+CM_hex_3f,
+CM_hex_40,
+CM_AA,
+CM_AE,
+CM_DH,
+CM_H,
+CM_L,
+CM_LaTeX,
+CM_O,
+CM_OE,
+CM_TH,
+CM_TeX,
+CM_hex_5c,
+CM_hex_5e,
+CM_hex_60,
+CM_aa,
+CM_abbr,
+CM_acronym,
+CM_ae,
+CM_afivepaper,
+CM_afourlatex,
+CM_afourpaper,
+CM_afourwide,
+CM_alias,
+CM_allowcodebreaks,
+CM_anchor,
+CM_appendix,
+CM_appendixsec,
+CM_appendixsection,
+CM_appendixsubsec,
+CM_appendixsubsubsec,
+CM_arrow,
+CM_asis,
+CM_atchar,
+CM_author,
+CM_b,
+CM_backslashchar,
+CM_bullet,
+CM_bye,
+CM_c,
+CM_caption,
+CM_cartouche,
+CM_center,
+CM_centerchap,
+CM_chapheading,
+CM_chapter,
+CM_cite,
+CM_clear,
+CM_click,
+CM_clicksequence,
+CM_clickstyle,
+CM_code,
+CM_codequotebacktick,
+CM_codequoteundirected,
+CM_columnfractions,
+CM_comma,
+CM_command,
+CM_comment,
+CM_contents,
+CM_copying,
+CM_copyright,
+CM_cropmarks,
+CM_ctrl,
+CM_defcodeindex,
+CM_defcv,
+CM_defcvx,
+CM_deffn,
+CM_deffnx,
+CM_defindex,
+CM_definfoenclose,
+CM_defivar,
+CM_defivarx,
+CM_defmac,
+CM_defmacx,
+CM_defmethod,
+CM_defmethodx,
+CM_defop,
+CM_defopt,
+CM_defoptx,
+CM_defopx,
+CM_defspec,
+CM_defspecx,
+CM_deftp,
+CM_deftpx,
+CM_deftypecv,
+CM_deftypecvx,
+CM_deftypefn,
+CM_deftypefnnewline,
+CM_deftypefnx,
+CM_deftypefun,
+CM_deftypefunx,
+CM_deftypeivar,
+CM_deftypeivarx,
+CM_deftypemethod,
+CM_deftypemethodx,
+CM_deftypeop,
+CM_deftypeopx,
+CM_deftypevar,
+CM_deftypevarx,
+CM_deftypevr,
+CM_deftypevrx,
+CM_defun,
+CM_defunx,
+CM_defvar,
+CM_defvarx,
+CM_defvr,
+CM_defvrx,
+CM_detailmenu,
+CM_dfn,
+CM_dh,
+CM_dircategory,
+CM_direntry,
+CM_display,
+CM_dmn,
+CM_docbook,
+CM_documentdescription,
+CM_documentencoding,
+CM_documentlanguage,
+CM_dotaccent,
+CM_dotless,
+CM_dots,
+CM_email,
+CM_emph,
+CM_end,
+CM_enddots,
+CM_enumerate,
+CM_env,
+CM_equiv,
+CM_error,
+CM_errormsg,
+CM_euro,
+CM_evenfooting,
+CM_evenfootingmarks,
+CM_evenheading,
+CM_evenheadingmarks,
+CM_everyfooting,
+CM_everyfootingmarks,
+CM_everyheading,
+CM_everyheadingmarks,
+CM_example,
+CM_exampleindent,
+CM_exclamdown,
+CM_exdent,
+CM_expansion,
+CM_file,
+CM_finalout,
+CM_firstparagraphindent,
+CM_float,
+CM_flushleft,
+CM_flushright,
+CM_fonttextsize,
+CM_footnote,
+CM_footnotestyle,
+CM_format,
+CM_frenchspacing,
+CM_ftable,
+CM_geq,
+CM_group,
+CM_guillemetleft,
+CM_guillemetright,
+CM_guillemotleft,
+CM_guillemotright,
+CM_guilsinglleft,
+CM_guilsinglright,
+CM_hashchar,
+CM_headings,
+CM_headitem,
+CM_headitemfont,
+CM_html,
+CM_hyphenation,
+CM_i,
+CM_ifclear,
+CM_ifcommanddefined,
+CM_ifcommandnotdefined,
+CM_ifdocbook,
+CM_ifhtml,
+CM_ifinfo,
+CM_ifnotdocbook,
+CM_ifnothtml,
+CM_ifnotinfo,
+CM_ifnotplaintext,
+CM_ifnottex,
+CM_ifnotxml,
+CM_ifplaintext,
+CM_ifset,
+CM_iftex,
+CM_ifxml,
+CM_ignore,
+CM_image,
+CM_include,
+CM_indent,
+CM_indentedblock,
+CM_indicateurl,
+CM_inforef,
+CM_inlinefmt,
+CM_inlinefmtifelse,
+CM_inlineifclear,
+CM_inlineifset,
+CM_inlineraw,
+CM_insertcopying,
+CM_item,
+CM_itemize,
+CM_itemx,
+CM_kbd,
+CM_kbdinputstyle,
+CM_key,
+CM_l,
+CM_lbracechar,
+CM_leq,
+CM_lisp,
+CM_listoffloats,
+CM_lowersections,
+CM_macro,
+CM_math,
+CM_menu,
+CM_minus,
+CM_multitable,
+CM_need,
+CM_node,
+CM_noindent,
+CM_novalidate,
+CM_o,
+CM_oddfooting,
+CM_oddfootingmarks,
+CM_oddheading,
+CM_oddheadingmarks,
+CM_oe,
+CM_ogonek,
+CM_option,
+CM_ordf,
+CM_ordm,
+CM_page,
+CM_pagesizes,
+CM_paragraphindent,
+CM_part,
+CM_point,
+CM_pounds,
+CM_print,
+CM_printindex,
+CM_pxref,
+CM_questiondown,
+CM_quotation,
+CM_quotedblbase,
+CM_quotedblleft,
+CM_quotedblright,
+CM_quoteleft,
+CM_quoteright,
+CM_quotesinglbase,
+CM_r,
+CM_raggedright,
+CM_raisesections,
+CM_rbracechar,
+CM_ref,
+CM_refill,
+CM_registeredsymbol,
+CM_result,
+CM_ringaccent,
+CM_rmacro,
+CM_samp,
+CM_sansserif,
+CM_sc,
+CM_section,
+CM_set,
+CM_setchapternewpage,
+CM_setcontentsaftertitlepage,
+CM_setfilename,
+CM_setshortcontentsaftertitlepage,
+CM_settitle,
+CM_shortcaption,
+CM_shortcontents,
+CM_shorttitlepage,
+CM_slanted,
+CM_smallbook,
+CM_smalldisplay,
+CM_smallexample,
+CM_smallformat,
+CM_smallindentedblock,
+CM_smalllisp,
+CM_smallquotation,
+CM_sp,
+CM_ss,
+CM_strong,
+CM_subheading,
+CM_subsection,
+CM_subsubheading,
+CM_subsubsection,
+CM_subtitle,
+CM_summarycontents,
+CM_syncodeindex,
+CM_synindex,
+CM_t,
+CM_tab,
+CM_table,
+CM_tex,
+CM_textdegree,
+CM_th,
+CM_thischapter,
+CM_thischaptername,
+CM_thischapternum,
+CM_thisfile,
+CM_thispage,
+CM_thistitle,
+CM_tie,
+CM_tieaccent,
+CM_title,
+CM_titlefont,
+CM_titlepage,
+CM_today,
+CM_top,
+CM_u,
+CM_ubaraccent,
+CM_udotaccent,
+CM_unmacro,
+CM_unnumbered,
+CM_unnumberedsec,
+CM_unnumberedsubsec,
+CM_unnumberedsubsubsec,
+CM_uref,
+CM_urefbreakstyle,
+CM_url,
+CM_v,
+CM_value,
+CM_var,
+CM_verb,
+CM_verbatim,
+CM_verbatiminclude,
+CM_vskip,
+CM_vtable,
+CM_w,
+CM_xml,
+CM_xref,
+CM_xrefautomaticsectiontitle,
+CM_hex_7b,
+CM_hex_7c,
+CM_hex_7d,
+CM_hex_7e,
+};
Added: trunk/parsetexi/commands.c
===================================================================
--- trunk/parsetexi/commands.c (rev 0)
+++ trunk/parsetexi/commands.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,127 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "command_ids.h"
+#include "commands.h"
+#include "command_data.c"
+
+COMMAND *user_defined_command_data = 0;
+static size_t user_defined_number = 0;
+static size_t user_defined_space = 0;
+
+static int
+compare_command_fn (const void *a, const void *b)
+{
+ const COMMAND *ca = (COMMAND *) a;
+ const COMMAND *cb = (COMMAND *) b;
+
+ return strcmp (ca->cmdname, cb->cmdname);
+}
+
+/* Return element number in command_data array. Return 0 if not found. */
+enum command_id
+lookup_command (char *cmdname)
+{
+ COMMAND *c;
+ COMMAND target;
+ int i;
+
+ target.cmdname = cmdname;
+
+ c = (COMMAND *) bsearch (&target, builtin_command_data + 1,
+ /* number of elements */
+ sizeof (builtin_command_data) / sizeof (builtin_command_data[0]) - 1,
+ sizeof (builtin_command_data[0]),
+ compare_command_fn);
+
+ if (c)
+ return c - &builtin_command_data[0];
+
+ /* Check for user-defined commands: macros, indexes, etc. */
+ for (i = 0; i < user_defined_number; i++)
+ {
+ if (!strcmp (user_defined_command_data[i].cmdname, cmdname))
+ return ((enum command_id) i) | USER_COMMAND_BIT;
+ }
+
+ return 0;
+}
+
+/* Add a new user-defined Texinfo command, like an index or macro command. No
+ reference to NAME is retained. */
+enum command_id
+add_texinfo_command (char *name)
+{
+ if (user_defined_number == user_defined_space)
+ {
+ user_defined_command_data
+ = realloc (user_defined_command_data,
+ (user_defined_space += 10) * sizeof (COMMAND));
+ if (!user_defined_command_data)
+ abort ();
+ }
+
+ user_defined_command_data[user_defined_number].cmdname = strdup (name);
+ user_defined_command_data[user_defined_number].flags = 0;
+ user_defined_command_data[user_defined_number].data = 0;
+
+ return ((enum command_id) user_defined_number++) | USER_COMMAND_BIT;
+}
+
+/* Common.pm:841. */
+/* Commands that terminate a paragraph. */
+/* We may replace this function with a macro, or represent this infomation in
+ command_data. */
+int
+close_paragraph_command (enum command_id cmd_id)
+{
+ /* Block commands except 'raw' and 'conditional'. */
+ if (command_data(cmd_id).flags & CF_block)
+ {
+ if (command_data(cmd_id).data == BLOCK_conditional
+ || command_data(cmd_id).data == BLOCK_raw)
+ return 0;
+
+ return 1;
+ }
+
+ /* several others Common.pm:852 */
+ if (cmd_id == CM_titlefont
+ || cmd_id == CM_insertcopying
+ || cmd_id == CM_sp
+ || cmd_id == CM_verbatiminclude
+ || cmd_id == CM_page
+ || cmd_id == CM_item
+ || cmd_id == CM_itemx
+ || cmd_id == CM_tab
+ || cmd_id == CM_headitem
+ || cmd_id == CM_printindex
+ || cmd_id == CM_listoffloats
+ || cmd_id == CM_center
+ || cmd_id == CM_dircategory
+ || cmd_id == CM_contents
+ || cmd_id == CM_shortcontents
+ || cmd_id == CM_summarycontents
+ || cmd_id == CM_caption
+ || cmd_id == CM_shortcaption
+ || cmd_id == CM_setfilename
+ || cmd_id == CM_exdent)
+ return 1;
+
+ /* def commands */
+
+ return 0;
+}
+
+// Parser.pm:348
+int
+close_preformatted_command (enum command_id cmd_id)
+{
+ return cmd_id != CM_sp && close_paragraph_command (cmd_id);
+}
+
+int
+item_line_command (enum command_id cmd_id)
+{
+ return cmd_id == CM_table || cmd_id == CM_ftable || cmd_id == CM_vtable;
+}
Added: trunk/parsetexi/commands.h
===================================================================
--- trunk/parsetexi/commands.h (rev 0)
+++ trunk/parsetexi/commands.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,85 @@
+typedef struct command_struct {
+ char *cmdname;
+ unsigned long flags; /* Up to 32 flags */
+ int data; /* Number of arguments for brace commands. */
+} COMMAND;
+
+extern COMMAND builtin_command_data[];
+extern COMMAND *user_defined_command_data;
+
+/* Command ID's with this bit set represent a user-defined command. */
+#define USER_COMMAND_BIT 0x8000
+
+enum command_id lookup_command (char *cmdname);
+
+#define command_data(id) \
+ (!((id) & USER_COMMAND_BIT) \
+ ? builtin_command_data[(id)] \
+ : user_defined_command_data[(id) & ~USER_COMMAND_BIT])
+
+#define command_flags(e) (command_data((e)->cmd).flags)
+
+enum command_id add_texinfo_command (char *name);
+
+/* In indices.c */
+void init_index_commands (void);
+
+/* Available command flags. Based on tp/Texinfo/Common.tp. */
+
+#define CF_misc 0x0001
+#define CF_default_index 0x0002
+#define CF_root 0x0004
+#define CF_sectioning 0x0008
+#define CF_brace 0x0010
+#define CF_letter_no_arg 0x0020
+#define CF_accent 0x0040
+#define CF_style 0x0080
+#define CF_code_style 0x0100
+#define CF_regular_font_style 0x0200
+#define CF_context_brace 0x0400
+#define CF_ref 0x0800
+#define CF_explained 0x1000
+#define CF_block 0x2000
+#define CF_raw 0x4000
+#define CF_format_raw 0x8000
+// #define free 0x00010000
+#define CF_def 0x00020000
+#define CF_def_aliases 0x00040000
+#define CF_menu 0x00080000
+#define CF_align 0x00100000
+#define CF_region 0x00200000
+#define CF_preformatted 0x00400000
+#define CF_preformatted_code 0x00800000
+#define CF_item_container 0x01000000
+#define CF_item_line 0x02000000
+#define CF_nobrace 0x04000000
+#define CF_blockitem 0x08000000
+#define CF_inline 0x10000000
+#define CF_MACRO 0x20000000
+// #define free 0x40000000
+// #define free 0x80000000
+
+/* Types of misc command (has CF_misc flag). Values for COMMAND.data. */
+/* See Common.pm:376 */
+#define MISC_special -1
+#define MISC_lineraw -2
+#define MISC_skipline -3
+#define MISC_skipspace -4
+#define MISC_noarg -5
+#define MISC_text -6
+#define MISC_line -7
+
+/* Types of block command (CF_block). Common.pm:687. */
+#define BLOCK_conditional -1
+#define BLOCK_raw -2
+#define BLOCK_multitable -3
+
+#if 0
+/* Types of brace command could go in 'flags', although then we risk running
+ out of space for flags. If it does then we have the 'data' field free to
+ store a number of args in. */
+
+/* Types of brace command (CF_brace). */
+#define BRACE_context_brace -1
+
+#endif
Added: trunk/parsetexi/compile
===================================================================
--- trunk/parsetexi/compile (rev 0)
+++ trunk/parsetexi/compile 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Written by Tom Tromey <address@hidden>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <address@hidden> or send patches to
+# <address@hidden>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <address@hidden>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Property changes on: trunk/parsetexi/compile
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/complete_tree.pl
===================================================================
--- trunk/parsetexi/complete_tree.pl (rev 0)
+++ trunk/parsetexi/complete_tree.pl 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+# Don't know exactly what this is but it's probably a good idea.
+use 5.006;
+use strict;
+
+use Data::Dumper;
+
+sub add_parents ($) {
+ my $elt = shift;
+
+ if (exists $elt->{'contents'}) {
+ foreach my $child (@{$elt->{'contents'}}) {
+ $child->{'parent'} = $elt;
+ add_parents ($child);
+ }
+ }
+
+ if (exists $elt->{'args'}) {
+ foreach my $child (@{$elt->{'args'}}) {
+ $child->{'parent'} = $elt;
+ add_parents ($child);
+ }
+ }
+}
+
+my $in_file = $ARGV[0];
+my $tree_stream;
+
+print "Getting tree...\n";
+
+$tree_stream = qx(./parsetexi $in_file 2>/dev/null);
+print "Got tree.\n";
+
+my $VAR1;
+print "Reading tree...\n";
+eval $tree_stream;
+print "Read tree.\n";
+
+print "Adjusting tree...\n";
+add_parents ($VAR1);
+print "Adjusted tree.\n";
+
+$Data::Dumper::Purity = 1;
+$Data::Dumper::Indent = 1;
+#my $bar = Data::Dumper->Dump([$VAR1], ['$VAR1']);
+#print $bar;
+
Property changes on: trunk/parsetexi/complete_tree.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/configure
===================================================================
--- trunk/parsetexi/configure (rev 0)
+++ trunk/parsetexi/configure 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,4719 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for parsetexi 0.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo";
then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file
name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh)
>/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"address@hidden"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"address@hidden"}'='\"address@hidden"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested="
as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested"
as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested"
as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" =
\"x\$as_lineno_2'\$as_run'\"' || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null;
then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a
"$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" |
as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a
"$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell address@hidden about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"}
as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX
shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed
'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='parsetexi'
+PACKAGE_TARNAME='parsetexi'
+PACKAGE_VERSION='0'
+PACKAGE_STRING='parsetexi 0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+SET_MAKE
+AWK
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+mkdir_p
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_dependency_tracking
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *)
ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *)
ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *)
ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *)
ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option}
${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options:
$ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures parsetexi 0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/parsetexi]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of parsetexi 0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed
's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir"
>&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+parsetexi configure 0
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by parsetexi $as_me 0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n
'\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable
$ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed
"s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed
"s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script
$ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to
\`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous
run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set
in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has
changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace
changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the
previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value:
\`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value:
\`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment
can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build"
>&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start
over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_config_files="$ac_config_files Makefile"
+
+am__api_version='1.99a'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\"
\"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible
install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two
"`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is
sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too
old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program
name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not
prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet"
>&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p"
>&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with
args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets
\$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports
nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+mkdir_p='$(MKDIR_P)'
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make
distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='parsetexi'
+ VERSION='0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell address@hidden about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+ fi
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program
name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not
prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet"
>&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program
name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a
program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with
args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not
prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet"
>&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in
\`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler
works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map
| *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map
| *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default
output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables"
>&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map
| *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross
compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files"
>&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map
| *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU
C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO
C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int,
int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c
and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o
conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+DEPDIR=.deps
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by
$am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc"
>&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`;
do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable
$ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache
$cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[
]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[
]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are
newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo";
then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file
name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"}
as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed
'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by parsetexi $as_me 0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //;
s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+parsetexi config.status 0
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create
--no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be
DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;;
esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed
's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
address@hidden@*|address@hidden@*|address@hidden@*|address@hidden@*|address@hidden@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to
ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir
setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a
reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable
\`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands"
>&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null
2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no;
then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options:
$ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
Property changes on: trunk/parsetexi/configure
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/configure.ac
===================================================================
--- trunk/parsetexi/configure.ac (rev 0)
+++ trunk/parsetexi/configure.ac 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,6 @@
+AC_INIT([parsetexi], [0])
+AC_CONFIG_FILES([Makefile])
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+AC_OUTPUT
Added: trunk/parsetexi/context_stack.c
===================================================================
--- trunk/parsetexi/context_stack.c (rev 0)
+++ trunk/parsetexi/context_stack.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+
+#include "context_stack.h"
+
+static enum context *stack;
+static size_t top; /* One above last pushed context. */
+static size_t space;
+
+void
+push_context (enum context c)
+{
+ if (top >= space)
+ {
+ stack = realloc (stack, (space += 5) * sizeof (enum context));
+ }
+
+ stack[top++] = c;
+}
+
+enum context
+pop_context ()
+{
+ if (top == 0)
+ abort ();
+
+ return stack[--top];
+}
+
+enum context
+current_context (void)
+{
+ if (top == 0)
+ return ct_NONE;
+
+ return stack[top - 1];
+}
Added: trunk/parsetexi/context_stack.h
===================================================================
--- trunk/parsetexi/context_stack.h (rev 0)
+++ trunk/parsetexi/context_stack.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,28 @@
+enum context {
+ ct_NONE,
+ ct_line,
+ ct_def,
+ ct_preformatted,
+ ct_rawpreformatted,
+ ct_menu,
+ ct_math,
+ ct_footnote,
+ ct_caption,
+ ct_shortcaption,
+ ct_inlineraw
+};
+
+/* Contexts where an empty line doesn't start a new paragraph. */
+/* line 492 */
+#define in_no_paragraph_contexts(c) \
+ ((c) == ct_math \
+ || (c) == ct_menu \
+ || (c) == ct_def \
+ || (c) == ct_preformatted \
+ || (c) == ct_rawpreformatted \
+ || (c) == ct_inlineraw)
+
+void push_context (enum context c);
+enum context pop_context ();
+enum context current_context (void);
+
Added: trunk/parsetexi/convert.c
===================================================================
--- trunk/parsetexi/convert.c (rev 0)
+++ trunk/parsetexi/convert.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+
+#include "tree_types.h"
+
+/* Stub for Texinfo::Convert::Text::convert */
+char *
+text_convert (ELEMENT *e)
+{
+ int which = e->contents.number;
+ which--;
+ if (which > 0)
+ {
+ if (e->contents.list[which]->type == ET_spaces_at_end)
+ which--;
+
+ if (which > 0)
+ return e->contents.list[which]->text.text;
+ }
+ return "bar";
+}
Added: trunk/parsetexi/debug.c
===================================================================
--- trunk/parsetexi/debug.c (rev 0)
+++ trunk/parsetexi/debug.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdio.h>
+
+
+void
+debug (char *s, ...)
+{
+ //return;
+ va_list v;
+ va_start (v, s);
+ vfprintf (stderr, s, v);
+ fputc ('\n', stderr);
+}
+
+void
+debug_nonl (char *s, ...)
+{
+ //return;
+ va_list v;
+ va_start (v, s);
+ vfprintf (stderr, s, v);
+}
Added: trunk/parsetexi/debug_perl.txt
===================================================================
--- trunk/parsetexi/debug_perl.txt (rev 0)
+++ trunk/parsetexi/debug_perl.txt 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,6 @@
+perl -d `which makeinfo` sample.texi
+
+b /usr/local/share/texinfo/Texinfo/Parser.pm:5344
+
+p _print_tree ($current)
+
Added: trunk/parsetexi/def.c
===================================================================
--- trunk/parsetexi/def.c (rev 0)
+++ trunk/parsetexi/def.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,156 @@
+#include "parser.h"
+
+// 1471
+void
+gather_def_item (ELEMENT *current /* , enum command_id next_command */ )
+{
+ enum element_type type;
+ ELEMENT *def_item;
+ int contents_count, i;
+
+ // TODO: ET_inter_def_item.
+ type = ET_def_item;
+
+ if (!current->cmd)
+ return;
+
+ /* Check this isn't an "x" type command.
+ "This may happen for a construct like:
+ @deffnx a b @section
+ but otherwise the end of line will lead to the command closing." */
+ if (command_data(current->cmd).flags & CF_misc)
+ return;
+
+ def_item = new_element (type);
+
+ /* Starting from the end, collect everything that is not a ET_def_line and
+ put it into the ET_def_item. */
+ contents_count = current->contents.number;
+ for (i = 0; i < contents_count; i++)
+ {
+ ELEMENT *last_child, *item_content;
+ last_child = last_contents_child (current);
+ if (last_child->type == ET_def_line)
+ break;
+ item_content = pop_element_from_contents (current);
+ insert_into_contents (def_item, item_content, 0);
+ }
+
+ if (def_item->contents.number > 0)
+ add_to_element_contents (current, def_item);
+ else
+ destroy_element (def_item);
+}
+
+#if 0
+/* *SPACES is set to... */
+static void
+next_bracketed_or_word (char **spaces)
+{
+ /* Change ET_bracketed to ET_bracketed_def_content. */
+}
+
+enum arg_type { end, category, name, arg, type, argtype, class };
+
+typedef struct {
+ enum command_id alias;
+ enum command_id command;
+ char *index_name;
+} DEF_ALIAS;
+
+DEF_MAP def_aliases[];
+};
+
+
+/* Parse the arguments on a def* command line. */
+/* Note that this does more than the Perl version. */
+// 2378
+char **
+parse_def (enum command_id command, ELEMENT_LIST contents)
+{
+ char *category;
+ enum command_id original_command = CM_NONE;
+
+ /* Check for "def alias" - for example defun for deffn
+ 'defun', {'deffn' => gdt('Function')},
+
+ Overwrite command with deffn.
+
+ Prepended content is stuck into contents, so
+ defun is converted into
+ deffn Function
+ */
+ if (command_data(command).flags & CF_def_alias)
+ {
+ int i;
+ for (i = 0; i < sizeof (def_aliases) / sizeof (*def_aliases); i++)
+ {
+ if (def_aliases[i].alias == command)
+ goto found;
+ }
+ abort ();
+found:
+ category = def_aliases[i].index_name;
+ original_command = command;
+ command = def_aliases[i].command;
+
+ /* Perl does something with gettext here, so category is not just
+ a string, but also a Texinfo tree. Why? */
+ }
+
+
+ // @args is def_map
+ // $arg_type - set if there are supposed to be arguments
+
+ /* Read arguments as [CATEGORY] [CLASS] [TYPE] NAME [ARGUMENTS] */
+
+ if (!category)
+ {
+ /* Next arg is the category. */
+ }
+
+ if (command == CM_deftypeop
+ || command == CM_defcv
+ || command == CM_deftypecv
+ || command == CM_op)
+ /* Next arg is the class. */
+ {
+ next_bracketed_or_word ();
+ }
+
+ if (command == CM_deftypefn
+ || command == CM_deftypeop
+ || command == CM_deftypevr
+ || command == CM_deftypecv)
+ /* Next arg is the type. */
+ {
+ next_bracketed_or_word ();
+ }
+
+ /* All command types get a name. */
+ name = next_bracketed_or_word ();
+
+ // ...
+
+
+ /* @result is an array of pairs, left being the type of argument (e.g.
+ 'class', right being the argument given. */
+
+ /* @args_results are the arguments at the end I suppose. Left side of
+ elements are either 'arg' or 'delimeter'. */
+
+ /* For 'argtype', change some of the left sides to 'typearg'. */
+
+ /* @args and @args_results are concatenated and returned. */
+
+
+ // In calling code at 2788, this array is saved in the extra key.
+
+ // 2853 an index entry is also entered
+ enter_index_entry (command, original_command, name
+ /* , index_entry_normalized */ );
+
+ /* Notes: See 2812 for value of 'name'. */
+
+}
+#endif
Added: trunk/parsetexi/def.h
===================================================================
--- trunk/parsetexi/def.h (rev 0)
+++ trunk/parsetexi/def.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1 @@
+void gather_def_item (ELEMENT *current /* , enum command_id next_command */ );
Added: trunk/parsetexi/depcomp
===================================================================
--- trunk/parsetexi/depcomp (rev 0)
+++ trunk/parsetexi/depcomp 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,756 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2013-05-30.07; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <address@hidden>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <address@hidden>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ aix_post_process_depfile
+ ;;
+
+tcc)
+ # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+ # FIXME: That version still under development at the moment of writing.
+ # Make that this statement remains true also for stable, released
+ # versions.
+ # It will wrap lines (doesn't matter whether long or short) with a
+ # trailing '\', as in:
+ #
+ # foo.o : \
+ # foo.c \
+ # foo.h \
+ #
+ # It will put a trailing '\' even on the last line, and will use leading
+ # spaces rather than leading tabs (at least since its commit 0394caf7
+ # "Emit spaces for -MD").
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+ # We have to change lines of the first kind to '$object: \'.
+ sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+ # And for each line of the second kind, we have to emit a 'dep.h:'
+ # dummy dependency, to avoid the deleted-header problem.
+ sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\' :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ set_dir_from "$object"
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ set_base_from "$source"
+ tmpdepfile=$base.d
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir=$base.d-lock
+ trap "
+ echo '$0: caught signal, cleaning up...' >&2
+ rmdir '$lockdir'
+ exit 1
+ " 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0; do
+ # mkdir is a portable test-and-set.
+ if mkdir "$lockdir" 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rmdir "$lockdir"
+ break
+ else
+ # If the lock is being held by a different process, wait
+ # until the winning process is done or we timeout.
+ while test -d "$lockdir" && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ make_dummy_depfile
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ set_dir_from "$object"
+ set_base_from "$object"
+
+ if test "$libtool" = yes; then
+ # Libtool generates 2 separate objects for the 2 libraries. These
+ # two compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir$base.o.d # libtool 1.5
+ tmpdepfile2=$dir.libs/$base.o.d # Likewise.
+ tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ # Same post-processing that is required for AIX mode.
+ aix_post_process_depfile
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this sed invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process the last invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed '1,2d' "$tmpdepfile" \
+ | tr ' ' "$nl" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E \
+ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ | sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u >
"$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >>
"$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Property changes on: trunk/parsetexi/depcomp
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/element_types.awk
===================================================================
--- trunk/parsetexi/element_types.awk (rev 0)
+++ trunk/parsetexi/element_types.awk 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,25 @@
+BEGIN {
+ print "/* This file automatically generated by element_types.awk */"
+ print "enum element_type {"
+ print "ET_NONE,"
+}
+
+!/^$/ && !/^#/ {
+ print "ET_" $1 ","
+ array = array "\"" $1 "\",\n"
+}
+
+END {
+ print "};"
+ print
+ print "extern char *element_type_names[];"
+ print "char *element_type_names[] = {" > "element_types.c"
+ print "0," > "element_types.c"
+ print array > "element_types.c"
+ print "};" > "element_types.c"
+}
+
+function output_array (string)
+{
+ print string > "element_types.c"
+}
Added: trunk/parsetexi/element_types.c
===================================================================
--- trunk/parsetexi/element_types.c (rev 0)
+++ trunk/parsetexi/element_types.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,59 @@
+char *element_type_names[] = {
+0,
+"command_as_argument",
+"index_entry_command",
+"following_arg",
+"space_command_arg",
+"definfoenclose_command",
+"empty_line",
+"raw",
+"last_raw_newline",
+"empty_line_after_command",
+"empty_spaces_after_command",
+"spaces_at_end",
+"empty_space_at_end_def_bracketed",
+"space_at_end_block_command",
+"empty_spaces_before_argument",
+"empty_spaces_after_close_brace",
+"empty_spaces_before_paragraph",
+"preamble_text",
+"space_at_end_menu_node",
+"after_description_line",
+"text_root",
+"document_root",
+"root_line",
+"preamble",
+"preamble_before_setfilename",
+"paragraph",
+"preformatted",
+"rawpreformatted",
+"brace_command_arg",
+"brace_command_context",
+"block_line_arg",
+"misc_line_arg",
+"misc_arg",
+"menu_entry_leading_text",
+"menu_entry_name",
+"menu_entry_separator",
+"menu_entry_node",
+"menu_entry_description",
+"menu_comment",
+"macro_name",
+"macro_arg",
+"before_item",
+"table_entry",
+"table_term",
+"table_item",
+"inter_item",
+"def_line",
+"def_item",
+"inter_def_item",
+"multitable_head",
+"multitable_body",
+"row",
+"bracketed",
+"bracketed_def_content",
+"bracketed_multitable_prototype",
+"row_prototype",
+
+};
Added: trunk/parsetexi/element_types.h
===================================================================
--- trunk/parsetexi/element_types.h (rev 0)
+++ trunk/parsetexi/element_types.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,61 @@
+/* This file automatically generated by element_types.awk */
+enum element_type {
+ET_NONE,
+ET_command_as_argument,
+ET_index_entry_command,
+ET_following_arg,
+ET_space_command_arg,
+ET_definfoenclose_command,
+ET_empty_line,
+ET_raw,
+ET_last_raw_newline,
+ET_empty_line_after_command,
+ET_empty_spaces_after_command,
+ET_spaces_at_end,
+ET_empty_space_at_end_def_bracketed,
+ET_space_at_end_block_command,
+ET_empty_spaces_before_argument,
+ET_empty_spaces_after_close_brace,
+ET_empty_spaces_before_paragraph,
+ET_preamble_text,
+ET_space_at_end_menu_node,
+ET_after_description_line,
+ET_text_root,
+ET_document_root,
+ET_root_line,
+ET_preamble,
+ET_preamble_before_setfilename,
+ET_paragraph,
+ET_preformatted,
+ET_rawpreformatted,
+ET_brace_command_arg,
+ET_brace_command_context,
+ET_block_line_arg,
+ET_misc_line_arg,
+ET_misc_arg,
+ET_menu_entry_leading_text,
+ET_menu_entry_name,
+ET_menu_entry_separator,
+ET_menu_entry_node,
+ET_menu_entry_description,
+ET_menu_comment,
+ET_macro_name,
+ET_macro_arg,
+ET_before_item,
+ET_table_entry,
+ET_table_term,
+ET_table_item,
+ET_inter_item,
+ET_def_line,
+ET_def_item,
+ET_inter_def_item,
+ET_multitable_head,
+ET_multitable_body,
+ET_row,
+ET_bracketed,
+ET_bracketed_def_content,
+ET_bracketed_multitable_prototype,
+ET_row_prototype,
+};
+
+extern char *element_type_names[];
Added: trunk/parsetexi/element_types.txt
===================================================================
--- trunk/parsetexi/element_types.txt (rev 0)
+++ trunk/parsetexi/element_types.txt 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,62 @@
+# Types for @-commands
+#def_line # duplicated below
+command_as_argument
+index_entry_command
+following_arg
+space_command_arg
+definfoenclose_command
+
+# For text elements
+empty_line
+raw
+last_raw_newline
+empty_line_after_command
+empty_spaces_after_command
+spaces_at_end
+empty_space_at_end_def_bracketed
+space_at_end_block_command
+empty_spaces_before_argument
+empty_spaces_after_close_brace
+empty_spaces_before_paragraph
+preamble_text
+space_at_end_menu_node
+after_description_line
+
+# Other special types
+text_root
+document_root
+root_line
+preamble
+preamble_before_setfilename
+paragraph
+preformatted
+rawpreformatted
+brace_command_arg
+brace_command_context
+block_line_arg
+misc_line_arg
+misc_arg
+menu_entry_leading_text
+menu_entry_name
+menu_entry_separator
+menu_entry_node
+menu_entry_description
+menu_comment
+macro_name
+macro_arg
+before_item
+table_entry
+table_term
+table_item
+inter_item
+def_line
+def_item
+inter_def_item
+multitable_head
+multitable_body
+row
+bracketed
+bracketed_def_content
+bracketed_multitable_prototype
+row_prototype
+
Added: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c (rev 0)
+++ trunk/parsetexi/end_line.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,345 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "parser.h"
+#include "tree.h"
+#include "text.h"
+#include "input.h"
+
+/* In convert.c */
+char *text_convert (ELEMENT *e);
+
+/* 2610 */
+/* Actions to be taken when a whole line of input has been processed */
+ELEMENT *
+end_line (ELEMENT *current)
+{
+ char *end_command = 0;
+ enum command_id end_id;
+
+ /* If empty line, start a new paragraph. */
+ if (last_contents_child (current)
+ && last_contents_child (current)->type == ET_empty_line)
+ {
+ debug ("END EMPTY LINE");
+ if (current->type == ET_paragraph) /* 2625 */
+ {
+ ELEMENT *e;
+ /* Remove empty_line element. */
+ e = pop_element_from_contents (current);
+
+ current = end_paragraph (current);
+
+ /* Add empty_line to higher-level element. */
+ add_to_element_contents (current, e);
+ }
+ //else if () // in menu_entry_description
+ else if (!in_no_paragraph_contexts (current_context ()))
+ {
+ current = end_paragraph (current);
+ }
+ }
+
+ /* Is it a line of a menu? */ /* line 2667 */
+
+ /* Is it a def line 2778 */
+ else if (current->parent && current->parent->type == ET_def_line)
+ {
+ enum element_type def_command;
+
+ if (pop_context () != ct_def)
+ {
+ abort ();
+ }
+
+#if 0
+ /* current->parent is a ET_def_line, and current->parent->parent
+ the def command. */
+ def_command = current->parent->parent->cmd;
+ // strip a trailing x
+ parse_def (def_command, current->contents);
+#endif
+
+ current = current->parent->parent;
+ current = begin_preformatted (current);
+
+ }
+
+ /* block line arg command 2872 */
+ else if (current->type == ET_block_line_arg)
+ {
+ enum context c;
+ // pop and check context_stack
+ c = pop_context ();
+ if (c != ct_line)
+ {
+ // bug
+ abort ();
+ }
+
+ // 2881
+ if (current->parent->cmd == CM_multitable)
+ {
+ /* Parse prototype row */
+ // But not @columnfractions, I assume?
+ }
+
+ if (current->parent->cmd == CM_float) // 2943
+ {
+ }
+ current = current->parent; //2965
+
+ /* Don't consider empty argument of block @-command as argument,
+ reparent them as contents. */
+ if (current->args.list[0]->contents.number > 0
+ && current->args.list[0]->contents.list[0]->type
+ == ET_empty_line_after_command)
+ {
+ ELEMENT *e;
+ e = current->args.list[0]->contents.list[0];
+ insert_into_contents (current, e, 0);
+ // TODO: Free lists?
+ current->args.number = 0;
+ }
+
+ if (command_flags(current) & CF_blockitem) // 2981
+ {
+ if (current->cmd == CM_enumerate)
+ {
+ }
+ else if (item_line_command (current->cmd)) // 3002
+ {
+ // check command_as_argument registered in 'extra', and
+ // that it accepts arguments in braces
+ }
+
+ if (current->cmd == CM_itemize) // 3019
+ {
+ // check that command_as_argument is alone on the line
+ }
+
+ // check if command_as_argument isn't an accent command
+
+ /* 3052 - if no command_as_argument given, default to @bullet for
+ @itemize, and @asis for @table. */
+
+ {
+ ELEMENT *bi = new_element (ET_before_item);
+ add_to_element_contents (current, bi);
+ current = bi;
+ }
+ } /* CF_blockitem */
+ }
+
+ /* after an "@end verbatim" 3090 */
+ else if (current->contents.number
+ && last_contents_child(current)->type == ET_empty_line_after_command
+ /* The Perl version gets the command with the 'command' key in 'extra'. */
+ && contents_child_by_index(current, -2)
+ && contents_child_by_index(current, -2)->cmd == CM_verbatim)
+ {
+ // I don't know what this means. raw command is @html etc.?
+ /*
+ if we are after a @end verbatim, we must restart a preformatted if needed,
+ since there is no @end command explicitly associated to raw commands
+ it won't be done elsewhere.
+ */
+
+ current = begin_preformatted (current);
+ }
+
+
+ /* if it's a misc line arg 3100 */
+ else if (current->type == ET_misc_line_arg)
+ {
+ int cmd_id, arg_type;
+ enum context c;
+
+ isolate_last_space (current);
+
+ current = current->parent;
+ cmd_id = current->cmd;
+ if (!cmd_id)
+ abort ();
+
+ arg_type = command_data(cmd_id).data;
+
+ /* Check 'line' is top of the context stack */
+ c = pop_context ();
+ if (c != ct_line)
+ {
+ /* error */
+ abort ();
+ }
+
+ // 3114
+ debug ("MISC END %s", command_data(cmd_id).cmdname);
+
+ if (arg_type > 0)
+ {
+ /* arg_type is number of args */
+ // parse_line_command_args
+ // save in 'misc_args' extra key
+ }
+ else if (arg_type == MISC_text) /* 3118 */
+ {
+ char *text;
+
+ /* argument string has to be parsed as Texinfo. This calls convert
in
+ Common/Text.pm on the first element of current->args. */
+ /* however, this makes it impossible to decouple the parser and
+ output stages... Any use of Texinfo::Convert is problematic. */
+
+ if (current->args.number > 0)
+ text = text_convert (current->args.list[0]);
+ else
+ text = "foo";
+
+ if (!strcmp (text, ""))
+ {
+ /* 3123 warning - missing argument */
+ abort ();
+ }
+ else
+ {
+ if (current->cmd == CM_end) /* 3128 */
+ {
+ char *line = text;
+
+ /* Set end_command - used below. */
+ end_command = read_command_name (&line);
+
+ /* Check argument meets format of a Texinfo command
+ (alphanumberic character followed by alphanumeric
+ characters or hyphens. */
+
+ /* Check if argument is a block Texinfo command. */
+ end_id = lookup_command (end_command);
+ if (end_id == -1 || !(command_data(end_id).flags & CF_block))
+ {
+ /* error - unknown @end */
+ }
+ else
+ {
+ debug ("END BLOCK %s", end_command);
+ /* 3140 Handle conditional block commands (e.g.
+ @ifinfo) */
+
+ /* If we are in a non-ignored conditional, there is not
+ an element for the block in the tree; it is recorded
+ in the conditional stack. Pop it and check it is the
+ same as the one given in the @end line. */
+
+ if (command_data(end_id).data == BLOCK_conditional)
+ {
+ if (conditional_number > 0)
+ {
+ enum command_id popped;
+ popped = pop_conditional_stack ();
+ if (popped != end_id)
+ abort ();
+ }
+ }
+ }
+
+ }
+ else if (current->cmd == CM_include) /* 3166 */
+ {
+ debug ("Include %s", text);
+ input_push_file (text);
+ }
+ else if (current->cmd == CM_documentencoding)
+ /* 3190 */
+ {
+ }
+ else if (current->cmd == CM_documentlanguage)
+ /* 3223 */
+ {
+ }
+ }
+ }
+ else if (current->cmd == CM_node) /* 3235 */
+ {
+ }
+ else if (current->cmd == CM_listoffloats) /* 3248 */
+ {
+ }
+ else
+ {
+ /* All the other "line" commands" */
+ }
+
+ current = current->parent; /* 3285 */
+ if (end_command) /* Set above */
+ {
+ /* more processing of @end */
+ ELEMENT *end_elt;
+
+ debug ("END COMMAND %s", end_command);
+
+ /* Reparent the "@end" element to be a child of the block element. */
+ end_elt = pop_element_from_contents (current);
+
+ /* 3289 If not a conditional */
+ if (command_data(end_id).data != BLOCK_conditional)
+ {
+ ELEMENT *closed_command;
+ /* This closes tree elements (e.g. paragraphs) until we reach
+ end_command. It can print an error if another block command
+ is found first. */
+ current = close_commands (current, end_id,
+ &closed_command, 0); /* 3292 */
+ if (!closed_command)
+ abort (); // 3335
+
+ close_command_cleanup (closed_command);
+ // 3301 INLINE_INSERTCOPYING
+ add_to_element_contents (closed_command, end_elt); // 3321
+ // 3324 ET_menu_comment
+ if (close_preformatted_command (end_id))
+ current = begin_preformatted (current);
+ }
+ } /* 3340 */
+ else
+ {
+ if (close_preformatted_command (cmd_id))
+ current = begin_preformatted (current);
+ }
+
+ /* 3346 included file */
+ // setfilename
+ /* 3355 columnfractions */
+ if (cmd_id == CM_columnfractions)
+ {
+ ELEMENT *before_item;
+ // check if in multitable
+
+ // pop and check context stack
+
+ current = current->parent;
+ before_item = new_element (ET_before_item);
+ add_to_element_contents (current, before_item);
+ current = before_item;
+ }
+ else if (command_data(cmd_id).flags & CF_root) /* 3380 */
+ {
+ current = last_contents_child (current);
+
+ /* 3383 Destroy all contents (why do we do this?) */
+ while (last_contents_child (current))
+ destroy_element (pop_element_from_contents (current));
+
+ /* do stuff with associated_section extra key. */
+ } /* 3416 */
+ }
+
+
+ // something to do with an empty line /* 3419 */
+
+ //if () /* 'line' or 'def' at top of "context stack" */
+ {
+ /* Recurse. */
+ }
+ return current;
+} /* end_line 3487 */
+
Added: trunk/parsetexi/handle_commands.c
===================================================================
--- trunk/parsetexi/handle_commands.c (rev 0)
+++ trunk/parsetexi/handle_commands.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,405 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "parser.h"
+#include "handle_commands.h"
+#include "tree.h"
+
+/* Return a containing @itemize or @enumerate if inside it. */
+// 1847
+ELEMENT *
+item_container_parent (ELEMENT *current)
+{
+ if ((current->cmd == CM_item
+ || current->type == ET_before_item)
+ && current->parent
+ && ((current->parent->cmd == CM_itemize
+ || current->parent->cmd == CM_enumerate)))
+ {
+ return current->parent;
+ }
+ return 0;
+}
+
+/* Line 4289 */
+ELEMENT *
+handle_misc_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id)
+{
+ ELEMENT *misc = 0;
+ char *line = *line_inout;
+ int arg_spec;
+
+ /* Root commands (like @node) and @bye 4290 */
+ if (command_data(cmd_id).flags & CF_root || cmd_id == CM_bye)
+ {
+ ELEMENT *closed_elt; /* Not used */
+ current = close_commands (current, 0, &closed_elt, cmd_id);
+ if (current->type == ET_text_root)
+ {
+ if (cmd_id != CM_bye)
+ {
+ /* Something to do with document_root and text_root. */
+ ELEMENT *new_root = new_element (ET_document_root);
+ add_to_element_contents (new_root, current);
+ current = new_root;
+ }
+ }
+ else
+ {
+ current = current->parent;
+ if (!current)
+ abort ();
+ }
+ }
+
+ /* Look up information about this command ( noarg skipline skipspace text
+ line lineraw /^\d$/). */
+ arg_spec = command_data(cmd_id).data;
+
+ /* noarg */
+ if (arg_spec == MISC_noarg)
+ {
+ /*
+ if (close_preformatted_command(cmd_id))
+ current = begin_preformatted (current);
+ */
+ }
+ // all the cases using the raw line
+ else if (arg_spec == MISC_skipline /* 4347 */
+ || arg_spec == MISC_lineraw
+ || arg_spec == MISC_special)
+ {
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd_id;
+
+ /* If @set or @clear */
+ /* else */ /* 4402 */
+ {
+ add_to_element_contents (current, misc);
+ }
+ current = end_line (current);
+
+ // 4429 @bye
+ if (close_preformatted_command(cmd_id))
+ current = begin_preformatted (current);
+
+ line += strlen (line); /* FIXME: Where does the control flow go? */
+ }
+ else /* line 4435 - text, line, skipspace or a number */
+ {
+ int line_arg = 0;
+
+ if (arg_spec != MISC_skipspace)
+ line_arg = 1;
+ /* @END IS SOMEWHERE IN HERE ('text') */
+
+ /* 4439 */
+ if (cmd_id == CM_item || cmd_id == CM_itemx
+ || cmd_id == CM_headitem || cmd_id == CM_tab)
+ {
+ ELEMENT *parent;
+
+ // itemize or enumerate 4443
+ if ((parent = item_container_parent (current)))
+ {
+ if (cmd_id == CM_item)
+ {
+ ELEMENT *misc;
+ debug ("ITEM CONTAINER");
+ misc = new_element (ET_NONE);
+ misc->cmd = CM_item;
+ add_to_element_contents (parent, misc);
+ current = misc;
+ current = begin_preformatted (current);
+ }
+ else
+ {
+ // error
+ abort ();
+ }
+ //begin_preformatted ();
+ }
+ // *table
+ else if ((parent = item_line_parent (current)))
+ {
+ if (cmd_id == CM_item || cmd_id == CM_itemx)
+ {
+ ELEMENT *misc;
+
+ debug ("ITEM_LINE");
+ current = parent;
+ // gather_previous_item ();
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd_id;
+ add_to_element_contents (current, misc);
+ line_arg = 1;
+ }
+ }
+ // multitable
+ else if ((parent = item_multitable_parent (current))) // 4477
+ {
+ if (cmd_id != CM_item && cmd_id != CM_headitem
+ && cmd_id != CM_tab)
+ {
+ /* 4521 error - not meaningful */
+ abort ();
+ }
+ else
+ { /* 4480 */
+ // check for empty multitable
+ /* if
+ {
+ }
+ else */ if (cmd_id == CM_tab)
+ { // 4484
+ ELEMENT *row;
+
+ row = last_contents_child (parent);
+ if (row->type == ET_before_item)
+ abort ();/* error */
+ /* else if too many columns */
+ else // 4493
+ {
+ ELEMENT *misc;
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd_id;
+ add_to_element_contents (row, misc);
+ current = misc;
+ debug ("TAB");
+ }
+ }
+ else /* 4505 @item or @headitem */
+ {
+ ELEMENT *row, *misc;
+
+ debug ("ROW");
+ row = new_element (ET_row);
+ add_to_element_contents (parent, row);
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd_id;
+ add_to_element_contents (row, misc);
+ current = misc;
+ }
+ }
+ } /* item_multitable_parent */
+ else if (cmd_id == CM_tab) // 4526
+ {
+ // error - tab outside of multitable
+ current = begin_preformatted (current);
+ }
+ else
+ {
+ /* error */
+ // this is reached too much at the moment
+ //abort ();
+ current = begin_preformatted (current);
+ }
+ }
+ else /* not item, itemx, headitem, nor tab 4536 */
+ {
+ /* Add to contents */
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd_id;
+ add_to_element_contents (current, misc);
+
+ /* If root command, and not node or part: */
+ {
+ /* Store section level in 'extra' key. */
+ }
+
+ /* 4546 - def*x */
+ if (command_data(cmd_id).flags & CF_def)
+ {
+ enum command_id base_command;
+ char *base_name;
+ int base_len;
+
+ /* Find the command with "x" stripped from the end, e.g.
+ deffnx -> deffn. */
+ base_name = strdup (command_data(cmd_id).cmdname);
+ base_len = strlen (base_name);
+ if (base_name[base_len - 1] != 'x')
+ abort ();
+ base_name[base_len - 1] = '\0';
+ base_command = lookup_command (base_name);
+ if (base_command == CM_NONE)
+ abort ();
+ free (base_name);
+
+ //check_no_text ();
+ push_context (ct_def);
+ misc->type = ET_def_line;
+ if (current->cmd == base_command)
+ {
+ // Does this gather an "inter_def_item" ?
+ // gather_def_item (current, cmd_id);
+ }
+ else
+ {
+ // error - deffnx not after deffn
+ abort ();
+ }
+ }
+ } /* 4571 */
+
+ // Rest of the line is the argument - true unless is MISC_skipspace. */
+ if (line_arg)
+ {
+ ELEMENT *arg;
+ /* 4576 - change 'current' to its last child. This is ELEMENT *misc
+ above. */
+ current = last_contents_child (current);
+ arg = new_element (ET_misc_line_arg);
+ add_to_element_args (current, arg);
+
+ /* 4584 - node */
+ /* 4586 - author */
+ /* 4612 - dircategory */
+
+ /* 4617 - current to the first argument (ELEMENT *arg). */
+ current = last_args_child (current); /* arg */
+
+ /* add 'line' to context_stack (Parser.pm:141). This will be the
+ case while we read the argument on this line. */
+ if (!(command_data(cmd_id).flags & CF_def))
+ push_context (ct_line);
+ }
+ start_empty_line_after_command (current, &line); //4621
+ }
+
+ /* line 4622 */
+ /* mark_and_warn_invalid (); */ /* possible error message due to invalid
+ nesting */
+ //register_global_command ();
+
+ *line_inout = line;
+ return current;
+}
+
+/* line 4632 */
+ELEMENT *
+handle_block_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id)
+{
+ char *line = *line_inout;
+ unsigned long flags = command_data(cmd_id).flags;
+
+ /* New macro being defined. */
+ if (cmd_id == CM_macro || cmd_id == CM_rmacro)
+ {
+ ELEMENT *macro;
+ macro = parse_macro_command_line (cmd_id, &line, current);
+ add_to_element_contents (current, macro);
+ // mark_and_warn_invalid ();
+ current = macro;
+
+ /* 4640 FIXME */
+ /* The line should be advanced to the end, so a new line should be read
+ immediately after this. */
+ /* Alternative is to use longjmp to go where "last;" does in the Perl
+ version. */
+ goto funexit;
+ }
+ else if (command_data(cmd_id).data == BLOCK_conditional)
+ {
+ // 4699 - If conditional true, push onto conditional stack. Otherwise
+ // open a new element (which we shall later remove).
+
+ debug ("CONDITIONAL %s", command_data(cmd_id).cmdname);
+ if (cmd_id != CM_ifnotinfo) // TODO
+ push_conditional_stack (cmd_id); // Not ignored
+ else
+ {
+ // Ignored.
+ ELEMENT *e;
+ e = new_element (ET_NONE);
+ e->cmd = cmd_id;
+ add_to_element_contents (current, e);
+ current = e;
+ }
+ }
+ else /* line 4710 */
+ {
+ if (flags & CF_menu)
+ {
+ }
+
+ // 4740
+ if (flags & CF_def)
+ {
+ ELEMENT *block, *def_line;
+ push_context (ct_def);
+ block = new_element (ET_NONE);
+ block->cmd = cmd_id;
+ add_to_element_contents (current, block);
+ current = block;
+ def_line = new_element (ET_def_line);
+ add_to_element_contents (current, def_line);
+ current = def_line;
+ }
+ else
+ {
+ /* line 4756 */
+ ELEMENT *block = new_element (ET_NONE);
+
+ block->cmd = cmd_id;
+ add_to_element_contents (current, block);
+ current = block;
+ }
+
+ /* 4763 Check if 'block args command' */
+ if (command_data(cmd_id).data != BLOCK_raw)
+ {
+ if (command_data(cmd_id).flags & CF_preformatted)
+ push_context (ct_preformatted);
+ else if (command_data(cmd_id).flags & CF_format_raw)
+ {
+ push_context (ct_rawpreformatted);
+ }
+
+ // regionsstack
+
+ // 4784 menu commands
+
+ {
+ ELEMENT *bla = new_element (ET_block_line_arg);
+ add_to_element_args (current, bla);
+ current = bla;
+ if (!(command_data(cmd_id).flags & CF_def))
+ push_context (ct_line);
+
+ /* Note that an ET_empty_line_after_command gets reparented in the
+ contents in 'end_line'. */
+
+ }
+ } /* 4827 */
+ // mark_and_warn_invalid ();
+ // register_global_command ();
+ start_empty_line_after_command (current, &line);
+ }
+
+funexit:
+ *line_inout = line;
+ return current;
+}
+
+/* 4835 */
+ELEMENT *
+handle_brace_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id)
+{
+ char *line = *line_inout;
+ ELEMENT *e;
+
+ e = new_element (ET_NONE);
+ e->cmd = cmd_id;
+ add_to_element_contents (current, e);
+ current = e;
+
+ // mark_and_warn_invalid
+ // click, kbd, definfoenclose
+
+ *line_inout = line;
+ return current;
+}
Added: trunk/parsetexi/handle_commands.h
===================================================================
--- trunk/parsetexi/handle_commands.h (rev 0)
+++ trunk/parsetexi/handle_commands.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,7 @@
+
+ELEMENT *handle_misc_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id);
+ELEMENT *handle_block_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id);
+ELEMENT *handle_brace_command (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id);
Added: trunk/parsetexi/indices.c
===================================================================
--- trunk/parsetexi/indices.c (rev 0)
+++ trunk/parsetexi/indices.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,32 @@
+#include "commands.h"
+#include "command_ids.h"
+
+static struct index_name {
+ char *name;
+ char prefix;
+ // int in_code;
+} index_names[] = {
+ "cp", 'c',
+ "fn", 'f',
+ "vr", 'v',
+ "ky", 'k',
+ "pg", 'p',
+ "tp", 't'
+};
+
+void
+init_index_commands (void)
+{
+ struct index_name *i;
+ char name[] = "?index";
+ for (i = index_names;
+ i < &index_names[sizeof(index_names)/sizeof(*index_names)];
+ i++)
+ {
+ enum command_id new;
+ name[0] = i->prefix;
+ new = add_texinfo_command (name);
+ user_defined_command_data[new & ~USER_COMMAND_BIT].flags = CF_misc;
+ user_defined_command_data[new & ~USER_COMMAND_BIT].data = MISC_line;
+ }
+}
Added: trunk/parsetexi/input.c
===================================================================
--- trunk/parsetexi/input.c (rev 0)
+++ trunk/parsetexi/input.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,179 @@
+#define _GNU_SOURCE
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "input.h"
+#include "tree_types.h"
+#include "text.h"
+
+enum input_type { IN_file, IN_text };
+
+typedef struct {
+ enum input_type type;
+
+ FILE *file;
+
+ char *text;
+ char *ptext; /* How far we are through 'text'. */
+} INPUT;
+
+static INPUT *input_stack = 0;
+static size_t input_number = 0;
+static size_t input_space = 0;
+
+/* Collect text until a newline is found. */
+// I don't really understand the difference between this and next_text.
+// When would next_text not return a string ending in a newline?
+// Unlike new_text, new_line's return value doesn't end in '\n'.
+// Return value should not be freed by caller, and becomes invalid after
+// a subsequent call.
+// 1961
+char *
+new_line (void)
+{
+ static TEXT t;
+ char *new = 0;
+
+ t.end = 0;
+
+ while (1)
+ {
+ new = next_text ();
+ if (!new)
+ break;
+ text_append (&t, new);
+ free (new);
+
+ if (t.text[t.end - 1] == '\n')
+ {
+ t.text[t.end - 1] = '\0';
+ break;
+ }
+ }
+
+ if (t.end > 0)
+ return t.text;
+ else
+ return 0;
+}
+
+/* Return value to be freed by caller. Return null if we are out of input. */
+char *
+next_text (void)
+{
+ ssize_t status;
+ char *line = 0;
+ size_t n;
+ FILE *input_file;
+
+ while (input_number > 0)
+ {
+ /* Check for pending input. */
+ INPUT *i = &input_stack[input_number - 1];
+
+ switch (i->type)
+ {
+ char *p, *new;
+ case IN_text:
+ if (!*i->ptext)
+ {
+ /* End of text reached. */
+ free (i->text);
+ break;
+ }
+ p = strchrnul (i->ptext, '\n');
+ new = strndup (i->ptext, p - i->ptext + 1);
+ i->ptext = p + 1;
+ return new;
+ // what if it doesn't end in a newline ?
+
+ break;
+ case IN_file: // 1911
+ input_file = input_stack[input_number - 1].file;
+ status = getline (&line, &n, input_file);
+ while (status != -1)
+ {
+ char *comment;
+ if (feof (input_file))
+ ; // Add a newline to the read line if one is missing.
+
+ /* Strip off a comment. */
+ comment = strchr (line, '\x7F');
+ if (comment)
+ *comment = '\n';
+
+ // 1920 CPP_LINE_DIRECTIVES
+
+ return line;
+ }
+ break;
+ default:
+ abort ();
+ }
+
+ /* Top input source failed. Pop it and try the next one. */
+
+ if (input_stack[input_number - 1].type == IN_file)
+ {
+ FILE *file = input_stack[input_number - 1].file;
+
+ if (file != stdin)
+ {
+ if (fclose (input_stack[input_number - 1].file) == EOF)
+ abort (); // error
+ }
+ }
+ input_number--;
+ }
+ return 0;
+}
+
+void
+input_push_text (char *text)
+{
+ if (input_number == input_space)
+ {
+ input_stack = realloc (input_stack,
+ (input_space *= 1.5) * sizeof (INPUT));
+ if (!input_stack)
+ abort ();
+ }
+
+ input_stack[input_number].type = IN_text;
+ input_stack[input_number].text = text;
+ input_stack[input_number].ptext = text;
+ input_number++;
+}
+
+void
+input_push_stream (FILE *stream)
+{
+ if (input_number == input_space)
+ {
+ input_stack = realloc (input_stack, (input_space += 5) * sizeof (INPUT));
+ if (!input_stack)
+ abort ();
+ }
+
+ input_stack[input_number].type = IN_file;
+ input_stack[input_number].file = stream;
+ input_number++;
+}
+
+void
+input_push_file (char *filename)
+{
+ FILE *stream;
+ stream = fopen (filename, "r");
+ if (!stream)
+ {
+ fprintf (stderr, "Could not open %s\n", filename);
+ exit (1);
+ }
+
+ input_push_stream (stream);
+ return;
+}
+
Added: trunk/parsetexi/input.h
===================================================================
--- trunk/parsetexi/input.h (rev 0)
+++ trunk/parsetexi/input.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+char *new_line (void);
+char *next_text (void);
+
+void input_push_file (char *line);
+void input_push_text (char *filename);
+void input_push_stream (FILE *stream);
Added: trunk/parsetexi/install-sh
===================================================================
--- trunk/parsetexi/install-sh (rev 0)
+++ trunk/parsetexi/install-sh 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,501 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2013-12-25.23; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab=' '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification
time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) is_target_a_directory=never;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from
address@hidden
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ dstdir=`dirname "$dst"`
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ set -f
+ set fnord $dstdir
+ shift
+ set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ set +f &&
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Property changes on: trunk/parsetexi/install-sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/macro.c
===================================================================
--- trunk/parsetexi/macro.c (rev 0)
+++ trunk/parsetexi/macro.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,401 @@
+#define _GNU_SOURCE
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "parser.h"
+#include "tree.h"
+#include "text.h"
+#include "input.h"
+
+typedef struct {
+ char *macro_name;
+ ELEMENT *element;
+ enum command_id cmd;
+} MACRO;
+
+static MACRO *macro_list;
+static size_t macro_number;
+static size_t macro_space;
+
+
+/* Macro definition. */
+
+void
+new_macro (char *name, ELEMENT *macro)
+{
+ enum command_id new;
+
+ if (macro_number == macro_space)
+ {
+ macro_list = realloc (macro_list, (macro_space += 5) * sizeof (MACRO));
+ if (!macro_list)
+ abort ();
+ }
+
+ macro_list[macro_number].macro_name = name; /* strdup ? */
+ macro_list[macro_number].element = macro;
+
+ new = add_texinfo_command (name);
+ macro_list[macro_number++].cmd = new;
+ new &= ~USER_COMMAND_BIT;
+
+ user_defined_command_data[new].flags |= CF_MACRO;
+}
+
+// 1088
+/* COMMAND_ID will be either CM_macro or CM_rmacro. Read the line defining a
+ macro's name and the arguments it takes, and return this information in a
+ new ELEMENT. */
+ELEMENT *
+parse_macro_command_line (enum command_id cmd, char **line_inout,
+ ELEMENT *parent)
+{
+ char *line = *line_inout;
+ ELEMENT *macro, *macro_name;
+ char *name, *args_ptr;
+ int index;
+
+ macro = new_element (ET_NONE);
+ macro->cmd = cmd;
+
+ line += strspn (line, whitespace_chars);
+ name = read_command_name (&line);
+ if (!name)
+ {
+ abort (); //error
+ }
+
+ macro_name = new_element (ET_macro_name);
+ text_append (¯o_name->text, name);
+ free (name);
+ add_to_element_args (macro, macro_name);
+
+ args_ptr = line;
+ args_ptr += strspn (args_ptr, whitespace_chars);
+
+ if (*args_ptr != '{')
+ {
+ /* Either error or no args. */
+ line = args_ptr;
+ goto funexit;
+ }
+ args_ptr++;
+
+ index = 0;
+ do
+ {
+ /* args_ptr is after a '{' or ','. */
+
+ char *q, *q2;
+ ELEMENT *arg;
+
+ args_ptr += strspn (args_ptr, whitespace_chars);
+
+ /* Find end of current argument. */
+ q = args_ptr;
+ while (*q != '\0' && *q != ',' && *q != '}')
+ q++;
+
+ if (!*q)
+ {
+ /* End of string reached before closing brace. */
+ abort ();
+ }
+
+ /* Disregard trailing whitespace. */
+ q2 = q;
+ while (q2 > q && strchr (whitespace_chars, q2[-1]))
+ q2--;
+
+ if (q2 == args_ptr)
+ {
+ // 1126 - argument is completely whitespace
+ if (index == 0)
+ break; /* Empty arg list, like "@macro m { }". */
+ abort ();
+ }
+
+ arg = new_element (ET_macro_arg);
+ text_append_n (&arg->text, args_ptr, q2 - args_ptr);
+ add_to_element_args (macro, arg);
+
+ args_ptr = q + 1;
+
+ if (*q == '}')
+ break;
+
+ index++;
+ }
+ while (1);
+ line = args_ptr;
+
+ /* FIXME: What if there is stuff after the '}'? */
+ line += strlen (line); /* Discard rest of line. */
+
+funexit:
+ *line_inout = line;
+ return macro;
+}
+
+
+/* Macro use. */
+
+/* Return index into given arguments to look for the value of NAME. */
+int
+lookup_macro_parameter (char *name, ELEMENT *macro)
+{
+ int i, pos;
+ ELEMENT **args;
+
+ /* Find 'arg' in MACRO parameters. */
+ args = macro->args.list;
+ pos = 0;
+ for (i = 0; i < macro->args.number; i++)
+ {
+ if (args[i]->type == ET_macro_arg)
+ {
+ if (!strcmp (args[i]->text.text, name))
+ return pos;
+ pos++;
+ }
+ }
+ abort ();
+ return -1;
+}
+
+/* LINE points to after opening brace in a macro invocation. */
+// 1984
+char **
+expand_macro_arguments (ELEMENT *macro, char **line_inout)
+{
+ char *line = *line_inout;
+ char *pline = line;
+ TEXT arg;
+ int braces_level = 1;
+
+ char **arg_list = 0;
+ size_t arg_number = 0;
+ size_t arg_space = 0;
+
+ text_init (&arg);
+
+ while (braces_level > 0)
+ {
+ /* At the beginning of this loop pline is at the start
+ of an argument. */
+ char *sep;
+
+ sep = pline + strcspn (pline, "\\,{}");
+ if (!*sep)
+ {
+ debug ("MACRO ARG end of line");
+ // FIXME: How to free line?
+ // We could keep a reference to it in a static variable in
+ // new_line.
+ line = new_line ();
+ pline = line;
+ }
+
+ text_append_n (&arg, pline, sep - pline);
+
+ // 2002
+ switch (*sep)
+ {
+ case '\\':
+ if (*pline)
+ text_append_n (&arg, pline, 1);
+ pline = sep + 1;
+ break;
+ case '{':
+ braces_level++;
+ pline = sep + 1;
+ break;
+ case '}':
+ braces_level--;
+ if (braces_level > 0)
+ {
+ text_append_n (&arg, sep, 1);
+ pline = sep + 1;
+ break;
+ }
+
+ /* Fall through to add argument. */
+ case ',':
+ if (braces_level > 1)
+ {
+ text_append_n (&arg, sep, 1);
+ pline = sep + 1;
+ break;
+ }
+
+ // 2021 check for too many args
+
+ /* Add the last argument read to the list. */
+ if (arg.end > 0)
+ {
+ if (arg_number == arg_space)
+ {
+ arg_list = realloc (arg_list,
+ (arg_space += 5) * sizeof (char *));
+ if (!arg_list)
+ abort ();
+ }
+ arg_list[arg_number++] = arg.text;
+ text_init (&arg);
+ }
+ else
+ // then what? e.g. is "@m { }" one empty argument or none?
+ if (arg_number != 0)
+ abort;
+
+ debug ("MACRO NEW ARG");
+ pline = sep + 1;
+ break;
+ }
+
+ if (*sep == ',')
+ pline += strspn (pline, whitespace_chars);
+ }
+
+ debug ("END MACRO ARGS EXPANSION");
+ line = pline;
+
+ *line_inout = line;
+ return arg_list;
+}
+
+/* ARGUMENTS are the arguments used in the macro invocation. EXPANDED gets
the
+ result of the expansion. */
+static void
+expand_macro_body (ELEMENT *macro, char *arguments[], TEXT *expanded)
+{
+ char *arg;
+ int pos; /* Index into arguments. */
+ int i; /* Index into macro contents. */
+ ELEMENT **body;
+
+ /* Initialize TEXT object. */
+ expanded->end = 0;
+
+ body = macro->contents.list;
+ for (i = 0; i < macro->contents.number; i++)
+ {
+ char *ptext;
+
+ if (body[i]->type != ET_raw)
+ continue; /* Could be an ET_last_raw_newline. */
+
+ /* There should be at least a newline. */
+ if (body[i]->text.end == 0)
+ abort ();
+
+ ptext = body[i]->text.text;
+ if (i == macro->contents.number - 1)
+ ; // strip newline
+
+ while (1)
+ {
+ /* At the start of this loop ptext is at the beginning or
+ just after the last backslash sequence. */
+
+ char *bs; /* Pointer to next backslash. */
+
+ bs = strchrnul (ptext, '\\');
+ text_append_n (expanded, ptext, bs - ptext);
+ if (!*bs)
+ break; /* End of line. */
+
+ ptext = bs + 1;
+ if (*ptext == '\\')
+ {
+ text_append_n (expanded, "\\", 1); /* Escaped backslash (\\). */
+ ptext++;
+ }
+ else
+ {
+ bs = strchr (ptext, '\\');
+ if (!bs)
+ {
+ // error - malformed
+ abort ();
+ }
+
+ *bs = '\0';
+ pos = lookup_macro_parameter (ptext, macro);
+ if (pos == -1)
+ abort ();
+ *bs = '\\';
+
+ text_append (expanded, arguments[pos]);
+ ptext = bs + 1;
+ }
+ }
+ }
+}
+
+static MACRO *
+lookup_macro (enum command_id cmd)
+{
+ int i;
+
+ for (i = 0; i < macro_number; i++)
+ {
+ if (macro_list[i].cmd == cmd)
+ return ¯o_list[i];
+ }
+ return 0;
+}
+
+// 3898
+ELEMENT *
+handle_macro (ELEMENT *current, char **line_inout, enum command_id cmd)
+{
+ char *line;
+ MACRO *macro_record;
+ ELEMENT *macro;
+ TEXT expanded;
+ char **arguments;
+
+ line = *line_inout;
+ text_init (&expanded);
+
+ macro_record = lookup_macro (cmd);
+ if (!macro_record)
+ abort ();
+ macro = macro_record->element;
+
+ // 3907 Get number of args.
+
+ line += strspn (line, whitespace_chars);
+ if (*line == '{')
+ {
+ line++;
+ /* In the Perl version formfeed is excluded for some reason. */
+ line += strspn (line, whitespace_chars);
+ arguments = expand_macro_arguments (macro, &line);
+ }
+
+ expand_macro_body (macro, arguments, &expanded);
+ debug ("MACROBODY: %s||||||", expanded.text);
+
+ /* Free arguments. */
+ {
+ char **s = arguments;
+ while (*s)
+ {
+ free (*s);
+ s++;
+ }
+ free (arguments);
+ }
+
+
+ // 3958 Pop macro stack
+
+ // 3961 Split expansion into lines.
+ input_push_text (expanded.text);
+
+ *line_inout = line;
+ return current;
+}
Added: trunk/parsetexi/main.c
===================================================================
--- trunk/parsetexi/main.c (rev 0)
+++ trunk/parsetexi/main.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,147 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "parser.h"
+#include "input.h"
+
+#define element_type_name(e) element_type_names[(e)->type]
+
+int indent = 0;
+
+void dump_contents (ELEMENT *);
+void dump_element (ELEMENT *);
+
+/* Output INDENT spaces. */
+void
+dump_indent (void)
+{
+ int i;
+ for (i = 0; i < indent; i++)
+ printf (" ");
+}
+
+void
+dump_args (ELEMENT *e)
+{
+ int i;
+ printf ("[\n");
+ indent += 2;
+
+ for (i = 0; i < e->args.number; i++)
+ {
+ dump_indent ();
+ dump_element (e->args.list[i]);
+ printf (",\n");
+ }
+
+ indent -= 2;
+ dump_indent ();
+ printf ("],\n");
+}
+
+void
+dump_contents (ELEMENT *e)
+{
+ int i;
+ printf ("[\n");
+ indent += 2;
+
+ for (i = 0; i < e->contents.number; i++)
+ {
+ dump_indent ();
+ dump_element (e->contents.list[i]);
+ printf (",\n");
+ }
+
+ indent -= 2;
+ dump_indent ();
+ printf ("],\n");
+}
+
+void
+dump_string (char *s)
+{
+ while (*s)
+ {
+ if (*s == '\''
+ || *s == '\\')
+ putchar ('\\');
+ putchar (*s++);
+ }
+}
+
+void
+dump_element (ELEMENT *e)
+{
+ printf ("{\n");
+ indent += 2;
+
+ if (e->type)
+ {
+ dump_indent ();
+ printf ("'type' => '%s',\n", element_type_name(e));
+ }
+
+ if (e->cmd)
+ {
+ dump_indent ();
+ printf ("'cmdname' => '");
+ dump_string (command_data(e->cmd).cmdname);
+ printf ("',\n");
+ }
+
+ if (e->text.text)
+ {
+ char *s;
+ dump_indent ();
+ /* FIXME: Need to escape backslashes, e.g. output
+ \\input instead of \input. */
+ printf ("'text' => '");
+ dump_string (e->text.text);
+ printf ("',\n");
+ }
+
+ if (e->args.number > 0)
+ {
+ dump_indent ();
+ printf ("'args' => ");
+ dump_args (e);
+ }
+
+ if (e->contents.number > 0)
+ {
+ dump_indent ();
+ printf ("'contents' => ");
+ dump_contents (e);
+ }
+
+ indent -= 2;
+ dump_indent ();
+ printf ("}");
+}
+
+void
+dump_tree_to_perl (ELEMENT *root)
+{
+ printf ("$VAR1 = ");
+ dump_element (root);
+ printf (";\n");
+}
+
+
+int
+main (int argc, char **argv)
+{
+ ELEMENT *root;
+ if (argc <= 1)
+ {
+ fprintf (stderr, "Please give the name of a file to process.\n");
+ exit (1);
+ }
+ input_push_file (argv[1]);
+ init_index_commands ();
+ root = parse_texi_file ();
+ dump_tree_to_perl (root);
+
+ exit (0);
+}
Added: trunk/parsetexi/makeinfo-debug.txt
===================================================================
--- trunk/parsetexi/makeinfo-debug.txt (rev 0)
+++ trunk/parsetexi/makeinfo-debug.txt 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,36 @@
+to get tree output, do
+
+$makeinfo -c DUMP_TREE=1 multitparseable.texi 2>&1 |less
+
+makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree mltitble.texi
+
+makeinfo -c DEBUG=1 -c TEXINFO_OUTPUT_FORMAT=parse mltitble.texi
+
+----------- speed comparison-----------------------
+
+time makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree texinfo.texi >/dev/null
+
+real 0m5.261s
+user 0m4.903s
+sys 0m0.054s
+
+(Earlier)
+time ./parsetexi texinfo.texi >/dev/null 2>&1
+
+real 0m0.311s
+user 0m0.277s
+sys 0m0.018s
+
+(5th Dec)
+time ./parsetexi texinfo.texi >/dev/null 2>&1
+
+real 0m0.685s
+user 0m0.549s
+sys 0m0.124s
+
+time ./complete_tree.pl texinfo.texi >/dev/null
+
+real 0m3.603s
+user 0m1.805s
+sys 0m1.396s
+
Added: trunk/parsetexi/missing
===================================================================
--- trunk/parsetexi/missing (rev 0)
+++ trunk/parsetexi/missing 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2013-10-28.13; # UTC
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <address@hidden>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+fi
+
+case $1 in
+
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
+
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <address@hidden>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'autom4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
+ ;;
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Property changes on: trunk/parsetexi/missing
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/parsetexi/multitable.c
===================================================================
--- trunk/parsetexi/multitable.c (rev 0)
+++ trunk/parsetexi/multitable.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,38 @@
+#include "parser.h"
+
+/* Return the parent if in an item_line command, @*table */
+ELEMENT *
+item_line_parent (ELEMENT *current)
+{
+ if (current->cmd == CM_item || current->cmd == CM_itemx)
+ current = current->parent->parent;
+ else if (current->type == ET_before_item && current->parent)
+ current = current->parent;
+
+ if (item_line_command (current->cmd))
+ return current;
+
+ return 0;
+}
+
+/* Return the parent if in a multitable. */
+ELEMENT *
+item_multitable_parent (ELEMENT *current)
+{
+ if (current->cmd == CM_headitem
+ || current->cmd == CM_item
+ || current->cmd == CM_tab)
+ {
+ if (current->parent && current->parent->parent)
+ current = current->parent->parent;
+ }
+ else if (current->type == ET_before_item)
+ {
+ current = current->parent;
+ }
+
+ if (current->cmd == CM_multitable)
+ return current;
+
+ return 0;
+}
Added: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c (rev 0)
+++ trunk/parsetexi/parser.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,919 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#include "parser.h"
+#include "text.h"
+#include "input.h"
+#include "tree.h"
+
+/* Parser state - see Parser.pm:135. */
+
+//macro_stack;
+
+/* Declarations of functions in this file */
+ELEMENT *parse_texi (ELEMENT *root_elt);
+
+
+/* Utility functions */
+
+const char *whitespace_chars = " \t\f\r\n";
+
+// [^\S\r\n] in Perl
+const char *whitespace_chars_except_newline = " \t\f";
+
+/* Check if the contents of S2 appear at S1). */
+int
+looking_at (char *s1, char *s2)
+{
+ return !strncmp (s1, s2, strlen (s2));
+}
+
+/* Return value to be freed by caller. *PTR is advanced past the read name. */
+// 4161
+char *
+read_command_name (char **ptr)
+{
+ char *p = *ptr;
+ char *ret = 0;
+
+ /* List of single character Texinfo commands. */
+ if (strchr ("([\"'address@hidden,.!?"
+ " \f\n\r\t" /* \s in Perl */
+ "*-^`=:|/\\",
+ *p))
+ {
+ ret = malloc (2);
+ ret[0] = *p++;
+ ret[1] = '\0';
+ }
+ else
+ {
+ /* Look for a sequence of alphanumeric characters or hyphens, where the
+ first isn't a hyphen. */
+ char *q = p;
+ if (!isalnum (*q))
+ abort (); /* Invalid. */
+
+ while (isalnum (*++q) || *q == '-')
+ ;
+ ret = strndup (p, q - p);
+ p = q;
+ }
+
+ *ptr = p;
+ return ret;
+}
+
+/* Conditional stack. */
+
+enum command_id *conditional_stack;
+size_t conditional_number;
+size_t conditional_space;
+
+void
+push_conditional_stack (enum command_id cond)
+{
+ if (conditional_number == conditional_space)
+ {
+ conditional_stack = realloc (conditional_stack,
+ (conditional_space += 5)
+ * sizeof (enum command_id));
+ if (!conditional_stack)
+ abort ();
+ }
+ conditional_stack[conditional_number++] = cond;
+}
+
+enum command_id
+pop_conditional_stack (void)
+{
+ if (conditional_number == 0)
+ return CM_NONE;
+ return conditional_stack[--conditional_number];
+}
+
+
+/* lines 1-751 - comments, variable declarations, package imports,
+ initializations, utilities */
+
+/* lines 751 - 983 - user-visible functions, entry points */
+/* parse_texi_file */
+/* 835 */
+ELEMENT *
+parse_texi_file (void)
+{
+ char *linep, *line = 0;
+ ELEMENT *root = new_element (ET_text_root);
+ ELEMENT *preamble = 0;
+
+ /* Check for preamble. */
+ do
+ {
+ ELEMENT *l;
+
+ /* FIXME: _next_text isn't used in Perl. */
+ line = next_text ();
+ if (!line)
+ abort (); /* Empty file? */
+
+ linep = line;
+ linep += strspn (linep, whitespace_chars);
+ if (*linep && !looking_at (linep, "\\input"))
+ {
+ /* This line is not part of the preamble. Shove back
+ into input stream. */
+ input_push_text (line);
+ break;
+ }
+
+ if (!preamble)
+ preamble = new_element (ET_preamble);
+
+ l = new_element (ET_preamble_text);
+ text_append (&l->text, line);
+ add_to_element_contents (preamble, l);
+ }
+ while (1);
+
+ if (preamble)
+ add_to_element_contents (root, preamble);
+
+ root = parse_texi (root);
+ return root;
+} /* 916 */
+
+
+int
+begin_paragraph_p (ELEMENT *current)
+{
+ return (current->type == ET_NONE /* "True for @-commands" */
+ || current->type == ET_before_item
+ || current->type == ET_text_root
+ || current->type == ET_document_root
+ || current->type == ET_brace_command_context)
+ && !in_no_paragraph_contexts (current_context ());
+}
+
+/* Line 1146 */
+/* If in a context where paragraphs are to be started, start a new
+ paragraph. */
+ELEMENT *
+begin_paragraph (ELEMENT *current)
+{
+ if (begin_paragraph_p (current))
+ {
+ ELEMENT *e;
+ int indent = 0;
+
+ /* Check if an @indent precedes the paragraph (to record it
+ in the 'extra' key). */
+
+ e = new_element (ET_paragraph);
+ add_to_element_contents (current, e);
+ current = e;
+
+ debug ("PARAGRAPH");
+ }
+ return current;
+}
+
+// 1190
+ELEMENT *
+begin_preformatted (ELEMENT *current)
+{
+ if (current_context() == ct_preformatted
+ || current_context() == ct_rawpreformatted)
+ {
+ ELEMENT *e;
+ enum element_type et;
+
+ if (current_context() == ct_preformatted)
+ et = ET_preformatted;
+ else
+ et = ET_rawpreformatted;
+ e = new_element (et);
+ add_to_element_contents (current, e);
+ current = e;
+ debug ("PREFORMATTED %s", et == ET_preformatted ? "preformatted"
+ : "rawpreformatted");
+ }
+ return current;
+}
+
+/* 1310 */
+ELEMENT *
+end_paragraph (ELEMENT *current)
+{
+ /* close_all_style_commands (); */
+
+ if (current->type == ET_paragraph)
+ {
+ current = current->parent;
+ debug ("CLOSE PARA");
+ }
+
+ return current;
+}
+
+/* 1328 */
+ELEMENT *
+end_preformatted (ELEMENT *current)
+{
+ //current = close_all_style_commands (current);
+ if (current->type == ET_preformatted
+ || current->type == ET_rawpreformatted)
+ {
+ debug ("CLOSE PREFORMATTED %s",
+ current->type == ET_preformatted ? "preformatted"
+ : "rawpreformatted");
+ // remove if empty
+ current = current->parent;
+ }
+ return current;
+}
+
+/* Line 1798 */
+/* Add TEXT to the contents of CURRENT, maybe starting a new paragraph. */
+ELEMENT *
+merge_text (ELEMENT *current, char *text)
+{
+ int no_merge_with_following_text = 0;
+ int leading_spaces = strspn (text, whitespace_chars);
+ ELEMENT *last_child = last_contents_child (current);
+
+ /* Is there a non-whitespace character in the line? */
+ if (text[leading_spaces])
+ {
+ char *additional = 0;
+
+ if (last_child
+ && (last_child->type == ET_empty_line_after_command
+ || last_child->type == ET_empty_line_after_command
+ || last_child->type == ET_empty_spaces_before_argument
+ || last_child->type == ET_empty_spaces_after_close_brace))
+ {
+ no_merge_with_following_text = 1;
+ }
+
+ if (leading_spaces)
+ {
+ additional = malloc (leading_spaces + 1);
+ if (!additional)
+ abort ();
+ memcpy (additional, text, leading_spaces);
+ additional[leading_spaces] = '\0';
+ }
+
+ if (abort_empty_line (¤t, additional))
+ text += leading_spaces;
+
+ free (additional);
+
+ current = begin_paragraph (current);
+ }
+
+ if (last_contents_child (current)
+ /* There is a difference between the text being defined and empty,
+ and not defined at all. The latter is true for 'brace_command_arg'
+ elements. We need to make sure that we initialize all elements with
+ text_append (&e->text, "") where we want merging with following
+ text. */
+ && last_contents_child (current)->text.space > 0
+ && !strchr (last_contents_child (current)->text.text, '\n')
+ && !no_merge_with_following_text)
+ {
+ /* Append text to contents */
+ ELEMENT *last_child = last_contents_child (current);
+ text_append (&last_child->text, text);
+ debug ("MERGED TEXT: %s|||", text);
+ }
+ else
+ {
+ ELEMENT *e = new_element (ET_NONE);
+ text_append (&e->text, text);
+ add_to_element_contents (current, e);
+ debug ("NEW TEXT: %s|||", text);
+ }
+
+ return current;
+}
+
+/* 2106 */
+int
+abort_empty_line (ELEMENT **current_inout, char *additional_text)
+{
+ ELEMENT *current = *current_inout;
+ int retval;
+
+ ELEMENT *last_child = last_contents_child (current);
+
+ if (!additional_text)
+ additional_text = "";
+
+ if (last_child
+ && (last_child->type == ET_empty_line
+ || last_child->type == ET_empty_line_after_command
+ || last_child->type == ET_empty_spaces_before_argument
+ || last_child->type == ET_empty_spaces_after_close_brace))
+ {
+ debug ("ABORT EMPTY additional text |%s| "
+ "current |%s|",
+ additional_text,
+ last_child->text.text);
+ text_append (&last_child->text, additional_text);
+
+ // FIXME: How and when is this condition exactly met?
+ if (last_child->text.end == 0) //2121
+ {
+ // 'extra' stuff
+
+ destroy_element (pop_element_from_contents (current));
+ }
+ else if (last_child->type == ET_empty_line) //2132
+ {
+ if (begin_paragraph_p (current))
+ last_child->type = ET_empty_spaces_before_paragraph;
+ else
+ destroy_element (pop_element_from_contents (current));
+ }
+ else if (last_child->type == ET_empty_line_after_command)
+ {
+ last_child->type = ET_empty_spaces_after_command;
+ }
+ retval = 1;
+ }
+ else
+ retval = 0;
+
+ *current_inout = current;
+ return retval;
+}
+
+/* 2149 */
+void
+isolate_last_space (ELEMENT *current)
+{
+ int element_type;
+ ELEMENT *last = last_contents_child (current);
+
+ element_type = ET_spaces_at_end;
+ if (last)
+ {
+ int index = -1;
+ ELEMENT *indexed_elt;
+
+ /* Ignore space before a misc command that is last on line. (I don't
+ understand this. ) */
+ if (element_contents_number (current) > 1)
+ {
+ if (last->cmd)
+ {
+ if (command_flags(last) & CF_misc)
+ index = -2;
+ }
+ }
+
+ indexed_elt = contents_child_by_index (current, index);
+ if (indexed_elt)
+ {
+ char *text = element_text (indexed_elt);
+ if (!text || !*text)
+ return;
+
+ if (indexed_elt->type == ET_NONE)
+ {
+ int text_len = strlen (text);
+ /* 2170 */
+ /* Does the text end in whitespace? */
+ if (strchr (whitespace_chars, text[text_len - 1]))
+ {
+ /* If text all whitespace */
+ if (text[strspn (text, whitespace_chars)] == '\0')
+ indexed_elt->type = element_type;
+ else
+ {
+ /* 2173 */
+ ELEMENT *new_spaces;
+ int i, trailing_spaces;
+
+ /* "strrcspn" */
+ trailing_spaces = 0;
+ for (i = strlen (text) - 1;
+ i > 0 && strchr (whitespace_chars, text[i]);
+ i--)
+ trailing_spaces++;
+
+ new_spaces = new_element (element_type);
+ text_append_n (&new_spaces->text,
+ text + text_len - trailing_spaces,
+ trailing_spaces);
+ text[text_len - trailing_spaces] = '\0';
+
+ if (index == -1)
+ add_to_element_contents (current, new_spaces);
+ else
+ insert_into_contents (current, new_spaces, -1);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void
+start_empty_line_after_command (ELEMENT *current, char **line_inout)
+{
+ char *line = *line_inout;
+ ELEMENT *e;
+ int len;
+
+ len = strspn (line, whitespace_chars_except_newline);
+ e = new_element (ET_empty_line_after_command);
+ add_to_element_contents (current, e);
+ text_append_n (&e->text, line, len);
+ line += len;
+
+ *line_inout = line;
+}
+
+/* Parts of parse_texi lines 3676 - 5372 */
+
+int
+command_with_command_as_argument (ELEMENT *current)
+{
+ return current->type == ET_block_line_arg
+ && (current->parent->cmd == CM_itemize
+ || item_line_command (current->parent->cmd));
+// && (current->contents.number == 1);
+ // || current->contents.number == 2 and the first child's text is
+ // all non-whitespace characters??
+}
+
+/* Used at line 3755 */
+/* Check if line is "@end ..." for current command. If so, advance LINE. */
+int
+is_end_current_command (ELEMENT *current, char **line,
+ enum command_id *end_cmd)
+{
+ char *linep;
+ char *cmdname;
+
+ linep = *line;
+
+ linep += strspn (linep, whitespace_chars);
+ if (!looking_at (linep, "@end"))
+ return 0;
+
+ linep += 4;
+ if (!strchr (whitespace_chars, *linep))
+ return 0;
+
+ linep += strspn (linep, whitespace_chars);
+ cmdname = read_command_name (&linep);
+ *end_cmd = lookup_command (cmdname);
+ free (cmdname);
+ if (*end_cmd != current->cmd)
+ return 0;
+
+ *line = linep;
+ return 1;
+}
+
+/* line 3725 */
+/* *LINEP is a pointer into the line being processed. It is advanced past any
+ bytes processed. Return 0 when we need to read a new line. */
+int
+big_loop (ELEMENT **current_inout, char **line_inout)
+{
+ ELEMENT *current = *current_inout;
+ char *line = *line_inout;
+ int retval = 1; /* Return value of function */
+ enum command_id end_cmd;
+
+ char *command = 0;
+ enum command_id cmd_id = CM_NONE;
+
+ /* We could be after a @macro line. See comment in handle_block_command
+ 4640. */
+ if (!*line)
+ {
+ retval = 0;
+ goto funexit;
+ }
+
+ /* If in raw block, or ignored conditional block. */
+ // 3727
+ if (command_flags(current) & CF_block
+ && (command_data(current->cmd).data == BLOCK_raw
+ || command_data(current->cmd).data == BLOCK_conditional))
+ { /* 3730 */
+#if 0
+ /* Check if we are using a macro within a macro. */
+ if (...)
+ {
+ ELEMENT *e = new_element ();
+ /* ... */
+
+ current = current->contents.list[number];
+ break;
+ }
+
+ /* Else check for nested ifclear */
+ else if (...)
+ {
+ /* ... */
+ current = current->contents.list[number];
+ break;
+ }
+ else
+#endif
+ /* 3755 Else check if line is "@end ..." for current command. */
+ if (is_end_current_command (current, &line, &end_cmd))
+ {
+ ELEMENT *last_child;
+
+ last_child = last_contents_child (current);
+
+ if (last_child
+ && last_child->type == ET_raw
+ && current->cmd != CM_verbatim)
+ {
+ if (last_child->text.end > 0
+ && last_child->text.text[last_child->text.end - 1] == '\n')
+ {
+ ELEMENT *lrn;
+ last_child->text.text[--last_child->text.end] = '\0';
+ lrn = new_element (ET_last_raw_newline);
+ text_append (&lrn->text, "\n");
+ add_to_element_contents (current, lrn);
+ }
+ }
+
+ /* For macros, define a new macro (unless we are in a nested
+ macro definition). */
+ if ((end_cmd == CM_macro || end_cmd == CM_rmacro)
+ && (!current->parent
+ || (current->parent->cmd != CM_macro
+ && current->parent->cmd != CM_rmacro)))
+ {
+ char *name;
+
+ name = element_text (args_child_by_index (current, 0));
+ new_macro (name, current); // 3808
+ }
+
+ current = current->parent;
+
+ /* Check for conditionals. */
+ if (command_data(end_cmd).flags & CF_block
+ && command_data(end_cmd).data == BLOCK_conditional)
+ {
+ // 3813 Remove an ignored block.
+ ELEMENT *popped;
+ popped = pop_element_from_contents (current);
+ if (popped->cmd != end_cmd)
+ abort(); //error
+ destroy_element (popped);
+
+ // abort until end of line, calling new_line
+ debug ("CLOSED conditional %s", command_data(end_cmd).cmdname);
+ }
+ else
+ {
+ debug ("CLOSED raw %s", command_data(end_cmd).cmdname);
+ start_empty_line_after_command (current, &line); // 3831
+ }
+ }
+ else /* 3833 save the line verbatim */
+ {
+ if (0 && last_contents_child (current)->type
+ == ET_empty_line_after_command)
+ {
+ /* Only if the text is wholly whitespace characters. */
+ text_append (&last_contents_child(current)->text, line);
+ }
+ else
+ {
+ ELEMENT *e;
+ e = new_element (ET_raw);
+ text_append (&e->text, line);
+ add_to_element_contents (current, e);
+ }
+
+ retval = 0; /* 3844 */
+ goto funexit;
+ }
+ } /* BLOCK_raw or (ignored) BLOCK_conditional 3897 */
+
+#if 0
+ /* Check if parent element is 'verb' */
+ else if (current->parent->cmdname == CM_verb)
+ {
+ /* Save the deliminating character in 'type'. */
+ }
+
+ /* Skip empty lines. If we reach the end of input, continue in case there
+ is an @include. */
+#endif
+
+ /* !!! In the Perl version the command name is read separately for macros.
+ Thus the !cmd_id conditions. */
+ if (*line == '@')
+ {
+ line++; /* FIXME: DO this in read_command_name instead? */
+ command = read_command_name (&line);
+ cmd_id = lookup_command (command);
+ if (cmd_id == 0)
+ {
+ /* Unknown command */
+ //abort ();
+ }
+ }
+
+ /* Handle user-defined macros before anything else because their expansion
+ may lead to changes in the line. */
+ if (cmd_id && (command_data(cmd_id).flags & CF_MACRO)) // 3894
+ {
+ current = handle_macro (current, &line, cmd_id);
+ }
+
+ /* 3983 Cases that may "lead to command closing": brace commands that don't
+ need a brace: accent commands.
+ @definfoenclose. */
+ /* This condition is only checked immediately after the command opening,
+ otherwise the current element is in the 'args' and not right in the
+ commmand container. */
+ else if (!cmd_id && command_flags(current) & CF_brace && *line != '{')
+ {
+ if (command_with_command_as_argument (current->parent)) // 3988
+ {
+ debug ("FOR PARENT");
+ current->type = ET_command_as_argument;
+ current = current->parent;
+ }
+ else if (command_flags (current) & CF_accent) // 3996 - accent commands
+ {
+ // do accent stuff here
+ current = current->parent;
+ goto funexit;
+ }
+ else // 4041
+ {
+ // error - braces expected
+ // broken by lack of @verb processing ATM
+ //abort ();
+ current = current->parent;
+ }
+ }
+
+#if 0
+
+ /* Menu entry "* ...". */
+ else if (!cmd_id && ...)
+ {
+ }
+
+ /* various parsing of menus. */
+
+#endif
+
+ /* line 4161 */
+ /* Any other @-command. */
+ else if (cmd_id)
+ {
+ debug ("COMMAND %s", command);
+
+#if 0
+ /* Check if this is an alias command */
+
+ /* @value */
+
+ /* warn on deprecated command */
+#endif
+
+ /* warn on not appearing at line beginning 4226 */
+ if (!abort_empty_line (¤t, NULL))
+ // && begin_line_commands (command))
+ {
+ /* warning */
+ }
+
+#if 0
+ /* 4233 invalid nestings */
+#endif
+
+ /* 4276 check if begins or ends a paragraph */
+ if (!(command_data(cmd_id).flags & (CF_misc | CF_block)))
+ {
+ /*
+ Unless no paragraph commands (line 311):
+ All misc commands
+ All block commands
+ 'titlefont', 'caption', 'shortcaption',
+ 'image', '*', 'hyphenation', 'anchor', 'errormsg'
+ Index commands
+ */
+
+ ELEMENT *paragraph;
+ paragraph = begin_paragraph (current);
+ if (paragraph)
+ current = paragraph;
+ }
+
+ // 4281
+ if (cmd_id != 0)
+ {
+ if (close_paragraph_command (cmd_id))
+ current = end_paragraph (current);
+ if (close_preformatted_command (cmd_id))
+ current = end_preformatted (current);
+ }
+
+ if (cmd_id == 0)
+ {
+ // Unknown command
+ /* FIXME: Just add it as a new element for now to check it worked. */
+ /* Elements corresponding to Texinfo commands don't have types.
They
+ are identified by the cmdname instead. */
+ ELEMENT *e = new_element (ET_NONE);
+ e->cmd = CM_NONE;
+ add_to_element_contents (current, e);
+ retval = 1;
+ goto funexit;
+ }
+ /* line 4289 */
+ /* the 'misc-commands' - no braces and not block commands (includes
+ @end) */
+ else if (command_data(cmd_id).flags & CF_misc)
+ {
+ current = handle_misc_command (current, &line, cmd_id);
+ }
+
+ /* line 4632 */
+ else if (command_data(cmd_id).flags & CF_block)
+ {
+ current = handle_block_command (current, &line, cmd_id);
+ }
+
+ else if (command_data(cmd_id).flags & CF_brace) /* line 4835 */
+ /* or definfoenclose */
+ {
+ current = handle_brace_command (current, &line, cmd_id);
+ }
+
+ /* No-brace command */
+ else if (command_data(cmd_id).flags & CF_nobrace) /* 4864 */
+ {
+ ELEMENT *nobrace;
+
+ nobrace = new_element (ET_NONE);
+ nobrace->cmd = cmd_id;
+ add_to_element_contents (current, nobrace);
+
+ // @\
+ // @NEWLINE
+
+ }
+#if 0
+ else
+ {
+ /* error: unknown command */
+ }
+#endif
+ }
+ /* "Separator" - line 4881 */
+ else if (*line != '\0' && strchr ("{}@,:\t.\f", *line))
+ {
+ char separator = *line++;
+ debug ("SEPARATOR: %c", separator);
+ if (separator == '@')
+ /* error */;
+ else
+ current = handle_separator (current, separator, &line);
+ } /* 5326 */
+ /* "Misc text except end of line." */
+ else if (*line && *line != '\n') /* 5326 */
+ {
+ size_t len;
+
+ /* Output until next command, separator or newline. */
+ {
+ char saved; /* TODO: Have a length argument to merge_text? */
+ len = strcspn (line, "{}@,:\t.\n\f");
+ saved = line[len];
+ line[len] = '\0';
+ current = merge_text (current, line);
+ line += len;
+ *line = saved;
+ }
+
+ retval = 1;
+ goto funexit;
+ }
+ else /* 5331 End of line */
+ {
+ if (current->type)
+ debug ("END LINE (%s)", element_type_names[current->type]);
+ else if (current->cmd)
+ debug ("END LINE (@%s)", command_data(current->cmd).cmdname);
+ else
+ debug ("END LINE");
+ if (current->parent)
+ {
+ debug_nonl (" <- ");
+ if (current->parent->cmd)
+ debug_nonl("@%s", command_data(current->parent->cmd).cmdname);
+ if (current->parent->type)
+ debug_nonl("(%s)", element_type_names[current->parent->type]);
+ debug ("");
+ debug ("");
+ }
+
+ if (*line == '\n')
+ {
+ current = merge_text (current, "\n");
+ line++;
+ }
+ else
+ ;//abort ();
+
+ /* '@end' is processed in here. */
+ current = end_line (current); /* 5344 */
+ retval = 0;
+ }
+
+funexit:
+ *current_inout = current;
+ *line_inout = line;
+ return retval;
+}
+
+/* Pass in and return root of a "Texinfo tree". */
+/* 3676 */
+ELEMENT *
+parse_texi (ELEMENT *root_elt)
+{
+ ELEMENT *current = root_elt;
+ char *allocated_line = 0, *line;
+
+ /* Read input file line-by-line. */
+ while (1)
+ {
+ free (allocated_line);
+ line = allocated_line = next_text ();
+ if (!allocated_line)
+ break; /* Out of input. */
+
+ debug_nonl ("NEW LINE %s", line);
+
+ // 3706
+ /* Check if not in 'raw' or 'conditional' or parent is a 'verb', and
+ strip leading whitespace. Add a blank line to contents. */
+ if (!(command_flags(current) & CF_block)
+ || command_data(current->cmd).data != BLOCK_raw
+ && command_data(current->cmd).data != BLOCK_conditional)
+ {
+ ELEMENT *e;
+ int n;
+
+ debug ("BEGIN LINE");
+ e = new_element (ET_empty_line);
+ add_to_element_contents (current, e);
+
+ n = strspn (line, whitespace_chars_except_newline);
+ text_append_n (&e->text, line, n);
+ line += n;
+ }
+
+ /* Process from start of remaining line, advancing it until we run out
+ of line. */
+ while (1)
+ {
+ if (!big_loop (¤t, &line))
+ break;
+ }
+ }
+
+#if 0
+ /* Check for unclosed conditionals */
+ while (...)
+ {
+ }
+#endif
+
+ {
+ ELEMENT *dummy;
+ current = close_commands (current, CM_NONE, &dummy, CM_NONE);
+ }
+
+ /* Check for "unclosed stacks". */
+
+ return current;
+} /* 5372 */
+
+
+
+/* 5793 - end of code in Parser.pm */
Added: trunk/parsetexi/parser.h
===================================================================
--- trunk/parsetexi/parser.h (rev 0)
+++ trunk/parsetexi/parser.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,55 @@
+#include "tree_types.h"
+#include "tree.h"
+#include "context_stack.h"
+#include "commands.h"
+#include "handle_commands.h"
+#include "def.h"
+
+/* In commands.c */
+int close_paragraph_command (enum command_id cmd_id);
+int close_preformatted_command (enum command_id cmd_id);
+int item_line_command (enum command_id cmd_id);
+
+/* In close.c */
+void close_command_cleanup (ELEMENT *current);
+ELEMENT *close_commands (ELEMENT *current, enum command_id closed_command,
+ ELEMENT **closed_element, enum command_id);
+
+/* In end_line.c */
+ELEMENT *end_line (ELEMENT *current);
+
+/* In debug.c */
+void debug (char *s, ...);
+void debug_nonl (char *s, ...);
+
+/* In separator.c */
+ELEMENT *handle_separator (ELEMENT *current, char separator,
+ char **line_inout);
+
+/* In parser.c */
+void push_conditional_stack (enum command_id cond);
+enum command_id pop_conditional_stack (void);
+size_t conditional_number;
+ELEMENT *parse_texi_file (void);
+int abort_empty_line (ELEMENT **current_inout, char *additional);
+ELEMENT *end_paragraph (ELEMENT *current);
+void isolate_last_space (ELEMENT *current);
+int command_with_command_as_argument (ELEMENT *current);
+ELEMENT *begin_preformatted (ELEMENT *current);
+ELEMENT *end_preformatted (ELEMENT *current);
+char *read_command_name (char **ptr);
+ELEMENT *merge_text (ELEMENT *current, char *text);
+void start_empty_line_after_command (ELEMENT *current, char **line_inout);
+
+extern const char *whitespace_chars, *whitespace_chars_except_newline;
+
+/* In macro.c */
+void new_macro (char *name, ELEMENT *macro);
+ELEMENT *parse_macro_command_line (enum command_id, char **line_inout,
+ ELEMENT *parent);
+ELEMENT *handle_macro (ELEMENT *current, char **line_inout,
+ enum command_id cmd_id);
+
+/* Unsorted. */
+ELEMENT *item_line_parent (ELEMENT *current);
+ELEMENT *item_multitable_parent (ELEMENT *current);
Added: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c (rev 0)
+++ trunk/parsetexi/separator.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,313 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "parser.h"
+#include "tree.h"
+#include "text.h"
+
+/* 4888 */
+ELEMENT *
+handle_open_brace (ELEMENT *current, char **line_inout)
+{
+ char *line = *line_inout;
+
+ abort_empty_line (¤t, NULL);
+ /* 4890 */
+ if (command_flags(current) & CF_brace
+ /* || definfoenclose */ )
+ {
+ enum command_id command;
+ ELEMENT *arg;
+
+ command = current->cmd;
+ /* 4896 */
+ current->remaining_args = command_data(current->cmd).data;
+ current->remaining_args--;
+
+ arg = new_element (ET_NONE);
+ add_to_element_args (current, arg);
+ current = arg;
+
+ /* 4903 */
+ if (command_data(command).flags & CF_context_brace)
+ {
+ if (command == CM_caption || command == CM_shortcaption)
+ {
+ }
+
+ /* Add to context stack. */
+ switch (command)
+ {
+ case CM_footnote:
+ push_context (ct_footnote);
+ break;
+ case CM_caption:
+ push_context (ct_caption);
+ break;
+ case CM_shortcaption:
+ push_context (ct_shortcaption);
+ break;
+ case CM_math:
+ push_context (ct_math);
+ break;
+ default:
+ abort ();
+ }
+
+ {
+ ELEMENT *e;
+ int n;
+ n = strspn (line, whitespace_chars_except_newline);
+ e = new_element (ET_empty_spaces_before_argument);
+ text_append_n (&e->text, line, n);
+ add_to_element_contents (current, e);
+ line += n;
+ }
+ current->type = ET_brace_command_context;
+ }
+
+ /* 4945 */
+ else /* not context brace */
+ {
+ current->type = ET_brace_command_arg;
+ /* If this command takes any arguments. */
+ if (command_data(command).data > 0)
+ {
+ ELEMENT *e;
+ e = new_element (ET_empty_spaces_before_argument);
+ add_to_element_contents (current, e);
+ }
+ }
+
+ }
+
+ /* 4967 */
+ else if (current->parent->cmd == CM_multitable
+ || current->parent->type == ET_def_line)
+ {
+ ELEMENT *b, *e;
+ b = new_element (ET_bracketed);
+ add_to_element_contents (current, b);
+ current = b;
+ /* TODO: Record the line number if we are in a def_line in case @
+ protects the end of the line. */
+ e = new_element (ET_empty_spaces_before_argument);
+ add_to_element_contents (current, e);
+ debug ("BRACKETED in def/multitable");
+
+ }
+ else if (current->type == ET_rawpreformatted)
+ {
+ ELEMENT *e = new_element (ET_NONE);
+ text_append (&e->text, "{");
+ add_to_element_contents (current, e);
+ }
+
+ // 4993
+ else if (current_context() == ct_math
+ || current_context() == ct_rawpreformatted
+ || current_context() == ct_inlineraw)
+ // || ignore_global_commands () - whatever that is
+ {
+ ELEMENT *b = new_element (ET_bracketed);
+ add_to_element_contents (current, b);
+ current = b;
+ debug ("BRACKETED in math");
+ }
+#if 0
+
+ else
+ /*error*/;
+#endif
+
+ *line_inout = line;
+ return current;
+}
+
+/* 5007 */
+ELEMENT *
+handle_close_brace (ELEMENT *current, char **line_inout)
+{
+ char *line = *line_inout;
+
+ abort_empty_line (¤t, NULL);
+
+ if (current->type == ET_bracketed)
+ {
+ /* Used in @math */
+ current = current->parent;
+ goto funexit;
+ }
+ else if (command_flags(current->parent) & CF_brace)
+ // || definfoenclose
+ {
+ enum command_id closed_command;
+ // 5019
+ if (command_flags(current->parent) & CF_context_brace)
+ {
+ enum context c;
+ c = pop_context ();
+ }
+ closed_command = current->parent->cmd;
+ debug ("CLOSING(brace) %s", command_data(closed_command).cmdname);
+
+ // 5044 check for brace command that doesn't take arguments has in
+ // fact been given arguments.
+
+ if (closed_command == CM_anchor) // 5051
+ {
+ }
+ else if (command_data(closed_command).flags & CF_ref) // 5062
+ {
+ }
+ else if (closed_command == CM_image)
+ {
+ // check for filename argument
+ }
+ else if (closed_command == CM_dotless)
+ {
+ }
+ else if (command_data(closed_command).flags & (CF_explained | CF_inline))
+ { // 5129
+ }
+ else if (closed_command == CM_errormsg)
+ {
+ // XXXXX !!!!!!
+ // Texinfo::Convert::Text::convert (...)
+ // XXXXX !!!!!!
+ abort ();
+ }
+ else if (command_with_command_as_argument (current->parent->parent)
+ && current->contents.number == 0)
+ {
+ debug ("FOR PARENT ... command_as_argument_braces ...");
+ if (!current->parent->type)
+ current->parent->type = ET_command_as_argument;
+ }
+ //register_global_command ();
+ // ET_empty_spaces_after_close_brace
+ current = current->parent->parent;
+ if (close_preformatted_command(closed_command))
+ current = begin_preformatted (current);
+ // if close_preformatted begin_preformatted
+ } /* CF_brace */
+ else if (current->type == ET_rawpreformatted) // 5199
+ {
+ goto funexit;
+ }
+ // 5203 -- context brace command (e.g. @footnote)
+ else if (current_context() == ct_footnote
+ || current_context() == ct_caption
+ || current_context() == ct_shortcaption
+ || current_context() == ct_math)
+ {
+ enum context c;
+
+ current = end_paragraph (current);
+ if (1)
+ {
+ enum command_id closed_command;
+ c = pop_context ();
+ debug ("CLOSING(context command)");
+ closed_command = current->parent->cmd;
+
+ // 5211
+ current = current->parent->parent;
+ if (close_preformatted_command(closed_command))
+ current = begin_preformatted (current);
+ }
+ else // 5224
+ {
+ /* error - misplaced } */
+ goto funexit;
+ }
+ }
+
+funexit:
+ *line_inout = line;
+ return current;
+}
+
+/* Handle a comma separating arguments to a Texinfo command. */
+/* 5228 */
+ELEMENT *
+handle_comma (ELEMENT *current, char **line_inout)
+{
+ char *line = *line_inout;
+ enum element_type type;
+ ELEMENT *new_arg;
+
+ abort_empty_line (¤t, NULL);
+
+ /* Register brace_command_contents or block_command_line_contents in extra
+ key. Hopefully we won't have to do this. */
+
+ type = current->type;
+ current = current->parent;
+#if 0
+ if (current is an inline command (like inlineraw) all brace commands))
+ {
+ }
+#endif
+
+ current->remaining_args--;
+ new_arg = new_element (type);
+ add_to_element_args (current, new_arg);
+ current = new_arg;
+ add_to_element_contents (current,
+ new_element (ET_empty_spaces_before_argument));
+
+ *line_inout = line;
+ return current;
+}
+
+ELEMENT *
+handle_separator (ELEMENT *current, char separator, char **line_inout)
+{
+ char *line = *line_inout;
+
+ switch (separator)
+ {
+ case '{': /* 4888 */
+ current = handle_open_brace (current, &line);
+ goto funexit;
+ case '}': /* 5007 */
+ current = handle_close_brace (current, &line);
+ goto funexit;
+ case ',': /* 5228 */
+ if (current->parent->remaining_args > 0)
+ current = handle_comma (current, &line);
+ else
+ {
+ /* 5297 */
+ /* error - superfluous argument for @node. */
+ break;
+ /* if (...) */
+ goto funexit;
+ }
+
+ /* Fall through */
+ case '\t':
+ case '.':
+ break;
+ /* Menu entry separator. */
+ goto funexit;
+
+ case '\f':
+ break;
+ /* Form feed stops and restarts a paragraph. */
+ goto funexit;
+ }
+
+ /* Default: merge character. */
+ {
+ char t[2];
+ t[0] = separator;
+ t[1] = '\0';
+ merge_text (current, t);
+ }
+
+funexit:
+ *line_inout = line;
+ return current;
+}
Added: trunk/parsetexi/text.c
===================================================================
--- trunk/parsetexi/text.c (rev 0)
+++ trunk/parsetexi/text.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,43 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "tree_types.h"
+
+/* Make sure there are LEN free bytes. */
+static void
+text_alloc (TEXT *t, size_t len)
+{
+ if (t->end + len > t->space)
+ {
+ /* FIXME: Double it instead? */
+ t->space = t->end + len;
+ if (t->space < 10)
+ t->space = 10;
+ t->text = realloc (t->text, t->space);
+ if (!t->text)
+ abort ();
+ }
+}
+
+void
+text_append_n (TEXT *t, char *s, size_t len)
+{
+ text_alloc (t, len + 1);
+ memcpy (t->text + t->end, s, len);
+ t->end += len;
+ t->text[t->end] = '\0';
+}
+
+void
+text_append (TEXT *t, char *s)
+{
+ size_t len = strlen (s);
+ text_append_n (t, s, len);
+}
+
+void
+text_init (TEXT *t)
+{
+ t->end = t->space = 0;
+ t->text = 0;
+}
Added: trunk/parsetexi/text.h
===================================================================
--- trunk/parsetexi/text.h (rev 0)
+++ trunk/parsetexi/text.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,5 @@
+void text_init (TEXT *t);
+void text_append (TEXT *t, char *s);
+void text_append_n (TEXT *t, char *s, size_t len);
+
+#define text_base(t) ((t)->space ? (t)->text : (char *) 0)
Added: trunk/parsetexi/tree.c
===================================================================
--- trunk/parsetexi/tree.c (rev 0)
+++ trunk/parsetexi/tree.c 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,135 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "tree_types.h"
+#include "tree.h"
+
+ELEMENT *
+new_element (enum element_type type)
+{
+ ELEMENT *e = malloc (sizeof (ELEMENT));
+
+ /* Zero all elements */
+ memset (e, 0, sizeof (*e));
+
+ e->type = type;
+ e->cmd = CM_NONE;
+ e->args.list = 0;
+ e->args.space = 0;
+ e->args.number = 0;
+ e->contents.list = 0;
+ e->contents.space = 0;
+ e->contents.number = 0;
+ e->parent = 0;
+ e->extra = 0;
+
+ return e;
+}
+
+void
+destroy_element (ELEMENT *e)
+{
+ free (e);
+}
+
+/* Make sure there is space for at least one more element. */
+static void
+reallocate_list (ELEMENT_LIST *list)
+{
+ if (list->number + 1 >= list->space)
+ {
+ list->space += 10;
+ list->list = realloc (list->list, list->space * sizeof (ELEMENT));
+ if (!list->list)
+ abort (); /* Out of memory. */
+ }
+}
+
+void
+add_to_element_contents (ELEMENT *parent, ELEMENT *e)
+{
+ ELEMENT_LIST *list = &parent->contents;
+ reallocate_list (list);
+
+ list->list[list->number++] = e;
+ e->parent = parent;
+}
+
+void
+add_to_element_args (ELEMENT *parent, ELEMENT *e)
+{
+ ELEMENT_LIST *list = &parent->args;
+ reallocate_list (list);
+
+ list->list[list->number++] = e;
+ e->parent = parent;
+}
+
+void
+insert_into_contents (ELEMENT *parent, ELEMENT *e, int where)
+{
+ ELEMENT_LIST *list = &parent->contents;
+ reallocate_list (list);
+
+ if (where < 0)
+ where = list->number + where;
+
+ if (where < 0 || where > list->number)
+ abort ();
+
+ memmove (&list->list[where + 1], &list->list[where],
+ (list->number - where) * sizeof (ELEMENT));
+ list->list[where] = e;
+ list->number++;
+}
+
+
+ELEMENT *
+pop_element_from_contents (ELEMENT *parent)
+{
+ ELEMENT_LIST *list = &parent->contents;
+
+ return list->list[--list->number];
+}
+
+ELEMENT *
+last_args_child (ELEMENT *current)
+{
+ if (current->args.number == 0)
+ return 0;
+
+ return current->args.list[current->args.number - 1];
+}
+
+ELEMENT *
+last_contents_child (ELEMENT *current)
+{
+ if (current->contents.number == 0)
+ return 0;
+
+ return current->contents.list[current->contents.number - 1];
+}
+
+ELEMENT *
+contents_child_by_index (ELEMENT *e, int index)
+{
+ if (index < 0)
+ index = e->contents.number + index;
+
+ if (index < 0 || index >= e->contents.number)
+ return 0;
+
+ return e->contents.list[index];
+}
+
+ELEMENT *
+args_child_by_index (ELEMENT *e, int index)
+{
+ if (index < 0)
+ index = e->args.number + index;
+
+ if (index < 0 || index >= e->args.number)
+ return 0;
+
+ return e->args.list[index];
+}
Added: trunk/parsetexi/tree.h
===================================================================
--- trunk/parsetexi/tree.h (rev 0)
+++ trunk/parsetexi/tree.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,15 @@
+ELEMENT *new_element (enum element_type type);
+void add_to_element_contents (ELEMENT *parent, ELEMENT *e);
+void add_to_element_args (ELEMENT *parent, ELEMENT *e);
+void insert_into_contents (ELEMENT *parent, ELEMENT *e, int where);
+ELEMENT *last_args_child (ELEMENT *current);
+ELEMENT *last_contents_child (ELEMENT *current);
+ELEMENT *pop_element_from_contents (ELEMENT *parent);
+ELEMENT *contents_child_by_index (ELEMENT *e, int index);
+ELEMENT *args_child_by_index (ELEMENT *e, int index);
+void destroy_element (ELEMENT *e);
+
+#define element_contents_number(e) ((e)->contents.number)
+#define element_args_number(e) ((e)->args.number)
+#define element_text(e) (text_base (&(e)->text))
+
Added: trunk/parsetexi/tree_types.h
===================================================================
--- trunk/parsetexi/tree_types.h (rev 0)
+++ trunk/parsetexi/tree_types.h 2014-12-10 01:35:34 UTC (rev 5952)
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+#include "command_ids.h"
+#include "element_types.h"
+
+typedef struct TEXT {
+ char *text;
+ size_t space;
+ size_t end;
+} TEXT;
+
+typedef struct KEY_PAIR {
+ char *key;
+ char *value;
+} KEY_PAIR;
+
+typedef struct ELEMENT_LIST {
+ struct ELEMENT **list;
+ size_t number;
+ size_t space;
+} ELEMENT_LIST;
+
+typedef struct LINE_NR {
+} LINE_NR;
+
+typedef struct ELEMENT {
+ enum command_id cmd;
+ TEXT text;
+ enum element_type type;
+ ELEMENT_LIST args;
+ ELEMENT_LIST contents;
+ struct ELEMENT *parent; /* !! No way to serialize !! */
+ LINE_NR line_nr;
+ KEY_PAIR **extra;
+
+ /* Not used in final output. */
+ int remaining_args; /* Could be a stack instead. */
+} ELEMENT;
+
+typedef struct GLOBAL_INFO {
+ char *input_file_name;
+ char *input_encoding_name;
+} GLOBAL_INFO;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5952] add parsetexi to repository,
Gavin D. Smith <=