diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-01-20 23:33:45 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-01-20 23:33:45 +0000 |
commit | 36b1955f36f90bd4a8fb5195dcf62611571c1fdf (patch) | |
tree | 25d685697257e6e407d3ec0b52f116dc87576e3f /boxbackup/generate_except_xml.pl | |
parent | e1b13eeb4845c32c5554f78b0ec95dd120948482 (diff) |
Move documentation/boxbackup to documentation, part 2
Diffstat (limited to 'boxbackup/generate_except_xml.pl')
-rw-r--r-- | boxbackup/generate_except_xml.pl | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/boxbackup/generate_except_xml.pl b/boxbackup/generate_except_xml.pl new file mode 100644 index 00000000..9046d5cf --- /dev/null +++ b/boxbackup/generate_except_xml.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w +use strict; + +open (EXCEPT, "<../../ExceptionCodes.txt") or die "Can't open ../../ExceptionCodes.txt: $!\n"; +open (DOCBOOK, ">ExceptionCodes.xml") or die "Can't open Exceptioncodes.xml for writing: $!\n"; + +print DOCBOOK <<EOD; +<?xml version="1.0" encoding="UTF-8"?> + +<appendix> + <title>Exception codes</title> + +EOD +my $sectionName; +my $sectionNum; +my $sectionDesc; +my $exceptionCode; +my $exceptionShortDesc; +my $exceptionLongDesc; +while(<EXCEPT>) +{ + next if(m/^#/); + chomp; + if(m/^EXCEPTION TYPE (\w+) (\d+)/) + { + $sectionName = ucfirst(lc($1)); + $sectionNum = $2; + if($sectionName ne "Common") + { + $sectionDesc = "the " . $sectionName; + } + else + { + $sectionDesc = "any"; + } + print DOCBOOK <<EOD; + <section> + <title>$sectionName Exceptions ($sectionNum)</title> + + <para>These are exceptions that can occur in $sectionDesc module + of the system.</para> + + <itemizedlist> +EOD + } + + # The END TYPE line + if(m/^END TYPE$/) + { + print DOCBOOK " </itemizedlist>\n </section>\n"; + } + + # The actual exceptions + if(m/(\(\d+\/\d+\)) - (\w+ \w+)(?: - )?(.*)$/) + { + $exceptionCode = $1; + $exceptionShortDesc = $2; + $exceptionLongDesc = $3; + + print DOCBOOK " <listitem>\n <para><emphasis role=\"bold\">"; + print DOCBOOK $exceptionCode . ": " . $exceptionShortDesc . "</emphasis>"; + if($exceptionLongDesc ne "") + { + print DOCBOOK " -- " . $exceptionLongDesc; + } + print DOCBOOK "</para>\n </listitem>\n"; + } +} + +print DOCBOOK "</appendix>\n"; + +close EXCEPT; +close DOCBOOK; +
\ No newline at end of file |