149 G4int wsiz = wordlist.size();
151 for (ii = 0; ii < wsiz; ii++)
157 const G4int NMAXLIN = 1000;
161 (theLineNo[theCurrentFile])++;
162 for ( ii = 0; ii < NMAXLIN; ii++) { ltemp[ii] =
' '; }
163 theFiles[theCurrentFile]->getline( ltemp, NMAXLIN );
166 for ( ii=0; ii < NMAXLIN; ii++)
168 if ( ltemp[ii] ==
'\0' ) {
break; }
170 if ( ii == NMAXLIN-1 )
173 G4String ErrMessage =
"Too long line. Please split it "
174 +
G4String(
"putting a '\\' at the end!");
175 G4Exception(
"G4tgrFileIn::GetWordsInLine()",
"InvalidInput",
186 std::istringstream istr_line(ltemp);
196 if( *tt !=
' ' && *(tt) !=
'\0' )
204 G4cout <<
"G4tgrFileIn::GetWordsInLine() - NoWords"
205 << NoWords << ltemp <<
G4endl;
209 else if( *(tt-1) ==
' ' || *(tt-1) ==
'\015' || *(tt-1) ==
'\t')
215 G4cout <<
"G4tgrFileIn::GetWordsInLine() - NoWords"
216 << NoWords << ltemp <<
G4endl;
222 }
while((*tt !=
'\0') && (stemp.length()!=0));
224 if(stemp.length() == 0) { NoWords = 0; }
227 for( ii=0; ii < NoWords; ii++)
231 if ( stemp.length() == 0 ) {
break; }
236 G4cout <<
"!!!COMMENT" << comment << stemp.c_str() <<
G4endl;
243 else if ( comment > 0 )
245 stemp = stemp.substr( 0, comment );
246 wordlist.push_back(stemp);
249 wordlist.push_back(stemp);
261 if ( wordlist.size() != 0 )
263 if( (*(wordlist.end()-1)).compare(
"\\") == 0 )
276 std::vector<G4String> wordlist2;
278 unsigned int imerge = 0;
279 for(
size_t jj = 0; jj < wordlist.size(); jj++)
281 if( wordlist[jj].substr(0,1) ==
"\"" )
285 if( wordlist[jj][ wordlist[jj].size()-1 ] ==
'\"' )
289 G4String err1 =
" word with trailing '\"' while there is no";
290 G4String err2 =
" previous word with leading '\"' in line ";
298 wordlist2.push_back( wordlist[jj] );
300 else if( imerge == 1 )
304 wordq.
append( wordlist[jj].substr(1,wordlist[jj].size()) );
308 wordq.
append( wordlist[jj].substr(0,wordlist[jj].size()) );
312 else if( imerge == 2 )
316 wordq.
append( wordlist[jj].substr(1,wordlist[jj].size()-2));
320 wordq.
append( wordlist[jj].substr(0,wordlist[jj].size()-1) );
322 wordlist2.push_back( wordq );
329 G4String err1 =
" word with leading '\"' in line while there is no";
330 G4String err2 =
" later word with trailing '\"' in line ";
335 wordlist = wordlist2;
342 if( wordlist[0] ==
"#include" )
344 if( wordlist.size() != 2 )
348 =
"'#include' should have as second argument, the filename !";
349 G4Exception(
"G4tgrFileIn::GetWordsInLine()",
"InvalidInput",
356 G4cout <<
" G4tgrFileIn::GetWordsInLine() - Include found !" <<
G4endl;
G4int GetWordsInLine(std::vector< G4String > &wl)
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void DumpException(const G4String &sent)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void OpenNewFile(const char *filename)
G4String & append(const G4String &)