Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# $Id: GNUmakefile,v 2.2 1998/07/07 16:57:17 allison Exp $
# -------------------------------------------------------------
# GNUmakefile for interfaces/OPACS library. John Allison, 6/7/98.
name := G4UIOPACS
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4UI_BUILD.gmk
include $(G4INSTALL)/config/interactivity.gmk
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
CPPFLAGS += -I$(G4BASE)/global/management/include
CPPFLAGS += -I$(G4BASE)/interfaces/common/include
CPPFLAGS += -I$(G4BASE)/intercoms/include
include $(G4INSTALL)/config/common.gmk
+38
View File
@@ -0,0 +1,38 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWo.hh,v 2.3 1998/10/23 14:42:27 barrand Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4UIWo_h
#define G4UIWo_h
#if defined(G4UI_BUILD_WO_SESSION) || defined(G4UI_USE_WO)
#include "G4UIsession.hh"
class G4WoMessenger;
class G4UIWo : public G4UIsession {
public:
G4UIWo(int,char**);
~G4UIWo();
G4UIsession* SessionStart();
void Prompt(G4String);
void SessionTerminate();
void PauseSessionStart(G4String);
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
private:
void SecondaryLoop(G4String);
G4WoMessenger* woMessenger;
};
#endif
#endif
@@ -0,0 +1,48 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4WoMessenger.hh,v 2.3 1998/07/12 03:42:49 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4WoMessenger_h
#define G4WoMessenger_h 1
#ifdef G4UI_BUILD_WO_SESSION
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
#include <OShell.h>
class G4WoMessenger: public G4UImessenger
{
public:
G4WoMessenger(OShell);
~G4WoMessenger();
public:
void SetNewValue (G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
OShell shell;
private: //commands
G4UIdirectory* WoDirectory;
G4UIcmdWithoutParameter* sendExitCmd;
G4UIcmdWithAString* oshCmd;
};
#endif
#endif
@@ -0,0 +1,38 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4oCommon.hh,v 2.2 1998/07/12 02:59:59 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/*
Included by G4o.h.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*G4*/
#include <G4UImanager.hh>
/*Co*/
#include <CMemory.h>
#include <CPrinter.h>
#include <CText.h>
#include <CFile.h>
#include <OType.h>
#include <OShell.h>
#include <OProcess.h>
static void SetTypes ();
static void ExecuteScript (char*);
static int Execute_G4 (int,char**,OProcess);
static int DoMethod (OIdentifier,char*,void*,int,char**,void*,int*);
static G4UIcommand* GetCommandIdentifier (char*);
static void GetCommands (G4UIcommandTree*,int*,char***);
static int ProduceODB (G4UIcommand*,char*);
@@ -0,0 +1,463 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4oCommon.icc,v 2.2 1998/07/12 03:00:00 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/*
Included by G4o.cc.
*/
/***************************************************************************/
void SetTypes (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
OType otype;
/*.........................................................................*/
if(OTypeGetIdentifier("G4")!=NULL) return; /*Done*/
otype = OTypeCreate ("G4");
OTypeSetDoMethodFunction (otype,DoMethod);
OTypeAddNewClassMethodProperty (otype,"getCommandGuidance" ,OPropertyString,NULL);
OTypeAddNewClassMethodProperty (otype,"askListOfCommands" ,OPropertyString,NULL);
OTypeAddNewClassMethodProperty (otype,"createCommandPanel" ,OPropertyVoid,NULL);
}
/***************************************************************************/
int Execute_G4 (
int a_argn
,char** a_args
,OProcess a_process
)
/***************************************************************************/
/*
osh> G4 <string:command> <string:param 1> ...
*/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
int count;
char* string = NULL;
/*.........................................................................*/
if(a_argn<=1)
{
CWarnF ("At least one argument expected in:\n%s\n",OProcessGetCommand(a_process));
return EXIT_FAILURE;
}
for(count=1;count<a_argn;count++)
{
CStringConcatenate (&string,a_args[count]);
CStringConcatenate (&string," ");
}
ExecuteScript (string);
CStringDelete (string);
return EXIT_SUCCESS;
}
/***************************************************************************/
void ExecuteScript (
char* a_string
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI;
int linen = 0;
char** lines = NULL;
/*.........................................................................*/
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return;
lines = CTextCreateFromString (a_string,&linen);
if( (linen!=0) && (lines!=NULL) )
{
int count;
for(count=0;count<linen;count++)
{
CStringTrim(lines[count]);
if( (lines[count]==NULL) || (lines[count][0]=='\0') || (lines[count][0]=='#') ) continue;
UI->ApplyCommand(lines[count]);
}
}
CTextDelete (linen,lines);
}
/***************************************************************************/
int DoMethod (
OIdentifier This
,char* a_name
,void* a_user
,int a_argn
,char** a_args
,void* a_addr
,int* a_number
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
if(a_number!=NULL) *a_number = 0;
if(a_name==NULL) return 0;
if(This==NULL)
{
if(strcmp(a_name,"getCommandGuidance")==0)
{
G4UIcommand* command;
char* string = NULL;
int count,linen,paramn;
if(a_argn!=1)
{
CWarnF ("One arguments expected for %s property.\n",a_name);
return 0;
}
command = GetCommandIdentifier(a_args[0]);
if(command==NULL)
{
CWarnF ("Unknown G4 command :\n%s\n",a_args[0]);
return 0;
}
linen = command->GetGuidanceEntries();
for(count=0;count<linen;count++)
{
CStringConcatenate (&string,(char*)command->GetGuidanceLine(count).data());
CStringConcatenate (&string,"\n");
}
paramn = command->GetParameterEntries();
for(count=0;count<paramn;count++)
{
char* info;
char* line;
G4UIparameter* parameter = (G4UIparameter*)command->GetParameter(count);
info = (char*)parameter->GetParameterName().data();
line = CStringCreateF(12+strlen(info)+1,"Parameter : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
if( ! parameter->GetParameterGuidance().isNull() )
{
CStringConcatenate (&string,(char*)parameter->GetParameterGuidance().data());
CStringConcatenate (&string,"\n");
}
line = CStringCreateF(19+1+1," Parameter type : %c\n",parameter->GetParameterType());
CStringConcatenate (&string,line);
CStringDelete (line);
if(parameter->IsOmittable()==True)
line = CStringDuplicate(" Omittable : true\n");
else
line = CStringDuplicate(" Omittable : false\n");
CStringConcatenate (&string,line);
CStringDelete (line);
if( ! parameter->GetDefaultValue().isNull() )
{
info = (char*)parameter->GetDefaultValue().data();
line = CStringCreateF(19+strlen(info)+1," Default value : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
}
if( ! parameter->GetParameterRange().isNull() )
{
info = (char*)parameter->GetParameterRange().data();
line = CStringCreateF(19+strlen(info)+1," Parameter range : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
}
}
*((char**)a_addr) = string;
return FREE_BLOCK;
}
else if(strcmp(a_name,"askListOfCommands")==0)
{
G4UIcommandTree* treeTop;
char* string = NULL;
G4UImanager* UI;
int linen = 0;
char** lines = NULL;
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return 0;
treeTop = UI->GetTree();
if(treeTop==NULL) return 0;
if(a_argn==1) treeTop = treeTop->GetTree(a_args[0]);
GetCommands (treeTop,&linen,&lines);
string = CTextConvertToString (linen,lines,"\n");
CTextDelete (linen,lines);
*((char**)a_addr) = string;
return FREE_BLOCK;
}
else if(strcmp(a_name,"createCommandPanel")==0)
{
if(a_argn!=2)
{
CWarnF ("Two arguments expected for %s property.\n",a_name);
return 0;
}
return ProduceODB(GetCommandIdentifier(a_args[0]),a_args[1]);
}
else
{
CInfoF ("G4_DoMethod: %s is not a class routine property.\n",a_name);
return 0;
}
}
CInfoF ("G4_DoMethod: %s is not a routine property.\n",a_name);
a_user = NULL;
a_argn = 0;
a_args = NULL;
a_addr = NULL;
return 0;
}
/***************************************************************************/
void GetCommands (
G4UIcommandTree* a_tree
,int* a_linen
,char*** a_lines
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
if(a_tree==NULL) return;
int n_commandEntry = a_tree->GetCommandEntry();
for( int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ )
{
G4UIcommand* command = a_tree->GetCommand(i_thCommand);
CTextAddLine (a_linen,a_lines,(char*)command->GetCommandPath().data());
}
int n_treeEntry = a_tree->GetTreeEntry();
for( int i_thTree = 1; i_thTree <= n_treeEntry; i_thTree++ )
{
GetCommands (a_tree->GetTree(i_thTree),a_linen,a_lines);
}
}
/***************************************************************************/
G4UIcommand* GetCommandIdentifier (
char* a_name
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI;
G4UIcommandTree* treeTop;
/*.........................................................................*/
if(a_name==NULL) return NULL;
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return NULL;
treeTop = UI->GetTree();
if(treeTop==NULL) return NULL;
return treeTop->FindPath(a_name);
}
/***************************************************************************/
int ProduceODB (
G4UIcommand* a_command
,char* a_name
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
FILE* file;
int paramn,parami;
char* top = NULL;
/*.........................................................................*/
if(a_command==NULL) return 0;
paramn = a_command->GetParameterEntries();
file = CFileOpenForWriting (a_name);
if(file==NULL) return 0;
fprintf (file,"\
!----------------------------\n\
begin OInterface\n\
prefix = G4Params_\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_palette\n\
type = XmFormDialog\n\
children = G4Params_command\
");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," G4Params_label_%d G4Params_text_%d",parami,parami);
}
fprintf (file," G4Params_ok G4Params_apply G4Params_cancel\n\
autoUnmanage = False\n\
dialogTitle = G4 parameters\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_command\n\
type = XmPushButton\n\
labelString = %s\n\
background = black\n\
foreground = white\n\
leftAttachment = attach_form\n\
rightAttachment = attach_form\n\
topAttachment = attach_form\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
echo `do G4 getCommandGuidance $command`\n\
end\n\
",a_command->GetCommandPath().data());
for(parami=0;parami<paramn;parami++)
{
G4UIparameter* parameter = (G4UIparameter*)a_command->GetParameter(parami);
fprintf (file,"\
!----------------------------\n\
begin OWidget\n\
name = G4Params_label_%d\n\
type = XmLabel\n\
labelString = %s\n\
createCallback = osh> setWidgetResource `thisWidget` height `getWidgetResource G4Params_text_%d height`\n\
leftAttachment = attach_form\n\
",parami,parameter->GetParameterName().data(),parami);
if(parami==0)
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_command\n\
");
}
else
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_text_%d\n\
",parami-1);
}
fprintf (file,"\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_text_%d\n\
type = XmText\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_label_%d\n\
rightAttachment = attach_form\n\
",parami,parami);
if(parami==0)
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_command\n\
");
}
else
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_text_%d\n\
",parami-1);
}
if( ! parameter->GetDefaultValue().isNull() )
{
fprintf (file,"\
value = %s\n\
",parameter->GetDefaultValue().data());
}
fprintf (file,"\
end\n\
");
}
if(paramn>=1)
{
top = CStringCreateF(14+32,"G4Params_text_%d",paramn-1);
}
else
{
top = CStringDuplicate("G4Params_command");
}
fprintf (file,"\
!----------------------------\n\
begin OWidget\n\
name = G4Params_ok\n\
type = XmPushButton\n\
labelString = Ok\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
");
for(parami=0;parami<paramn;parami++)
{
fprintf (file,"\
param_%d=`getWidgetResource G4Params_text_%d value`\\\n\
",parami,parami);
}
fprintf (file,"\
G4 $command");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," $param_%d",parami);
}
fprintf (file,"\\\n\
unmanageWidget `thisWidgetParent`\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_form\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_apply\n\
type = XmPushButton\n\
labelString = Apply\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
",top);
for(parami=0;parami<paramn;parami++)
{
fprintf (file,"\
param_%d=`getWidgetResource G4Params_text_%d value`\\\n\
",parami,parami);
}
fprintf (file,"\
G4 $command");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," $param_%d",parami);
}
fprintf (file,"\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_ok\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_cancel\n\
type = XmPushButton\n\
labelString = Cancel\n\
activateCallback = osh> unmanageWidget `thisWidgetParent`\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_apply\n\
rightAttachment = attach_form\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
",top,top);
CStringDelete (top);
fclose(file);
return 1;
}
+361
View File
@@ -0,0 +1,361 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWo.cc,v 2.5 1998/10/23 14:42:29 barrand Exp $
// GEANT4 tag $Name: geant4-00 $
//
//G4UIWo.cc -- copied from G4UIterminal.cc
//#define DEBUG
#ifdef G4UI_BUILD_WO_SESSION
#include <stdlib.h>
#ifdef HAS_XM
#include <Xm/MainW.h> //For G4OIX
#include <Xm/Label.h>
#endif
#ifdef HAS_XAW
#include <X11/Intrinsic.h>
#include <Xaw/Label.h>
#endif
// Below are the "wanted" packages header files.
// begin Want_h
#include <WoWo.h>
#include <WoXtw.h>
#include <WoXm.h>
#include <WoXaw.h>
#include <WoXo.h>
//end Want_h
/*Co*/
#include <CPrinter.h>
#include <CString.h>
#include <CFile.h>
#include <CText.h>
#include <OShell.h>
/*Xx*/
#include <XWidget.h>
/*Xo*/
#include <XoCamera.h>
/*Wo*/
#include <OEvent.h>
#include <OWidget.h>
#include <OInterface.h>
/*G4*/
#include "G4UIWo.hh"
#include "G4UImanager.hh"
#include "G4UIcommandTree.hh"
#include "G4WoMessenger.hh"
#include "G4StateManager.hh"
#include "G4Xt.hh"
#include "G4oCommon.hh"
static Widget CreateG4View (String,Widget,String,ArgList,Cardinal);
static Widget CreateG4XoView (Widget,String,ArgList,Cardinal);
static Widget CreateG4OIXView (Widget,String,ArgList,Cardinal);
static int Inited = 0;
/***************************************************************************/
G4UIWo::G4UIWo (
int argc
,char** argv
)
:woMessenger(NULL)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI!=NULL) UI->SetSession(this);
if(Inited==1) return; // Below code must be executed once.
// Below are the "wanted" packages include c files.
// begin Want_c
#include <WoWo.ic>
#include <WoXtw.ic>
#include <WoXm.ic>
#include <WoXaw.ic>
#include <WoXo.ic>
// end Want_c
//Declare G4 interpreter to Wo.
OInterpreterCreate ("G4",ExecuteScript,NULL,NULL,NULL);
OShellAddNewCommand (WoGetShellInterpreter(),"G4/G4",Execute_G4);
SetTypes ();
//Declare osh to G4.
woMessenger = new G4WoMessenger (WoGetShellInterpreter());
//Declare G4/vis~/views to Wo.
#ifdef HAS_XO
OClassDeclareCompoundWidget ("G4/G4XoView" ,CreateG4XoView ,xoCameraWidgetClass);
#endif
#ifdef HAS_XM
OClassDeclareCompoundWidget ("G4/G4OIXView",CreateG4OIXView,xmMainWindowWidgetClass);
OClassDeclareWidgetClass ("G4/ThumbWheel" ,NULL);
OClassDeclareWidgetClass ("G4/SoGLwMDrawingArea",NULL);
OClassDeclareWidgetClass ("G4/XoSoArea" ,NULL);
#endif
G4Xt* interactorManager = G4Xt::getInstance (argc,argv,"Wo");
Widget top = (Widget)interactorManager->GetMainInteractor();
XtAppContext context = XtWidgetToApplicationContext(top);
WoSetXt (context,top);
interactorManager->AddDispatcher ((G4DispatchFunction)WoDispatchEvent);
// Load file in SessionStart.
// At this moment the G4VisManager is expected to be created.
// It is needed if an odb file is expected to create some upper G4View.
WoSetInterfaceFile ("nil");
WoStartup (argc,argv);
if(UI!=NULL) UI->SetCoutDestination(this);
Inited = 1;
}
/***************************************************************************/
G4UIWo::~G4UIWo (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI!=NULL) {
UI->SetSession(NULL);
UI->SetCoutDestination(NULL);
}
if(woMessenger!=NULL) delete woMessenger;
}
/***************************************************************************/
G4UIsession* G4UIWo::SessionStart (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
static int Done = 0;
G4Xt* interactorManager = G4Xt::getInstance ();
if(Done==0) { //Load odb file.
char* fileName = NULL;
if(getenv("WOENVIRONMENT")!=NULL) {
fileName = CStringDuplicate (getenv("WOENVIRONMENT"));
} else {
char** argv;
int argc;
argv = interactorManager->GetArguments (&argc);
if(argc>=1) {
char* aname = CFileGetName (argv[0]);
fileName = CStringCreateF (strlen(aname)+4,"%s.odb",aname);
CStringDelete (aname);
}
}
WoSetInterfaceFile (fileName);
OInterfaceLoadFile (fileName,NULL);
OInterfaceSetExtentNotModified ();
if(OWidgetHasMappedShell()==0) XWidgetMap (OWidgetGetFirstShell());
CStringDelete (fileName);
Done = 1;
}
int value;
// Prompt ("session");
interactorManager->DisableSecondaryLoop ();
void* event;
while((event = interactorManager->GetEvent())!=NULL) {
if(OEventIsExit((XEvent*)event,&value)==1)
{
WoDispatchEvent (event);
break;
}
interactorManager->DispatchEvent(event);
}
interactorManager->EnableSecondaryLoop ();
return this;
}
/***************************************************************************/
void G4UIWo::Prompt (
G4String aPrompt
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
CWarnF("%s\n",aPrompt.data());
}
/***************************************************************************/
void G4UIWo::SessionTerminate (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
}
/***************************************************************************/
void G4UIWo::PauseSessionStart (
G4String a_state
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
#ifdef DEBUG
G4cout << "debug : G4UIWo::PauseSessionStart : begin : " << a_state << endl;
#endif
if(a_state=="G4_pause> ")
{
SecondaryLoop ("G4Pause.osh");
}
if(a_state=="BeginOfRun")
{
WoExecuteShellFileInSameContext ("G4RunBegin.osh");
}
else if(a_state=="EndOfRun")
{
WoExecuteShellFileInSameContext ("G4RunEnd.osh");
}
else if(a_state=="BeginOfEvent")
{
WoExecuteShellFileInSameContext ("G4EventBegin.osh");
}
else if(a_state=="EndOfEvent")
{
// Picking with feed back in event data Done here !!!
SecondaryLoop ("G4EventEnd.osh");
}
#ifdef DEBUG
G4cout << "debug : G4UIWo::PauseSessionStart : end." << endl;
#endif
}
/***************************************************************************/
void G4UIWo::SecondaryLoop (
G4String a_file
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4Xt* interactorManager = G4Xt::getInstance ();
int value;
// Prompt (a_prompt);
WoExecuteShellFileInSameContext ((char*)a_file.data());
void* event;
while((event = interactorManager->GetEvent())!=NULL) {
if(OEventIsExit((XEvent*)event,&value)==1) {
WoDispatchEvent (event);
break;
}
interactorManager->DispatchEvent(event);
}
// Prompt ("session");
WoExecuteShellFileInSameContext ((char*)"G4Session.osh");
}
/***************************************************************************/
G4int G4UIWo::ReceiveG4cout (
G4String a_string
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
CWarnF ("%s",a_string.data());
return 0;
}
/***************************************************************************/
G4int G4UIWo::ReceiveG4cerr (
G4String a_string
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
CWarnF ("%s",a_string.data());
return 0;
}
/***************************************************************************/
Widget CreateG4XoView (
Widget a_parent
,String a_name
,ArgList a_list
,Cardinal a_number
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
return CreateG4View("Xo",a_parent,a_name,a_list,a_number);
}
/***************************************************************************/
Widget CreateG4OIXView (
Widget a_parent
,String a_name
,ArgList a_list
,Cardinal a_number
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
return CreateG4View("OIX",a_parent,a_name,a_list,a_number);
}
/***************************************************************************/
Widget CreateG4View (
String a_gs
,Widget a_parent
,String a_name
,ArgList /*a_list*/
,Cardinal /*a_number*/
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
Widget widget = NULL;
/*.........................................................................*/
if(a_gs==NULL) return NULL;
if(a_parent==NULL) return NULL;
if(a_name==NULL) return NULL;
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI!=NULL) {
G4Xt* interactorManager = G4Xt::getInstance ();
interactorManager->SetParentInteractor (a_parent);
interactorManager->SetCreationString (a_name);
// Give name ???
char* command;
command = CStringCreateF(37+strlen(a_gs),
"/vis~/create_view/new_graphics_system %s",
a_gs);
UI->ApplyCommand (command);
CStringDelete (command);
widget = (Widget)interactorManager->GetCreatedInteractor ();
if(widget==a_parent) {
widget = NULL; //No viewer created !
}
interactorManager->SetParentInteractor (NULL);
interactorManager->SetCreatedInteractor (NULL);
interactorManager->SetCreationString (NULL);
}
if(widget==NULL) {
Arg args[1];
CWarnF ("G4UIWo::CreateG4View : can't create a %s view.\n Create a label instead.\n",a_gs);
#ifdef HAS_XM
widget = XmCreateLabel (a_parent,a_name,args,0);
XtManageChild (widget);
#endif
#ifdef HAS_XAW
widget = XtCreateManagedWidget (a_name,labelWidgetClass,a_parent,args,0);
#endif
}
return widget;
}
#include "G4oCommon.icc"
#endif
@@ -0,0 +1,59 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4WoMessenger.cc,v 2.3 1998/07/12 03:42:52 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifdef G4UI_BUILD_WO_SESSION
#include "G4WoMessenger.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include <Wo.h>
G4WoMessenger::G4WoMessenger(OShell a_shell)
:shell(NULL)
,WoDirectory(NULL)
,sendExitCmd(NULL)
,oshCmd(NULL)
{
shell = a_shell;
WoDirectory = new G4UIdirectory("/Wo/");
WoDirectory->SetGuidance ("Wo control commands.");
sendExitCmd = new G4UIcmdWithoutParameter("/Wo/sendExit",this);
sendExitCmd->SetGuidance ("Exit Wo event event loop..");
oshCmd = new G4UIcmdWithAString("/Wo/osh",this);
oshCmd->SetGuidance ("osh interpreter.");
oshCmd->SetParameterName("Command",true);
oshCmd->SetDefaultValue ("");
}
G4WoMessenger::~G4WoMessenger() {
if(oshCmd!=NULL) delete oshCmd;
if(sendExitCmd!=NULL) delete sendExitCmd;
if(WoDirectory!=NULL) delete WoDirectory;
}
void G4WoMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if(command==oshCmd) {
OShellExecute (shell,(char*)newValues.data());
} else if(command==sendExitCmd) {
WoSendExit ();
}
}
G4String G4WoMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
return cv;
}
#endif