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.

1991 lines
73 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. gpdparse.h
  5. Abstract:
  6. Header file for GPD parser
  7. Environment:
  8. Windows NT Universal printer driver.
  9. Revision History:
  10. --*/
  11. /*
  12. gpdparse.h - this holds structure definitions
  13. and other defines specific to the GPD parser
  14. */
  15. #ifndef _GPDPARSE_H_
  16. #define _GPDPARSE_H_
  17. #include "lib.h"
  18. #include "gpd.h"
  19. #ifdef GMACROS
  20. #define PRIVATE_PARSER_VERSION 0x0053
  21. #else
  22. #define PRIVATE_PARSER_VERSION 0x0052
  23. #endif
  24. #define GPD_PARSER_VERSION MAKELONG(PRIVATE_PARSER_VERSION, SHARED_PARSER_VERSION)
  25. // extra printrate units not defined in wingdi.h
  26. #define PRINTRATEUNIT_LPS 5
  27. #define PRINTRATEUNIT_IPS 6
  28. // ---- General Section ---- //
  29. typedef DWORD DWFLAGS ;
  30. #define FIRST_NON_STANDARD_ID 257
  31. #define FOREVER (1)
  32. #define BUD_FILENAME_EXT TEXT(".BUD")
  33. // "bud" in unicode. GPD -> BUD.
  34. // a non-relocatable string reference, but unlike an ARRAYREF, can access
  35. // addresses outside of the memory buffer defined by the base reference
  36. // pointer used by an ARRAYREF.
  37. // note: for all arrayrefs containing Strings the dw field holds the number
  38. // of bytes which the string contains. For Unicode strings this is TWICE
  39. // the number of Unicode characters.
  40. #define LOCALE_KEYWORD "Locale"
  41. typedef struct
  42. {
  43. PBYTE pub ;
  44. DWORD dw ;
  45. } ABSARRAYREF , * PABSARRAYREF ; // assign this struct the type 'aar'
  46. typedef struct
  47. {
  48. DWORD loOffset ;
  49. DWORD dwCount ;
  50. DWORD dwElementSiz ;
  51. } ENHARRAYREF , * PENHARRAYREF ; // assign this struct the type 'ear'
  52. // ---- End of General Section ---- //
  53. // ---- Constant Classes Section ---- //
  54. typedef enum
  55. {
  56. // -- Constant Classes -- //
  57. CL_BOOLEANTYPE,
  58. CL_PRINTERTYPE,
  59. CL_FEATURETYPE,
  60. CL_UITYPE,
  61. CL_PROMPTTIME,
  62. CL_PAPERFEED_ORIENT,
  63. CL_COLORPLANE,
  64. CL_SEQSECTION,
  65. CL_RASTERCAPS,
  66. CL_TEXTCAPS,
  67. CL_MEMORYUSAGE,
  68. CL_RESELECTFONT,
  69. CL_OEMPRINTINGCALLBACKS,
  70. CL_CURSORXAFTERCR,
  71. CL_BADCURSORMOVEINGRXMODE,
  72. // CL_SIMULATEXMOVE,
  73. CL_PALETTESCOPE,
  74. CL_OUTPUTDATAFORMAT,
  75. CL_STRIPBLANKS,
  76. CL_LANDSCAPEGRXROTATION,
  77. CL_CURSORXAFTERSENDBLOCKDATA,
  78. CL_CURSORYAFTERSENDBLOCKDATA,
  79. CL_CHARPOSITION,
  80. CL_FONTFORMAT,
  81. CL_QUERYDATATYPE,
  82. CL_YMOVEATTRIB,
  83. CL_DLSYMBOLSET,
  84. CL_CURXAFTER_RECTFILL,
  85. CL_CURYAFTER_RECTFILL,
  86. #ifndef WINNT_40
  87. CL_PRINTRATEUNIT,
  88. #endif
  89. CL_RASTERMODE,
  90. CL_QUALITYSETTING ,
  91. // the following aren't true constant classes per se,
  92. // but if the construct fits...
  93. CL_STANDARD_VARS, // names of Unidrv Standard Variables
  94. CL_COMMAND_NAMES, // Unidrv Command Names and index.
  95. CL_CONS_FEATURES, // reserved feature symbol names
  96. // reserved option symbol names for these predefined features
  97. CL_CONS_PAPERSIZE,
  98. CL_CONS_MEDIATYPE,
  99. CL_CONS_INPUTSLOT,
  100. CL_CONS_DUPLEX,
  101. CL_CONS_ORIENTATION,
  102. CL_CONS_PAGEPROTECT,
  103. CL_CONS_COLLATE,
  104. CL_CONS_HALFTONE,
  105. CL_NUMCLASSES
  106. } CONSTANT_CLASSES ; // enumerate types of constant classes
  107. typedef struct // only used in static gConstantsTable.
  108. {
  109. PBYTE pubName ;
  110. DWORD dwValue ;
  111. } CONSTANTDEF, * PCONSTANTDEF ;
  112. // this table associates ConstantNames with their defined values.
  113. // The table is divided into sections, one section per class.
  114. // the index table - gcieTable[] provides the index range
  115. // that each class occupies. Note the similarity to the arrangement
  116. // of the MainKeywordTable.
  117. extern CONST CONSTANTDEF gConstantsTable[] ;
  118. typedef struct
  119. {
  120. DWORD dwStart ; // index of first member of class
  121. DWORD dwCount ; // number of members in this class.
  122. } CLASSINDEXENTRY, * PCLASSINDEXENTRY ;
  123. // extern CLASSINDEXENTRY gcieTable[CL_NUMCLASSES] ;
  124. // This is now in GLOBL structure.
  125. // ---- End of Constant Classes Section ---- //
  126. // ---- MasterTable Section ---- //
  127. /* The master table keeps track of all allocated memory buffers.
  128. The buffers are typically used to store an array of structures.
  129. The master table is an array of entries of the form:
  130. */
  131. typedef struct _MASTER_TABLE_ENTRY
  132. {
  133. PBYTE pubStruct ; // address of element zero of array
  134. DWORD dwArraySize ; // number of array elements requested
  135. DWORD dwCurIndex ; // points to first uninitialized element
  136. DWORD dwElementSiz ; // size of each element in array.
  137. DWORD dwMaxArraySize ; // This is the absolute max size
  138. // we allow this resource to grow.
  139. } MASTERTAB_ENTRY ;
  140. // the following Enums represent indicies in the master table
  141. // reserved for each of the following objects:
  142. typedef enum
  143. {
  144. MTI_STRINGHEAP, // Permanent heap for GPD strings and binary data.
  145. MTI_GLOBALATTRIB, // structure holding value of global attributes.
  146. MTI_COMMANDTABLE, // array of ATREEREF (or DWORD indicies to
  147. // COMMAND_ARRAY)
  148. // note: the IDs used to index this table are the
  149. // Unidrv IDs.
  150. MTI_ATTRIBTREE, // array of ATTRIB_TREE structures.
  151. MTI_COMMANDARRAY, // array of COMMAND structures.
  152. // size varies depending on number of commands and variants
  153. // defined in the GPD file.
  154. MTI_PARAMETER, // parameters for command
  155. MTI_TOKENSTREAM, // contains value tokens to populate the value stack
  156. // and commands to operate on them. For command
  157. // parameters
  158. MTI_LISTNODES, // array of LISTNODEs.
  159. MTI_CONSTRAINTS, // array of CONSTRAINTS
  160. MTI_INVALIDCOMBO, // array of INVALIDCOMBO
  161. MTI_GPDFILEDATEINFO, // array of GPDFILEDATEINFO
  162. /* buffers allocated on 2nd pass */
  163. MTI_DFEATURE_OPTIONS, // references a whole bunch of treeroots.
  164. // should be initialized to ATTRIB_UNINITIALIZED values.
  165. // SymbolID pointed to by dwFeatureSymbols contains largest
  166. // array index appropriated. We won't need to allocate
  167. // more elements in the final array than this.
  168. MTI_SYNTHESIZED_FEATURES, // this holds synthesized
  169. // features. an array of DFEATURE_OPTIONS
  170. MTI_PRIORITYARRAY, // array of feature indicies
  171. MTI_TTFONTSUBTABLE, // array of arrayrefs and integers.
  172. MTI_FONTCART, // array of FontCartridge structures - one per
  173. // construct.
  174. // end of buffers allocated on 2nd pass
  175. // gray area: do we need to save the following objects?
  176. MTI_SYMBOLROOT, // index to root of symbol tree
  177. MTI_SYMBOLTREE, // symbolTree Array
  178. MTI_NUM_SAVED_OBJECTS , // denotes end of list of objects to be saved
  179. // to the GPD binary file.
  180. MTI_TMPHEAP = MTI_NUM_SAVED_OBJECTS ,
  181. // store strings referenced in tokenmap.
  182. MTI_SOURCEBUFFER, // Tracks Source file (GPD input stream)
  183. // gMasterTable[MTI_SOURCEBUFFER].dwCurIndex
  184. // indexes the current SOURCEBUFFER.
  185. MTI_TOKENMAP, // tokenMap large enough to hold an old and New copy!
  186. MTI_NEWTOKENMAP, // newtokenMap (not a separate buffer from TOKENMAP -
  187. // just points immediately after oldTokenMap).
  188. MTI_BLOCKMACROARRAY, // (one for Block and another for Value macros)
  189. MTI_VALUEMACROARRAY, // an array of DWORDS holding a
  190. // tokenindex where a valuemacro ID value is stored
  191. MTI_MACROLEVELSTACK, // is operated as a two dword stack that saves the
  192. // values of curBlockMacroArray and curValueMacroArray ,
  193. // each time a brace is encountered.
  194. MTI_STSENTRY, // this is the StateStack
  195. MTI_OP_QUEUE, // temp queue of operators (array of DWORDS)
  196. MTI_MAINKEYWORDTABLE, // the keyword dictionary!
  197. MTI_RNGDICTIONARY, // specifies the range of indicies in the
  198. // mainKeyword table which comprises the specified dictionary.
  199. MTI_FILENAMES, // array of ptrs to buffers containing widestrings
  200. // representing GPD filenames that were read in
  201. // used for friendly error messages.
  202. MTI_PREPROCSTATE, // array of PPSTATESTACK structures
  203. // which hold state of preprocessor.
  204. MTI_MAX_ENTRIES, // Last entry.
  205. } MT_INDICIES ;
  206. // extern MASTERTAB_ENTRY gMasterTable[MTI_MAX_ENTRIES] ;
  207. // This is now in GLOBL structure.
  208. // ---- End Of MasterTable Section ---- //
  209. // ---- SourceBuffer Section ---- //
  210. /* array of structures to track the MemoryMapped src files.
  211. multiple files may be open at the same time due to nesting
  212. imposed by the *Include keyword.
  213. The array of SOURCEBUFFERS is operated as a stack.
  214. The MasterTable[MTI_SOURCEBUFFER] field dwCurIndex
  215. serves as the stack pointer.
  216. */
  217. typedef struct
  218. {
  219. PBYTE pubSrcBuf ; // start of file bytes.
  220. DWORD dwCurIndex ; // stream ptr
  221. DWORD dwArraySize ; // filesize
  222. DWORD dwFileNameIndex ; // index into MTI_FILENAMES
  223. DWORD dwLineNumber ; // zero indexed
  224. HFILEMAP hFile ; // used to access/close file.
  225. } SOURCEBUFFER, * PSOURCEBUFFER ;
  226. // the tagname is 'sb'
  227. //
  228. // define macros to access what were global variables but are now packed
  229. // in PGLOBL structure.
  230. //
  231. #define gMasterTable (pglobl->GMasterTable)
  232. #define gmrbd (pglobl->Gmrbd)
  233. #define gastAllowedTransitions (pglobl->GastAllowedTransitions)
  234. #define gabAllowedAttributes (pglobl->GabAllowedAttributes)
  235. #define gdwOperPrecedence (pglobl->GdwOperPrecedence)
  236. #define gdwMasterTabIndex (pglobl->GdwMasterTabIndex)
  237. #define geErrorSev (pglobl->GeErrorSev)
  238. #define geErrorType (pglobl->GeErrorType)
  239. #define gdwVerbosity (pglobl->GdwVerbosity)
  240. #define gdwID_IgnoreBlock (pglobl->GdwID_IgnoreBlock)
  241. #define gValueToSize (pglobl->GValueToSize)
  242. #define gdwMemConfigKB (pglobl->GdwMemConfigKB)
  243. #define gdwMemConfigMB (pglobl->GdwMemConfigMB)
  244. #define gdwOptionConstruct (pglobl->GdwOptionConstruct)
  245. #define gdwOpenBraceConstruct (pglobl->GdwOpenBraceConstruct)
  246. #define gdwCloseBraceConstruct (pglobl->GdwCloseBraceConstruct)
  247. #define gdwMemoryConfigMB (pglobl->GdwMemoryConfigMB)
  248. #define gdwMemoryConfigKB (pglobl->GdwMemoryConfigKB)
  249. #define gdwCommandConstruct (pglobl->GdwCommandConstruct)
  250. #define gdwCommandCmd (pglobl->GdwCommandCmd)
  251. #define gdwOptionName (pglobl->GdwOptionName)
  252. #define gdwResDLL_ID (pglobl->GdwResDLL_ID)
  253. #define gdwLastIndex (pglobl->GdwLastIndex)
  254. #define gaarPPPrefix (pglobl->GaarPPPrefix)
  255. #define gcieTable (pglobl->GcieTable)
  256. // define Local Macro to access info for current file:
  257. #define mCurFile (gMasterTable[MTI_SOURCEBUFFER].dwCurIndex)
  258. // which file are we currently accessing ?
  259. #define mMaxFiles (gMasterTable[MTI_SOURCEBUFFER].dwArraySize)
  260. // max number of files open at one time (nesting depth)
  261. #define mpSourcebuffer ((PSOURCEBUFFER)(gMasterTable \
  262. [MTI_SOURCEBUFFER].pubStruct))
  263. // location of first SOURCEBUFFER element in array
  264. #define mpubSrcRef (mpSourcebuffer[mCurFile - 1].pubSrcBuf)
  265. // start of file bytes
  266. #define mdwSrcInd (mpSourcebuffer[mCurFile - 1].dwCurIndex)
  267. // current position in file bytes
  268. #define mdwSrcMax (mpSourcebuffer[mCurFile - 1].dwArraySize)
  269. // filesize
  270. // ---- End Of SourceBuffer Section ---- //
  271. // ----- Preprocessor Section ---- //
  272. enum IFSTATE {IFS_ROOT, IFS_CONDITIONAL , IFS_LAST_CONDITIONAL } ;
  273. // tracks correct syntatical use of #ifdef, #elseifdef, #else and #endif directives.
  274. enum PERMSTATE {PERM_ALLOW, PERM_DENY , PERM_LATCHED } ;
  275. // tracks current state of preprocessing,
  276. // PERM_ALLOW: all statements in this section are passed to body gpdparser
  277. // PERM_DENY: statements in this section are discarded
  278. // PERM_LATCHED: all statements until the end of this nesting level are discarded.
  279. enum DIRECTIVE {NOT_A_DIRECTIVE, DIRECTIVE_EOF, DIRECTIVE_DEFINE , DIRECTIVE_UNDEFINE ,
  280. DIRECTIVE_INCLUDE , DIRECTIVE_SETPPPREFIX , DIRECTIVE_IFDEF ,
  281. DIRECTIVE_ELSEIFDEF , DIRECTIVE_ELSE , DIRECTIVE_ENDIF } ;
  282. typedef struct
  283. {
  284. enum IFSTATE ifState ;
  285. enum PERMSTATE permState ;
  286. } PPSTATESTACK, * PPPSTATESTACK ;
  287. // the tagname is 'ppss'
  288. #define mppStack ((PPPSTATESTACK)(gMasterTable \
  289. [MTI_PREPROCSTATE].pubStruct))
  290. // location of first SOURCEBUFFER element in array
  291. #define mdwNestingLevel (gMasterTable[MTI_PREPROCSTATE].dwCurIndex)
  292. // current preprocessor directive nesting level
  293. #define mMaxNestingLevel (gMasterTable[MTI_PREPROCSTATE].dwArraySize)
  294. // max preprocessor directive nesting depth
  295. // ---- End Of Preprocessor Section ---- //
  296. // ---- Symbol Trees Section ---- //
  297. /* this structure is used to implement the symbol trees which
  298. track all user defined symbol names and associate with each name
  299. a zero indexed integer. */
  300. typedef struct
  301. {
  302. ARRAYREF arSymbolName;
  303. DWORD dwSymbolID; // has nothing to do with array of symbol structs.
  304. // value begins at zero and is incremented to obtain
  305. // next value.
  306. DWORD dwNextSymbol; // index to next element in this space.
  307. DWORD dwSubSpaceIndex ; // index to first element in new symbol space
  308. // which exists within the catagory represented by this symbol.
  309. // for example in the catagory represented by the
  310. // symbol PAPERSIZES: we may have the subspace
  311. // comprised of Letter, A4, Legal, etc.
  312. } SYMBOLNODE , * PSYMBOLNODE ;
  313. // assign this struct the type 'psn'
  314. #define INVALID_SYMBOLID (0xffffffff)
  315. // this value is returned instead of a valid SymbolID
  316. // to indicate a failure condition - symbol not found, or
  317. // unable to register symbol.
  318. // Warning! this value may be truncated to WORD to
  319. // fit into a qualified name!
  320. #define INVALID_INDEX (0xffffffff)
  321. // used to denote the end of a chain of nodes.
  322. // dwNextSymbol may be assigned this value.
  323. // there is one symbol tree for each symbol class.
  324. // actually the options tree is a sublevel of the features
  325. // tree. This enumeration is used to access the MTI_SYMBOLROOT
  326. // array.
  327. typedef enum
  328. {
  329. SCL_FEATURES, SCL_FONTCART, SCL_TTFONTNAMES,
  330. SCL_BLOCKMACRO, SCL_VALUEMACRO, SCL_OPTIONS,
  331. SCL_COMMANDNAMES, SCL_PPDEFINES, SCL_NUMSYMCLASSES
  332. } SYMBOL_CLASSES ;
  333. // ---- End of Symbol Trees Section ---- //
  334. // ---- TokenMap Section ---- //
  335. /* the tokenMap contains an array entry for each logical statement
  336. in the GPD source file. It identifies the token string
  337. representing the Keyword and its associated Value.
  338. */
  339. typedef struct _TOKENMAP
  340. {
  341. DWORD dwKeywordID ; // index of entry in KeywordTable
  342. ABSARRAYREF aarKeyword ; // points to keyword in the source file
  343. ABSARRAYREF aarValue ; // value associated with this keyword.
  344. DWORD dwValue ; // interpretation of Value string - see flags.
  345. // maybe commandID, numerical value of constant, MacroID assigned
  346. // to MacroSymbol , SymbolID etc.
  347. DWORD dwFileNameIndex ; // GPD filename
  348. DWORD dwLineNumber ; // zero indexed
  349. DWFLAGS dwFlags ; // bitfield with the following flags
  350. // * TKMF_NOVALUE no value was found
  351. // TKMF_VALUE_SAVED independently of the tokenmap.
  352. // TKMF_COMMAND_SHORTCUT only used when parsing commands.
  353. // TKMF_INLINE_BLOCKMACROREF need to know when resolving macros.
  354. // *TKMF_COLON additional token found in value - shortcut?
  355. // *TKMF_MACROREF indicates a value macro reference that must
  356. // be resolved
  357. // TKMF_SYMBOLID dwValue contains a symbolID.
  358. // * TKMF_SYMBOL_KEYWORD keyword is a symbol
  359. // * TKMF_SYMBOL_REGISTERED set when the symbolID is registered
  360. // by ProcessSymbolKeyword which also sets dwValue.
  361. // * TKMF_EXTERN_GLOBAL The extern Qualifier was prepended to the
  362. // * TKMF_EXTERN_FEATURE attribute keyword and has now been
  363. // truncated.
  364. // * indicates actually set by code.
  365. // ! indicates actually read by code.
  366. } TKMAP, *PTKMAP ;
  367. // assign this struct the type 'tkmap'
  368. // allowed flags for dwFlags field:
  369. #define TKMF_NOVALUE (0x00000001)
  370. #define TKMF_VALUE_SAVED (0x00000002)
  371. #define TKMF_COMMAND_SHORTCUT (0x00000004)
  372. #define TKMF_INLINE_BLOCKMACROREF (0x00000008)
  373. #define TKMF_COLON (0x00000010)
  374. #define TKMF_MACROREF (0x00000020)
  375. #define TKMF_SYMBOLID (0x00000040)
  376. #define TKMF_SYMBOL_KEYWORD (0x00000080)
  377. #define TKMF_SYMBOL_REGISTERED (0x00000100)
  378. #define TKMF_EXTERN_GLOBAL (0x00000200)
  379. #define TKMF_EXTERN_FEATURE (0x00000400)
  380. // ---- special KeywordIDs for TokenMap ---- //
  381. #define ID_SPECIAL 0xff00 // larger than any KeywordTable index
  382. #define ID_NULLENTRY (ID_SPECIAL + 0)
  383. // ignore this, either expired code, parsing error etc.
  384. #define ID_UNRECOGNIZED (ID_SPECIAL + 1)
  385. // conforms to correct syntax, but not in my keyword table.
  386. // could be a keyword defined in a newer spec or an attribute name
  387. // or some other OEM defined stuff.
  388. #define ID_SYMBOL (ID_SPECIAL + 2)
  389. // this identifies a user-defined keyword like a fontname
  390. // does not begin with * , but conforms to syntax for a symbol.
  391. #define ID_EOF (ID_SPECIAL + 3)
  392. // end of file - no more tokenMap entries
  393. // ---- End of TokenMap Section ---- //
  394. // ---- MainKeyword table Section ---- //
  395. /* the MainKeyword table contains static information that
  396. describes each main keyword. This table controls what action
  397. the parser takes. First define several enumerations used
  398. in the table. */
  399. typedef enum
  400. {
  401. TY_CONSTRUCT, TY_ATTRIBUTE, TY_SPECIAL
  402. } KEYWORD_TYPE ;
  403. typedef enum
  404. {
  405. ATT_GLOBAL_ONLY, ATT_GLOBAL_FREEFLOAT,
  406. ATT_LOCAL_FEATURE_ONLY, ATT_LOCAL_FEATURE_FF ,
  407. ATT_LOCAL_OPTION_ONLY, ATT_LOCAL_OPTION_FF ,
  408. ATT_LOCAL_COMMAND_ONLY, ATT_LOCAL_FONTCART_ONLY,
  409. ATT_LOCAL_TTFONTSUBS_ONLY, ATT_LOCAL_OEM_ONLY,
  410. ATT_LAST // Must be last in list.
  411. } ATTRIBUTE ; // subtype
  412. typedef enum
  413. {
  414. CONSTRUCT_UIGROUP ,
  415. CONSTRUCT_FEATURE ,
  416. CONSTRUCT_OPTION ,
  417. CONSTRUCT_SWITCH,
  418. CONSTRUCT_CASE ,
  419. CONSTRUCT_DEFAULT ,
  420. CONSTRUCT_COMMAND ,
  421. CONSTRUCT_FONTCART ,
  422. CONSTRUCT_TTFONTSUBS ,
  423. CONSTRUCT_OEM ,
  424. CONSTRUCT_LAST, // must end list of transition inducing constructs.
  425. // constructs below do not cause state transitions
  426. CONSTRUCT_BLOCKMACRO ,
  427. CONSTRUCT_MACROS,
  428. CONSTRUCT_OPENBRACE,
  429. CONSTRUCT_CLOSEBRACE,
  430. CONSTRUCT_PREPROCESSOR,
  431. } CONSTRUCT ; // SubType if Type = CONSTRUCT
  432. typedef enum
  433. {
  434. SPEC_TTFS, SPEC_FONTSUB, SPEC_INVALID_COMBO,
  435. SPEC_COMMAND_SHORTCUT,
  436. SPEC_CONSTR, SPEC_INS_CONSTR,
  437. SPEC_NOT_INS_CONSTR, SPEC_INVALID_INS_COMBO,
  438. SPEC_MEM_CONFIG_KB, SPEC_MEM_CONFIG_MB,
  439. SPEC_INCLUDE, SPEC_INSERTBLOCK, SPEC_IGNOREBLOCK
  440. } SPECIAL ;
  441. // what value type does the parser expect after each keyword?
  442. typedef enum
  443. {
  444. NO_VALUE , // a linebreak OR an effective linebreak: ({) or comment
  445. // or optional value.
  446. VALUE_INTEGER, // integer
  447. VALUE_POINT, // point
  448. VALUE_RECT, // rectangle
  449. // VALUE_BOOLEAN, // a subset of constants.
  450. VALUE_QUALIFIED_NAME, // Qualified name (two symbols separated by .
  451. VALUE_QUALIFIED_NAME_EX, // QualifiedName followed
  452. // by an unsigned integer with a . delimiter.
  453. VALUE_PARTIALLY_QUALIFIED_NAME , // (just one symbol or two symbols
  454. // separated by .)
  455. VALUE_CONSTRAINT, // list of qualified names but stored differently.
  456. VALUE_ORDERDEPENDENCY,
  457. VALUE_FONTSUB, // "fontname" : <int>
  458. // VALUE_STRING, // Quoted String, hexstring, string MACROREF,
  459. // parameterless invocation.
  460. VALUE_STRING_NO_CONVERT, // string will not undergo unicode conversion
  461. // for example *GPDSpecVersion must remain an ascii string.
  462. VALUE_STRING_DEF_CONVERT, // string will be converted using the
  463. // system codepage - filenames
  464. VALUE_STRING_CP_CONVERT, // string will be converted using the
  465. // codepage specified by *CodePage
  466. VALUE_COMMAND_INVOC, // like VALUE_STRING but allowed to contain
  467. // one or more parameter references.
  468. VALUE_COMMAND_SHORTCUT, // Commandname:VALUE_COMMAND_INVOC
  469. VALUE_PARAMETER, // substring only containing a parameter reference.
  470. VALUE_SYMBOL_DEF, // * the value defines a symbol or value macro
  471. // { and } are not permitted. Is this ever used ? yes
  472. VALUE_SYMBOL_FIRST, // base of user-defined symbol catagory
  473. VALUE_SYMBOL_FEATURES = VALUE_SYMBOL_FIRST + SCL_FEATURES , //
  474. VALUE_SYMBOL_FONTCART = VALUE_SYMBOL_FIRST + SCL_FONTCART , //
  475. VALUE_SYMBOL_TTFONTNAMES = VALUE_SYMBOL_FIRST + SCL_TTFONTNAMES , //
  476. VALUE_SYMBOL_BLOCKMACRO = VALUE_SYMBOL_FIRST + SCL_BLOCKMACRO , //
  477. VALUE_SYMBOL_VALUEMACRO = VALUE_SYMBOL_FIRST + SCL_VALUEMACRO , //
  478. VALUE_SYMBOL_OPTIONS = VALUE_SYMBOL_FIRST + SCL_OPTIONS , //
  479. // SCL_COMMANDNAMES intentionally omitted.
  480. VALUE_SYMBOL_LAST = VALUE_SYMBOL_FIRST + SCL_NUMSYMCLASSES - 1 , //
  481. VALUE_CONSTANT_FIRST, // base of enumeration catagory.
  482. VALUE_CONSTANT_BOOLEANTYPE = VALUE_CONSTANT_FIRST + CL_BOOLEANTYPE ,
  483. VALUE_CONSTANT_PRINTERTYPE = VALUE_CONSTANT_FIRST + CL_PRINTERTYPE ,
  484. VALUE_CONSTANT_FEATURETYPE = VALUE_CONSTANT_FIRST + CL_FEATURETYPE ,
  485. VALUE_CONSTANT_UITYPE = VALUE_CONSTANT_FIRST + CL_UITYPE ,
  486. VALUE_CONSTANT_PROMPTTIME = VALUE_CONSTANT_FIRST + CL_PROMPTTIME ,
  487. VALUE_CONSTANT_PAPERFEED_ORIENT = VALUE_CONSTANT_FIRST + CL_PAPERFEED_ORIENT ,
  488. VALUE_CONSTANT_COLORPLANE = VALUE_CONSTANT_FIRST + CL_COLORPLANE ,
  489. VALUE_CONSTANT_SEQSECTION = VALUE_CONSTANT_FIRST + CL_SEQSECTION ,
  490. VALUE_CONSTANT_RASTERCAPS = VALUE_CONSTANT_FIRST + CL_RASTERCAPS ,
  491. VALUE_CONSTANT_TEXTCAPS = VALUE_CONSTANT_FIRST + CL_TEXTCAPS ,
  492. VALUE_CONSTANT_MEMORYUSAGE = VALUE_CONSTANT_FIRST + CL_MEMORYUSAGE ,
  493. VALUE_CONSTANT_RESELECTFONT = VALUE_CONSTANT_FIRST + CL_RESELECTFONT ,
  494. VALUE_CONSTANT_OEMPRINTINGCALLBACKS = VALUE_CONSTANT_FIRST + CL_OEMPRINTINGCALLBACKS ,
  495. VALUE_CONSTANT_CURSORXAFTERCR = VALUE_CONSTANT_FIRST + CL_CURSORXAFTERCR ,
  496. VALUE_CONSTANT_BADCURSORMOVEINGRXMODE = VALUE_CONSTANT_FIRST + CL_BADCURSORMOVEINGRXMODE ,
  497. // VALUE_CONSTANT_SIMULATEXMOVE = VALUE_CONSTANT_FIRST + CL_SIMULATEXMOVE ,
  498. VALUE_CONSTANT_PALETTESCOPE = VALUE_CONSTANT_FIRST + CL_PALETTESCOPE ,
  499. VALUE_CONSTANT_OUTPUTDATAFORMAT = VALUE_CONSTANT_FIRST + CL_OUTPUTDATAFORMAT ,
  500. VALUE_CONSTANT_STRIPBLANKS = VALUE_CONSTANT_FIRST + CL_STRIPBLANKS ,
  501. VALUE_CONSTANT_LANDSCAPEGRXROTATION = VALUE_CONSTANT_FIRST + CL_LANDSCAPEGRXROTATION ,
  502. VALUE_CONSTANT_CURSORXAFTERSENDBLOCKDATA = VALUE_CONSTANT_FIRST + CL_CURSORXAFTERSENDBLOCKDATA ,
  503. VALUE_CONSTANT_CURSORYAFTERSENDBLOCKDATA = VALUE_CONSTANT_FIRST + CL_CURSORYAFTERSENDBLOCKDATA ,
  504. VALUE_CONSTANT_CHARPOSITION = VALUE_CONSTANT_FIRST + CL_CHARPOSITION ,
  505. VALUE_CONSTANT_FONTFORMAT = VALUE_CONSTANT_FIRST + CL_FONTFORMAT ,
  506. VALUE_CONSTANT_QUERYDATATYPE = VALUE_CONSTANT_FIRST + CL_QUERYDATATYPE ,
  507. VALUE_CONSTANT_YMOVEATTRIB = VALUE_CONSTANT_FIRST + CL_YMOVEATTRIB ,
  508. VALUE_CONSTANT_DLSYMBOLSET = VALUE_CONSTANT_FIRST + CL_DLSYMBOLSET ,
  509. VALUE_CONSTANT_CURXAFTER_RECTFILL = VALUE_CONSTANT_FIRST + CL_CURXAFTER_RECTFILL ,
  510. VALUE_CONSTANT_CURYAFTER_RECTFILL = VALUE_CONSTANT_FIRST + CL_CURYAFTER_RECTFILL ,
  511. #ifndef WINNT_40
  512. VALUE_CONSTANT_PRINTRATEUNIT = VALUE_CONSTANT_FIRST + CL_PRINTRATEUNIT ,
  513. #endif
  514. VALUE_CONSTANT_RASTERMODE = VALUE_CONSTANT_FIRST + CL_RASTERMODE,
  515. VALUE_CONSTANT_QUALITYSETTING = VALUE_CONSTANT_FIRST + CL_QUALITYSETTING,
  516. VALUE_CONSTANT_STANDARD_VARS = VALUE_CONSTANT_FIRST + CL_STANDARD_VARS ,
  517. VALUE_CONSTANT_COMMAND_NAMES = VALUE_CONSTANT_FIRST + CL_COMMAND_NAMES ,
  518. VALUE_CONSTANT_CONS_FEATURES = VALUE_CONSTANT_FIRST + CL_CONS_FEATURES ,
  519. VALUE_CONSTANT_CONS_PAPERSIZE = VALUE_CONSTANT_FIRST + CL_CONS_PAPERSIZE ,
  520. VALUE_CONSTANT_CONS_MEDIATYPE = VALUE_CONSTANT_FIRST + CL_CONS_MEDIATYPE ,
  521. VALUE_CONSTANT_CONS_INPUTSLOT = VALUE_CONSTANT_FIRST + CL_CONS_INPUTSLOT ,
  522. VALUE_CONSTANT_CONS_DUPLEX = VALUE_CONSTANT_FIRST + CL_CONS_DUPLEX ,
  523. VALUE_CONSTANT_CONS_ORIENTATION = VALUE_CONSTANT_FIRST + CL_CONS_ORIENTATION ,
  524. VALUE_CONSTANT_CONS_PAGEPROTECT = VALUE_CONSTANT_FIRST + CL_CONS_PAGEPROTECT ,
  525. VALUE_CONSTANT_CONS_COLLATE = VALUE_CONSTANT_FIRST + CL_CONS_COLLATE ,
  526. VALUE_CONSTANT_CONS_HALFTONE = VALUE_CONSTANT_FIRST + CL_CONS_HALFTONE ,
  527. VALUE_CONSTANT_LAST = VALUE_CONSTANT_FIRST + CL_NUMCLASSES - 1 ,
  528. VALUE_LIST, // no attribute actually is assigned this descriptor,
  529. // but used in the gValueToSize table.
  530. VALUE_LARGEST, // not a real descriptor, but this position in the
  531. // gValueToSize table holds the largest of the above values.
  532. VALUE_MAX, // number of elements in gValueToSize table.
  533. } VALUE ;
  534. // -- allowed values for KEYWORDTABLE_ENTRY.flAgs: --
  535. #define KWF_LIST (0x00000001)
  536. // the value may be a LIST containing one or more
  537. // items of type AllowedValue. The storage format
  538. // must be of type LIST. Only certain values may qualify
  539. // for list format.
  540. #define KWF_ADDITIVE (0x00000002)
  541. // this flag implies KWF_LIST and also specifies the behavior
  542. // that any redefinition of this keyword simply adds its items
  543. // onto the existing list. (removal of redundant items is not
  544. // performed.)
  545. #define KWF_MACROREF_ALLOWED (0x00000004)
  546. // since only a handful of keywords cannot accept
  547. // macro references, it may be a waste of a flag, but reserve this
  548. // to alert us that this special case must accounted for.
  549. #define KWF_SHORTCUT (0x00000008)
  550. // This keyword has multiple variants of syntax.
  551. // one of the following 3 flags is set
  552. // if the values in the nodes of the attribute tree
  553. // refer to indicies of dedicated arrays, (which obviously
  554. // contain data fields not ATREEREFs) AND
  555. // gMainKeywordTable[].dwOffset is an offset into
  556. // this dedicated array, then set this flag.
  557. // else dwOffset is used to select the treeroot.
  558. #define KWF_COMMAND (0x00000010)
  559. // This attribute is stored in a dedicated structure
  560. #define KWF_FONTCART (0x00000020)
  561. // This attribute is stored in a dedicated structure
  562. #define KWF_OEM (0x00000040)
  563. // This attribute is stored in a dedicated structure
  564. #define KWF_TTFONTSUBS (0x00000080)
  565. // This attribute is stored in a dedicated structure
  566. #define KWF_DEDICATED_FIELD (KWF_COMMAND | KWF_FONTCART | \
  567. KWF_OEM | KWF_TTFONTSUBS)
  568. // this flag is never set in the MainKeywordTable[].
  569. #define KWF_REQUIRED (0x00000100)
  570. // this keyword must appear in the GPD file
  571. #ifdef GMACROS
  572. #define KWF_CHAIN (0x00000200)
  573. // if more than one entry exists for a given treenode,
  574. // subsequent entries are chained onto the first
  575. // creating a parent list which holds in its values
  576. // the actual inhabitants of the treenode.
  577. #endif
  578. // The mainKeyword Table is an array of structures of the form:
  579. typedef struct
  580. {
  581. PSTR pstrKeyword ; // keywordID is the index of this entry.
  582. DWORD dwHashValue ; // optional - implement as time permits.
  583. VALUE eAllowedValue ;
  584. DWORD flAgs ;
  585. KEYWORD_TYPE eType; // may replace Type/Subtype with a function
  586. DWORD dwSubType ; // if there is minimal code duplication.
  587. DWORD dwOffset ; // into appropriate struct for attributes only.
  588. // the size (num bytes to copy) of an attribute is easily determined
  589. // from the AllowedValue field.
  590. } KEYWORDTABLE_ENTRY, * PKEYWORDTABLE_ENTRY;
  591. // ---- End of MainKeyword table Section ---- //
  592. // ---- MainKeyword Dictionary Section ---- //
  593. /* note the MainKeywordTable is subdivided into sections
  594. with each section terminated by a NULL pstrKeyword.
  595. this enumerates the sections. The MTI_RNGDICTIONARY
  596. provides the starting and ending indicies of the
  597. the Keyword entries which each section spans. */
  598. typedef enum {NON_ATTR, GLOBAL_ATTR, FEATURE_ATTR,
  599. OPTION_ATTR, COMMAND_ATTR, FONTCART_ATTR, TTFONTSUBS_ATTR,
  600. OEM_ATTR , END_ATTR
  601. } KEYWORD_SECTS ;
  602. typedef struct
  603. {
  604. DWORD dwStart ; // index of first keyword in this section
  605. DWORD dwEnd ;
  606. } RANGE, *PRANGE ; // tag shall be rng
  607. // ---- End of MainKeyword Dictionary Section ---- //
  608. // ---- Attribute Trees Section ---- //
  609. /* an Attribute Tree is comprised of a set of ATTRIB_TREE
  610. nodes linked together. The root of the tree (the first node)
  611. may be a global default initializer. */
  612. typedef enum
  613. {
  614. NEXT_FEATURE, // offset field contain index to another node
  615. VALUE_AT_HEAP, // offset is a heap offset
  616. UNINITIALIZED // offset has no meaning yet. (a transient state)
  617. } ATTOFFMEANS ;
  618. #define DEFAULT_INIT (0xffffffff)
  619. // Warning! this value may be truncated to WORD to
  620. // fit into a qualified name!
  621. // #define END_OF_LIST (0xffffffff)
  622. // moved to gpd.h
  623. // may used where a node index is expected
  624. typedef struct
  625. {
  626. DWORD dwFeature ; // may also be set to DEFAULT_INIT
  627. DWORD dwOption ; // DEFAULT_INIT indicates this if set
  628. DWORD dwNext ; // index to another node or END_OF_LIST
  629. DWORD dwOffset ; // either offset in heap to value
  630. // or index to node containing another feature.
  631. ATTOFFMEANS eOffsetMeans ;
  632. } ATTRIB_TREE, * PATTRIB_TREE ;
  633. // the prefix tag shall be 'att'
  634. // these flags are used with ATREEREFS, this complication exists
  635. // because of the overloading of ATREEREFS.
  636. #define ATTRIB_HEAP_VALUE (0x80000000)
  637. // high bit set to indicate this value is an offset into
  638. // the heap.
  639. #define ATTRIB_UNINITIALIZED (ATTRIB_HEAP_VALUE - 1)
  640. // this value indicates no memory location has been allocated
  641. // to hold the value for this attribute.
  642. typedef DWORD ATREEREF ; // hold the index to attribute array
  643. // that is the root of an attribute tree or if high bit is set
  644. // is an offset to the heap where the actual value lies.
  645. //
  646. // the prefix tag shall be 'atr'
  647. typedef PDWORD PATREEREF ;
  648. // ---- End of Attribute Trees Section ---- //
  649. // ---- UI Constraints Section ---- //
  650. // slightly different from that defined in parser.h
  651. typedef struct
  652. {
  653. DWORD dwNextCnstrnt ;
  654. DWORD dwFeature ;
  655. DWORD dwOption ;
  656. }
  657. CONSTRAINTS, * PCONSTRAINTS ;
  658. // the prefix tag shall be 'cnstr'
  659. // ---- End of UI Constraints Section ---- //
  660. // ---- InvalidCombo Section ---- //
  661. // R.I.P. - moved to parser.h
  662. // typedef struct
  663. // {
  664. // DWORD dwFeature ; // the INVALIDCOMBO construct defines
  665. // DWORD dwOption ; // a set of elements subject to the constraint
  666. // DWORD dwNextElement ; // that all elements of the set cannot be
  667. // DWORD dwNewCombo ; // selected at the same time.
  668. // }
  669. // INVALIDCOMBO , * PINVALIDCOMBO ;
  670. // the prefix tag shall be 'invc'
  671. // Note: both dwNextElement and dwNewCombo are terminated by END_OF_LIST.
  672. // ---- End of InvalidCombo Section ---- //
  673. // store timestamp of GPD files and included files here.
  674. typedef struct _GPDFILEDATEINFO {
  675. ARRAYREF arFileName;
  676. FILETIME FileTime;
  677. } GPDFILEDATEINFO, *PGPDFILEDATEINFO;
  678. // ---- State Machine Section ---- //
  679. /* the state machine is used to define different parsing contexts
  680. introduced by the construct keywords. Each state recognizes a different
  681. set of Construct and Attribute Keywords. The 2 dimensional matricies
  682. AllowedTransitions and AllowedAttributes define these. The states
  683. are nested, so a stack is a good way to track the complete state
  684. of the system. Each state is introduced by a construct keyword
  685. with its optional symbol value which is stored in the stack for
  686. subsequent use. */
  687. typedef enum
  688. {
  689. STATE_ROOT,
  690. STATE_UIGROUP,
  691. STATE_FEATURE,
  692. STATE_OPTIONS,
  693. STATE_SWITCH_ROOT,
  694. STATE_SWITCH_FEATURE,
  695. STATE_SWITCH_OPTION,
  696. STATE_CASE_ROOT,
  697. STATE_DEFAULT_ROOT,
  698. STATE_CASE_FEATURE,
  699. STATE_DEFAULT_FEATURE,
  700. STATE_CASE_OPTION,
  701. STATE_DEFAULT_OPTION,
  702. STATE_COMMAND,
  703. STATE_FONTCART,
  704. STATE_TTFONTSUBS,
  705. STATE_OEM,
  706. // any other passive construct
  707. STATE_LAST, // must terminate list of valid states
  708. STATE_INVALID // must be after STATE_LAST
  709. } STATE, * PSTATE ; // the prefix tag shall be 'st'
  710. extern CONST PBYTE gpubStateNames[] ;
  711. // note if STATE enum changes, update the global gpubStateNames[]
  712. typedef struct
  713. {
  714. STATE stState ;
  715. DWORD dwSymbolID ;
  716. } STSENTRY , * PSTSENTRY; // StateStackEntry the prefix tag shall be 'sts'
  717. // The AllowedTransitions Table determines/defines
  718. // the state changes produced by each construct keyword
  719. // Each entry in the table is a NewState and is indexed
  720. // by the OldState and a ConstructKeyword
  721. // extern STATE gastAllowedTransitions[STATE_LAST][CONSTRUCT_LAST] ;
  722. // This is now in GLOBL structure
  723. // the AllowedAttributes table defines which attributes are
  724. // allowed in each state.
  725. // extern BOOL gabAllowedAttributes[STATE_LAST][ATT_LAST] ;
  726. // This is now in GLOBL structure
  727. // state of token parser (not to be confused with
  728. // state machine defined above.)
  729. typedef enum
  730. {
  731. PARST_EXIT, PARST_EOF, PARST_KEYWORD, PARST_COLON,
  732. PARST_VALUE, PARST_INCLUDEFILE, PARST_ABORT
  733. } PARSTATE ; // tag shall be 'parst'
  734. // ---- End of State Machine Section ---- //
  735. // ---- Value Structures Section ---- //
  736. /* the values from the attribute keywords are stored
  737. in various structures. Typically there is one type of
  738. structure for each construct and one instance of
  739. a structure for each unique Symbol name. The SymbolID
  740. is normally used to index the instance of the structure
  741. within the array of structures. */
  742. #if TODEL
  743. typedef struct
  744. {
  745. ARRAYREF arTTFontName ;
  746. ARRAYREF arDevFontName ;
  747. } TTFONTSUBTABLE, *PTTFONTSUBTABLE ;
  748. // tag 'ttft'
  749. //
  750. // Data structure used to represent the format of loOffset when indicating resource Ids
  751. //
  752. typedef struct
  753. {
  754. WORD wResourceID ; // ResourceID
  755. BYTE bFeatureID ; // Feature index for the resource DLL feature.
  756. // If zero, we will use the name specified
  757. // in ResourceDLL
  758. BYTE bOptionID ; // Option index for the qualified resource dll name.
  759. } QUALNAMEEX, * PQUALNAMEEX ;
  760. typedef struct
  761. {
  762. DWORD dwRCCartNameID ;
  763. ARRAYREF strCartName ;
  764. DWORD dwFontLst ; // Index to list of FontIDs
  765. DWORD dwPortFontLst ;
  766. DWORD dwLandFontLst ;
  767. } FONTCART , * PFONTCART ; // the prefix tag shall be 'fc'
  768. #endif
  769. typedef struct // for ease of processing shall contain only ATREEREFs
  770. {
  771. ATREEREF atrGPDSpecVersion ; // "GPDSpecVersion"
  772. ATREEREF atrMasterUnits ; // "MasterUnits"
  773. ATREEREF atrModelName ; // "ModelName"
  774. ATREEREF atrModelNameID ; // "rcModelNameID"
  775. ATREEREF atrGPDFileVersion ; // "GPDFileVersion"
  776. ATREEREF atrGPDFileName ; // "GPDFileName"
  777. ATREEREF atrOEMCustomData ; // "OEMCustomData"
  778. // next four fields used by Synthesized Features
  779. ATREEREF atrNameInstalled ; // "OptionNameInstalled"
  780. ATREEREF atrNameIDInstalled ; // "rcOptionNameInstalledID"
  781. ATREEREF atrNameNotInstalled ; // "OptionNameNotInstalled"
  782. ATREEREF atrNameIDNotInstalled ; // "rcOptionNameNotInstalledID"
  783. // support for common UI macro controls
  784. ATREEREF atrDraftQualitySettings; // "DraftQualitySettings"
  785. ATREEREF atrBetterQualitySettings; // "BetterQualitySettings"
  786. ATREEREF atrBestQualitySettings; // "BestQualitySettings"
  787. ATREEREF atrDefaultQuality ; // "DefaultQuality"
  788. ATREEREF atrPrinterType ; // "PrinterType"
  789. ATREEREF atrPersonality ; // "Personality"
  790. ATREEREF atrRcPersonalityID ; // "rcPersonalityID"
  791. // ATREEREF atrIncludeFiles; // "Include"
  792. ATREEREF atrResourceDLL; // "ResourceDLL"
  793. ATREEREF atrCodePage; // "CodePage"
  794. ATREEREF atrMaxCopies; // "MaxCopies"
  795. ATREEREF atrFontCartSlots; // "FontCartSlots"
  796. ATREEREF atrPrinterIcon; // "rcPrinterIconID"
  797. ATREEREF atrHelpFile; // "HelpFile"
  798. // obsolete?
  799. ATREEREF atrOutputDataFormat; // "OutputDataFormat"
  800. ATREEREF atrMaxPrintableArea; // "MaxPrintableArea"
  801. //
  802. // Printer Capabilities related information
  803. //
  804. ATREEREF atrRotateCoordinate; // "RotateCoordinate?"
  805. ATREEREF atrRasterCaps; // "RasterCaps"
  806. ATREEREF atrRotateRasterData; // "RotateRaster?"
  807. ATREEREF atrTextCaps; // "TextCaps"
  808. ATREEREF atrRotateFont; // "RotateFont?"
  809. ATREEREF atrMemoryUsage; // "MemoryUsage"
  810. ATREEREF atrReselectFont; // "ReselectFont"
  811. ATREEREF atrPrintRate; // "PrintRate"
  812. ATREEREF atrPrintRateUnit; // "PrintRateUnit"
  813. ATREEREF atrPrintRatePPM; // "PrintRatePPM"
  814. ATREEREF atrOutputOrderReversed; // "OutputOrderReversed?"
  815. // may change per snapshot.
  816. ATREEREF atrReverseBandOrderForEvenPages; // "ReverseBandOrderForEvenPages?"
  817. ATREEREF atrOEMPrintingCallbacks; // "OEMPrintingCallbacks"
  818. // ATREEREF atrDisabledFeatures ; // "*DisabledFeatures"
  819. //
  820. // Cursor Control related information
  821. //
  822. ATREEREF atrCursorXAfterCR; // "CursorXAfterCR"
  823. ATREEREF atrBadCursorMoveInGrxMode; // "BadCursorMoveInGrxMode"
  824. ATREEREF atrSimulateXMove; // "SimulateXMove"
  825. ATREEREF atrEjectPageWithFF; // "EjectPageWithFF?"
  826. ATREEREF atrLookaheadRegion; // "LookaheadRegion"
  827. ATREEREF atrYMoveAttributes ; // "YMoveAttributes"
  828. ATREEREF atrMaxLineSpacing ; // "MaxLineSpacing"
  829. ATREEREF atrbUseSpaceForXMove ; // "UseSpaceForXMove?"
  830. ATREEREF atrbAbsXMovesRightOnly ; // "AbsXMovesRightOnly?"
  831. ATREEREF atrXMoveThreshold; // "XMoveThreshold"
  832. ATREEREF atrYMoveThreshold; // "YMoveThreshold"
  833. ATREEREF atrXMoveUnits; // "XMoveUnits"
  834. ATREEREF atrYMoveUnits; // "YMoveUnits"
  835. ATREEREF atrLineSpacingMoveUnit; // "LineSpacingMoveUnit"
  836. //
  837. // Color related information
  838. //
  839. ATREEREF atrChangeColorMode; // "ChangeColorModeOnPage?"
  840. ATREEREF atrChangeColorModeDoc; // "ChangeColorModeOnDoc?"
  841. ATREEREF atrMagentaInCyanDye; // "MagentaInCyanDye"
  842. ATREEREF atrYellowInCyanDye; // "YellowInCyanDye"
  843. ATREEREF atrCyanInMagentaDye; // "CyanInMagentaDye"
  844. ATREEREF atrYellowInMagentaDye; // "YellowInMagentaDye"
  845. ATREEREF atrCyanInYellowDye; // "CyanInYellowDye"
  846. ATREEREF atrMagentaInYellowDye; // "MagentaInYellowDye"
  847. ATREEREF atrUseColorSelectCmd; // "UseExpColorSelectCmd?"
  848. ATREEREF atrMoveToX0BeforeColor; // "MoveToX0BeforeSetColor?"
  849. ATREEREF atrEnableGDIColorMapping; // "EnableGDIColorMapping?"
  850. // obsolete fields
  851. ATREEREF atrMaxNumPalettes; // "MaxNumPalettes"
  852. // ATREEREF atrPaletteSizes; // "PaletteSizes"
  853. // ATREEREF atrPaletteScope; // "PaletteScope"
  854. //
  855. // Overlay related information
  856. //
  857. ATREEREF atrMinOverlayID; // "MinOverlayID"
  858. ATREEREF atrMaxOverlayID; // "MaxOverlayID"
  859. //
  860. // Raster data related information
  861. //
  862. ATREEREF atrOptimizeLeftBound; // "OptimizeLeftBound?"
  863. ATREEREF atrStripBlanks; // "StripBlanks"
  864. ATREEREF atrLandscapeGrxRotation; // "LandscapeGrxRotation"
  865. ATREEREF atrRasterZeroFill; // "RasterZeroFill?"
  866. ATREEREF atrRasterSendAllData; // "RasterSendAllData?"
  867. ATREEREF atrSendMultipleRows; // "SendMultipleRows?"
  868. ATREEREF atrMaxMultipleRowBytes; // "MaxMultipleRowBytes"
  869. ATREEREF atrCursorXAfterSendBlockData; // "CursorXAfterSendBlockData"
  870. ATREEREF atrCursorYAfterSendBlockData; // "CursorYAfterSendBlockData"
  871. ATREEREF atrMirrorRasterByte; // "MirrorRasterByte?"
  872. ATREEREF atrMirrorRasterPage; // "MirrorRasterPage?"
  873. //
  874. // Device Font related information
  875. //
  876. ATREEREF atrDeviceFontsList ; // "DeviceFonts"
  877. ATREEREF atrDefaultFont; // "DefaultFont"
  878. ATREEREF atrTTFSEnabled ; // "TTFSEnabled?"
  879. ATREEREF atrRestoreDefaultFont; // "RestoreDefaultFont?"
  880. ATREEREF atrDefaultCTT; // "DefaultCTT"
  881. ATREEREF atrMaxFontUsePerPage; // "MaxFontUsePerPage"
  882. ATREEREF atrTextYOffset; // "TextYOffset"
  883. ATREEREF atrCharPosition; // "CharPosition"
  884. ATREEREF atrDiffFontsPerByteMode; // "DiffFontsPerByteMode?"
  885. //
  886. // Font Downloading related information
  887. //
  888. ATREEREF atrMinFontID; // "MinFontID"
  889. ATREEREF atrMaxFontID; // "MaxFontID"
  890. ATREEREF atrMaxNumDownFonts; // "MaxNumDownFonts"
  891. ATREEREF atrMinGlyphID; // "MinGlyphID"
  892. ATREEREF atrMaxGlyphID; // "MaxGlyphID"
  893. ATREEREF atrDLSymbolSet; // "DLSymbolSet"
  894. ATREEREF atrIncrementalDownload; // "IncrementalDownload?"
  895. ATREEREF atrFontFormat; // "FontFormat"
  896. ATREEREF atrMemoryForFontsOnly; // "MemoryForFontsOnly?"
  897. //
  898. // Rect Fill related information
  899. //
  900. ATREEREF atrCursorXAfterRectFill; // "CursorXAfterRectFill"
  901. ATREEREF atrCursorYAfterRectFill; // "CursorYAfterRectFill"
  902. ATREEREF atrMinGrayFill; // "MinGrayFill"
  903. ATREEREF atrMaxGrayFill; // "MaxGrayFill"
  904. ATREEREF atrTextHalftoneThreshold; // "TextHalftoneThreshold"
  905. // Internal Parser Use Only
  906. ATREEREF atrInvldInstallCombo ; // holds all InvalidCombos
  907. // involving synthesized features.
  908. ATREEREF atrLetterSizeExists ;
  909. ATREEREF atrA4SizeExists ;
  910. // ATREEREF atr; // "" prototype
  911. } GLOBALATTRIB, * PGLOBALATTRIB ; // the prefix tag shall be 'ga'
  912. // warning: any non-attribtreeref added to
  913. // the GLOBALATTRIB structure will get stomped on in strange
  914. // ways by BinitPreAllocatedObjects.
  915. // note: some fields in the snapshot won't be initialized.
  916. // they include orderdependencies and constraints. The
  917. // helper functions will do all the grovelling.
  918. // there are two classes of fields in the FeatureOption structure,
  919. // those initialized by a corresponding field in the GPD file
  920. // and those the parser initializes at postprocessing time.
  921. // These fields have no associated GPD keyword.
  922. // For the fields that are keyword initialized, note also
  923. // the keyword may be a Feature attribute only, an Option attribute
  924. // only or both a Feature and Option attribute.
  925. typedef struct
  926. {
  927. // -- Feature Level -- //
  928. ATREEREF atrFeatureType; // "FeatureType"
  929. ATREEREF atrUIType; // "UIType" PickMany or PickOne?
  930. ATREEREF atrDefaultOption; // "DefaultOption"
  931. ATREEREF atrPriority ;
  932. ATREEREF atrFeaInstallable; // "Installable?"
  933. ATREEREF atrInstallableFeaDisplayName; // "InstallableFeatureName"
  934. ATREEREF atrInstallableFeaRcNameID; // "rcInstallableFeatureNameID"
  935. // above 3 fields not used by snapshot.
  936. ATREEREF atrFeaKeyWord ; // symbol name
  937. ATREEREF atrFeaDisplayName ; // "Name"
  938. ATREEREF atrFeaRcNameID; // "rcNameID"
  939. ATREEREF atrFeaRcIconID; // "rcIconID"
  940. ATREEREF atrFeaRcHelpTextID; // "rcHelpTextID"
  941. ATREEREF atrFeaRcPromptMsgID; // "rcPromptMsgID"
  942. ATREEREF atrFeaRcPromptTime; // "rcPromptTime"
  943. ATREEREF atrConcealFromUI; // "ConcealFromUI?"
  944. ATREEREF atrUpdateQualityMacro; // "UpdateQualityMacro?"
  945. ATREEREF atrFeaHelpIndex; // "HelpIndex"
  946. // Bi-Di Query related information
  947. ATREEREF atrQueryOptionList; // "QueryOptionList"
  948. ATREEREF atrQueryDataType; // "QueryDataType"
  949. ATREEREF atrQueryDefaultOption; // "QueryDefaultOption"
  950. // scaffolding until Installable Features are synthesized.
  951. // ATREEREF atrFeaInvldInstallCombo ; // // referenced from
  952. // "InvalidInstallableCombination"
  953. ATREEREF atrFeaInstallConstraints ; // "InstalledConstraints"
  954. ATREEREF atrFeaNotInstallConstraints ; // "NotInstalledConstraints"
  955. // -- Option Level -- //
  956. ATREEREF atrOptInstallable; // "Installable?"
  957. ATREEREF atrInstallableOptDisplayName ; // "InstallableFeatureName"
  958. ATREEREF atrInstallableOptRcNameID; // "rcInstallableFeatureNameID"
  959. // above 3 fields not used by snapshot.
  960. ATREEREF atrOptKeyWord ; // symbol name
  961. ATREEREF atrOptDisplayName ; // "Name"
  962. ATREEREF atrOptRcNameID; // "rcNameID"
  963. ATREEREF atrOptRcIconID; // "rcIconID"
  964. ATREEREF atrOptRcHelpTextID; // "rcHelpTextID"
  965. ATREEREF atrOptHelpIndex; // "HelpIndex"
  966. ATREEREF atrOptRcPromptMsgID; // "rcPromptMsgID"
  967. ATREEREF atrOptRcPromptTime; // "rcPromptTime"
  968. ATREEREF atrCommandIndex ;
  969. // these 2 fields are the only permanent types of constraints
  970. ATREEREF atrConstraints ;
  971. ATREEREF atrInvalidCombos ; // referenced from "InvalidCombination"
  972. // all of these serve as scaffolding till the Installable
  973. // features are synthesized!
  974. // ATREEREF atrOptInvldInstallCombo ; // // referenced from
  975. // "InvalidInstallableCombination"
  976. ATREEREF atrOptInstallConstraints ; // "InstalledConstraints"
  977. ATREEREF atrOptNotInstallConstraints ; // "NotInstalledConstraints"
  978. ATREEREF atrDisabledFeatures ; // "*DisabledFeatures"
  979. #ifdef GMACROS
  980. ATREEREF atrDependentSettings ; // "*DependentSettings"
  981. ATREEREF atrUIChangeTriggersMacro ; // "*UIChangeTriggersMacro"
  982. #endif
  983. // -- Option specific fields -- //
  984. // -- PaperSize option specific fields -- //
  985. ATREEREF atrPrintableSize; // "PrintableSize"
  986. ATREEREF atrPrintableOrigin; // "PrintableOrigin"
  987. ATREEREF atrCursorOrigin; // "CursorOrigin"
  988. ATREEREF atrVectorOffset; // "VectorOffset"
  989. ATREEREF atrMinSize; // "MinSize"
  990. ATREEREF atrMaxSize; // "MaxSize"
  991. ATREEREF atrTopMargin; // "TopMargin"
  992. ATREEREF atrBottomMargin; // "BottomMargin"
  993. ATREEREF atrMaxPrintableWidth; // "MaxPrintableWidth"
  994. ATREEREF atrMinLeftMargin; // "MinLeftMargin"
  995. ATREEREF atrCenterPrintable; // "CenterPrintable?"
  996. ATREEREF atrPageDimensions; // "PageDimensions"
  997. ATREEREF atrRotateSize; // "RotateSize?"
  998. ATREEREF atrPortRotationAngle; // "PortRotationAngle"
  999. ATREEREF atrPageProtectMem; // "PageProtectMem"
  1000. ATREEREF atrCustCursorOriginX ; // "CustCursorOriginX"
  1001. ATREEREF atrCustCursorOriginY ; // "CustCursorOriginY"
  1002. ATREEREF atrCustPrintableOriginX ; // "CustPrintableOriginX"
  1003. ATREEREF atrCustPrintableOriginY ; // "CustPrintableOriginY"
  1004. ATREEREF atrCustPrintableSizeX; // "CustPrintableSizeX"
  1005. ATREEREF atrCustPrintableSizeY; // "CustPrintableSizeY"
  1006. // -- InputBin option specific fields -- //
  1007. ATREEREF atrFeedMargins; // "FeedMargins"
  1008. ATREEREF atrPaperFeed; // "PaperFeed"
  1009. // -- OutputBin option specific fields -- //
  1010. // -- Resolution option specific fields -- //
  1011. ATREEREF atrDPI; // "DPI"
  1012. ATREEREF atrSpotDiameter; // "SpotDiameter"
  1013. ATREEREF atrTextDPI; // "TextDPI"
  1014. ATREEREF atrPinsPerPhysPass; // "PinsPerPhysPass"
  1015. ATREEREF atrPinsPerLogPass; // "PinsPerLogPass"
  1016. ATREEREF atrRequireUniDir; // "RequireUniDir?"
  1017. ATREEREF atrMinStripBlankPixels; // "MinStripBlankPixels"
  1018. ATREEREF atrRedDeviceGamma ; // "RedDeviceGamma"
  1019. ATREEREF atrGreenDeviceGamma ; // "GreenDeviceGamma"
  1020. ATREEREF atrBlueDeviceGamma ; // "BlueDeviceGamma"
  1021. // -- ColorMode option specific fields -- //
  1022. ATREEREF atrColor; // "Color?"
  1023. ATREEREF atrDevNumOfPlanes; // "DevNumOfPlanes"
  1024. ATREEREF atrDevBPP; // "DevBPP"
  1025. ATREEREF atrColorPlaneOrder; // "ColorPlaneOrder"
  1026. ATREEREF atrDrvBPP; // "DrvBPP"
  1027. ATREEREF atrIPCallbackID; // "IPCallbackID"
  1028. ATREEREF atrColorSeparation; // "ColorSeparation?"
  1029. ATREEREF atrRasterMode; // "RasterMode"
  1030. ATREEREF atrPaletteSize; // "PaletteSize"
  1031. ATREEREF atrPaletteProgrammable; // "PaletteProgrammable?"
  1032. // -- Memory option specific fields -- //
  1033. ATREEREF atrMemoryConfigKB; // "MemoryConfigKB"
  1034. ATREEREF atrMemoryConfigMB; // "MemoryConfigMB"
  1035. // -- Halftone option specific fields -- //
  1036. ATREEREF atrRcHTPatternID; // "rcHTPatternID"
  1037. ATREEREF atrHTPatternSize; // "HTPatternSize"
  1038. ATREEREF atrHTNumPatterns; // "HTNumPatterns"
  1039. ATREEREF atrHTCallbackID; // "HTCallbackID"
  1040. ATREEREF atrLuminance; // "Luminance"
  1041. // -- OUTPUTBIN option specific fields -- //
  1042. ATREEREF atrOutputOrderReversed ; // *OutputOrderReversed? (option level)
  1043. // -- fields synthesized at Post Processing time -- //
  1044. // ATREEREF atrGIDvalue; // GID value
  1045. ATREEREF atrOptIDvalue; // ID value
  1046. ATREEREF atrFeaFlags ; // invalid or not
  1047. // If this option is installable, this points to the index of the
  1048. // resulting synthesized feature.
  1049. ATREEREF atrOptionSpawnsFeature ; // must support an attrib tree.
  1050. // warning: any non-attribtreeref added to
  1051. // the DFEATURE_OPTIONS structure will get stomped on in strange
  1052. // and wonderful ways by BinitPreAllocatedObjects.
  1053. // if this is a synthesized feature:
  1054. DWORD dwInstallableFeatureIndex ; // backlink to Feature/Option
  1055. DWORD dwInstallableOptionIndex ; // that prompted this feature.
  1056. // If this feature is installable, this points to the index of the
  1057. // resulting synthesized feature.
  1058. DWORD dwFeatureSpawnsFeature ;
  1059. // internal consistency checks.
  1060. BOOL bReferenced ; // default is FALSE.
  1061. DWORD dwGID , // GID tag
  1062. dwNumOptions ; // these are not read in from GPD file.
  1063. }DFEATURE_OPTIONS, * PDFEATURE_OPTIONS ; // the prefix tag shall be 'fo'
  1064. // R.I.P. - moved to gpd.h
  1065. // typedef struct
  1066. // {
  1067. // SEQSECTION eSection; // Specifies the section
  1068. // DWORD dwOrder ; // order within each section.
  1069. // } ORDERDEPENDENCY , * PORDERDEPENDENCY ;
  1070. // assign this struct the type 'ord'
  1071. // ---- End of Value Structures Section ---- //
  1072. // ---- Header Section ---- //
  1073. typedef struct
  1074. {
  1075. PSTR pstrKeyword ; // keyword associated with this entry
  1076. VALUE dwDefaultValue ; // One DWORD that will be copied
  1077. // to the destination if nothing is found
  1078. // in the attribute tree. If the field
  1079. // requires more than one DWORD, this
  1080. // value is repeatedly copied.
  1081. //
  1082. // if the value being copied is actually
  1083. // a bit flag, this member shall contain
  1084. // the value of the bit flag to be set.
  1085. // Setting the flag shall be accomplished by
  1086. // OR-ing this value into the destination.
  1087. DWORD dwNbytes ; // # bytes occupied by value or link
  1088. DWORD dwSrcOffset ; // location of ATREEREF
  1089. DWORD dwDestOffset ; // offset in snapshot (dest) Structure to
  1090. // copy link to object or object itself.
  1091. DWORD dwFlags ; // is this a dedicated structure?
  1092. // ideally to ensure consistency, should
  1093. // copy flags directly from the mainkeyword table.
  1094. DWORD dwGIDflags ; // BitField indicating which GID this
  1095. // field is a member of. Only one bit should be set.
  1096. } SNAPSHOTTABLE , * PSNAPSHOTTABLE ;
  1097. // the snapshot table determines which fields in the
  1098. // rawbinarydata are copied over to each structure in the
  1099. // snapshot. This table is initialized only when a
  1100. // rawbinarydata block is read from file.
  1101. typedef struct {
  1102. RAWBINARYDATA rbd ; // may be accessed by UI and control module.
  1103. DWORD dwSpecVersion ; // store converted version number
  1104. // ptrs to tables required to generate snapshot.
  1105. // these tables are allocated and initialized when
  1106. // the RawBinaryData is read from file. They are not saved
  1107. // to file.
  1108. // max buffer size needed to store option array in keyword form:
  1109. DWORD dwMaxDocKeywordSize, // Doc-Sticky,not used now but might later.
  1110. dwMaxPrnKeywordSize; // Printer-Sticky
  1111. #if 0
  1112. PSNAPSHOTTABLE snapShotTable ;
  1113. PRANGE ssTableIndex ;
  1114. PDWORD pdwSizeOption ;
  1115. PDWORD pdwSizeOptionEx ;
  1116. DWORD dwSSCmdSelectIndex ; // SS index of atrCommandIndex in pfo
  1117. DWORD dwSSdefaultOptionIndex ; // SSindex of atrDefaultOption in pfo
  1118. DWORD dwSSTableCmdIndex ; // SSindex of MTI_COMMANDTABLE entry.
  1119. DWORD dwSSPaperSizeMinSizeIndex ; // index not actually used
  1120. DWORD dwSSPaperSizeMaxSizeIndex ;
  1121. DWORD dwSSPaperSizeMarginsIndex ;
  1122. DWORD dwSSPaperSizeCursorOriginIndex ;
  1123. DWORD dwSSFeatureTypeIndex ;
  1124. DWORD dwSSConstraintsIndex ;
  1125. DWORD dwSSInvalidCombosIndex ;
  1126. // add other special case indicies here.
  1127. #endif
  1128. } MINIRAWBINARYDATA, * PMINIRAWBINARYDATA;
  1129. // assign this struct the type 'mrbd'
  1130. // First 6 or so fields are same as RAWBINARYDATA.
  1131. // global !
  1132. // extern MINIRAWBINARYDATA gmrbd ;
  1133. // This is now in GLOBL structure.
  1134. typedef struct {
  1135. RAWBINARYDATA rbd ; // may be accessed by UI and control module.
  1136. // this must be the FIRST! field, so Amanda's code will still function.
  1137. // so initialize with beginning of pubBUDData.
  1138. HFILEMAP hFileMap; // handle to memory mapped BUD file.
  1139. PBYTE pubBUDData ; // ptr to image of BUD file.
  1140. // first structure is RAWBINARYDATA
  1141. PSNAPSHOTTABLE snapShotTable ;
  1142. PRANGE ssTableIndex ;
  1143. PDWORD pdwSizeOption ;
  1144. PDWORD pdwSizeOptionEx ;
  1145. DWORD dwSSFeatureTypeIndex ;
  1146. DWORD dwSSdefaultOptionIndex ; // SSindex of atrDefaultOption in pfo
  1147. DWORD dwSSPaperSizeMinSizeIndex ; // index not actually used
  1148. DWORD dwSSPaperSizeMaxSizeIndex ;
  1149. DWORD dwSSTableCmdIndex ; // SSindex of MTI_COMMANDTABLE entry.
  1150. DWORD dwSSCmdSelectIndex ; // SS index of atrCommandIndex in pfo
  1151. DWORD dwSSPaperSizeCursorOriginIndex ;
  1152. DWORD dwSSConstraintsIndex ;
  1153. DWORD dwSSInvalidCombosIndex ;
  1154. #ifdef GMACROS
  1155. DWORD dwSSDepSettingsIndex ;
  1156. DWORD dwSSUIChangeTriggersMacroIndex ;
  1157. #endif
  1158. #if 0 // Don't define unless necessary.
  1159. DWORD dwSSPaperSizeMarginsIndex ;
  1160. // add other special case indicies here.
  1161. #endif
  1162. } STATICFIELDS, *PSTATICFIELDS ; // These are fields that contain static data that is used
  1163. // to create the snapshot, but would be repetitive and waste space if kept in the BUD file.
  1164. // ---- End of Header Section ---- //
  1165. // ---- CommandArray Section ---- //
  1166. // #define NO_CALLBACK_ID (0xffffffff)
  1167. #define CMD_SELECT (0xfffffffe)
  1168. // used in place of a symbolID resulting from
  1169. // registering a command name.
  1170. // R.I.P. - moved to gpd.h
  1171. // typedef struct
  1172. // {
  1173. // ARRAYREF strInvocation ; // use only if NOT a CmdCallback.
  1174. // ORDERDEPENDENCY ordOrder ;
  1175. // DWORD dwCmdCallbackID ; // set to UNUSED if not a CmdCallback
  1176. // DWORD dwStandardVarsList ; // use only if CmdCallback. Points to
  1177. // // root of list holding indicies of Standard Vars
  1178. // // to be passed into the callback.
  1179. // } COMMAND, * PCOMMAND ;
  1180. // assign this struct the type 'cmd'
  1181. // typedef struct
  1182. // {
  1183. // DWORD dwFormat ; // first letter after the %
  1184. // DWORD dwDigits ; // used if wFormat = 'd' or 'D' and
  1185. // // PARAM_FLAG_FIELDWIDTH_USED
  1186. // DWORD dwFlags ; // see param_flags
  1187. // LONG lMin ; // optional lower limit
  1188. // LONG lMax ; // optional upper limit
  1189. // // DWORD dwMaxRepeat ; // optional max repeat count
  1190. // // doesn't really exist!
  1191. // ARRAYREF arTokens ; // tokens for RPN calculator
  1192. // } PARAMETER, * PPARAMETER ;
  1193. // assign this struct the type 'param'
  1194. // #define PARAM_FLAG_MIN_USED 0x00000001
  1195. // // lMin field is used
  1196. // #define PARAM_FLAG_MAX_USED 0x00000002
  1197. // // lMax field is used
  1198. // #define PARAM_FLAG_FIELDWIDTH_USED 0x00000004
  1199. // // if fieldwidth was specified for 'd' or 'D' format.
  1200. // #define PARAM_FLAG_MAXREPEAT_USED 0x00000008 // dead
  1201. // // dwMaxRepeat field is used
  1202. // typedef struct
  1203. // {
  1204. // DWORD dwValue ; // integer or Standard Variable index
  1205. // OPERATOR eType; // type of Value or operator
  1206. // } TOKENSTREAM, * PTOKENSTREAM ;
  1207. // assign this struct the type 'tstr'
  1208. // typedef enum
  1209. // { OP_INTEGER, // dwValue contains an integer
  1210. // OP_VARI_INDEX,
  1211. // // dwValue contains index to Standard Variable Table.
  1212. //
  1213. // // these operators will actually be inserted into the token
  1214. // // stream.
  1215. // OP_MIN, OP_MAX, OP_ADD, OP_SUB, OP_MULT,
  1216. // OP_DIV, OP_MOD, OP_MAX_REPEAT, OP_HALT
  1217. //
  1218. // // these operators are used only in the temporary stack
  1219. // OP_OPENPAR, OP_CLOSEPAR, OP_NEG,
  1220. //
  1221. // // these operators are processed immediately by the
  1222. // // token parser and are not stored.
  1223. // OP_COMMA, OP_NULL, OP_LAST
  1224. // } OPERATOR ; // parameter operator.
  1225. //
  1226. // extern DWORD gdwOperPrecedence[OP_LAST] ;
  1227. // This is now in GLOBL structure.
  1228. // ---- End of CommandArray Section ---- //
  1229. // ---- List Values Section ---- //
  1230. /* this defines the nodes used to implement a singly-linked
  1231. list of DWORD items. Some values are stored in Lists. */
  1232. // typedef struct
  1233. // {
  1234. // DWORD dwData ;
  1235. // DWORD dwNextItem ; // index of next listnode
  1236. // } LISTNODE, * PLISTNODE ;
  1237. // assign this struct the type 'lst'
  1238. // ---- End of List Values Section ---- //
  1239. // ---- Macros Section ---- //
  1240. // BLOCKMACRODICT is an array of BLOCKMACRODICTENTRY structs
  1241. // that allows the function to resolve references to BlockMacros.
  1242. typedef struct
  1243. {
  1244. DWORD dwSymbolID; // macro name ID value (obtained by RegisterSymbol)
  1245. DWORD dwTKIndexOpen; // index of open brace (in newTokenMap)
  1246. DWORD dwTKIndexClose; // index of closing brace
  1247. } BLOCKMACRODICTENTRY, * PBLOCKMACRODICTENTRY ;
  1248. // VALUEMACRODICT is an array of VALUEMACRODICTENTRY structs
  1249. // that allows the function to resolve references to valueMacros.
  1250. typedef struct
  1251. {
  1252. DWORD dwSymbolID; // macro name ID value
  1253. DWORD dwTKIndexValue; // token index of valueMacro defintion
  1254. } VALUEMACRODICTENTRY, * PVALUEMACRODICTENTRY ;
  1255. // MACROLEVELSTACK: is operated as a stack of MACROLEVELSTATE
  1256. // structs that saves the values of curBlockMacroEntry
  1257. // and curValueMacroEntry , each time a brace is encountered.
  1258. typedef struct
  1259. {
  1260. DWORD dwCurBlockMacroEntry;
  1261. DWORD dwCurValueMacroEntry;
  1262. BOOL bMacroInProgress ;
  1263. } MACROLEVELSTATE, * PMACROLEVELSTATE ;
  1264. // ---- End of Macros Section ---- //
  1265. // ---- Global and state Variables ---- //
  1266. // {
  1267. // ---- Error handling variables ---- //
  1268. typedef enum
  1269. {ERRSEV_NONE, ERRSEV_CONTINUE, ERRSEV_RESTART, ERRSEV_FATAL} SEVERITY ;
  1270. typedef enum
  1271. {ERRTY_NONE, ERRTY_SYNTAX, ERRTY_MEMORY_ALLOCATION,
  1272. ERRTY_FILE_OPEN, ERRTY_CODEBUG} ERRTYPE ;
  1273. // All of the following are now in GLOBL structure.
  1274. // extern DWORD gdwMasterTabIndex ; // which resource ran out
  1275. // extern SEVERITY geErrorSev ; // how bad an error?
  1276. // extern ERRTYPE geErrorType ; // what type of error?
  1277. // extern DWORD gdwVerbosity ; // 0 = min verbosity 4 max verbosity.
  1278. // extern DWORD gdwID_IgnoreBlock ; // index of *IgnoreBlock
  1279. // extern DWORD gdwMemConfigKB, gdwMemConfigMB, gdwOptionConstruct,
  1280. // gdwOpenBraceConstruct, gdwCloseBraceConstruct,
  1281. // gdwMemoryConfigMB, gdwMemoryConfigKB,
  1282. // gdwCommandConstruct, gdwCommandCmd,
  1283. // gdwOptionName ;
  1284. // extern DWORD gdwResDLL_ID ; // Feature index of feature holding
  1285. // names of all resource DLLs.
  1286. // Table to convert allowed values to sizes:
  1287. // extern DWORD gValueToSize[VALUE_MAX] ; // size of various values in bytes
  1288. // ---- track value of curBlockMacroArray and curValueMacroArray ---- //
  1289. // BUG_BUG!!!!! may be part of master table !
  1290. // DWORD gdwCurBlockMacroArray ; // initially set to zero. First
  1291. // DWORD gdwCurValueMacroArray ; // writable slot in MacroArray.
  1292. // DWORD gdwMacroLevelStackPtr ; // Push: write values into
  1293. // MacroLevelStack[MacroLevelStackPtr++]
  1294. // Pop: read values from
  1295. // MacroLevelStack[--MacroLevelStackPtr]
  1296. // }
  1297. // These commonly used entities will be MACROS.
  1298. #define mMainKeywordTable ((PKEYWORDTABLE_ENTRY)(gMasterTable[MTI_MAINKEYWORDTABLE].pubStruct))
  1299. #define mpubOffRef (gMasterTable[MTI_STRINGHEAP].pubStruct)
  1300. // All stringheap offsets are referenced from this pointer.
  1301. #define mloCurHeap (gMasterTable[MTI_STRINGHEAP].dwCurIndex)
  1302. // current writable position on heap.
  1303. #define mdwMaxHeap (gMasterTable[MTI_STRINGHEAP].dwArraySize)
  1304. // maximum size of heap.
  1305. #define mpstsStateStack ((PSTSENTRY)gMasterTable[MTI_STSENTRY].pubStruct)
  1306. // base of state stack
  1307. #define mdwCurStsPtr (gMasterTable[MTI_STSENTRY].dwCurIndex)
  1308. // current writable (uninitialized) position on stack.
  1309. #define mdwMaxStackDepth (gMasterTable[MTI_STSENTRY].dwArraySize)
  1310. // maximum size of heap.
  1311. // ---- Index in SYMBOLNODE array to each type of tree ---- //
  1312. // initially set to INVALID_INDEX
  1313. #define mdwFeatureSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1314. + SCL_FEATURES))
  1315. #define mdwFontCartSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1316. + SCL_FONTCART))
  1317. #define mdwTTFontSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1318. + SCL_TTFONTNAMES))
  1319. #define mdwBlockMacroSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1320. + SCL_BLOCKMACRO))
  1321. #define mdwValueMacroSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1322. + SCL_VALUEMACRO))
  1323. #define mdwCmdNameSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1324. + SCL_COMMANDNAMES))
  1325. #define mdwPreProcDefinesSymbols (*((PDWORD)gMasterTable[MTI_SYMBOLROOT].pubStruct\
  1326. + SCL_PPDEFINES))
  1327. /* ----- tables of constants ----- */
  1328. typedef enum {BT_FALSE, BT_TRUE} BOOLEANTYPE ;
  1329. typedef enum { UIT_PICKONE, UIT_PICKMANY } UITYPE ;
  1330. typedef enum _QUERYDATATYPE {
  1331. QDT_DWORD, QDT_CONCATENATED_STRINGS
  1332. } QUERYDATATYPE;
  1333. // typedef enum
  1334. // {ORIENT_PORTRAIT, ORIENT_CC90, ORIENT_CC270 }
  1335. // ORIENTATION ; // decided to overload LANDSCAPEGRXROTATION
  1336. // // instead of using a separate enum for orientation
  1337. // // option keywords.
  1338. // typedef enum
  1339. // {
  1340. // SECT_UNINITIALIZED, JOB_SETUP, DOC_SETUP, PAGE_SETUP, PAGE_FINISH,
  1341. // DOC_FINISH, JOB_FINISH
  1342. // } SECTION ; replaced by SEQ_SECTION
  1343. typedef struct
  1344. {
  1345. DWORD tIndexID; // tokenindex where a macro ID value is stored
  1346. DWORD tIndexOpen; // index of open brace
  1347. DWORD tIndexClose; // index of closing brace
  1348. } BLOCKMACROARRAY ;
  1349. // snapshot and helper functions.
  1350. #define OPTION_PENDING (OPTION_INDEX_ANY - 1)
  1351. #define NUM_CONFIGURATION_CMDS (LAST_CONFIG_CMD - FIRST_CONFIG_CMD)
  1352. // number of predefined commands that are emitted
  1353. // at a fixed point in the job determined by order dependency.
  1354. #define MAX_SNAPSHOT_ELEMENTS (200)
  1355. // increase as more entries are added to the snapshot table.
  1356. typedef enum
  1357. {
  1358. TRI_UTTER_FAILURE, TRI_SUCCESS, TRI_AGAIN, TRI_UNINITIALIZED
  1359. } TRISTATUS ;
  1360. typedef enum
  1361. { SSTI_GLOBALS, SSTI_UPDATE_GLOBALS,
  1362. SSTI_UIINFO, SSTI_UPDATE_UIINFO,
  1363. SSTI_FEATURES, SSTI_UPDATE_FEATURES,
  1364. SSTI_OPTIONS, SSTI_UPDATE_OPTIONS,
  1365. SSTI_OPTIONEX, SSTI_UPDATE_OPTIONEX,
  1366. SSTI_SPECIAL, MAX_STRUCTURETYPES
  1367. } SSTABLEINDEX ;
  1368. // flags for snapshot table.
  1369. #define SSF_REQUIRED 0x00000001
  1370. // fail if there is no value to copy
  1371. #define SSF_DONT_USEDEFAULT 0x00000002
  1372. // if there is no value to copy leave dest
  1373. // undisturbed. Do not copy the default value.
  1374. #define SSF_OFFSETONLY 0x00000004
  1375. // Copy only the loOffset of an arrayref.
  1376. #define SSF_MAKE_STRINGPTR 0x00000008
  1377. // Convert arrayref to stringptr
  1378. #define SSF_SETRCID 0x00000010
  1379. // set high bit after copying the value (if found)
  1380. #define SSF_FAILIFZERO 0x00000020
  1381. // unlike SSF_REQUIRED, allow current copy
  1382. // to fail, then fail only if dest is zero.
  1383. #define SSF_SECOND_DWORD 0x00000040
  1384. // treat src value object as array of DWORDS
  1385. // and copy the 2nd DWORD to the destination.
  1386. // used to transfer just the Y value of a point
  1387. // to the dest.
  1388. #define SSF_KB_TO_BYTES 0x00000080
  1389. // treat dest as a dword and left shift by 10 bits.
  1390. #define SSF_HEAPOFFSET 0x00000100
  1391. // instead of copying the bytes at pheap + heapoffset
  1392. // just copy heapoffset to the destination.
  1393. // this is used with dedicated structures where
  1394. // the heapoffset is actually the array index of a dedicated
  1395. // structure.
  1396. #define SSF_RETURN_UNINITIALIZED 0x00000200
  1397. // if no value exists, cause EextractValueFromTree
  1398. // to return TRI_UNINITIALIZED, but don't complain
  1399. // to user.
  1400. #define SSF_NON_LOCALIZABLE 0x00000400
  1401. // this keyword contains an explicit string and the resulting
  1402. // GPD file is not localizable. The parser will emit a
  1403. // warning whenever such a keyword is parsed.
  1404. #define SSF_MB_TO_BYTES 0x00000800
  1405. // treat dest as a dword and left shift by 20 bits.
  1406. #define SSF_STRINGLEN 0x00001000
  1407. // just copy dwCount portion of arrayref to the destination.
  1408. // the next 3 flags are to support the helper function
  1409. // GetGPDResourceIDs() which is used only by Bob's MDT tool.
  1410. // Note when any new entries are added to snaptbl.c
  1411. // you should see if any of these flags need to be set.
  1412. // otherwise GetGPDResourceIDs will not report any
  1413. // IDs used by the new entries.
  1414. #define SSF_FONTID 0x00002000
  1415. // This entry is a Font resource ID.
  1416. #define SSF_STRINGID 0x00004000
  1417. // This entry is a String resource ID.
  1418. #define SSF_LIST 0x00008000
  1419. // This entry is a LIST (the index of a LISTNODE)
  1420. #define SSF_ICONID 0x00010000
  1421. // This entry is an Icon resource ID.
  1422. #define SSF_OTHER_RESID 0x00020000
  1423. // This entry is an unclassified resource ID.
  1424. // ie CTT, rcPromptMsgID, HelpIndex, rcHTPatternID
  1425. #define SSF_BITFIELD_DEF_FALSE (0x00040000)
  1426. // This entry is a Bitfield, which is CLEARED
  1427. // by default.
  1428. #define SSF_BITFIELD_DEF_TRUE (0x00080000)
  1429. // This entry is a Bitfield, which is SET
  1430. // by default.
  1431. // bitflags may be used with SSF_REQUIRED.
  1432. // Bitfields are SET and CLEARED depending on the
  1433. // value of the Boolean in the attribute tree.
  1434. // the Bits to SET are defined by dwDefaultValue.
  1435. // how do we verify proper initialization in the case when a dest
  1436. // field must be initialized by at least one of several keywords?
  1437. // The first keyword has a default initializer value of zero.
  1438. // and has no flags set. The last keyword has the
  1439. // SSF_DONT_USEDEFAULT | SSF_FAILIFZERO flags set.
  1440. // The keywords in between has the SSF_DONT_USEDEFAULT flag set.
  1441. #define GIDF_RESOLUTION (1 << GID_RESOLUTION)
  1442. #define GIDF_PAGESIZE (1 << GID_PAGESIZE)
  1443. #define GIDF_PAGEREGION (1 << GID_PAGEREGION)
  1444. #define GIDF_DUPLEX (1 << GID_DUPLEX)
  1445. #define GIDF_INPUTSLOT (1 << GID_INPUTSLOT)
  1446. #define GIDF_MEDIATYPE (1 << GID_MEDIATYPE)
  1447. #define GIDF_MEMOPTION (1 << GID_MEMOPTION)
  1448. #define GIDF_COLORMODE (1 << GID_COLORMODE)
  1449. #define GIDF_ORIENTATION (1 << GID_ORIENTATION)
  1450. #define GIDF_PAGEPROTECTION (1 << GID_PAGEPROTECTION)
  1451. #define GIDF_COLLATE (1 << GID_COLLATE)
  1452. #define GIDF_OUTPUTBIN (1 << GID_OUTPUTBIN)
  1453. #define GIDF_HALFTONING (1 << GID_HALFTONING)
  1454. //
  1455. // All the thread-unsafe data that was previously global has now
  1456. // been packed into this structure.
  1457. //
  1458. typedef struct {
  1459. MASTERTAB_ENTRY GMasterTable[MTI_MAX_ENTRIES] ;
  1460. MINIRAWBINARYDATA Gmrbd ;
  1461. // The AllowedTransitions Table determines/defines
  1462. // the state changes produced by each construct keyword
  1463. // Each entry in the table is a NewState and is indexed
  1464. // by the OldState and a ConstructKeyword
  1465. STATE GastAllowedTransitions[STATE_LAST][CONSTRUCT_LAST] ;
  1466. BOOL GabAllowedAttributes[STATE_LAST][ATT_LAST] ;
  1467. DWORD GdwOperPrecedence[OP_LAST] ;
  1468. DWORD GdwMasterTabIndex ; // which resource ran out
  1469. SEVERITY GeErrorSev ; // how bad an error?
  1470. ERRTYPE GeErrorType ; // what type of error?
  1471. DWORD GdwVerbosity ; // 0 = min verbosity 4 max verbosity.
  1472. DWORD GdwID_IgnoreBlock ; // index of *IgnoreBlock
  1473. DWORD GValueToSize[VALUE_MAX] ; // size of various values in bytes
  1474. // MainKeywordTable ID values for keywords
  1475. // that will be synthesized or read by shortcuts code.
  1476. DWORD GdwMemConfigKB, GdwMemConfigMB, GdwOptionConstruct,
  1477. GdwOpenBraceConstruct, GdwCloseBraceConstruct,
  1478. GdwMemoryConfigMB, GdwMemoryConfigKB,
  1479. GdwCommandConstruct, GdwCommandCmd,
  1480. GdwOptionName ;
  1481. DWORD GdwResDLL_ID ; // Feature index of feature holding
  1482. // names of all resource DLLs.
  1483. DWORD GdwLastIndex; // Used only in token1.c. Used to suppress
  1484. // BarchiveStrings() from doing redundant
  1485. // copying of the same strings in the event there
  1486. // are multiple parsing errors.
  1487. ABSARRAYREF GaarPPPrefix; // used only in preproc1.c
  1488. CLASSINDEXENTRY GcieTable[CL_NUMCLASSES] ;
  1489. } GLOBL, * PGLOBL; // All the thread-unsafe data that was previously global has
  1490. // been packed into this structure.
  1491. // function declarations.
  1492. #include "declares.h"
  1493. #if defined(DEVSTUDIO)
  1494. HANDLE MDSCreateFileW(LPCWSTR lpstrFile, DWORD dwDesiredAccess,
  1495. DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpsa,
  1496. DWORD dwCreateFlags, DWORD dwfAttributes,
  1497. HANDLE hTemplateFile);
  1498. #undef CreateFile
  1499. #define CreateFile MDSCreateFileW
  1500. #endif
  1501. #endif // _GPDPARSE_H_