ObjC NeXT, split encode-support code from next-mapping.h
[gcc.git] / gcc / testsuite / objc-obj-c++-shared / objc-test-suite-next-encode-assist.h
1 #ifndef _OBJC_TEST_SUITE_NEXT_ENCODE_ASSIST_H_
2 #define _OBJC_TEST_SUITE_NEXT_ENCODE_ASSIST_H_
3
4 #ifdef __NEXT_RUNTIME__
5
6 #include "next-abi.h"
7 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
8 #include <objc/runtime.h>
9 typedef void * PMETH;
10 #else
11 #include <objc/objc-runtime.h>
12 typedef struct objc_method * PMETH;
13 #endif
14
15 /* The NeXT headers do not define NULL. */
16 #ifndef NULL
17 #define NULL 0
18 #endif
19
20 /* The NeXT runtimes do not include these functions (at least not through
21 any public API). They are required for the objc/execute/bf-* and bycopy-3. */
22
23 /* Not sure why the following are missing from NeXT objc headers... */
24
25 #ifndef _C_LNG_LNG
26 #define _C_LNG_LNG 'q'
27 #endif
28 #ifndef _C_ULNG_LNG
29 #define _C_ULNG_LNG 'Q'
30 #endif
31 #ifndef _C_ATOM
32 #define _C_ATOM '%'
33 #endif
34 #ifndef _C_BOOL
35 #define _C_BOOL 'B'
36 #endif
37
38 #define _C_CONST 'r'
39 #define _C_IN 'n'
40 #define _C_INOUT 'N'
41 #define _C_OUT 'o'
42 #define _C_BYCOPY 'O'
43 #define _C_BYREF 'R'
44 #define _C_ONEWAY 'V'
45 #define _C_GCINVISIBLE '!'
46
47 #define _F_CONST 0x01
48 #define _F_IN 0x01
49 #define _F_OUT 0x02
50 #define _F_INOUT 0x03
51 #define _F_BYCOPY 0x04
52 #define _F_BYREF 0x08
53 #define _F_ONEWAY 0x10
54 #define _F_GCINVISIBLE 0x20
55
56 /* Functions available in the GNU runtime, emulated here for testing with NeXT. */
57
58 struct objc_struct_layout
59 {
60 const char *original_type;
61 const char *type;
62 const char *prev_type;
63 unsigned int record_size;
64 unsigned int record_align;
65 };
66
67 typedef union arglist {
68 char *arg_ptr;
69 char arg_regs[sizeof (char*)];
70 } *arglist_t; /* argument frame */
71
72 void objc_layout_structure_get_info (struct objc_struct_layout *,unsigned int *,
73 unsigned int *, const char **);
74 void objc_layout_structure (const char *, struct objc_struct_layout *);
75 BOOL objc_layout_structure_next_member (struct objc_struct_layout *);
76 void objc_layout_finish_structure (struct objc_struct_layout *, unsigned int *,
77 unsigned int *);
78
79 int objc_sizeof_type (const char *);
80 int objc_alignof_type (const char *);
81 int objc_aligned_size (const char *);
82 int objc_promoted_size (const char *);
83
84 unsigned objc_get_type_qualifiers (const char *);
85 const char *objc_skip_type_qualifiers (const char *);
86 const char *objc_skip_typespec (const char *);
87 const char *objc_skip_offset (const char *);
88 const char *objc_skip_argspec (const char *);
89
90 int method_get_number_of_arguments (PMETH);
91 int method_get_sizeof_arguments (PMETH);
92 char *method_get_next_argument (arglist_t , const char **);
93 char *method_get_first_argument (PMETH, arglist_t, const char **);
94 char *method_get_nth_argument (PMETH, arglist_t, int, const char **);
95
96 #endif /* __NEXT_RUNTIME__ */
97 #endif /* _OBJC_TEST_SUITE_NEXT_ENCODE_ASSIST_H_ */