OSDN Git Service

2011-04-11 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / libobjc / objc / encoding.h
1 /* Encoding of types for Objective C.
2    Copyright (C) 1993, 1997, 2002, 2004, 2009, 2010
3    Free Software Foundation, Inc.
4
5 Author: Kresten Krab Thorup
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
22
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
26 <http://www.gnu.org/licenses/>.  */
27
28
29 #ifndef __encoding_INCLUDE_GNU
30 #define __encoding_INCLUDE_GNU
31
32 /* This file is to be used with the "traditional" GNU Objective-C
33    Runtime API (the one declared in objc/objc-api.h).  If you are
34    using the "modern" GNU Objective-C Runtime API, then the useful
35    functions from this file are declared in objc/runtime.h.  */
36
37 #include "objc-api.h"
38 #include <ctype.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif /* __cplusplus */
43
44 /* The following are used in encode strings to describe some
45    qualifiers of method and ivar types.  */
46 #define _C_CONST        'r'
47 #define _C_IN           'n'
48 #define _C_INOUT        'N'
49 #define _C_OUT          'o'
50 #define _C_BYCOPY       'O'
51 #define _C_BYREF        'R'
52 #define _C_ONEWAY       'V'
53 #define _C_GCINVISIBLE  '|'
54
55 /* The same when used as flags.  */
56 #define _F_CONST        0x01
57 #define _F_IN           0x01
58 #define _F_OUT          0x02
59 #define _F_INOUT        0x03
60 #define _F_BYCOPY       0x04
61 #define _F_BYREF        0x08
62 #define _F_ONEWAY       0x10
63 #define _F_GCINVISIBLE  0x20
64
65 int objc_sizeof_type (const char *type);
66 int objc_alignof_type (const char *type);
67 int objc_aligned_size (const char *type);
68 int objc_promoted_size (const char *type);
69
70 const char *objc_skip_type_qualifiers (const char *type);
71 const char *objc_skip_typespec (const char *type);
72 const char *objc_skip_offset (const char *type);
73 const char *objc_skip_argspec (const char *type);
74 unsigned objc_get_type_qualifiers (const char *type);
75
76 /* The following functions are replaced, in the modern API, by
77    method_getNumberOfArguments(), method_getArgumentType().  */
78 int method_get_number_of_arguments (struct objc_method *);
79 int method_get_sizeof_arguments (struct objc_method *);
80
81 /* The following functions are deprecated and they use arglist_t which
82    is deprecated.  */
83 char *method_get_first_argument (struct objc_method *,
84                                  arglist_t argframe, 
85                                  const char **type);
86 char *method_get_next_argument (arglist_t argframe, 
87                                 const char **type);
88 char *method_get_nth_argument (struct objc_method *m, 
89                                arglist_t argframe,
90                                int arg, 
91                                const char **type);
92
93 struct objc_struct_layout
94 {
95   const char *original_type;
96   const char *type;
97   const char *prev_type;
98   unsigned int record_size;
99   unsigned int record_align;
100 };
101
102 void objc_layout_structure (const char *type,
103                             struct objc_struct_layout *layout);
104 BOOL  objc_layout_structure_next_member (struct objc_struct_layout *layout);
105 void objc_layout_finish_structure (struct objc_struct_layout *layout,
106                                    unsigned int *size,
107                                    unsigned int *align);
108 void objc_layout_structure_get_info (struct objc_struct_layout *layout,
109                                      unsigned int *offset,
110                                      unsigned int *align,
111                                      const char **type);
112
113 #ifdef __cplusplus
114 }
115 #endif /* __cplusplus */
116
117 #endif /* __encoding_INCLUDE_GNU */