1 /* src/vmcore/field.c - field functions
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, 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., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: field.c 8132 2007-06-22 11:15:47Z twisti $
37 #include "vmcore/class.h"
38 #include "vmcore/field.h"
39 #include "vmcore/primitive.h"
40 #include "vmcore/references.h"
41 #include "vmcore/utf8.h"
44 /* field_get_type **************************************************************
46 Returns the type of the field as class.
48 *******************************************************************************/
50 classinfo *field_get_type(fieldinfo *f)
58 if (td->type == TYPE_ADR) {
61 u = td->classref->name;
63 /* load the class of the field-type with the field's
66 c = load_class_from_classloader(u, f->class->classloader);
69 c = primitive_class_get_by_type(td->decltype);
76 /* field_free ******************************************************************
78 Frees a fields' resources.
80 *******************************************************************************/
82 void field_free(fieldinfo *f)
88 /* field_printflags ************************************************************
92 *******************************************************************************/
95 void field_printflags(fieldinfo *f)
102 if (f->flags & ACC_PUBLIC) printf(" PUBLIC");
103 if (f->flags & ACC_PRIVATE) printf(" PRIVATE");
104 if (f->flags & ACC_PROTECTED) printf(" PROTECTED");
105 if (f->flags & ACC_STATIC) printf(" STATIC");
106 if (f->flags & ACC_FINAL) printf(" FINAL");
107 if (f->flags & ACC_SYNCHRONIZED) printf(" SYNCHRONIZED");
108 if (f->flags & ACC_VOLATILE) printf(" VOLATILE");
109 if (f->flags & ACC_TRANSIENT) printf(" TRANSIENT");
110 if (f->flags & ACC_NATIVE) printf(" NATIVE");
111 if (f->flags & ACC_INTERFACE) printf(" INTERFACE");
112 if (f->flags & ACC_ABSTRACT) printf(" ABSTRACT");
117 /* field_print *****************************************************************
121 *******************************************************************************/
124 void field_print(fieldinfo *f)
127 printf("(fieldinfo*)NULL");
131 utf_display_printable_ascii_classname(f->class->name);
133 utf_display_printable_ascii(f->name);
135 utf_display_printable_ascii(f->descriptor);
142 /* field_println ***************************************************************
146 *******************************************************************************/
149 void field_println(fieldinfo *f)
156 /* field_fieldref_print ********************************************************
160 *******************************************************************************/
163 void field_fieldref_print(constant_FMIref *fr)
166 printf("(constant_FMIref *)NULL");
170 if (IS_FMIREF_RESOLVED(fr)) {
172 field_print(fr->p.field);
175 printf("<fieldref> ");
176 utf_display_printable_ascii_classname(fr->p.classref->name);
178 utf_display_printable_ascii(fr->name);
180 utf_display_printable_ascii(fr->descriptor);
185 /* field_fieldref_println ******************************************************
189 *******************************************************************************/
192 void field_fieldref_println(constant_FMIref *fr)
194 field_fieldref_print(fr);
200 * These are local overrides for various environment variables in Emacs.
201 * Please do not remove this and leave it at the end of the file, where
202 * Emacs will automagically detect them.
203 * ---------------------------------------------------------------------
206 * indent-tabs-mode: t