Commit e476cdea authored by whitlocb's avatar whitlocb

I made the VisItInit functions handle -dv so GetVisItLauncher returns valid

results in all components. This required moving some libutility code to 
libmisc, hence the large number of changes (new header files).

I also modified the viewer so various properties were consolidated into a
ViewerProperties object accessible from the base class. This simplifies book
keeping of properties and makes them accessible to all subclasses.

I used the new ViewerProperties mechanism to conditionally add new menu options
to the popup menu that let the viewer launch gui, cli, or quit from the 
popup menu.




git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@6869 18c085ea-50e0-402c-830e-de6fd14e8384
parent 6b722ff4
......@@ -44,7 +44,6 @@
#include <errno.h> // for errno
#include <visitstream.h>
#include <sys/stat.h>
#include <vector>
#include <string>
......@@ -57,7 +56,7 @@
#include <DatabasePluginManager.h>
#include <DatabasePluginInfo.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <DBOptionsAttributes.h>
#include <BadPermissionException.h>
......
......@@ -41,7 +41,8 @@
// ************************************************************************* //
#include <avtDebugDumpOptions.h>
#include <Utility.h>
#include <visit-config.h>
#include <FileFunctions.h>
#include <DebugStream.h>
using std::string;
......
......@@ -53,7 +53,7 @@
#include <DebugStream.h>
#include <snprintf.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <visitstream.h>
#include <VisItException.h>
......
......@@ -56,7 +56,7 @@
#include <AnnotationObject.h>
#include <avtCallback.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <VisWindow.h>
#include <VisWindowColleagueProxy.h>
......
......@@ -43,7 +43,7 @@
#include <IncompatibleSecurityTokenException.h>
#include <CancelledConnectException.h>
#include <CouldNotConnectException.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <string.h> // for strcmp
#include <stdlib.h>
#include <stdio.h>
......
......@@ -267,9 +267,12 @@ ParentProcess::SetVersion(const std::string &ver)
// Kathleen Bonnell, Thu Aug 9 10:12:18 PDT 2007
// Moved '-rawmap' test to just after '-host' test.
//
// Brad Whitlock, Tue Apr 14 15:13:07 PDT 2009
// I made it return true if any connections were created.
//
// ****************************************************************************
void
bool
ParentProcess::Connect(int numRead, int numWrite, int *argc, char **argv[],
bool createSockets, int failCode)
{
......@@ -362,6 +365,7 @@ ParentProcess::Connect(int numRead, int numWrite, int *argc, char **argv[],
//
// Now that we have connection information, create the connections.
//
bool createdConnections = false;
if(rhostSpecified && createSockets)
{
debug5 << mName << "Creating sockets" << endl;
......@@ -414,10 +418,12 @@ ParentProcess::Connect(int numRead, int numWrite, int *argc, char **argv[],
//
debug5 << mName << "Exchanging type representations." << endl;
ExchangeTypeRepresentations(failCode);
createdConnections = true;
}
}
debug5 << mName << "done" << endl;
return createdConnections;
}
// ****************************************************************************
......
......@@ -87,6 +87,10 @@ class Connection;
// Jeremy Meredith, Wed Apr 30 12:26:25 EDT 2008
// Added apparent host name (tries to resolve localhost into a real name).
//
// Brad Whitlock, Tue Apr 14 15:13:20 PDT 2009
// I made Connect return bool as to whether any connections were created
// since it is possible to call Connect and not create any connections.
//
// ****************************************************************************
class COMM_API ParentProcess
......@@ -94,7 +98,7 @@ class COMM_API ParentProcess
public:
ParentProcess();
~ParentProcess();
void Connect(int numRead, int numWrite, int *argc, char **argv[],
bool Connect(int numRead, int numWrite, int *argc, char **argv[],
bool createSockets, int failCode=0);
const std::string &GetHostName() const;
const std::string &GetApparentHostName();
......
......@@ -65,7 +65,7 @@
#include <IncompatibleSecurityTokenException.h>
#include <CancelledConnectException.h>
#include <CouldNotConnectException.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <DebugStream.h>
#include <snprintf.h>
......
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef FILE_FUNCTIONS_H
#define FILE_FUNCTIONS_H
#include <misc_exports.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
//
// Type definitions
//
typedef void (ProcessDirectoryCallback)(void *, const std::string &, bool,
bool, long);
#if defined(_WIN32)
typedef struct _stat VisItStat_t;
typedef off_t VisItOff_t;
typedef unsigned short mode_t;
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) &S_IFMT) == S_IFDIR)
#endif
#else
#if SIZEOF_OFF64_T > 4
typedef struct stat64 VisItStat_t;
typedef off64_t VisItOff_t;
#else
typedef struct stat VisItStat_t;
typedef off_t VisItOff_t;
#endif
#endif
int MISC_API VisItStat(const char *filename, VisItStat_t *buf);
int MISC_API VisItFstat(int fd, VisItStat_t *buf);
bool MISC_API ReadAndProcessDirectory(const std::string &,
ProcessDirectoryCallback *,
void * = 0,
bool = false);
std::string MISC_API ExpandUserPath(const std::string &);
#endif
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef INSTALLATION_FUNCTIONS_H
#define INSTALLATION_FUNCTIONS_H
#include <string>
#include <misc_exports.h>
typedef enum {CONFIGSTATE_IOERROR,
CONFIGSTATE_FIRSTTIME,
CONFIGSTATE_SUCCESS} ConfigStateEnum;
// Installation directory functions
std::string MISC_API GetVisItInstallationDirectory();
std::string MISC_API GetVisItInstallationDirectory(const char *version);
bool MISC_API ReadInstallationInfo(std::string &distName,
std::string &configName,
std::string &bankName);
std::string MISC_API GetVisItArchitectureDirectory();
std::string MISC_API GetVisItArchitectureDirectory(const char *version);
std::string MISC_API GetVisItLauncher();
// User installation / data functions
std::string MISC_API GetUserVisItDirectory();
MISC_API char * GetDefaultConfigFile(const char *filename = 0, const char *home = 0);
MISC_API char * GetSystemConfigFile(const char *filename = 0);
std::string MISC_API GetUserVisItRCFile();
std::string MISC_API GetSystemVisItRCFile();
int MISC_API ConfigStateGetRunCount(ConfigStateEnum &code);
void MISC_API ConfigStateIncrementRunCount(ConfigStateEnum &code);
// Version functions
int MISC_API GetVisItVersionFromString(const char*, int&, int&, int&);
bool MISC_API VisItVersionsCompatible(const char*, const char*);
bool MISC_API VersionGreaterThan(const std::string &v1, const std::string &v2);
void MISC_API SetIsDevelopmentVersion(bool val);
bool MISC_API GetIsDevelopmentVersion();
#endif
......@@ -67,6 +67,9 @@
# Tom Fogal, Sat Nov 22 16:48:20 MST 2008
# Added Environment
#
# Brad Whitlock, Fri Apr 10 16:12:30 PDT 2009
# I moved some code from utility into InstallationFunctions.C
#
##############################################################################
##
......@@ -81,10 +84,10 @@ CPPFLAGS=-I. @CPPFLAGS@
##
## Files...
##
SRC=DebugStream.C Environment.C PTY.C StackTimer.C \
TimingsManager.C VisItException.C VisItInit.C
HDR=DebugStream.h Environment.h PTY.h StackTimer.h \
TimingsManager.h VisItException.h VisItInit.h
SRC=DebugStream.C Environment.C FileFunctions.C InstallationFunctions.C \
PTY.C StackTimer.C TimingsManager.C VisItException.C VisItInit.C
HDR=DebugStream.h Environment.h FileFunctions.C InstallationFunctions.h \
PTY.h StackTimer.h TimingsManager.h VisItException.h VisItInit.h
OBJ=$(SRC:.C=.o)
LIB=libmisc
......
......@@ -56,6 +56,7 @@
#include <cstring>
#include <DebugStream.h>
#include <InstallationFunctions.h>
#include <TimingsManager.h>
#include <visit-config.h>
......@@ -216,6 +217,9 @@ NewHandler(void)
// Add support for -debug_engine_rank, limiting debug output to the specified
// rank.
//
// Brad Whitlock, Fri Apr 10 16:00:55 PDT 2009
// I added support for reading -dv.
//
// ****************************************************************************
void
......@@ -311,6 +315,10 @@ VisItInit::Initialize(int &argc, char *argv[], int r, int n, bool strip, bool si
{
enableTimings = true;
}
else if (strcmp("-dv", argv[i]) == 0)
{
SetIsDevelopmentVersion(true);
}
else if (strcmp("-svn_revision", argv[i]) == 0)
{
if (strcmp(SVN_REVISION, "") == 0)
......
......@@ -44,7 +44,7 @@
#include <DebugStream.h>
#include <InvalidDirectoryException.h>
#include <InvalidPluginException.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <visit-config.h>
#include <visitstream.h>
#include <stdlib.h>
......
......@@ -39,7 +39,8 @@
#include <ColorTableManager.h>
#include <DataNode.h>
#include <DebugStream.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <FileFunctions.h>
#include <visit-config.h>
#include <ColorControlPoint.h>
......
This diff is collapsed.
......@@ -47,50 +47,15 @@
#include <vectortypes.h>
#include <map>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <float.h>
//
// Type definitions
//
typedef void (ProcessDirectoryCallback)(void *, const std::string &, bool,
bool, long);
typedef enum {CONFIGSTATE_IOERROR,
CONFIGSTATE_FIRSTTIME,
CONFIGSTATE_SUCCESS} ConfigStateEnum;
#if defined(_WIN32)
typedef struct _stat VisItStat_t;
typedef off_t VisItOff_t;
typedef unsigned short mode_t;
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) &S_IFMT) == S_IFDIR)
#endif
#else
#if SIZEOF_OFF64_T > 4
typedef struct stat64 VisItStat_t;
typedef off64_t VisItOff_t;
#else
typedef struct stat VisItStat_t;
typedef off_t VisItOff_t;
#endif
#endif
//
// Function Prototypes
//
char UTILITY_API *CreateMessageStrings(char **, int *, int);
int UTILITY_API LongestCommonPrefixLength(const char * const *, int);
int UTILITY_API LongestCommonSuffixLength(const char * const *, int);
bool UTILITY_API ReadAndProcessDirectory(const std::string &,
ProcessDirectoryCallback *,
void * = 0,
bool = false);
std::string UTILITY_API ExpandUserPath(const std::string &);
// LINUX ONLY
void UTILITY_API GetMemorySize(unsigned int &, unsigned int &);
......@@ -103,40 +68,10 @@ bool UTILITY_API NumericStringCompare(const std::string &str1, const std::strin
std::vector<std::string> UTILITY_API SplitValues(const std::string &buff,
char delim);
std::string UTILITY_API GetVisItInstallationDirectory();
std::string UTILITY_API GetVisItInstallationDirectory(const char *version);
bool UTILITY_API ReadInstallationInfo(std::string &distName,
std::string &configName,
std::string &bankName);
std::string UTILITY_API GetVisItArchitectureDirectory();
std::string UTILITY_API GetVisItArchitectureDirectory(const char *version);
std::string UTILITY_API GetVisItLauncher();
std::string UTILITY_API GetUserVisItDirectory();
UTILITY_API char * GetDefaultConfigFile(const char *filename = 0, const char *home = 0);
UTILITY_API char * GetSystemConfigFile(const char *filename = 0);
std::string UTILITY_API GetUserVisItRCFile();
std::string UTILITY_API GetSystemVisItRCFile();
int UTILITY_API ConfigStateGetRunCount(ConfigStateEnum &code);
void UTILITY_API ConfigStateIncrementRunCount(ConfigStateEnum &code);
int UTILITY_API VisItStat(const char *filename, VisItStat_t *buf);
int UTILITY_API VisItFstat(int fd, VisItStat_t *buf);
bool UTILITY_API VisItInitExtentsToLimits(double *exts, int n);
bool UTILITY_API VisItInitExtentsToLimits(float *exts, int n);
bool UTILITY_API VisItInitExtentsToLimits(int *exts, int n);
// Version functions
int UTILITY_API GetVisItVersionFromString(const char*, int&, int&, int&);
bool UTILITY_API VisItVersionsCompatible(const char*, const char*);
bool UTILITY_API VersionGreaterThan(const std::string &v1, const std::string &v2);
void UTILITY_API SetIsDevelopmentVersion(bool val);
bool UTILITY_API GetIsDevelopmentVersion();
// NOTE: Put these in their own header.
void UTILITY_API PutOnSameXIntervals(int on1, const float *ox1,
const float *oy1, int on2, const float *ox2, const float *oy2,
......
......@@ -67,7 +67,7 @@
#include <TimingsManager.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
using std::string;
......
......@@ -60,7 +60,7 @@
#include <InvalidVariableException.h>
#include <InvalidFilesException.h>
#include <Utility.h>
#include <FileFunctions.h>
using std::string;
......
......@@ -49,7 +49,7 @@
#include <string>
#include <vector>
#include <Utility.h>
#include <FileFunctions.h>
#include <vtkCellData.h>
#include <vtkDemandDrivenPipeline.h>
......
......@@ -68,7 +68,7 @@
#include <Expression.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <BadDomainException.h>
#include <DebugStream.h>
......
......@@ -57,7 +57,7 @@
#include <Expression.h>
#include <StringHelpers.h>
#include <DataNode.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <InvalidFilesException.h>
#include <InvalidVariableException.h>
......
......@@ -64,7 +64,7 @@
#include <DebugStream.h>
#include <InvalidVariableException.h>
#include <InvalidFilesException.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <object.h>
......
......@@ -27,7 +27,7 @@
#include "vtkStructuredGrid.h"
#include "vtkStructuredPoints.h"
#include "vtkUnstructuredGrid.h"
#include "Utility.h"
#include "FileFunctions.h"
#include <sys/stat.h>
#include <ctype.h>
......
......@@ -26,7 +26,7 @@
#include "vtkRectilinearGrid.h"
#include "vtkStructuredGrid.h"
#include "vtkUnstructuredGrid.h"
#include "Utility.h"
#include "FileFunctions.h"
#include <sys/stat.h>
#include <ctype.h>
......
......@@ -46,7 +46,7 @@
#include <vtkObjectFactory.h>
#include <vtkByteSwap.h>
#include <vtkPointData.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <sys/stat.h>
......
......@@ -59,7 +59,7 @@
#include <TimingsManager.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <snprintf.h>
//
......
......@@ -7,7 +7,7 @@
#include <Expression.h>
#include <InvalidVariableException.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
// ****************************************************************************
// Method: avtOpenFOAM constructor
......
......@@ -60,7 +60,7 @@
#include <TimingsManager.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
#define PATRAN_PACKET_NODE_DATA 1
#define PATRAN_PACKET_ELEMENT_DATA 2
......
......@@ -41,7 +41,7 @@
#include <InvalidVariableException.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <avtSTMDFileFormatInterface.h>
#include <avtDatabase.h>
......
......@@ -54,7 +54,7 @@
#include <InvalidFilesException.h>
#include <InvalidVariableException.h>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <DebugStream.h>
const char *avtPoint3DFileFormat::MESHNAME = "points";
......
......@@ -49,7 +49,7 @@
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <snprintf.h>
......
......@@ -57,7 +57,8 @@
#include <TimingsManager.h>
#include <DebugStream.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <InstallationFunctions.h>
//
// TSurf models have a node id associated with each vertex and that nodeid
......
......@@ -39,7 +39,7 @@
#include "vtkUnsignedShortArray.h"
#include "snprintf.h"
#include "Utility.h"
#include "FileFunctions.h"
#include "avtCallback.h"
#include <ctype.h>
......
......@@ -29,7 +29,7 @@
#include "vtkVisItXMLParser.h"
#include "vtkObjectFactory.h"
#include "Utility.h"
#include "FileFunctions.h"
#include "vtk_expat.h"
#include <ctype.h>
#include <sys/stat.h>
......
......@@ -29,7 +29,7 @@
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "Utility.h"
#include "FileFunctions.h"
#include <sys/stat.h>
#include <assert.h>
......
......@@ -60,7 +60,7 @@
#include <avtMTMDFileFormat.h>
#include <avtParallel.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
......
......@@ -72,6 +72,7 @@
#endif
#include <IncompatibleVersionException.h>
#include <VisItInit.h>
#include <InstallationFunctions.h>
#include <InitVTK.h>
#include <LoadBalancer.h>
#include <LostConnectionException.h>
......@@ -200,7 +201,7 @@ protected:
debug5 << mName << "viewer args(";
for(size_t i = 0; i < viewerArgs.size(); ++i)
debug5 << viewerArgs[i] << ", ";
debug5 << endl;
debug5 << ")" << endl;
RemoteProcess::Launch(rHost, createAsThoughLocal, viewerArgs);
}
......@@ -1061,7 +1062,7 @@ Engine::ReverseLaunchViewer(int *argc, char **argv[])
{
// If we're reverse launching and we're the UI process then we can
// launch the viewer.
viewer = new ViewerRemoteProcess("visit");
viewer = new ViewerRemoteProcess(GetVisItLauncher());
#ifdef PARALLEL
if(reverseLaunch && PAR_UIProcess())
#else
......@@ -1071,7 +1072,6 @@ Engine::ReverseLaunchViewer(int *argc, char **argv[])
TRY
{
viewer->AddArgument("-viewer");
// viewer->AddArgument("-defer");
for(size_t j = 0; j < viewerArgs.size(); ++j)
viewer->AddArgument(viewerArgs[j]);
viewer->Open("localhost", // host
......
......@@ -39,7 +39,8 @@
#include <MovieUtility.h>
#include <visit-config.h>
#include <Utility.h>
#include <FileFunctions.h>
#include <InstallationFunctions.h>
#include <MovieTemplateConfig.h>
#include <DebugStream.h>
......
......@@ -53,7 +53,7 @@
#include <QToolTip>
#include <QWidget>
#include <Utility.h>
#include <InstallationFunctions.h>
#include <DataNode.h>
#include <DebugStream.h>
......
......@@ -158,6 +158,7 @@
#include <CouldNotConnectException.h>