-#!/usr/bin/perl -w
# $Id$
# $Name$
use strict;
use diagnostics;
+my $gedcom_ref_doc="http://www.gendex.com/gedcom55/55gcch2.htm";
my $inputfile ="$ENV{srcdir}/../include/gom.h";
my $outputfile ="gomxref.html";
my $ext_link = "interface.html";
+my $generated = "";
my $main_structs = "";
my $sub_structs="";
my $section = "";
open INPUT, $inputfile or die "Can't read $inputfile\n";
-open OUTPUT, ">$outputfile" or die "Can't read $outputfile\n";
+open OUTPUT, ">$outputfile" or die "Can't write $outputfile\n";
+
+sub gedcom_link {
+ my ($sublink) = @_;
+ if ($sublink) {
+ return "(<A href=\"javascript:popup_gedcom('$sublink')\">?</A>)";
+ }
+ else {
+ return "";
+ }
+}
while (<INPUT>)
{
- $section = "sub" if m|/\* Sub-structures \*/|;
- $section = "main" if m|/\* Main structures \*/|;
- $section = "" if m|/\* Functions \*/|;
- next if m|/\*|;
+ my $gedc_ref = "";
+ $section = "sub" if m|^/\* Sub-structures \*/|;
+ $section = "main" if m|^/\* Main structures \*/|;
+ $section = "" if m|^/\* Functions \*/|;
+ $generated = $1 if m|^/\* [\$]Id: (.*?) \$ \*/|;
+ next if m|^/\*|;
if ($section ne "") {
+ chomp;
+ if (s|\s*/\* (.*?) \*/\s*$||) {
+ $gedc_ref = $1;
+ }
if (m|^struct (.*) \{|) {
s|^struct (.*?) \{|<a name="$1"><B>struct $1</B></a> \{|;
if ($section eq "main") {
}
if ($section eq "sub") {
- $sub_structs .= "$_";
+ $sub_structs .= "$_ " . gedcom_link($gedc_ref) . "\n";
}
else {
- $main_structs .= "$_";
+ $main_structs .= "$_ " . gedcom_link($gedc_ref) . "\n";
}
}
}
-print OUTPUT "<center><h1>Gedcom object model in C</h1></center>\n";
-print OUTPUT <<END_OF_TEXT;
+print OUTPUT <<"END_OF_HTML";
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">
+<html>
+<head>
+ <title>Gedcom object model in C</title>
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ function popup_gedcom(sublink) {
+ Gedcom = window.open( '$gedcom_ref_doc' + '#' + sublink,
+ 'Gedcom reference',
+ 'scrollbars=yes,resizable=yes,toolbar=no,height=400, width=400');
+ }
+ // -->
+ </script>
+</head>
+<body bgcolor="White">
+
+<h1 align="center">Gedcom object model in C: Structures</h1>
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";
+model for C. The '(?)' links are links to the
+<a href="http://www.gendex.com/gedcom55/55gctoc.htm">Gedcom standard</a>
+giving the meaning of each field.
+<P>
+The following links are fast links to the
+main structures in the Gedcom object model:
+
+<UL>
+$index
+</UL>
+<HR>
+
+<h2>Main structures</h2>
+<CODE><PRE>
+$main_structs
+</PRE></CODE>
+<HR>
+<h2>Sub-structures</h2>
+<CODE><PRE>
+$sub_structs
+</PRE></CODE>
+<HR>
+
+<SMALL>Generated from: $generated</SMALL>
+</body>
+</html>
+END_OF_HTML
+
close OUTPUT;
close INPUT;