aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1998-10-22 12:06:05 +0000
committerTom Tromey <tromey@gcc.gnu.org>1998-10-22 12:06:05 +0000
commit8603f9c5b022356e3993539be8c70358d935c710 (patch)
tree9b6b5425af73b8159f8c9b6dcf195daebe2e6914 /gcc/java/jcf-parse.c
parent8a829fd982378e9ae9f603e2df8d157e1f7c3d83 (diff)
downloadgcc-8603f9c5b022356e3993539be8c70358d935c710.zip
gcc-8603f9c5b022356e3993539be8c70358d935c710.tar.gz
gcc-8603f9c5b022356e3993539be8c70358d935c710.tar.bz2
jcf-io.c (find_class): Use saw_java_source to determine when to look for `.java' file.
* jcf-io.c (find_class): Use saw_java_source to determine when to look for `.java' file. * jcf-parse.c (saw_java_source): New global. (yyparse): Set it if `.java' file seen. * Make-lang.in (JAVA_SRCS): Added jcf-path.c. (GCJH_SOURCES): Likewise. * Makefile.in (datadir): New macro. (libjava_zip): Likewise. (JAVA_OBJS): Added jcf-path.o. (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o. (../gcjh$(exeext)): Likewise. (jcf-path.o): New target. * java-tree.h (fix_classpath): Removed decl. * jcf-parse.c (fix_classpath): Removed. (load_class): Don't call fix_classpath. * parse.y (read_import_dir): Don't call fix_classpath. * lex.h: Don't mention classpath. * lex.c (java_init_lex): Don't initialize classpath. * jcf-io.c (classpath): Removed global. (find_class): Use jcf_path iteration functions. Correctly search class path for .java file. (open_in_zip): New argument `is_system'. * jcf-dump.c (main): Call jcf_path_init. Recognize all new classpath-related options. * lang.c (lang_decode_option): Handle -fclasspath, -fCLASSPATH, and -I. (lang_init): Call jcf_path_init. * lang-options.h: Mention -I, -fclasspath, and -fCLASSPATH. * lang-specs.h: Handle -I. Minor cleanup to -M options. Correctly put braces around second string in each entry. * gjavah.c (main): Call jcf_path_init. Recognize all the new classpath-related options. (help): Updated for new options. * jcf.h: Declare functions from jcf-path.c. Don't mention `classpath' global. * jcf-path.c: New file. * jcf-depend.c: Include jcf.h. * jcf-write.c (localvar_alloc): Returns `void'. (localvar_free): Removed unused variable. * lang.c (OBJECT_SUFFIX): Define if not already defined. (init_parse): Use OBJECT_SUFFIX, not ".o". From-SVN: r23219
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 3df187f..81a1528 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1,5 +1,5 @@
/* Parser for Java(TM) .class files.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -61,6 +61,11 @@ tree current_class = NULL_TREE;
/* The class we started with. */
tree main_class = NULL_TREE;
+/* This is true if the user specified a `.java' file on the command
+ line. Otherwise it is 0. FIXME: this is temporary, until our
+ .java parser is fully working. */
+int saw_java_source = 0;
+
/* The FIELD_DECL for the current field. */
static tree current_field = NULL_TREE;
@@ -413,22 +418,6 @@ get_class_constant (JCF *jcf , int i)
}
void
-fix_classpath ()
-{
- static char default_path[] = DEFAULT_CLASS_PATH;
-
- if (classpath == NULL)
- {
- classpath = (char *) getenv ("CLASSPATH");
- if (classpath == NULL)
- {
- warning ("CLASSPATH not set");
- classpath = default_path;
- }
- }
-}
-
-void
DEFUN(jcf_out_of_synch, (jcf),
JCF *jcf)
{
@@ -465,8 +454,6 @@ load_class (class_or_name, verbose)
push_obstacks (&permanent_obstack, &permanent_obstack);
- if (!classpath)
- fix_classpath ();
/* Search in current zip first. */
if (find_in_current_zip (IDENTIFIER_POINTER (name),
IDENTIFIER_LENGTH (name), &jcf) == 0)
@@ -475,11 +462,14 @@ load_class (class_or_name, verbose)
{
if (verbose)
{
- error ("Cannot find class file class %s.",
+ error ("Cannot find class file for class %s.",
IDENTIFIER_POINTER (name));
TYPE_SIZE (class_or_name) = error_mark_node;
+#if 0
+ /* FIXME: what to do here? */
if (!strcmp (classpath, DEFAULT_CLASS_PATH))
fatal ("giving up");
+#endif
pop_obstacks (); /* FIXME: one pop_obstack() per function */
}
return;
@@ -730,12 +720,16 @@ yyparse ()
if (list[0])
{
- char *value;
+ char *value, len;
+
+ len = strlen (list);
+ if (len > 5 && ! strcmp (&list[len - 5], ".java"))
+ saw_java_source = 1;
if (*list != '/' && several_files)
obstack_grow (&temporary_obstack, "./", 2);
-
- obstack_grow0 (&temporary_obstack, list, strlen (list));
+
+ obstack_grow0 (&temporary_obstack, list, len);
value = obstack_finish (&temporary_obstack);
node = get_identifier (value);
IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
@@ -936,7 +930,8 @@ DEFUN(jcf_figure_file_type, (jcf),
if (magic == 0xcafebabe)
return JCF_CLASS;
- if (!open_in_zip (jcf, input_filename, NULL))
+ /* FIXME: is it a system file? */
+ if (!open_in_zip (jcf, input_filename, NULL, 0))
{
localToFile = ALLOC (sizeof (struct ZipFileCache));
bcopy (SeenZipFiles, localToFile, sizeof (struct ZipFileCache));