OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [scripts/] [classes.pl] - Blame information for rev 780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 762 jeremybenn
# classes.pl - A perl program to generate most of the contents of
2
# javaprims.h automatically.
3
 
4
# Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006, 2007  Free Software
5
# Foundation
6
#
7
# This file is part of libgcj.
8
#
9
# This software is copyrighted work licensed under the terms of the
10
# Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
11
# details.
12
 
13
# Usage: cd <srcdir>/classpath/lib ; perl ../../scripts/classes.pl.
14
 
15
use DirHandle;
16
 
17
if (-d 'java')
18
{
19
    # Ok here.
20
}
21
elsif (-d '../java')
22
{
23
    chdir ('..');
24
}
25
else
26
{
27
    die "couldn't find java directory\n";
28
}
29
 
30
&scan ('java', 2);
31
 
32
exit 0;
33
 
34
sub scan
35
{
36
    local ($dir, $indent) = @_;
37
    local (@subdirs) = ();
38
    local (%classes) = ();
39
 
40
    local ($d) = new DirHandle $dir;
41
    local (*JFILE);
42
    local ($name);
43
    if (defined $d)
44
    {
45
        while (defined ($name = $d->read))
46
        {
47
            next if $name eq 'CVS';
48
            next if $name eq '.svn';
49
            next if $name eq '.';
50
            next if $name eq '..';
51
            if ($dir eq 'java'
52
                && $name ne 'lang'
53
                && $name ne 'util'
54
                && $name ne 'io')
55
            {
56
                # We only generate decls for java.lang, java.io, and
57
                # java.util.
58
                next;
59
            }
60
            if (-d ($dir . '/' . $name))
61
            {
62
                push (@subdirs, $name);
63
                next;
64
            }
65
            next unless $name =~ s/\.class$//;
66
            $classes{$name} = 1;
67
        }
68
 
69
        undef $d;
70
    }
71
 
72
    local ($spaces) = ' ' x $indent;
73
    local ($classname);
74
    ($classname = $dir) =~ s/^.*\///;
75
    print $spaces, "namespace ", $classname, "\n";
76
    print $spaces, "{\n";
77
 
78
    foreach (sort keys %classes)
79
    {
80
        print $spaces, "  class ", $_, ";\n";
81
    }
82
    print "\n" if scalar @classes > 0 && scalar @subdirs > 0;
83
 
84
    local ($first) = 1;
85
    foreach (sort @subdirs)
86
    {
87
        print "\n" unless $first;
88
        $first = 0;
89
        &scan ("$dir/$_", $indent + 2);
90
    }
91
 
92
    print $spaces, "}\n";
93
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.