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.

157 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. All Rights Reserved
  4. Module Name:
  5. parsepjl.h
  6. Abstract:
  7. Header file for PJL parser
  8. --*/
  9. #define MAX_POSSIBLE_LISTS_IN_BRANCH 2
  10. /* Note: new actions must be added at end, and new functions at the
  11. end of the function pointer array defined later in this file */
  12. enum ParseActionsEnumTag
  13. {
  14. ACTION_TOKEN_FROM_PARAM_VALUE_FROM_NUMBER_FF,
  15. ACTION_SET_NEW_LIST,
  16. ACTION_GET_TOTAL_AND_LARGEST_FF,
  17. ACTION_GET_CODE_AND_ONLINE_FF,
  18. ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST,
  19. ACTION_SET_VALUE_FROM_PARAM_FF,
  20. ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_NUMBER_EOL_FROM_PARAM,
  21. ACTION_SET_VALUE_FROM_PARAM,
  22. ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_BOOLEAN_EOL,
  23. ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_STRING_EOL
  24. };
  25. /* Note: new actions must be added at end, and new functions at the
  26. end of the function pointer array defined later in this file
  27. */
  28. enum ParseNotFoundActionsEnumTag
  29. {
  30. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  31. ACTION_IF_NOT_FOUND_SKIP_CFLF_AND_INDENTED_LINES
  32. };
  33. /* Note: The order of some of the Token values is related to
  34. indexes in the keyword lists. Always add new token values
  35. to the end of BASE group.
  36. */
  37. enum pjl_token_variables_tag
  38. {
  39. PJL_TOKEN_INQUIRE_BASE = 0x10000,
  40. TOKEN_INQUIRE_TRAY1SIZE = 0x10000,
  41. TOKEN_INQUIRE_TRAY2SIZE,
  42. TOKEN_INQUIRE_TRAY3SIZE,
  43. TOKEN_INQUIRE_TRAY4SIZE,
  44. PJL_TOKEN_ECHO_BASE = 0x20000,
  45. TOKEN_ECHO_MSSYNC_NUMBER = 0x20000,
  46. PJL_TOKEN_INFO_MEMORY_BASE = 0x30000,
  47. TOKEN_INFO_MEMORY_TOTAL = 0x30000,
  48. TOKEN_INFO_MEMORY_LARGEST,
  49. PJL_TOKEN_INFO_STATUS_BASE = 0x40000,
  50. TOKEN_INFO_STATUS_CODE = 0x40000,
  51. TOKEN_INFO_STATUS_ONLINE,
  52. PJL_TOKEN_INFO_CONFIG_BASE = 0x50000,
  53. TOKEN_INFO_CONFIG_MEMORY = 0x50000,
  54. TOKEN_INFO_CONFIG_MEMORY_SPACE,
  55. PJL_TOKEN_USTATUS_JOB_BASE = 0x60000,
  56. TOKEN_USTATUS_JOB_END = 0x60000,
  57. TOKEN_USTATUS_JOB_NAME_MSJOB,
  58. PJL_TOKEN_USTATUS_DEVICE_BASE = 0x70000,
  59. TOKEN_USTATUS_DEVICE_CODE = 0x70000,
  60. TOKEN_USTATUS_DEVICE_DISPLAY,
  61. TOKEN_USTATUS_DEVICE_ONLINE,
  62. };
  63. /* The first 5 values are the possible return values for GetPJLTokens() */
  64. /* The last 2 values are used internally */
  65. enum status_tag
  66. {
  67. STATUS_REACHED_END_OF_COMMAND_OK,
  68. STATUS_END_OF_STRING,
  69. STATUS_SYNTAX_ERROR,
  70. STATUS_ATPJL_NOT_FOUND,
  71. STATUS_NOT_ENOUGH_ROOM_FOR_TOKENS,
  72. STATUS_REACHED_FF,
  73. STATUS_CONTINUE
  74. };
  75. typedef struct
  76. {
  77. DWORD token;
  78. UINT_PTR value;
  79. } TOKENPAIR, * PTOKENPAIR, TokenPairType;
  80. typedef struct ParamTypeTag
  81. {
  82. union
  83. {
  84. struct ListTypeTag *pList;
  85. DWORD token;
  86. DWORD value;
  87. struct KeywordTypeTag *pListOfKeywords;
  88. LPSTR lpstr;
  89. };
  90. } ParamType;
  91. typedef struct KeywordTypeTag
  92. {
  93. LPSTR lpsz;
  94. DWORD dwAction;
  95. ParamType param;
  96. } KeywordType;
  97. typedef struct ListTypeTag
  98. {
  99. BOOL bFormFeedOK;
  100. DWORD dwNotFoundAction;
  101. DWORD tokenBaseValue;
  102. KeywordType *pListOfKeywords;
  103. } ListType;
  104. typedef struct parseVarsTag
  105. {
  106. LPSTR pInPJL_Local;
  107. DWORD nTokenLeft;
  108. DWORD nTokenInBuffer_Local;
  109. TokenPairType *pToken_Local;
  110. DWORD dwNextToken;
  111. DWORD dwFoundIndex;
  112. DWORD status;
  113. ListType *pCurrentList;
  114. KeywordType *pCurrentKeywords;
  115. ListType *arrayOfLists[MAX_POSSIBLE_LISTS_IN_BRANCH+1];
  116. } ParseVarsType;
  117. extern DWORD GetPJLTokens(LPSTR lpInPJL, DWORD nTokenInBuffer,
  118. TokenPairType *pToken, DWORD *pnTokenParsed, LPSTR *plpInPJL);
  119. typedef struct
  120. {
  121. DWORD pjl;
  122. DWORD status;
  123. } PJLTOPRINTERSTATUS;
  124. extern PJLTOPRINTERSTATUS PJLToStatus[];