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 <<
")."
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) ==
'#' ) {