1 /* libjclass - Library for reading java class files
2  * Copyright (C) 2003  Nicos Panayides
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  * $Id: class_loader.h,v 1.14 2004/05/07 11:53:13 anarxia Exp $
19  */
20 
21 #ifndef __JCLASS_CLASS_LOADER_H__
22 #define __JCLASS_CLASS_LOADER_H__
23 
24 #include <jclassconfig.h>
25 #include <stdio.h>
26 #include <jclass/jar.h>
27 
28 #ifdef _cplusplus
29   extern "C" {
30 #endif
31 
32 typedef struct {
33 	FILE* file_ptr;
34 	char* data;
35 } ClassFile;
36 
37 typedef struct ClassPath {
38 	char *path;
39 	struct ClassPath *next;
40 	struct ClassPath *tail;
41 } ClassPath;
42 
43 #define foreach_in_classpath(node, path) for(node = path; node; node = node->next)
44 
45 typedef struct  {
46 		char* (*get_class_filename) (const char*, const ClassPath*);
47 		ClassFile* (*get_class_file) (const char*, const ClassPath*);
48 		ClassPath* (*get_classpath) (const char*, const char*);
49 } ClassLoader;
50 
51 ClassLoader* jclass_classloader_get_current(void);
52 ClassLoader* jclass_classloader_get_default(void);
53 void jclass_classloader_set(ClassLoader* classloader);
54 
55 char* jclass_classloader_get_class_filename(const char* class_name, const ClassPath *classpath);
56 
57 ClassFile* jclass_classloader_get_class_file(const char* class_name, const ClassPath *classpath);
58 
59 ClassPath* jclass_classloader_get_classpath(const char* classpath_string, const char* bootclasspath_string);
60 void jclass_classloader_classpath_free(ClassPath *path);
61 
62 #ifdef _cplusplus
63   }
64 #endif
65 #endif /* CLASS_LOADER_H */
66