]> git.sur5r.net Git - cc65/blob - src/cc65/datatype.h
Change the OptStackOps function so that it adjusts the instruction pointer
[cc65] / src / cc65 / datatype.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                datatype.h                                 */
4 /*                                                                           */
5 /*               Type string handling for the cc65 C compiler                */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2008 Ullrich von Bassewitz                                       */
10 /*               Roemerstrasse 52                                            */
11 /*               D-70794 Filderstadt                                         */
12 /* EMail:        uz@cc65.org                                                 */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef DATATYPE_H
37 #define DATATYPE_H
38
39
40
41 #include <stdio.h>
42
43 /* common */
44 #include "attrib.h"
45 #include "inline.h"
46 #include "mmodel.h"
47
48 /* cc65 */
49 #include "funcdesc.h"
50
51
52
53 /*****************************************************************************/
54 /*                                   Data                                    */
55 /*****************************************************************************/
56
57
58
59
60 /* Basic data types */
61 enum {
62     T_END           = 0x000000,
63
64     /* Basic types */
65     T_TYPE_NONE     = 0x000000,
66     T_TYPE_CHAR     = 0x000001,
67     T_TYPE_SHORT    = 0x000002,
68     T_TYPE_INT      = 0x000003,
69     T_TYPE_LONG     = 0x000004,
70     T_TYPE_LONGLONG = 0x000005,
71     T_TYPE_ENUM     = 0x000006,
72     T_TYPE_FLOAT    = 0x000007,
73     T_TYPE_DOUBLE   = 0x000008,
74     T_TYPE_VOID     = 0x000009,
75     T_TYPE_STRUCT   = 0x00000A,
76     T_TYPE_UNION    = 0x00000B,
77     T_TYPE_ARRAY    = 0x00000C,
78     T_TYPE_PTR      = 0x00000D,
79     T_TYPE_FUNC     = 0x00000E,
80     T_MASK_TYPE     = 0x00000F,
81
82     /* Type classes */
83     T_CLASS_NONE    = 0x000000,
84     T_CLASS_INT     = 0x000010,
85     T_CLASS_FLOAT   = 0x000020,
86     T_CLASS_PTR     = 0x000030,
87     T_CLASS_STRUCT  = 0x000040,
88     T_CLASS_FUNC    = 0x000050,
89     T_MASK_CLASS    = 0x000070,
90
91     /* Type signedness */
92     T_SIGN_NONE     = 0x000000,
93     T_SIGN_UNSIGNED = 0x000080,
94     T_SIGN_SIGNED   = 0x000100,
95     T_MASK_SIGN     = 0x000180,
96
97     /* Type size modifiers */
98     T_SIZE_NONE     = 0x000000,
99     T_SIZE_SHORT    = 0x000200,
100     T_SIZE_LONG     = 0x000400,
101     T_SIZE_LONGLONG = 0x000600,
102     T_MASK_SIZE     = 0x000600,
103
104     /* Type qualifiers */
105     T_QUAL_NONE     = 0x000000,
106     T_QUAL_CONST    = 0x000800,
107     T_QUAL_VOLATILE = 0x001000,
108     T_QUAL_RESTRICT = 0x002000,
109     T_QUAL_NEAR     = 0x004000,
110     T_QUAL_FAR      = 0x008000,
111     T_QUAL_ADDRSIZE = T_QUAL_NEAR | T_QUAL_FAR,
112     T_QUAL_FASTCALL = 0x010000,
113     T_MASK_QUAL     = 0x01F800,
114
115     /* Types */
116     T_CHAR      = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_NONE,
117     T_SCHAR     = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_NONE,
118     T_UCHAR     = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_NONE,
119     T_SHORT     = T_TYPE_SHORT    | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_SHORT,
120     T_USHORT    = T_TYPE_SHORT    | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_SHORT,
121     T_INT       = T_TYPE_INT      | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_NONE,
122     T_UINT      = T_TYPE_INT      | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_NONE,
123     T_LONG      = T_TYPE_LONG     | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_LONG,
124     T_ULONG     = T_TYPE_LONG     | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_LONG,
125     T_LONGLONG  = T_TYPE_LONGLONG | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_LONGLONG,
126     T_ULONGLONG = T_TYPE_LONGLONG | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_LONGLONG,
127     T_ENUM      = T_TYPE_ENUM     | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_NONE,
128     T_FLOAT     = T_TYPE_FLOAT    | T_CLASS_FLOAT  | T_SIGN_NONE     | T_SIZE_NONE,
129     T_DOUBLE    = T_TYPE_DOUBLE   | T_CLASS_FLOAT  | T_SIGN_NONE     | T_SIZE_NONE,
130     T_VOID      = T_TYPE_VOID     | T_CLASS_NONE   | T_SIGN_NONE     | T_SIZE_NONE,
131     T_STRUCT    = T_TYPE_STRUCT   | T_CLASS_STRUCT | T_SIGN_NONE     | T_SIZE_NONE,
132     T_UNION     = T_TYPE_UNION    | T_CLASS_STRUCT | T_SIGN_NONE     | T_SIZE_NONE,
133     T_ARRAY     = T_TYPE_ARRAY    | T_CLASS_PTR    | T_SIGN_NONE     | T_SIZE_NONE,
134     T_PTR       = T_TYPE_PTR      | T_CLASS_PTR    | T_SIGN_NONE     | T_SIZE_NONE,
135     T_FUNC      = T_TYPE_FUNC     | T_CLASS_FUNC   | T_SIGN_NONE     | T_SIZE_NONE,
136
137     /* Aliases */
138     T_SIZE_T    = T_UINT,
139 };
140
141
142
143 /* Type code entry */
144 typedef unsigned long TypeCode;
145
146 /* Type entry */
147 typedef struct Type Type;
148 struct Type {
149     TypeCode            C;      /* Code for this entry */
150     union {
151         void*           P;      /* Arbitrary attribute pointer */
152         long            L;      /* Numeric attribute value */
153         unsigned long   U;      /* Dito, unsigned */
154     } A;                        /* Type attribute if necessary */
155 };
156
157 /* A macro that expands to a full initializer for struct Type */
158 #define TYPE(T)         { (T), { 0 } }
159
160 /* Maximum length of a type string */
161 #define MAXTYPELEN      30
162
163 /* Special encodings for element counts of an array */
164 #define UNSPECIFIED     -1L     /* Element count was not specified */
165 #define FLEXIBLE        0L      /* Flexible array struct member */
166
167 /* Sizes. Floating point sizes come from fp.h */
168 #define SIZEOF_CHAR     1U
169 #define SIZEOF_SHORT    2U
170 #define SIZEOF_INT      2U
171 #define SIZEOF_LONG     4U
172 #define SIZEOF_LONGLONG 8U
173 #define SIZEOF_FLOAT    (FP_F_Size())
174 #define SIZEOF_DOUBLE   (FP_D_Size())
175 #define SIZEOF_PTR      SIZEOF_INT
176
177 /* Bit sizes */
178 #define CHAR_BITS       (8 * SIZEOF_CHAR)
179 #define SHORT_BITS      (8 * SIZEOF_SHORT)
180 #define INT_BITS        (8 * SIZEOF_INT)
181 #define LONG_BITS       (8 * SIZEOF_LONG)
182 #define LONGLONG_BITS   (8 * SIZEOF_LONGLONG)
183 #define FLOAT_BITS      (8 * SIZEOF_FLOAT)
184 #define DOUBLE_BITS     (8 * SIZEOF_DOUBLE)
185 #define PTR_BITS        (8 * SIZEOF_PTR)
186
187 /* Predefined type strings */
188 extern Type type_schar[];
189 extern Type type_uchar[];
190 extern Type type_int[];
191 extern Type type_uint[];
192 extern Type type_long[];
193 extern Type type_ulong[];
194 extern Type type_void[];
195 extern Type type_size_t[];
196 extern Type type_float[];
197 extern Type type_double[];
198
199 /* Forward for the SymEntry struct */
200 struct SymEntry;
201
202
203
204 /*****************************************************************************/
205 /*                                   Code                                    */
206 /*****************************************************************************/
207
208
209
210 unsigned TypeLen (const Type* T);
211 /* Return the length of the type string */
212
213 Type* TypeCopy (Type* Dest, const Type* Src);
214 /* Copy a type string */
215
216 Type* TypeDup (const Type* T);
217 /* Create a copy of the given type on the heap */
218
219 Type* TypeAlloc (unsigned Len);
220 /* Allocate memory for a type string of length Len. Len *must* include the
221  * trailing T_END.
222  */
223
224 void TypeFree (Type* T);
225 /* Free a type string */
226
227 int SignExtendChar (int C);
228 /* Do correct sign extension of a character */
229
230 TypeCode GetDefaultChar (void);
231 /* Return the default char type (signed/unsigned) depending on the settings */
232
233 Type* GetCharArrayType (unsigned Len);
234 /* Return the type for a char array of the given length */
235
236 Type* GetImplicitFuncType (void);
237 /* Return a type string for an inplicitly declared function */
238
239 Type* PointerTo (const Type* T);
240 /* Return a type string that is "pointer to T". The type string is allocated
241  * on the heap and may be freed after use.
242  */
243
244 void PrintType (FILE* F, const Type* T);
245 /* Output translation of type array. */
246
247 void PrintRawType (FILE* F, const Type* T);
248 /* Print a type string in raw format (for debugging) */
249
250 void PrintFuncSig (FILE* F, const char* Name, Type* T);
251 /* Print a function signature. */
252
253 int TypeHasAttr (const Type* T);
254 /* Return true if the given type has attribute data */
255
256 #if defined(HAVE_INLINE)
257 INLINE void CopyTypeAttr (const Type* Src, Type* Dest)
258 /* Copy attribute data from Src to Dest */
259 {
260     Dest->A = Src->A;
261 }
262 #else
263 #  define CopyTypeAttr(Src, Dest)       ((Dest)->A = (Src)->A)
264 #endif
265
266 #if defined(HAVE_INLINE)
267 INLINE TypeCode UnqualifiedType (TypeCode T)
268 /* Return the unqalified type code */
269 {
270     return (T & ~T_MASK_QUAL);
271 }
272 #else
273 #  define UnqualifiedType(T)    ((T) & ~T_MASK_QUAL)
274 #endif
275
276 unsigned SizeOf (const Type* T);
277 /* Compute size of object represented by type array. */
278
279 unsigned PSizeOf (const Type* T);
280 /* Compute size of pointer object. */
281
282 unsigned CheckedSizeOf (const Type* T);
283 /* Return the size of a data type. If the size is zero, emit an error and
284  * return some valid size instead (so the rest of the compiler doesn't have
285  * to work with invalid sizes).
286  */
287 unsigned CheckedPSizeOf (const Type* T);
288 /* Return the size of a data type that is pointed to by a pointer. If the
289  * size is zero, emit an error and return some valid size instead (so the
290  * rest of the compiler doesn't have to work with invalid sizes).
291  */
292
293 unsigned TypeOf (const Type* T);
294 /* Get the code generator base type of the object */
295
296 Type* Indirect (Type* T);
297 /* Do one indirection for the given type, that is, return the type where the
298  * given type points to.
299  */
300
301 Type* ArrayToPtr (Type* T);
302 /* Convert an array to a pointer to it's first element */
303
304 #if defined(HAVE_INLINE)
305 INLINE TypeCode GetType (const Type* T)
306 /* Get the raw type */
307 {
308     return (T->C & T_MASK_TYPE);
309 }
310 #else
311 #  define GetType(T)    ((T)->C & T_MASK_TYPE)
312 #endif
313
314 #if defined(HAVE_INLINE)
315 INLINE int IsTypeChar (const Type* T)
316 /* Return true if this is a character type */
317 {
318     return (GetType (T) == T_TYPE_CHAR);
319 }
320 #else
321 #  define IsTypeChar(T)         (GetType (T) == T_TYPE_CHAR)
322 #endif
323
324 #if defined(HAVE_INLINE)
325 INLINE int IsTypeInt (const Type* T)
326 /* Return true if this is an int type (signed or unsigned) */
327 {
328     return (GetType (T) == T_TYPE_INT);
329 }
330 #else
331 #  define IsTypeInt(T)          (GetType (T) == T_TYPE_INT)
332 #endif
333
334 #if defined(HAVE_INLINE)
335 INLINE int IsTypeLong (const Type* T)
336 /* Return true if this is a long type (signed or unsigned) */
337 {
338     return (GetType (T) == T_TYPE_LONG);
339 }
340 #else
341 #  define IsTypeLong(T)         (GetType (T) == T_TYPE_LONG)
342 #endif
343
344 #if defined(HAVE_INLINE)
345 INLINE int IsTypeFloat (const Type* T)
346 /* Return true if this is a float type */
347 {
348     return (GetType (T) == T_TYPE_FLOAT);
349 }
350 #else
351 #  define IsTypeFloat(T)        (GetType (T) == T_TYPE_FLOAT)
352 #endif
353
354 #if defined(HAVE_INLINE)
355 INLINE int IsTypeDouble (const Type* T)
356 /* Return true if this is a double type */
357 {
358     return (GetType (T) == T_TYPE_DOUBLE);
359 }
360 #else
361 #  define IsTypeDouble(T)       (GetType (T) == T_TYPE_DOUBLE)
362 #endif
363
364 #if defined(HAVE_INLINE)
365 INLINE int IsTypePtr (const Type* T)
366 /* Return true if this is a pointer type */
367 {
368     return (GetType (T) == T_TYPE_PTR);
369 }
370 #else
371 #  define IsTypePtr(T)          (GetType (T) == T_TYPE_PTR)
372 #endif
373
374 #if defined(HAVE_INLINE)
375 INLINE int IsTypeStruct (const Type* T)
376 /* Return true if this is a struct type */
377 {
378     return (GetType (T) == T_TYPE_STRUCT);
379 }
380 #else
381 #  define IsTypeStruct(T)       (GetType (T) == T_TYPE_STRUCT)
382 #endif
383
384 #if defined(HAVE_INLINE)
385 INLINE int IsTypeUnion (const Type* T)
386 /* Return true if this is a union type */
387 {
388     return (GetType (T) == T_TYPE_UNION);
389 }
390 #else
391 #  define IsTypeUnion(T)       (GetType (T) == T_TYPE_UNION)
392 #endif
393
394 #if defined(HAVE_INLINE)
395 INLINE int IsTypeArray (const Type* T)
396 /* Return true if this is an array type */
397 {
398     return (GetType (T) == T_TYPE_ARRAY);
399 }
400 #else
401 #  define IsTypeArray(T)        (GetType (T) == T_TYPE_ARRAY)
402 #endif
403
404 #if defined(HAVE_INLINE)
405 INLINE int IsTypeVoid (const Type* T)
406 /* Return true if this is a void type */
407 {
408     return (GetType (T) == T_TYPE_VOID);
409 }
410 #else
411 #  define IsTypeVoid(T)         (GetType (T) == T_TYPE_VOID)
412 #endif
413
414 #if defined(HAVE_INLINE)
415 INLINE int IsTypeFunc (const Type* T)
416 /* Return true if this is a function class */
417 {
418     return (GetType (T) == T_TYPE_FUNC);
419 }
420 #else
421 #  define IsTypeFunc(T)         (GetType (T) == T_TYPE_FUNC)
422 #endif
423
424 #if defined(HAVE_INLINE)
425 INLINE int IsTypeFuncPtr (const Type* T)
426 /* Return true if this is a function pointer */
427 {
428     return (IsTypePtr (T) && IsTypeFunc (T+1));
429 }
430 #else
431 #  define IsTypeFuncPtr(T)      (IsTypePtr (T) && IsTypeFunc (T+1))
432 #endif
433
434 #if defined(HAVE_INLINE)
435 INLINE TypeCode GetClass (const Type* T)
436 /* Get the class of a type string */
437 {
438     return (T->C & T_MASK_CLASS);
439 }
440 #else
441 #  define GetClass(T)    ((T)->C & T_MASK_CLASS)
442 #endif
443
444 #if defined(HAVE_INLINE)
445 INLINE int IsClassInt (const Type* T)
446 /* Return true if this is an integer type */
447 {
448     return (GetClass (T) == T_CLASS_INT);
449 }
450 #else
451 #  define IsClassInt(T)         (GetClass (T) == T_CLASS_INT)
452 #endif
453
454 #if defined(HAVE_INLINE)
455 INLINE int IsClassFloat (const Type* T)
456 /* Return true if this is a float type */
457 {
458     return (GetClass (T) == T_CLASS_FLOAT);
459 }
460 #else
461 #  define IsClassFloat(T)       (GetClass (T) == T_CLASS_FLOAT)
462 #endif
463
464 #if defined(HAVE_INLINE)
465 INLINE int IsClassPtr (const Type* T)
466 /* Return true if this is a pointer type */
467 {
468     return (GetClass (T) == T_CLASS_PTR);
469 }
470 #else
471 #  define IsClassPtr(T)         (GetClass (T) == T_CLASS_PTR)
472 #endif
473
474 #if defined(HAVE_INLINE)
475 INLINE int IsClassStruct (const Type* T)
476 /* Return true if this is a struct type */
477 {
478     return (GetClass (T) == T_CLASS_STRUCT);
479 }
480 #else
481 #  define IsClassStruct(T)      (GetClass (T) == T_CLASS_STRUCT)
482 #endif
483
484 #if defined(HAVE_INLINE)
485 INLINE int IsClassFunc (const Type* T)
486 /* Return true if this is a function type */
487 {
488     return (GetClass (T) == T_CLASS_FUNC);
489 }
490 #else
491 #  define IsClassFunc(T)        (GetClass (T) == T_CLASS_FUNC)
492 #endif
493
494 #if defined(HAVE_INLINE)
495 INLINE TypeCode GetSignedness (const Type* T)
496 /* Get the sign of a type */
497 {
498     return (T->C & T_MASK_SIGN);
499 }
500 #else
501 #  define GetSignedness(T)      ((T)->C & T_MASK_SIGN)
502 #endif
503
504 #if defined(HAVE_INLINE)
505 INLINE int IsSignUnsigned (const Type* T)
506 /* Return true if this is an unsigned type */
507 {
508     return (GetSignedness (T) == T_SIGN_UNSIGNED);
509 }
510 #else
511 #  define IsSignUnsigned(T)     (GetSignedness (T) == T_SIGN_UNSIGNED)
512 #endif
513
514 #if defined(HAVE_INLINE)
515 INLINE int IsSignSigned (const Type* T)
516 /* Return true if this is a signed type */
517 {
518     return (GetSignedness (T) == T_SIGN_SIGNED);
519 }
520 #else
521 #  define IsSignSigned(T)       (GetSignedness (T) == T_SIGN_SIGNED)
522 #endif
523
524 #if defined(HAVE_INLINE)
525 INLINE TypeCode GetQualifier (const Type* T)
526 /* Get the qualifier from the given type string */
527 {
528     return (T->C & T_MASK_QUAL);
529 }
530 #else
531 #  define GetQualifier(T)      ((T)->C & T_MASK_QUAL)
532 #endif
533
534 #if defined(HAVE_INLINE)
535 INLINE int IsQualConst (const Type* T)
536 /* Return true if the given type has a const memory image */
537 {
538     return (T->C & T_QUAL_CONST) != 0;
539 }
540 #else
541 #  define IsQualConst(T)        (((T)->C & T_QUAL_CONST) != 0)
542 #endif
543
544 #if defined(HAVE_INLINE)
545 INLINE int IsQualVolatile (const Type* T)
546 /* Return true if the given type has a volatile type qualifier */
547 {
548     return (T->C & T_QUAL_VOLATILE) != 0;
549 }
550 #else
551 #  define IsQualVolatile(T)     (((T)->C & T_QUAL_VOLATILE) != 0)
552 #endif
553
554 #if defined(HAVE_INLINE)
555 INLINE int IsQualRestrict (const Type* T)
556 /* Return true if the given type has a restrict qualifier */
557 {
558     return (T->C & T_QUAL_RESTRICT) != 0;
559 }
560 #else
561 #  define IsQualRestrict(T)     (((T)->C & T_QUAL_RESTRICT) != 0)
562 #endif
563
564 #if defined(HAVE_INLINE)
565 INLINE int IsQualNear (const Type* T)
566 /* Return true if the given type has a near qualifier */
567 {
568     return (T->C & T_QUAL_NEAR) != 0;
569 }
570 #else
571 #  define IsQualNear(T)         (((T)->C & T_QUAL_NEAR) != 0)
572 #endif
573
574 #if defined(HAVE_INLINE)
575 INLINE int IsQualFar (const Type* T)
576 /* Return true if the given type has a far qualifier */
577 {
578     return (T->C & T_QUAL_FAR) != 0;
579 }
580 #else
581 #  define IsQualFar(T)          (((T)->C & T_QUAL_FAR) != 0)
582 #endif
583
584 #if defined(HAVE_INLINE)
585 INLINE int IsQualFastcall (const Type* T)
586 /* Return true if the given type has a fastcall qualifier */
587 {
588     return (T->C & T_QUAL_FASTCALL) != 0;
589 }
590 #else
591 #  define IsQualFastcall(T)     (((T)->C & T_QUAL_FASTCALL) != 0)
592 #endif
593
594 int IsVariadicFunc (const Type* T) attribute ((const));
595 /* Return true if this is a function type or pointer to function type with
596  * variable parameter list
597  */
598
599 #if defined(HAVE_INLINE)
600 INLINE TypeCode GetSizeModifier (const Type* T)
601 /* Get the size modifier of a type */
602 {
603     return (T->C & T_MASK_SIZE);
604 }
605 #else
606 #  define GetSizeModifier(T)      ((T)->C & T_MASK_SIZE)
607 #endif
608
609 FuncDesc* GetFuncDesc (const Type* T) attribute ((const));
610 /* Get the FuncDesc pointer from a function or pointer-to-function type */
611
612 void SetFuncDesc (Type* T, FuncDesc* F);
613 /* Set the FuncDesc pointer in a function or pointer-to-function type */
614
615 Type* GetFuncReturn (Type* T) attribute ((const));
616 /* Return a pointer to the return type of a function or pointer-to-function type */
617
618 long GetElementCount (const Type* T);
619 /* Get the element count of the array specified in T (which must be of
620  * array type).
621  */
622
623 void SetElementCount (Type* T, long Count);
624 /* Set the element count of the array specified in T (which must be of
625  * array type).
626  */
627
628 Type* GetElementType (Type* T);
629 /* Return the element type of the given array type. */
630
631 struct SymEntry* GetSymEntry (const Type* T) attribute ((const));
632 /* Return a SymEntry pointer from a type */
633
634 void SetSymEntry (Type* T, struct SymEntry* S);
635 /* Set the SymEntry pointer for a type */
636
637 Type* IntPromotion (Type* T);
638 /* Apply the integer promotions to T and return the result. The returned type
639  * string may be T if there is no need to change it.
640  */
641
642 Type* PtrConversion (Type* T);
643 /* If the type is a function, convert it to pointer to function. If the
644  * expression is an array, convert it to pointer to first element. Otherwise
645  * return T.
646  */
647
648 TypeCode AddrSizeQualifier (unsigned AddrSize);
649 /* Return T_QUAL_NEAR or T_QUAL_FAR depending on the address size */
650
651 #if defined(HAVE_INLINE)
652 INLINE TypeCode CodeAddrSizeQualifier (void)
653 /* Return T_QUAL_NEAR or T_QUAL_FAR depending on the code address size */
654 {
655     return AddrSizeQualifier (CodeAddrSize);
656 }
657 #else
658 #  define CodeAddrSizeQualifier()      (AddrSizeQualifier (CodeAddrSize))
659 #endif
660
661 #if defined(HAVE_INLINE)
662 INLINE TypeCode DataAddrSizeQualifier (void)
663 /* Return T_QUAL_NEAR or T_QUAL_FAR depending on the data address size */
664 {
665     return AddrSizeQualifier (DataAddrSize);
666 }
667 #else
668 #  define DataAddrSizeQualifier()      (AddrSizeQualifier (DataAddrSize))
669 #endif
670
671
672
673 /* End of datatype.h */
674
675 #endif
676
677
678