Leaked source code of windows server 2003
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.

341 lines
12 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 1
  6. #define FALSE 0
  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_uctor ((unsigned char)'C')
  57. #define OC_udtor ((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. // Values for the 'type-encoding'
  65. #define TE_isbadtype(t) ((t)==0xFFFF)
  66. #define TE_setisbadtype(t) ((t)=0xFFFF)
  67. #define TE_istruncated(t) ((t)==0xFFFE)
  68. #define TE_setistruncated(t) ((t)=0xFFFE)
  69. #define TE_isfunction(t) ((t)&0x8000)
  70. #define TE_setisfunction(t) ((t)|=0x8000)
  71. #define TE_isbased(t) ((t)&0x4000)
  72. #define TE_setisbased(t) ((t)|=0x4000)
  73. #define TE_isnear(t) (((t)&0x2000)==0x0000)
  74. #define TE_setisnear(t) ((t)&=~0x2000)
  75. #define TE_isfar(t) ((t)&0x2000)
  76. #define TE_setisfar(t) ((t)|=0x2000)
  77. #define TE_ismember(t) (TE_isfunction(t)?(((t)&0x1800)==0x0800):(((t)&0x6000)==0x0000))
  78. #define TE_setismember(t) (TE_isfunction(t)?((t)=(((t)&~0x1800)|0x0800)):((t)=((t)&~0x6000)))
  79. #define TE_isvirtual(t) (TE_isfunction(t)&&(((t)&0x0700)==0x0100))
  80. #define TE_setisvirtual(t) ((t)=(((t)&~0x0700)|0x0100))
  81. #define TE_isthunk(t) (TE_ismember(t)?((t)&0x0400):((t)&0x1000))
  82. #define TE_isvcall(t) (TE_isfunction(t)?(((t)&0x1800)==0x1800):0)
  83. #define TE_setisvcall(t) ((t)=(((t)&~0x9800)|0x9800))
  84. #define TE_islocaldtor(t) (TE_isfunction(t)?(((t)&0x1800)==0x1000):0)
  85. #define TE_setislocaldtor(t) ((t)=(((t)&~0x9800)|0x9000))
  86. #define TE_isadjustor(t) (TE_ismember(t)&&(((t)&0x0700)==0x0400))
  87. #define TE_setisadjustor(t) ((t)=(((t)&~0x0700)|0x0400))
  88. #define TE_isvtoradj(t) (TE_ismember(t)&&(((t)&0x0700)==0x0500))
  89. #define TE_setisvtoradj(t) ((t)=(((t)&~0x0700)|0x0500))
  90. #define TE_ispublic(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0000):(((t)&0x1800)==0x0000)))
  91. #define TE_setispublic(t) ((t)=(TE_isfunction(t)?((t)&~0x00C0):((t)&~0x1800)))
  92. #define TE_isprivate(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0040):(((t)&0x1800)==0x0800)))
  93. #define TE_setisprivate(t) ((t)=(TE_isfunction(t)?(((t)&~0x00C0)|0x0040):(((t)&~0x1800)|0x0800)))
  94. #define TE_isprotected(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x00C0)==0x0080):(((t)&0x1800)==0x1000)))
  95. #define TE_setisprotected(t) ((t)=(TE_isfunction(t)?(((t)&~0x00C0)|0x0080):(((t)&~0x1800)|0x1000)))
  96. #define TE_isstatic(t) (TE_ismember(t)&&(TE_isfunction(t)?(((t)&0x0700)==0x0200):1))
  97. #define TE_setisstatic(t) ((t)=(TE_isfunction(t)?(((t)&~0x0700)|0x0200):TE_setismember(t)))
  98. #define TE_isdata(t) (!TE_isfunction(t))
  99. #define TE_setisdata(t) ((t)&=~0x8000)
  100. #define TE_isguard(t) (TE_isdata(t)&&(((t)&0x7800)==0x6000))
  101. #define TE_setisguard(t) ((t)=(((t)&~0x7800)|0x6000))
  102. #define TE_isvftable(t) (TE_isdata(t)&&(((t)&0x7800)==0x6800))
  103. #define TE_setisvftable(t) ((t)=(((t)&~0x7800)|0x6800))
  104. #define TE_isvbtable(t) (TE_isdata(t)&&(((t)&0x7800)==0x7000))
  105. #define TE_setisvbtable(t) ((t)=(((t)&~0x7800)|0x7000))
  106. #define TE_ismetaclass(t) (TE_isdata(t)&&(((t)&0x7800)==0x7800))
  107. #define TE_setismetaclass(t) ((t)=(((t)&~0x7800)|0x7800))
  108. #define TE_islocal(t) (TE_isdata(t)&&(((t)&0x6000)==0x2000))
  109. #define TE_setislocal(t) ((t)=(((t)&~0x6000)|0x2000))
  110. #define TE_isglobal(t) (TE_isdata(t)&&(((t)&0x6000)==0x4000))
  111. #define TE_setisglobal(t) ((t)=(((t)&~0x6000)|0x4000))
  112. #define TE_member ((unsigned char)0)
  113. #define TE_static ((unsigned char)2)
  114. #define TE_virtual ((unsigned char)4)
  115. #define TE_adjustor ((unsigned char)6)
  116. #define TE_external ((unsigned char)24)
  117. #define TE_far ((unsigned char)0x01)
  118. #define TE_private ((unsigned char)0x00)
  119. #define TE_protect ((unsigned char)0x08)
  120. #define TE_public ((unsigned char)0x10)
  121. #define TE_access (TE_protect|TE_public)
  122. #define TE_private_d ((unsigned char)0x00)
  123. #define TE_protect_d ((unsigned char)0x01)
  124. #define TE_public_d ((unsigned char)0x02)
  125. #define TE_access_d (TE_protect_d|TE_public_d)
  126. #define TE_private_vadj ((unsigned char)0x00)
  127. #define TE_protect_vadj ((unsigned char)0x02)
  128. #define TE_public_vadj ((unsigned char)0x04)
  129. #define TE_access_vadj (TE_protect_vadj|TE_public_vadj)
  130. #define TE_static_d ((unsigned char)'0')
  131. #define TE_global ((unsigned char)'3')
  132. #define TE_local ((unsigned char)'4')
  133. #define TE_guard ((unsigned char)'5')
  134. #define TE_vftable ((unsigned char)'6')
  135. #define TE_vbtable ((unsigned char)'7')
  136. #define TE_metatype ((unsigned char)'8')
  137. // Values for the 'data-indirect-type'
  138. #define DIT_near ((unsigned char)0x00)
  139. #define DIT_far ((unsigned char)0x04)
  140. #define DIT_huge ((unsigned char)0x08)
  141. #define DIT_based ((unsigned char)0x0C)
  142. #define DIT_modelmask ((unsigned char)0x0C)
  143. #define DIT_const ((unsigned char)0x01)
  144. #define DIT_volatile ((unsigned char)0x02)
  145. #define DIT_member ((unsigned char)0x10)
  146. // Values for the 'calling-convention'
  147. #define CC_cdecl ((unsigned char)0x00)
  148. #define CC_pascal ((unsigned char)0x02)
  149. #define CC_syscall ((unsigned char)0x04)
  150. #define CC_stdcall ((unsigned char)0x06)
  151. #define CC_fastcall ((unsigned char)0x08)
  152. #define CC_interrupt ((unsigned char)0x0A)
  153. #define CC_saveregs ((unsigned char)0x01)
  154. // Values for the 'data-type'
  155. #define DT_void 'X'
  156. // Values for the 'reference-data-type'
  157. #define RDT_array 'Y'
  158. // Values for the 'pointer-data-type'
  159. #define PoDT_void 'X'
  160. // Values for the 'primary-data-type'
  161. #define PDT_reference 'A'
  162. #define PDT_volatileReference 'B'
  163. // Values for the 'basic-data-type'
  164. #define BDT_unsigned 0x01
  165. #define BDT_const 0x01
  166. #define BDT_volatile 0x02
  167. #define BDT_schar 'C'
  168. #define BDT_char 'D'
  169. #define BDT_short 'F'
  170. #define BDT_int 'H'
  171. #define BDT_long 'J'
  172. #define BDT_segment 'L'
  173. #define BDT_float 'M'
  174. #define BDT_double 'N'
  175. #define BDT_longdouble 'O'
  176. #define BDT_pointer 'P'
  177. #define BDT_union 'T'
  178. #define BDT_struct 'U'
  179. #define BDT_class 'V'
  180. #define BDT_enum 'W'
  181. // Values for the 'enum-type'
  182. #define ET_schar '0'
  183. #define ET_uchar '1'
  184. #define ET_sshort '2'
  185. #define ET_ushort '3'
  186. #define ET_sint '4'
  187. #define ET_uint '5'
  188. #define ET_slong '6'
  189. #define ET_ulong '7'
  190. // Values for the 'function-indirect-type'
  191. #define FIT_near 0x00
  192. #define FIT_far 0x01
  193. #define FIT_member 0x02
  194. #define FIT_based 0x04
  195. // Values for the 'function-indirect-type'
  196. #define AT_void 'X'
  197. #define AT_ellipsis 'Z'
  198. #define AT_endoflist '@'
  199. // Values for 'indirect-type'
  200. #define IT_isfunction(it) ((((it)>='6')&&((it)<='9'))||((it)=='_'))
  201. // Values for the 'based-type'
  202. #define BT_void '0'
  203. #define BT_self '1'
  204. #define BT_nearptr '2'
  205. #define BT_farptr '3'
  206. #define BT_hugeptr '4'
  207. #define BT_basedptr '5'
  208. #define BT_segment '6'
  209. #define BT_segname '7'
  210. #define BT_segaddr '8'
  211. // Values for the 'based-type'
  212. //#define TT_illegal '@' // An illegal value to keep the algorithm happy
  213. // Values for the 'ecsu-data-indirect-type'
  214. #define ECSU_near DIT_near
  215. #define ECSU_far DIT_far
  216. #define ECSU_huge DIT_huge
  217. #define ECSU_based DIT_based
  218. #define ECSU_modelmask DIT_modelmask
  219. #define ECSU_const DIT_const
  220. #define ECSU_volatile DIT_volatile
  221. #define ECSU_valid (0x8000)
  222. #define ECSU_invalid (0xFFFF)
  223. #define ECSU_truncated (0xFFFE)
  224. // Value for the 'vcall-model-type'
  225. #define VMT_nTnCnV 'A'
  226. #define VMT_nTfCnV 'B'
  227. #define VMT_fTnCnV 'C'
  228. #define VMT_fTfCnV 'D'
  229. #define VMT_nTnCfV 'E'
  230. #define VMT_nTfCfV 'F'
  231. #define VMT_fTnCfV 'G'
  232. #define VMT_fTfCfV 'H'
  233. #define VMT_nTnCbV 'I'
  234. #define VMT_nTfCbV 'J'
  235. #define VMT_fTnCbV 'K'
  236. #define VMT_fTfCbV 'L'
  237. // Values for the 'letter' and 'number'
  238. #define isValidLetter(n) (((n)=='_')||((n)=='$')||(((n)>='a')&&((n)<='z'))||(((n)>='A')&&((n)<='Z')))
  239. #define isValidNumber(n) (((n)>='0')&&((n)<='9'))
  240. #define isValidIdentChar(n) (isValidLetter(n)||isValidNumber(n))