102 if(aCommand.length()<2)
return;
104 G4int paramIndex = returnVal % 100;
105 G4int commandStatus = returnVal - paramIndex;
109 switch(commandStatus) {
117 G4cerr <<
"illegal application state -- command refused" <<
G4endl;
121 G4cerr <<
"Parameter is wrong type and/or is not omittable (index " << paramIndex <<
")" <<
G4endl;
124 G4cerr <<
"Parameter is out of candidate list (index " << paramIndex <<
")" <<
G4endl;
129 G4cerr <<
"command refused (" << commandStatus <<
")" <<
G4endl;
132 switch(commandStatus) {
151 G4cout <<
"@@ErrResult \"Illegal application state -- command refused\"" <<
G4endl;
154 G4cout <<
"@@ErrResult \"Parameter Out of Range.\"" <<
G4endl;
157 G4cout <<
"@@ErrResult \"Parameter is wrong type and/or is not omittable.\"" <<
G4endl;
161 G4cout <<
"@@ErrResult \"Parameter Out of Candidates.\"" <<
G4endl;
165 G4cout <<
"@@ErrResult \"command refused (" << commandStatus <<
")\"" <<
G4endl;
173 std::cout << coutString << std::flush;
179 std::cerr << cerrString << std::flush;
204 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
207 if( newCommand.length() < 1) {
break; }
209 while( newCommand(newCommand.length()-1) ==
'_' )
212 newCommand.
remove(newCommand.length()-1);
214 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
215 newCommand.
append(newLine);
219 if( nC.length() < 1) {
break; }
222 if( nC ==
"@@GAGmodeJAVA" ) {
228 else if( nC ==
"@@GAGmodeTcl" ) {
234 else if( nC(0) ==
'#' )
237 else if( nC ==
"ls" || nC(0,3) ==
"ls " )
239 else if( nC ==
"pwd" )
241 else if( nC(0,2) ==
"cd" || nC(0,3) ==
"cd " )
243 else if( nC ==
"help" || nC(0,5) ==
"help ")
245 else if( nC(0) ==
'?' )
247 else if( nC(0,4) ==
"hist" || nC ==
"history")
250 for(
int i=0;i<nh;i++)
253 else if( nC(0) ==
'!' )
258 std::istringstream is((
char*)tt);
268 {
G4cerr <<
"history " << vl <<
" is not found." <<
G4endl; }
270 else if( nC(0,4) ==
"exit" )
276 G4cerr <<
"Please abort it using \"/run/abort\" command first" <<
G4endl;
277 G4cerr <<
" and use \"continue\" command until the application" <<
G4endl;
280 G4cout <<
"@@ErrResult \"You are now processing RUN.\"" <<
G4endl;
286 newCommand = nullString;
290 else if( nC ==
"cont" || nC ==
"continue" )
293 newCommand = nullString;
308 if( newCommand(0) ==
'/' )
309 { tmpString = newCommand; }
310 else if( newCommand(0,3) ==
"../" )
313 unsigned i_direc = 0;
314 while( i_direc < newCommand.length() )
316 if( newCommand(i_direc,3) ==
"../" )
325 tmpString.
append( newCommand( i_direc, newCommand.length()-i_direc ) );
331 tmpString.
append( newCommand );
345 if( ! (curV.
isNull()||curV(0)==
'\0' ) ) {
347 G4cout <<
"Current value(s) of the parameter(s) : " << curV <<
G4endl;
354 G4cout <<
"@@ErrResult \"Current value is not available.\"" <<
G4endl;
361 if( newCommand.length() <= 3 )
365 G4String aNewPrefix = newCommand.substr(3,newCommand.length()-3);
367 if( newPrefix(0) ==
'/' )
369 else if( newPrefix(0) !=
'.' )
388 if( newCommand.length() <= 3 )
392 G4String newPrefix = newCommand.substr(3,newCommand.length()-3);
394 if( newPrefix(0) ==
'/' )
395 { targetDir = newPrefix; }
396 else if( newPrefix(0) !=
'.' )
399 targetDir += newPrefix;
404 if( targetDir( targetDir.length() - 1 ) !=
'/' )
405 { targetDir +=
"/"; }
407 if( commandTree == NULL )
408 {
G4cout <<
"Directory <" << targetDir <<
"> is not found." <<
G4endl; }
417 if( i != std::string::npos )
419 G4String newValue = newCommand.substr(i+1,newCommand.length()-(i+1));
421 if( newValue(0) !=
'/' )
424 if( theCommand != NULL )
431 G4cout <<
"Command <" << newValue <<
" is not found." <<
G4endl;
439 unsigned prefixIndex = 1;
440 while( prefixIndex <
prefix.length()-1 )
442 int ii =
prefix.index(
"/",prefixIndex);
452 G4cout <<
G4endl <<
"Type the number ( 0:end, -n:n level back ) : "<<std::flush;
456 G4cin.ignore(30,
'\n');
460 if( iFloor < 0 ) iFloor = 0;
462 else if(j == 0) {
break;}
467 if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
475 floor[iFloor+1] = floor[iFloor]->
GetTree(i);
486 G4cin.getline( temp, 100 );
494 if( newCommand.substr(0,2) ==
".." )
496 if( newPrefix !=
"/" )
498 G4String tmpString = newPrefix(0,newPrefix.length()-1);
499 newPrefix = newPrefix(0,tmpString.
last(
'/')+1);
504 newPrefix += newCommand;
507 if( newCommand ==
".." || newCommand ==
"../" )
509 newCommand = newCommand.substr(3,newCommand.length()-3);
518 while( idx < newCommand.length()-1 )
520 int i = newCommand.
index(
"/",idx);
522 if( comTree == NULL )
564 int treeEntry, commandEntry;
569 for(
int i=0; i<commandEntry; i++){
573 if(treeEntry == 0)
return;
575 for(
int j=0; j<treeEntry; j++){
582 int treeEntry, commandEntry, i;
589 for(i=0; i<commandEntry; i++) {
592 if( treeEntry == 0 )
return;
594 for(i=0; i< treeEntry; i++) {
605 int guidanceEntry, parameterEntry;
614 for (
int j=0; j<guidanceEntry; j++){
618 for(
int i=0; i< (
int)title.length(); i++){
621 if ( c[0] ==
'\n' || c[0] ==
'\r') {
631 for(
int par=0; par<parameterEntry; par++) {
646 int treeEntry, commandEntry;
651 for(
int com=0; com<commandEntry; com++) {
657 if( treeEntry == 0 )
return;
659 for(
int i=0; i<treeEntry; i++) {
670 int treeEntry, commandEntry, guidanceEntry;
673 G4String commandPath, pathName, title1, title2;
677 for(
int com=0; com<commandEntry; com++){
682 if (guidanceEntry == 0){
683 title2 =
"...Title not available...";
689 for(i=0; i< (
int)title1.length(); i++){
695 }
else if ( c[0] ==
'\n' || c[0] ==
'\r') {
700 if (j >= guidanceEntry)
break;
704 G4cout << commandPath <<
" @@title \""<< title2 <<
"\""<<
G4endl;
707 if(treeEntry == 0)
return;
709 for(i=0; i< treeEntry; i++){
714 for(
int k=0;
k<(
int)title1.length();
k++){
724 G4cout << pathName <<
" @@title \"" << title1 <<
"\""<<
G4endl;
731 int treeEntry, commandEntry;
736 for(
int com=0; com<commandEntry; com++) {
740 if( treeEntry == 0 )
return;
742 for(
int i=0; i<treeEntry; i++) {
755 G4cout << commandPath <<
" @@param " << parameterEntry <<
G4endl;
756 G4cout <<
"@@command_range \"" << commandRange <<
"\"" <<
G4endl;
757 for(
int par=0; par<parameterEntry; par++) {
764 for(
int i=0; i<(
int)guide1.length(); i++){
772 G4cout <<
" @@param_guide : \"" << guide2 <<
"\""<<
G4endl;
790 G4cout <<
"@@State \"" << stateString <<
"\"" <<
G4endl;
818 if( newState != previousState )
821 previousState = newState;
831 for( i=0; i<pEntry; i++) {
832 for( j=0; j<nEntry; j++) {
840 for( i=0; i<nEntry; i++) {
841 for( j=0; j<pEntry; j++) {
865 for(
int com=0; com<commandEntry; com++){
871 if(treeEntry == 0)
return;
873 for(
int i=0; i< treeEntry; i++){
891 if (pEntry != nEntry)
return;
892 for( i=0; i<nEntry; i++) {
896 <<
" command is updated." <<
G4endl;
947 for(
int com=0; com<commandEntry; com++) {
951 param = commandPath +
" ";
952 for(
int par=0; par< parameterEntry; par++) {
964 if( treeEntry == 0 )
return;
965 for(
int i=0; i< treeEntry; i++) {