#include <G4UIGAG.hh>
Public Member Functions | |
| G4UIGAG () | |
| ~G4UIGAG () | |
| G4UIsession * | SessionStart () |
| void | PauseSessionStart (G4String) |
| G4int | ReceiveG4cout (G4String) |
| G4int | ReceiveG4cerr (G4String) |
| void | SessionTerminate () |
| void | Prompt (G4String) |
| G4String | GetCommand () |
Private Member Functions | |
| void | ExecuteCommand (G4String) |
| void | ChangeDirectory (G4String) |
| void | ListDirectory (G4String) |
| void | TerminalHelp (G4String) |
| G4String | ModifyPrefix (G4String) |
| G4UIcommandTree * | FindDirPath (G4String) |
| void | ShowCurrent (G4String) |
| G4String | GetFullPath (G4String) |
| void | SendCommandProperties (G4UIcommandTree *) |
| void | SendParameterProperties (G4UIcommandTree *) |
| void | SendAParamProperty (G4UIcommand *) |
| void | SendATclParamProperty (G4UIcommand *) |
| void | CodeGenJavaTree (G4UIcommandTree *, int recursiveLevel) |
| void | CodeGenJavaParams (G4UIcommandTree *, int recursiveLevel) |
| void | CodeGenTclTree (G4UIcommandTree *, int recursiveLevel) |
| void | CodeGenTclParams (G4UIcommandTree *, int recursiveLevel) |
| void | SendDisableList (G4UIcommandTree *, int recursiveLevel) |
| void | NotifyStateChange (void) |
| void | NotifyCommandUpdate (void) |
| void | NotifyParameterUpdate (G4UIcommand *) |
| int | CommandUpdated (void) |
| void | UpdateState (void) |
| void | UpdateParamVal (void) |
| void | GetNewTreeStructure (G4UIcommandTree *, int recursiveLevel) |
| void | GetNewTreeValues (G4UIcommandTree *, int recursiveLevel) |
Private Attributes | |
| G4String | prefix |
| G4UImanager * | UI |
| G4String | promptCharacter |
| G4bool | iExit |
| G4bool | iCont |
| UImode | uiMode |
| G4String | JVersion |
| G4String | TVersion |
| std::vector< G4String > | previousTreeCommands |
| std::vector< G4String > | newTreeCommands |
| std::vector< G4String > | previousTreeParams |
| std::vector< G4String > | newTreeParams |
| std::vector< G4UIcommand * > | previousTreePCP |
| std::vector< G4UIcommand * > | newTreePCP |
|
|
Definition at line 40 of file G4UIGAG.cc. References GetNewTreeStructure(), GetNewTreeValues(), iCont, iExit, JVersion, newTreeCommands, newTreeParams, newTreePCP, prefix, previousTreeCommands, previousTreeParams, previousTreePCP, promptCharacter, terminal_mode, TVersion, UI, and uiMode.
00040 : TVersion("T1.0a"), JVersion("J1.0a") 00041 { 00042 TVersion="T1.0a"; JVersion="J1.0a"; 00043 //G4cout << "G4UIGAG: Apr15,98." << G4endl; 00044 prefix = "/"; 00045 UI = G4UImanager::GetUIpointer(); 00046 UI->SetSession(this); 00047 UI->SetCoutDestination(this); 00048 G4StateManager * statM = G4StateManager::GetStateManager(); 00049 promptCharacter = statM->GetStateString(statM->GetCurrentState()); 00050 uiMode = terminal_mode; // GAG 00051 iExit = false; 00052 iCont = false; 00053 // -- Initialize Notify routines begin 00054 G4UIcommandTree * tree = UI->GetTree(); 00055 GetNewTreeStructure(tree,0); 00056 GetNewTreeValues(tree,0); 00057 previousTreeCommands = newTreeCommands; 00058 previousTreeParams = newTreeParams; 00059 previousTreePCP = newTreePCP; 00060 // -- end 00061 } |
Here is the call graph for this function:

|
|
Definition at line 63 of file G4UIGAG.cc. References UI.
|
|
|
Definition at line 358 of file G4UIGAG.cc. References FindDirPath(), ModifyPrefix(), and prefix. Referenced by GetCommand().
00359 {
00360 G4String savedPrefix = prefix;
00361 if( newCommand.length() <= 3 )
00362 { prefix = "/"; }
00363 else
00364 {
00365 G4String aNewPrefix = newCommand(3,newCommand.length()-3);
00366 G4String newPrefix = aNewPrefix.strip(G4String::both);
00367 if( newPrefix(0) == '/' )
00368 { prefix = newPrefix; }
00369 else if( newPrefix(0) != '.' )
00370 {
00371 prefix += newPrefix;
00372 }
00373 else
00374 { prefix = ModifyPrefix( newPrefix ); }
00375 }
00376 if( prefix( prefix.length() - 1 ) != '/' )
00377 { prefix += "/"; }
00378 if( FindDirPath( prefix ) == NULL )
00379 {
00380 G4cout << "Directory <" << prefix << "> is not found." << G4endl;
00381 prefix = savedPrefix;
00382 }
00383 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 586 of file G4UIGAG.cc. References SendAParamProperty(). Referenced by SendCommandProperties(), and SendParameterProperties().
00587 {
00588 int treeEntry, commandEntry, i;
00589 //G4UIcommand * Comp;
00590 G4UIcommandTree * treeLink;
00591
00592 treeEntry = tree->GetTreeEntry();
00593 commandEntry = tree->GetCommandEntry();
00594
00595 for(i=0; i<commandEntry; i++) {
00596 SendAParamProperty(tree->GetCommand(i+1));
00597 }
00598 if( treeEntry == 0 ) return; // end recursion
00599
00600 for(i=0; i< treeEntry; i++) {
00601 treeLink = tree->GetTree(i+1);
00602 G4cout << "@@JDirGuideBegin" << G4endl;
00603 G4cout << treeLink->GetPathName() << G4endl << treeLink->GetTitle() << G4endl;
00604 G4cout << "@@JDirGuideEnd" << G4endl;
00605 CodeGenJavaParams(treeLink, level+1);
00606 }
00607 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 568 of file G4UIGAG.cc. Referenced by SendCommandProperties().
00569 {
00570 int treeEntry, commandEntry;
00571 treeEntry = tree->GetTreeEntry();
00572 commandEntry = tree->GetCommandEntry();
00573
00574 if(level!=0) {
00575 for(int i=0; i<commandEntry; i++){
00576 G4cout << tree->GetCommand(i+1)->GetCommandPath() << G4endl;
00577 }
00578 }
00579 if(treeEntry == 0) return; //end recursion
00580
00581 for(int j=0; j<treeEntry; j++){
00582 CodeGenJavaTree(tree->GetTree(j+1), level+1);
00583 }
00584 }
|
|
||||||||||||
|
Definition at line 735 of file G4UIGAG.cc. References SendATclParamProperty(). Referenced by SendCommandProperties(), and SendParameterProperties().
00736 {
00737 int treeEntry, commandEntry;
00738 G4UIcommand * Comp;
00739 treeEntry = tree->GetTreeEntry();
00740 commandEntry = tree->GetCommandEntry();
00741
00742 for(int com=0; com<commandEntry; com++) {
00743 Comp = tree->GetCommand(com+1);
00744 SendATclParamProperty(Comp);
00745 }
00746 if( treeEntry == 0 ) return; // end recursion
00747
00748 for( int i=0; i<treeEntry; i++) {
00749 CodeGenTclParams(tree->GetTree(i+1), level+1);
00750 // be sure the function name is the same
00751 }
00752 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 673 of file G4UIGAG.cc. Referenced by SendCommandProperties().
00674 {
00675 int i, j;
00676 int treeEntry, commandEntry, guidanceEntry;
00677 treeEntry = tree->GetTreeEntry();
00678 commandEntry = tree->GetCommandEntry();
00679 G4String commandPath, pathName, title1, title2;
00680 G4UIcommandTree * t;
00681 G4UIcommand * Comp;
00682
00683 for(int com=0; com<commandEntry; com++){
00684 Comp = tree->GetCommand(com+1);
00685 commandPath = Comp->GetCommandPath();
00686 G4cout << commandPath << " @@command" << G4endl;
00687 guidanceEntry = Comp->GetGuidanceEntries();
00688 if (guidanceEntry == 0){
00689 title2 = "...Title not available...";
00690 } else {
00691 title2 = "";
00692 j = 0;
00693 while(1){
00694 title1 = Comp->GetGuidanceLine(j);
00695 for(i=0; i< (int)title1.length(); i++){
00696 char c[2];
00697 c[0]=title1(i);
00698 c[1]= '\0';
00699 if( c[0] == '\"') {
00700 title2.append("\\\""); // a Backslash and a double quote
00701 } else if ( c[0] == '\n' || c[0] == '\r') {
00702 title2.append("\\n");
00703 } else title2.append(c);
00704 }
00705 j++;
00706 if (j >= guidanceEntry) break;
00707 title2.append("\\n");
00708 }
00709 }
00710 G4cout << commandPath << " @@title \""<< title2 <<"\""<< G4endl;
00711 }
00712
00713 if(treeEntry == 0) return; //end recursion
00714
00715 for(i=0; i< treeEntry; i++){
00716 t = tree->GetTree(i+1);
00717 pathName = t->GetPathName();
00718 title1 = t->GetTitle();
00719 title2 = "";
00720 for(int i=0; i<(int)title1.length(); i++){
00721 char c[2];
00722 c[0]=title1(i);
00723 c[1]= '\0';
00724 if( c[0] == '\"')
00725 title2.append("\\\""); // a Backslash and a double quote
00726 else title2.append(c);
00727 }
00728 if(level==0) G4cout << pathName<< G4endl;
00729 else G4cout << pathName<< " @@cascade"<<G4endl;
00730 G4cout << pathName << " @@title \"" << title1 << "\""<<G4endl;
00731 CodeGenTclTree(t, level+1);
00732 }
00733 }
|
|
|
Definition at line 831 of file G4UIGAG.cc. References added, addedAndDeleted, deleted, newTreeCommands, notChanged, and previousTreeCommands. Referenced by ExecuteCommand().
00832 {
00833 int added=0, deleted=0;
00834 int pEntry= previousTreeCommands.size();
00835 int nEntry= newTreeCommands.size();
00836 int i,j;
00837 for( i=0; i<pEntry; i++) { // check deleted command(s)
00838 for( j=0; j<nEntry; j++) {
00839 if( previousTreeCommands[i] == newTreeCommands[j]) break;
00840 }
00841 if( j==nEntry ) {
00842 deleted = 1;
00843 //G4cout <<"deleted: "<< previousTreeCommands(i) << G4endl;
00844 }
00845 }
00846 for( i=0; i<nEntry; i++) { // check added command(s)
00847 for( j=0; j<pEntry; j++) {
00848 if( newTreeCommands[i] == previousTreeCommands[j]) break;
00849 }
00850 if( j==pEntry ) {
00851 added = 1;
00852 // G4cout <<"added: "<< newTreeCommands(i) << G4endl;
00853 }
00854 }
00855 if( added && deleted==0 ) {G4cout<<"c added"<<G4endl;return added;}
00856 if( added==0 && deleted ) {G4cout<<"c deleted"<<G4endl;return deleted;}
00857 if( added && deleted ) {G4cout<<"c add/deleted"<<G4endl;return addedAndDeleted;}
00858 return notChanged;
00859 }
|
|
|
Definition at line 101 of file G4UIGAG.cc. References CommandUpdated(), GetNewTreeStructure(), GetNewTreeValues(), newTreeCommands, newTreeParams, newTreePCP, NotifyCommandUpdate(), previousTreeCommands, previousTreeParams, previousTreePCP, terminal_mode, UI, uiMode, UpdateParamVal(), and UpdateState(). Referenced by PauseSessionStart(), and SessionStart().
00102 {
00103 G4UIcommandTree * tree = UI->GetTree();
00104 if(aCommand.length()<2) return;
00105 G4int returnVal = UI->ApplyCommand(aCommand);
00106 G4int paramIndex = returnVal % 100;
00107 G4int commandStatus = returnVal - paramIndex;
00108
00109 UpdateState();
00110 if ( uiMode == terminal_mode){
00111 switch(commandStatus) {
00112 case fCommandSucceeded:
00113 break;
00114 case fCommandNotFound:
00115 // G4cerr << "command not found" << G4endl;
00116 G4cerr << "command <" << UI->SolveAlias(aCommand) << "> not found" << G4endl;
00117 break;
00118 case fIllegalApplicationState:
00119 G4cerr << "illegal application state -- command refused" << G4endl;
00120 break;
00121 case fParameterOutOfRange:
00122 case fParameterUnreadable:
00123 G4cerr << "Parameter is wrong type and/or is not omittable (index " << paramIndex << ")" << G4endl;
00124 break;
00125 case fParameterOutOfCandidates:
00126 G4cerr << "Parameter is out of candidate list (index " << paramIndex << ")" << G4endl;
00127 // G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates() << G4endl;
00128 break;
00129 case fAliasNotFound:
00130 default:
00131 G4cerr << "command refused (" << commandStatus << ")" << G4endl;
00132 }
00133 }else{
00134 switch(commandStatus) {
00135 case fCommandSucceeded:
00136 {
00137 GetNewTreeStructure(tree,0);
00138 GetNewTreeValues(tree,0);
00139 if (CommandUpdated()) {
00140 NotifyCommandUpdate();
00141 } else {
00142 UpdateParamVal(); // if param is updated, call notifyPara...
00143 }
00144 previousTreeCommands = newTreeCommands;
00145 previousTreeParams = newTreeParams;
00146 previousTreePCP = newTreePCP;
00147 }
00148 break;
00149 case fCommandNotFound:
00150 G4cout << "@@ErrResult \" <" << UI->SolveAlias(aCommand) << "> command not found.\"" << G4endl;
00151 break;
00152 case fIllegalApplicationState:
00153 G4cout << "@@ErrResult \"Illegal application state -- command refused\"" << G4endl;
00154 break;
00155 case fParameterOutOfRange:
00156 G4cout << "@@ErrResult \"Parameter Out of Range.\"" << G4endl;
00157 break;
00158 case fParameterUnreadable:
00159 G4cout << "@@ErrResult \"Parameter is wrong type and/or is not omittable.\"" << G4endl;
00160 break;
00161 case fParameterOutOfCandidates:
00162 // G4cout << "@@ErrResult \"Parameter Out of Candidates. Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates()<< "\"" << G4endl;
00163 G4cout << "@@ErrResult \"Parameter Out of Candidates.\"" << G4endl;
00164 break;
00165 case fAliasNotFound:
00166 default:
00167 G4cout << "@@ErrResult \"command refused (" << commandStatus << ")\"" << G4endl;
00168 }
00169 }
00170 }
|
Here is the call graph for this function:

|
|
Definition at line 520 of file G4UIGAG.cc. References UI. Referenced by ChangeDirectory(), and ListDirectory().
00521 {
00522 G4UIcommandTree * comTree = UI->GetTree();
00523 /*int*/ unsigned idx = 1;
00524 while( idx < newCommand.length()-1 )
00525 {
00526 int i = newCommand.index("/",idx);
00527 comTree = comTree->GetTree(G4String(newCommand(0,i+1)));
00528 if( comTree == NULL )
00529 { return NULL; }
00530 idx = i+1;
00531 }
00532 return comTree;
00533 }
|
|
|
Definition at line 190 of file G4UIGAG.cc. References ChangeDirectory(), GetFullPath(), iCont, iExit, java_mode, JVersion, ListDirectory(), NotifyStateChange(), prefix, promptCharacter, SendCommandProperties(), ShowCurrent(), tcl_mode, terminal_mode, TerminalHelp(), TVersion, UI, and uiMode. Referenced by PauseSessionStart(), and SessionStart().
00191 {
00192 G4String newCommand;
00193 G4String nullString;
00194 while( 1 )
00195 {
00196 G4UIcommandTree* tree = UI->GetTree();
00197 if ( uiMode != terminal_mode ){
00198 G4cout << "@@PROMPT \"" << promptCharacter << "\"" << G4endl;
00199 }
00200 if ( uiMode != java_mode ){
00201 G4cout << promptCharacter << "> " << std::flush;
00202 }else{
00203 G4cout << "@@Ready" << G4endl;
00204 }
00205 newCommand.readLine( G4cin, FALSE );
00206 if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false;break;}
00207
00208 newCommand = newCommand.strip(G4String::leading);
00209 if( newCommand.length() < 1) { break; }
00210
00211 while( newCommand(newCommand.length()-1) == '_' )
00212 {
00213 G4String newLine;
00214 newCommand.remove(newCommand.length()-1);
00215 newLine.readLine( G4cin );
00216 if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false;break;}
00217 newCommand.append(newLine);
00218 }
00219
00220 G4String nC = newCommand.strip(G4String::leading);
00221 if( nC.length() < 1) { break; }
00222
00223 // -------------------- nC.toUpper();
00224 if( nC == "@@GAGmodeJAVA" ) {
00225 uiMode = java_mode;
00226 G4cout << G4endl << "@@Version " << JVersion << G4endl;
00227 SendCommandProperties(tree);
00228 NotifyStateChange();
00229 }
00230 else if( nC == "@@GAGmodeTcl" ) {
00231 uiMode = tcl_mode;
00232 G4cout << G4endl << "@@Version " << TVersion << G4endl;
00233 SendCommandProperties(tree);
00234 NotifyStateChange();
00235 }
00236 else if( nC(0) == '#' )
00237 { G4cout << nC << G4endl; }
00238
00239 else if( nC == "ls" || nC(0,3) == "ls " )
00240 { ListDirectory( nC ); }
00241 else if( nC == "pwd" )
00242 { G4cout << "Current Working Directory : " << prefix << G4endl; }
00243 else if( nC(0,2) == "cd" || nC(0,3) == "cd " )
00244 { ChangeDirectory( nC ); }
00245 else if( nC == "help" || nC(0,5) == "help ")
00246 { TerminalHelp( nC ); }
00247 else if( nC(0) == '?' )
00248 { ShowCurrent( nC ); }
00249 else if( nC(0,4) == "hist" || nC == "history")
00250 {
00251 G4int nh = UI->GetNumberOfHistory();
00252 for(int i=0;i<nh;i++)
00253 { G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl; }
00254 }
00255 else if( nC(0) == '!' )
00256 {
00257 G4String ss = nC(1,nC.length()-1);
00258 G4int vl;
00259 const char* tt = ss;
00260 std::istringstream is((char*)tt);
00261 is >> vl;
00262 G4int nh = UI->GetNumberOfHistory();
00263 if(vl>=0 && vl<nh)
00264 {
00265 newCommand = UI->GetPreviousCommand(vl);
00266 G4cout << newCommand << G4endl;
00267 break;
00268 }
00269 else
00270 { G4cerr << "history " << vl << " is not found." << G4endl; }
00271 }
00272 else if( nC(0,4) == "exit" )
00273 {
00274 if( iCont )
00275 {
00276 if ( uiMode == terminal_mode){
00277 G4cerr << "You are now processing RUN." << G4endl;
00278 G4cerr << "Please abrot it using \"/run/abort\" command first" << G4endl;
00279 G4cerr << " and use \"continue\" command until the application" << G4endl;
00280 G4cerr << " becomes to Idle." << G4endl;
00281 }else{
00282 G4cout << "@@ErrResult \"You are now processing RUN.\"" << G4endl;
00283 }
00284 }
00285 else
00286 {
00287 iExit = false;
00288 newCommand = nullString;
00289 break;
00290 }
00291 }
00292 else if( nC == "cont" || nC == "continue" )
00293 {
00294 iCont = false;
00295 newCommand = nullString;
00296 break;
00297 }
00298 else
00299 { break; }
00300 }
00301 return GetFullPath(newCommand);
00302 }
|
Here is the call graph for this function:

|
|
Definition at line 304 of file G4UIGAG.cc. References ModifyPrefix(), and prefix. Referenced by GetCommand(), and ShowCurrent().
00305 {
00306 G4String newCommand = aNewCommand.strip(G4String::both);
00307 G4String tmpString;
00308 if( newCommand(0) == '/' )
00309 { tmpString = newCommand; }
00310 else if( newCommand(0,3) == "../" )
00311 {
00312 G4String tmpPrefix = prefix;
00313 /*G4int*/ unsigned i_direc = 0;
00314 while( i_direc < newCommand.length() )
00315 {
00316 if( newCommand(i_direc,3) == "../" )
00317 {
00318 i_direc += 3;
00319 prefix = ModifyPrefix( G4String("../") );
00320 }
00321 else
00322 { break; }
00323 }
00324 tmpString = prefix;
00325 tmpString.append( newCommand( i_direc, newCommand.length()-i_direc ) );
00326 prefix = tmpPrefix;
00327 }
00328 else
00329 {
00330 tmpString = prefix;
00331 tmpString.append( newCommand );
00332 }
00333 return tmpString;
00334 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 861 of file G4UIGAG.cc. References newTreeCommands. Referenced by ExecuteCommand(), and G4UIGAG().
00862 {
00863 G4String commandPath;
00864 G4String title;
00865 G4String pathName; //tree name
00866 G4UIcommandTree * t;
00867 int treeEntry = tree->GetTreeEntry();
00868 int commandEntry = tree->GetCommandEntry();
00869
00870 if( level==0 ) { newTreeCommands.clear();}
00871 for(int com=0; com<commandEntry; com++){
00872 commandPath = tree->GetCommand(com+1)->GetCommandPath();
00873 title = tree->GetCommand(com+1)->GetTitle();
00874 newTreeCommands.push_back( commandPath + " " + title );
00875 }
00876
00877 if(treeEntry == 0) return; //end recursion
00878
00879 for(int i=0; i< treeEntry; i++){
00880 t = tree->GetTree(i+1);
00881 pathName = t->GetPathName();
00882 title = t->GetTitle();
00883 newTreeCommands.push_back( pathName + " " + title );
00884 GetNewTreeStructure(t, level+1);
00885 }
00886 }
|
|
||||||||||||
|
Definition at line 940 of file G4UIGAG.cc. References newTreeParams, and newTreePCP. Referenced by ExecuteCommand(), and G4UIGAG().
00941 {
00942 G4String commandPath;
00943 G4String pathName; //tree name
00944 G4UIcommandTree * t;
00945 int parameterEntry;
00946 int treeEntry = tree->GetTreeEntry();
00947 int commandEntry = tree->GetCommandEntry();
00948 G4UIcommand * Comp;
00949 G4UIparameter * prp;
00950 G4String param, str(" ");
00951
00952 if( level==0 ) { newTreeParams.clear(); }
00953 for(int com=0; com<commandEntry; com++) {
00954 Comp = tree->GetCommand(com+1);
00955 commandPath = Comp->GetCommandPath();
00956 parameterEntry = Comp->GetParameterEntries();
00957 param = commandPath +" ";
00958 for( int par=0; par< parameterEntry; par++) {
00959 prp = (G4UIparameter *)Comp->GetParameter(par);
00960 param += prp->GetParameterName() +" ";
00961 str(0) = prp->GetParameterType();
00962 param += str + " ";
00963 param += prp->GetDefaultValue() +" ";
00964 param += prp->GetParameterRange() +" ";
00965 param += prp->GetParameterCandidates();
00966 }
00967 newTreeParams.push_back( param + "\n");
00968 newTreePCP.push_back( Comp );
00969 }
00970 if( treeEntry == 0 ) return; // end recursion
00971 for( int i=0; i< treeEntry; i++) {
00972 t = tree->GetTree(i+1);
00973 GetNewTreeValues(t, level+1);
00974 }
00975 }
|
|
|
Definition at line 385 of file G4UIGAG.cc. References FindDirPath(), ModifyPrefix(), and prefix. Referenced by GetCommand().
00386 {
00387 G4String targetDir('\0');
00388 if( newCommand.length() <= 3 )
00389 { targetDir = prefix; }
00390 else
00391 {
00392 G4String newPrefix = newCommand(3,newCommand.length()-3);
00393 newPrefix.strip(G4String::both);
00394 if( newPrefix(0) == '/' )
00395 { targetDir = newPrefix; }
00396 else if( newPrefix(0) != '.' )
00397 {
00398 targetDir = prefix;
00399 targetDir += newPrefix;
00400 }
00401 else
00402 { targetDir = ModifyPrefix( newPrefix ); }
00403 }
00404 if( targetDir( targetDir.length() - 1 ) != '/' )
00405 { targetDir += "/"; }
00406 G4UIcommandTree * commandTree = FindDirPath( targetDir );
00407 if( commandTree == NULL )
00408 { G4cout << "Directory <" << targetDir << "> is not found." << G4endl; }
00409 else
00410 { commandTree->ListCurrent(); }
00411 }
|
Here is the call graph for this function:

|
|
Definition at line 495 of file G4UIGAG.cc. References prefix. Referenced by ChangeDirectory(), GetFullPath(), and ListDirectory().
00496 {
00497 G4String newPrefix = prefix;
00498 while( 1 )
00499 {
00500 if( newCommand(0,2) == ".." )
00501 {
00502 if( newPrefix != "/" )
00503 {
00504 G4String tmpString = newPrefix(0,newPrefix.length()-1);
00505 newPrefix = newPrefix(0,tmpString.last('/')+1);
00506 }
00507 }
00508 else
00509 {
00510 newPrefix += newCommand;
00511 break;
00512 }
00513 if( newCommand == ".." || newCommand == "../" )
00514 { break; }
00515 newCommand = newCommand(3,newCommand.length()-3);
00516 }
00517 return newPrefix;
00518 }
|
|
|
Definition at line 803 of file G4UIGAG.cc. References SendCommandProperties(), and UI. Referenced by ExecuteCommand().
00804 {
00805 G4UIcommandTree * tree = UI->GetTree();
00806 SendCommandProperties(tree);
00807 }
|
Here is the call graph for this function:

|
|
Definition at line 809 of file G4UIGAG.cc. References java_mode, SendAParamProperty(), SendATclParamProperty(), and uiMode. Referenced by UpdateParamVal().
00810 {
00811 if (uiMode == java_mode)
00812 SendAParamProperty(com);
00813 else
00814 SendATclParamProperty(com);
00815 }
|
Here is the call graph for this function:

|
|
Definition at line 789 of file G4UIGAG.cc. References SendDisableList(), terminal_mode, UI, and uiMode. Referenced by GetCommand(), and UpdateState().
00790 {
00791 G4String stateString;
00792 G4StateManager * statM = G4StateManager::GetStateManager();
00793 G4UIcommandTree * tree = UI->GetTree();
00794 stateString = statM->GetStateString(statM->GetCurrentState());
00795 if ( uiMode != terminal_mode ){
00796 G4cout << "@@State \"" << stateString << "\"" << G4endl;
00797 G4cout << "@@DisableListBegin"<<G4endl;
00798 SendDisableList(tree, 0);
00799 G4cout << "@@DisableListEnd" <<G4endl;
00800 }
00801 }
|
Here is the call graph for this function:

|
|
Definition at line 88 of file G4UIGAG.cc. References ExecuteCommand(), GetCommand(), iCont, and promptCharacter.
00089 {
00090 promptCharacter = msg;
00091 G4cout << "@@PROMPT \"" << promptCharacter << "\"" << G4endl;
00092 iCont = true;
00093 G4String newCommand = GetCommand();
00094 while( iCont )
00095 {
00096 ExecuteCommand(newCommand);
00097 newCommand = GetCommand();
00098 }
00099 }
|
Here is the call graph for this function:

|
|
Definition at line 185 of file G4UIGAG.cc. References promptCharacter.
00186 {
00187 promptCharacter = aPrompt;
00188 }
|
|
|
Definition at line 179 of file G4UIGAG.cc.
00180 {
00181 std::cerr << cerrString << std::flush;
00182 return 0;
00183 }
|
|
|
Definition at line 173 of file G4UIGAG.cc.
00174 {
00175 std::cout << coutString << std::flush;
00176 return 0;
00177 }
|
|
|
Definition at line 609 of file G4UIGAG.cc. Referenced by CodeGenJavaParams(), and NotifyParameterUpdate().
00610 {
00611 int guidanceEntry, parameterEntry;
00612 G4String title, title2;
00613 G4UIparameter * prp;
00614 char c[2];
00615 guidanceEntry = Comp->GetGuidanceEntries();
00616 parameterEntry = Comp->GetParameterEntries();
00617 G4cout << "@@JParamBegin" << G4endl;
00618 G4cout << Comp->GetCommandPath() << G4endl;
00619 G4cout << guidanceEntry << G4endl;
00620 for (int j=0; j<guidanceEntry; j++){
00621 title = Comp->GetGuidanceLine(j);
00622 title2 = "";
00623 if (title != ""){
00624 for(int i=0; i< (int)title.length(); i++){
00625 c[0]=title(i);
00626 c[1]= '\0';
00627 if ( c[0] == '\n' || c[0] == '\r') {
00628 c[0]= ' ';
00629 }
00630 title2.append(c);
00631 }
00632 }
00633 G4cout << title2 << G4endl;
00634 }
00635 G4cout << Comp->GetRange() << G4endl;
00636 G4cout << parameterEntry << G4endl;
00637 for( int par=0; par<parameterEntry; par++) {
00638 prp = (G4UIparameter *)Comp->GetParameter(par);
00639 G4cout << prp->GetParameterName() << G4endl;
00640 G4cout << prp->GetParameterGuidance() << G4endl;
00641 G4cout << prp->GetParameterType() << G4endl;
00642 G4cout << prp->IsOmittable() << G4endl;
00643 G4cout << prp->GetDefaultValue() << G4endl;
00644 G4cout << prp->GetParameterRange() << G4endl;
00645 G4cout << prp->GetParameterCandidates() << G4endl;
00646 }
00647 G4cout << "@@JParamEnd" << G4endl;
00648 }
|
|
|
Definition at line 754 of file G4UIGAG.cc. Referenced by CodeGenTclParams(), and NotifyParameterUpdate().
00755 {
00756 G4UIparameter * prp;
00757 int parameterEntry = Comp->GetParameterEntries();
00758 G4String commandPath = Comp->GetCommandPath();
00759 G4String commandRange = Comp->GetRange();
00760 G4cout << "@@parameter_start" << G4endl;
00761 G4cout << commandPath << " @@param " << parameterEntry << G4endl;
00762 G4cout << "@@command_range \"" << commandRange << "\"" << G4endl;
00763 for( int par=0; par<parameterEntry; par++) {
00764 prp = (G4UIparameter *)Comp->GetParameter(par);
00765 G4cout << "{" ;
00766 G4cout << "@@param_name : \"" << prp->GetParameterName() <<"\""<<G4endl;
00767 G4String guide1,guide2;
00768 guide1 = prp->GetParameterGuidance();
00769 guide2 = "";
00770 for(int i=0; i<(int)guide1.length(); i++){
00771 char c[2];
00772 c[0]=guide1(i);
00773 c[1]= '\0';
00774 if( c[0] == '\"')
00775 guide2.append("\\\""); // a Backslash and a double quote
00776 else guide2.append(c);
00777 }
00778 G4cout << " @@param_guide : \"" << guide2 << "\""<<G4endl;
00779 G4cout << " @@param_type : \"" << prp->GetParameterType()<<"\""<<G4endl;
00780 G4cout << " @@param_omit : \"" << prp->IsOmittable()<<"\""<<G4endl;
00781 G4cout << " @@param_default : \""<< prp->GetDefaultValue()<<"\""<<G4endl;
00782 G4cout << " @@param_range : \""<< prp->GetParameterRange()<<"\""<<G4endl;
00783 G4cout << " @@param_candidate : \"" << prp->GetParameterCandidates()<< "\""<<G4endl;
00784 G4cout << "}" << G4endl;
00785 }
00786 G4cout << "@@parameter_end" << G4endl;
00787 }
|
|
|
Definition at line 537 of file G4UIGAG.cc. References CodeGenJavaParams(), CodeGenJavaTree(), CodeGenTclParams(), CodeGenTclTree(), java_mode, and uiMode. Referenced by GetCommand(), and NotifyCommandUpdate().
00538 {
00539 if( tree == NULL ) {
00540 G4cerr << "GetTree() returnes null." << G4endl;
00541 return;
00542 }
00543 if (uiMode == java_mode){
00544 G4cout << "@@JTreeBegin" << G4endl;
00545 CodeGenJavaTree(tree, 0);
00546 G4cout << "@@JTreeEnd" << G4endl;
00547 CodeGenJavaParams(tree, 0);
00548 }else{
00549 G4cout << G4endl << "@@maketree_start" << G4endl;
00550 CodeGenTclTree(tree,0);
00551 G4cout << "@@maketree_end" << G4endl;
00552 CodeGenTclParams(tree, 0);
00553 }
00554 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 650 of file G4UIGAG.cc. Referenced by NotifyStateChange().
00651 {
00652 int treeEntry, commandEntry;
00653 G4UIcommand * Comp;
00654 treeEntry = tree->GetTreeEntry();
00655 commandEntry = tree->GetCommandEntry();
00656
00657 for(int com=0; com<commandEntry; com++) {
00658 Comp = tree->GetCommand(com+1);
00659 if( Comp->IsAvailable()==false ) {
00660 G4cout << Comp->GetCommandPath()<<G4endl;
00661 }
00662 }
00663 if( treeEntry == 0 ) return; // end recursion
00664
00665 for( int i=0; i<treeEntry; i++) {
00666 SendDisableList(tree->GetTree(i+1), level+1);
00667 // be sure the function name is the same
00668 }
00669 }
|
|
|
Definition at line 555 of file G4UIGAG.cc. References CodeGenJavaParams(), CodeGenTclParams(), java_mode, and uiMode.
00556 {
00557 if( tree == NULL ) {
00558 G4cerr << "GetTree() returnes null." << G4endl;
00559 return;
00560 }
00561 if (uiMode == java_mode){
00562 CodeGenJavaParams(tree, 0);
00563 }else{
00564 CodeGenTclParams(tree, 0);
00565 }
00566 }
|
Here is the call graph for this function:

|
|
Definition at line 73 of file G4UIGAG.cc. References ExecuteCommand(), GetCommand(), iExit, and promptCharacter.
00074 {
00075 iExit = true;
00076 G4StateManager * statM = G4StateManager::GetStateManager();
00077 promptCharacter = statM->GetStateString(statM->GetCurrentState());
00078 G4String newCommand = GetCommand();
00079 while( iExit )
00080 {
00081 ExecuteCommand(newCommand);
00082 promptCharacter = statM->GetStateString(statM->GetCurrentState());
00083 newCommand = GetCommand();
00084 }
00085 return NULL;
00086 }
|
Here is the call graph for this function:

|
|
Definition at line 336 of file G4UIGAG.cc.
00337 {
00338 G4cout << "***** Terminal session end *****" << G4endl;
00339 }
|
|
|
Definition at line 341 of file G4UIGAG.cc. References GetFullPath(), terminal_mode, UI, and uiMode. Referenced by GetCommand().
00342 {
00343 G4String theCommand = GetFullPath(newCommand(1,newCommand.length()-1));
00344 G4String curV = UI->GetCurrentValues(theCommand);
00345 if( ! (curV.isNull()||curV(0)=='\0' ) ) {
00346 if (uiMode == terminal_mode){
00347 G4cout << "Current value(s) of the parameter(s) : " << curV << G4endl;
00348 }else{
00349 G4cout << "@@CurrentValue " << curV << G4endl;
00350 }
00351 } else if (uiMode == terminal_mode){
00352 G4cout << "Current value is not available." << G4endl;
00353 } else {
00354 G4cout << "@@ErrResult \"Current value is not available.\"" << G4endl;
00355 }
00356 }
|
Here is the call graph for this function:

|
|
Definition at line 413 of file G4UIGAG.cc. Referenced by GetCommand().
00414 {
00415 G4UIcommandTree * treeTop = UI->GetTree();
00416 /*int*/unsigned i = newCommand.index(" ");
00417 if( i != std::string::npos )
00418 {
00419 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
00420 newValue.strip(G4String::both);
00421 if( newValue(0) != '/' )
00422 { newValue.prepend( prefix ); }
00423 G4UIcommand * theCommand = treeTop->FindPath( newValue );
00424 if( theCommand != NULL )
00425 {
00426 theCommand->List();
00427 return;
00428 }
00429 else
00430 {
00431 G4cout << "Command <" << newValue << " is not found." << G4endl;
00432 return;
00433 }
00434 }
00435
00436 G4UIcommandTree * floor[10];
00437 floor[0] = treeTop;
00438 int iFloor = 0;
00439 /*int*/ unsigned prefixIndex = 1;
00440 while( prefixIndex < prefix.length()-1 )
00441 {
00442 int ii = prefix.index("/",prefixIndex);
00443 floor[iFloor+1] =
00444 floor[iFloor]->GetTree(G4String(prefix(0,ii+1)));
00445 prefixIndex = ii+1;
00446 iFloor++;
00447 }
00448 floor[iFloor]->ListCurrentWithNum();
00449 // 1998 Oct 2 non-number input
00450 while(1){
00451 int i;
00452 G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : "<<std::flush;
00453 G4cin >> i;
00454 if(!G4cin.good()){
00455 G4cin.clear();
00456 G4cin.ignore(30,'\n');
00457 G4cout << G4endl << "Not a number, once more" << G4endl; continue;}
00458 else if( i < 0 ){
00459 iFloor += i;
00460 if( iFloor < 0 ) iFloor = 0;
00461 floor[iFloor]->ListCurrentWithNum(); continue;}
00462 else if(i == 0) { break;}
00463 else if( i > 0 ) {
00464 int n_tree = floor[iFloor]->GetTreeEntry();
00465 if( i > n_tree )
00466 {
00467 if( i <= n_tree + floor[iFloor]->GetCommandEntry() )
00468 {
00469 floor[iFloor]->GetCommand(i-n_tree)->List();
00470 //iFloor++;
00471 }
00472 }
00473 else
00474 {
00475 floor[iFloor+1] = floor[iFloor]->GetTree(i);
00476 iFloor++;
00477 floor[iFloor]->ListCurrentWithNum();
00478 }
00479 }
00480
00481 }
00482 G4cout << "Exit from HELP." << G4endl << G4endl;
00483 G4cout << G4endl;
00484 // G4cin.flush();
00485 char temp[100];
00486 G4cin.getline( temp, 100 );
00487 }
|
|
|
Definition at line 888 of file G4UIGAG.cc. References newTreeParams, newTreePCP, NotifyParameterUpdate(), and previousTreeParams. Referenced by ExecuteCommand().
00889 {
00890 // call NotifyParameterUpdate() if the value of each
00891 // command/parameter is updated.
00892 // assuming the command structure is not changed.
00893 int pEntry= previousTreeParams.size();
00894 int nEntry= newTreeParams.size();
00895 int i;
00896 G4UIcommand* Comp;
00897 if (pEntry != nEntry) return;
00898 for( i=0; i<nEntry; i++) {
00899 if( previousTreeParams[i] != newTreeParams[i]){
00900 Comp = newTreePCP[i];
00901 G4cout << Comp->GetCommandPath()
00902 << " command is updated." <<G4endl;
00903 NotifyParameterUpdate(Comp);
00904 }
00905 }
00906 }
|
Here is the call graph for this function:

|
|
Definition at line 818 of file G4UIGAG.cc. References NotifyStateChange(). Referenced by ExecuteCommand().
00819 {
00820 static G4ApplicationState previousState= G4State_PreInit;
00821 G4ApplicationState newState;
00822 G4StateManager *statM = G4StateManager::GetStateManager();
00823 newState = statM->GetCurrentState();
00824 if( newState != previousState )
00825 {
00826 NotifyStateChange();
00827 previousState = newState;
00828 }
00829 }
|
Here is the call graph for this function:

|
|
Definition at line 85 of file G4UIGAG.hh. Referenced by G4UIGAG(), GetCommand(), and PauseSessionStart(). |
|
|
Definition at line 84 of file G4UIGAG.hh. Referenced by G4UIGAG(), GetCommand(), and SessionStart(). |
|
|
Definition at line 89 of file G4UIGAG.hh. Referenced by G4UIGAG(), and GetCommand(). |
|
|
Definition at line 124 of file G4UIGAG.hh. Referenced by CommandUpdated(), ExecuteCommand(), G4UIGAG(), and GetNewTreeStructure(). |
|
|
Definition at line 126 of file G4UIGAG.hh. Referenced by ExecuteCommand(), G4UIGAG(), GetNewTreeValues(), and UpdateParamVal(). |
|
|
Definition at line 128 of file G4UIGAG.hh. Referenced by ExecuteCommand(), G4UIGAG(), GetNewTreeValues(), and UpdateParamVal(). |
|
|
Definition at line 81 of file G4UIGAG.hh. Referenced by ChangeDirectory(), G4UIGAG(), GetCommand(), GetFullPath(), ListDirectory(), ModifyPrefix(), and TerminalHelp(). |
|
|
Definition at line 123 of file G4UIGAG.hh. Referenced by CommandUpdated(), ExecuteCommand(), and G4UIGAG(). |
|
|
Definition at line 125 of file G4UIGAG.hh. Referenced by ExecuteCommand(), G4UIGAG(), and UpdateParamVal(). |
|
|
Definition at line 127 of file G4UIGAG.hh. Referenced by ExecuteCommand(), and G4UIGAG(). |
|
|
Definition at line 83 of file G4UIGAG.hh. Referenced by G4UIGAG(), GetCommand(), PauseSessionStart(), Prompt(), and SessionStart(). |
|
|
Definition at line 90 of file G4UIGAG.hh. Referenced by G4UIGAG(), and GetCommand(). |
|
|
Definition at line 82 of file G4UIGAG.hh. Referenced by ExecuteCommand(), FindDirPath(), G4UIGAG(), GetCommand(), NotifyCommandUpdate(), NotifyStateChange(), ShowCurrent(), TerminalHelp(), and ~G4UIGAG(). |
|
|
Definition at line 86 of file G4UIGAG.hh. Referenced by ExecuteCommand(), G4UIGAG(), GetCommand(), NotifyParameterUpdate(), NotifyStateChange(), SendCommandProperties(), SendParameterProperties(), and ShowCurrent(). |
1.3.4