code:
\initial {!}
\entry {\code {! \r {(end of sentence)}}}{121}
\initial {"}
\entry {\code {" \r {(umlaut accent)}}}{122}
\initial {'}
\entry {\code {' \r {(umlaut accent)}}}{122}
\initial {*}
\entry {\code {* \r {(force line break)}}}{132}
\initial {,}
\entry {\code {, \r {(cedilla accent)}}}{122}
\initial {-}
\entry {\code {- \r {(discretionary hyphen)}}}{133}
\entry {\code {- (in image alt string)}}{108}
\initial {.}
\entry {\code {. \r {(end of sentence)}}}{121}
\initial {/}
\entry {\code {/ \r {(allow line break)}}}{132}
\initial {<}
\entry {\code {<colon> \r {(suppress end-of-sentence space)}}}{120}
\entry {\code {<newline>}}{119}
\entry {\code {<space>}}{119}
\entry {\code {<tab>}}{119}
\initial {=}
\entry {\code {= \r {(macron accent)}}}{122}
\initial {?}
\entry {\code {? \r {(end of sentence)}}}{121}
\initial {@}
\entry {\code {@ \r {(literal \samp {@})}}}{117}
\entry {\code {@atchar{\tt \char 123}{\tt \char 125} \r {(literal \samp {@})}}}{117}
\entry {\code {@codequotebacktick \var {on-off}}}{119}
\entry {\code {@codequoteundirected \var {on-off}}}{119}
\entry {\code {@hashchar{\tt \char 123}{\tt \char 125} \r {(literal \samp {#})}}}{118}
\entry {\code {@lbracechar{\tt \char 123}{\tt \char 125} \r {(literal \samp {{\tt \char 123}})}}}{117}
\entry {\code {@rbracechar{\tt \char 123}{\tt \char 125} \r {(literal \samp {{\tt \char 125}})}}}{117}
\initial {^}
\entry {\code {^ \r {(circumflex accent)}}}{122}
\initial {`}
\entry {\code {` \r {(grave accent)}}}{122}
\initial {{\tt \indexbackslash }}
\entry {\code {{\tt \backslashcurfont } \r {(literal {\tt \backslashcurfont } in \code {@math})}}}{125}
\entry {\code {{\tt \backslashcurfont }emergencystretch}}{183}
\entry {\code {{\tt \backslashcurfont }gdef \r {within \code {@tex}}}}{154}
\entry {\code {{\tt \backslashcurfont }globaldefs \r {within \code {@tex}}}}{154}
\entry {\code {{\tt \backslashcurfont }input \r {(raw \TeX {} startup)}}}{10}
\entry {\code {{\tt \backslashcurfont }mag \r {(raw \TeX {} magnification)}}}{185}
\initial {|}
\entry {\code {{\tt \char 123} \r {(literal \samp {{\tt \char 123}})}}}{117}
\entry {\code {{\tt \char 125} \r {(literal \samp {{\tt \char 125}})}}}{117}
\initial {~}
\entry {\code {~ \r {(tilde accent)}}}{122}
\initial {A}
\entry {\code {aa}}{123}
\entry {\code {AA}}{123}
\entry {\code {abbr}}{83}
\entry {\code {acronym}}{83}
\entry {\code {ae}}{123}
\entry {\code {AE}}{123}
\entry {\code {afourlatex}}{184}
\entry {\code {afourpaper}}{184}
\entry {\code {afourwide}}{184}
\entry {\code {alias}}{168}
\entry {\code {allowcodebreaks}}{133}
\entry {\code {anchor}}{58}
\entry {\code {appendix}}{48}
\entry {\code {appendixsec}}{49}
\entry {\code {appendixsection}}{49}
\entry {\code {appendixsubsec}}{49}
\entry {\code {appendixsubsubsec}}{50}
\entry {\code {apply}}{147}
\entry {\code {arrow}}{130}
\entry {\code {asis}}{101}
\entry {\code {author}}{35}
\initial {B}
\entry {\code {b \r {(bold font)}}}{86}
\entry {\code {backslash}}{118}
\entry {\code {bullet}}{126}
\entry {\code {bye}}{44, 45}
\initial {C}
\entry {\code {c \r {(comment)}}}{10}
\entry {\code {caption}}{106}
\entry {\code {cartouche}}{96}
\entry {\code {center}}{34}
\entry {\code {centerchap}}{48}
\entry {\code {chapheading}}{48}
\entry {\code {chapter}}{47}
\entry {\code {cindex}}{112}
\entry {\code {cite}}{75}
\entry {\code {clear}}{156}
\entry {\code {click}}{130}
\entry {\code {clicksequence}}{130}
\entry {\code {clickstyle}}{130}
\entry {\code {code}}{77}
\entry {\code {columnfractions}}{103}
\entry {\code {comma}}{118}
\entry {\code {command}}{82}
\entry {\code {comment}}{10}
\entry {\code {complete_tree_nodes_menus}}{206}
\entry {\code {contents}}{37}
\entry {\code {copying}}{32}
\entry {\code {copyright}}{32, 125}
\entry {\code {cropmarks}}{185}
\initial {D}
\entry {\code {debugcount}}{197}
\entry {\code {debugtree}}{197}
\entry {\code {defcodeindex}}{115}
\entry {\code {defcv}}{144}
\entry {\code {deffn}}{139}
\entry {\code {deffnx}}{138}
\entry {\code {defindex}}{115}
\entry {\code {definfoenclose}}{168}
\entry {\code {defivar}}{144}
\entry {\code {defmac}}{139}
\entry {\code {defmethod}}{146}
\entry {\code {defop}}{145}
\entry {\code {defopt}}{140}
\entry {\code {defspec}}{139}
\entry {\code {deftp}}{143}
\entry {\code {deftypecv}}{144}
\entry {\code {deftypefn}}{141}
\entry {\code {deftypefnnewline}}{142}
\entry {\code {deftypefun}}{142}
\entry {\code {deftypeivar}}{145}
\entry {\code {deftypeop}}{146}
\entry {\code {deftypevar}}{143}
\entry {\code {deftypevr}}{142}
\entry {\code {defun}}{139}
\entry {\code {defvar}}{140}
\entry {\code {defvr}}{140}
\entry {\code {DEL \r {(comment character)}}}{10}
\entry {\code {detailmenu}}{39, 58}
\entry {\code {dfn}}{82}
\entry {\code {dh}}{123}
\entry {\code {DH}}{123}
\entry {\code {dircategory}}{216}
\entry {\code {direntry}}{216}
\entry {\code {display}}{92}
\entry {\code {dmn}}{122}
\entry {\code {docbook}}{155, 197}
\entry {\code {documentdescription}}{40}
\entry {\code {documentencoding}}{122, 123, 150}
\entry {\code {documentlanguage}}{149}
\entry {\code {dotaccent}}{122}
\entry {\code {dotless}}{123}
\entry {\code {dots}}{126}
\entry {\code {dvi}}{197}
\entry {\code {dvipdf}}{197}
\initial {E}
\entry {\code {email}}{84}
\entry {\code {emph}}{85}
\entry {\code {end}}{87, 97}
\entry {\code {enddots}}{126}
\entry {\code {enumerate}}{99}
\entry {\code {env}}{81}
\entry {\code {equiv}}{129}
\entry {\code {error}}{129}
\entry {\code {errormsg}}{153}
\entry {\code {errormsg\r {, and line numbers in \TeX {}}}}{170}
\entry {\code {euro}}{126}
\entry {\code {evenfooting}}{268}
\entry {\code {evenfootingmarks}}{270}
\entry {\code {evenheading}}{268}
\entry {\code {evenheadingmarks}}{270}
\entry {\code {everyfooting}}{268}
\entry {\code {everyfootingmarks}}{269}
\entry {\code {everyheading}}{268}
\entry {\code {everyheadingmarks}}{269}
\entry {\code {example}}{89}
\entry {\code {exampleindent}}{43}
\entry {\code {exclamdown}}{123}
\entry {\code {exdent}}{93}
\entry {\code {expansion}}{128}
\initial {F}
\entry {\code {file}}{82}
\entry {\code {fill_gaps_in_sectioning}}{206}
\entry {\code {filll \r {\TeX {} dimension}}}{36}
\entry {\code {finalout}}{183}
\entry {\code {findex}}{112}
\entry {\code {firstparagraphindent}}{43}
\entry {\code {float}}{105}
\entry {\code {flushleft}}{93}
\entry {\code {flushright}}{93}
\entry {\code {fn-name}}{137}
\entry {\code {fonttextsize}}{85}
\entry {\code {foobar}}{138, 141}
\entry {\code {footnote}}{109}
\entry {\code {footnotestyle}}{110}
\entry {\code {format}}{93}
\entry {\code {forward-word}}{136}
\entry {\code {frenchspacing}}{121}
\entry {\code {ftable}}{102}
\initial {G}
\entry {\code {geq}}{127}
\entry {\code {group}}{135}
\entry {\code {guillemetleft}}{124}
\entry {\code {guillemetright}}{124}
\entry {\code {guillemotleft}}{124}
\entry {\code {guillemotright}}{124}
\entry {\code {guilsinglleft}}{124}
\entry {\code {guilsinglright}}{124}
\initial {H}
\entry {\code {H \r {(Hungarian umlaut accent)}}}{122}
\entry {\code {hbox}}{183}
\entry {\code {heading}}{49}
\entry {\code {headings}}{41}
\entry {\code {headitem}}{103}
\entry {\code {headitemfont}}{103}
\entry {\code {headword}}{169}
\entry {\code {html}}{154, 197}
\entry {\code {hyphenation}}{133}
\initial {I}
\entry {\code {i \r {(italic font)}}}{86}
\entry {\code {ifclear}}{158}
\entry {\code {ifdocbook}}{152, 155}
\entry {\code {ifhtml}}{152, 154}
\entry {\code {ifinfo}}{152}
\entry {\code {ifnotdocbook}}{153}
\entry {\code {ifnothtml}}{153}
\entry {\code {ifnotinfo}}{153}
\entry {\code {ifnotplaintext}}{153}
\entry {\code {ifnottex}}{153}
\entry {\code {ifnotxml}}{153}
\entry {\code {ifplaintext}}{152}
\entry {\code {ifset}}{157}
\entry {\code {iftex}}{152}
\entry {\code {ifxml}}{152, 154}
\entry {\code {ignore}}{10}
\entry {\code {image}}{107}
\entry {\code {include}}{172}
\entry {\code {indent}}{95}
\entry {\code {indent_menu_descriptions}}{206}
\entry {\code {indentedblock}}{89}
\entry {\code {indicateurl}}{84}
\entry {\code {info}}{197}
\entry {\code {Info-validate}}{275}
\entry {\code {inforef}}{73}
\entry {\code {inlinefmt}}{155}
\entry {\code {inlinefmtifelse}}{155}
\entry {\code {inlineifclear}}{158}
\entry {\code {inlineifset}}{158}
\entry {\code {inlineraw}}{155}
\entry {\code {insert_nodes_for_sectioning_commands}}{207}
\entry {\code {insertcopying}}{33}
\entry {\code {isearch-backward}}{138}
\entry {\code {isearch-forward}}{138}
\entry {\code {item}}{98, 101, 103}
\entry {\code {itemize}}{98}
\entry {\code {itemx}}{102}
\initial {K}
\entry {\code {kbd}}{78}
\entry {\code {kbdinputstyle}}{78}
\entry {\code {key}}{79}
\entry {\code {kindex}}{112}
\initial {L}
\entry {\code {l}}{123}
\entry {\code {L}}{123}
\entry {\code {LaTeX}}{125}
\entry {\code {leq}}{127}
\entry {\code {lisp}}{91}
\entry {\code {listoffloats}}{106}
\entry {\code {lowersections}}{51}
\initial {M}
\entry {\code {macro}}{162}
\entry {\code {majorheading}}{48}
\entry {\code {makeinfo-buffer}}{211}
\entry {\code {makeinfo-kill-job}}{212}
\entry {\code {makeinfo-recenter-output-buffer}}{212}
\entry {\code {makeinfo-region}}{211}
\entry {\code {math}}{124}
\entry {\code {menu}}{61}
\entry {\code {minus}}{127}
\entry {\code {move_index_entries_after_items}}{207}
\entry {\code {multitable}}{102}
\initial {N}
\entry {\code {need}}{135}
\entry {\code {next-error}}{211}
\entry {\code {node}}{53}
\entry {\code {noindent}}{94}
\entry {\code {novalidate}}{176}
\initial {O}
\entry {\code {o}}{123}
\entry {\code {O}}{123}
\entry {\code {occur}}{275}
\entry {\code {occur-mode-goto-occurrence}}{19}
\entry {\code {oddfooting}}{268}
\entry {\code {oddfootingmarks}}{270}
\entry {\code {oddheading}}{268}
\entry {\code {oddheadingmarks}}{270}
\entry {\code {oe}}{123}
\entry {\code {OE}}{123}
\entry {\code {ogonek}}{122}
\entry {\code {option}}{82}
\entry {\code {ordf}}{123}
\entry {\code {ordm}}{123}
\initial {P}
\entry {\code {page}}{134}
\entry {\code {page\r {, within \code {@titlepage}}}}{34}
\entry {\code {pagesizes}}{184}
\entry {\code {paragraphindent}}{42}
\entry {\code {parse}}{197}
\entry {\code {part}}{50}
\entry {\code {pdf}}{197}
\entry {\code {phoo}}{169}
\entry {\code {pindex}}{112}
\entry {\code {plaintexinfo}}{197}
\entry {\code {plaintext}}{197}
\entry {\code {point}}{129}
\entry {\code {pounds}}{126}
\entry {\code {print}}{128}
\entry {\code {printindex}}{44}
\entry {\code {ps}}{197}
\entry {\code {pxref}}{72}
\initial {Q}
\entry {\code {questiondown}}{123}
\entry {\code {quotation}}{88}
\entry {\code {quotedblbase}}{124}
\entry {\code {quotedblleft}}{124}
\entry {\code {quotedblright}}{124}
\entry {\code {quoteleft}}{124}
\entry {\code {quoteright}}{124}
\entry {\code {quotesinglbase}}{124}
\initial {R}
\entry {\code {r \r {(roman font)}}}{86}
\entry {\code {raggedright}}{94}
\entry {\code {raisesections}}{51}
\entry {\code {rawtext}}{197}
\entry {\code {ref}}{72}
\entry {\code {refill}}{247}
\entry {\code {regenerate_master_menu}}{207}
\entry {\code {registeredsymbol}}{126}
\entry {\code {result}}{128}
\entry {\code {ringaccent}}{122}
\entry {\code {rmacro}}{163}
\initial {S}
\entry {\code {samp}}{80}
\entry {\code {sansserif \r {(sans serif font)}}}{86}
\entry {\code {sc \r {(small caps font)}}}{85}
\entry {\code {section}}{48}
\entry {\code {set}}{156}
\entry {\code {setchapternewpage}}{40}
\entry {\code {setcontentsaftertitlepage}}{38}
\entry {\code {setfilename}}{30}
\entry {\code {setshortcontentsaftertitlepage}}{38}
\entry {\code {settitle}}{31}
\entry {\code {shortcaption}}{106}
\entry {\code {shortcontents}}{37}
\entry {\code {shorttitlepage}}{34}
\entry {\code {simple_menu}}{207}
\entry {\code {slanted \r {(slanted font)}}}{86}
\entry {\code {smallbook}}{183}
\entry {\code {smalldisplay}}{92}
\entry {\code {smallexample}}{92}
\entry {\code {smallformat}}{92, 93}
\entry {\code {smallindentedblock}}{89}
\entry {\code {smalllisp}}{92}
\entry {\code {smallquotation}}{89, 92}
\entry {\code {sp \r {(line spacing)}}}{134}
\entry {\code {sp \r {(titlepage line spacing)}}}{34}
\entry {\code {ss}}{123}
\entry {\code {strong}}{85}
\entry {\code {structure}}{197}
\entry {\code {subheading}}{49}
\entry {\code {subsection}}{49}
\entry {\code {subsubheading}}{50}
\entry {\code {subsubsection}}{50}
\entry {\code {subtitle}}{35}
\entry {\code {summarycontents}}{37}
\entry {\code {syncodeindex}}{114}
\entry {\code {synindex}}{115}
\initial {T}
\entry {\code {t \r {(typewriter font)}}}{86}
\entry {\code {tab}}{103}
\entry {\code {table}}{100}
\entry {\code {tex}}{154}
\entry {\code {TeX}}{125}
\entry {\code {texinfo-all-menus-update}}{21}
\entry {\code {texinfo-every-node-update}}{21}
\entry {\code {texinfo-format-buffer}}{24, 212}
\entry {\code {texinfo-format-region}}{24, 212}
\entry {\code {texinfo-indent-menu-description}}{23}
\entry {\code {texinfo-insert-@code}}{17}
\entry {\code {texinfo-insert-@dfn}}{17}
\entry {\code {texinfo-insert-@end}}{17}
\entry {\code {texinfo-insert-@example}}{18}
\entry {\code {texinfo-insert-@item}}{17}
\entry {\code {texinfo-insert-@kbd}}{17}
\entry {\code {texinfo-insert-@node}}{17}
\entry {\code {texinfo-insert-@noindent}}{17}
\entry {\code {texinfo-insert-@samp}}{17}
\entry {\code {texinfo-insert-@table}}{17}
\entry {\code {texinfo-insert-@var}}{18}
\entry {\code {texinfo-insert-braces}}{18}
\entry {\code {texinfo-insert-node-lines}}{23}
\entry {\code {texinfo-make-menu}}{21}
\entry {\code {texinfo-master-menu}}{20}
\entry {\code {texinfo-multiple-files-update}}{172}
\entry {\code {texinfo-multiple-files-update \r {(in brief)}}}{23}
\entry {\code {texinfo-sequential-node-update}}{23}
\entry {\code {texinfo-show-structure}}{19, 274}
\entry {\code {texinfo-start-menu-description}}{18}
\entry {\code {texinfo-tex-buffer}}{25}
\entry {\code {texinfo-tex-print}}{25}
\entry {\code {texinfo-tex-region}}{25}
\entry {\code {texinfo-update-node}}{21}
\entry {\code {Texinfo::Parser module}}{187}
\entry {\code {texinfosxml}}{197}
\entry {\code {textcontent}}{197}
\entry {\code {textdegree}}{126}
\entry {\code {th}}{123}
\entry {\code {TH}}{123}
\entry {\code {thischapter}}{269}
\entry {\code {thischaptername}}{269}
\entry {\code {thischapternum}}{269}
\entry {\code {thisfile}}{269}
\entry {\code {thispage}}{269}
\entry {\code {thissection}}{269}
\entry {\code {thissectionname}}{269}
\entry {\code {thissectionnum}}{269}
\entry {\code {thistitle}}{269}
\entry {\code {tie \r {(unbreakable interword space)}}}{134}
\entry {\code {tieaccent}}{122}
\entry {\code {tindex}}{112}
\entry {\code {title}}{35}
\entry {\code {titlefont}}{34}
\entry {\code {titlepage}}{33}
\entry {\code {today}}{269}
\entry {\code {top}}{38, 57}
\initial {U}
\entry {\code {u \r {(breve accent)}}}{122}
\entry {\code {ubaraccent}}{122}
\entry {\code {udotaccent}}{122}
\entry {\code {unmacro}}{163}
\entry {\code {unnumbered}}{48}
\entry {\code {unnumberedsec}}{49}
\entry {\code {unnumberedsubsec}}{49}
\entry {\code {unnumberedsubsubsec}}{50}
\entry {\code {up-list}}{18}
\entry {\code {uref}}{74}
\entry {\code {urefbreakstyle}}{74}
\initial {V}
\entry {\code {v \r {(check accent)}}}{122}
\entry {\code {value}}{156}
\entry {\code {var}}{81}
\entry {\code {verb}}{80}
\entry {\code {verbatim}}{90}
\entry {\code {verbatiminclude}}{91}
\entry {\code {vindex}}{112}
\entry {\code {vskip \r {\TeX {} vertical skip}}}{36}
\entry {\code {vtable}}{102}
\initial {W}
\entry {\code {w \r {(prevent line break)}}}{134}
\initial {X}
\entry {\code {xml}}{154, 197}
\entry {\code {xref}}{67}
\entry {\code {xrefautomaticsectiontitle}}{69}


code:
\initial {!}
\entry {\code {! \r {(end of sentence)}}}{121}
\initial {"}
\entry {\code {" \r {(umlaut accent)}}}{122}
\initial {'}
\entry {\code {' \r {(umlaut accent)}}}{122}
\initial {*}
\entry {\code {* \r {(force line break)}}}{132}
\initial {,}
\entry {\code {, \r {(cedilla accent)}}}{122}
\initial {-}
\entry {\code {- \r {(discretionary hyphen)}}}{133}
\entry {\code {- (in image alt string)}}{108}
\initial {.}
\entry {\code {. \r {(end of sentence)}}}{121}
\initial {/}
\entry {\code {/ \r {(allow line break)}}}{132}
\initial {<}
\entry {\code {<colon> \r {(suppress end-of-sentence space)}}}{120}
\entry {\code {<newline>}}{119}
\entry {\code {<space>}}{119}
\entry {\code {<tab>}}{119}
\initial {=}
\entry {\code {= \r {(macron accent)}}}{122}
\initial {?}
\entry {\code {? \r {(end of sentence)}}}{121}
\initial {@}
\entry {\code {@ \r {(literal \samp {@})}}}{117}
\entry {\code {@atchar{\tt \char 123}{\tt \char 125} \r {(literal \samp {@})}}}{117}
\entry {\code {@codequotebacktick \var {on-off}}}{119}
\entry {\code {@codequoteundirected \var {on-off}}}{119}
\entry {\code {@hashchar{\tt \char 123}{\tt \char 125} \r {(literal \samp {#})}}}{118}
\entry {\code {@lbracechar{\tt \char 123}{\tt \char 125} \r {(literal \samp {{\tt \char 123}})}}}{117}
\entry {\code {@rbracechar{\tt \char 123}{\tt \char 125} \r {(literal \samp {{\tt \char 125}})}}}{117}
\initial {^}
\entry {\code {^ \r {(circumflex accent)}}}{122}
\initial {`}
\entry {\code {` \r {(grave accent)}}}{122}
\initial {\\}
\entry {\code {{\tt \backslashcurfont } \r {(literal {\tt \backslashcurfont } in \code {@math})}}}{125}
\entry {\code {{\tt \backslashcurfont }emergencystretch}}{183}
\entry {\code {{\tt \backslashcurfont }gdef \r {within \code {@tex}}}}{154}
\entry {\code {{\tt \backslashcurfont }globaldefs \r {within \code {@tex}}}}{154}
\entry {\code {{\tt \backslashcurfont }input \r {(raw \TeX {} startup)}}}{10}
\entry {\code {{\tt \backslashcurfont }mag \r {(raw \TeX {} magnification)}}}{185}
\initial {|}
\entry {\code {{\tt \char 123} \r {(literal \samp {{\tt \char 123}})}}}{117}
\entry {\code {{\tt \char 125} \r {(literal \samp {{\tt \char 125}})}}}{117}
\initial {~}
\entry {\code {~ \r {(tilde accent)}}}{122}
\initial {A}
\entry {\code {aa}}{123}
\entry {\code {AA}}{123}
\entry {\code {abbr}}{83}
\entry {\code {acronym}}{83}
\entry {\code {ae}}{123}
\entry {\code {AE}}{123}
\entry {\code {afourlatex}}{184}
\entry {\code {afourpaper}}{184}
\entry {\code {afourwide}}{184}
\entry {\code {alias}}{168}
\entry {\code {allowcodebreaks}}{133}
\entry {\code {anchor}}{58}
\entry {\code {appendix}}{48}
\entry {\code {appendixsec}}{49}
\entry {\code {appendixsection}}{49}
\entry {\code {appendixsubsec}}{49}
\entry {\code {appendixsubsubsec}}{50}
\entry {\code {apply}}{147}
\entry {\code {arrow}}{130}
\entry {\code {asis}}{101}
\entry {\code {author}}{35}
\initial {B}
\entry {\code {b \r {(bold font)}}}{86}
\entry {\code {backslash}}{118}
\entry {\code {bullet}}{126}
\entry {\code {bye}}{44, 45}
\initial {C}
\entry {\code {c \r {(comment)}}}{10}
\entry {\code {caption}}{106}
\entry {\code {cartouche}}{96}
\entry {\code {center}}{34}
\entry {\code {centerchap}}{48}
\entry {\code {chapheading}}{48}
\entry {\code {chapter}}{47}
\entry {\code {cindex}}{112}
\entry {\code {cite}}{75}
\entry {\code {clear}}{156}
\entry {\code {click}}{130}
\entry {\code {clicksequence}}{130}
\entry {\code {clickstyle}}{130}
\entry {\code {code}}{77}
\entry {\code {columnfractions}}{103}
\entry {\code {comma}}{118}
\entry {\code {command}}{82}
\entry {\code {comment}}{10}
\entry {\code {complete_tree_nodes_menus}}{206}
\entry {\code {contents}}{37}
\entry {\code {copying}}{32}
\entry {\code {copyright}}{32, 125}
\entry {\code {cropmarks}}{185}
\initial {D}
\entry {\code {debugcount}}{197}
\entry {\code {debugtree}}{197}
\entry {\code {defcodeindex}}{115}
\entry {\code {defcv}}{144}
\entry {\code {deffn}}{139}
\entry {\code {deffnx}}{138}
\entry {\code {defindex}}{115}
\entry {\code {definfoenclose}}{168}
\entry {\code {defivar}}{144}
\entry {\code {defmac}}{139}
\entry {\code {defmethod}}{146}
\entry {\code {defop}}{145}
\entry {\code {defopt}}{140}
\entry {\code {defspec}}{139}
\entry {\code {deftp}}{143}
\entry {\code {deftypecv}}{144}
\entry {\code {deftypefn}}{141}
\entry {\code {deftypefnnewline}}{142}
\entry {\code {deftypefun}}{142}
\entry {\code {deftypeivar}}{145}
\entry {\code {deftypeop}}{146}
\entry {\code {deftypevar}}{143}
\entry {\code {deftypevr}}{142}
\entry {\code {defun}}{139}
\entry {\code {defvar}}{140}
\entry {\code {defvr}}{140}
\entry {\code {DEL \r {(comment character)}}}{10}
\entry {\code {detailmenu}}{39, 58}
\entry {\code {dfn}}{82}
\entry {\code {dh}}{123}
\entry {\code {DH}}{123}
\entry {\code {dircategory}}{216}
\entry {\code {direntry}}{216}
\entry {\code {display}}{92}
\entry {\code {dmn}}{122}
\entry {\code {docbook}}{155, 197}
\entry {\code {documentdescription}}{40}
\entry {\code {documentencoding}}{122, 123, 150}
\entry {\code {documentlanguage}}{149}
\entry {\code {dotaccent}}{122}
\entry {\code {dotless}}{123}
\entry {\code {dots}}{126}
\entry {\code {dvi}}{197}
\entry {\code {dvipdf}}{197}
\initial {E}
\entry {\code {email}}{84}
\entry {\code {emph}}{85}
\entry {\code {end}}{87, 97}
\entry {\code {enddots}}{126}
\entry {\code {enumerate}}{99}
\entry {\code {env}}{81}
\entry {\code {equiv}}{129}
\entry {\code {error}}{129}
\entry {\code {errormsg}}{153}
\entry {\code {errormsg\r {, and line numbers in \TeX {}}}}{170}
\entry {\code {euro}}{126}
\entry {\code {evenfooting}}{268}
\entry {\code {evenfootingmarks}}{270}
\entry {\code {evenheading}}{268}
\entry {\code {evenheadingmarks}}{270}
\entry {\code {everyfooting}}{268}
\entry {\code {everyfootingmarks}}{269}
\entry {\code {everyheading}}{268}
\entry {\code {everyheadingmarks}}{269}
\entry {\code {example}}{89}
\entry {\code {exampleindent}}{43}
\entry {\code {exclamdown}}{123}
\entry {\code {exdent}}{93}
\entry {\code {expansion}}{128}
\initial {F}
\entry {\code {file}}{82}
\entry {\code {fill_gaps_in_sectioning}}{206}
\entry {\code {filll \r {\TeX {} dimension}}}{36}
\entry {\code {finalout}}{183}
\entry {\code {findex}}{112}
\entry {\code {firstparagraphindent}}{43}
\entry {\code {float}}{105}
\entry {\code {flushleft}}{93}
\entry {\code {flushright}}{93}
\entry {\code {fn-name}}{137}
\entry {\code {fonttextsize}}{85}
\entry {\code {foobar}}{138, 141}
\entry {\code {footnote}}{109}
\entry {\code {footnotestyle}}{110}
\entry {\code {format}}{93}
\entry {\code {forward-word}}{136}
\entry {\code {frenchspacing}}{121}
\entry {\code {ftable}}{102}
\initial {G}
\entry {\code {geq}}{127}
\entry {\code {group}}{135}
\entry {\code {guillemetleft}}{124}
\entry {\code {guillemetright}}{124}
\entry {\code {guillemotleft}}{124}
\entry {\code {guillemotright}}{124}
\entry {\code {guilsinglleft}}{124}
\entry {\code {guilsinglright}}{124}
\initial {H}
\entry {\code {H \r {(Hungarian umlaut accent)}}}{122}
\entry {\code {hbox}}{183}
\entry {\code {heading}}{49}
\entry {\code {headings}}{41}
\entry {\code {headitem}}{103}
\entry {\code {headitemfont}}{103}
\entry {\code {headword}}{169}
\entry {\code {html}}{154, 197}
\entry {\code {hyphenation}}{133}
\initial {I}
\entry {\code {i \r {(italic font)}}}{86}
\entry {\code {ifclear}}{158}
\entry {\code {ifdocbook}}{152, 155}
\entry {\code {ifhtml}}{152, 154}
\entry {\code {ifinfo}}{152}
\entry {\code {ifnotdocbook}}{153}
\entry {\code {ifnothtml}}{153}
\entry {\code {ifnotinfo}}{153}
\entry {\code {ifnotplaintext}}{153}
\entry {\code {ifnottex}}{153}
\entry {\code {ifnotxml}}{153}
\entry {\code {ifplaintext}}{152}
\entry {\code {ifset}}{157}
\entry {\code {iftex}}{152}
\entry {\code {ifxml}}{152, 154}
\entry {\code {ignore}}{10}
\entry {\code {image}}{107}
\entry {\code {include}}{172}
\entry {\code {indent}}{95}
\entry {\code {indent_menu_descriptions}}{206}
\entry {\code {indentedblock}}{89}
\entry {\code {indicateurl}}{84}
\entry {\code {info}}{197}
\entry {\code {Info-validate}}{275}
\entry {\code {inforef}}{73}
\entry {\code {inlinefmt}}{155}
\entry {\code {inlinefmtifelse}}{155}
\entry {\code {inlineifclear}}{158}
\entry {\code {inlineifset}}{158}
\entry {\code {inlineraw}}{155}
\entry {\code {insert_nodes_for_sectioning_commands}}{207}
\entry {\code {insertcopying}}{33}
\entry {\code {isearch-backward}}{138}
\entry {\code {isearch-forward}}{138}
\entry {\code {item}}{98, 101, 103}
\entry {\code {itemize}}{98}
\entry {\code {itemx}}{102}
\initial {K}
\entry {\code {kbd}}{78}
\entry {\code {kbdinputstyle}}{78}
\entry {\code {key}}{79}
\entry {\code {kindex}}{112}
\initial {L}
\entry {\code {l}}{123}
\entry {\code {LaTeX}}{125}
\entry {\code {leq}}{127}
\entry {\code {lisp}}{91}
\entry {\code {listoffloats}}{106}
\entry {\code {lowersections}}{51}
\entry {\code {L}}{123}
\initial {M}
\entry {\code {macro}}{162}
\entry {\code {majorheading}}{48}
\entry {\code {makeinfo-buffer}}{211}
\entry {\code {makeinfo-kill-job}}{212}
\entry {\code {makeinfo-recenter-output-buffer}}{212}
\entry {\code {makeinfo-region}}{211}
\entry {\code {math}}{124}
\entry {\code {menu}}{61}
\entry {\code {minus}}{127}
\entry {\code {move_index_entries_after_items}}{207}
\entry {\code {multitable}}{102}
\initial {N}
\entry {\code {need}}{135}
\entry {\code {next-error}}{211}
\entry {\code {node}}{53}
\entry {\code {noindent}}{94}
\entry {\code {novalidate}}{176}
\initial {O}
\entry {\code {o}}{123}
\entry {\code {occur}}{275}
\entry {\code {occur-mode-goto-occurrence}}{19}
\entry {\code {oddfooting}}{268}
\entry {\code {oddfootingmarks}}{270}
\entry {\code {oddheading}}{268}
\entry {\code {oddheadingmarks}}{270}
\entry {\code {oe}}{123}
\entry {\code {OE}}{123}
\entry {\code {ogonek}}{122}
\entry {\code {option}}{82}
\entry {\code {ordf}}{123}
\entry {\code {ordm}}{123}
\entry {\code {O}}{123}
\initial {P}
\entry {\code {page}}{134}
\entry {\code {page\r {, within \code {@titlepage}}}}{34}
\entry {\code {pagesizes}}{184}
\entry {\code {paragraphindent}}{42}
\entry {\code {parse}}{197}
\entry {\code {part}}{50}
\entry {\code {pdf}}{197}
\entry {\code {phoo}}{169}
\entry {\code {pindex}}{112}
\entry {\code {plaintexinfo}}{197}
\entry {\code {plaintext}}{197}
\entry {\code {point}}{129}
\entry {\code {pounds}}{126}
\entry {\code {print}}{128}
\entry {\code {printindex}}{44}
\entry {\code {ps}}{197}
\entry {\code {pxref}}{72}
\initial {Q}
\entry {\code {questiondown}}{123}
\entry {\code {quotation}}{88}
\entry {\code {quotedblbase}}{124}
\entry {\code {quotedblleft}}{124}
\entry {\code {quotedblright}}{124}
\entry {\code {quoteleft}}{124}
\entry {\code {quoteright}}{124}
\entry {\code {quotesinglbase}}{124}
\initial {R}
\entry {\code {r \r {(roman font)}}}{86}
\entry {\code {raggedright}}{94}
\entry {\code {raisesections}}{51}
\entry {\code {rawtext}}{197}
\entry {\code {ref}}{72}
\entry {\code {refill}}{247}
\entry {\code {regenerate_master_menu}}{207}
\entry {\code {registeredsymbol}}{126}
\entry {\code {result}}{128}
\entry {\code {ringaccent}}{122}
\entry {\code {rmacro}}{163}
\initial {S}
\entry {\code {samp}}{80}
\entry {\code {sansserif \r {(sans serif font)}}}{86}
\entry {\code {sc \r {(small caps font)}}}{85}
\entry {\code {section}}{48}
\entry {\code {set}}{156}
\entry {\code {setchapternewpage}}{40}
\entry {\code {setcontentsaftertitlepage}}{38}
\entry {\code {setfilename}}{30}
\entry {\code {setshortcontentsaftertitlepage}}{38}
\entry {\code {settitle}}{31}
\entry {\code {shortcaption}}{106}
\entry {\code {shortcontents}}{37}
\entry {\code {shorttitlepage}}{34}
\entry {\code {simple_menu}}{207}
\entry {\code {slanted \r {(slanted font)}}}{86}
\entry {\code {smallbook}}{183}
\entry {\code {smalldisplay}}{92}
\entry {\code {smallexample}}{92}
\entry {\code {smallformat}}{92, 93}
\entry {\code {smallindentedblock}}{89}
\entry {\code {smalllisp}}{92}
\entry {\code {smallquotation}}{89, 92}
\entry {\code {sp \r {(line spacing)}}}{134}
\entry {\code {sp \r {(titlepage line spacing)}}}{34}
\entry {\code {ss}}{123}
\entry {\code {strong}}{85}
\entry {\code {structure}}{197}
\entry {\code {subheading}}{49}
\entry {\code {subsection}}{49}
\entry {\code {subsubheading}}{50}
\entry {\code {subsubsection}}{50}
\entry {\code {subtitle}}{35}
\entry {\code {summarycontents}}{37}
\entry {\code {syncodeindex}}{114}
\entry {\code {synindex}}{115}
\initial {T}
\entry {\code {t \r {(typewriter font)}}}{86}
\entry {\code {tab}}{103}
\entry {\code {table}}{100}
\entry {\code {tex}}{154}
\entry {\code {texinfo-all-menus-update}}{21}
\entry {\code {texinfo-every-node-update}}{21}
\entry {\code {texinfo-format-buffer}}{24, 212}
\entry {\code {texinfo-format-region}}{24, 212}
\entry {\code {texinfo-indent-menu-description}}{23}
\entry {\code {texinfo-insert-@code}}{17}
\entry {\code {texinfo-insert-@dfn}}{17}
\entry {\code {texinfo-insert-@end}}{17}
\entry {\code {texinfo-insert-@example}}{18}
\entry {\code {texinfo-insert-@item}}{17}
\entry {\code {texinfo-insert-@kbd}}{17}
\entry {\code {texinfo-insert-@node}}{17}
\entry {\code {texinfo-insert-@noindent}}{17}
\entry {\code {texinfo-insert-@samp}}{17}
\entry {\code {texinfo-insert-@table}}{17}
\entry {\code {texinfo-insert-@var}}{18}
\entry {\code {texinfo-insert-braces}}{18}
\entry {\code {texinfo-insert-node-lines}}{23}
\entry {\code {texinfo-make-menu}}{21}
\entry {\code {texinfo-master-menu}}{20}
\entry {\code {texinfo-multiple-files-update}}{172}
\entry {\code {texinfo-multiple-files-update \r {(in brief)}}}{23}
\entry {\code {texinfo-sequential-node-update}}{23}
\entry {\code {texinfo-show-structure}}{19, 274}
\entry {\code {texinfo-start-menu-description}}{18}
\entry {\code {texinfo-tex-buffer}}{25}
\entry {\code {texinfo-tex-print}}{25}
\entry {\code {texinfo-tex-region}}{25}
\entry {\code {texinfo-update-node}}{21}
\entry {\code {Texinfo::Parser module}}{187}
\entry {\code {texinfosxml}}{197}
\entry {\code {textcontent}}{197}
\entry {\code {textdegree}}{126}
\entry {\code {TeX}}{125}
\entry {\code {th}}{123}
\entry {\code {thischapter}}{269}
\entry {\code {thischaptername}}{269}
\entry {\code {thischapternum}}{269}
\entry {\code {thisfile}}{269}
\entry {\code {thispage}}{269}
\entry {\code {thissection}}{269}
\entry {\code {thissectionname}}{269}
\entry {\code {thissectionnum}}{269}
\entry {\code {thistitle}}{269}
\entry {\code {TH}}{123}
\entry {\code {tie \r {(unbreakable interword space)}}}{134}
\entry {\code {tieaccent}}{122}
\entry {\code {tindex}}{112}
\entry {\code {title}}{35}
\entry {\code {titlefont}}{34}
\entry {\code {titlepage}}{33}
\entry {\code {today}}{269}
\entry {\code {top}}{38, 57}
\initial {U}
\entry {\code {u \r {(breve accent)}}}{122}
\entry {\code {ubaraccent}}{122}
\entry {\code {udotaccent}}{122}
\entry {\code {unmacro}}{163}
\entry {\code {unnumbered}}{48}
\entry {\code {unnumberedsec}}{49}
\entry {\code {unnumberedsubsec}}{49}
\entry {\code {unnumberedsubsubsec}}{50}
\entry {\code {up-list}}{18}
\entry {\code {uref}}{74}
\entry {\code {urefbreakstyle}}{74}
\initial {V}
\entry {\code {v \r {(check accent)}}}{122}
\entry {\code {value}}{156}
\entry {\code {var}}{81}
\entry {\code {verb}}{80}
\entry {\code {verbatim}}{90}
\entry {\code {verbatiminclude}}{91}
\entry {\code {vindex}}{112}
\entry {\code {vskip \r {\TeX {} vertical skip}}}{36}
\entry {\code {vtable}}{102}
\initial {W}
\entry {\code {w \r {(prevent line break)}}}{134}
\initial {X}
\entry {\code {xml}}{154, 197}
\entry {\code {xref}}{67}
\entry {\code {xrefautomaticsectiontitle}}{69}

repo_name: mthl/texinfo

license: mit


code:
#!/bin/sh
# $Id$
# This file is public domain.

# check texindex --help and --version.  We'll just ensure that stdout is
# nonempty and exit status is zero, and not worry if the output is sensible.

# if we ever have more tests, we should move this to a common file,
# and ideally share with install-info/tests/defs.in, etc.
####
set -x
# Make sure we override the user shell.
SHELL='/bin/sh'; export SHELL

# unsetting an already-unset variable fails with BSD sh.
CDPATH=; unset CDPATH

# If srcdir is not set, then we are not running from `make check'; be verbose.
if test -z "$srcdir"; then
   VERBOSE=x
   # compute $srcdir.
   srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
   test $srcdir = $0 && srcdir=.
fi

texindex=./texindex
TEXINDEX_SCRIPT=$srcdir/texindex.awk; export TEXINDEX_SCRIPT
####

# The actual test follows.
out=`$texindex --version`
if test $? -ne 0 || test -z "$out"; then
  echo "$0: $texindex --version failed." >&2
  exit 1
fi

out=`$texindex --help`
if test $? -ne 0 || test -z "$out"; then
  echo "$0: $texindex --help failed." >&2
  exit 1
fi

exit 0


code:
#!/bin/sh
# $Id$
#
# Copyright 2015, 2016 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/>.
#
# Originally written by Karl Berry.
# Please send bug reports, etc. to bug-texinfo@gnu.org.
#
# Shell wrapper for the texindex.awk program.  This is the most
# convenient way to support --options; with a #! line, it is (g)awk
# itself that interprets the options.  We want texindex --version
# to report texindex's version number, not gawk's.
#
# So our job here is to (a) find the awk interpreter,
# and (b) find the texindex.awk script file.

mydir=`cd \`dirname $0\` && pwd`

#
# allow user override for awk program location.
awk_binary=
awk_envvar=$TEXINDEX_AWK
if test -n "$awk_envvar"; then
  if test -s "$awk_envvar"; then
    awk_binary=$awk_envvar
  else
    echo "$0: TEXINDEX_AWK environment variable set, but value" >&2
    echo "$0: is not a readable non-empty file; ignoring: $awk_envvar" >&2
  fi
fi
#
# else use configured value for awk.
if test -z "$awk_binary"; then
  awk_binary="@AWK@"
fi
#
# that should never be empty, but just in case, else fall back to plain
# "awk".  (Let's not go to the trouble of searching PATH unless we get
# reports of problems.)
test -z "$awk_binary" && awk_binary=awk

#
# finding the texindex.awk script file ...
ti_script=
#
# allow user override for script location:
ti_envvar=$TEXINDEX_SCRIPT
if test -n "$ti_envvar"; then
  if test -s "$ti_envvar"; then
    ti_script=$ti_envvar
  else
    echo "$0: TEXINDEX_SCRIPT environment variable set, but value" >&2
    echo "$0: is not a readable non-empty file; ignoring: $ti_script" >&2
  fi
fi
#
# else if script is in the same directory as us (development tree), use it:
test -z "$ti_script" && test -s "$mydir/texindex.awk" \
&& ti_script=$mydir/texindex.awk
#
# else look for script in pkgdatadir.
if test -z "$ti_script"; then
  pkgdatadir_configured="@pkgdatadir@"
  test -s "$pkgdatadir_configured/texindex.awk" \
  && ti_script=$pkgdatadir_configured/texindex.awk
fi
#
# look relative to $mydir, to allow the installed tree to be moved.
if test -z "$ti_script"; then
  relative_dir=$mydir/../share/texinfo
  test -d "$relative_dir" \
  && test -s "$relative_dir/texindex.awk" \
  && ti_script=$relative_dir/texindex.awk
fi
#
# didn't find it, abort.
if test -z "$ti_script"; then
  echo "$0: could not locate texindex.awk script file, quitting." >&2
  echo "$0: (checked envvar TEXINDEX_SCRIPT ($TEXINDEX_SCRIPT)," >&2
  echo "$0:  executable dir ($mydir)," >&2
  echo "$0:  share dir relative to binary ($relative_dir)," >&2
  echo "$0:  and configured pkgdatadir ($pkgdatadir_configured).)"  >&2
  exit 1
fi

# Suppose a symlink named a\tb (four chars) is made to this script, and
# "a\tb" --help
# is invoked.  We want the output to report the program name as the
# four chars a, \, t, b, not a, tab, b.
#
# But we pass the value using (g)awk -v, and (g)awk processes arguments
# to -v for escape sequences, so that by the time the rest of the script
# sees it, it has a tab in it.
#
# Conclusion: we must double any backslashes before invoking gawk,
# by running the command: sed 's,\\,\\\\,g'
#
# Sadly, since we have to do this in a shell, we need twice
# as many backslash characters in the input.  Hope it's portable across
# shells and seds.
#
escaped0=`echo "$0" | sed 's,\\\\,\\\\\\\\,g'`
exec $awk_binary -v Invocation_name="$escaped0" -f "$ti_script" -- "$@"


code:
\input texinfo   @c -*-texinfo-*-
@c vim: filetype=texinfo tabstop=2 expandtab
@c $Id$
@c %**start of header (This is for running Texinfo on a region.)
@setfilename texindex.info
@settitle Texindex @VERSION@: A program for sorting indices
@c %**end of header (This is for running Texinfo on a region.)

@c Better brace handling, this texindex is needed to process!
@allowindexbraces

@c Merge the function and variable indexes into the concept index,
@c but without the code font; in the index entries we'll do the
@c font management ourselves.  Also merge in the chunk definition
@c and reference entries, which jrweave creates for us.
@c (Ordinarily this would be in the header, but jrweave puts the
@c defindexes later.)
@synindex fn cp
@synindex vr cp
@synindex cd cp
@synindex cr cp

@copying
This @command{texindex} program (version @VERSION@, @UPDATED@) sorts the
raw index files created by @file{texinfo.tex}.  (This Texinfo source is
a literate program written using TexiWeb@tie{}Jr., not a user manual.)

Copyright @copyright{} 2014, 2015, 2016, 2017 Free Software Foundation,
Inc.

@quotation
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 @url{http://www.gnu.org/licenses/}.
@end quotation
@end copying

@titlepage
@title Texindex
@subtitle version @VERSION@, @UPDATED@
@author Arnold D. Robbins
@author and Texinfo maintainers
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents

@ifnottex
@node Top
@top Texindex

This file defines @command{texindex} (version @VERSION@,
@UPDATED@), an @code{awk} program that processes the raw index
files produced by the @file{texinfo.tex} file.

@end ifnottex

@menu
* Preface::                     Introductory remarks.
* Requirements::                How the program needs to work.
* High-level organization::     The overall outline.
* Processing records::          Processing each record.
* Necessary stuff::             Copyright, helper functions, i18n.
* Index::                       Combined index.
@end menu

@node Preface
@unnumbered Preface

This file defines @file{texindex.awk}, a reimplementation of the C
program @file{texindex.c}.  The purpose is to make the program more
maintainable.  As a practical benefit, it also supports correct sorting
and initials for the @samp{@{} and @samp{@}} characters in an index.
@cindex @{ (left brace), example index entry for
@cindex @} (right brace), example index entry for

@cindex TexiWeb Jr.@: literate programming system
@cindex Texinfo document formatting language
This is a @dfn{literate program}, written using the
@uref{https://github.com/arnoldrobbins/texiwebjr, @sc{TexiWeb Jr.@:}
literate programming system}.  The underlying documentation system is
@uref{http://www.gnu.org/software/texinfo, Texinfo} the GNU
documentation formatting language.  A single source file produces the
runnable program, a printable document, and an online document.

@menu
* Intended audience::
@end menu

@node Intended audience
@section Intended audience

You should read this if you want to understand how @file{texindex.awk}
works.  You should be familiar with the @command{awk} programming
language.

If you are interested in array indexing, you've come to
the wrong place.  @xref{knuth}.

@c Scale figure to 4.5 inches which is good for both smallbook
@c and regular.  TeX will scale height also automatically.
@float Figure,knuth
@caption{Indexing (@url{http://xkcd.com/163/})}
@center @image{dek_idx, 5in, , Indexing}
@end float

@node Requirements
@chapter Requirements

The input to this program is the list of unsorted index entries produced
by @file{texinfo.tex} when a Texinfo document is processed.  For
example, two lines resulting from the @command{gawk} manual might look
like this:

@example
\entry@{POSIX awk@}@{5@}@{POSIX \command @{awk@}@}
@dots{}
\entry@{POSIX awk@}@{106@}@{POSIX \command @{awk@}@}
@end example

As shown, there are three ``fields'' enclosed in braces:

@itemize @bullet
@item
The sort key.  This is the text of the entry with all markup removed.
It should contain only ASCII characters.

@item
The page number for this entry.

@item
The display text to be shown in the printed index, which can include markup.
@end itemize

The braces are balanced in all cases, although for use by this program,
literal braces (not necessarily balanced) can be included in the sort
key by escaping them with the @dfn{command character}.  This is the
first character on the line.  It is either the backslash used by @TeX{}
(@samp{\}) or the at sign used by Texinfo (@samp{@@}).

@cindex backslash vs.@: at
@cindex command character, @samp{\} vs.@: @samp{@@}
Historically, @file{texinfo.tex} has used @samp{\} as the command
character in index files.  This causes complications with index entries
containing backslashes and braces; C @command{texindex} has never output
the correct initial (a left brace) for an index entry like
@samp{@@cindex @@@{@}}, or done technically-correct sorting with such
entries.  @xref{Details of @t{texindex},,, texinfo, GNU Texinfo}.

The present @code{awk} implementation handles these cases better.  It
also supports @samp{@@} as the command character, which allows
@file{texinfo.tex} to output cleaner raw index files.  (For
compatibility, for now this is only done if a ``secret'' @TeX{} variable
is set: @code{\global\usebracesinindexestrue}.)  The first character of
the raw input file is taken as the command character.

@subheading Processing

The job is to sort the entries, and merge those which are identical
except for the page numbers.  Thus, for the above two entries, the
output should be:

@example
\entry @{POSIX \command @{awk@}@}@{5, 106@}
@end example

The sorting should be in the order of: all symbols first, then all
digits, then all letters, with uppercase letters following lowercase
ones, so we will need some smarts.

Input lines might be duplicated (same entry, same page, more than once),
so we will have to deal with that.

In addition, @command{texindex} must output special lines indicating the
first character (the @dfn{initial}) of keys grouped together, but only
if there is more than one initial used throughout the input file.  This
output looks like:

@example
\initial @{A@}
@end example

@subheading Assumptions

In the rest of the program we make two fundamental assumptions:

@enumerate 1
@item
If a given sort key has more than one display text, we only take the
first (this matches the behavior of C @command{texindex}).  Put another
way, if the same sort key has two different display texts, it means that
different markup was used, probably inadvertently, and we just take the
first.  As an example, consider these two Texinfo commands:

@example
@@cindex @@file@{field_split()@} function
@dots{}
@@cindex @@code@{field_split()@} function
@end example

@noindent
They produce the following output via @file{texinfo.tex},
which in turn is the input to @command{texindex}:

@example
\entry@{field_split() function@}@{2@}@{\file @{field_split()@} function@}
\entry@{field_split() function@}@{7@}@{\code @{field_split()@} function@}
@end example

@noindent The result will be a single entry, using @code{\file},
accumulating the page numbers.

@example
\entry @{\file @{field_split()@} function@}@{2, 7@}
@end example

@item
@cindex roman numerals
For the same sort key and text, page numbers will be monotonically
increasing.  This means we can just use a new page number when it comes
in, and not have to sort entries based on both sort key and page number.
(Which, in turn, means that we don't need to worry about page numbers
that are roman numerals.)

@end enumerate

An additional requirement, for ease of deployment, is that the program
be written in portable @command{awk}, and not use features found only in
GNU @command{awk} (@command{gawk}).  For our purposes, ``portable''
means ``new'' @command{awk} as defined in the 1988 book by Aho,
Weinberger and Kernighan.  This gives us functions, multidimensional
arrays and a number of other important features over the original
@command{awk} shipped with V7 Unix.

@node High-level organization
@chapter High-level organization

The general outline is as follows:

@file_update_recipe
@end file_update_recipe
@file_update texindex.awk . ""

@(texindex.awk@) =
@<First line@>
@<GPL v3 copyright statement@>
@<Library functions@>
@<Helper functions@>

BEGIN {
  @<Initial setup@>
  @<Argument processing@>
}

@<@code{beginfile()} function@>
@<@code{endfile()} function@>
@<Process a record@>
@<Work functions@>
@

@menu
* First line::
* Initial setup::
* Argument processing::
@end menu

@node First line
@section First line

@cindex first line
@cindex @code{#!} header
@cindex header, shebang

For the first line of the generated output, we hardwire our intended
output file name and how it got made.  We do not use a @samp{#!} header
because, being a GNU program, we need to accept the @option{--help} and
@option{--version} options.  This cannot be done with a standalone
@code{awk} script; we need a shell wrapper, and hence, the @code{awk}
script itself need not be executable, and it's simpler not to worry
about the location of the @code{awk} program.

@<First line@> =
# texindex.awk, generated by jrtangle from ti.twjr.
@

@node Initial setup
@section Initial setup

@cindex initial setup

The initial setup sets up some constants, including the version of the
program.  In the program itself, we follow a convenient convention:
global variable and array names start with a capital letter.

@cindex @code{Invocation_name} variable
Per GNU standards, we sometimes hardwire the string @samp{texindex} as
the name of the program, and sometimes use the name by which the program
was invoked.  We'll call the latter @code{Invocation_name}; it's
supposed to be passed in from the shell wrapper.

@cindex @code{Can_split_null} variable
The last line below sets up @code{Can_split_null}, which tells us if the
built-in @code{split()} function will split apart a string into its
individual characters or if we have to do it manually.

@cindex @code{TRUE} constant
@cindex @code{FALSE} constant
@cindex @code{EXIT_SUCCESS} constant
@cindex @code{EXIT_FAILURE} constant
@cindex @code{Texindex_version} variable
@cindex @code{check_split_null()} function
@<Initial setup@>=
TRUE = 1
FALSE = 0
EXIT_SUCCESS = 0
EXIT_FAILURE = 1

Texindex_version = "@VERSION@"
if (! Invocation_name) {
  # provide fallback in case it's not passed in.
  Invocation_name = "texindex"
}

Can_split_null = check_split_null()
@

@node Argument processing
@section Argument processing

@cindex argument processing

@cindex @code{usage()} function
@cindex @code{version()} function
Argument processing is straightforward, though manual.  The important
thing is to remove options and their arguments from @code{ARGV} so that
they're not treated as filenames.  The options that print version or
help information automatically exit, so there's no need to mess with
@code{ARGV} in those cases.

@cindex @code{-o} (@code{--output}) option, unimplemented
The C implementation of @command{texindex} provided an option @code{-o}
(@code{--output}) @var{file} to write the output to @var{file}.  We've
chosen to omit it from this incarnation of the program unless and until
we receive information that it was ever useful.

@cindex @code{-h} (@code{--help}) option
@cindex @code{-k} (@code{--keep}), no-op option
@cindex @code{--} option
@cindex @code{--version} option
@<Argument processing@>=
for (i = 1; i < ARGC; i++) {
  if (ARGV[i] == "-h" || ARGV[i] == "--help") {
    usage(EXIT_SUCCESS)
  } else if (ARGV[i] == "--version") {
    version()
  } else if (ARGV[i] == "-k" || ARGV[i] == "--keep") {
    # do nothing, backwards compatibility
    delete ARGV[i]
  } else if (ARGV[i] == "--") {
    delete ARGV[i]
    break
  } else if (ARGV[i] ~ /^--?.+/) {
    fatal(_"%s: unrecognized option `%s'\n" \
          "Try `%s --help' for more information.\n",
          Invocation_name, ARGV[i], Invocation_name)
    exit EXIT_FAILURE
  } else {
    break
  }
}
@

@node Processing records
@chapter Processing records

Processing records includes setting things up for each input file,
pulling apart each record, sorting the data at the end, and writing out
the data properly.

@menu
* Setup for each input file::   What happens at the start of each file.
* Processing each record::
* End-of-file sorting and printing::
@end menu

@node Setup for each input file
@section Setup for each input file

At the beginning of each input file, the @code{beginfile()} function
clears our variables from any previous processing (@code{Data},
@code{Keys}, etc.)@: and sets up the output file name.  We always append
an @samp{s} to the name of the input file, which has become the standard
convention.  (As mentioned above, the @option{-o} option in the C
implementation of @command{texindex} has been omitted here, until the
need is seen.)

When @code{beginfile()} is called, the first record has already been
read, so it's possible to perform the checks for a Texinfo index file:
The first character must be either @samp{\} or @samp{@@}
(@pxref{Requirements}), and the next five characters must be the word
@samp{entry}.

@cindex @code{Special_chars} variable
@code{Special_chars} are the two characters that must be preceded by
the command character inside the first key.

@cindex @code{beginfile()} function
@cindex @code{Output_file} variable
@cindex @code{Data} array
@cindex @code{Keys} array
@cindex @code{Seen} array
@cindex @code{Entries} variable
@cindex @code{Do_initials} variable
@cindex @code{Prev_initial} variable
@cindex @code{del_array()} function
@cindex @code{Command_char} variable
@cindex @code{Special_chars} variable
@<@code{beginfile()} function@>=
function beginfile(filename)
{
  Output_file = filename "s"

  # Reinitialize these for each input file
  del_array(Data)
  del_array(Keys)
  del_array(Seen)
  Entries = 0
  Do_initials = FALSE
  Prev_initial = ""

  Command_char = substr($0, 1, 1)
  if (   (Command_char != "\\" && Command_char != "@") \
      || substr($0, 2, 5) != "entry")
    fatal(_"%s is not a Texinfo index file\n", filename)

  Special_chars = "{}"
}
@

@node Processing each record
@section Processing each record

Record processing consists of building the data structures for use in
sorting and printing once the whole file has been processed.

@<Process a record@> =
{
  @<Remove duplicates@>
  @<Remove leading @code{\entry}@>
  @<Get the initial@>
  @<Set up @code{fields} array with the data@>
  @<Name the fields@>
  @<Store the data for this line in the @code{Data} array@>
  @<Check for more than one initial@>
}
@

@menu
* Remove duplicates::
* Remove leading @code{\entry}::
* Get the initial::
* Set up and name fields::
* Store the data for this line::
* Check for more than one initial::
* Splitting the record::
@end menu

@node Remove duplicates
@subsection Remove duplicates

@cindex removing duplicates
@cindex duplicates, removing

@cindex @code{Seen} array
Duplicates are going to be exact.  Removing them is thus easy; store
each incoming line as the index of an array named @code{Seen}.  If a
line is not there, it has not been seen.  Otherwise it has, and we move
on to the next record.

@<Remove duplicates@>=
# Remove duplicates, which can happen
if ($0 in Seen)
  next
Seen[$0] = TRUE
@

@node Remove leading @code{\entry}
@subsection Remove leading @code{\entry}

We use @code{substr()} here to avoid possible hassles with leading
backslashes in @code{sub()}.

@<Remove leading @code{\entry}@>=
$0 = substr($0, 7)  # remove leading \entry
@

@node Get the initial
@subsection Get the initial

@cindex @code{extract_initial()} function
@<Get the initial@>=
initial = extract_initial($0)
@

The key argument here is the rest of the line after @samp{\entry},
starting with an open brace.

The very first field character of the sort key can be an open brace.
If so, we extract the component of the sort key surrounded by balanced
braces.  We don't account for \@{ or \@} inside this component, as
@file{texinfo.tex} isn't expected to produce such output.

An example can be seen in what older versions of @file{texinfo.tex}
generated if you needed to index a real backslash, namely an input line
something like the following:

@example
\entry@{@{\tt \indexbackslash @} (backslash)@}@{14@}@{\code @{@{\tt @dots{}
@end example

Earlier versions of @command{texindex} took the the first non-brace
character as the initial, in this example @samp{\}, and output it as
@samp{\\}; this was not, however, a control sequence recognized by the
older versions of @file{texinfo.tex}.

@cindex @code{extract_initial()} function
@cindex @code{char_split()} function
@<Work functions@>=
function extract_initial(key,  initial, nextchar, i, l, kchars)
{
  l = char_split(key, kchars)
  if (l >= 3 && kchars[2] == "{") {
    bracecount = 1
    i = 3
    while (bracecount > 0 && i <= l) {
      if (kchars[i] == "{")
        bracecount++
      else if (kchars[i] == "}")
        bracecount--
      i++
    }
    if (i > l)
      fatal(_"%s:%d: Bad key %s in record\n", FILENAME, FNR, key)
    initial = substr(key, 2, i - 2)
  } else if (kchars[2] == Command_char) {
    nextchar = kchars[3]
    if (initial == Command_char && (nextchar == "{" || nextchar == "}"))
      initial = substr(key, 2, 3)
    else {
      initial = toupper(nextchar)
    }
  } else {
    initial = toupper(kchars[2])
  }

  return initial
}
@

@node Set up and name fields
@subsection Set up and name fields

The next part is to pull out the data of interest from the three sets of
braces.  This is delegated to a function named @code{field_split()}.
There must be exactly three fields.

@cindex @code{field_split()} function
@cindex @code{fields} array, setting up
@<Set up @code{fields} array with the data@>=
numfields = field_split($0, fields, "{", "}", Command_char)
if (numfields != 3)
  fatal(_"%s:%d: Bad entry; expected three fields, not %d\n",
        FILENAME, FNR, numfields)
@

We give the fields names for later use.

@<Name the fields@>=
key = fields[1]
pagenum = fields[2]
text = fields[3]
@

@node Store the data for this line
@subsection Store the data for this line

@cindex storing data

@cindex @code{Data} array
We use a traditional @command{awk} multidimensional array, @code{Data}.
The sort key from the input is invariant across entries, so we use that
as the basis for the keys in the @code{Data} array.
The @code{Data} values are the the output @code{"text"}, the
@code{"pagenum"} list, and the @code{"initial"}.

In the event that a particular key has more than one associated output
text, we'll keep the first and ignore the remainder (this is the same
behavior as the C implementation).  @xref{Requirements}.

For page numbers, we merely append the page number field from the input,
preceded by a comma and space, unless that page number was already the
last that's been stored.  (We're assuming the page numbers don't jump
around, which, in fact, they don't, so we don't need a more complex
approach.)

@cindex @code{Keys} array
@cindex @code{Entries} variable
In addition to all this updating of the @code{Data} array, the key is
stored in the @code{Keys} array the first time it is seen; this array
is sorted later on.  For now, its indices are just incremented integers,
stored in the global @code{Entries} variable.

@<Store the data for this line in the @code{Data} array@>=
if (! ((key, "text") in Data)) {
  # first time we've seen this full line
  Keys[++Entries] = key
  Data[key, "text"] = text
  Data[key, "pagenum"] = pagenum
  Data[key, "initial"] = initial
} else
  # seen this key before; add the current pagenum
  # unless we've already seen that too.
  if (   Data[key, "pagenum"] != pagenum \
      && Data[key, "pagenum"] !~ (", " pagenum "$")) {
    Data[key, "pagenum"] = Data[key, "pagenum"] ", " pagenum
  }
@

@node Check for more than one initial
@subsection Check for more than one initial

@cindex initial, checking for more than one

Finally, we need to determine if more than one initial occurs in the
input.  If so, we set @code{Do_initials} to true.  As soon as it's true,
we don't need to do further checking on subsequent lines.

@cindex @code{Do_initials} variable
@cindex @code{Prev_initial} variable
@<Check for more than one initial@> =
if (! Do_initials) {
  if (Prev_initial == "")
    Prev_initial = initial
  else if (initial != Prev_initial)
    Do_initials = TRUE
}
@

@node Splitting the record
@subsection Splitting the record: @code{field_split}

Let's take a look at the function that breaks apart the record.  Upon
entry to the function, the value of @code{record} looks something like:

@example
@{POSIX awk@}@{5@}@{POSIX \command @{awk@}@}
@end example

The first field may have instances of @samp{@@@{} and/or @samp{@@@}} (or
@samp{\@{} and/or @samp{\@}}), so the braces aren't necessarily exactly
balanced.

The @code{field_split()} function uses fairly straightforward ``count
the delimiters'' code.  The loop starts at 2, since we know the first
character is an open brace.  The main things to handle are the command
character and the final closing brace.  The third field is taken as a
whole; this is described shortly.

@cindex @code{field_split()} function
@cindex @code{char_split()} function
@<Work functions@>=
function field_split( \
  record, fields, start, end, com_ch,      # parameters
  chars, numchars, out, delim_count, i, j, k) # locals
{
  del_array(fields)

  numchars = char_split(record, chars)
  j = 1  # index into fields
  k = 1  # index into out
  delim_count = 1
  for (i = 2; i <= numchars; i++) {
    if (chars[i] == com_ch) {
      @<Handle the character after the command character@>
    } else if (chars[i] == start) {
      delim_count++
      out[k++] = chars[i]
    } else if (chars[i] == end) {
      delim_count--

      if (delim_count == 0) {
        @<Finish off the field, set up for next field@>
      } else
        out[k++] = chars[i]
    } else
      out[k++] = chars[i]

    @<Take the third field as a whole@>
  }

  return j  # num fields
}
@

If the character following the command character is an open brace, close
brace, or the command character itself, we pull it in.  Otherwise, the
command character is left alone as part of the field.

@<Handle the character after the command character@>=
if (index(Special_chars, chars[i+1]) != 0) {
  out[k++] = chars[i+1]
  i++
} else
  out[k++] = chars[i]
@

Upon seeing the final closing brace, we put all the characters back
together into a string using @code{join()}.  We then reset the
@code{out} array for the next time through.  If the next character isn't
an open brace, then the line is bad and we print a fatal error.
Otherwise, we reset @code{delim_count} to one.

@cindex @code{join()} function
@<Finish off the field, set up for next field@>=
fields[j++] = join(out, 1, k-1, SUBSEP)
del_array(out)  # reset for next time through
k = 1

i++
if (i <= numchars && chars[i] != start)
  fatal(_"%s:%d: Bad entry; expected %s at column %d\n",
        FILENAME, FNR, start, i)
delim_count = 1
@

The third field is the printable version, and may have unbalanced braces
or other oddities.  We just take the whole thing as is.  This is done by
stripping off the outermost braces, using @code{substr()}.  We then
break out of the loop, since we're done.

@<Take the third field as a whole@>=
if (j == 3) {  # Per Karl, just grab the whole rest of the line
  # extract everything between the outer delimiters
  fields[3] = substr(record, i + 1, numchars - i - 1)
  break
}
@

@node End-of-file sorting and printing
@section End-of-file sorting and printing

Upon end of input, the processing is straightforward: sort the entries
and write them out.  Additionally, if we are printing the initial,
handle that.  (That printing task is delegated to a small function.)

@cindex @code{endfile()} function
@cindex @code{quicksort()} function
@cindex @code{Entries} variable
@cindex @code{Keys} array
@cindex @code{Data} array
@cindex @code{print_initial()} function
@cindex @code{Output_file} variable
@<@code{endfile()} function@>=
function endfile(filename,    i, prev_initial, initial)
{
  # sort the entries
  quicksort(Keys, 1, Entries)

  for (i = 1; i <= Entries; i++) {
    # deal with initial
    initial = Data[Keys[i], "initial"]
    if (initial != prev_initial) {
      prev_initial = initial
      print_initial(initial)
    }

    # write the actual line \entry {...}{...}
    printf("%centry {%s}{%s}\n",
      Command_char,
      Data[Keys[i], "text"],
      Data[Keys[i], "pagenum"]) > Output_file
  }
  close(Output_file)
}
@

Printing the initial is not complicated.  The main thing is to precede
special characters with the command character.

@cindex @code{Command_char} variable
@cindex @code{Special_chars} variable
@cindex @code{Do_initials} variable
@cindex @code{print_initial()} function
@<Work functions@>=
function print_initial(initial)
{
  if (Do_initials) {
    if (index(Special_chars, initial) != 0)
      initial = Command_char initial
    printf("%cinitial {%s}\n",
      Command_char, initial) > Output_file
  }
}
@

@menu
* Quicksort::                   Sorting our input.
* Comparing index entries::     The heart of the sorting algorithm.
@end menu

@node Quicksort
@subsection Quicksort

@cindex quicksort
@cindex Hoare, C.A.R.

Sorting uses a standard quicksort algorithm, with a @code{less_than()}
function (defined in the next function) supplying the comparison.

@cindex @code{less_than()} function
@cindex @code{quicksort()} function
@cindex @code{quicksort_swap()} function
@<Helper functions@>=
# quicksort --- C.A.R. Hoare's quick sort algorithm.  See Wikipedia
#               or almost any algorithms or computer science text
# Adapted from K&R-II, page 110
#
function quicksort(data, left, right,    i, last)
{
    if (left >= right)  # do nothing if array contains fewer
        return          # than two elements

    quicksort_swap(data, left, int((left + right) / 2))
    last = left
    for (i = left + 1; i <= right; i++)
        if (less_than(data[i], data[left]))
            quicksort_swap(data, ++last, i)
    quicksort_swap(data, left, last)
    quicksort(data, left, last - 1)
    quicksort(data, last + 1, right)
}

# quicksort_swap --- quicksort helper function, could be inline
#
function quicksort_swap(data, i, j, temp)
{
    temp = data[i]
    data[i] = data[j]
    data[j] = temp
}
@

@node Comparing index entries
@subsection Comparing index entries

The comparison function is the heart of the sorting algorithm.  The
comparison is based on the indexing rules, which are:

@itemize @bullet
@item
All symbols first.

@item
Followed by digits.

@item
Followed by letters.  Lowercase precedes uppercase and both ``a'' and
``A'' precede anything starting with ``b'' or ``B'' (etc.).
@end itemize

Implementing these rules is a little complicated.  The first thing we
need is a table that maps characters to comparison values.  The
following code is based on the original C @command{texindex}, although
the actual comparison algorithm is more sophisticated.

We set up an @code{Ordval} array to map characters to numeric values.
Most characters map to their ASCII code.  We add 512 to the value of
each of the digits.  Both uppercase and lowercase letters map to the
same numeric value, which is the ASCII code for the uppercase letter
plus 512. (This code should also work for EBCDIC systems,
although @TeX{} does everything in ASCII, so it's not likely to make a
difference.)

The table must be built completely before changing the mapping of the
letters, because all of the uppercase and lowercase letters must be in
the table before we can change their values.

@cindex @code{Ordval} array
@<Work functions@>=
BEGIN {
  for (i = 0; i < 256; i++) {
    c = sprintf("%c", i)
    Ordval[c] = i  # map character to value

    if ((n = isdigit(c)) > 0) {
      Ordval[c] += 512
    }
  }

  # Give both 'A' and 'a' the same code
  i = Ordval["A"]
  j = Ordval["Z"]
  for (; i <= j; i++) {
    c = sprintf("%c", i)

    # In ASCII, 'A' is before 'a', so this is
    # the right order to check
    #
    # Checking isupper() lets this work for EBCDIC, too.
    if (isupper(c)) {
      Ordval[c] += 512
      Ordval[tolower(c)] = Ordval[c]
    }
  }
}
@

Here is the @code{less_than()} function.  It returns true if the
@code{left} string is ``less than'' the @code{right} string.

The comparison algorithm is not too complicated, once we define how
things should work.  We loop over each pair of characters in the
@code{left} and @code{right} strings, comparing them one at a time.
When comparing two characters, there are three cases, one of which has
three subcases, as follows:

@table @i
@item Two letters

@c nested table
@table @i
@item Same letter, but different case
This is the complicated case.  First, we want lowercase letters to be
ordered before uppercase ones, even though this is the opposite of the
natural ASCII ordering.  To make this happen, we use a @samp{>}
comparison instead of a @samp{<} comparison.

Second, when two characters are equal, we have to look ahead at the next
characters to decide whether to continue the loop or quit.  As long as
we are not at the end of the string, and at least one of the following
characters in either string is a letter, we continue the loop.
Otherwise we do the character comparison and return.

@item Two different letters, but same case
@itemx Two different letters, different case
Use the comparison of the respective @code{Ordval} values.
@end table
@c end nested table

@item A letter and something else
@itemx Two nonletters
Use the comparison of the respective @code{Ordval} values.

@end table

@noindent When the values are equal, continue around the loop.  And, as
usual, if one string is an initial substring of the other, that one is
considered to be ``less than'' the other one.

The rules just described produce @emph{better} results than did the C
@command{texindex}.  For example, @samp{beginfile()} sorts
before @samp{BEGINFILE}, whereas with the C version they came out in the
opposite order.

@cindex @code{Ordval} array
@cindex @code{char_split()} function
@cindex @code{less_than()} function
@cindex @code{isalpha()} function
@<Work functions@>=
function less_than(left, right,    len_l, len_r, len, chars_l, chars_r)
{
  len_l = length(left)
  len_r = length(right)
  len = (len_l < len_r ? len_l : len_r)

  char_split(left, chars_l)
  char_split(right, chars_r)

  for (i = 1; i <= len; i++) {
    if (isalpha(chars_l[i]) && isalpha(chars_r[i])) {
      # same char different case
      # upper case comes out last
      if (chars_l[i] != chars_r[i] &&
        tolower(chars_l[i]) == tolower(chars_r[i])) {
          if (   i != len \
            && (isalpha(chars_l[i+1]) \
              || isalpha(chars_r[i+1])))
            continue
          if (chars_l[i] > chars_r[i])
            return 1
          return 0
      }
      # same case, different char,
      # or different case, different char:
      # letter order wins
      if (Ordval[chars_l[i]] < Ordval[chars_r[i]])
        return 1

      if (Ordval[chars_l[i]] > Ordval[chars_r[i]])
        return 0

      # equal, keep going
      continue
    }

    # letter and something else, or two non-letters
    # letter order wins
    if (Ordval[chars_l[i]] < Ordval[chars_r[i]])
      return 1

    if (Ordval[chars_l[i]] > Ordval[chars_r[i]])
      return 0

    # equal, keep going
  }

  # equal so far, shorter one wins
  if (len_l < len_r)
    return 1

  return 0
}
@

@node Necessary stuff
@chapter Necessary stuff that isn't thrilling

This chapter provides some necessary but unexciting elements.

@menu
* Copyright statement:: Copyright info.
* Library functions::   From the @code{gawk} library: @file{ftrans.awk}, @code{join}.
* Helper functions::    @code{del_array}, @code{check_split}, @code{fatal}, @dots{}
* I18N::                Internationalization.
@end menu

@node Copyright statement
@section Copyright statement

@cindex copyright statement
@cindex GNU General Public License
@cindex License, GNU General Public
@cindex GPL (GNU General Public License)
Every program needs a copyright statement.

@<GPL v3 copyright statement@>=
#
# Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
#
# This file is part of GNU Texinfo.
#
# Texinfo 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.
#
# Texinfo 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/>.
@

@node Library functions
@section Library functions: @file{ftrans.awk}, @code{join}

The program uses several library routines discussed in detail
in the @command{gawk} documentation.  The first sets up the
infrastructure for the @code{beginfile()} and @code{endfile()} functions.
@xref{Filetrans Function,,, gawk, GNU Awk User's Guide},
for an explanation of how this function works.

@cindex @file{ftrans.awk} library file
@<Library functions@>=
# ftrans.awk --- handle data file transitions
#
# user supplies beginfile() and endfile() functions
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# November 1992

FNR == 1 {
  if (_filename_ != "")
    endfile(_filename_)
  _filename_ = FILENAME
  beginfile(FILENAME)
}

END  { endfile(_filename_) }
@

The next function is @code{join()}, which joins an array of characters
back into a string.  @xref{Join Function,,, gawk, GNU Awk User's Guide},
for an explanation of how this function works.

@cindex @file{join.awk} library file
@cindex @code{join()} function
@<Library functions@>=
# join.awk --- join an array into a string
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# May 1993

function join(array, start, end, sep,    result, i)
{
  if (sep == "")
    sep = " "
  else if (sep == SUBSEP) # magic value
    sep = ""
  result = array[start]
  for (i = start + 1; i <= end; i++)
    result = result sep array[i]
  return result
}
@

@node Helper functions
@section Helper functions

These helper functions make the main code easier to follow.

@menu
* @code{del_array}::
* @code{check_split_null}::
* @code{char_split}::
* @code{fatal}::
* @code{is@dots{}} functions::
@end menu

@node @code{del_array}
@subsection @code{del_array}

@code{del_array()} clears out an array.

@cindex @code{del_array()} function
@<Helper functions@>=
function del_array(a)
{
  # Portable and faster than
  #   for (i in a)
  #     delete a[i]
  split("", a)
}
@

@node @code{check_split_null}
@subsection @code{check_split_null}

@code{check_split_null()} determines whether the @command{awk} running
this program supports using the null string for the separator, splitting
each character off into a separate element.  If so, the return value
will be the number of elements in the array, and it will be more than
one.  It is called at program startup.

@cindex @code{check_split_null()} function
@<Helper functions@>=
function check_split_null(    n, a)
{
  n = split("abcde", a, "")
  return (n == 5)
}
@

@node @code{char_split}
@subsection @code{char_split}

@code{char_split()} splits a string into separate characters, letting
@command{awk} do the work if possible.  If not, each character is
extracted manually using a loop and @code{substr()}.

@cindex @code{char_split()} function
@cindex @code{Can_split_null} variable
@cindex @code{del_array()} function
@<Helper functions@>=
function char_split(string, array,    n, i)
{
  if (Can_split_null)
    return split(string, array, "")

  # do it the hard way
  del_array(array)
  n = length(string)
  for (i = 1; i <= n; i++)
    array[i] = substr(string, i, 1)

  return n
}
@

@node @code{fatal}
@subsection @code{fatal}

@cindex stderr
The @code{fatal()} function prints a @code{printf}-formatted message to
standard error and then exits badly.

@cindex @code{fatal()} function
@<Helper functions@>=
function fatal(format, arg1, arg2, arg3, arg4, arg5,
            arg6, arg7, arg8, arg9, arg10)
{
  printf(format, arg1, arg2, arg3, arg4, arg5,
      arg6, arg7, arg8, arg9, arg10) > "/dev/stderr"
  exit EXIT_FAILURE
}
@

@node @code{is@dots{}} functions
@subsection @code{is@dots{}} functions

@cindex @code{isupper()} function
@cindex @code{islower()} function
@cindex @code{isalpha()} function
@cindex @code{isdigit()} function
The following functions help identify what a character is; they are
similar in nature to the various macros in the C @code{<ctype.h>} header
file.  Since each one returns a count, the return value could be used to
compute which character from the set was seen; this turned out not to be
necessary in this program but might be useful in some other context.

@<Helper functions@>=
function isupper(c)
{
  return index("ABCDEFGHIJKLMNOPQRSTUVWXYZ", c)
}

function islower(c)
{
  return index("abcdefghijklmnopqrstuvwxyz", c)
}

function isalpha(c)
{
  return islower(c) || isupper(c)
}

function isdigit(c)
{
  return index("0123456789", c)
}
@

@node I18N
@section Internationalization

For @command{gawk}, we can arrange for the various messages, e.g., in
the @code{usage()} and @code{version()} functions, to be translated.  We
do this by setting the text domain at startup.  For more information on
internationalization in @command{gawk},
@pxref{Internationalization.html,,, gawk, GNU Awk User's Guide}.

@<Initial setup@>=
TEXTDOMAIN = "texinfo"
@

@noindent On non-GNU versions of @command{awk}, this is a harmless
assignment, and the @code{_"..."} construct below is a harmless
concatenation of an unassigned variable @code{_}, i.e., the empty
string.

The @code{usage()} and @code{version()} functions print the necessary
information and then exit.  The strings that can and should be
translated are prefixed with an underscore.

@cindex @code{Texindex_version} variable
@cindex @code{usage()} function
@cindex @code{version()} function
@tex
% avoid useless warnings/overfull boxes in these long strings
\global\hfuzz=\maxdimen
@end tex

@<Helper functions@>=
function usage(exit_val)
{
  printf(_"Usage: %s [OPTION]... FILE...\n", Invocation_name)
  print _"Generate a sorted index for each TeX output FILE."
  print _"Usually FILE... is specified as `foo.??' for a document `foo.texi'."
  print ""
  print _"Options:"
  print _" -h, --help   display this help and exit"
  print _" --version    display version information and exit"
  print _" --           end option processing"
  print ""
  print _"Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
Texinfo home page: http://www.gnu.org/software/texinfo/";

  exit exit_val
}

function version()
{
  print "texindex (GNU texinfo)", Texindex_version
  print ""
  printf _"Copyright (C) %s Free Software Foundation, Inc.\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n", "2017";

  exit EXIT_SUCCESS
}
@

@node Index
@unnumbered Index

@printindex cp

@bye


code:
# DebugTexinfo::DebugTree.pm: debug a Texinfo::Parser tree.
#
# Copyright 2011, 2012, 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 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 <pertusus@free.fr>

# Example of calls
# with creation of elements corresponding to sections:
# ./texi2any.pl --set TEXINFO_OUTPUT_FORMAT=debugtree --set USE_NODES=0 file.texi
# with creation of elements corresponding to nodes:
# ./texi2any.pl --set TEXINFO_OUTPUT_FORMAT=debugtree --set USE_NODES=1 file.texi
# no elements
# ./texi2any.pl --set TEXINFO_OUTPUT_FORMAT=debugtree file.texi
#
# Some unofficial info about the --debug command line option ... with
# --debug=1, the tree is not printed,
# --debug=10 (or more), the tree is printed at the end of the run,
# --debug=100 (or more), the tree is printed at each newline.

use Texinfo::Convert::Converter;

package DebugTexinfo::DebugTree;

@ISA = qw(Texinfo::Convert::Converter);

my %defaults = (
  'EXTENSION' => 'debugtree',
  'OUTFILE' => '-',
);

sub converter_defaults($$)
{
  return %defaults;
}

sub output($$)
{
  my $self = shift;
  my $root = shift;

  $self->_set_outfile();
  return undef unless $self->_create_destination_directory();

  my $fh;
  if (! $self->{'output_file'} eq '') {
    $fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
    if (!$fh) {
      $self->document_error(sprintf($self->__("could not open %s for writing: %s"),
                                    $self->{'output_file'}, $!));
      return undef;
    }
  }

  my $elements;
  if ($self) {
    if ($self->get_conf('USE_NODES')) {
      $elements = Texinfo::Structuring::split_by_node($root);
    } elsif (defined($self->get_conf('USE_NODES'))) {
      #print STDERR "U sections\n";
      $elements = Texinfo::Structuring::split_by_section($root);
    }
    # Currently the information added is not used further.
    if ($elements and ($self->get_conf('SPLIT')
                       or !$self->get_conf('MONOLITHIC'))) {
      #print STDERR "S ".$self->get_conf('SPLIT')."\n";
      Texinfo::Structuring::split_pages($elements,
                                        $self->get_conf('SPLIT'));
    }
  }
  if ($elements) {
    $root = {'type' => 'elements_root',
             'contents' => $elements };
  }
  return $self->_output_text (_print_tree($self, $root), $fh);
}

sub convert($$)
{
  my $self = shift;
  my $root = shift;

  return _print_tree($self, $root);
}

sub convert_tree($$)
{
  my $self = shift;
  my $root = shift;

  return _print_tree($self, $root);
}

sub _print_tree($$;$$);

sub _print_tree($$;$$)
{
  my $self = shift;
  my $root = shift;
  my $level = shift;
  my $argument = shift;
  $level = 0 if (!defined($level));

  my $result = ' ' x $level;
  if ($argument) {
    $result .= '%';
    $level++;
  }
  if ($root->{'cmdname'}) {
    $result .= "\@$root->{'cmdname'} ";
  }
  if (defined($root->{'type'})) {
    $result .= "$root->{'type'} ";
  }
  if (defined($root->{'text'})) {
    my $text = $root->{'text'};
    $text =~ s/\n/\\n/g;
    $text =~ s/\f/\\f/g;
    $text =~ s/\r/\\r/g;
    $result .= "|$text|";
  }
  $result .= "\n";
  if ($root->{'args'}) {
    foreach my $arg (@{$root->{'args'}}) {
      $result .= _print_tree ($self, $arg, $level +1, 1);
    }
  }
  if ($root->{'contents'}) {
    foreach my $content (@{$root->{'contents'}}) {
      $result .= _print_tree ($self, $content, $level+1);
    }
  }
  return $result;
}


code:
use 5.00405;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Texinfo',
    VERSION_FROM      => 'Texinfo/Parser.pm', # finds $VERSION
    ABSTRACT          => 'Texinfo Parser and Converters',
    PREREQ_PM         => {"Encode" => 0,
                          "Data::Dumper" => 0,
                          "File::Spec" => 0,
                          "Config" => 0,
                          "Carp" => 0,
                          "Unicode::Normalize" => 0,
                          "File::Basename" => 0,
                          "File::Copy" => 0,
                          "Getopt::Long" => 0,
                          "Unicode::EastAsianWidth" => 0,
                          "Text::Unidecode" => 0,
                          "Locale::Messages" => 0,
                         },
    BUILD_REQUIRES    => {"Data::Compare" => 0,
                          "Test::Deep" => 0,
                          "Test::More" => "0.88",
                          "Storable" => 0,
                         },
    PMLIBDIRS         => [ 'Texinfo', 'LocaleData', 'DebugTexinfo' ],
    EXE_FILES         => [ 'texi2any' ],
    # FIXME MakeMaker seems to support only subdirectory with one level.
    # The blib directory is put in ../, so in Texinfo/Convert/ which
    # means that XSParagraph is not used in tests.  It should be
    # correctly installed, though.
    DIR                => ['Texinfo/Convert/XSParagraph/'],
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (
       AUTHOR         => 'Patrice Dumas <pertusus@free.fr>') : ()),
);

#package MY;
#sub test
#{
#  my $inherited = shift->SUPER::test(@_);
#  print STDERR "|$inherited|\n";
#  $inherited;
#}


code:
# $Id$
# Makefile.am for texinfo/tp.
#
# Copyright 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation,
# Inc.
#
# This file is free software; as a special exception the author 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.

# Generated lists of tests and of test result files, and some rules.
include $(srcdir)/Makefile.tres

# Generated list of document string locale files and associated rules.
include $(srcdir)/Makefile.docstr

$(srcdir)/Makefile.tres: maintain/regenerate_file_lists.pl
	cd $(srcdir)/ && $(PERL) ./maintain/regenerate_file_lists.pl

$(srcdir)/Makefile.docstr: maintain/regenerate_docstr.sh \
                           $(srcdir)/../po_document/LINGUAS
	cd $(srcdir) \
	&& $(SHELL) ./maintain/regenerate_docstr.sh "$@"

SUBDIRS =
if ! DISABLE_XS
SUBDIRS += Texinfo/Convert/XSParagraph Texinfo/MiscXS
endif

SUBDIRS += . tests

DIST_SUBDIRS = Texinfo/Convert/XSParagraph Texinfo/MiscXS tests

bin_SCRIPTS = texi2any

do_subst = sed \
  -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
  -e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
  -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
  -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
  -e 's,[@]prefix[@],$(prefix),g' \
  -e 's,[@]datarootdir[@],$(datarootdir),g' \
  -e 's,[@]datadir[@],$(datadir),g' \
  -e 's,[@]pkglibdir[@],$(pkglibdir),g' \
  -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
  -e 's,[@]USE_EXTERNAL_LIBINTL[@],$(USE_EXTERNAL_LIBINTL),g' \
  -e 's,[@]USE_EXTERNAL_EASTASIANWIDTH[@],$(USE_EXTERNAL_EASTASIANWIDTH),g' \
  -e 's,[@]USE_EXTERNAL_UNIDECODE[@],$(USE_EXTERNAL_UNIDECODE),g' \
  -e 's,[@]TEXINFO_DTD_VERSION[@],$(TEXINFO_DTD_VERSION),g' \
  -e 's,[@]enable_xs[@],$(enable_xs),g' \
  -e '1 s,/usr/bin/env perl,$(PERL),g'

texi2any: texi2any.pl $(top_builddir)/config.status
	$(do_subst) $(srcdir)/texi2any.pl >$@
	chmod a+x $@

makeinfo: texi2any
	rm -f $@
	-$(LN_S) texi2any $@

modulesdir = $(pkgdatadir)/Texinfo
dist_modules_DATA = \
 Texinfo/Parser.pm \
 Texinfo/Report.pm \
 Texinfo/Common.pm \
 Texinfo/Encoding.pm \
 Texinfo/Structuring.pm \
 Texinfo/Transformations.pm \
 Texinfo/MiscXS.pm \
 Texinfo/XSLoader.pm \
 Texinfo/Documentlanguages.pm

dist_noinst_DATA = \
 Texinfo/ModulePath.pm.in

modules_DATA = \
 Texinfo/ModulePath.pm

convertersdir = $(pkgdatadir)/Texinfo/Convert
dist_converters_DATA = \
 Texinfo/Convert/Converter.pm \
 Texinfo/Convert/DocBook.pm \
 Texinfo/Convert/HTML.pm \
 Texinfo/Convert/IXIN.pm \
 Texinfo/Convert/IXINSXML.pm \
 Texinfo/Convert/Info.pm \
 Texinfo/Convert/Line.pm \
 Texinfo/Convert/NodeNameNormalization.pm \
 Texinfo/Convert/Paragraph.pm \
 Texinfo/Convert/ParagraphNonXS.pm \
 Texinfo/Convert/PlainTexinfo.pm \
 Texinfo/Convert/Plaintext.pm \
 Texinfo/Convert/Texinfo.pm \
 Texinfo/Convert/TexinfoSXML.pm \
 Texinfo/Convert/TexinfoXML.pm \
 Texinfo/Convert/Text.pm \
 Texinfo/Convert/TextContent.pm \
 Texinfo/Convert/UnFilled.pm \
 Texinfo/Convert/Unicode.pm

debugmodulesdir = $(pkgdatadir)/DebugTexinfo
dist_debugmodules_DATA = \
 DebugTexinfo/DebugTree.pm

initdir = $(datadir)/texinfo/init
dist_init_DATA = \
 init/book.pm \
 init/chm.pm \
 init/html32.pm \
 init/tex4ht.pm \
 init/latex2html.pm

test_files = \
 t/README \
 t/include/a.txt \
 t/include/aa.txt \
 t/include/count_image.png \
 t/include/count_image.txt \
 t/include/count_image_text.txt \
 t/include/f.txt \
 t/include/fdotext.ext \
 t/include/fdotext.png \
 t/include/fdotext.txt \
 t/include/fext.ext \
 t/include/fext.png \
 t/include/fext.txt \
 t/include/fextext \
 t/include/file_with_cpp_lines.texi \
 t/include/file_with_xml_chars.texi \
 t/include/include_noeol.texi \
 t/include/image.txt \
 t/include/image_encoded.txt \
 t/include/inc_@f--ile.texi \
 t/include/included_file_with_setfilename.texi \
 t/include/this_is_a_long_unknown_file.png \
 t/include/verbatim_encoded.texi \
 t/include/verbatim_encoded_latin1.texi \
 t/include/words.txt \
 t/init/only_toc_out.init \
 t/init/cvs.init \
 t/init/redefine_need.init \
 t/init/icons.init \
 t/init/t2h_singular.init \
 t/init/ignore_and_comments_output.init \
 t/init/test_directions.init \
 t/init/mini_ker_t2h.init \
 t/init/test_renamed_nodes.init \
 t/init/misc_file_collision.init \
 t/init/l2h.init \
 t/manual_tree.pl \
 t/test_utils.pl \
 t/input_files/all_spaces.texi \
 t/input_files/char_latin1_utf8_in_refs.texi \
 t/input_files/char_latin1_latin1_in_refs.texi \
 t/input_files/char_latin2_latin2_in_refs.texi \
 t/input_files/chinese_mixed_with_en.texi \
 t/input_files/contents_at_document_begin.texi \
 t/input_files/contents_at_end_document_after_node.texi \
 t/input_files/contents_at_end_document.texi \
 t/input_files/contents_in_document.texi \
 t/input_files/contents_no_section.texi \
 t/input_files/cpp_lines.texi \
 t/input_files/delcomment.texi \
 t/input_files/east_asian_in_w.texi \
 t/input_files/empty_lines_at_beginning_no_setfilename.texi \
 t/input_files/empty_lines_at_beginning_no_setfilename_no_element.texi \
 t/input_files/japanese_utf8.texi \
 t/input_files/japanese_shift_jis.texi \
 t/input_files/nodequote.texi \
 t/input_files/non_break_spaces.texi \
 t/input_files/sample_utf8.texi \
 t/input_files/things_before_setfilename_no_element.texi \
 t/input_files/things_before_setfilename.texi \
 #

document_domain = $(PACKAGE)_document

# $(document_strings_mo_files) and $(test_copied_include_files) come from
# the generated makefiles Makefile.docstr and Makefile.tres.
all-local: maintain/catalog.xml $(document_strings_mo_files) \
           $(test_copied_include_files)

tp_tests = prove.sh

if TP_TESTS
TESTS = $(test_tap_files_generated_list)
endif

TEST_EXTENSIONS = .t
T_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
                       $(top_srcdir)/build-aux/tap-driver.sh
T_LOG_COMPILER = $(PERL)
AM_T_LOG_FLAGS = -w
AM_T_LOG_FLAGS += -ITexinfo/Convert/XSParagraph
AM_T_LOG_FLAGS += -I$(srcdir)/Texinfo/Convert/XSParagraph

AM_TESTS_ENVIRONMENT = srcdir="$(srcdir)"; export srcdir; top_srcdir="$(top_srcdir)"; export top_srcdir; builddir="$(builddir)"; export buildir; top_builddir="$(top_builddir)"; export top_builddir;

maintenance_files = \
  maintain/all_tests.sh \
  maintain/change_perl_modules_version.sh \
  maintain/clean_perl_module_files.sh \
  maintain/language-subtag-registry \
  maintain/Makefile_perl_po \
  maintain/MANIFEST_generated_files \
  maintain/prepare_perl_module_files.sh \
  maintain/prepare_perl_standalone_module_archive.sh \
  maintain/regenerate_cmd_tests.sh \
  maintain/regenerate_converters_documentation.sh \
  maintain/regenerate_docstr.sh \
  maintain/regenerate_documentlanguages.pl \
  maintain/regenerate_file_lists.pl \
  maintain/template.pod \
  maintain/catalog.xml.in

perl_specific_files = \
  Makefile.PL \
  MANIFEST

EXTRA_DIST = \
  texi2any.pl \
  $(test_files_generated_list) \
  $(test_files) \
  $(tp_tests) \
  $(maintenance_files) \
  $(perl_specific_files) \
  maintain/lib

# MANIFEST is used for the Perl module.
# maintain/MANIFEST_generated_files is used for dist(check).
# They are made by maintain/prepare_perl_module_files.sh.
MANIFEST: maintain/MANIFEST_generated_files Makefile.am Makefile.tres
	LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE; \
	echo "$(dist_modules_DATA) $(dist_converters_DATA)" \
	"$(dist_debugmodules_DATA) $(dist_init_DATA)" \
	"$(test_files) $(tp_tests) $(test_files_generated_list)" \
	"texi2any README TODO COPYING $(modules_DATA)" \
	"$(maintenance_files) $(perl_specific_files)" \
	 | sed 's/  */\n/g' \
	 | cat - $(srcdir)/maintain/MANIFEST_generated_files $(srcdir)/maintain/MANIFEST_XSParagraph_files \
	 | sort >$@

# template.pod is the basis for the .pm documentation, and the script
# invoked here updates them; to be run when template.pod changes.
#
# If we ever make that documentation more extensive, the .pm doc could
# (and probably should) just be maintained separately, by hand.
do-pm-doc:
	./maintain/regenerate_converters_documentation.sh

maintain/catalog.xml: maintain/catalog.xml.in Makefile
	$(MKDIR_P) maintain
	sed -e 's|[@]abs_top_srcdir[@]|$(abs_top_srcdir)|' \
	    -e 's|[@]TEXINFO_DTD_VERSION[@]|$(TEXINFO_DTD_VERSION)|' \
	  $(srcdir)/maintain/catalog.xml.in >$@

libsrcdir = $(srcdir)/maintain/lib

install-data-local:
	if test $(USE_EXTERNAL_LIBINTL) != 'yes' ; then \
	  $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/lib/libintl-perl/lib/Locale/Recode \
	    $(DESTDIR)$(pkgdatadir)/lib/libintl-perl/lib/Locale/RecodeData; \
	  $(INSTALL_DATA) $(libsrcdir)/libintl-perl/lib/Locale/*.pm \
	    $(DESTDIR)$(pkgdatadir)/lib/libintl-perl/lib/Locale; \
	  $(INSTALL_DATA) $(libsrcdir)/libintl-perl/lib/Locale/Recode/*.pm \
	    $(DESTDIR)$(pkgdatadir)/lib/libintl-perl/lib/Locale/Recode; \
	  $(INSTALL_DATA) $(libsrcdir)/libintl-perl/lib/Locale/RecodeData/*.pm \
	    $(DESTDIR)$(pkgdatadir)/lib/libintl-perl/lib/Locale/RecodeData; \
	fi
	if test $(USE_EXTERNAL_EASTASIANWIDTH) != 'yes' ; then \
	  $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/lib/Unicode-EastAsianWidth/lib/Unicode; \
	  $(INSTALL_DATA) $(libsrcdir)/Unicode-EastAsianWidth/lib/Unicode/EastAsianWidth.pm \
	   $(DESTDIR)$(pkgdatadir)/lib/Unicode-EastAsianWidth/lib/Unicode; \
	fi
	if test $(USE_EXTERNAL_UNIDECODE) != 'yes' ; then \
	  $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/lib/Text-Unidecode/lib/Text/Unidecode; \
	  $(INSTALL_DATA) $(libsrcdir)/Text-Unidecode/lib/Text/Unidecode.pm \
	    $(DESTDIR)$(pkgdatadir)/lib/Text-Unidecode/lib/Text; \
	  $(INSTALL_DATA) $(libsrcdir)/Text-Unidecode/lib/Text/Unidecode/*.pm \
	    $(DESTDIR)$(pkgdatadir)/lib/Text-Unidecode/lib/Text/Unidecode; \
	fi

install-exec-hook:
	makeinfo_f=`echo makeinfo | sed -e '$(transform)'`; rm -f $(DESTDIR)$(bindir)/$$makeinfo_f
	-makeinfo_f=`echo makeinfo | sed -e '$(transform)'`; texi2any_f=`echo texi2any| sed -e '$(transform)'`; $(LN_S) $$texi2any_f $(DESTDIR)$(bindir)/$$makeinfo_f

dist-hook:
	rm -rf `find $(distdir)/maintain/lib -name .svn`

uninstall-local:
	rm -rf $(DESTDIR)$(pkgdatadir)/lib/

distclean-local:
	rm -rf LocaleData
	rm -f t/results/*/*.pl.new
	rm -rf t/results/*/*/out_*/
	rm -rf t/include_dir
	rm -rf blib po po_document

CLEANFILES = texi2any makeinfo texi2any-perl
DISTCLEANFILES = maintain/catalog.xml pm_to_blib Makefile.old


code:
$Id$
texinfo/tp/README

  Copyright 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.

  Copying and distribution of this file, with or without modification,
  are permitted in any medium without royalty provided the copyright
  notice and this notice are preserved.

Texinfo::Parser (hence the directory name tp) is a Perl module for
parsing Texinfo code into a tree representing the Texinfo code
structure.

These other modules and libraries are required (all have been standard
parts of Perl for years, at least since 5.7.3):
  Carp, Config, Data::Dumper, Encode, File::Basename, File::Spec
  Getopt::Long, Unicode::Normalize, Storable

It also uses the less widely-available modules:
  Locale::Messages, Unicode::EastAsianWidth, Text::Unidecode
For these, internal versions are included, and are installed and used as
part of Texinfo (not disturbing the Perl installation at all).

To run the tests you also need:
  Test::More, Data::Compare, Test::Deep
On Debian-based distros, Test::More is part of perl-modules and thus
installed with perl, the packages corresponding to the other modules
are named:
  libdata-compare-perl libtest-deep-perl

The tests are in the subdirectories t/ and test/.  The tests in t/ test
the Perl modules used by the makeinfo command, and the tests in test/
test the command itself.

This module is part of GNU Texinfo.  A standalone Perl module may also be
produced from within the the Texinfo tree, using
  ./maintain/prepare_perl_standalone_module_archive.sh
The resulting module, although standalone, should always be regenerated
from the sources in Texinfo, to avoid divergence of sources.

If you want to delve into making a new backend, the documentation in
tp/Texinfo/Convert/Converter.pm is a good starting point, as it
describes the existing backends and other places to look.  To do a good
job, expect to spend a lot of time making it do the right thing with the
existing tests.

tp builds a complicated parse tree.  It can output a lot of debug
information about the tree, and what it's doing generally.  For example,
these commands output the tree (in different forms):
  makeinfo -c DUMP_TREE=1 -c TEXINFO_OUTPUT_FORMAT=parse document.texi
  makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree document.texi
In addition (or instead) setting the DEBUG configuration variable will
dump more information about what it's doing.

path: tp/README