1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4// METASIG.H
5//
6
7//
8// All literal MetaData signatures should be defined here.
9//
10
11
12// Generic sig's based on types.
13
14// All sigs are alphabetized by the signature string and given a canonical name. Do not
15// give them "meaningful" names because we want to share them aggressively. Do not add
16// duplicates!
17
18// The canonical form:
19//
20// <what>(<type>*, <name>*)
21//
22// where <what> is:
23//
24// Fld -- field
25// IM -- instance method (HASTHIS == TRUE)
26// SM -- static method
27//
28// and <name> -- <type> is:
29//
30// a -- Arr -- array
31// P -- Ptr -- a pointer
32// r -- Ref -- a byref
33// Ret -- indicates function return type
34//
35// Var -- Variant
36//
37// b -- Byte -- (unsigned) byte
38// u -- Char -- character (2 byte unsigned unicode)
39// d -- Dbl -- double
40// f -- Flt -- float
41// i -- Int -- integer
42// K -- UInt -- unsigned integer
43// I -- IntPtr -- agnostic integer
44// U -- UIntPtr -- agnostic unsigned integer
45// l -- Long -- long integer
46// L -- ULong -- unsigned long integer
47// h -- Shrt -- short integer
48// H -- UShrt -- unsigned short integer
49// v -- Void -- Void
50// B -- SByt -- signed byte
51// F -- Bool -- boolean
52// j -- Obj -- System.Object
53// s -- Str -- System.String
54// C -- -- class
55// g -- -- struct
56// T -- TypedReference -- TypedReference
57// G -- -- Generic type variable
58// M -- -- Generic method variable
59// GI -- -- Generic type instantiation
60// Q -- modreq
61
62//#DEFINE_METASIG
63// Use DEFINE_METASIG for signatures that does not reference other types
64// Use DEFINE_METASIG_T for signatures that reference other types (contains C or g)
65
66
67// This part of the file is included multiple times with different macro definitions
68// to generate the hardcoded metasigs.
69
70
71// SM, IM and Fld macros have often a very similar definitions. METASIG_BODY is
72// a helper to avoid these redundant SM, IM and Fld definitions.
73#ifdef METASIG_BODY
74#ifndef DEFINE_METASIG
75// See code:#DEFINE_METASIG
76#define DEFINE_METASIG(body) body
77#endif
78#define SM(varname, args, retval) METASIG_BODY( SM_ ## varname, args retval )
79#define IM(varname, args, retval) METASIG_BODY( IM_ ## varname, args retval )
80#define GM(varname, n, conv, args, retval) METASIG_BODY( GM_ ## varname, args retval )
81#define Fld(varname, val) METASIG_BODY( Fld_ ## varname, val )
82#endif
83
84
85#ifdef DEFINE_METASIG
86
87// Use default if undefined
88// See code:#DEFINE_METASIG
89#ifndef DEFINE_METASIG_T
90#define DEFINE_METASIG_T(body) DEFINE_METASIG(body)
91#endif
92
93// One letter shortcuts are defined for all types that can occur in the signature.
94// The shortcuts are defined indirectly through METASIG_ATOM. METASIG_ATOM is
95// designed to control whether to generate the initializer for the signature or
96// just compute the size of the signature.
97
98#define b METASIG_ATOM(ELEMENT_TYPE_U1)
99#define u METASIG_ATOM(ELEMENT_TYPE_CHAR)
100#define d METASIG_ATOM(ELEMENT_TYPE_R8)
101#define f METASIG_ATOM(ELEMENT_TYPE_R4)
102#define i METASIG_ATOM(ELEMENT_TYPE_I4)
103#define K METASIG_ATOM(ELEMENT_TYPE_U4)
104#define I METASIG_ATOM(ELEMENT_TYPE_I)
105#define U METASIG_ATOM(ELEMENT_TYPE_U)
106#define l METASIG_ATOM(ELEMENT_TYPE_I8)
107#define L METASIG_ATOM(ELEMENT_TYPE_U8)
108#define h METASIG_ATOM(ELEMENT_TYPE_I2)
109#define H METASIG_ATOM(ELEMENT_TYPE_U2)
110#define v METASIG_ATOM(ELEMENT_TYPE_VOID)
111#define B METASIG_ATOM(ELEMENT_TYPE_I1)
112#define F METASIG_ATOM(ELEMENT_TYPE_BOOLEAN)
113#define j METASIG_ATOM(ELEMENT_TYPE_OBJECT)
114#define s METASIG_ATOM(ELEMENT_TYPE_STRING)
115#define T METASIG_ATOM(ELEMENT_TYPE_TYPEDBYREF)
116
117
118// METASIG_RECURSE controls whether to recurse into the complex types
119// in the macro expansion. METASIG_RECURSE is designed to control
120// whether to compute the byte size of the signature or just compute
121// the number of arguments in the signature.
122
123#if METASIG_RECURSE
124
125#define a(x) METASIG_ATOM(ELEMENT_TYPE_SZARRAY) x
126#define P(x) METASIG_ATOM(ELEMENT_TYPE_PTR) x
127#define r(x) METASIG_ATOM(ELEMENT_TYPE_BYREF) x
128
129#define G(n) METASIG_ATOM(ELEMENT_TYPE_VAR) METASIG_ATOM(n)
130#define M(n) METASIG_ATOM(ELEMENT_TYPE_MVAR) METASIG_ATOM(n)
131
132#define GI(type, n, x) METASIG_ATOM(ELEMENT_TYPE_GENERICINST) type METASIG_ATOM(n) x
133
134// The references to other types have special definition in some cases
135#ifndef C
136#define C(x) METASIG_ATOM(ELEMENT_TYPE_CLASS) METASIG_ATOM(CLASS__ ## x % 0x100) METASIG_ATOM(CLASS__ ## x / 0x100)
137#endif
138#ifndef g
139#define g(x) METASIG_ATOM(ELEMENT_TYPE_VALUETYPE) METASIG_ATOM(CLASS__ ## x % 0x100) METASIG_ATOM(CLASS__ ## x / 0x100)
140#endif
141#ifndef Q
142#define Q(x) METASIG_ATOM(ELEMENT_TYPE_CMOD_REQD) METASIG_ATOM(CLASS__ ## x % 0x100) METASIG_ATOM(CLASS__ ## x / 0x100)
143#endif
144
145#else
146
147#define a(x) METASIG_ATOM(ELEMENT_TYPE_SZARRAY)
148#define P(x) METASIG_ATOM(ELEMENT_TYPE_PTR)
149#define r(x) METASIG_ATOM(ELEMENT_TYPE_BYREF)
150
151#define G(n) METASIG_ATOM(ELEMENT_TYPE_VAR)
152#define M(n) METASIG_ATOM(ELEMENT_TYPE_MVAR)
153
154#define GI(type, n, x) METASIG_ATOM(ELEMENT_TYPE_GENERICINST)
155
156// The references to other types have special definition in some cases
157#ifndef C
158#define C(x) METASIG_ATOM(ELEMENT_TYPE_CLASS)
159#endif
160#ifndef g
161#define g(x) METASIG_ATOM(ELEMENT_TYPE_VALUETYPE)
162#endif
163
164#define Q(x)
165
166#endif
167
168
169
170// to avoid empty arguments for macros
171#define _
172
173
174// static methods:
175DEFINE_METASIG_T(SM(Int_IntPtr_Obj_RetException, i I j, C(EXCEPTION)))
176DEFINE_METASIG_T(SM(Type_ArrType_IntPtr_int_RetType, C(TYPE) a(C(TYPE)) I i, C(TYPE) ))
177DEFINE_METASIG_T(SM(Type_RetIntPtr, C(TYPE), I))
178DEFINE_METASIG(SM(IntPtr_IntPtr_IntPtr_Int_RetObj, I I I i, j))
179DEFINE_METASIG(SM(Obj_IntPtr_RetIntPtr, j I, I))
180DEFINE_METASIG(SM(Obj_IntPtr_RetObj, j I, j))
181DEFINE_METASIG(SM(Obj_RefIntPtr_RetVoid, j r(I), v))
182DEFINE_METASIG(SM(Obj_IntPtr_RetVoid, j I, v))
183DEFINE_METASIG(SM(Obj_IntPtr_RetBool, j I, F))
184DEFINE_METASIG(SM(Obj_IntPtr_IntPtr_Int_RetIntPtr, j I I i, I))
185DEFINE_METASIG(SM(IntPtr_IntPtr_RefIntPtr_RetObj, I I r(I), j))
186#ifdef FEATURE_COMINTEROP
187DEFINE_METASIG(SM(Obj_IntPtr_RefIntPtr_RefBool_RetIntPtr, j I r(I) r(F), I))
188DEFINE_METASIG(SM(Obj_IntPtr_RefIntPtr_RetIntPtr, j I r(I), I))
189DEFINE_METASIG_T(SM(Obj_Str_RetICustomProperty, j s, C(ICUSTOMPROPERTY)))
190DEFINE_METASIG_T(SM(Obj_Str_PtrTypeName_RetICustomProperty, j s P(g(TYPENAMENATIVE)), C(ICUSTOMPROPERTY)))
191DEFINE_METASIG_T(SM(Obj_PtrTypeName_RetVoid, j P(g(TYPENAMENATIVE)), v))
192DEFINE_METASIG_T(SM(Type_PtrTypeName_RetVoid, C(TYPE) P(g(TYPENAMENATIVE)), v))
193DEFINE_METASIG_T(SM(PtrTypeName_RefType_RetVoid, P(g(TYPENAMENATIVE)) r(C(TYPE)), v))
194DEFINE_METASIG_T(SM(ArrType_PtrTypeName_RetVoid, a(C(TYPE)) P(g(TYPENAMENATIVE)), v))
195DEFINE_METASIG_T(SM(PtrTypeName_ArrType_RetVoid, P(g(TYPENAMENATIVE)) a(C(TYPE)), v))
196DEFINE_METASIG_T(SM(PtrTypeName_RetVoid, P(g(TYPENAMENATIVE)), v))
197DEFINE_METASIG_T(SM(PtrTypeName_Int_RetVoid, P(g(TYPENAMENATIVE)) i, v))
198DEFINE_METASIG_T(SM(Exception_IntPtr_RetException, C(EXCEPTION) I, C(EXCEPTION)))
199#endif // FEATURE_COMINTEROP
200DEFINE_METASIG(SM(Int_RetVoid, i, v))
201DEFINE_METASIG(SM(Int_Int_RetVoid, i i, v))
202DEFINE_METASIG(SM(Str_RetIntPtr, s, I))
203DEFINE_METASIG(SM(Str_RetBool, s, F))
204DEFINE_METASIG(SM(IntPtr_IntPtr_RetVoid, I I, v))
205DEFINE_METASIG(SM(IntPtr_IntPtr_Obj_RetIntPtr, I I j, I))
206DEFINE_METASIG(SM(IntPtr_IntPtr_Int_Obj_RetIntPtr, I I i j, I))
207DEFINE_METASIG(SM(IntPtr_IntPtr_IntPtr_RetVoid, I I I, v))
208DEFINE_METASIG(SM(IntPtr_IntPtr_IntPtr_UShrt_RetVoid, I I I H, v))
209DEFINE_METASIG(SM(IntPtr_Int_IntPtr_RetIntPtr, I i I, I))
210DEFINE_METASIG(SM(IntPtr_IntPtr_Int_IntPtr_RetVoid, I I i I, v))
211DEFINE_METASIG(SM(IntPtr_IntPtr_Obj_RetVoid, I I j, v))
212DEFINE_METASIG(SM(Obj_ArrObject_RetVoid, j a(j), v))
213DEFINE_METASIG(SM(Obj_IntPtr_Obj_RetVoid, j I j, v))
214DEFINE_METASIG(SM(RetUIntPtr, _, U))
215DEFINE_METASIG(SM(RetIntPtr, _, I))
216DEFINE_METASIG(SM(RetBool, _, F))
217DEFINE_METASIG(SM(IntPtr_RetStr, I, s))
218DEFINE_METASIG(SM(IntPtr_RetBool, I, F))
219DEFINE_METASIG(SM(IntPtrIntPtrIntPtr_RetVoid, I I I, v))
220DEFINE_METASIG_T(SM(IntPtrIntPtrIntPtr_RefCleanupWorkListElement_RetVoid, I I I r(C(CLEANUP_WORK_LIST_ELEMENT)), v))
221DEFINE_METASIG_T(SM(RuntimeType_RuntimeMethodHandleInternal_RetMethodBase, C(CLASS) g(METHOD_HANDLE_INTERNAL), C(METHOD_BASE) ))
222DEFINE_METASIG_T(SM(RuntimeType_IRuntimeFieldInfo_RetFieldInfo, C(CLASS) C(I_RT_FIELD_INFO), C(FIELD_INFO) ))
223DEFINE_METASIG_T(SM(RuntimeType_Int_RetPropertyInfo, C(CLASS) i, C(PROPERTY_INFO) ))
224DEFINE_METASIG(SM(Char_Bool_Bool_RetByte, u F F, b))
225DEFINE_METASIG(SM(Byte_RetChar, b, u))
226DEFINE_METASIG(SM(Str_Bool_Bool_RefInt_RetIntPtr, s F F r(i), I))
227DEFINE_METASIG(SM(IntPtr_Int_RetStr, I i, s))
228DEFINE_METASIG_T(SM(Obj_PtrByte_RefCleanupWorkListElement_RetVoid, j P(b) r(C(CLEANUP_WORK_LIST_ELEMENT)), v))
229DEFINE_METASIG(SM(Obj_PtrByte_RetVoid, j P(b), v))
230DEFINE_METASIG(SM(PtrByte_IntPtr_RetVoid, P(b) I, v))
231DEFINE_METASIG(SM(Str_Bool_Bool_RefInt_RetArrByte, s F F r(i), a(b) ))
232DEFINE_METASIG(SM(ArrByte_Int_PtrByte_Int_Int_RetVoid, a(b) i P(b) i i, v))
233DEFINE_METASIG(SM(PtrByte_Int_ArrByte_Int_Int_RetVoid, P(b) i a(b) i i, v))
234DEFINE_METASIG(SM(PtrByte_RetInt, P(b), i))
235DEFINE_METASIG(SM(PtrSByt_RetInt, P(B), i))
236DEFINE_METASIG(SM(IntPtr_RetIntPtr, I, I))
237DEFINE_METASIG(SM(UIntPtr_RetIntPtr, U, I))
238DEFINE_METASIG(SM(PtrByte_PtrByte_Int_RetVoid, P(b) P(b) i, v))
239DEFINE_METASIG(SM(RefObj_IntPtr_RetVoid, r(j) I, v))
240DEFINE_METASIG(SM(RefObj_RefIntPtr_RetVoid, r(j) r(I), v))
241DEFINE_METASIG(SM(IntPtr_RefObj_IntPtr_RetVoid, I r(j) I, v))
242DEFINE_METASIG(SM(IntPtr_RefObj_IntPtr_Int_RetVoid, I r(j) I i,v))
243DEFINE_METASIG(SM(IntPtr_Int_IntPtr_Int_Int_Int_RetVoid, I i I i i i, v))
244DEFINE_METASIG(SM(IntPtr_IntPtr_Int_Int_RetVoid, I I i i, v))
245DEFINE_METASIG(SM(IntPtr_RefObj_IntPtr_Obj_RetVoid, I r(j) I j, v))
246DEFINE_METASIG(SM(Obj_Int_RetVoid, j i,v))
247
248DEFINE_METASIG(SM(Flt_RetFlt, f, f))
249DEFINE_METASIG(SM(Dbl_RetDbl, d, d))
250DEFINE_METASIG(SM(RefDbl_Dbl_RetDbl, r(d) d, d))
251DEFINE_METASIG(SM(RefDbl_Dbl_Dbl_RetDbl, r(d) d d, d))
252DEFINE_METASIG(SM(RefLong_Long_RetLong, r(l) l, l))
253DEFINE_METASIG(SM(RefLong_Long_Long_RetLong, r(l) l l, l))
254DEFINE_METASIG(SM(RefFlt_Flt_RetFlt, r(f) f, f))
255DEFINE_METASIG(SM(RefFlt_Flt_Flt_RetFlt, r(f) f f, f))
256DEFINE_METASIG(SM(RefInt_Int_RetInt, r(i) i, i))
257DEFINE_METASIG(SM(RefInt_Int_Int_RetInt, r(i) i i, i))
258DEFINE_METASIG(SM(RefInt_Int_Int_RefBool_RetInt, r(i) i i r(F), i))
259DEFINE_METASIG(SM(RefIntPtr_IntPtr_RetIntPtr, r(I) I, I))
260DEFINE_METASIG(SM(RefIntPtr_IntPtr_IntPtr_RetIntPtr, r(I) I I, I))
261DEFINE_METASIG(SM(RefObj_Obj_RetObj, r(j) j, j))
262DEFINE_METASIG(SM(RefObj_Obj_Obj_RetObj, r(j) j j, j))
263DEFINE_METASIG(SM(ObjIntPtr_RetVoid, j I, v))
264
265DEFINE_METASIG(SM(RefBool_RetBool, r(F), F))
266DEFINE_METASIG(SM(RefBool_Bool, r(F) F, v))
267DEFINE_METASIG(SM(RefSByt_RetSByt, r(B), B))
268DEFINE_METASIG(SM(RefSByt_SByt, r(B) B, v))
269DEFINE_METASIG(SM(RefByte_RetByte, r(b), b))
270DEFINE_METASIG(SM(RefByte_Byte, r(b) b, v))
271DEFINE_METASIG(SM(RefShrt_RetShrt, r(h), h))
272DEFINE_METASIG(SM(RefShrt_Shrt, r(h) h, v))
273DEFINE_METASIG(SM(RefUShrt_RetUShrt, r(H), H))
274DEFINE_METASIG(SM(RefUShrt_UShrt, r(H) H, v))
275DEFINE_METASIG(SM(RefInt_RetInt, r(i), i))
276DEFINE_METASIG(SM(RefInt_Int, r(i) i, v))
277DEFINE_METASIG(SM(RefUInt_RetUInt, r(K), K))
278DEFINE_METASIG(SM(RefUInt_UInt, r(K) K, v))
279DEFINE_METASIG(SM(RefLong_RetLong, r(l), l))
280DEFINE_METASIG(SM(RefLong_Long, r(l) l, v))
281DEFINE_METASIG(SM(RefULong_RetULong, r(L), L))
282DEFINE_METASIG(SM(RefULong_ULong, r(L) L, v))
283DEFINE_METASIG(SM(RefIntPtr_RetIntPtr, r(I), I))
284DEFINE_METASIG(SM(RefIntPtr_IntPtr, r(I) I, v))
285DEFINE_METASIG(SM(RefUIntPtr_RetUIntPtr, r(U), U))
286DEFINE_METASIG(SM(RefUIntPtr_UIntPtr, r(U) U, v))
287DEFINE_METASIG(SM(RefFlt_RetFlt, r(f), f))
288DEFINE_METASIG(SM(RefFlt_Flt, r(f) f, v))
289DEFINE_METASIG(SM(RefDbl_RetDbl, r(d), d))
290DEFINE_METASIG(SM(RefDbl_Dbl, r(d) d, v))
291DEFINE_METASIG(GM(RefT_RetT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)), M(0)))
292DEFINE_METASIG(GM(RefT_T, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)) M(0), v))
293
294DEFINE_METASIG(GM(RefByte_RetT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(b), M(0)))
295DEFINE_METASIG(GM(RefByte_T_RetVoid, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(b) M(0), v))
296DEFINE_METASIG(GM(PtrVoid_RetT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, P(v), M(0)))
297DEFINE_METASIG(GM(PtrVoid_T_RetVoid, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, P(v) M(0), v))
298
299DEFINE_METASIG(GM(RefT_RetRefT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)), r(M(0))))
300DEFINE_METASIG(GM(VoidPtr_RetRefT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, P(v), r(M(0))))
301DEFINE_METASIG(GM(RefTFrom_RetRefTTo, IMAGE_CEE_CS_CALLCONV_DEFAULT, 2, r(M(0)), r(M(1))))
302DEFINE_METASIG(GM(Obj_RetT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, j, M(0)))
303DEFINE_METASIG(GM(RefT_Int_RetRefT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)) i, r(M(0))))
304DEFINE_METASIG(GM(RefT_IntPtr_RetRefT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)) I, r(M(0))))
305DEFINE_METASIG(GM(PtrVoid_Int_RetPtrVoid, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, P(v) i, P(v)))
306
307DEFINE_METASIG_T(SM(SafeHandle_RefBool_RetIntPtr, C(SAFE_HANDLE) r(F), I ))
308DEFINE_METASIG_T(SM(SafeHandle_RetVoid, C(SAFE_HANDLE), v ))
309
310DEFINE_METASIG_T(SM(RetMethodBase, _, C(METHOD_BASE)))
311DEFINE_METASIG(SM(RetVoid, _, v))
312DEFINE_METASIG(SM(Str_IntPtr_Int_RetVoid, s I i, v))
313DEFINE_METASIG(SM(Int_RetIntPtr, i, I))
314
315DEFINE_METASIG_T(SM(DateTime_RetDbl, g(DATE_TIME), d))
316DEFINE_METASIG(SM(Dbl_RetLong, d, l))
317
318DEFINE_METASIG(SM(IntPtr_RetObj, I, j))
319DEFINE_METASIG_T(SM(Int_RetException, i, C(EXCEPTION)))
320DEFINE_METASIG(SM(Int_IntPtr_RetObj, i I, j))
321DEFINE_METASIG(SM(IntPtr_IntPtr_Int_RetVoid, I I i, v))
322DEFINE_METASIG_T(SM(Exception_RetInt, C(EXCEPTION), i))
323
324
325DEFINE_METASIG(SM(IntPtr_RetVoid, I, v))
326DEFINE_METASIG(SM(IntPtr_Bool_RetVoid, I F, v))
327DEFINE_METASIG(SM(IntPtr_UInt_IntPtr_RetVoid, I K I, v))
328DEFINE_METASIG(SM(IntPtr_RetUInt, I, K))
329DEFINE_METASIG(SM(PtrChar_RetInt, P(u), i))
330DEFINE_METASIG(SM(IntPtr_IntPtr_RetIntPtr, I I, I))
331DEFINE_METASIG(SM(IntPtr_IntPtr_Int_RetIntPtr, I I i, I))
332DEFINE_METASIG(SM(PtrVoid_PtrVoid_RetVoid, P(v) P(v), v))
333DEFINE_METASIG(IM(Obj_RetBool, j, F))
334DEFINE_METASIG(SM(Obj_RetVoid, j, v))
335DEFINE_METASIG(SM(Obj_RetInt, j, i))
336DEFINE_METASIG(SM(Obj_RetIntPtr, j, I))
337DEFINE_METASIG(SM(Obj_RetObj, j, j))
338DEFINE_METASIG(SM(Obj_RetArrByte, j, a(b)))
339DEFINE_METASIG(SM(Obj_Bool_RetArrByte, j F, a(b)))
340DEFINE_METASIG(SM(Obj_Obj_RefArrByte_RetArrByte, j j r(a(b)), a(b)))
341
342#ifdef FEATURE_COMINTEROP
343DEFINE_METASIG_T(SM(Obj_Int_RefVariant_RetVoid, j i r(g(VARIANT)), v))
344DEFINE_METASIG_T(SM(Obj_RefVariant_RetVoid, j r(g(VARIANT)), v))
345DEFINE_METASIG_T(SM(RefVariant_RetObject, r(g(VARIANT)), j))
346DEFINE_METASIG_T(SM(Str_PtrHStringHeader_RetIntPtr, s P(g(HSTRING_HEADER_MANAGED)), I))
347
348DEFINE_METASIG_T(SM(RefDateTimeOffset_RefDateTimeNative_RetVoid, r(g(DATE_TIME_OFFSET)) r(g(DATETIMENATIVE)), v))
349
350#endif
351
352
353DEFINE_METASIG(SM(Str_RetInt, s, i))
354DEFINE_METASIG_T(SM(Str_RetICustomMarshaler, s, C(ICUSTOM_MARSHALER)))
355DEFINE_METASIG(SM(Int_Str_RetIntPtr, i s, I))
356DEFINE_METASIG(SM(Int_Str_IntPtr_RetIntPtr, i s I, I))
357DEFINE_METASIG(SM(Str_IntPtr_RetIntPtr, s I, I))
358DEFINE_METASIG(SM(Str_Bool_Int_RetV, s F i, v))
359
360DEFINE_METASIG_T(SM(Type_RetInt, C(TYPE), i))
361DEFINE_METASIG(SM(ArrByte_RetObj, a(b), j))
362DEFINE_METASIG(SM(ArrByte_Bool_RetObj, a(b) F, j))
363DEFINE_METASIG(SM(ArrByte_ArrByte_RefObj_RetObj, a(b) a(b) r(j), j))
364DEFINE_METASIG_T(SM(PtrSByt_Int_Int_Encoding_RetStr, P(B) i i C(ENCODING), s))
365
366DEFINE_METASIG_T(SM(Void_RetRuntimeTypeHandle, _, g(RT_TYPE_HANDLE)))
367DEFINE_METASIG(SM(Void_RetIntPtr, _, I))
368
369DEFINE_METASIG_T(SM(UInt_UInt_PtrNativeOverlapped_RetVoid, K K P(g(NATIVEOVERLAPPED)), v))
370
371DEFINE_METASIG(IM(Long_RetVoid, l, v))
372DEFINE_METASIG(IM(IntPtr_Int_RetVoid, I i, v))
373DEFINE_METASIG(IM(IntInt_RetArrByte, i i, a(b)))
374DEFINE_METASIG(IM(RetIntPtr, _, I))
375DEFINE_METASIG(IM(RetInt, _, i))
376DEFINE_METASIG_T(IM(RetAssemblyName, _, C(ASSEMBLY_NAME)))
377DEFINE_METASIG_T(IM(RetAssemblyBase, _, C(ASSEMBLYBASE)))
378DEFINE_METASIG_T(IM(RetModule, _, C(MODULE)))
379DEFINE_METASIG_T(IM(Str_ArrB_ArrB_Ver_CI_AHA_AVC_Str_ANF_SNKP_RetV,
380 s a(b) a(b) C(VERSION) C(CULTURE_INFO) g(ASSEMBLY_HASH_ALGORITHM) g(ASSEMBLY_VERSION_COMPATIBILITY) s g(ASSEMBLY_NAME_FLAGS) C(STRONG_NAME_KEY_PAIR), v))
381DEFINE_METASIG_T(IM(PEK_IFM_RetV,
382 g(PORTABLE_EXECUTABLE_KINDS) g(IMAGE_FILE_MACHINE), v))
383DEFINE_METASIG(IM(RetObj, _, j))
384DEFINE_METASIG_T(IM(RetIEnumerator, _, C(IENUMERATOR)))
385DEFINE_METASIG(IM(RetStr, _, s))
386DEFINE_METASIG(IM(RetLong, _, l))
387
388DEFINE_METASIG_T(IM(RetType, _, C(TYPE)))
389DEFINE_METASIG(IM(RetVoid, _, v))
390DEFINE_METASIG(IM(RetBool, _, F))
391DEFINE_METASIG(IM(RetArrByte, _, a(b)))
392DEFINE_METASIG_T(IM(RetArrParameterInfo, _, a(C(PARAMETER))))
393DEFINE_METASIG_T(IM(RetCultureInfo, _, C(CULTURE_INFO)))
394#ifdef FEATURE_COMINTEROP
395DEFINE_METASIG_T(IM(RetCausalityTraceLevel, _, g(CAUSALITY_TRACE_LEVEL)))
396#endif // FEATURE_COMINTEROP
397
398DEFINE_METASIG(IM(Bool_RetIntPtr, F, I))
399DEFINE_METASIG_T(IM(Bool_RetMethodInfo, F, C(METHOD_INFO)))
400DEFINE_METASIG(SM(Bool_RetStr, F, s))
401DEFINE_METASIG(IM(Bool_Bool_RetStr, F F, s))
402
403DEFINE_METASIG(IM(PtrChar_RetVoid, P(u), v))
404DEFINE_METASIG(IM(PtrChar_Int_Int_RetVoid, P(u) i i, v))
405DEFINE_METASIG_T(IM(ReadOnlySpanOfChar_RetVoid, GI(g(READONLY_SPAN), 1, u), v))
406DEFINE_METASIG(IM(PtrSByt_RetVoid, P(B), v))
407DEFINE_METASIG(IM(PtrSByt_Int_Int_RetVoid, P(B) i i, v))
408DEFINE_METASIG_T(IM(PtrSByt_Int_Int_Encoding_RetVoid, P(B) i i C(ENCODING), v))
409DEFINE_METASIG(IM(PtrChar_Int_RetVoid, P(u) i, v))
410DEFINE_METASIG(IM(PtrSByt_Int_RetVoid, P(B) i, v))
411
412DEFINE_METASIG(IM(ArrChar_RetStr, a(u), s))
413DEFINE_METASIG(IM(ArrChar_Int_Int_RetStr, a(u) i i, s))
414DEFINE_METASIG(IM(Char_Int_RetStr, u i, s))
415DEFINE_METASIG(IM(PtrChar_RetStr, P(u), s))
416DEFINE_METASIG(IM(PtrChar_Int_Int_RetStr, P(u) i i, s))
417DEFINE_METASIG_T(IM(ReadOnlySpanOfChar_RetStr, GI(g(READONLY_SPAN), 1, u), s))
418DEFINE_METASIG(IM(PtrSByt_RetStr, P(B), s))
419DEFINE_METASIG(IM(PtrSByt_Int_Int_RetStr, P(B) i i, s))
420DEFINE_METASIG_T(IM(PtrSByt_Int_Int_Encoding_RetStr, P(B) i i C(ENCODING), s))
421DEFINE_METASIG(IM(Obj_Int_RetIntPtr, j i, I))
422
423DEFINE_METASIG(IM(Char_Char_RetStr, u u, s))
424DEFINE_METASIG(IM(Char_Int_RetVoid, u i, v))
425DEFINE_METASIG_T(SM(RetCultureInfo, _, C(CULTURE_INFO)))
426DEFINE_METASIG_T(SM(CultureInfo_RetVoid, C(CULTURE_INFO), v))
427DEFINE_METASIG(IM(Dbl_RetVoid, d, v))
428DEFINE_METASIG(IM(Flt_RetVoid, f, v))
429DEFINE_METASIG(IM(Int_RetInt, i, i))
430DEFINE_METASIG(IM(Int_RefIntPtr_RefIntPtr_RefIntPtr_RetVoid, i r(I) r(I) r(I), v))
431DEFINE_METASIG(IM(Int_RetStr, i, s))
432DEFINE_METASIG(IM(Int_RetVoid, i, v))
433DEFINE_METASIG(IM(Int_RetBool, i, F))
434DEFINE_METASIG(IM(Int_Int_RetVoid, i i, v))
435DEFINE_METASIG(IM(Int_Int_Int_RetVoid, i i i, v))
436DEFINE_METASIG(IM(Int_Int_Int_Int_RetVoid, i i i i, v))
437DEFINE_METASIG_T(IM(Obj_EventArgs_RetVoid, j C(EVENT_ARGS), v))
438DEFINE_METASIG_T(IM(Obj_UnhandledExceptionEventArgs_RetVoid, j C(UNHANDLED_EVENTARGS), v))
439
440DEFINE_METASIG_T(IM(Assembly_RetBool, C(ASSEMBLY), F))
441DEFINE_METASIG_T(IM(AssemblyBase_RetBool, C(ASSEMBLYBASE), F))
442DEFINE_METASIG_T(IM(Exception_RetVoid, C(EXCEPTION), v))
443
444DEFINE_METASIG(IM(IntPtr_RetObj, I, j))
445DEFINE_METASIG(IM(IntPtr_RetVoid, I, v))
446DEFINE_METASIG(IM(IntPtr_PtrVoid_RetVoid, I P(v), v))
447DEFINE_METASIG_T(IM(RefGuid_RetIntPtr, r(g(GUID)), I))
448
449DEFINE_METASIG(IM(Obj_RetInt, j, i))
450DEFINE_METASIG(IM(Obj_RetIntPtr, j, I))
451DEFINE_METASIG(IM(Obj_RetVoid, j, v))
452DEFINE_METASIG(IM(Obj_RetObj, j, j))
453DEFINE_METASIG(IM(Obj_IntPtr_RetVoid, j I, v))
454DEFINE_METASIG(IM(Obj_UIntPtr_RetVoid, j U, v))
455DEFINE_METASIG(IM(Obj_IntPtr_IntPtr_RetVoid, j I I, v))
456DEFINE_METASIG(IM(Obj_IntPtr_IntPtr_IntPtr_RetVoid, j I I I, v))
457DEFINE_METASIG(IM(Obj_IntPtr_IntPtr_IntPtr_IntPtr_RetVoid, j I I I I, v))
458DEFINE_METASIG(IM(IntPtr_UInt_IntPtr_IntPtr_RetVoid, I K I I, v))
459DEFINE_METASIG(IM(Obj_Bool_RetVoid, j F, v))
460#ifdef FEATURE_COMINTEROP
461DEFINE_METASIG(SM(Obj_RetStr, j, s))
462DEFINE_METASIG_T(IM(Str_BindingFlags_Obj_ArrObj_ArrBool_ArrInt_ArrType_Type_RetObj, s g(BINDING_FLAGS) j a(j) a(F) a(i) a(C(TYPE)) C(TYPE), j))
463#endif // FEATURE_COMINTEROP
464DEFINE_METASIG_T(IM(Obj_Obj_BindingFlags_Binder_CultureInfo_RetVoid, j j g(BINDING_FLAGS) C(BINDER) C(CULTURE_INFO), v))
465DEFINE_METASIG_T(IM(Obj_Obj_BindingFlags_Binder_ArrObj_CultureInfo_RetVoid, j j g(BINDING_FLAGS) C(BINDER) a(j) C(CULTURE_INFO), v))
466DEFINE_METASIG_T(IM(Obj_BindingFlags_Binder_ArrObj_CultureInfo_RetObj, j g(BINDING_FLAGS) C(BINDER) a(j) C(CULTURE_INFO), j))
467DEFINE_METASIG_T(IM(Obj_Type_CultureInfo_RetObj, j C(TYPE) C(CULTURE_INFO), j))
468DEFINE_METASIG_T(IM(MemberInfo_RetVoid, C(MEMBER), v))
469DEFINE_METASIG(IM(IntPtr_ArrObj_Obj_RefArrObj_RetObj, I a(j) j r(a(j)), j))
470DEFINE_METASIG(IM(RefObject_RetBool, r(j), F))
471DEFINE_METASIG_T(IM(Class_RetObj, C(CLASS), j))
472DEFINE_METASIG(IM(Int_VoidPtr_RetVoid, i P(v), v))
473DEFINE_METASIG(IM(VoidPtr_RetVoid, P(v), v))
474
475DEFINE_METASIG_T(IM(Str_RetModule, s, C(MODULE)))
476DEFINE_METASIG_T(SM(Assembly_Str_RetAssembly, C(ASSEMBLY) s, C(ASSEMBLY)))
477DEFINE_METASIG_T(SM(Str_Bool_RetAssembly, s F, C(ASSEMBLY)))
478DEFINE_METASIG(IM(Str_Str_Obj_RetVoid, s s j, v))
479DEFINE_METASIG(IM(Str_Str_Str_Obj_RetVoid, s s s j, v))
480DEFINE_METASIG(IM(Str_Str_Str_Obj_Bool_RetVoid, s s s j F, v))
481DEFINE_METASIG(IM(Str_Str_RefObj_RetVoid, s s r(j), v))
482DEFINE_METASIG_T(IM(Str_RetFieldInfo, s, C(FIELD_INFO)))
483DEFINE_METASIG_T(IM(Str_RetPropertyInfo, s, C(PROPERTY_INFO)))
484DEFINE_METASIG(SM(Str_RetStr, s, s))
485DEFINE_METASIG_T(SM(Str_CultureInfo_RetStr, s C(CULTURE_INFO), s))
486DEFINE_METASIG_T(SM(Str_CultureInfo_RefBool_RetStr, s C(CULTURE_INFO) r(F), s))
487DEFINE_METASIG(SM(PtrPtrChar_PtrPtrChar_Int_RetVoid, P(P(u)) P(P(u)) i, v))
488DEFINE_METASIG(SM(ArrStr_RetVoid, a(s), v))
489DEFINE_METASIG(IM(Str_RetVoid, s, v))
490DEFINE_METASIG(SM(RefBool_RefBool_RetVoid, r(F) r(F), v))
491DEFINE_METASIG_T(IM(Str_Exception_RetVoid, s C(EXCEPTION), v))
492DEFINE_METASIG(IM(Str_Obj_RetVoid, s j, v))
493DEFINE_METASIG_T(IM(Str_BindingFlags_Binder_ArrType_ArrParameterModifier_RetMethodInfo, \
494 s g(BINDING_FLAGS) C(BINDER) a(C(TYPE)) a(g(PARAMETER_MODIFIER)), C(METHOD_INFO)))
495DEFINE_METASIG_T(IM(Str_BindingFlags_Binder_Type_ArrType_ArrParameterModifier_RetPropertyInfo, \
496 s g(BINDING_FLAGS) C(BINDER) C(TYPE) a(C(TYPE)) a(g(PARAMETER_MODIFIER)), C(PROPERTY_INFO)))
497DEFINE_METASIG(IM(Str_Str_RetStr, s s, s))
498DEFINE_METASIG(IM(Str_Str_RetVoid, s s, v))
499DEFINE_METASIG(IM(Str_Str_Str_RetVoid, s s s, v))
500DEFINE_METASIG(IM(Str_Int_RetVoid, s i, v))
501DEFINE_METASIG(IM(Str_Str_Int_RetVoid, s s i, v))
502DEFINE_METASIG(IM(Str_Str_Str_Int_RetVoid, s s s i, v))
503DEFINE_METASIG_T(IM(Str_BindingFlags_RetFieldInfo, s g(BINDING_FLAGS), C(FIELD_INFO)))
504DEFINE_METASIG_T(IM(Str_BindingFlags_RetMemberInfo, s g(BINDING_FLAGS), a(C(MEMBER))))
505DEFINE_METASIG_T(IM(Str_BindingFlags_RetMethodInfo, s g(BINDING_FLAGS), C(METHOD_INFO)))
506DEFINE_METASIG_T(IM(Str_BindingFlags_RetPropertyInfo, s g(BINDING_FLAGS), C(PROPERTY_INFO)))
507DEFINE_METASIG_T(IM(Str_BindingFlags_Binder_Obj_ArrObj_ArrParameterModifier_CultureInfo_ArrStr_RetObj, \
508 s g(BINDING_FLAGS) C(BINDER) j a(j) a(g(PARAMETER_MODIFIER)) C(CULTURE_INFO) a(s), j))
509DEFINE_METASIG_T(IM(Str_Delegate_RetMethodInfo, s C(DELEGATE), C(METHOD_INFO)))
510DEFINE_METASIG_T(IM(Str_Type_Str_RetVoid, s C(TYPE) s, v))
511DEFINE_METASIG_T(SM(Delegate_RetIntPtr, C(DELEGATE), I))
512DEFINE_METASIG_T(SM(Delegate_RefIntPtr_RetIntPtr, C(DELEGATE) r(I), I))
513DEFINE_METASIG_T(SM(RuntimeTypeHandle_RetType, g(RT_TYPE_HANDLE), C(TYPE)))
514DEFINE_METASIG_T(SM(RuntimeTypeHandle_RetIntPtr, g(RT_TYPE_HANDLE), I))
515DEFINE_METASIG_T(SM(RuntimeMethodHandle_RetIntPtr, g(METHOD_HANDLE), I))
516DEFINE_METASIG_T(SM(IntPtr_Type_RetDelegate, I C(TYPE), C(DELEGATE)))
517
518
519DEFINE_METASIG_T(IM(Type_RetArrObj, C(TYPE) F, a(j)))
520DEFINE_METASIG(IM(Bool_RetVoid, F, v))
521DEFINE_METASIG_T(IM(BindingFlags_RetArrFieldInfo, g(BINDING_FLAGS), a(C(FIELD_INFO))))
522DEFINE_METASIG_T(IM(BindingFlags_RetArrMemberInfo, g(BINDING_FLAGS), a(C(MEMBER))))
523DEFINE_METASIG_T(IM(BindingFlags_RetArrMethodInfo, g(BINDING_FLAGS), a(C(METHOD_INFO))))
524DEFINE_METASIG_T(IM(BindingFlags_RetArrPropertyInfo, g(BINDING_FLAGS), a(C(PROPERTY_INFO))))
525DEFINE_METASIG(IM(ArrByte_RetVoid, a(b), v))
526DEFINE_METASIG(IM(ArrChar_RetVoid, a(u), v))
527DEFINE_METASIG(IM(ArrChar_Int_Int_RetVoid, a(u) i i, v))
528DEFINE_METASIG_T(IM(ArrType_ArrException_Str_RetVoid, a(C(TYPE)) a(C(EXCEPTION)) s, v))
529DEFINE_METASIG(IM(RefInt_RefInt_RefInt_RetArrByte, r(i) r(i) r(i), a(b)))
530DEFINE_METASIG_T(IM(RefInt_RetRuntimeType, r(i) , C(CLASS)))
531DEFINE_METASIG_T(IM(RuntimeType_RetVoid, C(CLASS) , v))
532DEFINE_METASIG_T(SM(ArrException_PtrInt_RetVoid, a(C(EXCEPTION)) P(i), v))
533
534DEFINE_METASIG_T(IM(RuntimeArgumentHandle_PtrVoid_RetVoid, g(ARGUMENT_HANDLE) P(v), v))
535DEFINE_METASIG_T(IM(LicenseInteropHelper_GetCurrentContextInfo, r(i) r(I) g(RT_TYPE_HANDLE), v))
536DEFINE_METASIG(IM(LicenseInteropHelper_SaveKeyInCurrentContext, I, v))
537DEFINE_METASIG_T(SM(LicenseInteropHelper_AllocateAndValidateLicense, g(RT_TYPE_HANDLE) I i, j))
538DEFINE_METASIG_T(SM(LicenseInteropHelper_RequestLicKey, g(RT_TYPE_HANDLE) r(I), i))
539DEFINE_METASIG_T(IM(LicenseInteropHelper_GetLicInfo, g(RT_TYPE_HANDLE) r(i) r(i), v))
540
541DEFINE_METASIG_T(SM(Assembly_RetVoid, C(ASSEMBLY), v))
542DEFINE_METASIG_T(SM(Assembly_Str_RetArrAssembly, C(ASSEMBLY) s, a(C(ASSEMBLY))))
543DEFINE_METASIG(SM(Str_RetArrStr, s, a(s)))
544
545// Execution Context
546DEFINE_METASIG_T(SM(SyncCtx_ArrIntPtr_Bool_Int_RetInt, C(SYNCHRONIZATION_CONTEXT) a(I) F i, i))
547
548#ifdef FEATURE_COMINTEROP
549// The signature of the method System.Runtime.InteropServices.ICustomQueryInterface.GetInterface
550DEFINE_METASIG_T(IM(RefGuid_OutIntPtr_RetCustomQueryInterfaceResult, r(g(GUID)) r(I), g(CUSTOMQUERYINTERFACERESULT)))
551#endif //FEATURE_COMINTEROP
552
553DEFINE_METASIG_T(SM(IntPtr_AssemblyName_RetAssemblyBase, I C(ASSEMBLY_NAME), C(ASSEMBLYBASE)))
554
555// ThreadPool
556DEFINE_METASIG(SM(Obj_Bool_RetVoid, j F, v))
557
558// For FailFast
559DEFINE_METASIG(SM(Str_RetVoid, s, v))
560DEFINE_METASIG(SM(Str_Uint_RetVoid, s K, v))
561DEFINE_METASIG_T(SM(Str_Exception_RetVoid, s C(EXCEPTION), v))
562DEFINE_METASIG_T(SM(Str_Exception_Str_RetVoid, s C(EXCEPTION) s, v))
563
564// fields - e.g.:
565// DEFINE_METASIG(Fld(PtrVoid, P(v)))
566
567// Runtime Helpers
568DEFINE_METASIG(SM(Obj_Obj_Bool_RetVoid, j j F, v))
569
570DEFINE_METASIG_T(IM(Dec_RetVoid, g(DECIMAL), v))
571DEFINE_METASIG_T(IM(Currency_RetVoid, g(CURRENCY), v))
572DEFINE_METASIG_T(SM(RefDec_RetVoid, r(g(DECIMAL)), v))
573
574DEFINE_METASIG(GM(RefT_T_T_RetT, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)) M(0) M(0), M(0)))
575DEFINE_METASIG(SM(RefObject_Object_Object_RetObject, r(j) j j, j))
576
577DEFINE_METASIG_T(SM(RefCleanupWorkListElement_RetVoid, r(C(CLEANUP_WORK_LIST_ELEMENT)), v))
578DEFINE_METASIG_T(SM(RefCleanupWorkListElement_SafeHandle_RetIntPtr, r(C(CLEANUP_WORK_LIST_ELEMENT)) C(SAFE_HANDLE), I))
579DEFINE_METASIG_T(SM(RefCleanupWorkListElement_Delegate_RetVoid, r(C(CLEANUP_WORK_LIST_ELEMENT)) C(DELEGATE), v))
580
581#ifdef FEATURE_ICASTABLE
582DEFINE_METASIG_T(SM(ICastable_RtType_RefException_RetBool, C(ICASTABLE) C(CLASS) r(C(EXCEPTION)), F))
583DEFINE_METASIG_T(SM(ICastable_RtType_RetRtType, C(ICASTABLE) C(CLASS), C(CLASS)))
584#endif // FEATURE_ICASTABLE
585
586DEFINE_METASIG_T(IM(ArrByte_Int_Int_AsyncCallback_Object_RetIAsyncResult, a(b) i i C(ASYNCCALLBACK) j, C(IASYNCRESULT)))
587DEFINE_METASIG_T(IM(IAsyncResult_RetInt, C(IASYNCRESULT), i))
588DEFINE_METASIG_T(IM(IAsyncResult_RetVoid, C(IASYNCRESULT), v))
589
590DEFINE_METASIG(IM(Int_RetRefT, i, r(G(0))))
591DEFINE_METASIG_T(IM(Int_RetReadOnlyRefT, i, Q(INATTRIBUTE) r(G(0))))
592
593// Undefine macros in case we include the file again in the compilation unit
594
595#undef DEFINE_METASIG
596#undef DEFINE_METASIG_T
597
598#undef METASIG_BODY
599#undef METASIG_ATOM
600#undef METASIG_RECURSE
601
602
603#undef SM
604#undef IM
605#undef GM
606#undef Fld
607
608#undef a
609#undef P
610#undef r
611#undef b
612#undef u
613#undef d
614#undef f
615#undef i
616#undef K
617#undef I
618#undef U
619#undef l
620#undef L
621#undef h
622#undef H
623#undef v
624#undef B
625#undef F
626#undef j
627#undef s
628#undef C
629#undef g
630#undef T
631#undef G
632#undef M
633#undef GI
634#undef Q
635
636#undef _
637
638
639#endif // DEFINE_METASIG
640