* This is a rather huge commit, which changes the build order of
[cacao.git] / src / vmcore / field.c
1 /* src/vmcore/field.c - field functions
2
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
7
8    This file is part of CACAO.
9
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.
14
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.
19
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
23    02110-1301, USA.
24
25    $Id: field.c 7246 2007-01-29 18:49:05Z twisti $
26
27 */
28
29
30 #include "config.h"
31
32 #include <stdio.h>
33
34 #include "vm/types.h"
35
36 #include "vmcore/field.h"
37 #include "vmcore/references.h"
38 #include "vmcore/utf8.h"
39
40
41 /* field_free ******************************************************************
42
43    Frees a fields' resources.
44
45 *******************************************************************************/
46
47 void field_free(fieldinfo *f)
48 {
49         /* empty */
50 }
51
52
53 /* field_printflags ************************************************************
54
55    (debugging only)
56
57 *******************************************************************************/
58
59 #if !defined(NDEBUG)
60 void field_printflags(fieldinfo *f)
61 {
62         if (f == NULL) {
63                 printf("NULL");
64                 return;
65         }
66
67         if (f->flags & ACC_PUBLIC)       printf(" PUBLIC");
68         if (f->flags & ACC_PRIVATE)      printf(" PRIVATE");
69         if (f->flags & ACC_PROTECTED)    printf(" PROTECTED");
70         if (f->flags & ACC_STATIC)       printf(" STATIC");
71         if (f->flags & ACC_FINAL)        printf(" FINAL");
72         if (f->flags & ACC_SYNCHRONIZED) printf(" SYNCHRONIZED");
73         if (f->flags & ACC_VOLATILE)     printf(" VOLATILE");
74         if (f->flags & ACC_TRANSIENT)    printf(" TRANSIENT");
75         if (f->flags & ACC_NATIVE)       printf(" NATIVE");
76         if (f->flags & ACC_INTERFACE)    printf(" INTERFACE");
77         if (f->flags & ACC_ABSTRACT)     printf(" ABSTRACT");
78 }
79 #endif
80
81
82 /* field_print *****************************************************************
83
84    (debugging only)
85
86 *******************************************************************************/
87
88 #if !defined(NDEBUG)
89 void field_print(fieldinfo *f)
90 {
91         if (f == NULL) {
92                 printf("(fieldinfo*)NULL");
93                 return;
94         }
95
96         utf_display_printable_ascii_classname(f->class->name);
97         printf(".");
98         utf_display_printable_ascii(f->name);
99         printf(" ");
100         utf_display_printable_ascii(f->descriptor);     
101
102         field_printflags(f);
103 }
104 #endif
105
106
107 /* field_println ***************************************************************
108
109    (debugging only)
110
111 *******************************************************************************/
112
113 #if !defined(NDEBUG)
114 void field_println(fieldinfo *f)
115 {
116         field_print(f);
117         printf("\n");
118 }
119 #endif
120
121 /* field_fieldref_print ********************************************************
122
123    (debugging only)
124
125 *******************************************************************************/
126
127 #if !defined(NDEBUG)
128 void field_fieldref_print(constant_FMIref *fr)
129 {
130         if (fr == NULL) {
131                 printf("(constant_FMIref *)NULL");
132                 return;
133         }
134
135         if (IS_FMIREF_RESOLVED(fr)) {
136                 printf("<field> ");
137                 field_print(fr->p.field);
138         }
139         else {
140                 printf("<fieldref> ");
141                 utf_display_printable_ascii_classname(fr->p.classref->name);
142                 printf(".");
143                 utf_display_printable_ascii(fr->name);
144                 printf(" ");
145                 utf_display_printable_ascii(fr->descriptor);
146         }
147 }
148 #endif
149
150 /* field_fieldref_println ******************************************************
151
152    (debugging only)
153
154 *******************************************************************************/
155
156 #if !defined(NDEBUG)
157 void field_fieldref_println(constant_FMIref *fr)
158 {
159         field_fieldref_print(fr);
160         printf("\n");
161 }
162 #endif
163
164 /*
165  * These are local overrides for various environment variables in Emacs.
166  * Please do not remove this and leave it at the end of the file, where
167  * Emacs will automagically detect them.
168  * ---------------------------------------------------------------------
169  * Local variables:
170  * mode: c
171  * indent-tabs-mode: t
172  * c-basic-offset: 4
173  * tab-width: 4
174  * End:
175  */