45#define ROOT_compiledata_cxx
46#include "compiledata.h"
47#include "RConfigure.h"
119 return !strncmp(path, proto, strlen(proto)) ? path + strlen(proto) : path;
128 Error(
"TSystem",
"only one instance of TSystem allowed");
272 return rv ?
len : -1;
361 catch (std::exception& exc) {
373 Warning(
"Run",
"instructed to abort");
380 catch (
const char *str) {
385 Warning(
"Run",
"handle uncaught exception, terminating");
426 return gROOT->IsInterrupted();
521 if (to && to->
IsAsync() && timeout > 0) {
697 SysError(
"GetFromPipe",
"cannot run command \"%s\"", scommand.
Data());
702 while (
line.Gets(pipe)) {
710 Error(
"GetFromPipe",
"command \"%s\" returned %d", scommand.
Data(),
r);
781 while ((helper = (
TSystem*) next()))
795 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TSystem", path))) {
796 if (
h->LoadPlugin() == -1)
800 }
else if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TSystem", path))) {
801 if (
h->LoadPlugin() == -1)
803 helper = (
TSystem*)
h->ExecPlugin(0);
833 return (checkproto || checkdir);
896 return std::string();
912 return std::string();
952 if (
name[0] ==
'/' &&
name[1] ==
'\0')
955 if ((cp = (
char *)strrchr(
name,
'/')))
959 Error(
"BaseName",
"name = 0");
969 return dir[0] ==
'/';
995 while ( incPath.
Index(
" :") != -1 ) {
1002 incPath.
Prepend(fileLocation+
":.:");
1004 char *actual =
Which(incPath,realname);
1024 if (res.IsNull() || (res ==
"."))
1030 TTHREAD_TLS(
char*) buf =
nullptr;
1031 if (res.Length() >=
len) {
1032 if (buf)
delete [] buf;
1033 len = res.Length() + 50;
1034 buf =
new char [
len];
1037 strncpy(buf, res.Data(),
len);
1049 if (!pathname || !strchr(pathname,
'/'))
1052 auto pathlen = strlen(pathname);
1054 const char *
r = pathname + pathlen - 1;
1056 while ((
r > pathname) && (*
r ==
'/'))
1059 while ((
r > pathname) && (*
r !=
'/'))
1064 while ((
r > pathname) && (*
r ==
'/'))
1068 if ((
r == pathname) && (*
r !=
'/'))
1071 return TString(pathname,
r + 1 - pathname);
1117 TTHREAD_TLS_ARRAY(
char, kBufSize, xname);
1135 char xname[kBufSize];
1150 int n, ier, iter, lx, ncopy;
1151 char *inp, *out, *
x, *t, *buff;
1152 const char *
b, *
c, *
e;
1154 buff =
new char[kBufSize * 4];
1156 iter = 0; xname[0] = 0; inp = buff + kBufSize; out = inp + kBufSize;
1157 inp[-1] =
' '; inp[0] = 0; out[-1] =
' ';
1158 c = fname + strspn(fname,
" \t\f\r");
1161 strlcat(inp,
c, kBufSize);
1164 iter++;
c = inp; ier = 0;
1167 p =
nullptr;
e =
nullptr;
1168 if (
c[0] ==
'~' &&
c[1] ==
'/') {
1173 strlcpy(
x,
p, kBufSize);
1180 }
else if (
c[0] ==
'~' &&
c[1] !=
'/') {
1181 n = strcspn(
c+1,
"/ ");
1182 assert((
n+1) < kBufSize &&
"This should have been prevented by the truncation 'strlcat(inp, c, kBufSize)'");
1184 (void)strlcpy(buff,
c+1,
n+1);
1189 strlcpy(
x,
p, kBufSize);
1199 for ( ;
c[0];
c++) {
1201 p =
nullptr;
e =
nullptr;
1203 if (
c[0] ==
'.' &&
c[1] ==
'/' &&
c[-1] ==
' ') {
1205 strlcpy(buff, wd.c_str(), kBufSize);
1210 strlcpy(
x,
p, kBufSize);
x += strlen(
p);
c =
e-1;
continue;
1217 if (
c[1] ==
'(')
b++;
1218 if (
c[1] ==
'{')
b++;
1222 for (
e =
b; isalnum(
e[0]) ||
e[0] ==
'_';
e++) ;
1223 buff[0] = 0; strncat(buff,
b,
e-
b);
1226 for (t = buff; (t[0] = toupper(t[0])); t++) ;
1230 for (t = buff; (t[0] = tolower(t[0])); t++) ;
1233 if (!
p && !strcmp(buff,
"cwd")) {
1235 strlcpy(buff, wd.c_str(), kBufSize);
1238 if (!
p && !strcmp(buff,
"$")) {
1239 snprintf(buff,kBufSize*4,
"%d",
GetPid());
1247 if (
c[1] &&
c[1]!=
'\\' &&
c[1]!=
';' &&
c[1]!=
'/')
1255 if (lp >= kBufSize) {
1257 strlcpy(
x,
p, kBufSize);
1263 c = (
b==
c+1) ?
e-1 :
e;
1268 x[0] = 0; lx =
x - out;
1269 if (ier && iter < 3) { strlcpy(inp, out, kBufSize);
goto again; }
1270 ncopy = (lx >= kBufSize) ? kBufSize-1 : lx;
1271 xname[0] = 0; strncat(xname, out, ncopy);
1275 if (ier || ncopy != lx) {
1276 if (fname && std::strstr(fname,
"~$")) {
1278 Info(
"ExpandFileName",
"detected MS temp file input: %s, output: %s", fname, xname);
1281 ::Error(
"TSystem::ExpandFileName",
"input: %s, output: %s", fname, xname);
1332 if (strlen(url.
GetHost()) > 0) {
1337 if (!strcmp(
a.GetHostName(),
b.GetHostName()) ||
1338 !strcmp(
a.GetHostAddress(),
b.GetHostAddress())) {
1342 if (strlen(url.
GetUser()) > 0) {
1425 int res =
GetPathInfo(path,
id, &lsize, flags, modtime);
1427 if (res == 0 &&
size) {
1429 Error(
"GetPathInfo",
"file %s > 2 GB, use GetPathInfo() with Long64_t size", path);
1751 Error(
"ShowOutput",
"handle not specified");
1757 Error(
"ShowOutput",
"file '%s' cannot be read",
h->fFile.Data());
1763 if (!(
f = fopen(
h->fFile.Data(),
"r"))) {
1764 Error(
"ShowOutput",
"file '%s' cannot be open",
h->fFile.Data());
1769 off_t ltot = lseek(fileno(
f), (off_t) 0, SEEK_END);
1770 Int_t begin = (
h->fReadOffSet > 0 &&
h->fReadOffSet < ltot) ?
h->fReadOffSet : 0;
1771 lseek(fileno(
f), (off_t) begin, SEEK_SET);
1772 Int_t left = ltot - begin;
1775 const Int_t kMAXBUF = 16384;
1777 Int_t wanted = (left > kMAXBUF-1) ? kMAXBUF-1 : left;
1780 while ((
len = read(fileno(
f), buf, wanted)) < 0 &&
1785 SysError(
"ShowOutput",
"error reading log file");
1791 fprintf(stderr,
"%s", buf);
1795 wanted = (left > kMAXBUF) ? kMAXBUF : left;
1797 }
while (
len > 0 && left > 0);
1800 h->fReadOffSet = ltot;
1840 if (left == right)
return kTRUE;
1842 if (left==
nullptr || right==
nullptr)
return kFALSE;
1844 if ( (strcmp(right,left)==0) ) {
1850 char leftname[_MAX_PATH];
1851 char rightname[_MAX_PATH];
1852 _fullpath( leftname, left, _MAX_PATH );
1853 _fullpath( rightname, right, _MAX_PATH );
1854 return ((stricmp(leftname, rightname)==0));
1856 struct stat rightBuf;
1857 struct stat leftBuf;
1858 return ( ( 0 == stat( left, & leftBuf ) )
1859 && ( 0 == stat( right, & rightBuf ) )
1860 && ( leftBuf.st_dev == rightBuf.st_dev )
1861 && ( leftBuf.st_ino == rightBuf.st_ino )
1862 && ( leftBuf.st_size == rightBuf.st_size )
1863 && ( leftBuf.st_mtime == rightBuf.st_mtime )
1892 if (idx == 0 || libs[idx-1] ==
'/' || libs[idx-1] ==
'\\') {
1895 if (!
l.EndsWith(
".") && libs[idx]==
'.')
1898 while (idx <
len && isdigit(libs[idx])) {
1901 if (libs[idx] ==
'.') {
1905 while (idx <
len && libs[idx] !=
'.') {
1906 if (libs[idx] ==
' ' || idx+1 ==
len) {
1913 if (
l[
l.Length()-1] ==
'.') {
1914 l.Remove(
l.Length()-1);
1916 if (
l.BeginsWith(
"lib")) {
1917 l.Replace(0, 3,
"-l");
1919 if ((idx == 0 || libs[idx-1] ==
' ') &&
1920 (libs[idx+
l.Length()] ==
' ' || libs[idx+
l.Length()] == 0)) {
1937 if (strcmp(module,deplib)==0) {
1941 Info(
"Load",
"loading dependent library %s for library %s",
1943 if ((ret =
Load(deplib,
"", system)) < 0) {
1967 if (ret < 0) ret = -1;
1969 Info(
"Load",
"loaded library %s, status %d", path, ret);
1972 Error(
"Load",
"version mismatch, %s = %d, ROOT = %d",
1973 path,
v,
gROOT->GetVersionInt());
1981 if (!entry || !entry[0] || ret < 0)
return ret;
1997 if (!mapfile || !mapfile->
GetTable())
return 0;
1999 std::set<std::string> loadedlibs;
2000 std::set<std::string> failedlibs;
2004 while ((rec = (
TEnvRec*) iEnvRec())) {
2010 if (failedlibs.find(lib.
Data()) != failedlibs.end()) {
2022 if (loadedlibs.find(lib.
Data()) == loadedlibs.end()) {
2026 if (res == 0) ++nlibs;
2027 loadedlibs.insert(lib.
Data());
2029 failedlibs.insert(lib.
Data());
2108 if (!(regexp && regexp[0]))
2114 while (libs.
Tokenize(tok, from,
" ")) {
2115 if ((tok.
Index(pat, &ext) != 0) || (ext != tok.
Length()))
2117 std::cout << tok <<
"\n";
2126 TTHREAD_TLS_DECL(
TString, gLastErrorString);
2127 return gLastErrorString;
2199 if (libs.
Length() == 0) {
2205 static TString lastAddMissing;
2206 if ( lastLinked != slinked ) {
2208 static TRegexp separator(
"[^ \\t\\s]+");
2209 lastLinked = slinked;
2210 lastAddMissing.
Clear();
2213 start =
index = end = 0;
2219 if (sub[0]==
'-' && sub[1]==
'L') {
2234 }
else if (libs.
Length() != 0) {
2237 static TRegexp separator(
"[^ \\t\\s]+");
2239 start =
index = end = 0;
2245 if (sub[0]!=
'-' && sub[1]!=
'L') {
2255 if (regexp && *regexp) {
2256 static TRegexp separator(
"[^ \\t\\s]+");
2260 start =
index = end = 0;
2265 s = libs(
index,end);
2266 if ((isRegexp && s.
Index(user_re) !=
kNPOS) ||
2278#if defined(R__MACOSX)
2284 static TRegexp separator(
"[^ \\t\\s]+");
2285 static TRegexp dynload(
"/lib-dynload/");
2290 static TRegexp libffiMatch(
"/usr/lib/libffi");
2293 start =
index = end = 0;
2529 delete [] tobedeleted;
2534static TString R__Exec(
const char *cmd)
2545 while ((
x = fgetc(
f))!=EOF ) {
2546 if (
x==
'\n' ||
x==
'\r')
break;
2554static void R__FixLink(
TString &cmd)
2560 TString res = R__Exec(
"link 2>&1");
2562 if (res.
Contains(
"Microsoft (R) Incremental Linker"))
2566 res = R__Exec(
"cygpath . 2>&1");
2572 res = R__Exec(
"which cl.exe 2>&1|grep cl|sed 's,cl\\.exe$,link\\.exe,' 2>&1");
2574 res = R__Exec(
Form(
"cygpath -w '%s' 2>&1",res.
Data()));
2582#if defined(__CYGWIN__)
2584 if (path.
Length() > 2 && path[1]==
':') {
2602 bool needToUnlinkTempFile =
false;
2603 TString devnullfile =
"/dev/null";
2610 if (!comspec || !comspec[0]) {
2611 devnullfile =
"NUL";
2615 if (comspecStr.
EndsWith(
"cmd.exe")) {
2616 devnullfile =
"NUL";
2617 }
else if (comspecStr.
Contains(
"powershell.exe")) {
2618 devnullfile =
"$null";
2620 needToUnlinkTempFile =
true;
2621 devnullfile = depfilename +
".stderr.tmp";
2626 TString bakdepfilename = depfilename +
".bak";
2629 bool fNeedToUnlinkTempFile;
2630 const TString &fDevNullFile, &fBakdepfilename;
2633 if (fNeedToUnlinkTempFile) {
2639 } deferGuard{needToUnlinkTempFile, devnullfile, bakdepfilename};
2641 TString builddep =
"rmkdepend";
2643 builddep +=
" \"-f";
2644 builddep += depfilename;
2649 builddep +=
" \"-p";
2650 if (build_loc[
len] ==
'/' || build_loc[
len+1] !=
'\\' ) {
2660 builddep +=
" \"-p";
2664 builddep +=
" -Y -- ";
2666 builddep +=
" \"-I"+rootsysInclude+
"\" ";
2667 builddep += includes;
2668 builddep += defines;
2669 builddep +=
" -- \"";
2676 if (library[
len] ==
'/' || library[
len+1] !=
'\\' ) {
2677 targetname = library.
Data() +
len + 1;
2679 targetname = library.
Data() +
len + 2;
2682 targetname = library;
2685 targetname = library;
2690 builddep +=
"\" > ";
2691 builddep += devnullfile;
2692 builddep +=
" 2>&1 ";
2697#if defined(R__HAS_CLING_DICTVERSION)
2699 char *clingdictversion =
gSystem->
Which(incPath,
"clingdictversion.h");
2700 if (clingdictversion) {
2703 delete [] clingdictversion;
2705 R__AddPath(adddictdep,rootsysInclude+
"/clingdictversion.h ");
2710 constexpr const char *dictHeaders[] = {
"ROOT/RConfig.hxx",
2712 "TDictAttributeMap.h",
2716 "TMemberInspector.h",
2721 "TCollectionProxyInfo.h"};
2723 for (
const char *header : dictHeaders) {
2727 delete [] rootVersion;
2729 R__AddPath(adddictdep, rootsysInclude +
"/" + header);
2740 delete [] rootCling;
2745 std::ofstream depFile(depfilename, std::ios::out | std::ios::trunc);
2747 ::Warning(
"ACLiC",
"Failed to open dependency file %s for %s", depfilename.
Data(), library.
Data());
2761 ::Warning(
"ACLiC",
"Failed to run rmkdepend for %s", library.
Data());
2765 std::ofstream depFile(depfilename, std::ios::out | std::ios::app);
2767 ::Warning(
"ACLiC",
"Failed to open dependency file %s for %s after running rmkdepend", depfilename.
Data(),
2771 depFile << adddictdep <<
"\n";
2772 depFile << libname << version_var_prefix <<
" \"" <<
ROOT_RELEASE <<
"\"\n";
2902 const char *library_specified,
2903 const char *build_dir,
2906 static const char *version_var_prefix =
"__ROOTBUILDVERSION=";
2917 keep = (strchr(opt,
'k')!=
nullptr);
2918 recompile = (strchr(opt,
'f')!=
nullptr);
2919 if (strchr(opt,
'O')!=
nullptr) {
2922 if (strchr(opt,
'g')!=
nullptr) {
2925 if (strchr(opt,
'c')!=
nullptr) {
2928 withInfo = strchr(opt,
's') ==
nullptr;
2929 verbose = strchr(opt,
'v') !=
nullptr;
2930 internalDebug = strchr(opt,
'd') !=
nullptr;
2933 TString rootbuild = ROOTBUILD;
2940#if defined(_MSC_VER) && defined(_DEBUG)
2951 if (build_dir && strlen(build_dir)) build_loc = build_dir;
2952 if (build_loc ==
".") {
2965 incPath.
Append(fromConfig);
2968 auto posISysRoot = incPath.
Index(
" -isysroot \"");
2969 if (posISysRoot !=
kNPOS) {
2970 auto posISysRootEnd = incPath.
Index(
'"', posISysRoot + 12);
2971 if (posISysRootEnd !=
kNPOS) {
2974 incPath.
Insert(posISysRootEnd - 1,
"/usr/include/");
2975 incPath.
Replace(posISysRoot, 12,
":\"");
2978 while ( incPath.
Index(
" :") != -1 ) {
2988 TString library = expFileName;
2991 const char *whichlibrary =
Which(incPath,library);
2993 library = whichlibrary;
2994 delete [] whichlibrary;
2996 ::Error(
"ACLiC",
"The file %s can not be found in the include path: %s",
filename,incPath.
Data());
3012 TString filename_fullpath = library;
3019 if (library.
Length()>1 && isalpha(library[0]) && library[1]==
':') {
3020 file_dirname.
Prepend(library(0,2));
3022 TString file_location( file_dirname );
3023 incPath.
Prepend( file_location +
":" );
3026 TString extension, libname_noext = library;
3028 libname_noext.
Remove(dot_pos);
3029 extension = library(dot_pos+1, library.
Length()-dot_pos-1);
3035 library.
Replace( dot_pos, library.
Length()-dot_pos, suffix);
3042 if (library_specified && strlen(library_specified) ) {
3044 libname =
BaseName( library_specified );
3045 library = library_specified;
3050 libname_noext = library_specified;
3055 TString libname_ext ( libname );
3056 libname_ext +=
"." +
fSoExt;
3063 if (library.
Length()>1 && isalpha(library[0]) && library[1]==
':') {
3064 lib_dirname.
Prepend(library(0,2));
3067 if ( strncmp( &(lib_dirname[lib_dirname.
Length()-2]),
"/.", 2) == 0 ) {
3070 if ( strncmp( &(lib_dirname[lib_dirname.
Length()-2]),
"\\.", 2) == 0 ) {
3073 TString lib_location( lib_dirname );
3076 if (build_loc.
Length()==0) {
3077 build_loc = lib_location;
3080 TRegexp disk_finder (
"[A-z]:");
3082 if (pos==0) library.
Remove(pos,3);
3083 pos = lib_location.
Index( disk_finder );
3084 if (pos==0) lib_location.
Remove(pos,3);
3087 library = libname_ext;
3094 TString build_loc_store( build_loc );
3095 if (!flatBuildDir) {
3096 TString temp_lib_location = lib_location;
3101 mkdirFailed = (0 !=
mkdir(build_loc,
true));
3102 if (mkdirFailed && !canWriteBuild_loc) {
3105 build_loc = build_loc_store;
3107 }
else if (!mkdirFailed && dirmode!=0) {
3108 Chmod(build_loc,dirmode);
3120 ::Info(
"ACLiC",
"script has already been loaded in interpreted mode");
3137 TRegexp rel_inc(
" -I[^\"/\\\\$\\%-][^:\\s]+");
3139 pos = rel_inc.
Index(includes,&
len);
3149 pos = rel_inc.
Index(includes,&
len);
3154 TRegexp rel_inc(
" -I\"[^/\\\\$\\%-][^:\\s]+");
3156 pos = rel_inc.
Index(includes,&
len);
3163 pos = rel_inc.
Index(includes,&
len);
3184 TRegexp rel_def(
"-D[^\\s\\t\\n\\r]*");
3188 defines += cmd(pos,
len);
3190 pos = rel_def.
Index(cmd,&
len,pos+1);
3199 emergency_loc = (ug->
fUser).Data();
3215 depfilename +=
"_" + extension +
".d";
3219 Long_t lib_time, file_time;
3223 (lib_time < file_time))) {
3233 depdir = emergency_loc;
3234 depfilename =
BaseName(libname_noext);
3236 depfilename +=
"_" + extension +
".d";
3238 R__WriteDependencyFile(build_loc, depfilename, filename_fullpath, library, libname, extension, version_var_prefix, includes, defines, incPath);
3245 FILE * depfile = fopen(depfilename.
Data(),
"r");
3246 if (depfile==
nullptr) {
3254 TString version_var = libname + version_var_prefix;
3257 char *
line =
new char[sz];
3263 Bool_t hasversion =
false;
3265 while ((
c = fgetc(depfile)) != EOF) {
3268 while ((
c = fgetc(depfile)) != EOF) {
3275 if (current &&
line[current-1]==
'=' && strncmp(version_var.
Data(),
line,current)==0) {
3281 }
else if (isspace(
c) && !nested) {
3283 if (
line[current-1]!=
':') {
3292 modified |= ( lib_time <= filetime );
3299 if (current==sz-1) {
3301 char *newline =
new char[sz];
3302 memcpy(newline,
line, current);
3306 if (
c==
'"') nested = !nested;
3315 recompile = modified;
3332 && (lib_time>load_time)) {
3337 if ( !recompile && reload ) {
3340 ::Info(
"ACLiC",
"%s has been modified and will be reloaded",
3363 ::Info(
"ACLiC",
"%s script has already been compiled and loaded",
3364 modified ?
"modified" :
"unmodified");
3371 ::Info(
"ACLiC",
"it will be regenerated and reloaded!");
3387 TString libmapfilename = libname;
3389 libmapfilename +=
".rootmap";
3390#if (defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_5)) || defined(R__WIN32)
3395 Bool_t linkDepLibraries = !produceRootmap;
3397#if (defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_5))
3399#elif defined(R__WIN32)
3404 produceRootmap = linkLibs & 0x2;
3405 linkDepLibraries = linkLibs & 0x1;
3409 bool useCxxModules =
3410#ifdef R__USE_CXXMODULES
3417 auto ForeachSharedLibDep = [](
const char *lib, std::function<
bool(
const char *)>
f) {
3418 using std::string, std::vector, std::istringstream, std::istream_iterator;
3419 string deps =
gInterpreter->GetSharedLibDeps(lib,
true);
3420 istringstream iss(deps);
3421 vector<string> libs{istream_iterator<std::string>{iss}, istream_iterator<string>{}};
3423 for (
auto I = libs.begin() + 1, E = libs.end(); I != E; ++I)
3427 auto LoadLibrary = [useCxxModules, produceRootmap, ForeachSharedLibDep](
const TString &lib) {
3436 if (useCxxModules && !produceRootmap) {
3437 std::function<
bool(
const char *)> LoadLibF = [](
const char *dep) {
3440 ForeachSharedLibDep(lib, LoadLibF);
3457 return LoadLibrary(library);
3462 if (!canWrite && recompile) {
3465 ::Warning(
"ACLiC",
"Could not create the directory: %s",
3468 ::Warning(
"ACLiC",
"%s is not writable!",
3471 if (emergency_loc == build_dir ) {
3472 ::Error(
"ACLiC",
"%s is the last resort location (i.e. temp location)",build_loc.
Data());
3475 ::Warning(
"ACLiC",
"Output will be written to %s",
3476 emergency_loc.
Data());
3477 return CompileMacro(expFileName, opt, library_specified, emergency_loc, dirmode);
3481 Info(
"ACLiC",
"creating shared library %s",library.
Data());
3484 R__WriteDependencyFile(build_loc, depfilename, filename_fullpath, library, libname, extension, version_var_prefix, includes, defines, incPath);
3487 TString dict = libname +
"_ACLiC_dict";
3491 static const int maxforbidden = 27;
3492 static const char *forbidden_chars[maxforbidden] =
3493 {
"+",
"-",
"*",
"/",
"&",
"%",
"|",
"^",
">",
"<",
3494 "=",
"~",
".",
"(",
")",
"[",
"]",
"!",
",",
"$",
3495 " ",
":",
"'",
"#",
"@",
"\\",
"\"" };
3496 for(
int ic = 0; ic < maxforbidden; ic++ ) {
3510 linkdef +=
"_ACLiC_linkdef.h";
3511 std::ofstream linkdefFile( linkdef, std::ios::out );
3512 linkdefFile <<
"// File Automatically generated by the ROOT Script Compiler "
3514 linkdefFile << std::endl;
3515 linkdefFile <<
"#ifdef __CLING__" << std::endl;
3516 linkdefFile << std::endl;
3517 linkdefFile <<
"#pragma link C++ nestedclasses;" << std::endl;
3518 linkdefFile <<
"#pragma link C++ nestedtypedefs;" << std::endl;
3519 linkdefFile << std::endl;
3523 const char * extensions[] = {
".h",
".hh",
".hpp",
".hxx",
".hPP",
".hXX" };
3526 for (i = 0; i < 6; i++ ) {
3530 extra_linkdef.
Append(extensions[i]);
3533 if (verboseLevel>4 && withInfo) {
3534 Info(
"ACLiC",
"including extra linkdef file: %s",
name);
3536 linkdefFile <<
"#include \"" <<
name <<
"\"" << std::endl;
3541 if (verboseLevel>5 && withInfo) {
3542 Info(
"ACLiC",
"looking for header in: %s",incPath.
Data());
3544 for (i = 0; i < 6; i++ ) {
3547 lookup.
Append(extensions[i]);
3554 linkdefFile <<
"#pragma link C++ defined_in \""<<filename_fullpath <<
"\";" << std::endl;
3555 linkdefFile << std::endl;
3556 linkdefFile <<
"#endif" << std::endl;
3557 linkdefFile.close();
3562 mapfile +=
"_ACLiC_map";
3563 TString mapfilein = mapfile +
".in";
3564 TString mapfileout = mapfile +
".out";
3567 if (!useCxxModules) {
3568 if (
gInterpreter->GetSharedLibDeps(library) !=
nullptr) {
3570 needLoadMap =
kTRUE;
3574 std::ofstream mapfileStream( mapfilein, std::ios::out );
3577 TString sname =
"system.rootmap";
3592 mapfileStream << file << std::endl;
3595 mapfileStream << file << std::endl;
3596 mapfileStream <<
name << std::endl;
3598 for (i = 0; i <
gInterpreter->GetRootMapFiles()->GetEntriesFast(); i++) {
3603 mapfileStream.close();
3608 rcling +=
" \"--lib-list-prefix=";
3610 rcling +=
"\" -f \"";
3613 if (produceRootmap && !useCxxModules) {
3614 rcling +=
" -rml " + libname +
" -rmf \"" + libmapfilename +
"\" ";
3615 rcling.
Append(
"-DR__ACLIC_ROOTMAP ");
3620 rcling.
Append(fromConfig);
3622 if (!extraFlags.
IsNull()) {
3625 rcling.
Append(extraFlags);
3631 if (useCxxModules && produceRootmap) {
3632 rcling +=
" -cxxmodule ";
3634 TString moduleName = libname +
"_ACLiC_dict";
3636 moduleName = moduleName.
Remove(0, 3);
3637 TString moduleMapName = moduleName +
".modulemap";
3638 TString moduleMapFullPath = build_loc +
"/" + moduleMapName;
3641 ::Info(
"ACLiC",
"File %s already exists!", moduleMapFullPath.
Data());
3645 std::ofstream moduleMapFile(moduleMapFullPath, std::ios::out);
3646 moduleMapFile <<
"module \"" << moduleName <<
"\" {" << std::endl;
3647 moduleMapFile <<
" header \"" << relative_path <<
"\"" << std::endl;
3648 moduleMapFile <<
" export *" << std::endl;
3649 moduleMapFile <<
" link \"" << libname_ext <<
"\"" << std::endl;
3650 moduleMapFile <<
"}" << std::endl;
3651 moduleMapFile.close();
3653 rcling.
Append(
" \"-moduleMapFile=" + moduleMapFullPath +
"\" ");
3661 if (verboseLevel>3) {
3662 ::Info(
"ACLiC",
"creating the dictionary files");
3663 if (verboseLevel>4)
::Info(
"ACLiC",
"%s", rcling.
Data());
3668 auto ExecAndReport = [](
TString cmd) ->
bool {
3672 ::Error(
"ACLiC",
"Executing '%s' failed with a core dump!", cmd.
Data());
3674 ::Error(
"ACLiC",
"Executing '%s' failed!", cmd.
Data());
3687 std::ifstream liblist(mapfileout);
3689 while ( liblist >> libtoload ) {
3691 if (libtoload ==
"#") {
3693 std::string toskipcomment;
3694 std::getline(liblist,toskipcomment);
3697 if (libtoload != library && libtoload != libname && libtoload != libname_ext) {
3698 if (produceRootmap) {
3699 if (loadLib || linkDepLibraries ) {
3706 if (!linkedlibs.
Contains(libtoload)) {
3708 depLibraries.
Append(
" ");
3710 depLibraries = depLibraries.
Strip();
3713 gROOT->LoadClass(
"", libtoload);
3716 unsigned char c = liblist.peek();
3717 if (
c==
'\n' ||
c==
'\r') {
3743 std::unique_ptr<TObjArray> tokens( linkLibrariesNoQuotes.
Tokenize(
" ") );
3744 for (
auto tokenObj : *tokens) {
3745 singleLibrary = ((
TObjString*)tokenObj)->GetString();
3747 if (collectingSingleLibraryNameTokens) {
3748 librariesWithQuotes.
Chop();
3749 librariesWithQuotes +=
"\" \"" + singleLibrary +
"\"";
3750 collectingSingleLibraryNameTokens =
kFALSE;
3752 librariesWithQuotes +=
" \"" + singleLibrary +
"\"";
3755 if (collectingSingleLibraryNameTokens) {
3756 librariesWithQuotes += singleLibrary +
" ";
3758 collectingSingleLibraryNameTokens =
kTRUE;
3759 librariesWithQuotes +=
" \"" + singleLibrary +
" ";
3765 linkLibraries.
Prepend(linkLibrariesNoQuotes);
3767 linkLibraries.
Prepend(librariesWithQuotes);
3774 cmd.
ReplaceAll(
"$SourceFiles",
"-D__ACLIC__ \"$SourceFiles\"");
3776 cmd.
ReplaceAll(
"$ObjectFiles",
"\"$ObjectFiles\"");
3779 cmd.
ReplaceAll(
"$SharedLib",
"\"$SharedLib\"");
3781 if (linkDepLibraries) {
3782 if (produceRootmap) {
3798 cmd.
ReplaceAll(
"$RPath",
"-Wl,-rpath," +
gROOT->GetSharedLibDir() +
" -Wl,-rpath," + build_loc);
3812 cmd.
ReplaceAll(
" && link ",
"&& link /DEBUG ");
3819 fakeMain +=
"_ACLiC_main";
3820 fakeMain += extension;
3821 std::ofstream fakeMainFile( fakeMain, std::ios::out );
3822 fakeMainFile <<
"// File Automatically generated by the ROOT Script Compiler "
3824 fakeMainFile <<
"int main(char*argc,char**argvv) {};" << std::endl;
3825 fakeMainFile.close();
3836 exec +=
"_ACLiC_exec";
3837 testcmd.
ReplaceAll(
"$SourceFiles",
"-D__ACLIC__ \"$SourceFiles\"");
3839 testcmd.
ReplaceAll(
"$ObjectFiles",
"\"$ObjectFiles\"");
3843 testcmd.
ReplaceAll(
"$LinkedLibs",linkLibraries);
3851 R__FixLink(testcmd);
3857 TString cmdAllowUnresolved = cmd;
3860 cmdAllowUnresolved.
ReplaceAll(
"-dynamiclib",
"-dynamiclib -Wl,-w -Wl,-undefined,dynamic_lookup");
3862 if (verboseLevel > 3 && withInfo) {
3863 ::Info(
"ACLiC",
"compiling the dictionary and script files");
3865 ::Info(
"ACLiC",
"%s", cmdAllowUnresolved.
Data());
3867 Int_t success = ExecAndReport(cmdAllowUnresolved);
3869 if (produceRootmap) {
3877 if (linkDepLibraries) {
3883 std::function<
bool(
const char *)> CollectF = [&depLibsFullPaths](
const char *dep) {
3886 ::Error(
"TSystem::CompileMacro",
"Cannot find library '%s'", dep);
3889 depLibsFullPaths +=
" " + LibFullPath;
3892 ForeachSharedLibDep(library, CollectF);
3895 relink_cmd += depLibsFullPaths;
3896 if (verboseLevel > 3 && withInfo) {
3897 ::Info(
"ACLiC",
"relinking against all dependencies");
3898 if (verboseLevel > 4)
3901 result = ExecAndReport(relink_cmd);
3914 if (verboseLevel>3 && withInfo)
::Info(
"ACLiC",
"loading the shared library");
3916 result = LoadLibrary(library);
3921 if (verboseLevel>3 && withInfo) {
3922 ::Info(
"ACLiC",
"testing for missing symbols:");
3923 if (verboseLevel>4)
::Info(
"ACLiC",
"%s", testcmd.
Data());
3931 if (verboseLevel<=5 && !internalDebug) {
3941 if (verboseLevel>6) {
4008 if (!
gEnv)
return "";
4094 if (!
gEnv)
return "_linkdef";
4355 filenameCopy = filenameCopy.
Strip();
4359 filenameCopy = filenameCopy.
Strip();
4364 int parenNestCount = 1;
4365 bool inString =
false;
4366 Ssiz_t posArgBegin = posArgEnd - 1;
4367 for (; parenNestCount && posArgBegin >= 0; --posArgBegin) {
4370 if (posArgBegin > 0 && filenameCopy[posArgBegin] ==
'\\' &&
4371 (posArgBegin == 1 || filenameCopy[posArgBegin - 1] !=
'\\')) {
4376 switch (filenameCopy[posArgBegin]) {
4385 case '"': inString = !inString;
break;
4388 if (parenNestCount || inString) {
4389 Error(
"SplitAclicMode",
"Cannot parse argument in %s",
filename);
4391 arguments = filenameCopy(posArgBegin + 1, posArgEnd - 1);
4392 fname[posArgBegin + 1] = 0;
4400 s2 = strstr(fname,
">>");
4401 if (!s2) s2 = strstr(fname,
"2>");
4402 if (!s2) s2 = strchr(fname,
'>');
4403 s3 = strchr(fname,
'<');
4404 if (s2 && s3) s2 = s2<s3 ? s2 : s3;
4405 if (s3 && !s2) s2 = s3;
4416 while (s2 > fname && *s2 ==
' ') s2--;
4427 int len = strlen(fname);
4430 if (strchr(
"kfgOcsdv-", fname[
len - 1])) {
4438 Bool_t remove = compile &&
len > 1 && fname[
len - 2] ==
'+';
4440 if (
mode.Length()) {
4444 fname[strlen(fname)-2] = 0;
4447 fname[strlen(fname)-1] = 0;
4468 const char *extensions[] = {
".lib",
".exp",
".d",
".def",
".rootmap",
"_ACLiC_linkdef.h",
"_ACLiC_dict_rdict.pcm"};
4469 while ((lib = (
TNamed*)next())) {
4475 ::FreeLibrary(::GetModuleHandle(libname));
4480 for (
const char *ext : extensions) {
The file contains utilities which are foundational and could be used across the core component of ROO...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char)
R__EXTERN TApplication * gApplication
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
char * StrDup(const char *str)
Duplicate the string str.
static Int_t gLibraryVersionIdx
TVirtualMutex * gSystemMutex
void AssignAndDelete(TString &target, char *tobedeleted)
static void R__WriteDependencyFile(const TString &build_loc, const TString &depfilename, const TString &filename, const TString &library, const TString &libname, const TString &extension, const char *version_var_prefix, const TString &includes, const TString &defines, const TString &incPath)
static bool R__MatchFilename(const char *left, const char *right)
Figure out if left and right points to the same object in the file system.
static void R__AddPath(TString &target, const TString &path)
static Int_t * gLibraryVersion
static Int_t gLibraryVersionMax
R__EXTERN const char * gProgName
R__EXTERN TVirtualMutex * gSystemMutex
Bool_t R_ISREG(Int_t mode)
ESocketBindOption
Options for binging the sockets created.
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD2(mutex)
#define R__WRITE_LOCKGUARD(mutex)
#define R__READ_LOCKGUARD(mutex)
virtual void StopIdleing()
Called when system stops idleing.
virtual void StartIdleing()
Called when system starts idleing.
virtual TObject * Remove(TObject *obj)=0
virtual bool UseRWLock(Bool_t enable=true)
Set this collection to use a RW lock upon access, making it thread safe.
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
void Delete(Option_t *option="") override=0
Delete this object.
const char * GetValue() const
The TEnv class reads config files, by default named .rootrc.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
THashList * GetTable() const
This class represents an Internet Protocol (IP) address.
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
Collectable string class.
Mother of all ROOT objects.
void AbstractMethod(const char *method) const
Call this function within a function that you don't want to define as purely virtual,...
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
@ kInvalidObject
if object ctor succeeded but object should not be used
@ kMustCleanup
if object destructor must call RecursiveRemove()
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TProcessEventTimer(Long_t delay)
Create async event processor timer. Delay is in milliseconds.
Bool_t ProcessEvents()
Process events if timer did time out.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
static Int_t ConvertVersionCode2Int(Int_t code)
Convert version code to an integer, i.e. 331527 -> 51507.
static const TString & GetRootSys()
Get the rootsys directory in the installation. Static utility function.
static Int_t RootVersionCode()
Return ROOT version code as defined in ROOT/RVersion.hxx.
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static const TString & GetLibDir()
Get the library directory in the installation.
Regular expression class.
Ssiz_t Index(const TString &str, Ssiz_t *len, Ssiz_t start=0) const
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match...
void Add(TObject *obj) override
virtual EStatus Handle(std::exception &exc)=0
static Int_t * ReAllocInt(Int_t *vp, size_t size, size_t oldsize)
Reallocate (i.e.
void ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
TString & Insert(Ssiz_t pos, const char *s)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
void Clear()
Clear string without changing its capacity.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Abstract base class defining a generic interface to the underlying Operating System.
virtual void NotifyApplicationCreated()
Hook to tell TSystem that the TApplication object has been created.
virtual const char * GetBuildNode() const
Return the build node name.
virtual int Umask(Int_t mask)
Set the process file creation mode mask.
virtual int SendBuf(int sock, const void *buffer, int length)
Send a buffer headed by a length indicator.
virtual int GetServiceByName(const char *service)
Get port # of internet service.
virtual Bool_t IsFileInIncludePath(const char *name, char **fullpath=nullptr)
Return true if 'name' is a file that can be found in the ROOT include path or the current directory.
virtual void Unload(const char *module)
Unload a shared library.
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual const char * GetMakeSharedLib() const
Return the command line use to make a shared library.
TSeqCollection * fFileHandler
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
TString & GetLastErrorString()
Return the thread local storage for the custom last error message.
virtual void AddLinkedLibs(const char *linkedLib)
Add linkedLib to already set linked libs.
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=nullptr)
Redirect standard output (stdout, stderr) to the specified file.
virtual const char * GetBuildCompilerVersion() const
Return the build compiler version.
virtual void ResetSignal(ESignals sig, Bool_t reset=kTRUE)
If reset is true reset the signal handler for the specified signal to the default handler,...
virtual TInetAddress GetSockName(int sock)
Get Internet Protocol (IP) address of host and port #.
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks.
virtual Func_t DynFindSymbol(const char *module, const char *entry)
Find specific entry point in specified library.
virtual const char * GetLinkedLibs() const
Return the list of library linked to this executable.
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
virtual void Syslog(ELogLevel level, const char *mess)
Send mess to syslog daemon.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
virtual void SetAclicMode(EAclicMode mode)
AclicMode indicates whether the library should be built in debug mode or optimized.
static void ResetErrno()
Static function resetting system error number.
virtual UInt_t LoadAllLibraries()
Load all libraries known to ROOT via the rootmap system.
virtual void * GetDirPtr() const
virtual void SetObjExt(const char *objExt)
Set object files extension, should be either .o, .obj, etc.
virtual void SetLinkdefSuffix(const char *suffix)
The 'suffix' will be appended to the name of a script loaded by ACLiC and used to locate any eventual...
TSeqCollection * fHelpers
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * GetBuildDir() const
Return the path of the build directory.
virtual void Openlog(const char *name, Int_t options, ELogFacility facility)
Open connection to system log daemon.
static Int_t GetErrno()
Static function returning system error number.
virtual void AddIncludePath(const char *includePath)
Add a directory to the already set include path.
virtual int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
virtual Int_t GetEffectiveGid()
Returns the effective group id.
virtual ~TSystem()
Delete the OS interface.
virtual void SetDisplay()
Set DISPLAY environment variable based on utmp entry. Only for UNIX.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void SetFlagsOpt(const char *)
FlagsOpt should contain the options to pass to the C++ compiler in order to compile the library in op...
void RemoveOnExit(TObject *obj)
Objects that should be deleted on exit of the OS interface.
TSeqCollection * fStdExceptionHandler
virtual char * GetServiceByPort(int port)
Get name of internet service.
virtual void * OpenDirectory(const char *name)
Open a directory.
virtual int GetPid()
Get process id.
virtual int RecvBuf(int sock, void *buffer, int length)
Receive a buffer headed by a length indicator.
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
virtual Long_t NextTimeOut(Bool_t mode)
Time when next timer of mode (synchronous=kTRUE or asynchronous=kFALSE) will time-out (in ms).
virtual int SetSockOpt(int sock, int kind, int val)
Set socket option.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual TStdExceptionHandler * RemoveStdExceptionHandler(TStdExceptionHandler *eh)
Remove an exception handler from list of exception handlers.
virtual const char * GetIncludePath()
Get the list of include path.
virtual int AcceptConnection(int sock)
Accept a connection.
virtual Int_t GetAclicProperties() const
Return the ACLiC properties field.
virtual TString SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const
This method split a filename of the form:
virtual void ShowOutput(RedirectHandle_t *h)
Display the content associated with the redirection described by the opaque handle 'h'.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name.
virtual UserGroup_t * GetGroupInfo(Int_t gid)
Returns all group info in the UserGroup_t structure.
virtual void CleanCompiledMacros()
Remove the shared libs produced by the CompileMacro() function, together with their rootmaps,...
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual int MakeDirectory(const char *name)
Make a directory.
TString fBuildCompilerVersionStr
virtual const char * ExpandFileName(const char *fname)
Expand a pathname getting rid of special shell characters like ~.
TSystem(const TSystem &)=delete
virtual TInetAddress GetPeerName(int sock)
Get Internet Protocol (IP) address of remote host and port #.
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual int GetSysInfo(SysInfo_t *info) const
Returns static system info, like OS type, CPU type, number of CPUs RAM size, etc into the SysInfo_t s...
virtual int GetMemInfo(MemInfo_t *info) const
Returns ram and swap memory usage info into the MemInfo_t structure.
virtual EAclicMode GetAclicMode() const
AclicMode indicates whether the library should be built in debug mode or optimized.
virtual const char * GetLinkedLibraries()
Get list of shared libraries loaded at the start of the executable.
virtual void SetIncludePath(const char *includePath)
IncludePath should contain the list of compiler flags to indicate where to find user defined header f...
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual void ListSymbols(const char *module, const char *re="")
List symbols in a shared library.
virtual void DoBeep(Int_t=-1, Int_t=-1) const
virtual int GetCpuInfo(CpuInfo_t *info, Int_t sampleTime=1000) const
Returns cpu load average and load info into the CpuInfo_t structure.
virtual void ListLibraries(const char *regexp="")
List the loaded shared libraries.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
virtual void SetMakeSharedLib(const char *directives)
Directives should contain the description on how to compile and link a shared lib.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual void InnerLoop()
Inner event loop.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual int OpenConnection(const char *server, int port, int tcpwindowsize=-1, const char *protocol="tcp")
Open a connection to another host.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual void IgnoreSignal(ESignals sig, Bool_t ignore=kTRUE)
If ignore is true ignore the specified signal, else restore previous behaviour.
virtual void Run()
System event loop.
virtual int GetSockOpt(int sock, int kind, int *val)
Get socket option.
virtual void ExitLoop()
Exit from event loop.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual std::string GetHomeDirectory(const char *userName=nullptr) const
Return the user's home directory.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual int RecvRaw(int sock, void *buffer, int length, int flag)
Receive exactly length bytes into buffer.
virtual Bool_t Init()
Initialize the OS interface.
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
virtual const char * GetBuildCompilerVersionStr() const
Return the build compiler version identifier string.
static Int_t GetCryptoRandom(void *buf, Int_t len)
Return cryptographic random number Fill provided buffer with random values.
virtual void DispatchOneEvent(Bool_t pendingOnly=kFALSE)
Dispatch a single event.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void AddSignalHandler(TSignalHandler *sh)
Add a signal handler to list of system signal handlers.
virtual const char * GetDynamicPath()
Return the dynamic path (used to find shared libraries).
TSeqCollection * fSignalHandler
virtual const char * GetMakeExe() const
Return the command line use to make an executable.
virtual const char * FindDynamicLibrary(TString &lib, Bool_t quiet=kFALSE)
Find a dynamic library using the system search paths.
virtual TString GetFromPipe(const char *command, Int_t *ret=nullptr, Bool_t redirectStderr=kFALSE)
Execute command and return output in TString.
virtual void SetFlagsDebug(const char *)
FlagsDebug should contain the options to pass to the C++ compiler in order to compile the library in ...
virtual void Exit(int code, Bool_t mode=kTRUE)
Exit the application.
virtual Int_t GetGid(const char *group=nullptr)
Returns the group's id. If group = 0, returns current user's group.
virtual void SetMakeExe(const char *directives)
Directives has the same syntax as the argument of SetMakeSharedLib but is used to create an executabl...
TSeqCollection * fCompiled
TString fBuildCompilerVersion
TSystem * FindHelper(const char *path, void *dirptr=nullptr)
Create helper TSystem to handle file and directory operations that might be special for remote file a...
virtual const char * GetFlagsDebug() const
Return the debug flags.
virtual const char * HostName()
Return the system's host name.
virtual void Unsetenv(const char *name)
Unset environment variable.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual void AddDynamicPath(const char *pathname)
Add a new directory to the dynamic path.
virtual Int_t Select(TList *active, Long_t timeout)
Select on active file descriptors (called by TMonitor).
TSeqCollection * fOnExitList
virtual const char * GetObjExt() const
Get the object file extension.
virtual int AnnounceUnixService(int port, int backlog)
Announce unix domain service.
virtual Int_t GetUid(const char *user=nullptr)
Returns the user's id. If user = 0, returns current user's id.
virtual Int_t GetEffectiveUid()
Returns the effective user id.
virtual const char * GetLinkdefSuffix() const
Return the linkdef suffix chosen by the user for ACLiC.
virtual void SetDynamicPath(const char *pathname)
Set the dynamic path to a new value.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual int CompileMacro(const char *filename, Option_t *opt="", const char *library_name="", const char *build_dir="", UInt_t dirmode=0)
This method compiles and loads a shared library containing the code from the file "filename".
virtual const char * WorkingDirectory()
Return working directory.
virtual void AddStdExceptionHandler(TStdExceptionHandler *eh)
Add an exception handler to list of system exception handlers.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
virtual void SetProgname(const char *name)
Set the application name (from command line, argv[0]) and copy it in gProgName.
virtual int SendRaw(int sock, const void *buffer, int length, int flag)
Send exactly length bytes from buffer.
virtual Int_t SetFPEMask(Int_t mask=kDefaultMask)
Set which conditions trigger a floating point exception.
virtual const char * GetBuildCompiler() const
Return the build compiler.
virtual void CloseConnection(int sock, Bool_t force=kFALSE)
Close socket connection.
virtual const char * GetLibraries(const char *regexp="", const char *option="", Bool_t isRegexp=kTRUE)
Return a space separated list of loaded shared libraries.
void SetErrorStr(const char *errstr)
Set the system error string.
virtual TSignalHandler * RemoveSignalHandler(TSignalHandler *sh)
Remove a signal handler from list of signal handlers.
virtual void SetSoExt(const char *soExt)
Set shared library extension, should be either .so, .sl, .a, .dll, etc.
virtual void Closelog()
Close connection to system log daemon.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
virtual const char * GetBuildArch() const
Return the build architecture.
virtual int Link(const char *from, const char *to)
Create a link from file1 to file2.
virtual void SigAlarmInterruptsSyscalls(Bool_t)
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual void SetLinkedLibs(const char *linkedLibs)
LinkedLibs should contain the library directory and list of libraries needed to recreate the current ...
virtual std::string GetWorkingDirectory() const
Return working directory.
virtual void SetBuildDir(const char *build_dir, Bool_t isflat=kFALSE)
Set the location where ACLiC will create libraries and use as a scratch area.
static const char * StripOffProto(const char *path, const char *proto)
Strip off protocol string from specified path.
virtual void Abort(int code=0)
Abort the application.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual const char * GetSoExt() const
Get the shared library extension.
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.
virtual const char * GetError()
Return system error string.
virtual int AnnounceTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize=-1, ESocketBindOption socketBindOption=ESocketBindOption::kInaddrAny)
Announce TCP/IP service.
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual Int_t GetFPEMask()
Return the bitmap of conditions that trigger a floating point exception.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual void StackTrace()
Print a stack trace.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual int AnnounceUdpService(int port, int backlog, ESocketBindOption socketBindOption=ESocketBindOption::kInaddrAny)
Announce UDP service.
virtual void ResetSignals()
Reset signals handlers to previous behaviour.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
virtual const char * GetFlagsOpt() const
Return the optimization flags.
virtual Bool_t ConsistentWith(const char *path, void *dirptr=nullptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
Basic time type with millisecond precision.
Handles synchronous and a-synchronous timer events.
virtual void TurnOn()
Add the timer to the system timer list.
void Reset()
Reset the timer.
Bool_t IsInterruptingSyscalls() const
This class represents a WWW compatible URL.
const char * GetUser() const
const char * GetHost() const
const char * GetProtocol() const
TVersionCheck(int versionCode)
Register version of plugin library.
This class implements a mutex interface.
std::string GetCurrentDir()
std::string MakePathRelative(const std::string &path, const std::string &base, bool isBuildingROOT=false)
bool GetCryptoRandom(void *buf, unsigned int len)
Get random bytes from the operating system's cryptographic random number generator The requested numb...
R__EXTERN TVirtualRWMutex * gCoreMutex