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.

361 lines
14 KiB

  1. // Copyright (c) 1996-1999 Microsoft Corporation
  2. ---- how to add new keywords to the parser ----
  3. if the keyword is a global (not associated with a Feature or Option
  4. or other structure) add an entry into the GLOBALATTRIB structure
  5. in parsers\gpd\gpdparse.h . The entry should be of type ATREEREF.
  6. Add an entry into the GLOBALS structure in \inc\gpd.h
  7. (if this is a Unidrv specific attribute)
  8. or into UIINFO structure in parser.h if it is used by the
  9. UI or common also to Pscript.
  10. If the keyword belongs to a Feature or Option structure
  11. add an entry into the DFEATURE_OPTIONS structure
  12. in parsers\gpd\gpdparse.h . The entry should be of type ATREEREF.
  13. Add an entry into the GID_EX specific structure in \inc\gpd.h
  14. if the keyword is specific to one Feature and is not used by the
  15. UIModule. Add it to the GID option structure in \inc\parser.h
  16. if the keyword is specific to one Feature and is used by the
  17. UI and Control Modules. Add to the FEATURE structure in \inc\parser.h
  18. if its a feature keyword.
  19. if the new keyword has a CONSTANTS valuetype, add an enum value to
  20. the CONSTANT_CLASSES enumeration. (in gpdparse.h)
  21. This value is the CONSTANT_CLASS_ENUMERATION_VALUE and identifies
  22. the set of CONSTANTS that may be used with this keyword.
  23. next enumerate a set of constants to be associated
  24. with each allowed value for that keyword.
  25. (\inc\gpd.h)
  26. //
  27. // define values for *YMoveAttributes keyword
  28. //
  29. typedef enum _YMOVEATTRIBUTE {
  30. YMOVE_FAVOR_ABS,
  31. YMOVE_FAVOR_LINEFEEDSPACING,
  32. YMOVE_SENDCR_FIRST,
  33. } YMOVEATTRIBUTE;
  34. now add a list of pairs to the CONSTANTDEF gConstantsTable[]
  35. (globals.h)
  36. which associate the constant values just enumerated with
  37. the "STRINGS" representing these constants in the GPD spec.
  38. This list is prefaced by {NULL, CONSTANT_CLASS_ENUMERATION_VALUE}.
  39. The position this list appears in CONSTANTDEF gConstantsTable[]
  40. is determined by CONSTANT_CLASS_ENUMERATION_VALUE. The lists
  41. are ordered in ascending value of CONSTANT_CLASS_ENUMERATION_VALUE.
  42. {NULL, CL_YMOVEATTRIB},
  43. {"FAVOR_ABS", YMOVE_FAVOR_ABS},
  44. {"FAV_LF", YMOVE_FAVOR_LINEFEEDSPACING},
  45. {"SEND_CR_FIRST", YMOVE_SENDCR_FIRST},
  46. add an entry to the VALUE enumeration gpdparse.h
  47. of the form:
  48. VALUE_CONSTANT_YMOVEATTRIB = VALUE_CONSTANT_FIRST + CL_YMOVEATTRIB ,
  49. in framwrk1.c add an entry of this form to
  50. VOID VinitMainKeywordTable()
  51. // *YMoveAttributes:
  52. mMainKeywordTable[dwI].pstrKeyword = "YMoveAttributes" ;
  53. mMainKeywordTable[dwI].eAllowedValue = VALUE_CONSTANT_YMOVEATTRIB ;
  54. mMainKeywordTable[dwI].flAgs = KWF_LIST ;
  55. mMainKeywordTable[dwI].eType = TY_ATTRIBUTE ;
  56. mMainKeywordTable[dwI].dwSubType = ATT_GLOBAL_FREEFLOAT ;
  57. mMainKeywordTable[dwI].dwOffset = offsetof(GLOBALATTRIB,
  58. atrYMoveAttributes) ;
  59. dwI++ ;
  60. // ---- MainKeyword table Section ---- //
  61. /* the MainKeyword table contains static information that
  62. describes each main keyword. This table controls what action
  63. the parser takes. First define several enumerations used
  64. in the table. */
  65. typedef enum
  66. {
  67. TY_CONSTRUCT, TY_ATTRIBUTE, TY_SPECIAL
  68. } KEYWORD_TYPE ;
  69. typedef enum
  70. {
  71. ATT_GLOBAL_ONLY, ATT_GLOBAL_FREEFLOAT,
  72. ATT_LOCAL_FEATURE_ONLY, ATT_LOCAL_FEATURE_FF ,
  73. ATT_LOCAL_OPTION_ONLY, ATT_LOCAL_OPTION_FF ,
  74. ATT_LOCAL_COMMAND_ONLY, ATT_LOCAL_FONTCART_ONLY,
  75. ATT_LOCAL_TTFONTSUBS_ONLY, ATT_LOCAL_OEM_ONLY,
  76. ATT_LAST // Must be last in list.
  77. } ATTRIBUTE ; // subtype
  78. typedef enum
  79. {
  80. CONSTRUCT_UIGROUP ,
  81. CONSTRUCT_FEATURE ,
  82. CONSTRUCT_OPTION ,
  83. CONSTRUCT_SWITCH,
  84. CONSTRUCT_CASE ,
  85. CONSTRUCT_DEFAULT ,
  86. CONSTRUCT_COMMAND ,
  87. CONSTRUCT_FONTCART ,
  88. CONSTRUCT_TTFONTSUBS ,
  89. CONSTRUCT_OEM ,
  90. CONSTRUCT_LAST, // must end list of transition inducing constructs.
  91. // constructs below do not cause state transitions
  92. CONSTRUCT_BLOCKMACRO ,
  93. CONSTRUCT_MACROS,
  94. CONSTRUCT_OPENBRACE,
  95. CONSTRUCT_CLOSEBRACE,
  96. } CONSTRUCT ; // SubType if Type = CONSTRUCT
  97. typedef enum
  98. {
  99. SPEC_TTFS, SPEC_FONTSUB, SPEC_INVALID_COMBO,
  100. SPEC_COMMAND_SHORTCUT,
  101. SPEC_CONSTR, SPEC_INS_CONSTR,
  102. SPEC_NOT_INS_CONSTR, SPEC_INVALID_INS_COMBO,
  103. SPEC_MEM_CONFIG_KB, SPEC_MEM_CONFIG_MB,
  104. SPEC_INCLUDE, SPEC_INSERTBLOCK
  105. } SPECIAL ;
  106. // what value type does the parser expect after each keyword?
  107. typedef enum
  108. {
  109. NO_VALUE , // a linebreak OR an effective linebreak: ({) or comment
  110. // or optional value.
  111. VALUE_INTEGER, // integer
  112. VALUE_POINT, // point
  113. VALUE_RECT, // rectangle
  114. // VALUE_BOOLEAN, // a subset of constants.
  115. VALUE_QUALIFIED_NAME, // Qualified name (two symbols separated by .
  116. VALUE_PARTIALLY_QUALIFIED_NAME , // (just one symbol or two symbols
  117. // separated by .)
  118. VALUE_CONSTRAINT, // list of qualified names but stored differently.
  119. VALUE_ORDERDEPENDENCY,
  120. VALUE_FONTSUB, // "fontname" : <int>
  121. // VALUE_STRING, // Quoted String, hexstring, string MACROREF,
  122. // parameterless invocation.
  123. VALUE_STRING_NO_CONVERT, // string will not undergo unicode conversion
  124. // for example *GPDSpecVersion must remain an ascii string.
  125. VALUE_STRING_DEF_CONVERT, // string will be converted using the
  126. // system codepage - filenames
  127. VALUE_STRING_CP_CONVERT, // string will be converted using the
  128. // codepage specified by *CodePage
  129. VALUE_COMMAND_INVOC, // like VALUE_STRING but allowed to contain
  130. // one or more parameter references.
  131. VALUE_COMMAND_SHORTCUT, // Commandname:VALUE_COMMAND_INVOC
  132. VALUE_SYMBOL_DEF, // * the value defines a symbol or value macro
  133. // { and } are not permitted. Is this ever used ? yes
  134. VALUE_SYMBOL_FIRST, // base of user-defined symbol catagory
  135. VALUE_SYMBOL_FEATURES = VALUE_SYMBOL_FIRST + SCL_FEATURES , //
  136. VALUE_SYMBOL_FONTCART = VALUE_SYMBOL_FIRST + SCL_FONTCART , //
  137. VALUE_SYMBOL_TTFONTNAMES = VALUE_SYMBOL_FIRST + SCL_TTFONTNAMES , //
  138. VALUE_SYMBOL_BLOCKMACRO = VALUE_SYMBOL_FIRST + SCL_BLOCKMACRO , //
  139. VALUE_SYMBOL_VALUEMACRO = VALUE_SYMBOL_FIRST + SCL_VALUEMACRO , //
  140. VALUE_SYMBOL_OPTIONS = VALUE_SYMBOL_FIRST + SCL_OPTIONS , //
  141. // SCL_COMMANDNAMES intentionally omitted.
  142. VALUE_SYMBOL_LAST = VALUE_SYMBOL_FIRST + SCL_NUMSYMCLASSES - 1 , //
  143. VALUE_CONSTANT_FIRST, // base of enumeration catagory.
  144. VALUE_CONSTANT_BOOLEANTYPE = VALUE_CONSTANT_FIRST + CL_BOOLEANTYPE ,
  145. VALUE_CONSTANT_PRINTERTYPE = VALUE_CONSTANT_FIRST + CL_PRINTERTYPE ,
  146. VALUE_CONSTANT_FEATURETYPE = VALUE_CONSTANT_FIRST + CL_FEATURETYPE ,
  147. VALUE_CONSTANT_UITYPE = VALUE_CONSTANT_FIRST + CL_UITYPE ,
  148. VALUE_CONSTANT_PROMPTTIME = VALUE_CONSTANT_FIRST + CL_PROMPTTIME ,
  149. VALUE_CONSTANT_PAPERFEED_ORIENT = VALUE_CONSTANT_FIRST + CL_PAPERFEED_ORIENT ,
  150. VALUE_CONSTANT_COLORPLANE = VALUE_CONSTANT_FIRST + CL_COLORPLANE ,
  151. VALUE_CONSTANT_SEQSECTION = VALUE_CONSTANT_FIRST + CL_SEQSECTION ,
  152. VALUE_CONSTANT_RASTERCAPS = VALUE_CONSTANT_FIRST + CL_RASTERCAPS ,
  153. VALUE_CONSTANT_TEXTCAPS = VALUE_CONSTANT_FIRST + CL_TEXTCAPS ,
  154. VALUE_CONSTANT_MEMORYUSAGE = VALUE_CONSTANT_FIRST + CL_MEMORYUSAGE ,
  155. VALUE_CONSTANT_CURSORXAFTERCR = VALUE_CONSTANT_FIRST + CL_CURSORXAFTERCR ,
  156. VALUE_CONSTANT_BADCURSORMOVEINGRXMODE = VALUE_CONSTANT_FIRST + CL_BADCURSORMOVEINGRXMODE ,
  157. // VALUE_CONSTANT_SIMULATEXMOVE = VALUE_CONSTANT_FIRST + CL_SIMULATEXMOVE ,
  158. VALUE_CONSTANT_PALETTESCOPE = VALUE_CONSTANT_FIRST + CL_PALETTESCOPE ,
  159. VALUE_CONSTANT_OUTPUTDATAFORMAT = VALUE_CONSTANT_FIRST + CL_OUTPUTDATAFORMAT ,
  160. VALUE_CONSTANT_STRIPBLANKS = VALUE_CONSTANT_FIRST + CL_STRIPBLANKS ,
  161. VALUE_CONSTANT_LANDSCAPEGRXROTATION = VALUE_CONSTANT_FIRST + CL_LANDSCAPEGRXROTATION ,
  162. VALUE_CONSTANT_CURSORXAFTERSENDBLOCKDATA = VALUE_CONSTANT_FIRST + CL_CURSORXAFTERSENDBLOCKDATA ,
  163. VALUE_CONSTANT_CURSORYAFTERSENDBLOCKDATA = VALUE_CONSTANT_FIRST + CL_CURSORYAFTERSENDBLOCKDATA ,
  164. VALUE_CONSTANT_CHARPOSITION = VALUE_CONSTANT_FIRST + CL_CHARPOSITION ,
  165. VALUE_CONSTANT_FONTFORMAT = VALUE_CONSTANT_FIRST + CL_FONTFORMAT ,
  166. VALUE_CONSTANT_QUERYDATATYPE = VALUE_CONSTANT_FIRST + CL_QUERYDATATYPE ,
  167. VALUE_CONSTANT_YMOVEATTRIB = VALUE_CONSTANT_FIRST + CL_YMOVEATTRIB ,
  168. VALUE_CONSTANT_DLSYMBOLSET = VALUE_CONSTANT_FIRST + CL_DLSYMBOLSET ,
  169. VALUE_CONSTANT_CURXAFTER_RECTFILL = VALUE_CONSTANT_FIRST + CL_CURXAFTER_RECTFILL ,
  170. VALUE_CONSTANT_CURYAFTER_RECTFILL = VALUE_CONSTANT_FIRST + CL_CURYAFTER_RECTFILL ,
  171. VALUE_CONSTANT_PRINTRATEUNIT = VALUE_CONSTANT_FIRST + CL_PRINTRATEUNIT ,
  172. VALUE_CONSTANT_STANDARD_VARS = VALUE_CONSTANT_FIRST + CL_STANDARD_VARS ,
  173. VALUE_CONSTANT_COMMAND_NAMES = VALUE_CONSTANT_FIRST + CL_COMMAND_NAMES ,
  174. VALUE_CONSTANT_CONS_FEATURES = VALUE_CONSTANT_FIRST + CL_CONS_FEATURES ,
  175. VALUE_CONSTANT_CONS_PAPERSIZE = VALUE_CONSTANT_FIRST + CL_CONS_PAPERSIZE ,
  176. VALUE_CONSTANT_CONS_MEDIATYPE = VALUE_CONSTANT_FIRST + CL_CONS_MEDIATYPE ,
  177. VALUE_CONSTANT_CONS_INPUTSLOT = VALUE_CONSTANT_FIRST + CL_CONS_INPUTSLOT ,
  178. VALUE_CONSTANT_CONS_DUPLEX = VALUE_CONSTANT_FIRST + CL_CONS_DUPLEX ,
  179. VALUE_CONSTANT_CONS_ORIENTATION = VALUE_CONSTANT_FIRST + CL_CONS_ORIENTATION ,
  180. VALUE_CONSTANT_CONS_PAGEPROTECT = VALUE_CONSTANT_FIRST + CL_CONS_PAGEPROTECT ,
  181. VALUE_CONSTANT_CONS_COLLATE = VALUE_CONSTANT_FIRST + CL_CONS_COLLATE ,
  182. VALUE_CONSTANT_LAST = VALUE_CONSTANT_FIRST + CL_NUMCLASSES - 1 ,
  183. VALUE_LIST, // no attribute actually is assigned this descriptor,
  184. // but used in the gValueToSize table.
  185. VALUE_LARGEST, // not a real descriptor, but this position in the
  186. // gValueToSize table holds the largest of the above values.
  187. VALUE_MAX, // number of elements in gValueToSize table.
  188. } VALUE ;
  189. // -- allowed values for KEYWORDTABLE_ENTRY.flAgs: --
  190. #define KWF_LIST (0x00000001)
  191. // the value may be a LIST containing one or more
  192. // items of type AllowedValue. The storage format
  193. // must be of type LIST. Only certain values may qualify
  194. // for list format.
  195. #define KWF_ADDITIVE (0x00000002)
  196. // this flag implies KWF_LIST and also specifies the behavior
  197. // that any redefinition of this keyword simply adds its items
  198. // onto the existing list. (removal of redundant items is not
  199. // performed.)
  200. #define KWF_MACROREF_ALLOWED (0x00000004)
  201. // since only a handful of keywords cannot accept
  202. // macro references, it may be a waste of a flag, but reserve this
  203. // to alert us that this special case must accounted for.
  204. #define KWF_SHORTCUT (0x00000008)
  205. // This keyword has multiple variants of syntax.
  206. // one of the following 3 flags is set
  207. // if the values in the nodes of the attribute tree
  208. // refer to indicies of dedicated arrays, (which obviously
  209. // contain data fields not ATREEREFs) AND
  210. // gMainKeywordTable[].dwOffset is an offset into
  211. // this dedicated array, then set this flag.
  212. // else dwOffset is used to select the treeroot.
  213. #define KWF_COMMAND (0x00000010)
  214. // This attribute is stored in a dedicated structure
  215. #define KWF_FONTCART (0x00000020)
  216. // This attribute is stored in a dedicated structure
  217. #define KWF_OEM (0x00000040)
  218. // This attribute is stored in a dedicated structure
  219. #define KWF_TTFONTSUBS (0x00000080)
  220. // This attribute is stored in a dedicated structure
  221. #define KWF_DEDICATED_FIELD (KWF_COMMAND | KWF_FONTCART | \
  222. KWF_OEM | KWF_TTFONTSUBS)
  223. // this flag is never set in the MainKeywordTable[].
  224. #define KWF_REQUIRED (0x00000100)
  225. // this keyword must appear in the GPD file
  226. also check the number of entries allocated for the mainkeyword
  227. table is sufficient to hold all of the new entries.
  228. See VOID VinitGlobals() in framwrk1.c
  229. gMasterTable[MTI_MAINKEYWORDTABLE].dwArraySize = 300 ;
  230. In BinitSnapShotTable - snaptbl.c add and initialize
  231. an entry in the snapShotTable. Be sure to place this
  232. entry in the proper section depending on the structure type
  233. of the destination.
  234. pmrbd->snapShotTable[dwI].dwSrcOffset = offsetof(GLOBALATTRIB,
  235. atrMasterUnits) ;
  236. pmrbd->snapShotTable[dwI].dwDestOffset = offsetof(UIINFO,
  237. ptMasterUnits) ;
  238. pmrbd->snapShotTable[dwI].dwNbytes = sizeof(POINT) ;
  239. pmrbd->snapShotTable[dwI].dwDefaultValue = 0 ;
  240. pmrbd->snapShotTable[dwI].dwFlags = SSF_REQUIRED ;
  241. pmrbd->snapShotTable[dwI].dwGIDflags = 0 ;
  242. dwI++ ;
  243. // flags for snapshot table.
  244. #define SSF_REQUIRED 0x00000001
  245. // fail if there is no value to copy
  246. #define SSF_DONT_USEDEFAULT 0x00000002
  247. // if there is no value to copy leave dest
  248. // undisturbed. Do not copy the default value.
  249. #define SSF_OFFSETONLY 0x00000004
  250. // Copy only the loOffset of an arrayref.
  251. #define SSF_MAKE_STRINGPTR 0x00000008
  252. // Convert arrayref to stringptr
  253. #define SSF_SETRCID 0x00000010
  254. // set high bit after copying the value (if found)
  255. #define SSF_FAILIFZERO 0x00000020
  256. // unlike SSF_REQUIRED, allow current copy
  257. // to fail, then fail only if dest is zero.
  258. #define SSF_SECOND_DWORD 0x00000040
  259. // treat src value object as array of DWORDS
  260. // and copy the 2nd DWORD to the destination.
  261. // used to transfer just the Y value of a point
  262. // to the dest.
  263. #define SSF_KB_TO_BYTES 0x00000080
  264. // treat dest as a dword and left shift by 10 bits.
  265. #define SSF_HEAPOFFSET 0x00000100
  266. // instead of copying the bytes at pheap + heapoffset
  267. // just copy heapoffset to the destination.
  268. // this is used with dedicated structures where
  269. // the heapoffset is actually the array index of a dedicated
  270. // structure.
  271. #define SSF_RETURN_UNINITIALIZED 0x00000200
  272. // if no value exists, cause EextractValueFromTree
  273. // to return TRI_UNINITIALIZED, but don't complain
  274. // to user.
  275. The snapShotTable is currently divided into the
  276. following sections:
  277. typedef enum
  278. {SSTI_GLOBALS, SSTI_UIINFO, SSTI_FEATURES, SSTI_OPTIONS, SSTI_OPTIONEX,
  279. SSTI_SPECIAL, MAX_STRUCTURETYPES}
  280. SSTABLEINDEX ;
  281. each section is delimited by a few lines:
  282. // end of SSTI_GLOBALS section
  283. pmrbd->snapShotTable[dwI].dwNbytes = 0 ;
  284. dwI++ ;
  285. // beginning of SSTI_UIINFO section