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.

86 lines
2.0 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994.
  5. //
  6. // File: bm_parse.hxx
  7. //
  8. // Contents: Base class for generic parsers
  9. //
  10. // Classes: CParserBase
  11. // CTimerBase
  12. //
  13. // Functions:
  14. //
  15. // History: 16-June-94 t-vadims Created
  16. //
  17. // Notes: To use, derive 2 new classes, one from each base, and
  18. // define all functions that are pure virtual in the base.
  19. //
  20. //--------------------------------------------------------------------------
  21. #ifndef _BM_PARSE_HXX_
  22. #define _BM_PARSE_HXX_
  23. #include <bm_base.hxx>
  24. #define FIRST_INTERNALID 0xffffff00
  25. #define INVALID_INSTRUCTION FIRST_INTERNALID
  26. #define NOT_INSTRUCTION (FIRST_INTERNALID + 1)
  27. class CParserBase
  28. {
  29. public:
  30. virtual SCODE Setup (CTestInput *input) = 0;
  31. virtual SCODE Cleanup () = 0;
  32. virtual ULONG ParseNewInstruction(LPTSTR pszNewLine) = 0;
  33. virtual ULONG ExecuteInstruction(ULONG ulInstrID) = 0;
  34. virtual TCHAR* InstructionName(ULONG ulInstrID) = 0;
  35. };
  36. struct SInstruction; // forward declaration
  37. class CTimerBase : public CTestBase
  38. {
  39. public:
  40. virtual SCODE SetParserObject () = 0;
  41. virtual SCODE DeleteParserObject () = 0;
  42. virtual TCHAR *Name () = 0;
  43. virtual TCHAR* SectionHeader() = 0;
  44. SCODE Setup (CTestInput *pInput);
  45. SCODE Run ();
  46. SCODE Report (CTestOutput &OutputFile);
  47. SCODE Cleanup ();
  48. protected:
  49. CParserBase *m_pParser;
  50. private:
  51. SCODE ReadFile ();
  52. SCODE ExecuteFile ();
  53. SCODE GetNextLine (LPTSTR);
  54. SInstruction* AddNewInstruction(SInstruction *pTail, ULONG ulID);
  55. BOOL IsInternalID (ULONG ulID);
  56. BOOL IsEmptyLine (LPTSTR);
  57. ULONG m_iIterations; // number of iterations to be performed
  58. ULONG m_iLine; // line count
  59. FILE *m_fpIn; // Script file
  60. SInstruction *m_pHead; // Linked list of instructions
  61. };
  62. #endif