File indexing completed on 2025-01-18 10:12:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef ROOT_TTabCom
0016 #define ROOT_TTabCom
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #include "TString.h"
0040 #include "TRegexp.h"
0041
0042 #define MAX_LEN_PAT 1024
0043 #define dblquote(x) "\"" << x << "\""
0044
0045
0046 class TList;
0047 class TListIter;
0048 class TSeqCollection;
0049 class TClass;
0050
0051
0052 class TTabCom {
0053
0054 public:
0055 TTabCom();
0056 virtual ~TTabCom();
0057
0058 public:
0059 typedef TList TContainer;
0060 typedef TListIter TContIter;
0061
0062 public:
0063 Int_t Hook(char *buf, int *pLoc, std::ostream& out);
0064
0065 const TSeqCollection* GetListOfClasses();
0066 const TSeqCollection* GetListOfCppDirectives();
0067 const TSeqCollection* GetListOfFilesInPath( const char path[] );
0068 const TSeqCollection* GetListOfEnvVars();
0069 TCollection* GetListOfGlobalFunctions();
0070 const TSeqCollection* GetListOfGlobals();
0071 const TSeqCollection* GetListOfPragmas();
0072 const TSeqCollection* GetListOfSysIncFiles();
0073 const TSeqCollection* GetListOfUsers();
0074
0075 void ClearClasses();
0076 void ClearCppDirectives();
0077 void ClearEnvVars();
0078 void ClearFiles();
0079 void ClearGlobalFunctions();
0080 void ClearGlobals();
0081 void ClearPragmas();
0082 void ClearSysIncFiles();
0083 void ClearUsers();
0084
0085 void ClearAll();
0086
0087 void RehashClasses();
0088 void RehashCppDirectives();
0089 void RehashEnvVars();
0090 void RehashFiles();
0091 void RehashGlobalFunctions();
0092 void RehashGlobals();
0093 void RehashPragmas();
0094 void RehashSysIncFiles();
0095 void RehashUsers();
0096
0097 void RehashAll();
0098
0099 public:
0100 static Char_t AllAgreeOnChar( int i, const TSeqCollection* pList, Int_t& nGoodStrings );
0101 static void AppendListOfFilesInDirectory( const char dirName[], TSeqCollection* pList );
0102 static TString DetermineClass( const char varName[] );
0103 static Bool_t ExcludedByFignore( TString s );
0104 static TString GetSysIncludePath();
0105 static Bool_t IsDirectory( const char fileName[] );
0106 static TSeqCollection* NewListOfFilesInPath( const char path[] );
0107 static Bool_t PathIsSpecifiedInFileName( const TString& fileName );
0108 static void NoMsg( Int_t errorLevel );
0109
0110 public:
0111 enum {kDebug = 17};
0112
0113 enum EContext_t {
0114 kUNKNOWN_CONTEXT=-1,
0115
0116
0117
0118
0119
0120
0121 kSYS_UserName,
0122 kSYS_EnvVar,
0123
0124
0125 kCINT_stdout,
0126 kCINT_stderr,
0127 kCINT_stdin,
0128
0129
0130
0131
0132 kCINT_Edit,
0133 kCINT_Load,
0134 kCINT_Exec,
0135 kCINT_EXec,
0136
0137
0138 kCINT_pragma,
0139 kCINT_includeSYS,
0140 kCINT_includePWD,
0141
0142
0143
0144
0145
0146
0147 kCINT_cpp,
0148
0149
0150
0151 kROOT_Load,
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164 kSYS_FileName,
0165
0166
0167 kCXX_NewProto,
0168 kCXX_ConstructorProto,
0169 kCXX_ScopeProto,
0170 kCXX_DirectProto,
0171 kCXX_IndirectProto,
0172
0173
0174
0175 kCXX_ScopeMember,
0176 kCXX_DirectMember,
0177 kCXX_IndirectMember,
0178
0179
0180
0181 kCXX_Global,
0182 kCXX_GlobalProto,
0183
0184
0185
0186 kNUM_PAT
0187 };
0188
0189 private:
0190 TTabCom(const TTabCom &) = delete;
0191 TTabCom& operator=(const TTabCom&) = delete;
0192
0193 Int_t Complete(const TRegexp& re, const TSeqCollection* pListOfCandidates,
0194 const char appendage[], std::ostream& out, TString::ECaseCompare cmp = TString::kExact);
0195 void CopyMatch(char *dest, int dest_len, const char *localName, const char *appendage = nullptr, const char *fullName = nullptr) const;
0196 EContext_t DetermineContext() const;
0197 TString DeterminePath( const TString& fileName, const char defaultPath[] ) const;
0198 TString ExtendPath( const char originalPath[], TString newBase ) const;
0199 void InitPatterns();
0200 TClass* MakeClassFromClassName( const char className[] ) const;
0201 TClass* TryMakeClassFromClassName( const char className[] ) const;
0202 TClass* MakeClassFromVarName( const char varName[], EContext_t& context,
0203 int iter=0);
0204 void SetPattern( EContext_t handle, const char regexp[] );
0205 int ParseReverse(const char *var_str, int start);
0206
0207 private:
0208 TSeqCollection* fpClasses;
0209 ULong64_t fPrevInterpMarker;
0210 TSeqCollection* fpDirectives;
0211 TSeqCollection* fpEnvVars;
0212 TSeqCollection* fpFiles;
0213 TSeqCollection* fpGlobals;
0214 TSeqCollection* fpPragmas;
0215 TSeqCollection* fpSysIncFiles;
0216 TSeqCollection* fpUsers;
0217
0218 char* fBuf;
0219 int* fpLoc;
0220
0221 Pattern_t fPat[ kNUM_PAT ][ MAX_LEN_PAT ];
0222 const char* fRegExp[ kNUM_PAT ];
0223 Bool_t fVarIsPointer;
0224 Int_t fLastIter;
0225
0226 ClassDef(TTabCom,0)
0227 };
0228
0229 R__EXTERN TTabCom *gTabCom;
0230
0231 #endif