1 /* global.h - global definitions
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5 M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6 P. Tomsich, J. Wenninger
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: Reinhard Grafl
34 $Id: global.h 719 2003-12-08 14:26:05Z edwin $
44 #include "toolbox/list.h"
49 #define STATISTICS /* if enabled collects program statistics */
52 * SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
53 * of determining the sizes of objects on the heap.
55 #define SIZE_FROM_CLASSINFO
58 * CACAO_TYPECHECK activates typechecking (part of bytecode verification)
60 #define CACAO_TYPECHECK
63 * Macros for configuration of the typechecking code
65 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
66 * TYPECHECK_DEBUG activates debug checks in typecheck.c
67 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
68 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
69 * TYPECHECK_VERBOSE activates all debug messages
71 #ifdef CACAO_TYPECHECK
72 #define TYPEINFO_DEBUG
73 #define TYPECHECK_DEBUG
74 /*#define TYPEINFO_DEBUG_TEST*/
75 #define TYPECHECK_VERBOSE
76 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
77 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
78 #define TYPECHECK_VERBOSE_OPT
83 /* additional data types ******************************************************/
85 typedef void *voidptr; /* generic pointer */
87 typedef int bool; /* boolean data type */
93 /* immediate data union */
105 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
107 /* CAUTION: Don't change the numerical values! These constants are
108 * used as indices into the primitive type table.
110 #define PRIMITIVETYPE_INT 0
111 #define PRIMITIVETYPE_LONG 1
112 #define PRIMITIVETYPE_FLOAT 2
113 #define PRIMITIVETYPE_DOUBLE 3
114 #define PRIMITIVETYPE_BYTE 4
115 #define PRIMITIVETYPE_CHAR 5
116 #define PRIMITIVETYPE_SHORT 6
117 #define PRIMITIVETYPE_BOOLEAN 7
118 #define PRIMITIVETYPE_VOID 8
120 typedef void (*functionptr) (); /* generic function pointer */
123 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
125 /* shutdown function **********************************************************/
127 void cacao_shutdown(s4 status);
130 /* basic data types ***********************************************************/
132 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
133 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
134 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
135 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
136 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
141 /* Java class file constants **************************************************/
143 #define MAGIC 0xcafebabe
144 #define MINOR_VERSION 3
145 #define MAJOR_VERSION 45
147 #define CONSTANT_Class 7
148 #define CONSTANT_Fieldref 9
149 #define CONSTANT_Methodref 10
150 #define CONSTANT_InterfaceMethodref 11
151 #define CONSTANT_String 8
152 #define CONSTANT_Integer 3
153 #define CONSTANT_Float 4
154 #define CONSTANT_Long 5
155 #define CONSTANT_Double 6
156 #define CONSTANT_NameAndType 12
157 #define CONSTANT_Utf8 1
159 #define CONSTANT_UNUSED 0
161 #define ACC_PUBLIC 0x0001
162 #define ACC_PRIVATE 0x0002
163 #define ACC_PROTECTED 0x0004
164 #define ACC_STATIC 0x0008
165 #define ACC_FINAL 0x0010
166 #define ACC_SYNCHRONIZED 0x0020
167 #define ACC_VOLATILE 0x0040
168 #define ACC_TRANSIENT 0x0080
169 #define ACC_NATIVE 0x0100
170 #define ACC_INTERFACE 0x0200
171 #define ACC_ABSTRACT 0x0400
172 #define ACC_STRICT 0x0800
174 /* resolve typedef cycles *****************************************************/
176 typedef struct utf utf;
177 typedef struct literalstring literalstring;
178 typedef struct java_objectheader java_objectheader;
179 typedef struct classinfo classinfo;
180 typedef struct vftbl vftbl;
181 typedef u1* methodptr;
182 typedef struct fieldinfo fieldinfo;
183 typedef struct methodinfo methodinfo;
184 typedef struct arraydescriptor arraydescriptor;
187 /* constant pool entries *******************************************************
189 All constant pool entries need a data structure which contain the entrys
190 value. In some cases this structure exist already, in the remaining cases
191 this structure must be generated:
193 kind structure generated?
194 ----------------------------------------------------------------------
195 CONSTANT_Class classinfo no
196 CONSTANT_Fieldref constant_FMIref yes
197 CONSTANT_Methodref constant_FMIref yes
198 CONSTANT_InterfaceMethodref constant_FMIref yes
199 CONSTANT_String unicode no
200 CONSTANT_Integer constant_integer yes
201 CONSTANT_Float constant_float yes
202 CONSTANT_Long constant_long yes
203 CONSTANT_Double constant_double yes
204 CONSTANT_NameAndType constant_nameandtype yes
205 CONSTANT_Utf8 unicode no
208 *******************************************************************************/
210 /* data structures for hashtables ********************************************
213 All utf-symbols, javastrings and classes are stored in global hashtables,
214 so every symbol exists only once. Equal symbols have identical pointers.
215 The functions for adding hashtable elements search the table for the
216 element with the specified name/text and return it on success. Otherwise a
217 new hashtable element is created.
219 The hashtables use external linking for handling collisions. The hashtable
220 structure contains a pointer <ptr> to the array of hashtable slots. The
221 number of hashtable slots and therefore the size of this array is specified
222 by the element <size> of hashtable structure. <entries> contains the number
223 of all hashtable elements stored in the table, including those in the
225 The hashtable element structures (utf, literalstring, classinfo) contain
226 both a pointer to the next hashtable element as a link for the external hash
227 chain and the key of the element. The key is computed from the text of
228 the string or the classname by using up to 8 characters.
230 If the number of entries in the hashtable exceeds twice the size of the
231 hashtableslot-array it is supposed that the average length of the
232 external chains has reached a value beyond 2. Therefore the functions for
233 adding hashtable elements (utf_new, class_new, literalstring_new) double
234 the hashtableslot-array. In this restructuring process all elements have
235 to be inserted into the new hashtable and new external chains must be built.
238 example for the layout of a hashtable:
240 hashtable.ptr--> +-------------------+
244 +-------------------+ +-------------------+ +-------------------+
245 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
246 +-------------------+ +-------------------+ +-------------------+
247 | hashtable element |
248 +-------------------+ +-------------------+
249 | hashtable element |-->| hashtable element |-->NULL
250 +-------------------+ +-------------------+
251 | hashtable element |-->NULL
252 +-------------------+
256 +-------------------+
261 /* data structure for utf8 symbols ********************************************/
264 utf *hashlink; /* link for external hash chain */
265 int blength; /* text length in bytes */
266 char *text; /* pointer to text */
270 /* data structure of internal javastrings stored in global hashtable **********/
272 struct literalstring {
273 literalstring *hashlink; /* link for external hash chain */
274 java_objectheader *string;
278 /* data structure for calls from c code to java methods */
280 struct jni_callblock {
285 typedef struct jni_callblock jni_callblock;
288 /* data structure for accessing hashtables ************************************/
292 u4 entries; /* number of entries in the table */
293 void **ptr; /* pointer to hashtable */
297 /* data structures of remaining constant pool entries *************************/
299 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
300 classinfo *class; /* class containing this field/method/interface */
301 utf *name; /* field/method/interface name */
302 utf *descriptor; /* field/method/interface type descriptor string */
306 typedef struct { /* Integer */
311 typedef struct { /* Float */
316 typedef struct { /* Long */
321 typedef struct { /* Double */
326 typedef struct { /* NameAndType (Field or Method) */
327 utf *name; /* field/method name */
328 utf *descriptor; /* field/method type descriptor string */
329 } constant_nameandtype;
332 /* data structures of the runtime system **************************************/
334 /* objects *********************************************************************
336 All objects (and arrays) which resides on the heap need the following
337 header at the beginning of the data structure.
340 struct java_objectheader { /* header for all objects */
341 vftbl *vftbl; /* pointer to virtual function table */
346 /* arrays **********************************************************************
348 All arrays are objects (they need the object header with a pointer
349 to a vftbl (array class table). There is one class for each array
350 type. The array type is described by an arraydescriptor struct
351 which is referenced by the vftbl.
354 /* CAUTION: Don't change the numerical values! These constants (with
355 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
356 * primitive type table.
358 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
359 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
360 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
361 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
362 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
363 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
364 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
365 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
366 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
368 typedef struct java_arrayheader { /* header for all arrays */
369 java_objectheader objheader; /* object header */
370 s4 size; /* array size */
371 #ifdef SIZE_FROM_CLASSINFO
372 s4 alignedsize; /* phil */
378 /* structs for all kinds of arrays ********************************************/
380 typedef struct java_chararray {
381 java_arrayheader header;
385 typedef struct java_floatheader {
386 java_arrayheader header;
390 typedef struct java_doublearray {
391 java_arrayheader header;
395 /* booleanarray and bytearray need identical memory layout (access methods
396 use the same machine code */
398 typedef struct java_booleanarray {
399 java_arrayheader header;
403 typedef struct java_bytearray {
404 java_arrayheader header;
408 typedef struct java_shortarray {
409 java_arrayheader header;
413 typedef struct java_intarray {
414 java_arrayheader header;
418 typedef struct java_longarray {
419 java_arrayheader header;
423 /* objectarray and arrayarray need identical memory layout (access methods
424 use the same machine code */
426 typedef struct java_objectarray {
427 java_arrayheader header;
428 java_objectheader *data[1];
432 /* structure for primitive classes ********************************************/
434 typedef struct primitivetypeinfo {
435 classinfo *class_wrap; /* class for wrapping primitive type */
436 classinfo *class_primitive; /* primitive class */
437 char *wrapname; /* name of class for wrapping */
438 char typesig; /* one character type signature */
439 char *name; /* name of primitive class */
440 char *arrayname; /* name of primitive array class */
441 classinfo *arrayclass; /* primitive array class */
442 vftbl *arrayvftbl; /* vftbl of primitive array class */
446 /* field, method and class structures *****************************************/
449 typedef struct xtafldinfo {
451 classinfo *fldClassType;
452 classSet *XTAclassSet; /* field class type set */
456 /* fieldinfo ******************************************************************/
458 struct fieldinfo { /* field of a class */
459 s4 flags; /* ACC flags */
460 s4 type; /* basic data type */
461 utf *name; /* name of field */
462 utf *descriptor; /* JavaVM descriptor string of field */
464 s4 offset; /* offset from start of object (instance variables) */
466 imm_union value; /* storage for static values (class variables) */
474 /* exceptiontable *************************************************************/
476 typedef struct xtable { /* exceptiontable entry in a method */
477 s4 startpc; /* start pc of guarded area (inclusive) */
478 struct basicblock *start;
480 s4 endpc; /* end pc of guarded area (exklusive) */
481 struct basicblock *end;
483 s4 handlerpc; /* pc of exception handler */
484 struct basicblock *handler;
486 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
487 struct xtable *next; /* used to build a list of exception when */
488 /* loops are copied */
489 struct xtable *down; /* instead of the old array, a list is used */
493 typedef struct exceptiontable { /* exceptiontable entry in a method */
494 s4 startpc; /* start pc of guarded area (inclusive) */
495 s4 endpc; /* end pc of guarded area (exklusive) */
496 s4 handlerpc; /* pc of exception handler */
497 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
501 /* methodinfo static info ****************************************************/
502 typedef struct xtainfo {
503 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
504 classSet *XTAclassSet; /* method class type set */
505 /*classSet *PartClassSet */ /* method class type set */
507 classSetNode *paramClassSet; /* cone set of methods parameters */
509 methSet *calls; /* methods this method calls */
510 methSet *calledBy; /* methods that call this method */
511 methSet *marked; /* methods that marked by this method */
512 /*methSet *markedBy*/
513 fldSet *fldsUsed; /* fields used by this method */
514 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
515 bool chgdSinceLastParse; /* Changed since last parse ? */
519 /* methodinfo *****************************************************************/
521 struct methodinfo { /* method structure */
522 s4 flags; /* ACC flags */
523 utf *name; /* name of method */
524 utf *descriptor; /* JavaVM descriptor string of method */
525 s4 returntype; /* only temporary valid, return type */
526 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
527 s4 paramcount; /* only temporary valid, parameter count */
528 u1 *paramtypes; /* only temporary valid, parameter types */
529 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
531 classinfo *class; /* class, the method belongs to */
532 s4 vftblindex; /* index of method in virtual function table
533 (if it is a virtual method) */
534 s4 maxstack; /* maximum stack depth of method */
535 s4 maxlocals; /* maximum number of local variables */
536 s4 jcodelength; /* length of JavaVM code */
537 u1 *jcode; /* pointer to JavaVM code */
539 s4 exceptiontablelength;/* exceptiontable length */
540 exceptiontable *exceptiontable;
541 /* the exceptiontable */
543 u1 *stubroutine; /* stub for compiling or calling natives */
544 s4 mcodelength; /* legth of generated machine code */
545 u1 *mcode; /* pointer to machine code */
546 u1 *entrypoint; /* entry point in machine code */
551 s4 methodUsed; /* marked (might be used later) /not used /used */
552 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
553 /* should # method def'd and used be kept after static parse (will it be used?) */
559 /* innerclassinfo *************************************************************/
561 typedef struct innerclassinfo {
562 classinfo *inner_class; /* inner class pointer */
563 classinfo *outer_class; /* outer class pointer */
564 utf *name; /* innerclass name */
565 s4 flags; /* ACC flags */
569 /* classinfo ******************************************************************/
571 struct classinfo { /* class structure */
572 java_objectheader header; /* classes are also objects */
573 java_objectarray* signers;
574 struct java_security_ProtectionDomain* pd;
575 struct java_lang_VMClass* vmClass;
576 struct java_lang_reflect_Constructor* constructor;
579 s4 initializing_thread; /* gnu classpath */
580 s4 erroneous_state; /* gnu classpath */
581 struct gnu_classpath_RawData* vmData; /* gnu classpath */
583 s4 flags; /* ACC flags */
584 utf *name; /* class name */
586 s4 cpcount; /* number of entries in constant pool */
587 u1 *cptags; /* constant pool tags */
588 voidptr *cpinfos; /* pointer to constant pool info structures */
590 classinfo *super; /* super class pointer */
591 classinfo *sub; /* sub class pointer */
592 classinfo *nextsub; /* pointer to next class in sub class list */
594 s4 interfacescount; /* number of interfaces */
595 classinfo **interfaces; /* pointer to interfaces */
597 s4 fieldscount; /* number of fields */
598 fieldinfo *fields; /* field table */
600 s4 methodscount; /* number of methods */
601 methodinfo *methods; /* method table */
603 listnode listnode; /* linkage */
605 bool initialized; /* true, if class already initialised */
606 bool loaded; /* true, if class already loaded */
607 bool linked; /* true, if class already linked */
608 s4 index; /* hierarchy depth (classes) or index
610 s4 instancesize; /* size of an instance of this class */
611 #ifdef SIZE_FROM_CLASSINFO
612 s4 alignedsize; /* size of an instance, aligned to the
613 allocation size on the heap */
616 vftbl *vftbl; /* pointer to virtual function table */
618 methodinfo *finalizer; /* finalizer method */
620 u2 innerclasscount; /* number of inner classes */
621 innerclassinfo *innerclass;
623 classinfo *hashlink; /* link for external hash chain */
624 bool classvftbl; /* has its own copy of the Class vtbl */
626 s4 classUsed; /* 0= not used 1 = used CO-RT */
628 classSetNode *impldBy; /* implemented by class set */
631 /* check if class is an array class. Only use for linked classes! */
632 #define CLASS_IS_ARRAY(clsinfo) (clsinfo->vftbl->arraydesc != NULL)
635 /* virtual function table ******************************************************
637 The vtbl has a bidirectional layout with open ends at both sides.
638 interfacetablelength gives the number of entries of the interface table at
639 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
640 vftbllength gives the number of entries of table at the end of the vftbl.
642 runtime type check (checkcast):
644 Different methods are used for runtime type check depending on the
645 argument of checkcast/instanceof.
647 A check against a class is implemented via relative numbering on the class
648 hierachy tree. The tree is numbered in a depth first traversal setting
649 the base field and the diff field. The diff field gets the result of
650 (high - base) so that a range check can be implemented by an unsigned
651 compare. A sub type test is done by checking the inclusion of base of
652 the sub class in the range of the superclass.
654 A check against an interface is implemented via the interfacevftbl. If the
655 interfacevftbl contains a nonnull value a class is a subclass of this
660 Like standard virtual methods interface methods are called using
661 virtual function tables. All interfaces are numbered sequentially
662 (starting with zero). For each class there exist an interface table
663 of virtual function tables for each implemented interface. The length
664 of the interface table is determined by the highest number of an
665 implemented interface.
667 The following example assumes a class which implements interface 0 and 3:
669 interfacetablelength = 4
672 +-----------+ | method 2 |---> method z
673 | class | | method 1 |---> method y
674 +-----------+ | method 0 |---> method x
675 | ivftbl 0 |----------> +----------+
676 vftblptr ---> +-----------+
677 | ivftbl -1 |--> NULL +----------+
678 | ivftbl -2 |--> NULL | method 1 |---> method x
679 | ivftbl -3 |-----+ | method 0 |---> method a
680 +-----------+ +----> +----------+
687 interfacevftbllength ---> +---------------+
689 *******************************************************************************/
692 methodptr *interfacetable[1]; /* interface table (access via macro) */
694 classinfo *class; /* class, the vtbl belongs to */
696 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
698 s4 vftbllength; /* virtual function table length */
699 s4 interfacetablelength; /* interface table length */
701 s4 baseval; /* base for runtime type check */
702 /* (-index for interfaces) */
703 s4 diffval; /* high - base for runtime type check */
705 s4 *interfacevftbllength; /* length of interface vftbls */
707 methodptr table[1]; /* class vftbl */
710 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
713 /* arraydescriptor ************************************************************
715 For every array class an arraydescriptor is allocated which
716 describes the array class.
717 The arraydescriptor is referenced from the vftbl of the array
720 *******************************************************************************/
722 struct arraydescriptor {
723 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
724 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
725 short arraytype; /* ARRAYTYPE_* constant */
726 short dimension; /* dimension of the array (always >= 1) */
727 s4 dataoffset; /* offset of the array data from object pointer */
728 s4 componentsize; /* size of a component in bytes */
729 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
733 /* references to some system classes ******************************************/
735 extern classinfo *class_java_lang_Object;
736 extern classinfo *class_java_lang_String;
737 extern classinfo *class_java_lang_Throwable;
738 extern classinfo *class_java_lang_Cloneable;
739 extern classinfo *class_java_io_Serializable;
740 extern classinfo *class_java_lang_ClassCastException;
741 extern classinfo *class_java_lang_NullPointerException;
742 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
743 extern classinfo *class_java_lang_NegativeArraySizeException;
744 extern classinfo *class_java_lang_OutOfMemoryError;
745 extern classinfo *class_java_lang_ArithmeticException;
746 extern classinfo *class_java_lang_ArrayStoreException;
747 extern classinfo *class_java_lang_ThreadDeath;
748 extern classinfo *pseudo_class_Arraystub;
749 extern classinfo *pseudo_class_Null;
750 extern classinfo *pseudo_class_New;
751 extern vftbl *pseudo_class_Arraystub_vftbl;
754 /* instances of some system classes *******************************************/
756 extern java_objectheader *proto_java_lang_ClassCastException;
757 extern java_objectheader *proto_java_lang_NullPointerException;
758 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
759 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
760 extern java_objectheader *proto_java_lang_OutOfMemoryError;
761 extern java_objectheader *proto_java_lang_ArithmeticException;
762 extern java_objectheader *proto_java_lang_ArrayStoreException;
763 extern java_objectheader *proto_java_lang_ThreadDeath;
766 /* flag variables *************************************************************/
768 extern bool compileall;
769 extern bool runverbose;
771 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
772 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
773 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
774 #ifdef TYPECHECK_VERBOSE_OPT
775 extern bool typecheckverbose;
778 //extern int pClassHeir;
779 //extern int pCallgraph;
780 //extern int pOpcodes;
783 //extern void RT_jit_parse(methodinfo *m);
786 /* statistic variables ********************************************************/
788 extern int count_class_infos;
789 extern int count_const_pool_len;
790 extern int count_vftbl_len;
791 extern int count_utf_len;
792 extern int count_all_methods;
793 extern int count_vmcode_len;
794 extern int count_extable_len;
795 extern int count_class_loads;
796 extern int count_class_inits;
797 extern int count_utf_new;
798 extern int count_utf_new_found;
801 /* table of primitive types ***************************************************/
803 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
804 * constants (except ARRAYTYPE_OBJECT).
806 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
809 /* macros for descriptor parsing **********************************************/
811 /* utf_ptr must point to the 'L' or the '[' of a field descriptor.
812 * After the macro call utf_ptr points to the first character after
813 * the field descriptor.
815 * CAUTION: This macro does not check for an unexpected end of the
818 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
819 { while (*(utf_ptr)=='[') (utf_ptr)++; \
820 if (*(utf_ptr)++=='L') \
821 while(*(utf_ptr)++ != ';') /* skip */; }
823 * utf_ptr....points to first char of descriptor
824 * end_ptr....points to first char after the end of the string
825 * errorflag..must be initialized (to false) by the caller!
827 * utf_ptr....points to first char after the descriptor
828 * errorflag..set to true if the string ended unexpectedly
830 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
831 { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
832 if ((utf_ptr) == (end_ptr)) \
833 (errorflag) = true; \
835 if (*(utf_ptr)++=='L') { \
836 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') /* skip */; \
837 if ((utf_ptr)[-1] != ';') \
838 (errorflag) = true; }}
840 #endif /* _GLOBAL_H */
844 * These are local overrides for various environment variables in Emacs.
845 * Please do not remove this and leave it at the end of the file, where
846 * Emacs will automagically detect them.
847 * ---------------------------------------------------------------------
850 * indent-tabs-mode: t