gcc/libjava/classpath/lib/mkcollections.pl.in
Mark Wielaard ac1ed908de Imported GNU Classpath 0.92
2006-08-14  Mark Wielaard  <mark@klomp.org>

       Imported GNU Classpath 0.92
       * HACKING: Add more importing hints. Update automake version
       requirement.

       * configure.ac (gconf-peer): New enable AC argument.
       Add --disable-gconf-peer and --enable-default-preferences-peer
       to classpath configure when gconf is disabled.
       * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
       gnu/java/awt/dnd/peer/gtk to bc. Classify
       gnu/java/security/Configuration.java as generated source file.

       * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
       gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
       gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
       gnu/java/lang/management/VMThreadMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryMXBeanImpl.java,
       gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
       classes.
       * java/lang/management/VMManagementFactory.java: Likewise.
       * java/net/VMURLConnection.java: Likewise.
       * gnu/java/nio/VMChannel.java: Likewise.

       * java/lang/Thread.java (getState): Add stub implementation.
       * java/lang/Class.java (isEnum): Likewise.
       * java/lang/Class.h (isEnum): Likewise.

       * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.

       * javax/naming/spi/NamingManager.java: New override for StackWalker
       functionality.

       * configure, sources.am, Makefile.in, gcj/Makefile.in,
       include/Makefile.in, testsuite/Makefile.in: Regenerated.

From-SVN: r116139
2006-08-14 23:12:35 +00:00

142 lines
3.5 KiB
Perl
Executable File

#!@PERL@
#
# mkcollections.pl - small perl script to convert GNU Classpath's
# Collection classes into its own package for java 1.1
#
# USAGE: mkcollections.pl <Destination-Path>
#
# Copyright (C) 2000 Free Software Foundation, Inc.
#
# 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.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
my $destpath=@COLLECTIONS_PREFIX@;
my $classpath=pop;
my @javalangclasses=qw(UnsupportedOperationException
Comparable
Iterable);
my @javautilclasses=qw(AbstractCollection
AbstractList
AbstractMap
AbstractSequentialList
AbstractSet
ArrayList
Arrays
List
Collection
Collections
Comparator
ConcurrentModificationException
HashMap
HashSet
Hashtable
Iterator
LinkedList
ListIterator
Map
NoSuchElementException
Random
RandomAccess
Set
SortedMap
SortedSet
TreeMap
TreeSet
Vector);
my $destPkg = $destpath;
$destPkg =~ s!/!.!g;
my %imports = ( "Collections" => [ "Enumeration" ],
"Hashtable" => [ "Dictionary", "Enumeration" ],
"Vector" => [ "Enumeration" ]);
sub mymkdir ($)
{
my ($dir) = @_;
if ($dir =~ /^(.*)\/\w+$/)
{
$parentdir = "$1";
if (! (-d $parentdir))
{
mymkdir ($parentdir);
}
}
print "$dir";
mkdir ($dir, 0777);
}
sub convert($$$) {
my ($file, $infile, $outfile) = @_;
open (INPUT, "<$infile") || die "Could not open ", $infile, " for reading\n";
my $dir = "$outfile";
$dir =~ /^(.*)\/\S+\.java$/ and
$dir = "$1";
if (! (-d $dir)) {
mymkdir ($dir);
}
open (OUTPUT, ">$outfile") || die "Could not open ", $outfile, " for writing\n";
print OUTPUT <<'EOF';
/* This file was converted from the GNU Classpath Project by a
* perl script, written by Jochen Hoenicke <jochen\@gnu.org>.
*/
EOF
while (<INPUT>) {
$_ = "package $destPkg;\n" if ($_ =~ /^package java.(lang|util);$/);
next if $_ =~ /^import java.io.Object.*putStream.*Field;$/;
next if $_ =~ /^import java.io.ObjectStreamField;$/;
for $clazz (@javalangclasses) {
$_ =~ s/java.lang.$clazz/$clazz/g;
}
for $clazz (@javautilclasses) {
$_ =~ s/java.util.$clazz/$clazz/g;
}
$_ =~ s/abstract (interface)/$1/g;
print OUTPUT $_;
if ($_ =~ /^package $destPkg;$/
&& exists $imports{$file}) {
for $imp (@{$imports{$file}}) {
print OUTPUT "import java.util.$imp;\n";
}
}
}
close (OUTPUT);
close (INPUT);
}
my $file;
for $file (@javalangclasses) {
my $infile = "$classpath/java/lang/$file.java";
my $outfile = "$destpath/$file.java";
print "$outfile\n";
convert ($file, $infile, $outfile);
}
for $file (@javautilclasses) {
my $infile = "$classpath/java/util/$file.java";
my $outfile = "$destpath/$file.java";
print "$outfile\n";
convert ($file, $infile, $outfile);
}