From: Peter Verthez <Peter.Verthez@advalvas.be> Date: Wed, 11 Sep 2002 19:09:50 +0000 (+0000) Subject: Generating documentation for gedcom object model. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=f66f8671b738b063b4085e2ff35632503547fb1c;p=gedcom-parse.git Generating documentation for gedcom object model. --- diff --git a/doc/make_xref b/doc/make_xref new file mode 100755 index 0000000..fac7ebd --- /dev/null +++ b/doc/make_xref @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w +# $Id$ +# $Name$ + +use strict; +use diagnostics; + +my $inputfile ="$ENV{srcdir}/../include/gom.h"; +my $outputfile ="gomxref.html"; +my $ext_link = "interface.html"; + +my $main_structs = ""; +my $sub_structs=""; +my $index = ""; +my $section = ""; + +open INPUT, $inputfile or die "Can't read $inputfile\n"; +open OUTPUT, ">$outputfile" or die "Can't read $outputfile\n"; + +while (<INPUT>) +{ + $section = "sub" if m|/\* Sub-structures \*/|; + $section = "main" if m|/\* Main structures \*/|; + $section = "" if m|/\* Functions \*/|; + next if m|/\*|; + + if ($section ne "") { + if (m|^struct (.*) \{|) { + s|^struct (.*?) \{|<a name="$1"><B>struct $1</B></a> \{|; + if ($section eq "main") { + $index .= " <LI><a href=\"#$1\">struct $1</a><br>\n"; + } + } + elsif (m|struct (.*?) \*|) { + my $link = ""; + my $structname = $1; + if ($structname =~ /^(date|age|xref)_value$/) { + $link = $ext_link; + } + s|struct (.*?) \*|<a href="$link#$1">struct $1</a> \*|; + } + + if ($section eq "sub") { + $sub_structs .= "$_"; + } + else { + $main_structs .= "$_"; + } + } +} + +print OUTPUT "<center><h1>Gedcom object model in C</h1></center>\n"; +print OUTPUT <<END_OF_TEXT; +This page provides a cross-reference of all objects in the Gedcom object +model for C. The following links are fast links to the main structures +in the Gedcom object model: +END_OF_TEXT +print OUTPUT "\n"; +print OUTPUT "<UL>\n"; +print OUTPUT $index; +print OUTPUT "</UL>\n"; +print OUTPUT "<hr>\n"; +print OUTPUT "<h2>Main structures</h2>\n"; +print OUTPUT "<CODE><PRE>\n"; +print OUTPUT $main_structs; +print OUTPUT "</PRE></CODE>\n"; +print OUTPUT "<hr>\n"; +print OUTPUT "<h2>Sub-structures</h2>\n"; +print OUTPUT "<CODE><PRE>\n"; +print OUTPUT $sub_structs; +print OUTPUT "</PRE></CODE>\n"; + +close OUTPUT; +close INPUT;