103 if(aCommand.length()<2)
return;
105 G4int paramIndex = returnVal % 100;
106 G4int commandStatus = returnVal - paramIndex;
110 switch(commandStatus) {
118 G4cerr <<
"illegal application state -- command refused" <<
G4endl;
122 G4cerr <<
"Parameter is wrong type and/or is not omittable (index " << paramIndex <<
")" <<
G4endl;
125 G4cerr <<
"Parameter is out of candidate list (index " << paramIndex <<
")" <<
G4endl;
130 G4cerr <<
"command refused (" << commandStatus <<
")" <<
G4endl;
133 switch(commandStatus) {
152 G4cout <<
"@@ErrResult \"Illegal application state -- command refused\"" <<
G4endl;
155 G4cout <<
"@@ErrResult \"Parameter Out of Range.\"" <<
G4endl;
158 G4cout <<
"@@ErrResult \"Parameter is wrong type and/or is not omittable.\"" <<
G4endl;
162 G4cout <<
"@@ErrResult \"Parameter Out of Candidates.\"" <<
G4endl;
166 G4cout <<
"@@ErrResult \"command refused (" << commandStatus <<
")\"" <<
G4endl;
174 std::cout << coutString << std::flush;
180 std::cerr << cerrString << std::flush;
205 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
208 if( newCommand.length() < 1) {
break; }
210 while( newCommand(newCommand.length()-1) ==
'_' )
213 newCommand.
remove(newCommand.length()-1);
215 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
216 newCommand.
append(newLine);
220 if( nC.length() < 1) {
break; }
223 if( nC ==
"@@GAGmodeJAVA" ) {
229 else if( nC ==
"@@GAGmodeTcl" ) {
235 else if( nC(0) ==
'#' )
238 else if( nC ==
"ls" || nC(0,3) ==
"ls " )
240 else if( nC ==
"pwd" )
242 else if( nC(0,2) ==
"cd" || nC(0,3) ==
"cd " )
244 else if( nC ==
"help" || nC(0,5) ==
"help ")
246 else if( nC(0) ==
'?' )
248 else if( nC(0,4) ==
"hist" || nC ==
"history")
251 for(
int i=0;i<nh;i++)
254 else if( nC(0) ==
'!' )
259 std::istringstream is((
char*)tt);
269 {
G4cerr <<
"history " << vl <<
" is not found." <<
G4endl; }
271 else if( nC(0,4) ==
"exit" )
277 G4cerr <<
"Please abrot it using \"/run/abort\" command first" <<
G4endl;
278 G4cerr <<
" and use \"continue\" command until the application" <<
G4endl;
281 G4cout <<
"@@ErrResult \"You are now processing RUN.\"" <<
G4endl;
287 newCommand = nullString;
291 else if( nC ==
"cont" || nC ==
"continue" )
294 newCommand = nullString;
309 if( newCommand(0) ==
'/' )
310 { tmpString = newCommand; }
311 else if( newCommand(0,3) ==
"../" )
314 unsigned i_direc = 0;
315 while( i_direc < newCommand.length() )
317 if( newCommand(i_direc,3) ==
"../" )
326 tmpString.
append( newCommand( i_direc, newCommand.length()-i_direc ) );
332 tmpString.
append( newCommand );
346 if( ! (curV.
isNull()||curV(0)==
'\0' ) ) {
348 G4cout <<
"Current value(s) of the parameter(s) : " << curV <<
G4endl;
355 G4cout <<
"@@ErrResult \"Current value is not available.\"" <<
G4endl;
362 if( newCommand.length() <= 3 )
366 G4String aNewPrefix = newCommand.substr(3,newCommand.length()-3);
368 if( newPrefix(0) ==
'/' )
370 else if( newPrefix(0) !=
'.' )
389 if( newCommand.length() <= 3 )
393 G4String newPrefix = newCommand.substr(3,newCommand.length()-3);
395 if( newPrefix(0) ==
'/' )
396 { targetDir = newPrefix; }
397 else if( newPrefix(0) !=
'.' )
400 targetDir += newPrefix;
405 if( targetDir( targetDir.length() - 1 ) !=
'/' )
406 { targetDir +=
"/"; }
408 if( commandTree == NULL )
409 {
G4cout <<
"Directory <" << targetDir <<
"> is not found." <<
G4endl; }
418 if( i != std::string::npos )
420 G4String newValue = newCommand.substr(i+1,newCommand.length()-(i+1));
422 if( newValue(0) !=
'/' )
425 if( theCommand != NULL )
432 G4cout <<
"Command <" << newValue <<
" is not found." <<
G4endl;
440 unsigned prefixIndex = 1;
441 while( prefixIndex <
prefix.length()-1 )
443 int ii =
prefix.index(
"/",prefixIndex);
453 G4cout <<
G4endl <<
"Type the number ( 0:end, -n:n level back ) : "<<std::flush;
457 G4cin.ignore(30,
'\n');
461 if( iFloor < 0 ) iFloor = 0;
463 else if(j == 0) {
break;}
468 if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
476 floor[iFloor+1] = floor[iFloor]->
GetTree(i);
487 G4cin.getline( temp, 100 );
495 if( newCommand.substr(0,2) ==
".." )
497 if( newPrefix !=
"/" )
499 G4String tmpString = newPrefix(0,newPrefix.length()-1);
500 newPrefix = newPrefix(0,tmpString.
last(
'/')+1);
505 newPrefix += newCommand;
508 if( newCommand ==
".." || newCommand ==
"../" )
510 newCommand = newCommand.substr(3,newCommand.length()-3);
519 while( idx < newCommand.length()-1 )
521 int i = newCommand.
index(
"/",idx);
523 if( comTree == NULL )
565 int treeEntry, commandEntry;
570 for(
int i=0; i<commandEntry; i++){
574 if(treeEntry == 0)
return;
576 for(
int j=0; j<treeEntry; j++){
583 int treeEntry, commandEntry, i;
590 for(i=0; i<commandEntry; i++) {
593 if( treeEntry == 0 )
return;
595 for(i=0; i< treeEntry; i++) {
606 int guidanceEntry, parameterEntry;
615 for (
int j=0; j<guidanceEntry; j++){
619 for(
int i=0; i< (
int)title.length(); i++){
622 if ( c[0] ==
'\n' || c[0] ==
'\r') {
632 for(
int par=0; par<parameterEntry; par++) {
647 int treeEntry, commandEntry;
652 for(
int com=0; com<commandEntry; com++) {
658 if( treeEntry == 0 )
return;
660 for(
int i=0; i<treeEntry; i++) {
671 int treeEntry, commandEntry, guidanceEntry;
674 G4String commandPath, pathName, title1, title2;
678 for(
int com=0; com<commandEntry; com++){
683 if (guidanceEntry == 0){
684 title2 =
"...Title not available...";
690 for(i=0; i< (
int)title1.length(); i++){
696 }
else if ( c[0] ==
'\n' || c[0] ==
'\r') {
701 if (j >= guidanceEntry)
break;
705 G4cout << commandPath <<
" @@title \""<< title2 <<
"\""<<
G4endl;
708 if(treeEntry == 0)
return;
710 for(i=0; i< treeEntry; i++){
715 for(
int k=0; k<(
int)title1.length(); k++){
725 G4cout << pathName <<
" @@title \"" << title1 <<
"\""<<
G4endl;
732 int treeEntry, commandEntry;
737 for(
int com=0; com<commandEntry; com++) {
741 if( treeEntry == 0 )
return;
743 for(
int i=0; i<treeEntry; i++) {
756 G4cout << commandPath <<
" @@param " << parameterEntry <<
G4endl;
757 G4cout <<
"@@command_range \"" << commandRange <<
"\"" <<
G4endl;
758 for(
int par=0; par<parameterEntry; par++) {
765 for(
int i=0; i<(
int)guide1.length(); i++){
773 G4cout <<
" @@param_guide : \"" << guide2 <<
"\""<<
G4endl;
791 G4cout <<
"@@State \"" << stateString <<
"\"" <<
G4endl;
819 if( newState != previousState )
822 previousState = newState;
832 for( i=0; i<pEntry; i++) {
833 for( j=0; j<nEntry; j++) {
841 for( i=0; i<nEntry; i++) {
842 for( j=0; j<pEntry; j++) {
866 for(
int com=0; com<commandEntry; com++){
872 if(treeEntry == 0)
return;
874 for(
int i=0; i< treeEntry; i++){
892 if (pEntry != nEntry)
return;
893 for( i=0; i<nEntry; i++) {
897 <<
" command is updated." <<
G4endl;
948 for(
int com=0; com<commandEntry; com++) {
952 param = commandPath +
" ";
953 for(
int par=0; par< parameterEntry; par++) {
965 if( treeEntry == 0 )
return;
966 for(
int i=0; i< treeEntry; i++) {
G4UIcommandTree * GetTree() const
G4String & remove(str_size)
void TerminalHelp(const G4String &)
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
void ShowCurrent(const G4String &)
const G4String GetTitle() const
G4UIcommandTree * FindDirPath(const G4String &)
void SendATclParamProperty(G4UIcommand *)
G4int ApplyCommand(const char *aCommand)
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
std::istream & readLine(std::istream &, G4bool skipWhite=true)
void ExecuteCommand(const G4String &)
void NotifyCommandUpdate(void)
const G4String GetPathName() const
void PauseSessionStart(const G4String &)
const G4String & GetGuidanceLine(G4int i) const
char GetParameterType() const
void NotifyStateChange(void)
G4String GetDefaultValue() const
G4UIparameter * GetParameter(G4int i) const
void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel)
G4int ReceiveG4cerr(const G4String &)
void CodeGenTclTree(G4UIcommandTree *, int recursiveLevel)
G4String GetParameterCandidates() const
str_size index(const char *, G4int pos=0) const
G4int GetGuidanceEntries() const
G4UIsession * SessionStart()
G4String GetParameterRange() const
static G4UImanager * GetUIpointer()
void ListCurrentWithNum() const
G4String GetPreviousCommand(G4int i) const
G4String SolveAlias(const char *aCmd)
G4UIcommand * GetCommand(G4int i)
G4String GetCurrentValues(const char *aCommand)
std::vector< G4String > newTreeParams
std::vector< G4String > previousTreeCommands
void ListDirectory(const G4String &)
void SendCommandProperties(G4UIcommandTree *)
void CodeGenJavaTree(G4UIcommandTree *, int recursiveLevel)
const G4String GetParameterGuidance() const
G4String GetStateString(G4ApplicationState aState) const
void SendDisableList(G4UIcommandTree *, int recursiveLevel)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4String strip(G4int strip_Type=trailing, char c=' ')
void Prompt(const G4String &)
G4String GetFullPath(const G4String &)
const G4String & GetCommandPath() const
G4GLOB_DLL std::ostream G4cerr
G4int ReceiveG4cout(const G4String &)
void SetCoutDestination(G4UIsession *const value)
std::string::size_type str_size
void SendParameterProperties(G4UIcommandTree *)
G4ApplicationState GetCurrentState() const
std::vector< G4String > newTreeCommands
G4String ModifyPrefix(G4String)
void SendAParamProperty(G4UIcommand *)
std::vector< G4UIcommand * > newTreePCP
G4int GetCommandEntry() const
G4bool IsOmittable() const
G4int GetParameterEntries() const
G4GLOB_DLL std::ostream G4cout
G4int GetTreeEntry() const
std::vector< G4String > previousTreeParams
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
G4String & prepend(const char *)
G4int GetNumberOfHistory() const
const G4String GetTitle() const
G4String & append(const G4String &)
void ChangeDirectory(const G4String &)
G4UIcommand * FindPath(const char *commandPath) const
std::vector< G4UIcommand * > previousTreePCP
G4String GetParameterName() const
const G4String & GetRange() const
void SetSession(G4UIsession *const value)
static G4StateManager * GetStateManager()
void NotifyParameterUpdate(G4UIcommand *)
void UpdateParamVal(void)
G4UIcommandTree * GetTree(G4int i)