40 const char* delimiter =
" ";
42 str_size pos0 = str.find_first_not_of(delimiter);
45 while (pos != G4String::npos || pos0 != G4String::npos) {
46 if (str[pos0] ==
'\"') {
47 pos = str.find_first_of(
"\"", pos0+1);
48 if(pos != G4String::npos) pos++;
50 if (str[pos0] ==
'\'') {
51 pos = str.find_first_of(
"\'", pos0+1);
52 if(pos != G4String::npos) pos++;
55 tokens.push_back(str.substr(pos0, pos-pos0));
56 pos0 = str.find_first_not_of(delimiter, pos);
57 pos = str.find_first_of(delimiter, pos0);
70 G4cerr <<
"cannot open a macro file(" << fname <<
")."
87 enum { BUFSIZE = 4096 };
88 static char linebuf[BUFSIZE];
99 while ((nb= cmdline.find(
'\t',nb)) != G4String::npos) {
107 if( !qcontinued && cmdline.size() == 0 )
continue;
110 if( cmdline(0) ==
'#' )
return cmdline;
113 std::vector<G4String> tokens;
116 for(
G4int i = 0; i <
G4int(tokens.size()); i++ ) {
118 if( tokens[i](0) ==
'#' )
break;
120 if( tokens[i] ==
'\\' || tokens[i] ==
'_' ) {
123 if( i !=
G4int(tokens.size())-1 ) {
125 "unexpected character after line continuation character");
129 cmdtotal += tokens[i];
133 if( qcontinued )
continue;
135 if( cmdtotal.size() != 0 )
break;
157 g4mpi_-> BcastCommand(
"exit");
166 scommand =
g4mpi_-> BcastCommand(newCommand);
167 if( scommand ==
"exit" ) {
173 if( scommand(0) ==
'#' ) {
G4MPIbatch(const G4String &fname="", G4bool qbatch=false)
static const G4double pos
G4String BypassCommand(const G4String &command) const
G4String & replace(unsigned int, unsigned int, const char *, unsigned int)
static G4UImanager * GetUIpointer()
G4String strip(G4int strip_Type=trailing, char c=' ')
G4GLOB_DLL std::ostream G4cerr
virtual G4UIsession * SessionStart()
static void Tokenize(const G4String &str, std::vector< G4String > &tokens)
G4int ExecCommand(const G4String &acommand)
std::string::size_type str_size
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
std::ifstream batch_stream_