[ecj] Patch: FYI: add new jcf-path function
Tom Tromey
tromey@redhat.com
Sun Jun 4 20:08:00 GMT 2006
I'm checking this in on the gcj-eclipse branch.
This adds a new function to jcf-path that I needed for the ecj
integration. The patch to use this will come later.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* jcf-path.c (jcf_path_compute): New function.
* jcf.h (jcf_path_compute): Declare.
Index: jcf-path.c
===================================================================
--- jcf-path.c (revision 114362)
+++ jcf-path.c (working copy)
@@ -1,5 +1,5 @@
/* Handle CLASSPATH, -classpath, and path searching.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -457,6 +457,35 @@
return (void *) ent->next;
}
+char *
+jcf_path_compute (const char *prefix)
+{
+ struct entry *iter;
+ char *result;
+ int length = strlen (prefix) + 1;
+ int first;
+
+ for (iter = sealed; iter != NULL; iter = iter->next)
+ length += strlen (iter->name) + 1;
+
+ result = (char *) xmalloc (length);
+ strcpy (result, prefix);
+ first = 1;
+ for (iter = sealed; iter != NULL; iter = iter->next)
+ {
+ if (! first)
+ strcat (result, ":");
+ first = 0;
+ strcat (result, iter->name);
+ /* Ugly: we want to strip the '/' from zip entries when
+ computing a string classpath. */
+ if ((iter->flags & FLAG_ZIP) != 0)
+ result[strlen (result) - 1] = '\0';
+ }
+
+ return result;
+}
+
/* We guarantee that the return path will either be a zip file, or it
will end with a directory separator. */
char *
Index: jcf.h
===================================================================
--- jcf.h (revision 114362)
+++ jcf.h (working copy)
@@ -304,6 +304,7 @@
extern void *jcf_path_start (void);
extern void *jcf_path_next (void *);
extern char *jcf_path_name (void *);
+extern char *jcf_path_compute (const char *);
extern int jcf_path_is_zipfile (void *);
extern int jcf_path_is_system (void *);
extern int jcf_path_max_len (void);
More information about the Gcc-patches
mailing list