Team Fortress 2 Source Code as on 22/4/2020
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.

128 lines
3.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #if !defined( CODEPROCESSOR_H )
  8. #define CODEPROCESSOR_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "class.h"
  13. #include "icodeprocessor.h"
  14. #include "utldict.h"
  15. class CCodeProcessor : public ICodeProcessor
  16. {
  17. public:
  18. CCodeProcessor( void );
  19. ~CCodeProcessor( void );
  20. void Process( const char *baseentityclass, const char *gamespecific, const char *sourcetreebase, const char *subdir );
  21. void Process( const char *baseentityclass, const char *gamespecific, const char *sourcetreebase, const char *subdir, const char *pFileName );
  22. CClass *AddClass( const char *classname );
  23. void SetQuiet( bool quiet );
  24. bool GetQuiet( void ) const;
  25. void SetPrintHierarchy( bool print );
  26. bool GetPrintHierarchy( void ) const;
  27. void SetPrintMembers( bool print );
  28. bool GetPrintMembers( void ) const;
  29. void SetPrintTDs( bool print );
  30. bool GetPrintTDs( void ) const;
  31. void SetPrintPredTDs( bool print );
  32. bool GetPrintPredTDs( void ) const;
  33. void SetPrintCreateMissingTDs( bool print );
  34. bool GetPrintCreateMissingTDs( void ) const;
  35. void SetPrintCreateMissingPredTDs( bool print );
  36. bool GetPrintCreateMissingPredTDs( void ) const;
  37. void SetLogFile( bool log );
  38. bool GetLogFile( void ) const;
  39. void SetCheckHungarian( bool check );
  40. bool GetCheckHungarian() const;
  41. CClass *FindClass( const char *name ) const;
  42. void ResolveBaseClasses( const char *baseentityclass );
  43. void Clear( void );
  44. void PrintClassList( void ) const;
  45. void PrintMissingTDFields( void ) const;
  46. void ReportHungarianNotationErrors();
  47. int Count( void ) const;
  48. void SortClassList( void );
  49. private:
  50. char *ParseTypeDescription( char *current, bool fIsMacroized );
  51. char *ParsePredictionTypeDescription( char *current );
  52. char *ParseReceiveTable( char *current );
  53. void ProcessModule( bool forcequiet, int depth, int& maxdepth, int& numheaders, int& skippedfiles,
  54. const char *srcroot, const char *baseroot, const char *root, const char *module );
  55. void ProcessModules( const char *srcroot, const char *root, const char *rootmodule );
  56. void PrintResults( const char *baseentityclass );
  57. void ConstructModuleList_R( int level, const char *baseentityclass, const char *gamespecific, const char *root, char const *srcroot );
  58. void AddHeader( int depth, const char *filename, const char *rootmodule );
  59. bool CheckShouldSkip( bool forcequiet, int depth, char const *filename, int& numheaders, int& skippedfiles);
  60. bool LoadFile( char **buffer, char *filename, char const *module, bool forcequiet,
  61. int depth, int& filelength, int& numheaders, int& skippedfiles,
  62. char const *srcroot, char const *root, char const *baseroot );
  63. // include file path
  64. void CleanupIncludePath();
  65. void AddIncludePath( const char *pPath );
  66. void SetupIncludePath( const char *sourcetreebase, const char *subdir, const char *gamespecific );
  67. CClass *m_pClassList;
  68. typedef struct
  69. {
  70. bool skipped;
  71. } CODE_MODULE;
  72. CUtlDict< CODE_MODULE, int > m_Modules;
  73. CUtlDict< CODE_MODULE, int > m_Headers;
  74. CUtlVector< char * > m_IncludePath;
  75. bool m_bQuiet;
  76. bool m_bPrintHierarchy;
  77. bool m_bPrintMembers;
  78. bool m_bPrintTypedescriptionErrors;
  79. bool m_bPrintPredictionDescErrors;
  80. bool m_bCreateMissingTDs;
  81. bool m_bCreateMissingPredTDs;
  82. bool m_bLogToFile;
  83. bool m_bCheckHungarian;
  84. int m_nFilesProcessed;
  85. int m_nHeadersProcessed;
  86. int m_nClassesParsed;
  87. int m_nOffset;
  88. int m_nBytesProcessed;
  89. int m_nLinesOfCode;
  90. double m_flStart;
  91. double m_flEnd;
  92. char m_szCurrentCPP[ 128 ];
  93. char m_szBaseEntityClass[ 256 ];
  94. };
  95. extern ICodeProcessor *processor;
  96. #endif // CODEPROCESSOR_H