Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.4 KiB

  1. /*** token.h - Token definitions
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created: 09/04/96
  6. *
  7. * This file contains the implementation constants,
  8. * imported/exported data types, exported function
  9. * prototypes of the token.c module.
  10. *
  11. * MODIFICATIONS
  12. */
  13. #ifndef _TOKEN_H
  14. #define _TOKEN_H
  15. /*** Constants
  16. */
  17. // GetToken return values
  18. // return value is the token type if it is positive
  19. // return value is the error number if it is negative
  20. // Error values (negative)
  21. #define TOKERR_NONE 0
  22. #define TOKERR_EOF (TOKERR_BASE - 0)
  23. #define TOKERR_NO_MATCH (TOKERR_BASE - 1)
  24. #define TOKERR_ASSERT_FAILED (TOKERR_BASE - 2)
  25. // TOKERR_LANG must always be the last TOKERR from the above list
  26. #define TOKERR_LANG TOKERR_ASSERT_FAILED
  27. // Token type
  28. #define TOKTYPE_NULL 0
  29. #define TOKTYPE_LANG TOKTYPE_NULL
  30. // Identifier token types
  31. #define ID_USER -1 //user identifier
  32. #define ID_LANG 0 //language specific ID base
  33. //Token flags values
  34. #define TOKF_NOIGNORESPACE 0x0001
  35. #define TOKF_CACHED 0x8000
  36. //Match token flags
  37. #define MTF_NOT_ERR 0x00000001
  38. #define MTF_ANY_VALUE 0x00000002
  39. /*** Exported data types
  40. */
  41. #define MAX_TOKEN_LEN 255
  42. typedef struct token_s TOKEN;
  43. typedef TOKEN *PTOKEN;
  44. typedef int (LOCAL *PFNTOKEN)(int, PTOKEN);
  45. struct token_s
  46. {
  47. PLINE pline;
  48. PFNTOKEN *papfnToken;
  49. WORD wfToken;
  50. int iTokenType;
  51. LONGLONG llTokenValue;
  52. WORD wTokenLine;
  53. WORD wTokenPos;
  54. WORD wErrLine;
  55. WORD wErrPos;
  56. WORD wTokenLen;
  57. char szToken[MAX_TOKEN_LEN + 1];
  58. #ifdef TUNE
  59. WORD *pawcTokenType;
  60. #endif
  61. };
  62. /*** Imported data types
  63. */
  64. /*** Exported function prototypes
  65. */
  66. #ifdef TUNE
  67. PTOKEN EXPORT OpenToken(FILE *pfileSrc, PFNTOKEN *apfnToken,
  68. WORD *pawcTokenType);
  69. #else
  70. PTOKEN EXPORT OpenToken(FILE *pfileSrc, PFNTOKEN *apfnToken);
  71. #endif
  72. VOID EXPORT CloseToken(PTOKEN ptoken);
  73. int EXPORT GetToken(PTOKEN ptoken);
  74. int EXPORT UnGetToken(PTOKEN ptoken);
  75. int EXPORT MatchToken(PTOKEN ptoken, int iTokenType, LONG lTokenValue,
  76. DWORD dwfMatch, PSZ pszErrMsg);
  77. VOID EXPORT PrintTokenErr(PTOKEN ptoken, PSZ pszErrMsg, BOOL fErr);
  78. #endif //ifndef _TOKEN_H