39 :currentDirectory(
"/")
49 G4String rawCommandLine = aCommandLine;
50 if(rawCommandLine.
isNull()||rawCommandLine(0)==
'\0')
return rawCommandLine;
54 size_t i = commandLine.
index(
" ");
55 if( i != std::string::npos )
57 commandString = commandLine(0,i);
58 parameterString =
" ";
59 parameterString += commandLine(i+1,commandLine.length()-(i+1));
62 { commandString = commandLine; }
66 return fullPathCommandLine;
79 if( newDirectory( newDirectory.length() - 1 ) !=
'/' )
80 { newDirectory +=
"/"; }
92 if( targetDir( targetDir.length()-1 ) !=
'/' )
95 if( targetDir ==
"/" )
98 while( idx < targetDir.length()-1 )
100 size_t i = targetDir.
index(
"/",idx);
101 comTree = comTree->
GetTree(targetDir.substr(0,i+1).c_str());
102 if( comTree == NULL )
111 G4String rawCommandLine = commandName;
114 size_t i = commandLine.
index(
" ");
115 if( i != std::string::npos )
116 { commandString = commandLine(0,i); }
118 { commandString = commandLine; }
126 if( tempPath.length() == 0 )
return tempPath;
131 if( tempPath(0) ==
'/') newPath = tempPath;
136 size_t idx = newPath.find(
"/./");
137 if( idx == G4String::npos)
break;
138 newPath.erase(idx,2);
142 size_t idx = newPath.find(
"/../");
143 if( idx == G4String::npos)
break;
148 size_t idx2 = newPath.find_last_of(
'/', idx-1);
149 if(idx2 != G4String::npos) newPath.erase(idx2, idx-idx2+3);
153 if ( newPath.size() >= 3 ) {
154 if(newPath(newPath.size()-3,3) ==
"/..") {
155 if( newPath.size() == 3) {
158 size_t idx = newPath.find_last_of(
'/', newPath.size()-4);
159 if(idx != G4String::npos) newPath.erase(idx+1);
164 if ( newPath.size() >= 2 ) {
165 if(newPath(newPath.size()-2,2) ==
"/.") newPath.erase(newPath.size()-1,1);
170 size_t idx = newPath.find(
"//");
171 if( idx == G4String::npos)
break;
172 newPath.erase(idx,1);
182 G4String rawCommandLine = commandName;
184 size_t i = commandLine.
index(
" ");
185 if( i != std::string::npos )
return rawCommandLine;
187 G4String commandString = commandLine;
191 if(value==
"")
return rawCommandLine;
198 return aTree-> CompleteCommandPath(aCommandPath);
210 if(aCommand.length()<2)
return;
214 switch(commandStatus) {
218 G4cerr <<
"command not found: " <<
"\"" << aCommand <<
"\"" <<
G4endl;
221 G4cerr <<
"illegal application state -- command refused:" <<
"\"" << aCommand <<
"\"" <<
G4endl;
227 G4cerr <<
"command refused (" << commandStatus <<
"):" <<
"\"" << aCommand <<
"\"" <<
G4endl;
243 if( command(0) ==
'#' ) {
247 }
else if( command ==
"ls" || command(0,3) ==
"ls " ) {
251 }
else if( command ==
"pwd" ) {
253 G4cout <<
"Current Working Directory : "
256 }
else if( command ==
"cd" || command(0,3) ==
"cd ") {
260 }
else if( command ==
"help" || command(0,5) ==
"help ") {
264 }
else if( command(0) ==
'?' ) {
268 }
else if( command ==
"hist" || command ==
"history") {
271 for(
G4int i=0;i<nh;i++) {
275 }
else if( command(0) ==
'!' ) {
277 G4String ss = command(1,command.length()-1);
280 std::istringstream is(tt);
288 G4cerr <<
"history " << vl <<
" is not found." <<
G4endl;
291 }
else if( command ==
"exit" ) {
293 if( exitPause ==
false) {
295 G4cout <<
"Please abort it using \"/run/abort\" command first" <<
G4endl;
296 G4cout <<
" and use \"continue\" command until the application" <<
G4endl;
302 }
else if( command ==
"cont" || command ==
"continue"){
317 G4String comString = newCommand.substr(1,newCommand.length()-1);
321 G4cout <<
"Current value(s) of the parameter(s) : " << curV <<
G4endl;
328 if( newCommand.length() <= 3 ) {
331 G4String aNewPrefix = newCommand.substr(3, newCommand.length()-3);
335 G4cout <<
"directory <" << prefix <<
"> not found." <<
G4endl;
342 if( newCommand.length() <= 3 ) {
345 G4String newPrefix = newCommand.substr(3, newCommand.length()-3);
349 if( commandTree == NULL ) {
350 G4cout <<
"Directory <" << targetDir <<
"> is not found." <<
G4endl;
360 size_t i = newCommand.
index(
" ");
361 if( i != std::string::npos )
363 G4String newValue = newCommand.substr(i+1, newCommand.length()-(i+1));
367 if( theCommand != NULL )
374 G4cout <<
"Command <" << newValue <<
" is not found." <<
G4endl;
382 size_t prefixIndex = 1;
384 while( prefixIndex < prefix.length()-1 )
386 size_t ii = prefix.
index(
"/",prefixIndex);
399 G4cout << G4endl <<
"Not a number, once more" <<
G4endl;
402 if( iFloor < (
size_t)-j ) iFloor = 0;
414 if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
421 floor[iFloor+1] = floor[iFloor]->
GetTree(j);