Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the 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.
|
||||
//
|
||||
|
||||
#include <rw/ctoken.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
@@ -14,6 +15,9 @@
|
||||
|
||||
#include "G4InteractorMessenger.hh"
|
||||
|
||||
#define STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
|
||||
#define STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}}
|
||||
|
||||
static G4bool GetValues (G4String,int,G4String*);
|
||||
|
||||
G4InteractorMessenger::G4InteractorMessenger (
|
||||
@@ -81,27 +85,36 @@ G4bool GetValues (
|
||||
,G4String* params
|
||||
)
|
||||
{
|
||||
RWCTokenizer newValueToken( newValue );
|
||||
G4String aToken;
|
||||
char* value = STRDUP(newValue.data());
|
||||
if(value==NULL) return false;
|
||||
char* tok = strtok(value," ");
|
||||
for( int i=0; i<paramn;i++ ) {
|
||||
aToken = (G4String)newValueToken();
|
||||
if( aToken(0)=='"' ) {
|
||||
while( aToken(aToken.length()-1) != '"' ) {
|
||||
G4String additionalToken = (G4String)newValueToken();
|
||||
if( additionalToken.isNull() ) {
|
||||
if(tok==NULL) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
}
|
||||
G4String token = tok;
|
||||
if( token(0)=='"' ) {
|
||||
while( token(token.length()-1) != '"' ) {
|
||||
tok = strtok(NULL," ");
|
||||
if( (tok==NULL) || (*tok=='\0')) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
}
|
||||
aToken += " ";
|
||||
aToken += additionalToken;
|
||||
token += " ";
|
||||
token += tok;
|
||||
}
|
||||
aToken = (G4String)aToken.strip(G4String::both,'"');
|
||||
token = (G4String)token.strip(G4String::both,'"');
|
||||
}
|
||||
if( aToken.isNull() ) {
|
||||
if( token.isNull() ) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
} else {
|
||||
params[i] = aToken;
|
||||
params[i] = token;
|
||||
}
|
||||
tok = strtok(NULL," ");
|
||||
}
|
||||
STRDEL(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user