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.

435 lines
14 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1999 **/
  4. /*****************************************************************************/
  5. /*****************************************************************************
  6. File : acfattr.hxx
  7. Title : acf attribute node definition file
  8. Description : this file contains all the definitions of the
  9. : acfattribute nodes
  10. History :
  11. 24-Aug-1991 VibhasC Create
  12. *****************************************************************************/
  13. #ifndef __ACFATTR__HXX
  14. #define __ACFATTR__HXX
  15. #include "linenum.hxx"
  16. #include "cmdana.hxx"
  17. #define ALLOCATE_SINGLE_NODE (0x0001)
  18. #define ALLOCATE_ALL_NODES (0x0002)
  19. #define ALLOCATE_DONT_FREE (0x0004)
  20. #define ALLOCATE_FREE (0x0008)
  21. #define ALLOCATE_ALWAYS (0x0010)
  22. #define ALLOCATE_ON_NULL (0x0020)
  23. #define ALLOCATE_ALL_NODES_ALIGNED (0x0102)
  24. #define IS_ALLOCATE( AllocateType, CheckType ) ( AllocateType & CheckType )
  25. //
  26. // scenarios where allocate is illegal.
  27. //
  28. #define TRANSMIT_AS_WITH_ALLOCATE (0x0001)
  29. #define HANDLES_WITH_ALLOCATE (0x0002)
  30. // introduce a common base class for all the ACF attributes, since we need to store
  31. // line number info for them
  32. class acf_attr : public nbattr
  33. {
  34. public:
  35. tracked_node Position;
  36. acf_attr( ATTR_T At ) : nbattr ( At )
  37. {
  38. }
  39. BOOL IsAcfAttr()
  40. {
  41. return TRUE;
  42. }
  43. };
  44. class node_represent_as : public acf_attr
  45. {
  46. protected:
  47. char * pRepresentName;
  48. node_skl * pType;
  49. public:
  50. node_represent_as( char *p ):
  51. acf_attr( ATTR_REPRESENT_AS )
  52. {
  53. pRepresentName = p;
  54. pType = NULL;
  55. }
  56. node_represent_as( char *p,
  57. node_skl * pT,
  58. ATTR_T Attr = ATTR_REPRESENT_AS ):
  59. acf_attr( Attr )
  60. {
  61. pRepresentName = p;
  62. pType = pT;
  63. }
  64. node_represent_as( node_represent_as * pOld )
  65. : acf_attr( pOld->GetAttrID() )
  66. {
  67. *this = *pOld;
  68. }
  69. char * GetRepresentationName()
  70. {
  71. return pRepresentName;
  72. }
  73. node_skl * GetRepresentationType()
  74. {
  75. return pType;
  76. }
  77. virtual
  78. node_base_attr * Clone()
  79. {
  80. return new node_represent_as( this );
  81. }
  82. };
  83. ////////////////////////////////////////////////////////////////////////////
  84. // user_marshal attribute
  85. ////////////////////////////////////////////////////////////////////////////
  86. class node_user_marshal : public node_represent_as
  87. {
  88. public:
  89. node_user_marshal( char * pName, node_skl * pN )
  90. :
  91. node_represent_as( pName, pN, ATTR_USER_MARSHAL )
  92. {
  93. }
  94. node_user_marshal( node_user_marshal * pOld )
  95. :
  96. node_represent_as( (node_represent_as *)pOld )
  97. {
  98. *this = *pOld;
  99. }
  100. virtual
  101. node_base_attr * Clone()
  102. {
  103. node_base_attr * pNew = new node_user_marshal( this );
  104. return pNew;
  105. }
  106. node_skl * GetUserMarshalType()
  107. {
  108. return pType;
  109. }
  110. };
  111. class node_call_as : public acf_attr
  112. {
  113. private:
  114. char * pCallAsName;
  115. node_proc * pType;
  116. public:
  117. node_call_as( char *p ):
  118. acf_attr( ATTR_CALL_AS )
  119. {
  120. pCallAsName = p;
  121. pType = NULL;
  122. }
  123. node_call_as( char *p, node_skl * pT ):
  124. acf_attr( ATTR_CALL_AS )
  125. {
  126. pCallAsName = p;
  127. pType = (node_proc *) pT;
  128. }
  129. node_call_as( node_call_as * pOld )
  130. : acf_attr( pOld->GetAttrID() )
  131. {
  132. *this = *pOld;
  133. }
  134. char * GetCallAsName()
  135. {
  136. return pCallAsName;
  137. }
  138. void SetCallAsName( char* szName )
  139. {
  140. pCallAsName = szName;
  141. }
  142. node_proc * GetCallAsType()
  143. {
  144. return pType;
  145. }
  146. node_proc * SetCallAsType( node_skl * pT)
  147. {
  148. return ( pType = (node_proc *) pT );
  149. }
  150. virtual
  151. node_base_attr * Clone()
  152. {
  153. return new node_call_as( this );
  154. }
  155. };
  156. class node_byte_count : public acf_attr
  157. {
  158. private:
  159. node_param * pByteCountParam;
  160. public:
  161. node_byte_count( node_param *p ) :
  162. acf_attr( ATTR_BYTE_COUNT )
  163. {
  164. pByteCountParam = p;
  165. }
  166. node_byte_count( node_byte_count * pOld )
  167. : acf_attr( pOld->GetAttrID() )
  168. {
  169. *this = *pOld;
  170. }
  171. virtual
  172. node_base_attr * Clone()
  173. {
  174. return new node_byte_count( this );
  175. }
  176. node_param * GetByteCountParam()
  177. {
  178. return pByteCountParam;
  179. }
  180. virtual void SetByteCountParam( node_param* pNew )
  181. {
  182. pByteCountParam = pNew;
  183. }
  184. };
  185. ////////////////////////////////////////////////////////////////////////////
  186. // optimization attribute
  187. ////////////////////////////////////////////////////////////////////////////
  188. extern OPT_LEVEL_ENUM
  189. ParseAcfOptimizationAttr( char * pOptString, unsigned short * pOptFlags );
  190. class node_optimize : public acf_attr
  191. {
  192. OPT_LEVEL_ENUM OptimizationLevel;
  193. unsigned short OptimizationFlags;
  194. public:
  195. node_optimize( OPT_LEVEL_ENUM OptLevel,
  196. unsigned short OptFlags )
  197. : acf_attr( ATTR_OPTIMIZE ),
  198. OptimizationLevel( OptLevel ),
  199. OptimizationFlags( OptFlags )
  200. {
  201. }
  202. node_optimize( node_optimize * pOld )
  203. : acf_attr( pOld->GetAttrID() )
  204. {
  205. *this = *pOld;
  206. }
  207. virtual
  208. node_base_attr * Clone();
  209. unsigned short GetOptimizationFlags()
  210. {
  211. return OptimizationFlags;
  212. }
  213. OPT_LEVEL_ENUM GetOptimizationLevel()
  214. {
  215. return OptimizationLevel;
  216. }
  217. };
  218. ////////////////////////////////////////////////////////////////////////////
  219. // ptr_size attribute
  220. ////////////////////////////////////////////////////////////////////////////
  221. class node_ptr_size : public acf_attr
  222. {
  223. public:
  224. node_ptr_size() : acf_attr( ATTR_PTRSIZE )
  225. {
  226. }
  227. node_ptr_size( node_ptr_size * pOld )
  228. : acf_attr( pOld->GetAttrID() )
  229. {
  230. *this = *pOld;
  231. }
  232. virtual
  233. node_base_attr * Clone();
  234. };
  235. ////////////////////////////////////////////////////////////////////////////
  236. // enable_allocate attribute
  237. ////////////////////////////////////////////////////////////////////////////
  238. ////////////////////////////////////////////////////////////////////////////
  239. // implicit handle attribute
  240. ////////////////////////////////////////////////////////////////////////////
  241. class node_id;
  242. class CG_CLASS;
  243. class XLAT_CTXT;
  244. class node_implicit : public acf_attr
  245. {
  246. public:
  247. node_id * pHandleID;
  248. node_skl * pHandleType;
  249. public:
  250. node_implicit( node_skl *, node_id *);
  251. node_implicit( node_implicit * pOld )
  252. : acf_attr( pOld->GetAttrID() )
  253. {
  254. *this = *pOld;
  255. }
  256. virtual
  257. node_base_attr * Clone();
  258. void ImplicitHandleDetails( node_skl**, node_id **);
  259. BOOL IsHandleTypeDefined();
  260. virtual
  261. CG_CLASS * ILxlate( XLAT_CTXT * pContext );
  262. };
  263. ////////////////////////////////////////////////////////////////////////////
  264. // allocate attribute
  265. ////////////////////////////////////////////////////////////////////////////
  266. class node_allocate : public acf_attr
  267. {
  268. private:
  269. short AllocateDetails;
  270. public:
  271. node_allocate( short Details)
  272. : acf_attr( ATTR_ALLOCATE )
  273. {
  274. AllocateDetails = Details;
  275. }
  276. node_allocate( node_allocate * pOld )
  277. : acf_attr( pOld->GetAttrID() )
  278. {
  279. *this = *pOld;
  280. }
  281. virtual
  282. node_base_attr * Clone()
  283. {
  284. return new node_allocate( this );
  285. }
  286. short GetAllocateDetails()
  287. {
  288. return AllocateDetails;
  289. };
  290. };
  291. ////////////////////////////////////////////////////////////////////////////
  292. // cs_char attribute
  293. ////////////////////////////////////////////////////////////////////////////
  294. class node_cs_char : public acf_attr
  295. {
  296. private:
  297. // The type node for the user type
  298. node_skl *pUserType;
  299. // The size of the user type (not set until ILxlate is done)
  300. long ElementSize;
  301. public:
  302. node_cs_char( node_skl *p )
  303. : acf_attr( ATTR_CSCHAR )
  304. {
  305. pUserType = p;
  306. }
  307. node_skl * GetUserType()
  308. {
  309. return pUserType;
  310. }
  311. PNAME GetUserTypeName()
  312. {
  313. return pUserType->GetSymName();
  314. }
  315. void SetElementSize( long size )
  316. {
  317. MIDL_ASSERT( size >= 0 && size <= 255 );
  318. ElementSize = size;
  319. }
  320. long GetElementSize()
  321. {
  322. return ElementSize;
  323. }
  324. };
  325. ////////////////////////////////////////////////////////////////////////////
  326. // cs_tag_rtn attribute
  327. ////////////////////////////////////////////////////////////////////////////
  328. class node_cs_tag_rtn : public acf_attr
  329. {
  330. private:
  331. node_proc * pCSTagRoutine;
  332. public:
  333. node_cs_tag_rtn( node_skl *p )
  334. : acf_attr( ATTR_CSTAGRTN )
  335. {
  336. MIDL_ASSERT( NODE_PROC == p->NodeKind() );
  337. pCSTagRoutine = (node_proc *) p;
  338. }
  339. node_proc * GetCSTagRoutine()
  340. {
  341. return pCSTagRoutine;
  342. }
  343. };
  344. #endif // __ACFATTR__HXX