/usr/include/root/TTabCom.h is in libroot-core-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | // @(#)root/rint:$Id$
// Author: Christian Lacunza <lacunza@cdfsg6.lbl.gov> 27/04/99
// Modified by Artur Szostak <artur@alice.phy.uct.ac.za> : 1 June 2003
// Added support for namespaces.
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TTabCom
#define ROOT_TTabCom
////////////////////////////////////////////////////////////////////////////
// //
// TTabCom //
// //
// This class performs basic tab completion. //
// You should be able to hit [TAB] to complete a partially typed: //
// //
// username //
// environment variable //
// preprocessor directive //
// pragma //
// filename (with a context-sensitive path) //
// public member function or data member //
// global variable, function, or class name //
// //
// Also, something like gWhatever->Func([TAB] will print the appropriate //
// list of prototypes. For a list of some limitations see the source. //
// //
////////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TObjString
#include "TObjString.h"
#endif
#ifndef ROOT_TRegExp
#include "TRegexp.h"
#endif
#ifndef ROOT_Riosfwd
#include "Riosfwd.h"
#endif
#define MAX_LEN_PAT 1024 // maximum length of a pattern
#define dblquote(x) "\"" << x << "\""
// forward declarations
class TList;
class TListIter;
class TSeqCollection;
class TClass;
class TTabCom {
public: // constructors
TTabCom();
virtual ~TTabCom();
public: // typedefs
typedef TList TContainer;
typedef TListIter TContIter;
public: // member functions
Int_t Hook(char *buf, int *pLoc, ostream& out);
const TSeqCollection* GetListOfClasses();
const TSeqCollection* GetListOfCppDirectives();
const TSeqCollection* GetListOfFilesInPath( const char path[] );
const TSeqCollection* GetListOfEnvVars();
const TSeqCollection* GetListOfGlobalFunctions();
const TSeqCollection* GetListOfGlobals();
const TSeqCollection* GetListOfPragmas();
const TSeqCollection* GetListOfSysIncFiles();
const TSeqCollection* GetListOfUsers();
void ClearClasses();
void ClearCppDirectives();
void ClearEnvVars();
void ClearFiles();
void ClearGlobalFunctions();
void ClearGlobals();
void ClearPragmas();
void ClearSysIncFiles();
void ClearUsers();
void ClearAll();
void RehashClasses();
void RehashCppDirectives();
void RehashEnvVars();
void RehashFiles();
void RehashGlobalFunctions();
void RehashGlobals();
void RehashPragmas();
void RehashSysIncFiles();
void RehashUsers();
void RehashAll();
public: // static utility functions
static Char_t AllAgreeOnChar( int i, const TSeqCollection* pList, Int_t& nGoodStrings );
static void AppendListOfFilesInDirectory( const char dirName[], TSeqCollection* pList );
static TString DetermineClass( const char varName[] ); // TROOT
static Bool_t ExcludedByFignore( TString s );
static TString GetSysIncludePath(); // TROOT
static Bool_t IsDirectory( const char fileName[] ); // TSystem
static TSeqCollection* NewListOfFilesInPath( const char path[] );
static Bool_t PathIsSpecifiedInFileName( const TString& fileName );
static void NoMsg( Int_t errorLevel );
public: // enums
enum {kDebug = 17}; // set gDebug==TTabCom::kDebug for debugging output
enum EContext_t {
kUNKNOWN_CONTEXT=-1,
// first enum (not counting "kUNKNOWN_CONTEXT") must
// cast to zero because these enums will be used to
// index arrays of size "kNUM_PAT"
// ---------------
// user names and environment variables should come first
kSYS_UserName,
kSYS_EnvVar, // environment variables
// file descriptor redirection should almost come first
kCINT_stdout, // stdout
kCINT_stderr, // stderr
kCINT_stdin, // stdin
// CINT "." instructions
// the position of these guys is irrelevant since each of
// these commands will always be the only command on the line.
kCINT_Edit, // .E
kCINT_Load, // .L
kCINT_Exec, // .x
kCINT_EXec, // .X
// specific preprocessor directives.
kCINT_pragma,
kCINT_includeSYS, // system files
kCINT_includePWD, // local files
// specific preprocessor directives
// must come before general preprocessor directives
// general preprocessor directives
// must come after specific preprocessor directives
kCINT_cpp,
// specific member accessing
// should come before general member accessing
kROOT_Load,
// random files
/******************************************************************/
/* */
/* file names should come before member accessing */
/* */
/* (because otherwise "/tmp/a.cc" might look like you're trying */
/* to access member "cc" of some object "a") */
/* */
/* but after anything that requires a specific path. */
/* */
/******************************************************************/
kSYS_FileName,
// time to print prototype
kCXX_NewProto, // kCXX_NewProto must come before kCXX_ConstructorProto
kCXX_ConstructorProto, // kCXX_ConstructorProto this must come before kCXX_GlobalProto
kCXX_ScopeProto,
kCXX_DirectProto,
kCXX_IndirectProto,
// general member access
// should come after specific member access
kCXX_ScopeMember,
kCXX_DirectMember,
kCXX_IndirectMember,
// arbitrary global identifiers
// should really come last
kCXX_Global,
kCXX_GlobalProto,
// ------- make additions above this line ---------
kNUM_PAT // kNUM_PAT must be last. (to fix array size)
};
private: // member functions
TTabCom(const TTabCom &); //private and not implemented
TTabCom& operator=(const TTabCom&); //private and not implemented
Int_t Complete(const TRegexp& re, const TSeqCollection* pListOfCandidates,
const char appendage[], ostream& out, TString::ECaseCompare cmp = TString::kExact);
void CopyMatch( char dest[], const char localName[], const char appendage[]=0, const char fullName[]=0 ) const;
EContext_t DetermineContext() const;
TString DeterminePath( const TString& fileName, const char defaultPath[] ) const;
TString ExtendPath( const char originalPath[], TString newBase ) const;
void InitPatterns();
TClass* MakeClassFromClassName( const char className[] ) const;
TClass* TryMakeClassFromClassName( const char className[] ) const;
TClass* MakeClassFromVarName( const char varName[], EContext_t& context,
int iter=0);
void SetPattern( EContext_t handle, const char regexp[] );
int ParseReverse(const char *var_str, int start);
private: // data members
TSeqCollection* fpClasses;
TSeqCollection* fpNamespaces; // Contains the names of namespaces registered in CINT.
TSeqCollection* fpDirectives;
TSeqCollection* fpEnvVars;
TSeqCollection* fpFiles;
TSeqCollection* fpGlobals;
TSeqCollection* fpGlobalFuncs;
TSeqCollection* fpPragmas;
TSeqCollection* fpSysIncFiles;
TSeqCollection* fpUsers;
char* fBuf; // initialized by Hook()
int* fpLoc; // initialized by Hook()
Pattern_t fPat[ kNUM_PAT ][ MAX_LEN_PAT ]; // array of patterns
const char* fRegExp[ kNUM_PAT ]; // corresponding regular expression plain text
Bool_t fVarIsPointer; // frodo: pointer or not flag
Int_t fLastIter; // frodo: iteration counter for recursive MakeClassFromVarName
ClassDef(TTabCom,0) //Perform command line completion when hitting <TAB>
};
R__EXTERN TTabCom *gTabCom;
#endif
|