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.

1321 lines
37 KiB

  1. /*++
  2. Copyright (c) 1994-2003 Microsoft Corporation
  3. Module Name:
  4. PARSEPJL.C
  5. Abstract:
  6. Handles parsing of PJL printer response streams into token\value pairs.
  7. --*/
  8. /*
  9. Currently returns tokens for (see enum in parsepjl.h for token values):
  10. @PJL ECHO MSSYNC # ->#
  11. @PJL INFO MEMORY
  12. TOTAL=# ->#
  13. LARGEST=# ->#
  14. @PJL INFO STATUS
  15. CODE=# ->#
  16. DISPLAY=# (not returned)
  17. ONLINE=TRUE (or FALSE) -> 1 or 0 returned
  18. @PJL INQUIRE INTRAY?SIZE (? is 1,2,3 or 4)
  19. LEGAL(or other PJL paper size) ->constant from DM... list in PRINT.H
  20. @PJL INFO CONFIG
  21. MEMORY=# ->#
  22. @PJL USTATUS JOB
  23. END -> returns token with zero for value
  24. @PJL USTATUS JOB
  25. NAME="MSJOB #" ->#
  26. added
  27. @PJL USTATUS DEVICE
  28. CODE=# ->#
  29. DISPLAY=# (not returned)
  30. ONLINE=TRUE (or FALSE) -> 1 or 0 returned
  31. */
  32. #include "precomp.h"
  33. #define FF 12
  34. #define CR 13
  35. #define LF 10
  36. #define TAB 9
  37. #define SPACE 32
  38. #define OK_IF_FF_FOUND TRUE
  39. #define ERROR_IF_FF_FOUND FALSE
  40. #define TOKEN_BASE_NOT_USED 0
  41. #define ACTION_NOT_USED 0
  42. #define PARAM_NOT_USED 0
  43. /* returned as value for TOKEN_USTATUS_JOB_END */
  44. #define VALUE_RETURED_FOR_VALUELESS_TOKENS 0
  45. extern KeywordType readBackCommandKeywords[];
  46. extern KeywordType infoCatagoryKeywords[];
  47. extern KeywordType inquireVariableKeywords[];
  48. extern KeywordType traySizeKeywords[];
  49. extern KeywordType echoKeywords[];
  50. extern KeywordType infoConfigKeywords[];
  51. extern KeywordType ustatusKeywords[];
  52. extern KeywordType ustatusJobKeywords[];
  53. extern KeywordType ustatusDeviceKeywords[];
  54. /* Fuctions called when a string in keyword is found */
  55. void TokenFromParamValueFromNumberFF
  56. (ParseVarsType *pParseVars, ParamType);
  57. void SetNewList(ParseVarsType *pParseVars,
  58. ParamType);
  59. void GetTotalAndLargestFF(ParseVarsType *pParseVars,ParamType param);
  60. void GetCodeAndOnlineFF(ParseVarsType *pParseVars,ParamType param);
  61. void GetTokenFromIndexSetNewList(ParseVarsType *pParseVars,ParamType param);
  62. void SetValueFromParamFF(ParseVarsType *pParseVars,ParamType param);
  63. void SetValueFromParam(ParseVarsType *pParseVars,ParamType param);
  64. void GetTokenFromIndexValueFromNumberEOLFromParam(ParseVarsType *pParseVars,ParamType param);
  65. void GetTokenFromIndexValueFromBooleanEOL(ParseVarsType *pParseVars,ParamType param);
  66. void GetTokenFromIndexValueFromStringEOL(ParseVarsType *pParseVars,ParamType param);
  67. /* Fuctions called when no string in a keywords list is found */
  68. void ActionNotFoundSkipPastFF(ParseVarsType *pParseVars);
  69. void ActionNotFoundSkipCFLFandIndentedLines(ParseVarsType *pParseVars);
  70. /* Helper Functions */
  71. void StoreToken(ParseVarsType *pParseVars, DWORD dwToken);
  72. BOOL StoreTokenValueAndAdvancePointer
  73. (ParseVarsType *pParseVars, UINT_PTR dwValue);
  74. void ExpectFinalCRLFFF(ParseVarsType *pParseVars);
  75. BOOL SkipPastNextCRLF(ParseVarsType *pParseVars);
  76. int GetPositiveInteger(ParseVarsType *pParseVars);
  77. BOOL AdvancePointerPastString
  78. (ParseVarsType *pParseVars, LPSTR pString);
  79. BOOL SkipOverSpaces(ParseVarsType *pParseVars);
  80. int LookForKeyword(ParseVarsType *pParseVars);
  81. BOOL ExpectString(ParseVarsType *pParseVars, LPSTR pString);
  82. BOOL SkipPastFF(ParseVarsType *pParseVars);
  83. void ExpectFinalFF(ParseVarsType *pParseVars);
  84. /* Helper Strings */
  85. char lpCRLF[] = "\r\n";
  86. char lpQuoteCRLF[] = "\"\r\n";
  87. /*
  88. Below are the Lists that drive the parsing. The main loop of this
  89. parser looks through the keywords in the current list and tries to
  90. match the keyword string to the current input stream.
  91. If a keyword is found then the function corresponding to the Action in
  92. the keyword is called.
  93. If a FF is found in the input stream rather than a keyword, then the
  94. parser returns. The return value is determined using the bFormFeedOk
  95. element of the ListType structure.
  96. If no keyword from the list is found then the function corresponding
  97. to the notFoundAction is called.
  98. The tokenBaseValue element is a number to which the index in the
  99. keyword's list of strings will added to calculate the token number
  100. corresponding to the indexed string.
  101. */
  102. ListType readBackCommandList =
  103. {
  104. ERROR_IF_FF_FOUND,
  105. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  106. TOKEN_BASE_NOT_USED,
  107. readBackCommandKeywords /* INFO, ECHO, INQUIRE ... */
  108. };
  109. ListType infoCatagoryList =
  110. {
  111. ERROR_IF_FF_FOUND,
  112. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  113. TOKEN_BASE_NOT_USED,
  114. infoCatagoryKeywords /* MEMORY STATUS CONFIG ... */
  115. };
  116. ListType infoConfigList =
  117. {
  118. OK_IF_FF_FOUND,
  119. ACTION_IF_NOT_FOUND_SKIP_CFLF_AND_INDENTED_LINES,
  120. PJL_TOKEN_INFO_CONFIG_BASE,
  121. infoConfigKeywords /* MEMORY= ... */
  122. };
  123. ListType inquireVariableList =
  124. {
  125. ERROR_IF_FF_FOUND,
  126. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  127. PJL_TOKEN_INQUIRE_BASE,
  128. inquireVariableKeywords /* INTRAY1SIZE ...*/
  129. };
  130. ListType echoList =
  131. {
  132. OK_IF_FF_FOUND,
  133. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  134. TOKEN_BASE_NOT_USED,
  135. echoKeywords /* MSSYNC ...*/
  136. };
  137. ListType traySizeList =
  138. {
  139. ERROR_IF_FF_FOUND,
  140. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  141. TOKEN_BASE_NOT_USED,
  142. traySizeKeywords /* LEGAL, C5 ...*/
  143. };
  144. ListType ustatusList =
  145. {
  146. OK_IF_FF_FOUND,
  147. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  148. PJL_TOKEN_USTATUS_JOB_BASE,
  149. ustatusKeywords /* JOB ... */
  150. };
  151. ListType ustatusJobList =
  152. {
  153. OK_IF_FF_FOUND,
  154. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  155. PJL_TOKEN_USTATUS_JOB_BASE,
  156. ustatusJobKeywords /* END ... */
  157. };
  158. ListType ustatusDeviceList =
  159. {
  160. OK_IF_FF_FOUND,
  161. ACTION_IF_NOT_FOUND_SKIP_PAST_FF,
  162. PJL_TOKEN_USTATUS_DEVICE_BASE,
  163. ustatusDeviceKeywords /* END ... */
  164. };
  165. /* Command strings that can follow @PJL USTATUS */
  166. KeywordType ustatusKeywords[] =
  167. {
  168. {"JOB\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &ustatusJobList},
  169. {"DEVICE\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &ustatusDeviceList},
  170. // {"DEVICE\r\n", ACTION_GET_CODE_AND_ONLINE_FF, PARAM_NOT_USED},
  171. {"TIMED\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &ustatusDeviceList},
  172. NULL
  173. };
  174. /* Command strings that can follow @PJL USTATUS JOB */
  175. KeywordType ustatusJobKeywords[] =
  176. {
  177. {"END\r\n", ACTION_SET_VALUE_FROM_PARAM, VALUE_RETURED_FOR_VALUELESS_TOKENS},
  178. {"NAME=\"MSJOB ", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_NUMBER_EOL_FROM_PARAM, (struct ListTypeTag *)lpQuoteCRLF},
  179. NULL
  180. };
  181. /* command strings that can follow @PJL USTATUS DEVICE */
  182. KeywordType ustatusDeviceKeywords[] =
  183. {
  184. {"CODE=", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_NUMBER_EOL_FROM_PARAM, (struct ListTypeTag *)lpCRLF},
  185. {"DISPLAY=", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_STRING_EOL, (struct ListTypeTag *)lpCRLF},
  186. {"ONLINE=", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_BOOLEAN_EOL, (struct ListTypeTag *)lpCRLF},
  187. NULL
  188. };
  189. /* Command strings that can follow @PJL */
  190. KeywordType readBackCommandKeywords[] =
  191. {
  192. {"INFO", ACTION_SET_NEW_LIST, &infoCatagoryList},
  193. {"ECHO", ACTION_SET_NEW_LIST, &echoList},
  194. {"INQUIRE", ACTION_SET_NEW_LIST, &inquireVariableList},
  195. {"USTATUS", ACTION_SET_NEW_LIST, &ustatusList},
  196. NULL
  197. };
  198. /* Command strings that can follow @PJL ECHO (Microsoft specific-NOT PJL!) */
  199. KeywordType echoKeywords[] =
  200. {
  201. {"MSSYNC", ACTION_TOKEN_FROM_PARAM_VALUE_FROM_NUMBER_FF,
  202. (struct ListTypeTag *)(INT_PTR)TOKEN_ECHO_MSSYNC_NUMBER},
  203. NULL
  204. };
  205. /* Catagory strings that can follow @PJL INFO */
  206. KeywordType infoCatagoryKeywords[] =
  207. {
  208. {"MEMORY\r\n", ACTION_GET_TOTAL_AND_LARGEST_FF, PARAM_NOT_USED},
  209. {"STATUS\r\n", ACTION_GET_CODE_AND_ONLINE_FF, PARAM_NOT_USED},
  210. {"CONFIG\r\n", ACTION_SET_NEW_LIST, &infoConfigList},
  211. NULL
  212. };
  213. /* Catagory strings that can follow @PJL INFO */
  214. KeywordType infoConfigKeywords[] =
  215. {
  216. {"MEMORY=", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_NUMBER_EOL_FROM_PARAM, (struct ListTypeTag *)lpCRLF},
  217. {"MEMORY = ", ACTION_GET_TOKEN_FROM_INDEX_VALUE_FROM_NUMBER_EOL_FROM_PARAM, (struct ListTypeTag *)lpCRLF},
  218. NULL
  219. };
  220. /* TRUE or FALSE strings */
  221. KeywordType FALSEandTRUEKeywords[] =
  222. {
  223. {"FALSE", ACTION_NOT_USED, PARAM_NOT_USED},
  224. {"TRUE", ACTION_NOT_USED, PARAM_NOT_USED},
  225. NULL
  226. };
  227. /* strings that can follow @PJL INQUIRE */
  228. KeywordType inquireVariableKeywords[] =
  229. {
  230. {"INTRAY1SIZE\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &traySizeList},
  231. {"INTRAY2SIZE\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &traySizeList},
  232. {"INTRAY3SIZE\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &traySizeList},
  233. {"INTRAY4SIZE\r\n", ACTION_TOKEN_FROM_INDEX_SET_NEW_LIST, &traySizeList},
  234. NULL
  235. };
  236. /* strings that can follow @PJL INQUIRE INTRAY?SIZE */
  237. /* the parameters are the Microsoft defined token values for paper size */
  238. KeywordType traySizeKeywords[] =
  239. {
  240. {"LETTER", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_LETTER},
  241. {"LEGAL", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_LEGAL},
  242. {"A4", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_A4},
  243. {"EXECUTIVE", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_EXECUTIVE},
  244. {"COM10", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_ENV_10},
  245. {"MONARCH", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_ENV_MONARCH},
  246. {"C5", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_ENV_C5},
  247. {"DL", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_ENV_DL},
  248. {"B5", ACTION_SET_VALUE_FROM_PARAM_FF, (struct ListTypeTag *)DMPAPER_ENV_B5},
  249. NULL
  250. };
  251. void (*pfnNotFoundActions[])(ParseVarsType *pParseVars) =
  252. {
  253. ActionNotFoundSkipPastFF,
  254. ActionNotFoundSkipCFLFandIndentedLines
  255. };
  256. void (*pfnFoundActions[])(ParseVarsType *pParseVars, ParamType param) =
  257. {
  258. TokenFromParamValueFromNumberFF,
  259. SetNewList,
  260. GetTotalAndLargestFF,
  261. GetCodeAndOnlineFF,
  262. GetTokenFromIndexSetNewList,
  263. SetValueFromParamFF,
  264. GetTokenFromIndexValueFromNumberEOLFromParam,
  265. SetValueFromParam,
  266. GetTokenFromIndexValueFromBooleanEOL,
  267. GetTokenFromIndexValueFromStringEOL
  268. };
  269. PJLTOPRINTERSTATUS PJLToStatus[] =
  270. {
  271. { 10001,0x0 }, // clear status - printer is ready
  272. { 10002,0x0 }, // clear status - check ONLINE=TRUE or FALSE
  273. { 11002,0x0 }, // LJ4 sends this code for 00 READY
  274. { 40022,PORT_STATUS_PAPER_JAM },
  275. { 40034,PORT_STATUS_PAPER_PROBLEM},
  276. { 40079,PORT_STATUS_OFFLINE },
  277. { 40019,PORT_STATUS_OUTPUT_BIN_FULL},
  278. { 10003,PORT_STATUS_WARMING_UP },
  279. { 10006,PORT_STATUS_TONER_LOW },
  280. { 40038,PORT_STATUS_TONER_LOW },
  281. { 30016,PORT_STATUS_OUT_OF_MEMORY},
  282. { 40021,PORT_STATUS_DOOR_OPEN },
  283. { 30078,PORT_STATUS_POWER_SAVE },
  284. //
  285. // Entries added by MuhuntS
  286. //
  287. { 41002, PORT_STATUS_PAPER_PROBLEM}, // Load plain
  288. { 35078, PORT_STATUS_POWER_SAVE},
  289. {0, 0}
  290. };
  291. // @@BEGIN_DDKSPLIT
  292. #if 0
  293. /*
  294. test not enough room for tokens
  295. test no FF
  296. test zero before end
  297. */
  298. main ()
  299. {
  300. char pInString[] = "@PJL USTATUS DEVICE\r\nCODE=25008\r\n\f\
  301. @PJL USTATUS DEVICE\r\n\CODE=20020\r\n\f\
  302. @PJL ECHO MSSYNC 1234567\r\n\f\
  303. @PJL INFO CONFIG\r\n\
  304. IN TRAYS [1 ENUMERATED]\r\n\
  305. \tINTRAY1 PC\r\n\
  306. OUT TRAYS [1 ENUMERATED]\r\n\
  307. \tNORMAL FACEDOWN\r\n\
  308. PAPERS [10 ENUMERATED]\r\n\
  309. \tLETTER\r\n\
  310. \tLEGAL\r\n\
  311. \tA4\r\n\
  312. LANGUAGES [1 ENUMERATED]\r\n\
  313. \tPCL\r\n\
  314. MEMORY=2097152\r\n\
  315. DISPLAY LINES=1\r\n\
  316. DISPLAY CHARACTER SIZE=16\r\n\f\
  317. @PJL INQ";
  318. //char pInString[] = "@PJL USTATUS JOB\r\nEND\r\nNAME=\"MSJOB 3\"\r\nPAGES=3\r\n\f$"; //good command 1 token
  319. //char pInString[] = "@PJL USTATUS JOB\r\nEND\r\nNAME=\"JOB 14993\"\r\nPAGES=3\r\n\f$"; //good command 1 token
  320. /*
  321. char pInString[] = "@PJL INFO CONFIG\r\nINTRAYS [3 ENUMERATED]\r\n\tINTRAY1\
  322. MP\r\n\tINTRAY2 PC\r\n\tINTRAY3 LC\r\nENVELOPE TRAY\r\nMEMORY=2087152\r\n\
  323. DISPLAY LINES=1\r\n\f$"; //good command 1 token
  324. */
  325. //char pInString[] = "@PJL INQUIRE INTRAY3SIZE\r\nC5\r\n\f$"; //good command 1 token
  326. //char pInString[] = "@PJL INFO STATUS\r\nCODE=10001\r\n\DISPLAY=\"00 READY\"\r\nONLINE=TRUE\r\n\f$"; //good command 2 tokens
  327. //char pInString[] = "@PJL INFO MEMORY\r\nTOTAL=9876543\r\n\LARGEST=123456\r\n\f$"; //good command 2 tokens
  328. //char pInString[] = "@PJG INFO MEMORY\r\nTOTAL=9876543\r\n\LARGEST=123456\f$"; //bad command Fail
  329. //char pInString[] = "@PJG ECHO MSSYNC 12T4567\r\n\f$"; //bad command Fail
  330. //char pInString[] = "@PJL ECHO MSSYNC 12T4567\r\n\000\f$"; //bad command Fail
  331. //char pInString[] = "@PJL ECHO MSSYNC 12T4567\r\n\f$"; //bad MS command Fail
  332. //char pInString[] = "@PJL ECHO MSSYNC 1234567\r\n\f$"; //good command Success 1 token
  333. //char pInString[] = "@PJL ECHO 124567\r\n\f$"; //good command Success 0 token
  334. TokenPairType tokenPairs[20];
  335. DWORD nTokenParsedRet;
  336. LPSTR lpRet;
  337. DWORD i;
  338. DWORD status;
  339. status = GetPJLTokens(pInString, 20, tokenPairs, &nTokenParsedRet, &lpRet);
  340. switch (status)
  341. {
  342. case STATUS_REACHED_END_OF_COMMAND_OK:
  343. {
  344. printf("STATUS_REACHED_END_OF_COMMAND_OK\n");
  345. break;
  346. }
  347. case STATUS_CONTINUE:
  348. {
  349. printf("STATUS_CONTINUE\n");
  350. break;
  351. }
  352. case STATUS_REACHED_FF:
  353. {
  354. printf("STATUS_REACHED_FF\n");
  355. break;
  356. }
  357. case STATUS_END_OF_STRING;
  358. {
  359. printf("STATUS_END_OF_STRING\n");
  360. break;
  361. }
  362. case STATUS_SYNTAX_ERROR:
  363. {
  364. printf("STATUS_SYNTAX_ERROR\n");
  365. break;
  366. }
  367. case STATUS_ATPJL_NOT_FOUND:
  368. {
  369. printf("STATUS_ATPJL_NOT_FOUND\n");
  370. break;
  371. }
  372. case STATUS_NOT_ENOUGH_ROOM_FOR_TOKENS:
  373. {
  374. printf("STATUS_NOT_ENOUGH_ROOM_FOR_TOKENS\n");
  375. break;
  376. }
  377. default:
  378. {
  379. printf("INVALID STATUS RETURNED!!!!!!\n");
  380. break;
  381. }
  382. };
  383. printf(" length of command=%d, numberOfTokens=%d\n", lpRet-pInString, nTokenParsedRet);
  384. for (i=0; i<nTokenParsedRet; i++)
  385. {
  386. printf(" Token=0x%x, Value=%d\n", tokenPairs[i].token, tokenPairs[i].value);
  387. }
  388. if (*lpRet==0)
  389. {
  390. printf(" Next char is terminator\n");
  391. }
  392. else
  393. {
  394. printf(" Next char=%c\n", *lpRet);
  395. }
  396. exit(0);
  397. }
  398. #endif
  399. // @@END_DDKSPLIT
  400. /* GetPJLTokens
  401. This function parses a single ASCII PJL command and returns token/value pairs.
  402. Complete PJL commands must begin with '@PJL' and end with a <FF>.
  403. The function result returns one of the following values:
  404. 0 = STATUS_REACHED_END_OF_COMMAND_OK
  405. 1 = STATUS_END_OF_STRING
  406. 2 = STATUS_SYNTAX_ERROR
  407. 3 = STATUS_ATPJL_NOT_FOUND,
  408. 4 = STATUS_NOT_ENOUGH_ROOM_FOR_TOKENS
  409. Also returned through the parameters are:
  410. 1] *plpInPJL:
  411. If STATUS_REACHED_END_OF_COMMAND_OK
  412. will point to the character past the first <FF> (FF = form feed).
  413. If STATUS_END_OF_STRING
  414. will point to the terminator that was found before any <FF>.
  415. Else
  416. undefined
  417. 2] *pnTokenParsed will contain the number of pairs returned in *pToken.
  418. 3] pToken will contain *pnTokenParsed token pairs
  419. If there are characters belonging to another command trailing the first
  420. then the caller should call again for the new command. If only part of
  421. the new command may be present, then the caller may want to copy the
  422. characters of the new command to the beginning of the buffer, and then read
  423. the necessary additional characters onto the end before resubmitting the
  424. complete command to this function for parsing. Note that the *plpInPJL
  425. tells the caller where the next command would begin.
  426. If the end of the string is encountered before the trailing <FF> is found then
  427. the function returns with *plpInPJL pointing to the terminator.
  428. If the caller wants the command parsed into
  429. token\value pairs it should resubmit the string once the characters
  430. which complete the command have been appended.
  431. Operation:
  432. ----------
  433. Lists drive the parsing. The main loop of this
  434. parser looks through the keywords of the current list and tries to
  435. match the keyword string to the current input stream.
  436. If a keyword is found then the function corresponding to the Action in
  437. the keyword is called.
  438. If no keyword from the list is found then the function corresponding
  439. to the notFoundAction is called.
  440. */
  441. DWORD GetPJLTokens(
  442. LPSTR lpInPJL,
  443. DWORD nTokenInBuffer,
  444. TokenPairType *pToken,
  445. DWORD *pnTokenParsed,
  446. LPSTR *plpInPJL
  447. )
  448. {
  449. /* The parseVars variables are put into a structure so that they can be
  450. passed efficiently to all the helper functions.
  451. */
  452. ParseVarsType parseVars;
  453. BOOL bFoundKeyword;
  454. DWORD i, keywordIndex;
  455. KeywordType *pKeyword;
  456. DWORD dwNotFoundAction;
  457. BOOL bNotFoundAction = FALSE;
  458. /* The first list to look for is the commands that can follow
  459. @PJL
  460. */
  461. parseVars.arrayOfLists[0] = &readBackCommandList;
  462. parseVars.arrayOfLists[1] = NULL;
  463. parseVars.pInPJL_Local = lpInPJL;
  464. parseVars.nTokenInBuffer_Local = 0;
  465. parseVars.nTokenLeft = nTokenInBuffer;
  466. parseVars.pToken_Local = pToken;
  467. parseVars.status = STATUS_CONTINUE;
  468. if (!AdvancePointerPastString(&parseVars, "@PJL"))
  469. {
  470. parseVars.status = STATUS_ATPJL_NOT_FOUND;
  471. }
  472. while (parseVars.status == STATUS_CONTINUE)
  473. {
  474. /* Look for next input keyword in currently valid lists.
  475. Sometimes may need to look for the next input keyword in more
  476. then one list.
  477. */
  478. bFoundKeyword = FALSE;
  479. bNotFoundAction = FALSE;
  480. for (i=0; (parseVars.pCurrentList = parseVars.arrayOfLists[i])!=NULL; i++)
  481. {
  482. dwNotFoundAction = parseVars.pCurrentList->dwNotFoundAction;
  483. bNotFoundAction = TRUE;
  484. /* Skip over spaces to start of next keyword string */
  485. if ( !SkipOverSpaces(&parseVars) )
  486. {
  487. /* Either the input stream has ended or FF was found */
  488. if (parseVars.status == STATUS_REACHED_FF)
  489. {
  490. /* Finding a FF here may or may not be an error,
  491. the field in the current list tells us which
  492. */
  493. if ( parseVars.pCurrentList->bFormFeedOK )
  494. {
  495. parseVars.status = STATUS_REACHED_END_OF_COMMAND_OK;
  496. }
  497. else
  498. {
  499. parseVars.status = STATUS_SYNTAX_ERROR;
  500. }
  501. }
  502. break;
  503. }
  504. /* Look for keyword in current keywords */
  505. parseVars.pCurrentKeywords = parseVars.pCurrentList->pListOfKeywords;
  506. keywordIndex = LookForKeyword(&parseVars);
  507. if ( keywordIndex!=-1 )
  508. {
  509. bFoundKeyword = TRUE;
  510. break;
  511. }
  512. }
  513. if ( parseVars.status!=STATUS_CONTINUE )
  514. {
  515. /* We are finished processing commands */
  516. break;
  517. }
  518. if ( bFoundKeyword )
  519. /* do action from keyword */
  520. {
  521. pKeyword = &parseVars.pCurrentKeywords[keywordIndex];
  522. (*pfnFoundActions[pKeyword->dwAction])(&parseVars, pKeyword->param);
  523. }
  524. else if (bNotFoundAction)
  525. /* An action was not found, call the not found routine */
  526. {
  527. (*pfnNotFoundActions[dwNotFoundAction])(&parseVars);
  528. }
  529. }
  530. /* We are done parsing the input command, now we return the information */
  531. DBGMSG(DBG_TRACE, ("ParseVars.status = %d\n", parseVars.status));
  532. /* Fill in returned values and return with success */
  533. *pnTokenParsed = parseVars.nTokenInBuffer_Local;
  534. *plpInPJL = parseVars.pInPJL_Local;
  535. return(parseVars.status);
  536. }
  537. /*
  538. int LookForKeyword(ParseVarsType *pParseVars)
  539. This function looks through the current keyword list in search of a
  540. keyword that matches the characters in the input stream pointed to
  541. by pParseVars->pInPJL_Local.
  542. If a match is found:
  543. The index of the match in the pKeyword is returned.
  544. pParseVars->pInPJL_Local is advanced past the last matching character.
  545. pParseVars->dwKeywordIndex is set to item number in list
  546. If no match is found:
  547. The return value is -1.
  548. pParseVars->pInPJL_Local is unchanged.
  549. */
  550. int LookForKeyword(ParseVarsType *pParseVars)
  551. {
  552. LPSTR pInStart = pParseVars->pInPJL_Local;
  553. LPSTR pIn;
  554. DWORD dwKeywordIndex = 0;
  555. BOOL bFoundMatch = FALSE;
  556. BYTE c;
  557. KeywordType *pKeywords = pParseVars->pCurrentKeywords;
  558. LPSTR pKeywordString;
  559. while ( (pKeywordString=pKeywords[dwKeywordIndex++].lpsz)!=NULL )
  560. {
  561. DBGMSG(DBG_TRACE, ("LookForIn=%hs\n", pInStart));
  562. DBGMSG(DBG_TRACE, ("Keyword=%hs\n", pKeywordString));
  563. pIn = pInStart;
  564. while ( (c=*pKeywordString++)!=0 )
  565. {
  566. if ( c!=*pIn++ )
  567. {
  568. break;
  569. }
  570. }
  571. if ( c==0 )
  572. {
  573. bFoundMatch = TRUE;
  574. pParseVars->pInPJL_Local = pIn;
  575. pParseVars->dwFoundIndex = dwKeywordIndex-1;
  576. break;
  577. }
  578. }
  579. DBGMSG(DBG_TRACE, ("LookForOut=%hs\n", pParseVars->pInPJL_Local));
  580. return( (bFoundMatch)?dwKeywordIndex-1:-1 );
  581. }
  582. /*
  583. BOOL AdvancePointerPastString(ParseVarsType *pParseVars, LPSTR pString)
  584. This function looks through the input stream for a match with pString.
  585. If a match is found:
  586. pParseVars->pInPJL_Local is set to point just past the string.
  587. the return value is TRUE
  588. (pParseVars->status is unchanged)
  589. If the end of input is encountered before the string is found then
  590. pParseVars->pInPJL_Local is set to point to the terminating 0.
  591. the return value is FALSE
  592. pParseVars->status is set to STATUS_END_OF_STRING
  593. If an FF is encountered before the string is found then
  594. pParseVars->pInPJL_Local is set to point just past the FF.
  595. the return value is FALSE
  596. pParseVars->status is set to STATUS_REACHED_FF
  597. */
  598. BOOL AdvancePointerPastString(ParseVarsType *pParseVars, LPSTR pString)
  599. {
  600. LPSTR pIn = pParseVars->pInPJL_Local;
  601. LPSTR pS = pString;
  602. BYTE s, in;
  603. while ( ((s=*pS) != 0) && ((in=*pIn)!=0) && (in!=FF) )
  604. {
  605. if ( s==in )
  606. {
  607. pS++; /* point to next char in string to look for match */
  608. }
  609. else
  610. {
  611. pS = pString; /* start over looking for start of string */
  612. }
  613. pIn++;
  614. }
  615. if ( s==0 )
  616. {
  617. /* The whole string matched */
  618. /* point to character after string in input */
  619. pParseVars->pInPJL_Local = pIn;
  620. return(TRUE);
  621. }
  622. if ( in==FF )
  623. {
  624. pParseVars->status = STATUS_REACHED_FF;
  625. pParseVars->pInPJL_Local = pIn+1;
  626. }
  627. else
  628. {
  629. pParseVars->status = STATUS_END_OF_STRING;
  630. pParseVars->pInPJL_Local = pIn;
  631. }
  632. return(FALSE);
  633. }
  634. /*
  635. BOOL SkipOverSpaces(ParseVarsType &parseVars)
  636. This function skips over spaces in the input stream until a non-space
  637. character (FF and NULL are special cases) is found.
  638. If a non-space character is found then
  639. pParseVars->pInPJL_Local is set to point to the first non-space char.
  640. the return value is TRUE
  641. (pParseVars->status is unchanged)
  642. If the end of input is encountered before a non-space char is found then
  643. the return value is FALSE
  644. pParseVars->status is set to STATUS_END_OF_STRING_ENCOUNTERED
  645. pParseVars->pInPJL_Local is set to point to the terminating 0.
  646. If an FF is encountered before a non-space character is found then
  647. the return value is FALSE
  648. pParseVars->status is set to STATUS_REACHED_FF
  649. pParseVars->pInPJL_Local is set to point just past the FF.
  650. */
  651. BOOL SkipOverSpaces(ParseVarsType *pParseVars)
  652. {
  653. LPSTR pIn = pParseVars->pInPJL_Local;
  654. BYTE in;
  655. while ( ((in=*pIn)==SPACE)&&(in!=0)&&(in!=FF) )
  656. {
  657. pIn++;
  658. }
  659. switch (in)
  660. {
  661. case FF:
  662. {
  663. pParseVars->status = STATUS_REACHED_FF;
  664. pParseVars->pInPJL_Local = pIn+1;
  665. return(FALSE);
  666. }
  667. case 0:
  668. {
  669. pParseVars->status = STATUS_END_OF_STRING;
  670. pParseVars->pInPJL_Local = pIn;
  671. return(FALSE);
  672. }
  673. default:
  674. {
  675. /* point to character after string in input */
  676. pParseVars->pInPJL_Local = pIn;
  677. return(TRUE);
  678. }
  679. }
  680. }
  681. void TokenFromParamValueFromNumberFF(
  682. ParseVarsType *pParseVars,ParamType param)
  683. {
  684. int value;
  685. StoreToken(pParseVars, param.token);
  686. if ( (value=GetPositiveInteger(pParseVars))==-1 )
  687. {
  688. /* Not a valid number - status set by GetPositiveInteger() */
  689. return;
  690. }
  691. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  692. {
  693. return;
  694. }
  695. ExpectFinalCRLFFF(pParseVars);
  696. return;
  697. }
  698. void ActionNotFoundSkipPastFF(ParseVarsType *pParseVars)
  699. {
  700. if ( SkipPastFF(pParseVars) )
  701. {
  702. pParseVars->status = STATUS_REACHED_END_OF_COMMAND_OK;
  703. }
  704. return;
  705. }
  706. /*
  707. BOOL SkipPastFF(ParseVarsType *pParseVars)
  708. This function skips over all characters until either a zero is found or
  709. FF is found.
  710. If the end of input is encountered before an FF char is found then
  711. the return value is FALSE
  712. pParseVars->status is set to STATUS_END_OF_STRING_ENCOUNTERED
  713. pParseVars->pInPJL_Local is set to point to the terminating 0.
  714. If an FF is encountered
  715. the return value is TRUE
  716. pParseVars->status is set to STATUS_REACHED_FF
  717. pParseVars->pInPJL_Local is set to point just past the FF.
  718. */
  719. BOOL SkipPastFF(ParseVarsType *pParseVars)
  720. {
  721. LPSTR pIn = pParseVars->pInPJL_Local;
  722. BYTE in;
  723. while ( ((in=*pIn)!=FF)&&(in!=0) )
  724. {
  725. pIn++;
  726. }
  727. if ( in==0 )
  728. {
  729. pParseVars->status = STATUS_END_OF_STRING;
  730. pParseVars->pInPJL_Local = pIn;
  731. return(FALSE);
  732. }
  733. pParseVars->pInPJL_Local = pIn+1;
  734. pParseVars->status = STATUS_REACHED_FF;
  735. return(TRUE);
  736. }
  737. void ExpectFinalCRLFFF(ParseVarsType *pParseVars)
  738. {
  739. char c;
  740. if ( pParseVars->status==STATUS_CONTINUE )
  741. {
  742. c=*pParseVars->pInPJL_Local;
  743. if ( c==0 )
  744. {
  745. pParseVars->status = STATUS_END_OF_STRING;
  746. return;
  747. }
  748. if ( !AdvancePointerPastString(pParseVars, lpCRLF) )
  749. {
  750. if ( pParseVars->status==STATUS_REACHED_FF )
  751. {
  752. pParseVars->status = STATUS_SYNTAX_ERROR;
  753. }
  754. return;
  755. }
  756. ExpectFinalFF(pParseVars);
  757. }
  758. return;
  759. }
  760. void ExpectFinalFF(ParseVarsType *pParseVars)
  761. {
  762. if ( pParseVars->status==STATUS_CONTINUE )
  763. {
  764. if ( *pParseVars->pInPJL_Local==FF )
  765. {
  766. pParseVars->status = STATUS_REACHED_END_OF_COMMAND_OK;
  767. pParseVars->pInPJL_Local++;
  768. }
  769. else
  770. {
  771. if ( *pParseVars->pInPJL_Local==0 )
  772. {
  773. pParseVars->status = STATUS_END_OF_STRING;
  774. }
  775. else
  776. {
  777. pParseVars->status = STATUS_SYNTAX_ERROR;
  778. }
  779. }
  780. }
  781. return;
  782. }
  783. /*
  784. int GetPositiveInteger(ParseVarsType *pParseVars)
  785. This function skips spaces and then interprets all the digits in input stream
  786. as a positive integer.
  787. If digits follow any spaces and they are not terminated by a zero then
  788. the return value is the positive integer.
  789. If the first character following spaces in not a digit or the end of
  790. string is encountered then
  791. -1 is returned as the value
  792. pParseVars->status is set to STATUS_SYNTAX_ERROR
  793. Note: does not check for overflow
  794. */
  795. int GetPositiveInteger(ParseVarsType *pParseVars)
  796. {
  797. int value;
  798. LPSTR pIn;
  799. BYTE c;
  800. if ( !SkipOverSpaces(pParseVars) )
  801. {
  802. if ( pParseVars->status == STATUS_REACHED_FF )
  803. {
  804. pParseVars->status = STATUS_SYNTAX_ERROR;
  805. }
  806. return(-1);
  807. }
  808. pIn = pParseVars->pInPJL_Local;
  809. for ( value=0; ((c=*pIn++)>='0')&&(c<='9'); value=value*10+(c-'0') );
  810. if ( (c==0)||(pIn==pParseVars->pInPJL_Local+1) )
  811. {
  812. /* either end of string encountered or no digits found */
  813. if ( c==0 )
  814. {
  815. pParseVars->status = STATUS_END_OF_STRING;
  816. }
  817. else
  818. {
  819. pParseVars->status = STATUS_SYNTAX_ERROR;
  820. }
  821. pParseVars->pInPJL_Local = pIn-1;
  822. return(-1);
  823. }
  824. pParseVars->pInPJL_Local = pIn-1;
  825. return(value);
  826. }
  827. void SetNewList(ParseVarsType *pParseVars, ParamType param)
  828. {
  829. pParseVars->arrayOfLists[0] = param.pList;
  830. pParseVars->arrayOfLists[1] = NULL;
  831. return;
  832. }
  833. void StoreToken(ParseVarsType *pParseVars, DWORD dwToken)
  834. {
  835. pParseVars->dwNextToken = dwToken;
  836. return;
  837. }
  838. BOOL StoreTokenValueAndAdvancePointer(ParseVarsType *pParseVars, UINT_PTR dwValue)
  839. {
  840. if ( pParseVars->nTokenLeft==0 )
  841. {
  842. pParseVars->status = STATUS_NOT_ENOUGH_ROOM_FOR_TOKENS;
  843. return(FALSE);
  844. }
  845. pParseVars->pToken_Local->token = pParseVars->dwNextToken;
  846. pParseVars->pToken_Local->value = dwValue;
  847. pParseVars->pToken_Local++;
  848. pParseVars->nTokenInBuffer_Local++;
  849. pParseVars->nTokenLeft--;
  850. return(TRUE);
  851. }
  852. void GetTotalAndLargestFF(ParseVarsType *pParseVars, ParamType param)
  853. {
  854. int value;
  855. param; /* to eliminate not used warning */
  856. if ( !ExpectString(pParseVars, "TOTAL=") )
  857. {
  858. return;
  859. }
  860. StoreToken(pParseVars, TOKEN_INFO_MEMORY_TOTAL);
  861. if ( (value=GetPositiveInteger(pParseVars))==-1 )
  862. {
  863. /* Not a valid number - status set by GetPositiveInteger() */
  864. return;
  865. }
  866. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  867. {
  868. return;
  869. }
  870. if ( !ExpectString(pParseVars, "\r\nLARGEST=") )
  871. {
  872. return;
  873. }
  874. StoreToken(pParseVars, TOKEN_INFO_MEMORY_LARGEST);
  875. if ( (value=GetPositiveInteger(pParseVars))==-1 )
  876. {
  877. /* Not a valid number - status set by GetPositiveInteger() */
  878. return;
  879. }
  880. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  881. {
  882. return;
  883. }
  884. ExpectFinalCRLFFF(pParseVars);
  885. return;
  886. }
  887. void GetCodeAndOnlineFF(ParseVarsType *pParseVars, ParamType param)
  888. {
  889. int value;
  890. param; /* to eliminate not used warning */
  891. if ( !ExpectString(pParseVars,"CODE=") )
  892. {
  893. return;
  894. }
  895. StoreToken(pParseVars, TOKEN_INFO_STATUS_CODE);
  896. if ( (value=GetPositiveInteger(pParseVars))==-1 )
  897. {
  898. /* Not a valid number - status set by GetPositiveInteger() */
  899. return;
  900. }
  901. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  902. {
  903. return;
  904. }
  905. if ( !ExpectString(pParseVars, "\r\nDISPLAY=") )
  906. {
  907. return;
  908. }
  909. if ( !SkipPastNextCRLF(pParseVars) )
  910. {
  911. return;
  912. }
  913. if ( !ExpectString(pParseVars, "ONLINE=") )
  914. {
  915. return;
  916. }
  917. StoreToken(pParseVars, TOKEN_INFO_STATUS_ONLINE);
  918. pParseVars->pCurrentKeywords = FALSEandTRUEKeywords;
  919. if ( (value=LookForKeyword(pParseVars))==-1 )
  920. {
  921. /* Not TRUE or FALSE */
  922. pParseVars->status = STATUS_SYNTAX_ERROR;
  923. return;
  924. }
  925. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  926. {
  927. return;
  928. }
  929. ExpectFinalCRLFFF(pParseVars);
  930. return;
  931. }
  932. /*
  933. BOOL ExpectString(ParseVarsType *pParseVars, LPSTR pString)
  934. This function looks for a match of the current stream
  935. position with pString.
  936. If a match is found:
  937. pParseVars->pInPJL_Local is set to point just past the string.
  938. the return value is TRUE
  939. (pParseVars->status is unchanged)
  940. If the end of input is encountered before the string is found then
  941. pParseVars->pInPJL_Local is set to point to the terminating 0.
  942. the return value is FALSE
  943. pParseVars->status is set to STATUS_END_OF_STRING
  944. If an FF is encountered before the string is found then
  945. pParseVars->pInPJL_Local is set to point just past the FF.
  946. the return value is FALSE
  947. pParseVars->status is set to STATUS_SYNTAX_ERROR
  948. */
  949. BOOL ExpectString(ParseVarsType *pParseVars, LPSTR pString)
  950. {
  951. LPSTR pIn = pParseVars->pInPJL_Local;
  952. LPSTR pS = pString;
  953. BYTE s, in;
  954. while ( ((s=*pS) != 0) && ((in=*pIn)!=0) && (in!=FF) && (s==in) )
  955. {
  956. pS++;
  957. pIn++;
  958. }
  959. if ( s==0 )
  960. {
  961. /* The whole string matched */
  962. /* point to character after string in input */
  963. pParseVars->pInPJL_Local = pIn;
  964. return(TRUE);
  965. }
  966. pParseVars->status = ( in!=0 )?
  967. STATUS_SYNTAX_ERROR:STATUS_END_OF_STRING;
  968. pParseVars->pInPJL_Local = pIn;
  969. return(FALSE);
  970. }
  971. /*
  972. BOOL SkipPastNextCRLF(ParseVarsType *pParseVars)
  973. This function positions the stream pointer past the next
  974. CRLF.
  975. If a CRLF is found:
  976. pParseVars->pInPJL_Local is set to point just past the CRLF.
  977. the return value is TRUE
  978. (pParseVars->status is unchanged)
  979. If the end of input is encountered before the CRLF is found then
  980. pParseVars->pInPJL_Local is set to point to the terminating 0.
  981. the return value is FALSE
  982. pParseVars->status is set to STATUS_END_OF_STRING
  983. If an FF is encountered before the CRLF is found then
  984. the return value is FALSE
  985. pParseVars->status is set to STATUS_SYNTAX_ERROR
  986. */
  987. BOOL SkipPastNextCRLF(ParseVarsType *pParseVars)
  988. {
  989. if ( !AdvancePointerPastString(pParseVars, "\r\n") )
  990. {
  991. if ( pParseVars->status == STATUS_REACHED_FF)
  992. {
  993. pParseVars->status = STATUS_SYNTAX_ERROR;
  994. }
  995. return(FALSE);
  996. }
  997. return(TRUE);
  998. }
  999. void GetTokenFromIndexSetNewList(ParseVarsType *pParseVars, ParamType param)
  1000. {
  1001. StoreToken(pParseVars,
  1002. pParseVars->pCurrentList->tokenBaseValue+pParseVars->dwFoundIndex);
  1003. SetNewList(pParseVars, param);
  1004. return;
  1005. }
  1006. void SetValueFromParamFF(ParseVarsType *pParseVars, ParamType param)
  1007. {
  1008. if ( !StoreTokenValueAndAdvancePointer(pParseVars, param.value) )
  1009. {
  1010. return;
  1011. }
  1012. ExpectFinalCRLFFF(pParseVars);
  1013. return;
  1014. }
  1015. void SetValueFromParam(ParseVarsType *pParseVars, ParamType param)
  1016. {
  1017. if ( !StoreTokenValueAndAdvancePointer(pParseVars, param.value) )
  1018. {
  1019. return;
  1020. }
  1021. return;
  1022. }
  1023. void ActionNotFoundSkipCFLFandIndentedLines(ParseVarsType *pParseVars)
  1024. {
  1025. DBGMSG(DBG_TRACE, ("ActionNotFoundSkipCRLF In=%hs\n", pParseVars->pInPJL_Local));
  1026. do
  1027. {
  1028. if ( !SkipPastNextCRLF(pParseVars) )
  1029. {
  1030. DBGMSG(DBG_TRACE, ("ActionNotFoundSkipCRLF error skipping\n"));
  1031. return;
  1032. }
  1033. } while (*pParseVars->pInPJL_Local==TAB);
  1034. DBGMSG(DBG_TRACE, ("ActionNotFoundSkipCRLF Out=%hs\n", pParseVars->pInPJL_Local));
  1035. return;
  1036. }
  1037. void GetTokenFromIndexValueFromNumberEOLFromParam
  1038. (ParseVarsType *pParseVars,ParamType param)
  1039. {
  1040. int value;
  1041. param; /* to eliminate not used warning */
  1042. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromNumberIn=%hs\n", pParseVars->pInPJL_Local));
  1043. StoreToken(pParseVars,
  1044. pParseVars->pCurrentList->tokenBaseValue+pParseVars->dwFoundIndex);
  1045. if ( (value=GetPositiveInteger(pParseVars))==-1 )
  1046. {
  1047. /* Not a valid number - status set by GetPositiveInteger() */
  1048. DBGMSG(DBG_TRACE, ("error getting number\n"));
  1049. return;
  1050. }
  1051. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  1052. {
  1053. DBGMSG(DBG_TRACE, ("error storing value\n"));
  1054. return;
  1055. }
  1056. if ( !ExpectString(pParseVars, param.lpstr) )
  1057. {
  1058. return;
  1059. }
  1060. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromNumberOut=%hs\n", pParseVars->pInPJL_Local));
  1061. return;
  1062. }
  1063. void GetTokenFromIndexValueFromBooleanEOL
  1064. (ParseVarsType *pParseVars,ParamType param)
  1065. {
  1066. int value;
  1067. param; /* to eliminate not used warning */
  1068. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromBooleanEOLin=%hs\n", pParseVars->pInPJL_Local));
  1069. StoreToken(pParseVars,
  1070. pParseVars->pCurrentList->tokenBaseValue+pParseVars->dwFoundIndex);
  1071. pParseVars->pCurrentKeywords = FALSEandTRUEKeywords;
  1072. if ( (value=LookForKeyword(pParseVars))==-1 )
  1073. {
  1074. /* Not TRUE or FALSE */
  1075. pParseVars->status = STATUS_SYNTAX_ERROR;
  1076. return;
  1077. }
  1078. if ( !StoreTokenValueAndAdvancePointer(pParseVars, value) )
  1079. {
  1080. return;
  1081. }
  1082. if ( !ExpectString(pParseVars, param.lpstr) )
  1083. {
  1084. return;
  1085. }
  1086. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromBooleanEOLout=%hs\n", pParseVars->pInPJL_Local));
  1087. return;
  1088. }
  1089. void GetTokenFromIndexValueFromStringEOL
  1090. (ParseVarsType *pParseVars,ParamType param)
  1091. {
  1092. param; /* to eliminate not used warning */
  1093. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromStringEOLin=%hs\n", pParseVars->pInPJL_Local));
  1094. StoreToken(pParseVars,
  1095. pParseVars->pCurrentList->tokenBaseValue+pParseVars->dwFoundIndex);
  1096. if ( !StoreTokenValueAndAdvancePointer(pParseVars, (UINT_PTR)pParseVars->pInPJL_Local))
  1097. {
  1098. return;
  1099. }
  1100. SkipPastNextCRLF(pParseVars);
  1101. DBGMSG(DBG_TRACE, ("GetTokenFromIndexValueFromStringEOLout=%hs\n", pParseVars->pInPJL_Local));
  1102. return;
  1103. }