# Copyright (C) 1996,1997,1998,1999,2000,2001
# Associated Universities, Inc. Washington DC, USA.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# 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
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
# Correspondence concerning AIPS++ should be addressed as follows:
# Internet email: aips2-request@nrao.edu.
# Postal address: AIPS++ Project Office
# National Radio Astronomy Observatory
# Charlottesville, VA 22903-2475 USA
$etext = "([^\}]*\{[^\}]*\}[^\}]*|[^\}]*)";
$wlabel = "\\subsubsection";
$tbflabel = '\\flushleft\\vspace{.20in}\\textbf';
$end_section = "\\vspace{.18in}\n\\hrule";
# OK first we make sure we can tokenize everything by adding an endaips2help
# token after the \\end{ah}
$result = &GetOptions('glish', 'noheaders', 'package=s', 'outline', 'xml');
# Note to self here is where the XML header stuff goes
print "\<?xml version=\"1.0\" encoding=\"UTF-8\"?\>\n";
print "\<?xml-stylesheet type=\"text/xsl\" href=\"file:\/\/\/Users\/wyoung\/casa\/interfaces\/casa2acsidl.xsl\"?\>\n";
print "\<myps xmlns=\"http:\/\/www.aoc.nrao.edu\/~wyoung\/psetTypes.html\"\n";
print "xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n";
print "xsi:schemaLocation=\"http:\/\/www.aoc.nrao.edu\/~wyoung\/psetTypes.html\n";
print "file:\/\/\/users\/wyoung\/casa\/interfaces\/psetdef.xsd\"\>\n";
&fetch_raw_help($file, 'fh00', $pack);
foreach $moduleN (split(/beginaips2module/, $theText)){
foreach $objectN (split(/beginaips2object/, $moduleN)){
&make_tex_file($objectN);
&term_object($firstPass);
&term_module($objectText);
local($filename, $readme, $pack) = @_;
open($readme, $filename);
# remove any comments that have ah commands or
s/(\\begin{ahmodule})/beginaips2module $1/g;
s/(\\begin{ahtool})/beginaips2object $1/g;
s/(\\begin{ahobject})/beginaips2object $1/g;
s/(\\begin{ahfunction})/beginaips2help $1/g;
s/(\\begin{ahconstructor})/beginaips2help $1/g;
s/(\\begin{ahrecord})/beginaips2help $1/g;
s/(\\end{ahrecord})/beginaips2help $1/g;