IsArgMacroFile.h File Reference

#include "TString.h"

Go to the source code of this file.

Functions

TString IsArgMacroFile (const char *arg)

Function Documentation

TString IsArgMacroFile ( const char *  arg  ) 

Definition at line 3 of file IsArgMacroFile.cxx.

References len.

Referenced by JobCRootEnv::JobCRootEnv(), and JobCEnv::ProcessCommandLine().

00004 {
00005    // interpret arg as file name of a macro
00006    // allowing for possiblility of ACLiC invocation and arguments
00007    // return empty string if it doesn't look like a macro.
00008 
00009   int len = strlen(arg);
00010 
00011   // simple endings
00012   if ( strcmp(arg+len-2,".C")   == 0 ) return TString(arg);
00013   if ( strcmp(arg+len-2,".c")   == 0 ) return TString(arg);
00014   if ( strcmp(arg+len-3,".cc")  == 0 ) return TString(arg);
00015   if ( strcmp(arg+len-4,".cxx") == 0 ) return TString(arg);
00016 
00017   // ACLiC invocation
00018   if ( strcmp(arg+len-3,".C+")  == 0 ) return TString(arg,len-1);
00019   if ( strcmp(arg+len-4,".C++") == 0 ) return TString(arg,len-2);
00020 
00021   // macro with supplied arguments
00022   if ( strcmp(arg+len-1,")") == 0 ) {
00023     const char* argstart = strstr(arg,"(");
00024     len = argstart-arg;
00025 
00026     // normal file endings, before the arguments
00027     if ( strncmp(arg+len-2,".C",2)   == 0 ) return TString(arg,len);
00028     if ( strncmp(arg+len-2,".c",2)   == 0 ) return TString(arg,len);
00029     if ( strncmp(arg+len-3,".cc",3)  == 0 ) return TString(arg,len);
00030     if ( strncmp(arg+len-4,".cxx",4) == 0 ) return TString(arg,len);
00031     
00032     // ACLiC invocation before the arguments
00033     if ( strncmp(arg+len-3,".C+",3)  == 0 ) return TString(arg,len-1);
00034     if ( strncmp(arg+len-4,".C++",4) == 0 ) return TString(arg,len-2);
00035 
00036   }
00037 
00038   // nothing appropriate
00039   return "";
00040 }


Generated on 22 Nov 2017 for loon by  doxygen 1.6.1