1 /* vm/references.h - references to classes/fields/methods
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Edwin Steiner
31 $Id: references.h 2561 2005-06-06 15:21:19Z twisti $
35 #ifndef _REFERENCES_H_
36 #define _REFERENCES_H_
38 #include "vm/global.h"
42 /*----------------------------------------------------------------------------*/
45 /* This header files defines the following types used for references to */
46 /* classes/methods/fields and descriptors: */
48 /* classinfo * a loaded class */
49 /* constant_classref a symbolic reference */
50 /* classref_or_classinfo a loaded class or a symbolic reference */
52 /* constant_FMIref a symb. ref. to a field/method/intf.method */
54 /* typedesc * describes a field type */
55 /* methoddesc * descrives a method type */
56 /* parseddesc describes a field type or a method type */
57 /*----------------------------------------------------------------------------*/
59 /* forward declarations *******************************************************/
61 typedef struct classinfo classinfo;
62 typedef struct typedesc typedesc;
63 typedef struct methoddesc methoddesc;
66 /* structs ********************************************************************/
68 /* constant_classref **********************************************************/
70 typedef struct constant_classref {
71 void *pseudo_vftbl; /* for distinguishing it from classinfo */
72 classinfo *referer; /* class containing the reference */
73 utf *name; /* name of the class refered to */
77 /* classref_or_classinfo ******************************************************/
80 constant_classref *ref; /* a symbolic class reference */
81 classinfo *cls; /* an already loaded class */
82 void *any; /* used for general access (x != NULL,...) */
83 } classref_or_classinfo;
86 /* parseddesc *****************************************************************/
88 typedef union parseddesc {
89 typedesc *fd; /* parsed field descriptor */
90 methoddesc *md; /* parsed method descriptor */
91 void *any; /* used for simple test against NULL */
95 /* constant_FMIref ************************************************************/
97 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
98 constant_classref *classref; /* class containing this field/meth./intfm. */
99 utf *name; /* field/method/interfacemethod name */
100 utf *descriptor; /* field/method/intfmeth. type descriptor string */
101 parseddesc parseddesc; /* parsed descriptor */
105 /* macros *********************************************************************/
107 /* a value that never occurrs in classinfo.header.vftbl */
108 #define CLASSREF_PSEUDO_VFTBL ((void *) 1)
110 /* macro for testing if a classref_or_classinfo is a classref */
111 /* `reforinfo` is only evaluated once */
112 #define IS_CLASSREF(reforinfo) \
113 ((reforinfo).ref->pseudo_vftbl == CLASSREF_PSEUDO_VFTBL)
115 /* macro for casting a classref/classinfo * to a classref_or_classinfo */
116 #define CLASSREF_OR_CLASSINFO(value) \
117 (*((classref_or_classinfo *)(&(value))))
119 /* initialize a constant_classref with referer `ref` and name `classname` */
121 #define CLASSREF_INIT(c,ref,classname) \
123 (c).pseudo_vftbl = CLASSREF_PSEUDO_VFTBL; \
124 (c).referer = (ref); \
125 (c).name = (classname); \
128 #endif /* _REFERENCES_H_ */
131 * These are local overrides for various environment variables in Emacs.
132 * Please do not remove this and leave it at the end of the file, where
133 * Emacs will automagically detect them.
134 * ---------------------------------------------------------------------
137 * indent-tabs-mode: t
141 * vim:noexpandtab:sw=4:ts=4: