1 # classes.pl - A perl program to generate most of the contents of
2 # javaprims.h automatically.
4 # Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Free Software
7 # This file is part of libgcj.
9 # This software is copyrighted work licensed under the terms of the
10 # Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
13 # Usage: cd <srcdir>/classpath/lib ; perl ../../scripts/classes.pl.
27 die "couldn't find java directory\n";
36 local ($dir, $indent) = @_;
37 local (@subdirs) = ();
38 local (%classes) = ();
40 local ($d) = new DirHandle
$dir;
45 while (defined ($name = $d->read))
47 next if $name eq 'CVS';
48 next if $name eq '.svn';
50 next if $name eq '..';
56 # We only generate decls for java.lang, java.io, and
60 if (-d
($dir . '/' . $name))
62 push (@subdirs, $name);
65 next unless $name =~ s/\.class$//;
72 local ($spaces) = ' ' x
$indent;
74 ($classname = $dir) =~ s/^.*\///;
75 print $spaces, "namespace ", $classname, "\n";
78 foreach (sort keys %classes)
80 print $spaces, " class ", $_, ";\n";
82 print "\n" if scalar @classes > 0 && scalar @subdirs > 0;
85 foreach (sort @subdirs)
87 print "\n" unless $first;
89 &scan
("$dir/$_", $indent + 2);