--- /dev/null
+#!/usr/local/bin/perl -w
+#
+# $Id$
+#
+# Read a class name from stdin and print inheritance
+# in both directions.
+#
+
+use DBI;
+
+$db = DBI->connect('DBI:Pg:dbname=deal;host=gaia','deal','DEAL!!') ||
+ die $DBI::errstr;
+
+$prefix = " ";
+
+sub subtree
+{
+ my $name = shift(@_);
+ my $direction = shift(@_);
+
+ my $select;
+ my $result;
+
+ $prefix .= " ";
+
+ if ($direction eq 'up')
+ {
+ $select =
+ $db->prepare('SELECT inherits FROM inheritance WHERE inheritor = ?;');
+ $result = $select->execute($name);
+ if ($result == 0)
+ {
+ $name =~ s/<.*//;
+ $result = $select->execute($name);
+ }
+ } else {
+ $select =
+ $db->prepare('SELECT inheritor FROM inheritance WHERE inherits = ?;');
+ $result = $select->execute($name);
+ if ($result == 0)
+ {
+ $select->finish;
+ $select =
+ $db->prepare("SELECT inheritor FROM inheritance WHERE inherits ~ '^$name<';");
+ $result = $select->execute;
+ }
+ }
+# $select->trace(3);
+
+ print STDERR "$prefix$name\n";
+
+ $name =~ s/_/\\_/g;
+ $name =~ s/</\$<\$/g;
+ $name =~ s/>/\$>\$/g;
+
+ print "\\begin{bundle}{\\fbox{$name}}%\n" if ($result != 0);
+ print "\\fbox{$name}%\n" unless ($result != 0);
+
+ my $othername;
+ $select->bind_columns(undef, \$othername);
+ while($select->fetch)
+ {
+ print '\chunk{';
+ subtree($othername, $direction);
+ print '}';
+ }
+ print '\end{bundle}',"\n" if ($result != 0);
+ $select->finish;
+
+ chop $prefix;
+}
+
+
+
+print << 'EOT'
+\documentclass{article}
+\usepackage{eepic,epic,times}
+\usepackage{a4wide,ecltree}
+\pagestyle{empty}
+\begin{document}
+\sffamily
+EOT
+ ;
+
+while (<>)
+{
+ chop;
+ subtree($_,'down');
+ print "\n\n";
+ subtree($_,'up');
+ print "\n\n";
+}
+
+print '\end{document}',"\n";
+
+$db->disconnect;
typedef_declaration:
TYPEDEF vartype identifier
{ cout << setw(OUTW) << "@Typedef:" << $3 << endl
- << cvs_id << endl
+ << cvs_id << endl
<< setw(OUTW) << "@Type:" << $2 << endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl;
printdoc(cout); }
| TYPEDEF vartype '(' '*' identifier ')' argument_declaration
{ cout << setw(OUTW) << "@Typedef-Functionpointer:" << $4 << endl
<< setw(OUTW) << "@Type:" << $2<< endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl;
printdoc(cout); }
| TYPEDEF vartype '(' identifier ':' ':' '*' identifier ')' argument_declaration
{ cout << setw(OUTW) << "@Typedef-Functionpointer:" << $8 << endl
<< setw(OUTW) << "@Type:" << $2<< endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl;
printdoc(cout); }
| TYPEDEF vartype '(' '*' identifier ')' argument_declaration CONST
{ cout << setw(OUTW) << "@Typedef-Functionpointer:" << $4 << endl
<< setw(OUTW) << "@Type:" << $2<< endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl;
printdoc(cout); }
| TYPEDEF vartype '(' identifier ':' ':' '*' identifier ')' argument_declaration CONST
{ cout << setw(OUTW) << "@Typedef-Functionpointer:" << $8 << endl
<< setw(OUTW) << "@Type:" << $2<< endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl;
printdoc(cout); }
| TYPEDEF vartype identifier array_dimensions
{ cout << setw(OUTW) << "@Typedef:" << $3 << endl
<< cvs_id << endl
<< setw(OUTW) << "@Type:" << $2 << endl
+ << setw(OUTW) << "@In-Class:" << class_stack.top() << endl
<< setw(OUTW) << "@Access:" << access_stack.top() << endl
<< setw(OUTW) << "@Array-Dimension:" << $4 << endl;
printdoc(cout); }
--- /dev/null
+#!/usr/local/bin/perl
+#
+# $Id$
+#
+# Enter all names into the postgres database
+#
+# Variables and Typedefs are missing
+
+use DBI;
+
+$docindex = 0;
+
+open DOCFILE,">tmpdoc" || die "Could not open docfile";
+
+$db = DBI->connect('DBI:Pg:dbname=deal;host=gaia','deal','DEAL!!') ||
+ die $DBI::errstr;
+
+#$db->trace(2);
+
+$db->do('delete from classes;');
+$db->do('delete from inheritance;');
+$db->do('delete from roots;');
+$db->do('delete from exceptions;');
+$db->do('delete from functions;');
+
+$enterclass = $db->prepare('insert into classes (type, name, templates, fullname, scope, access, file, version, documentation) values (?, ?, ?, ?, ?, ?, ?, ?, ?);');
+
+$enterinheritance = $db->prepare('insert into inheritance (inheritor, inherits, access) values (?, ?, ?);');
+
+$enterroot = $db->prepare('insert into roots (name) values (?);');
+
+$enterexception = $db->prepare('insert into exceptions (name, scope, access, arguments, documentation) values (?, ?, ?, ?, ?);');
+
+$enterfunction = $db->prepare('insert into functions (type, name, templates, scope, access, file, version, parameters, virtual, const, documentation) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);');
+
+#$enterclass->trace(2);
+
+sub output;
+
+while(<>)
+{
+ if(/^\@\@\@/)
+ {
+ # Output depending on defined entity
+ output();
+ # Delete all variables
+ $template_description = "";
+ $classname = "";
+ $functionname = "";
+ $variablename = "";
+ $typedef = "";
+ $exception = "";
+ @inheritance = ();
+ $inclass = "";
+ $function_parameters = "";
+ $access = "";
+ $array = "";
+ $type = "";
+ $const = 0;
+ $virtual = "";
+ $file = "";
+ $doc = "";
+ }
+ elsif (/\@Template-Description:(.*)/)
+ {
+ $template_description = $1;
+ }
+ elsif (/\@Class-Definition:(.*)/)
+ {
+ ($temp, @inheritance) = split /\@/, $1;
+ ($type, $classname) = split / /, $temp, 2;
+ }
+ elsif (/\@In-Class:(.*)/)
+ {
+ $inclass = $1;
+ $inclass =~ s/^:://;
+ }
+ elsif (/\@Function-Definition:(.*)/)
+ {
+ $functionname = $1;
+ }
+ elsif (/\@Variable-Declaration:(.*)/)
+ {
+ $variablename = $1;
+ }
+ elsif (/\@DeclException(.):(.*)/)
+ {
+ $exception = $2;
+ $exceptionargs = $1;
+ }
+ elsif (/\@Typedef(-Functionpointer)?:(.*)/)
+ {
+ $typedef = $2;
+ }
+ elsif (/\@Function-Parameters:(.*)/)
+ {
+ $function_parameters = $1;
+ }
+ elsif (/\@Access:(.*)/)
+ {
+ $access = $1;
+ }
+ elsif (/\@Array-Dimension:(.*)/)
+ {
+ $array = $1;
+ }
+ elsif (/\@(Return-)?Type:(.*)/)
+ {
+ $type = $2;
+ }
+ elsif (/\@Const:(.*)/)
+ {
+ $const = 1;
+ }
+ elsif (/\@Virtual:(.*)/)
+ {
+ $virtual = $1;
+ }
+ elsif (/^\s*\@/)
+ {
+# print;
+ }
+ elsif (/^\s*\$(Id:)\s*(\S+)\s+(\S+)/)
+ {
+ $file = $2;
+ $version = $3;
+ $file =~ s/,v//;
+ }
+ elsif (/\s*\*/)
+ {
+ s/\s*\* ?//;
+ $doc .= $_;
+ }
+}
+
+$enterclass->finish;
+$enterinheritance->finish;
+$db->disconnect;
+
+sub output
+{
+ if ($classname)
+ {
+ print STDERR '.';
+# print $type, ' ';
+# print $inclass, '::' if ($inclass);
+# print $classname, " $file $version\n";
+ $fullname = "";
+ $fullname = $inclass . '::' if ($inclass);
+ $fullname .= $classname;
+ $enterclass->execute($type, $classname, $template_description, $fullname, $inclass,
+ $access, $file, $version, $docindex);
+
+ print DOCFILE "\@\@\@$docindex\n$doc\n";
+ $docindex++;
+
+ foreach (@inheritance)
+ {
+ m/\s*(\w+)\s+(.*)/;
+ $enterinheritance->execute($fullname, $2, $1);
+ }
+ $enterroot->execute($fullname) unless (@inheritance);
+ }
+ elsif($exception)
+ {
+ $enterexception->execute($exception, $inclass, $access,
+ $exceptionargs, $docindex);
+
+ print DOCFILE "\@\@\@$docindex\n$doc\n";
+ $docindex++;
+ }
+ elsif ($functionname)
+ {
+ $enterfunction->execute($type, $functionname, $template_description,
+ $inclass, $access, $file, $version,
+ $function_parameters,
+ $virtual, ($const) ? 't' : 'f', $docindex);
+
+ print DOCFILE "\@\@\@$docindex\n$doc\n";
+ $docindex++;
+ }
+}
+