00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ROOT_TTabCom
00016 #define ROOT_TTabCom
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef ROOT_TObjString
00040 #include "TObjString.h"
00041 #endif
00042 #ifndef ROOT_TRegExp
00043 #include "TRegexp.h"
00044 #endif
00045
00046
00047 #define MAX_LEN_PAT 1024 // maximum length of a pattern
00048 #define dblquote(x) "\"" << x << "\""
00049
00050
00051 class TList;
00052 class TListIter;
00053 class TSeqCollection;
00054 class TClass;
00055
00056
00057 class TTabCom {
00058
00059 public:
00060 TTabCom();
00061 virtual ~TTabCom();
00062
00063 public:
00064 typedef TList TContainer;
00065 typedef TListIter TContIter;
00066
00067 public:
00068 Int_t Hook(char *buf, int *pLoc);
00069
00070 const TSeqCollection* GetListOfClasses();
00071 const TSeqCollection* GetListOfCppDirectives();
00072 const TSeqCollection* GetListOfFilesInPath( const char path[] );
00073 const TSeqCollection* GetListOfEnvVars();
00074 const TSeqCollection* GetListOfGlobalFunctions();
00075 const TSeqCollection* GetListOfGlobals();
00076 const TSeqCollection* GetListOfPragmas();
00077 const TSeqCollection* GetListOfSysIncFiles();
00078 const TSeqCollection* GetListOfUsers();
00079
00080 void ClearClasses();
00081 void ClearCppDirectives();
00082 void ClearEnvVars();
00083 void ClearFiles();
00084 void ClearGlobalFunctions();
00085 void ClearGlobals();
00086 void ClearPragmas();
00087 void ClearSysIncFiles();
00088 void ClearUsers();
00089
00090 void ClearAll();
00091
00092 void RehashClasses();
00093 void RehashCppDirectives();
00094 void RehashEnvVars();
00095 void RehashFiles();
00096 void RehashGlobalFunctions();
00097 void RehashGlobals();
00098 void RehashPragmas();
00099 void RehashSysIncFiles();
00100 void RehashUsers();
00101
00102 void RehashAll();
00103
00104 public:
00105 static Char_t AllAgreeOnChar( int i, const TSeqCollection* pList, Int_t& nGoodStrings );
00106 static void AppendListOfFilesInDirectory( const char dirName[], TSeqCollection* pList );
00107 static TString DetermineClass( const char varName[] );
00108 static Bool_t ExcludedByFignore( TString s );
00109 static TString GetSysIncludePath();
00110 static Bool_t IsDirectory( const char fileName[] );
00111 static TSeqCollection* NewListOfFilesInPath( const char path[] );
00112 static Bool_t PathIsSpecifiedInFileName( const TString& fileName );
00113 static void NoMsg( Int_t errorLevel );
00114
00115 public:
00116 enum {kDebug = 17};
00117
00118 enum EContext_t {
00119 kUNKNOWN_CONTEXT=-1,
00120
00121
00122
00123
00124
00125
00126 kSYS_UserName,
00127 kSYS_EnvVar,
00128
00129
00130 kCINT_stdout,
00131 kCINT_stderr,
00132 kCINT_stdin,
00133
00134
00135
00136
00137 kCINT_Edit,
00138 kCINT_Load,
00139 kCINT_Exec,
00140 kCINT_EXec,
00141
00142
00143 kCINT_pragma,
00144 kCINT_includeSYS,
00145 kCINT_includePWD,
00146
00147
00148
00149
00150
00151
00152 kCINT_cpp,
00153
00154
00155
00156 kROOT_Load,
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 kSYS_FileName,
00170
00171
00172 kCXX_NewProto,
00173 kCXX_ConstructorProto,
00174 kCXX_ScopeProto,
00175 kCXX_DirectProto,
00176 kCXX_IndirectProto,
00177
00178
00179
00180 kCXX_ScopeMember,
00181 kCXX_DirectMember,
00182 kCXX_IndirectMember,
00183
00184
00185
00186 kCXX_Global,
00187 kCXX_GlobalProto,
00188
00189
00190
00191 kNUM_PAT
00192 };
00193
00194 private:
00195 TTabCom(const TTabCom &);
00196 TTabCom& operator=(const TTabCom&);
00197
00198 Int_t Complete( const TRegexp& re, const TSeqCollection* pListOfCandidates, const char appendage[], TString::ECaseCompare cmp = TString::kExact);
00199 void CopyMatch( char dest[], const char localName[], const char appendage[]=0, const char fullName[]=0 ) const;
00200 EContext_t DetermineContext() const;
00201 TString DeterminePath( const TString& fileName, const char defaultPath[] ) const;
00202 TString ExtendPath( const char originalPath[], TString newBase ) const;
00203 void InitPatterns();
00204 TClass* MakeClassFromClassName( const char className[] ) const;
00205 TClass* TryMakeClassFromClassName( const char className[] ) const;
00206 TClass* MakeClassFromVarName( const char varName[], EContext_t& context,
00207 int iter=0);
00208 void SetPattern( EContext_t handle, const char regexp[] );
00209 int ParseReverse(const char *var_str, int start);
00210
00211 private:
00212 TSeqCollection* fpClasses;
00213 TSeqCollection* fpNamespaces;
00214 TSeqCollection* fpDirectives;
00215 TSeqCollection* fpEnvVars;
00216 TSeqCollection* fpFiles;
00217 TSeqCollection* fpGlobals;
00218 TSeqCollection* fpGlobalFuncs;
00219 TSeqCollection* fpPragmas;
00220 TSeqCollection* fpSysIncFiles;
00221 TSeqCollection* fpUsers;
00222
00223 char* fBuf;
00224 int* fpLoc;
00225
00226 Pattern_t fPat[ kNUM_PAT ][ MAX_LEN_PAT ];
00227 const char* fRegExp[ kNUM_PAT ];
00228 Bool_t fVarIsPointer;
00229 Int_t fLastIter;
00230
00231 ClassDef(TTabCom,0)
00232 };
00233
00234 extern TTabCom *gTabCom;
00235
00236 #endif