#  Copyright (c) 1997-2006
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.de
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-----------------------------------------------------------------------------
#  $Project: polymake $$Id: list_all_properties,v 1.3 2006/02/21 20:34:41 gawrilow Exp $

#
#  Print all object types of an application together with their properties
#  and inheritance relations.
#

if (@ARGV != 1) {
   warn "usage: polymake --script list_all_properties APPLICATION_NAME\n";
   exit(1);
}

my $app=add Application($ARGV[0]);
print "application ", $app->name, " {\n";

foreach my $type (sort { $a->name cmp $b->name } values %{$app->types}) {
   print "  type ", $type->name;
   if (@{$type->super}) {
      print " : ", join(", ", map { $_->name } @{$type->super});
   }
   print " {\n";
   foreach my $prop (sort { $a->name cmp $b->name } values %{$type->properties}) {
      if ($prop->belongs_to == $type) {
	 print "    ", $prop->name, ":", $prop->type, "\n";
      }
   }
   print "  }\n";
}
print "}\n";


# Local Variables:
# mode: perl
# c-basic-offset:3
# End:
