Commit 507d239b authored by hrchilds's avatar hrchilds

Update from August 8, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@53 18c085ea-50e0-402c-830e-de6fd14e8384
parent 0293093c
......@@ -180,6 +180,9 @@ $0 = shift @ARGV;
# Sean Ahern, Thu Mar 6 00:57:10 PST 2003
# Added support for debugging VisIt components with totalview.
#
# Sean Ahern, Wed Mar 19 00:32:29 America/Los_Angeles 2003
# Fixed gdb paths.
#
# Jeremy Meredith, Wed Apr 9 12:52:53 PDT 2003
# Made the list of plugin types be in exactly one spot. This way things
# like expression or query plugins will be easier to add. Also improved
......@@ -1098,6 +1101,7 @@ else
print GDBFILE "directory $ENV{VISITHOME}/components/Exceptions/VisWindow\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Expressions/Abstract\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Expressions/General\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Expressions/Management\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Expressions/Math\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Expressions/MeshQuality\n";
print GDBFILE "directory $ENV{VISITHOME}/components/Math\n";
......@@ -1124,7 +1128,7 @@ else
print GDBFILE "directory $ENV{VISITHOME}/mdserver/proxy\n";
print GDBFILE "directory $ENV{VISITHOME}/mdserver/rpc\n";
print GDBFILE "directory $ENV{VISITHOME}/viewer/main\n";
print GDBFILE "directory $ENV{VISITHOME}/viewer/parser\n";
print GDBFILE "directory $ENV{VISITHOME}/common/parser\n";
print GDBFILE "directory $ENV{VISITHOME}/viewer/proxy\n";
print GDBFILE "directory $ENV{VISITHOME}/viewer/rpc\n";
print GDBFILE "directory $ENV{VISITHOME}/visitpy\n";
......
......@@ -60,6 +60,9 @@
# Sean Ahern, Mon Jun 10 16:32:01 PDT 2002
# Gutted while moving things to a common location.
#
# Sean Ahern, Tue Jan 21 12:40:11 PST 2003
# Added the parser directory.
#
# Brad Whitlock, Fri May 2 14:04:49 PST 2003
# I added proxybase.
#
......@@ -69,7 +72,7 @@
@VARIABLES@
@DIRTARGETS@
SUBDIRS=misc utility comm state plugin proxybase winutil
SUBDIRS=misc utility comm state plugin proxybase winutil parser
message:
@echo
......
// ************************************************************************* //
// Init.C //
// ************************************************************************* //
#include <Init.h>
#include <stdio.h>
......@@ -20,6 +24,9 @@ static void RemovePrependedDirs(const char *, char *);
static void Finalize(void);
static char executableName[256];
static char componentName[256];
static ErrorFunction errorFunction = NULL;
static void *errorFunctionArgs = NULL;
// ****************************************************************************
// Function: striparg
......@@ -274,6 +281,52 @@ Init::GetExecutableName(void)
return (const char *) executableName;
}
// ****************************************************************************
// Function: Init::ComponentRegisterErrorFunction
//
// Purpose:
// Registers an error function.
//
// Programmer: Hank Childs
// Creation: August 8, 2003
//
// ****************************************************************************
void
Init::ComponentRegisterErrorFunction(ErrorFunction ef, void *args)
{
errorFunctionArgs = args;
errorFunction = ef;
}
// ****************************************************************************
// Function: Init::ComponentIssueError
//
// Purpose:
// Issues an error message on that component.
//
// Programmer: Hank Childs
// Creation: August 8, 2003
//
// ****************************************************************************
void
Init::ComponentIssueError(const char *msg)
{
debug1 << "Error issued: " << msg << endl;
if (errorFunction != NULL)
{
errorFunction(errorFunctionArgs, msg);
}
else
{
debug1 << "Not able to issue error because no function was registered."
<< endl;
}
}
// ****************************************************************************
// Method: Finalize
//
......
// ************************************************************************* //
// Init.h //
// ************************************************************************* //
#ifndef INIT_H
#define INIT_H
#include <misc_exports.h>
typedef void (*ErrorFunction)(void *, const char *);
// ****************************************************************************
// Namespace: Init
//
// Purpose:
// A module that does initialization procedures. It has been extended to
// contain callbacks for components that allow it to get the compnent
// name, issue warnings, etc.
//
// Programmer: "Hank Childs" (Added documentation)
// Creation: August 8, 2003 (Added documentation)
//
// ****************************************************************************
namespace Init
{
MISC_API void Initialize(int &argc, char *argv[], int r=0, int n=1, bool strip=true);
MISC_API void SetComponentName(const char *);
MISC_API const char * GetExecutableName();
MISC_API const char * GetComponentName();
MISC_API void ComponentIssueError(const char *);
MISC_API void ComponentRegisterErrorFunction(ErrorFunction, void *);
}
#endif
#ifndef CONFIGURATINGITEM_H
#define CONFIGURATINGITEM_H
#include <viewer_parser_exports.h>
#include <parser_exports.h>
class ConfiguratingSet;
#include "SymbolSet.h"
......@@ -17,7 +17,7 @@ class ConfiguratingSet;
// Creation: April 4, 2002
//
// ****************************************************************************
class VIEWER_PARSER_API ConfiguratingItem
class PARSER_API ConfiguratingItem
{
public:
ConfiguratingItem(const ConfiguratingItem &ci);
......
#ifndef CONFIGURATINGSET_H
#define CONFIGURATINGSET_H
#include <viewer_parser_exports.h>
#include <parser_exports.h>
#include <vector>
#include <map>
......@@ -18,7 +18,7 @@
// Creation: April 4, 2002
//
// ****************************************************************************
class VIEWER_PARSER_API ConfiguratingSet
class PARSER_API ConfiguratingSet
{
friend struct State;
public:
......
......@@ -74,14 +74,15 @@ ExprGrammar::ExprGrammar() : Grammar()
AddRule(Rule(3, Expr) >> Expr + T_Slash + Expr ); // division
AddRule(Rule(4, Expr) >> Expr + T_Exp + Expr ); // exponentiation
AddRule(Rule(5, Expr) >> Expr + T_Mod + Expr ); // modulo
AddRule(Rule(6, Expr) >> T_Minus + Expr, 5); // u-negative, prec=5
AddRule(Rule(7, Expr) >> T_LParen + Expr + T_RParen );
AddRule(Rule(8, Expr) >> Constant );
AddRule(Rule(9, Expr) >> Vector );
AddRule(Rule(10, Expr) >> List );
AddRule(Rule(11, Expr) >> Function );
AddRule(Rule(12, Expr) >> Variable );
AddRule(Rule(13, Expr) >> Database );
AddRule(Rule(6, Expr) >> Expr + T_LBracket + T_Integer + T_RBracket ); // index
AddRule(Rule(7, Expr) >> T_Minus + Expr, 5); // u-negative, prec=5
AddRule(Rule(8, Expr) >> T_LParen + Expr + T_RParen );
AddRule(Rule(9, Expr) >> Constant );
AddRule(Rule(10, Expr) >> Vector );
AddRule(Rule(11, Expr) >> List );
AddRule(Rule(12, Expr) >> Function );
AddRule(Rule(13, Expr) >> Variable );
AddRule(Rule(14, Expr) >> Database );
// Constant
AddRule(Rule(0, Constant) >> T_Integer );
......@@ -167,6 +168,7 @@ ExprGrammar::ExprGrammar() : Grammar()
SetPrec(T_Slash, 3);
SetPrec(T_Exp, 4);
// Unary minus is 5 -- see rule above
SetPrec(T_LBracket, 6);
}
// ****************************************************************************
......
#ifndef EXPRGRAMMAR_H
#define EXPRGRAMMAR_H
#include <viewer_parser_exports.h>
#include <parser_exports.h>
#include "Grammar.h"
......@@ -14,7 +14,7 @@
// Creation: April 5, 2002
//
// ****************************************************************************
class VIEWER_PARSER_API ExprGrammar : public Grammar
class PARSER_API ExprGrammar : public Grammar
{
public:
ExprGrammar();
......@@ -54,22 +54,22 @@ extern Symbol T_Bool;
// ------------------------------------------------------------------------
// NON-TERMINALS
// ------------------------------------------------------------------------
extern VIEWER_PARSER_API Symbol Expr;
extern VIEWER_PARSER_API Symbol Constant;
extern VIEWER_PARSER_API Symbol Vector;
extern VIEWER_PARSER_API Symbol List;
extern VIEWER_PARSER_API Symbol ListElems;
extern VIEWER_PARSER_API Symbol ListElem;
extern VIEWER_PARSER_API Symbol Function;
extern VIEWER_PARSER_API Symbol Args;
extern VIEWER_PARSER_API Symbol Arg;
extern VIEWER_PARSER_API Symbol PathSpec;
extern VIEWER_PARSER_API Symbol MultiSlash;
extern VIEWER_PARSER_API Symbol Variable;
extern VIEWER_PARSER_API Symbol Database;
extern VIEWER_PARSER_API Symbol DBSpec;
extern VIEWER_PARSER_API Symbol PathMachSpec;
extern VIEWER_PARSER_API Symbol MachSpec;
extern VIEWER_PARSER_API Symbol TimeSpec;
extern PARSER_API Symbol Expr;
extern PARSER_API Symbol Constant;
extern PARSER_API Symbol Vector;
extern PARSER_API Symbol List;
extern PARSER_API Symbol ListElems;
extern PARSER_API Symbol ListElem;
extern PARSER_API Symbol Function;
extern PARSER_API Symbol Args;
extern PARSER_API Symbol Arg;
extern PARSER_API Symbol PathSpec;
extern PARSER_API Symbol MultiSlash;
extern PARSER_API Symbol Variable;
extern PARSER_API Symbol Database;
extern PARSER_API Symbol DBSpec;
extern PARSER_API Symbol PathMachSpec;
extern PARSER_API Symbol MachSpec;
extern PARSER_API Symbol TimeSpec;
#endif
#ifndef EXPRGRAMMARNODE_H
#define EXPRGRAMMARNODE_H
#include <viewer_parser_exports.h>
#include <parser_exports.h>
#include <vector>
#include "Pos.h"
#include <Pos.h>
#include <set>
class Identifier;
class Token;
class EngineProxy;
class ViewerPlot;
// ****************************************************************************
// Class: ExprGrammarNode
//
......@@ -22,13 +20,15 @@ class ViewerPlot;
// Modifications:
//
// ****************************************************************************
class VIEWER_PARSER_API ExprGrammarNode
class PARSER_API ExprGrammarNode
{
public:
ExprGrammarNode(const Pos &p) : pos(p) { }
virtual ~ExprGrammarNode() { }
const Pos &GetPos() const {return pos;}
Pos &GetPos() {return pos;}
Pos &GetPos() {return pos;}
virtual const std::string GetTypeName() {return "ExprGrammarNode";}
virtual std::set<std::string> GetVarLeaves() {return std::set<std::string>();}
virtual void Print(ostream &o, std::string s="")
{
static int indent = 0;
......
#include <stdio.h>
#include <ExprNode.h>
#include <Token.h>
#include <EngineProxy.h>
#include <ViewerPlot.h>
#include <DebugStream.h>
#include <ExpressionException.h>
#include <ViewerEngineManager.h>
#include <snprintf.h>
using std::vector;
......@@ -23,24 +20,6 @@ ConstExpr::PrintNode(ostream &o)
token->PrintNode(o);
}
void
ConstExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
{
debug1 << "ConstExpr::GeneratePlot: NOT YET IMPLEMENTED" << endl;
}
// class MathExpr
MathExpr::MathExpr(const Pos &p, char o) : ExprNode(p)
{
op = o;
}
// class UnaryExpr
UnaryExpr::UnaryExpr(const Pos &p, char o, ExprNode *e) : MathExpr(p, o)
{
expr = e;
}
void
UnaryExpr::PrintNode(ostream &o)
{
......@@ -48,23 +27,6 @@ UnaryExpr::PrintNode(ostream &o)
expr->Print(o,"Expr: ");
}
void
UnaryExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
{
expr->GeneratePlot(engine, plot, time);
char opstring[2];
opstring[0] = op;
opstring[1] = '\0';
engine->ApplyNamedFunction(opstring,1);
}
// class BinaryExpr
BinaryExpr::BinaryExpr(const Pos &p, char o, ExprNode *l, ExprNode *r) : MathExpr(p, o)
{
left = l;
right = r;
}
void
BinaryExpr::PrintNode(ostream &o)
{
......@@ -73,24 +35,28 @@ BinaryExpr::PrintNode(ostream &o)
right->Print(o,"Right: ");
}
void
BinaryExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
std::set<std::string>
BinaryExpr::GetVarLeaves()
{
left->GeneratePlot(engine, plot, time);
right->GeneratePlot(engine, plot, time);
char opstring[2];
opstring[0] = op;
opstring[1] = '\0';
engine->ApplyNamedFunction(opstring,2);
std::set<std::string> lset = left->GetVarLeaves();
std::set<std::string> rset = right->GetVarLeaves();
while (!rset.empty())
{
std::set<std::string>::iterator i = rset.begin();
lset.insert(*i);
rset.erase(i);
}
return lset;
}
// class VectorExpr
VectorExpr::VectorExpr(const Pos &p, ExprNode *xe, ExprNode *ye, ExprNode *ze)
: ExprNode(p)
void
IndexExpr::PrintNode(ostream &o)
{
x = xe;
y = ye;
z = ze;
o << "Index operation: (" << ":" << endl;
expr->Print(o, "Expr: ");
o << " index: " << ind << endl;
}
void
......@@ -102,19 +68,28 @@ VectorExpr::PrintNode(ostream &o)
if (z) z->Print(o);
}
void
VectorExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
std::set<std::string>
VectorExpr::GetVarLeaves()
{
debug1 << "VectorExpr::GeneratePlot: NOT YET IMPLEMENTED" << endl;
}
std::set<std::string> xset = x->GetVarLeaves();
std::set<std::string> yset = y->GetVarLeaves();
std::set<std::string> zset = z->GetVarLeaves();
// class ListElemExpr
ListElemExpr::ListElemExpr(const Pos &p, ExprNode *b, ExprNode *e,
ExprNode *s) : ExprGrammarNode(p)
{
beg = b;
end = e;
skip = s;
while (!yset.empty())
{
std::set<std::string>::iterator i = yset.begin();
xset.insert(*i);
yset.erase(i);
}
while (!zset.empty())
{
std::set<std::string>::iterator i = zset.begin();
xset.insert(*i);
zset.erase(i);
}
return xset;
}
void
......@@ -151,17 +126,13 @@ ListExpr::PrintNode(ostream &o)
}
}
// class ArgExpr
ArgExpr::ArgExpr(const Pos &p, ExprNode *e) : ExprGrammarNode(p)
{
id = NULL;
expr = e;
}
ArgExpr::ArgExpr(const Pos &p, Identifier *i, ExprNode *e) : ExprGrammarNode(p)
std::set<std::string>
ListExpr::GetVarLeaves()
{
id = i;
expr = e;
if (elems->size() != 0)
return (*elems)[0]->GetVarLeaves();
else
return std::set<std::string>();
}
void
......@@ -181,6 +152,7 @@ ArgsExpr::ArgsExpr(const Pos &p, ArgExpr *e) : ExprGrammarNode(p)
args = new vector<ArgExpr*>;
args->push_back(e);
}
void
ArgsExpr::AddArg(ArgExpr *e)
{
......@@ -199,13 +171,6 @@ ArgsExpr::PrintNode(ostream &o)
}
}
// class FunctionExpr
FunctionExpr::FunctionExpr(const Pos &p, Identifier *i, ArgsExpr *e) : ExprNode(p)
{
name = i;
args = e;
}
void
FunctionExpr::PrintNode(ostream &o)
{
......@@ -216,23 +181,25 @@ FunctionExpr::PrintNode(ostream &o)
o << "no arguments\n";
}
void
FunctionExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
std::set<std::string>
FunctionExpr::GetVarLeaves()
{
std::vector<ArgExpr*> *arguments = args->GetArgs();
std::vector<ArgExpr*>::iterator i;
for(i=arguments->begin(); i != arguments->end(); i++)
std::vector<ArgExpr*> *a = args->GetArgs();
std::set<std::string> ret;
for (int i = 0; i < a->size(); i++)
{
(*i)->GetExpr()->GeneratePlot(engine, plot, time);
std::set<std::string> vars = (*a)[i]->GetExpr()->GetVarLeaves();
while (!vars.empty())
{
std::set<std::string>::iterator i = vars.begin();
ret.insert(*i);
vars.erase(i);
}
}
engine->ApplyNamedFunction(name->GetVal(),arguments->size());
}
// class PathExpr
PathExpr::PathExpr(const Pos &p, const std::string &s) : ExprGrammarNode(p)
{
basename = s;
fullpath = basename;
return ret;
}
void
......@@ -252,25 +219,12 @@ PathExpr::PrintNode(ostream &o)
o << endl;
}
// class MachExpr
MachExpr::MachExpr(const Pos &p, Identifier *i) : ExprGrammarNode(p)
{
host = i;
}
void
MachExpr::PrintNode(ostream &o)
{
o << "Machine="<<host->GetVal().c_str()<<endl;
}
// class TimeExpr
TimeExpr::TimeExpr(const Pos &p, ListExpr *l, Type t) : ExprGrammarNode(p)
{
list = l;
type = t;
}
void
TimeExpr::PrintNode(ostream &o)
{
......@@ -283,13 +237,6 @@ TimeExpr::PrintNode(ostream &o)
list->Print(o);
}
// class DBExpr
DBExpr::DBExpr(const Pos &p, PathExpr *f, MachExpr *m, TimeExpr *t) : ExprGrammarNode(p)
{
file = f;
mach = m;
time = t;
}
void
DBExpr::PrintNode(ostream &o)
{
......@@ -302,14 +249,6 @@ DBExpr::PrintNode(ostream &o)
time->Print(o);
}
// class VarExpr
VarExpr::VarExpr(const Pos &p, DBExpr *d, PathExpr *v, bool exp) : ExprNode(p)
{
db = d;
var = v;
canexpand = exp;
}
void
VarExpr::PrintNode(ostream &o)
{
......@@ -322,16 +261,12 @@ VarExpr::PrintNode(ostream &o)
var->Print(o, "Var");
}
void
VarExpr::GeneratePlot(EngineProxy *engine, ViewerPlot *plot, const int time)
std::set<std::string>
VarExpr::GetVarLeaves()
{
// Tell the engine to read a single db of data.
if (db != NULL)
{
debug1 << "VarExpr::GeneratePlot: Database specifications are not yet supported" << endl;
EXCEPTION1(ExpressionException, "Database specifications are not yet supported");
}
engine->ReadDataObject(plot->GetDatabaseName(), var->GetFullpath(), time,
plot->GetSILRestriction(),
*ViewerEngineManager::Instance()->GetMaterialClientAtts());
std::set<std::string> ret;
ret.insert(var->GetFullpath());
return ret;
}
#ifndef EXPRNODEFACTORY_H
#define EXPRNODEFACTORY_H
#include <parser_exports.h>
#include <ExprNode.h>
#include <Pos.h>
class Token;
class