xref: /trunk/main/basegfx/qa/mkpolygons.pl (revision 7950f2af)
1cdf0e10cSrcweir:
2cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}'
3cdf0e10cSrcweir    if 0;
4bb113e63SAndrew Rist# *************************************************************
5bb113e63SAndrew Rist#
6bb113e63SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
7bb113e63SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
8bb113e63SAndrew Rist#  distributed with this work for additional information
9bb113e63SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
10bb113e63SAndrew Rist#  to you under the Apache License, Version 2.0 (the
11bb113e63SAndrew Rist#  "License"); you may not use this file except in compliance
12bb113e63SAndrew Rist#  with the License.  You may obtain a copy of the License at
13bb113e63SAndrew Rist#
14bb113e63SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
15bb113e63SAndrew Rist#
16bb113e63SAndrew Rist#  Unless required by applicable law or agreed to in writing,
17bb113e63SAndrew Rist#  software distributed under the License is distributed on an
18bb113e63SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19bb113e63SAndrew Rist#  KIND, either express or implied.  See the License for the
20bb113e63SAndrew Rist#  specific language governing permissions and limitations
21bb113e63SAndrew Rist#  under the License.
22bb113e63SAndrew Rist#
23bb113e63SAndrew Rist# *************************************************************
24cdf0e10cSrcweir
25cdf0e10cSrcweir#
26cdf0e10cSrcweir# 2009 Copyright Novell, Inc. & Sun Microsystems, Inc.
27cdf0e10cSrcweir#
28cdf0e10cSrcweir#
29cdf0e10cSrcweir
30cdf0e10cSrcweiruse	IO::File;
31cdf0e10cSrcweiruse	Cwd;
32cdf0e10cSrcweiruse File::Spec;
33cdf0e10cSrcweiruse File::Spec::Functions;
34cdf0e10cSrcweiruse File::Temp;
35cdf0e10cSrcweiruse File::Path;
36cdf0e10cSrcweir
37cdf0e10cSrcweir$TempDir = "";
38cdf0e10cSrcweir
39cdf0e10cSrcweir
40cdf0e10cSrcweir# all the XML package generation is a blatant rip from AF's
41cdf0e10cSrcweir# write-calc-doc.pl
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweir###############################################################################
45cdf0e10cSrcweir#	Open a file with the given name.
46cdf0e10cSrcweir#	First it is checked if the temporary directory, in which all files for
47cdf0e10cSrcweir#	the document are gathered, is already present and create it if it is not.
48cdf0e10cSrcweir#	Then create the path to the file inside the temporary directory.
49cdf0e10cSrcweir#	Finally open the file and return a file handle to it.
50cdf0e10cSrcweir#
51cdf0e10cSrcweirsub	open_file
52cdf0e10cSrcweir{
53cdf0e10cSrcweir    my	$filename = pop @_;
54cdf0e10cSrcweir
55cdf0e10cSrcweir    #	Create base directory of temporary directory tree if not alreay
56cdf0e10cSrcweir    #	present.
57cdf0e10cSrcweir    if ($TempDir eq "")
58cdf0e10cSrcweir    {
59cdf0e10cSrcweir        $TempDir = File::Temp::tempdir (CLEANUP => 1);
60cdf0e10cSrcweir    }
61cdf0e10cSrcweir
62cdf0e10cSrcweir    #	Create the path to the file.
63cdf0e10cSrcweir    my $fullname = File::Spec->catfile ($TempDir, $filename);
64cdf0e10cSrcweir    my ($volume,$directories,$file) = File::Spec->splitpath ($fullname);
65cdf0e10cSrcweir    mkpath (File::Spec->catpath ($volume,$directories,""));
66cdf0e10cSrcweir
67cdf0e10cSrcweir    #	Open the file and return a file handle to it.
68cdf0e10cSrcweir    return new IO::File ($fullname, "w");
69cdf0e10cSrcweir}
70cdf0e10cSrcweir
71cdf0e10cSrcweir
72cdf0e10cSrcweir###############################################################################
73cdf0e10cSrcweir#	Zip the files in the directory tree into the given file.
74cdf0e10cSrcweir#
75cdf0e10cSrcweirsub	zip_dirtree
76cdf0e10cSrcweir{
77cdf0e10cSrcweir    my	$filename = pop @_;
78cdf0e10cSrcweir
79cdf0e10cSrcweir    my	$cwd = getcwd;
80cdf0e10cSrcweir    my	$zip_name = $filename;
81cdf0e10cSrcweir
82cdf0e10cSrcweir    #	We are about to change the directory.
83cdf0e10cSrcweir    #	Therefore create an absolute pathname for the zip archive.
84cdf0e10cSrcweir
85cdf0e10cSrcweir    #	First transfer the drive from $cwd to $zip_name.  This is a
86cdf0e10cSrcweir    #	workaround for a bug in file_name_is_absolute which thinks
87*7950f2afSmseidel    #	the path \bla is an absolute path under DOS.
88cdf0e10cSrcweir    my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name);
89cdf0e10cSrcweir    my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd);
90cdf0e10cSrcweir    $volume = $volume_cwd if ($volume eq "");
91cdf0e10cSrcweir    $zip_name = File::Spec->catpath ($volume,$directories,$file);
92cdf0e10cSrcweir
93cdf0e10cSrcweir    #	Add the current working directory to a relative path.
94cdf0e10cSrcweir    if ( ! file_name_is_absolute ($zip_name))
95cdf0e10cSrcweir    {
96cdf0e10cSrcweir        $zip_name = File::Spec->catfile ($cwd, $zip_name);
97cdf0e10cSrcweir
98cdf0e10cSrcweir        #	Try everything to clean up the name.
99cdf0e10cSrcweir        $zip_name = File::Spec->rel2abs ($filename);
100cdf0e10cSrcweir        $zip_name = File::Spec->canonpath ($zip_name);
101cdf0e10cSrcweir
102cdf0e10cSrcweir        #	Remove .. directories from the middle of the path.
103cdf0e10cSrcweir        while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//)
104cdf0e10cSrcweir        {
105cdf0e10cSrcweir            $zip_name = $` . "/" . $';
106cdf0e10cSrcweir        }
107cdf0e10cSrcweir    }
108cdf0e10cSrcweir
109cdf0e10cSrcweir    #	Just in case the zip program gets confused by an existing file with the
110cdf0e10cSrcweir    #	same name as the one to be written that file is removed first.
111cdf0e10cSrcweir    if ( -e $filename)
112cdf0e10cSrcweir    {
113cdf0e10cSrcweir        if (unlink ($filename) == 0)
114cdf0e10cSrcweir        {
115cdf0e10cSrcweir            print "Existing file $filename could not be deleted.\n";
116cdf0e10cSrcweir            print "Please close the application that uses it, then try again.\n";
117cdf0e10cSrcweir            return;
118cdf0e10cSrcweir        }
119cdf0e10cSrcweir    }
120cdf0e10cSrcweir
121cdf0e10cSrcweir    #	Finally create the zip file.  First change into the temporary directory
122cdf0e10cSrcweir    #	so that the resulting zip file contains only paths relative to it.
123cdf0e10cSrcweir    print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
124cdf0e10cSrcweir    chdir ($TempDir);
125cdf0e10cSrcweir    system ("$ZipCmd $ZipFlags $zip_name *");
126cdf0e10cSrcweir    chdir ($cwd);
127cdf0e10cSrcweir}
128cdf0e10cSrcweir
129cdf0e10cSrcweir
130cdf0e10cSrcweirsub writeHeader
131cdf0e10cSrcweir{
132cdf0e10cSrcweir    print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
133cdf0e10cSrcweir
134cdf0e10cSrcweir<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
135cdf0e10cSrcweir <office:scripts/>
136cdf0e10cSrcweir <office:automatic-styles>
137cdf0e10cSrcweir  <style:style style:name="dp1" style:family="drawing-page">
138cdf0e10cSrcweir   <style:drawing-page-properties presentation:background-visible="true" presentation:background-objects-visible="true" presentation:display-footer="true" presentation:display-page-number="false" presentation:display-date-time="true"/>
139cdf0e10cSrcweir  </style:style>
140cdf0e10cSrcweir  <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
141cdf0e10cSrcweir   <style:graphic-properties draw:textarea-horizontal-align="center" draw:fill="none" draw:stroke="none" draw:textarea-vertical-align="middle"/>
142cdf0e10cSrcweir  </style:style>
143cdf0e10cSrcweir  <style:style style:name="gr2" style:family="graphic" style:parent-style-name="standard">
144cdf0e10cSrcweir   <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle"/>
145cdf0e10cSrcweir  </style:style>
146cdf0e10cSrcweir  <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
147cdf0e10cSrcweir   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
148cdf0e10cSrcweir  </style:style>
149cdf0e10cSrcweir  <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
150cdf0e10cSrcweir   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
151cdf0e10cSrcweir  </style:style>
152cdf0e10cSrcweir  <style:style style:name="P1" style:family="paragraph">
153cdf0e10cSrcweir   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
154cdf0e10cSrcweir  </style:style>
155cdf0e10cSrcweir  <style:style style:name="P2" style:family="paragraph">
156cdf0e10cSrcweir   <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
157cdf0e10cSrcweir  </style:style>
158cdf0e10cSrcweir  <text:list-style style:name="L1">
159cdf0e10cSrcweir   <text:list-level-style-bullet text:level="1" text:bullet-char="●">
160cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
161cdf0e10cSrcweir   </text:list-level-style-bullet>
162cdf0e10cSrcweir   <text:list-level-style-bullet text:level="2" text:bullet-char="●">
163cdf0e10cSrcweir    <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
164cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
165cdf0e10cSrcweir   </text:list-level-style-bullet>
166cdf0e10cSrcweir   <text:list-level-style-bullet text:level="3" text:bullet-char="●">
167cdf0e10cSrcweir    <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
168cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
169cdf0e10cSrcweir   </text:list-level-style-bullet>
170cdf0e10cSrcweir   <text:list-level-style-bullet text:level="4" text:bullet-char="●">
171cdf0e10cSrcweir    <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
172cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
173cdf0e10cSrcweir   </text:list-level-style-bullet>
174cdf0e10cSrcweir   <text:list-level-style-bullet text:level="5" text:bullet-char="●">
175cdf0e10cSrcweir    <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
176cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
177cdf0e10cSrcweir   </text:list-level-style-bullet>
178cdf0e10cSrcweir   <text:list-level-style-bullet text:level="6" text:bullet-char="●">
179cdf0e10cSrcweir    <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
180cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
181cdf0e10cSrcweir   </text:list-level-style-bullet>
182cdf0e10cSrcweir   <text:list-level-style-bullet text:level="7" text:bullet-char="●">
183cdf0e10cSrcweir    <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
184cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
185cdf0e10cSrcweir   </text:list-level-style-bullet>
186cdf0e10cSrcweir   <text:list-level-style-bullet text:level="8" text:bullet-char="●">
187cdf0e10cSrcweir    <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
188cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
189cdf0e10cSrcweir   </text:list-level-style-bullet>
190cdf0e10cSrcweir   <text:list-level-style-bullet text:level="9" text:bullet-char="●">
191cdf0e10cSrcweir    <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
192cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
193cdf0e10cSrcweir   </text:list-level-style-bullet>
194cdf0e10cSrcweir  </text:list-style>
195cdf0e10cSrcweir </office:automatic-styles>
196cdf0e10cSrcweir <office:body>
197cdf0e10cSrcweir  <office:presentation>
198cdf0e10cSrcweir~;
199cdf0e10cSrcweir
200cdf0e10cSrcweir}
201cdf0e10cSrcweir
202cdf0e10cSrcweirsub writeSlideHeader
203cdf0e10cSrcweir{
204cdf0e10cSrcweir    my $titleText = pop @_;
205cdf0e10cSrcweir    my $slideNum = pop @_;
206cdf0e10cSrcweir
207cdf0e10cSrcweir    print $OUT "    <draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n";
208cdf0e10cSrcweir    print $OUT "     <office:forms form:automatic-focus=\"false\" form:apply-design-mode=\"false\"/>\n";
209cdf0e10cSrcweir    print $OUT "     <draw:rect draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:id=\"id$slideNum\" draw:layer=\"layout\" svg:width=\"17.5cm\" svg:height=\"6cm\" svg:x=\"5cm\" svg:y=\"4cm\">\n";
210cdf0e10cSrcweir    print $OUT "      <text:p text:style-name=\"P2\">Slide: $slideNum</text:p>\n";
211cdf0e10cSrcweir    print $OUT "      <text:p text:style-name=\"P2\">Path: $titleText</text:p>\n";
212cdf0e10cSrcweir    print $OUT "     </draw:rect>\n";
213cdf0e10cSrcweir}
214cdf0e10cSrcweir
215cdf0e10cSrcweir
216cdf0e10cSrcweirsub writeSlideFooter
217cdf0e10cSrcweir{
218cdf0e10cSrcweir    print $OUT "    <presentation:notes draw:style-name=\"dp1\">\n";
219cdf0e10cSrcweir    print $OUT "     <draw:page-thumbnail draw:style-name=\"gr1\" draw:layer=\"layout\" svg:width=\"14.851cm\" svg:height=\"11.138cm\" svg:x=\"3.068cm\" svg:y=\"2.257cm\" draw:page-number=\"1\" presentation:class=\"page\"/>\n";
220cdf0e10cSrcweir    print $OUT "     <draw:frame presentation:style-name=\"pr3\" draw:layer=\"layout\" svg:width=\"16.79cm\" svg:height=\"13.116cm\" svg:x=\"2.098cm\" svg:y=\"14.109cm\" presentation:class=\"notes\" presentation:placeholder=\"true\">\n";
221cdf0e10cSrcweir    print $OUT "      <draw:text-box/>\n";
222cdf0e10cSrcweir    print $OUT "     </draw:frame>\n";
223cdf0e10cSrcweir    print $OUT "    </presentation:notes>\n";
224cdf0e10cSrcweir    print $OUT "   </draw:page>\n";
225cdf0e10cSrcweir}
226cdf0e10cSrcweir
227cdf0e10cSrcweirsub writeFooter
228cdf0e10cSrcweir{
229cdf0e10cSrcweir    print $OUT qq~   <presentation:settings presentation:full-screen="false"/>
230cdf0e10cSrcweir  </office:presentation>
231cdf0e10cSrcweir </office:body>
232cdf0e10cSrcweir</office:document-content>
233cdf0e10cSrcweir~;
234cdf0e10cSrcweir
235cdf0e10cSrcweir}
236cdf0e10cSrcweir
237cdf0e10cSrcweirsub writePath
238cdf0e10cSrcweir{
239cdf0e10cSrcweir    my $pathAry = pop @_;
240cdf0e10cSrcweir    my $path = $pathAry->[1];
241cdf0e10cSrcweir    my $viewBox = $pathAry->[0];
242cdf0e10cSrcweir
243cdf0e10cSrcweir    print $OUT "       <draw:path draw:style-name=\"gr2\" draw:text-style-name=\"P1\" draw:layer=\"layout\" svg:width=\"10cm\" svg:height=\"10cm\" svg:x=\"5cm\" svg:y=\"5cm\" svg:viewBox=\"";
244cdf0e10cSrcweir    print $OUT $viewBox;
245cdf0e10cSrcweir    print $OUT "\" svg:d=\"";
246cdf0e10cSrcweir    print $OUT $path;
247cdf0e10cSrcweir    print $OUT "\">\n";
248cdf0e10cSrcweir    print $OUT "         <text:p/>\n";
249cdf0e10cSrcweir    print $OUT "       </draw:path>\n";
250cdf0e10cSrcweir}
251cdf0e10cSrcweir
252cdf0e10cSrcweirsub writeManifest
253cdf0e10cSrcweir{
254cdf0e10cSrcweir    my $outFile = open_file("META-INF/manifest.xml");
255cdf0e10cSrcweir
256cdf0e10cSrcweir    print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
257cdf0e10cSrcweir<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
258cdf0e10cSrcweir<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
259cdf0e10cSrcweir <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
260cdf0e10cSrcweir <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
261cdf0e10cSrcweir</manifest:manifest>
262cdf0e10cSrcweir~;
263cdf0e10cSrcweir
264cdf0e10cSrcweir    $outFile->close;
265cdf0e10cSrcweir}
266cdf0e10cSrcweir
267cdf0e10cSrcweir
268cdf0e10cSrcweir###############################################################################
269cdf0e10cSrcweir#	Print usage information.
270cdf0e10cSrcweir#
271cdf0e10cSrcweirsub	usage	()
272cdf0e10cSrcweir{
273cdf0e10cSrcweir    print <<END_OF_USAGE;
274cdf0e10cSrcweirusage: $0 <option>* [<SvgD-values>]
275cdf0e10cSrcweir
276cdf0e10cSrcweiroutput-file-name defaults to polygons.odp.
277cdf0e10cSrcweir
278cdf0e10cSrcweir         -h    Print this usage information.
279cdf0e10cSrcweir         -o    output-file-name
280cdf0e10cSrcweirEND_OF_USAGE
281cdf0e10cSrcweir}
282cdf0e10cSrcweir
283cdf0e10cSrcweir###############################################################################
284cdf0e10cSrcweir#	Process the command line.
285cdf0e10cSrcweir#
286cdf0e10cSrcweirsub	process_command_line
287cdf0e10cSrcweir{
288cdf0e10cSrcweir    foreach (@ARGV)
289cdf0e10cSrcweir    {
290cdf0e10cSrcweir        if (/^-h/)
291cdf0e10cSrcweir        {
292cdf0e10cSrcweir            usage;
293cdf0e10cSrcweir            exit 0;
294cdf0e10cSrcweir        }
295cdf0e10cSrcweir    }
296cdf0e10cSrcweir
297cdf0e10cSrcweir    $global_output_name = "polygons.odp";
298cdf0e10cSrcweir    my	$j = 0, $noMoreOptions = 0;
299cdf0e10cSrcweir    for (my $i=0; $i<$#ARGV; $i++)
300cdf0e10cSrcweir    {
301cdf0e10cSrcweir        if ( !$noMoreOptions and $ARGV[$i] eq "-o")
302cdf0e10cSrcweir        {
303cdf0e10cSrcweir			$i++;
304cdf0e10cSrcweir			$global_output_name = $ARGV[$i];
305cdf0e10cSrcweir        }
306cdf0e10cSrcweir        elsif ( !$noMoreOptions and $ARGV[$i] eq "--")
307cdf0e10cSrcweir        {
308cdf0e10cSrcweir			$noMoreOptions = 1;
309cdf0e10cSrcweir        }
310cdf0e10cSrcweir        elsif ( !$noMoreOptions and $ARGV[$i] =~ /^-/)
311cdf0e10cSrcweir        {
312cdf0e10cSrcweir            print "Unknown option $ARGV[$i]\n";
313cdf0e10cSrcweir            usage;
314cdf0e10cSrcweir            exit 1;
315cdf0e10cSrcweir        }
316cdf0e10cSrcweir        else
317cdf0e10cSrcweir        {
318cdf0e10cSrcweir            push(@paths, [$ARGV[$i],$ARGV[$i+1]]);
319cdf0e10cSrcweir			$i++;
320cdf0e10cSrcweir        }
321cdf0e10cSrcweir    }
322cdf0e10cSrcweir
323cdf0e10cSrcweir    print "output to $global_output_name\n";
324cdf0e10cSrcweir}
325cdf0e10cSrcweir
326cdf0e10cSrcweir###############################################################################
327cdf0e10cSrcweir#	Main
328cdf0e10cSrcweir###############################################################################
329cdf0e10cSrcweir
330cdf0e10cSrcweir$ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
331cdf0e10cSrcweir$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
332cdf0e10cSrcweir#	Provide default values for the zip command and it's flags.
333cdf0e10cSrcweirif ( ! defined $ZipCmd)
334cdf0e10cSrcweir{
335cdf0e10cSrcweir    $ZipCmd = "zip" unless defined $ZipCmd;
336cdf0e10cSrcweir    $ZipFlags = "-r -q" unless defined $ZipFlags;
337cdf0e10cSrcweir}
338cdf0e10cSrcweir
339cdf0e10cSrcweirprocess_command_line();
340cdf0e10cSrcweir
341cdf0e10cSrcweirwriteManifest();
342cdf0e10cSrcweir
343cdf0e10cSrcweir$OUT = open_file( "content.xml" );
344cdf0e10cSrcweir
345cdf0e10cSrcweirwriteHeader();
346cdf0e10cSrcweir
347cdf0e10cSrcweir$pathNum=0;
348cdf0e10cSrcweirforeach $path (@paths)
349cdf0e10cSrcweir{
350cdf0e10cSrcweir	writeSlideHeader($pathNum, $path->[1]);
351cdf0e10cSrcweir	writePath($path);
352cdf0e10cSrcweir	writeSlideFooter();
353cdf0e10cSrcweir	$pathNum++;
354cdf0e10cSrcweir}
355cdf0e10cSrcweir
356cdf0e10cSrcweirwriteFooter();
357cdf0e10cSrcweir
358cdf0e10cSrcweir$OUT->close;
359cdf0e10cSrcweir
360cdf0e10cSrcweirzip_dirtree ($global_output_name);
361cdf0e10cSrcweir
362