Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

445 lines
13 KiB

  1. #include "undname.h"
  2. // I can't live without 'elif'
  3. #define elif else if
  4. // Good ol' TRUE and FALSE
  5. #define TRUE true
  6. #define FALSE false
  7. // The 'operator-code' values for the decorated name specification
  8. #define OC_ctor ((unsigned char)'0')
  9. #define OC_dtor ((unsigned char)'1')
  10. #define OC_new ((unsigned char)'2')
  11. #define OC_delete ((unsigned char)'3')
  12. #define OC_assign ((unsigned char)'4')
  13. #define OC_rshift ((unsigned char)'5')
  14. #define OC_lshift ((unsigned char)'6')
  15. #define OC_not ((unsigned char)'7')
  16. #define OC_equal ((unsigned char)'8')
  17. #define OC_unequal ((unsigned char)'9')
  18. #define OC_index ((unsigned char)'A')
  19. #define OC_udc ((unsigned char)'B')
  20. #define OC_pointer ((unsigned char)'C')
  21. #define OC_star ((unsigned char)'D')
  22. #define OC_incr ((unsigned char)'E')
  23. #define OC_decr ((unsigned char)'F')
  24. #define OC_minus ((unsigned char)'G')
  25. #define OC_plus ((unsigned char)'H')
  26. #define OC_amper ((unsigned char)'I')
  27. #define OC_ptrmem ((unsigned char)'J')
  28. #define OC_divide ((unsigned char)'K')
  29. #define OC_modulo ((unsigned char)'L')
  30. #define OC_less ((unsigned char)'M')
  31. #define OC_leq ((unsigned char)'N')
  32. #define OC_greater ((unsigned char)'O')
  33. #define OC_geq ((unsigned char)'P')
  34. #define OC_comma ((unsigned char)'Q')
  35. #define OC_call ((unsigned char)'R')
  36. #define OC_compl ((unsigned char)'S')
  37. #define OC_xor ((unsigned char)'T')
  38. #define OC_or ((unsigned char)'U')
  39. #define OC_land ((unsigned char)'V')
  40. #define OC_lor ((unsigned char)'W')
  41. #define OC_asmul ((unsigned char)'X')
  42. #define OC_asadd ((unsigned char)'Y')
  43. #define OC_assub ((unsigned char)'Z')
  44. #define OC_asdiv ((unsigned char)'0')
  45. #define OC_asmod ((unsigned char)'1')
  46. #define OC_asrshift ((unsigned char)'2')
  47. #define OC_aslshift ((unsigned char)'3')
  48. #define OC_asand ((unsigned char)'4')
  49. #define OC_asor ((unsigned char)'5')
  50. #define OC_asxor ((unsigned char)'6')
  51. #define OC_vftable ((unsigned char)'7')
  52. #define OC_vbtable ((unsigned char)'8')
  53. #define OC_vcall ((unsigned char)'9')
  54. #define OC_metatype ((unsigned char)'A')
  55. #define OC_guard ((unsigned char)'B')
  56. #define OC_string ((unsigned char)'C')
  57. #define OC_vbdtor ((unsigned char)'D')
  58. #define OC_vdeldtor ((unsigned char)'E')
  59. #define OC_defctor ((unsigned char)'F')
  60. #define OC_sdeldtor ((unsigned char)'G')
  61. #define OC_vctor ((unsigned char)'H')
  62. #define OC_vdtor ((unsigned char)'I')
  63. #define OC_vallctor ((unsigned char)'J')
  64. #define OC_vdispmap ((unsigned char)'K')
  65. #define OC_ehvctor ((unsigned char)'L')
  66. #define OC_ehvdtor ((unsigned char)'M')
  67. #define OC_ehvctorvb ((unsigned char)'N')
  68. #define OC_copyctorclosure ((unsigned char)'O')
  69. #define OC_udtthunk ((unsigned char)'P') //extended code for all thunks for udt returns
  70. #define OC_eh_init ((unsigned char)'Q') //extended code for eh initialized structs
  71. #define OC_rtti_init ((unsigned char)'R') //extended code for rtti initialized structs
  72. #define OC_locvftable ((unsigned char)'S')
  73. #define OC_locvfctorclosure ((unsigned char)'T')
  74. #define OC_arrayNew ((unsigned char)'U') // operator new[]
  75. #define OC_arrayDelete ((unsigned char)'V') // operator delete[]
  76. #define OC_omni_callsig_init ((unsigned char)'W') // Special reserved value
  77. #define OC_placementDeleteClosure ((unsigned char)'X')
  78. #define OC_placementArrayDeleteClosure ((unsigned char)'Y')
  79. #define OC_anonymousNamespace ((unsigned char)'0')
  80. // Values for for 'eh initializers'
  81. #define OC_eh_PMD ((unsigned char)'0')
  82. #define OC_eh_CT ((unsigned char)'1')
  83. #define OC_eh_CTA ((unsigned char)'2')
  84. #define OC_eh_TI ((unsigned char)'3')
  85. // Values for for 'rtti initializers'
  86. #define OC_rtti_TD ((unsigned char)'0')
  87. #define OC_rtti_BCD ((unsigned char)'1')
  88. #define OC_rtti_BCA ((unsigned char)'2')
  89. #define OC_rtti_CHD ((unsigned char)'3')
  90. #define OC_rtti_COL ((unsigned char)'4')
  91. // Managed vector constructor|destructor iterators
  92. #define OC_man_vec_ctor ((unsigned char)'A')
  93. #define OC_man_vec_dtor ((unsigned char)'B')
  94. #define OC_ehvcctor ((unsigned char)'C')
  95. #define OC_ehvcctorvb ((unsigned char)'D')
  96. // Values for the 'type-encoding'
  97. #define TE_isbadtype(t) ((t)==0xFFFF)
  98. #define TE_setisbadtype(t) ((t)=0xFFFF)
  99. #define TE_istruncated(t) ((t)==0xFFFE)
  100. #define TE_setistruncated(t) ((t)=0xFFFE)
  101. #define TE_isCident(t) ((t)==0xFFFD)
  102. #define TE_setisCident(t) ((t)=0xFFFD)
  103. #define TE_isfunction(t) ((t)&0x8000)
  104. #define TE_setisfunction(t) ((t)|=0x8000)
  105. #define TE_isbased(t) ((t)&0x4000)
  106. #define TE_setisbased(t) ((t)|=0x4000)
  107. #define TE_isnear(t) (((t)&0x2000)==0x0000)
  108. #define TE_setisnear(t) ((t)&=~0x2000)
  109. #define TE_isfar(t) ((t)&0x2000)
  110. #define TE_setisfar(t) ((t)|=0x2000)
  111. #define TE_ismember(t) (TE_isfunction(t)?(((t)&0x1800)==0x0800):(((t)&0x6000)==0x0000))
  112. #define TE_setismember(t) (TE_isfunction(t)?((t)=(((t)&~0x1800)|0x0800)):((t)=((t)&~0x6000)))
  113. #define TE_isvirtual(t) (TE_isfunction(t)&&(((t)&0x0700)==0x0100))
  114. #define TE_setisvirtual(t) ((t)=(((t)&~0x0700)|0x0100))
  115. #define TE_isthunk(t) (TE_ismember(t)?((t)&0x0400):((t)&0x1000))
  116. #define TE_isvcall(t) (TE_isfunction(t)?(((t)&0x1800)==0x1800):0)
  117. #define TE_setisvcall(t) ((t)=(((t)&~0x9800)|0x9800))
  118. #define TE_islocaldtor(t) (TE_isfunction(t)?(((t)&0x1b00)==0x1000):0)
  119. #define TE_setislocaldtor(t) ((t)=(((t)&~0x9b00)|0x9000))
  120. #define TE_istemplatector(t) (TE_isfunction(t)?(((t)&0x1b00)==0x1100):0)
  121. #define TE_setistemplatector(t) ((t)=(((t)&~0x9b00)|0x9100))
  122. #define TE_istemplatedtor(t) (TE_isfunction(t)?(((t)&0x1b00)==0x1200):0)
  123. #define TE_setistemplatedtor(t) ((t)=(((t)&~0x9b00)|0x9200))
  124. #define TE_isadjustor(t) (TE_ismember(t)&&(((t)&0x0700)==0x0400))
  125. #define TE_setisadjustor(t) ((t)=(((t)&~0x0700)|0x0400))
  126. #define TE_isvtoradj(t) (TE_ismember(t)&&(((t)&0x0700)==0x0500))
  127. #define TE_setisvtoradj(t) ((t)=(((t)&~0x0700)|0x0500))
  128. #define TE_ispublic(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0000):(((t)&0x1800)==0x0000)))
  129. #define TE_setispublic(t) ((t)=(TE_isfunction(t)?((t)&~0x00C0):((t)&~0x1800)))
  130. #define TE_isprivate(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0040):(((t)&0x1800)==0x0800)))
  131. #define TE_setisprivate(t) ((t)=(TE_isfunction(t)?(((t)&~0x00C0)|0x0040):(((t)&~0x1800)|0x0800)))
  132. #define TE_isprotected(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0080):(((t)&0x1800)==0x1000)))
  133. #define TE_setisprotected(t) ((t)=(TE_isfunction(t)?(((t)&~0x00C0)|0x0080):(((t)&~0x1800)|0x1000)))
  134. #define TE_isstatic(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x0700)==0x0200):1))
  135. #define TE_setisstatic(t) ((t)=(TE_isfunction(t)?(((t)&~0x0700)|0x0200):TE_setismember(t)))
  136. #define TE_isdata(t) (!TE_isfunction(t))
  137. #define TE_setisdata(t) ((t)&=~0x8000)
  138. #define TE_isguard(t) (TE_isdata(t)&&(((t)&0x7C00)==0x6000))
  139. #define TE_setisguard(t) ((t)=(((t)&~0x7C00)|0x6000))
  140. #define TE_isvftable(t) (TE_isdata(t)&&(((t)&0x7C00)==0x6800))
  141. #define TE_setisvftable(t) ((t)=(((t)&~0x7C00)|0x6800))
  142. #define TE_isvbtable(t) (TE_isdata(t)&&(((t)&0x7C00)==0x7000))
  143. #define TE_setisvbtable(t) ((t)=(((t)&~0x7C00)|0x7000))
  144. #define TE_ismetaclass(t) (TE_isdata(t)&&(((t)&0x7C00)==0x7800))
  145. #define TE_setismetaclass(t) ((t)=(((t)&~0x7C00)|0x7800))
  146. #define TE_isvdispmap(t) (TE_isdata(t)&&(((t)&0x7C00)==0x7C00))
  147. #define TE_setvdispmap(t) ((t)=(((t)&~0x7C00)|0x7C00))
  148. #define TE_islocal(t) (TE_isdata(t)&&(((t)&0x6000)==0x2000))
  149. #define TE_setislocal(t) ((t)=(((t)&~0x6000)|0x2000))
  150. #define TE_isglobal(t) (TE_isdata(t)&&(((t)&0x6000)==0x4000))
  151. #define TE_setisglobal(t) ((t)=(((t)&~0x6000)|0x4000))
  152. #define TE_member ((unsigned char)0)
  153. #define TE_static ((unsigned char)2)
  154. #define TE_virtual ((unsigned char)4)
  155. #define TE_adjustor ((unsigned char)6)
  156. #define TE_external ((unsigned char)24)
  157. #define TE_far ((unsigned char)0x01)
  158. #define TE_private ((unsigned char)0x00)
  159. #define TE_protect ((unsigned char)0x08)
  160. #define TE_public ((unsigned char)0x10)
  161. #define TE_access (TE_protect|TE_public)
  162. #define TE_private_d ((unsigned char)0x00)
  163. #define TE_protect_d ((unsigned char)0x01)
  164. #define TE_public_d ((unsigned char)0x02)
  165. #define TE_access_d (TE_protect_d|TE_public_d)
  166. #define TE_private_vadj ((unsigned char)0x00)
  167. #define TE_protect_vadj ((unsigned char)0x02)
  168. #define TE_public_vadj ((unsigned char)0x04)
  169. #define TE_access_vadj (TE_protect_vadj|TE_public_vadj)
  170. #define TE_static_d ((unsigned char)'0')
  171. #define TE_global ((unsigned char)'3')
  172. #define TE_local ((unsigned char)'4')
  173. #define TE_guard ((unsigned char)'5')
  174. #define TE_vftable ((unsigned char)'6')
  175. #define TE_vbtable ((unsigned char)'7')
  176. #define TE_metatype ((unsigned char)'8')
  177. #define TE_vcall ((unsigned char)'9')
  178. // Values for the 'data-indirect-type'
  179. #define DIT_near ((unsigned char)0x00)
  180. #define DIT_far ((unsigned char)0x04)
  181. #define DIT_huge ((unsigned char)0x08)
  182. #define DIT_based ((unsigned char)0x0C)
  183. #define DIT_modelmask ((unsigned char)0x0C)
  184. #define DIT_const ((unsigned char)0x01)
  185. #define DIT_volatile ((unsigned char)0x02)
  186. #define DIT_member ((unsigned char)0x10)
  187. #define DIT_ptr64 ((unsigned char)0x04)
  188. #define DIT_unaligned ((unsigned char)0x05)
  189. #define DIT_restrict ((unsigned char)0x08)
  190. // Values for the 'calling-convention'
  191. #define CC_cdecl ((unsigned char)0x00)
  192. #define CC_pascal ((unsigned char)0x02)
  193. #define CC_thiscall ((unsigned char)0x04)
  194. #define CC_stdcall ((unsigned char)0x06)
  195. #define CC_fastcall ((unsigned char)0x08)
  196. #define CC_interrupt ((unsigned char)0x0A)
  197. #define CC_cocall ((unsigned char)0x0C)
  198. #define CC_saveregs ((unsigned char)0x01)
  199. // Values for the 'data-type'
  200. #define DT_void 'X'
  201. // Values for the 'reference-data-type'
  202. #define RDT_array 'Y'
  203. // Values for the 'pointer-data-type'
  204. #define PoDT_void 'X'
  205. // Values for the 'primary-data-type'
  206. #define PDT_reference 'A'
  207. #define PDT_volatileReference 'B'
  208. #define PDT_extend '$'
  209. #define PDT_ex_function 'A'
  210. #define PDT_ex_other 'B'
  211. #define PDT_ex_qualified 'C'
  212. // Values for com+ pointer types __gc and __pin
  213. #define PDT_GCPointer 'A'
  214. #define PDT_PinnedPointer 'B'
  215. // Values for the 'basic-data-type'
  216. #define BDT_unsigned 0x01
  217. #define BDT_const 0x01
  218. #define BDT_volatile 0x02
  219. #define BDT_schar 'C'
  220. #define BDT_char 'D'
  221. #define BDT_short 'F'
  222. #define BDT_int 'H'
  223. #define BDT_long 'J'
  224. #define BDT_segment 'L'
  225. #define BDT_float 'M'
  226. #define BDT_double 'N'
  227. #define BDT_longdouble 'O'
  228. #define BDT_pointer 'P'
  229. #define BDT_union 'T'
  230. #define BDT_struct 'U'
  231. #define BDT_class 'V'
  232. #define BDT_enum 'W'
  233. // Adding big ints overflows the available BDT_* codes, so we extend to
  234. // 2 char codes, with a '_' as a lead in char
  235. #define BDT_extend '_' //1st char of 2 char codes
  236. #define BDT_int8 'D'
  237. #define BDT_int16 'F'
  238. #define BDT_int32 'H'
  239. #define BDT_int64 'J'
  240. #define BDT_int128 'L'
  241. #define BDT_bool 'N'
  242. #define BDT_array 'O'
  243. #define BDT_wchar_t 'W'
  244. #if CC_COR
  245. #define BDT_coclass 'X'
  246. #define BDT_cointerface 'Y'
  247. #endif // CC_COR
  248. // Values for the 'enum-type'
  249. #define ET_schar '0'
  250. #define ET_uchar '1'
  251. #define ET_sshort '2'
  252. #define ET_ushort '3'
  253. #define ET_sint '4'
  254. #define ET_uint '5'
  255. #define ET_slong '6'
  256. #define ET_ulong '7'
  257. // Values for the 'function-indirect-type'
  258. #define FIT_near 0x00
  259. #define FIT_far 0x01
  260. #define FIT_member 0x02
  261. #define FIT_based 0x04
  262. // Values for the 'function-indirect-type'
  263. #define AT_void 'X'
  264. #define AT_ellipsis 'Z'
  265. #define AT_endoflist '@'
  266. // Values for 'indirect-type'
  267. #define IT_isfunction(it) ((((it)>='6')&&((it)<='9'))||((it)=='_'))
  268. // Values for the 'based-type'
  269. #define BT_void '0'
  270. #define BT_self '1'
  271. #define BT_nearptr '2'
  272. #define BT_farptr '3'
  273. #define BT_hugeptr '4'
  274. #define BT_basedptr '5'
  275. #define BT_segment '6'
  276. #define BT_segname '7'
  277. #define BT_segaddr '8'
  278. // Values for the 'based-type'
  279. //#define TT_illegal '@' // An illegal value to keep the algorithm happy
  280. // Value for the 'vcall-model-type'
  281. #define VMT_nTnCnV 'A'
  282. #define VMT_nTfCnV 'B'
  283. #define VMT_fTnCnV 'C'
  284. #define VMT_fTfCnV 'D'
  285. #define VMT_nTnCfV 'E'
  286. #define VMT_nTfCfV 'F'
  287. #define VMT_fTnCfV 'G'
  288. #define VMT_fTfCfV 'H'
  289. #define VMT_nTnCbV 'I'
  290. #define VMT_nTfCbV 'J'
  291. #define VMT_fTnCbV 'K'
  292. #define VMT_fTfCbV 'L'
  293. // Values for the 'letter' and 'number'
  294. #define isValidLetter(n) (((n)=='_')||((n)=='$')||(((n)>='a')&&((n)<='z'))||(((n)>='A')&&((n)<='Z')))
  295. #define isValidNumber(n) (((n)>='0')&&((n)<='9'))
  296. #define isValidIdentChar(n) (isValidLetter(n)||isValidNumber(n))
  297. // Values for the 'template-constant'
  298. #define TC_nullptr '@'
  299. #define TC_integral '0'
  300. #define TC_address '1'
  301. #define TC_fp '2'
  302. #define TC_fp_dot 'A'
  303. #define TC_fp_minus 'B'
  304. #define TC_fp_plus 'C'
  305. #define TC_dummy 'D'
  306. #define TC_name 'E'
  307. #define TC_vptmd 'F'
  308. #define TC_gptmd 'G'
  309. #define TC_mptmf 'H'
  310. #define TC_vptmf 'I'
  311. #define TC_gptmf 'J'
  312. #define TC_nontype_dummy 'Q'
  313. //
  314. // Encoding for special help function
  315. //
  316. #define SHF_localdtor 'A'
  317. #define SHF_vcall 'B'
  318. #define SHF_vdispmap 'C'
  319. #define SHF_templateStaticDataMemberCtor 'D'
  320. #define SHF_templateStaticDataMemberDtor 'E'
  321. #define SHF_CPPManagedILFunction 'F'
  322. #define SHF_CPPManagedNativeFunction 'G'
  323. #define SHF_CPPManagedILMain 'H'
  324. #define SHF_CPPManagedNativeMain 'I'
  325. #define SHF_CManagedILFunction 'J'
  326. #define SHF_CManagedNativeFunction 'K'
  327. #define SHF_CPPManagedILDLLImportData 'L'
  328. #define SHF_CPPManagedNativeDLLImportData 'M'
  329. #define SHF_CManagedILDLLImportData 'N'
  330. #define SHF_CManagedNativeDLLImportData 'O'
  331. #define SHF_AnyDLLImportMethod 'P'