35 static void Tokenize(
const G4String& str, std::vector<G4String>& tokens)
37 const char* delimiter =
" ";
39 str_size pos0 = str.find_first_not_of(delimiter);
40 str_size pos = str.find_first_of(delimiter, pos0);
42 while (pos != G4String::npos || pos0 != G4String::npos) {
43 if (str[pos0] ==
'\"') {
44 pos = str.find_first_of(
"\"", pos0+1);
45 if(pos != G4String::npos) pos++;
47 if (str[pos0] ==
'\'') {
48 pos = str.find_first_of(
"\'", pos0+1);
49 if(pos != G4String::npos) pos++;
52 tokens.push_back(str.substr(pos0, pos-pos0));
53 pos0 = str.find_first_not_of(delimiter, pos);
54 pos = str.find_first_of(delimiter, pos0);
65 G4cerr <<
"cannot open a macro file(" << fname <<
")."
94 while ((nb= cmdline.find(
'\t',nb)) != G4String::npos) {
102 if(!qcontinued && cmdline.size() == 0)
continue;
105 if(cmdline(0) ==
'#')
return cmdline;
108 std::vector<G4String> tokens;
109 Tokenize(cmdline, tokens);
111 for (
G4int i = 0; i <
G4int(tokens.size()); i++) {
113 if(tokens[i](0) ==
'#' )
break;
115 if(tokens[i] ==
'\\' || tokens[i] ==
'_' ) {
118 if( i !=
G4int(tokens.size())-1) {
120 "unexpected character after line continuation character");
124 cmdtotal += tokens[i];
128 if(qcontinued)
continue;
130 if(cmdtotal.size() != 0)
break;
152 g4MPI-> BcastCommand(
"exit");
161 scommand =
g4MPI-> BcastCommand(newCommand);
162 if(scommand ==
"exit") {
163 g4MPI-> WaitBeamOn();
168 if( scommand(0) ==
'#') {