proj home

Files   Classes   Functions   Hierarchy  

Public Member Functions | Static Public Attributes | List of all members
rpnprogramstackstate Class Reference

#include <rpn.h>

Collaboration diagram for rpnprogramstackstate:
Collaboration graph

Public Member Functions

 rpnprogramstackstate ()
void init ()
deque< rpnbase * > & ds ()
deque< rpnvar * > & vs ()
ostreamprint (ostream &os) const
void push (rpnprogram *p)
void pop ()
void add (rpnbase *x, string const &s)
void findprogram (bool &found, string &path, rpnprogram *targ)
void find (bool &result, unsigned int &indexi, unsigned int &indexk, rpnvar *&x, string const &nm) const
void erase (string const &nm)
void replace (rpnbase *x, string const &nm)
void exists (bool &res, string const &nm) const
void evaluate (deque< rpnbase * > &ds, string const &nm) const
void recall (deque< rpnbase * > &ds, string const &nm) const
void recallpointer (deque< rpnbase * > &ds, string const &nm) const
 rpnprogramstackstate ()
void init ()
deque< rpnbase * > & ds ()
deque< rpnvar * > & vs ()
ostreamprint (ostream &os) const
void push (rpnprogram *p)
void pop ()
void add (rpnbase *x, string const &s)
void findprogram (bool &found, string &path, rpnprogram *targ)
void find (bool &result, unsigned int &indexi, unsigned int &indexk, rpnvar *&x, string const &nm) const
void erase (string const &nm)
void replace (rpnbase *x, string const &nm)
void exists (bool &res, string const &nm) const
void evaluate (deque< rpnbase * > &ds, string const &nm) const
void recall (deque< rpnbase * > &ds, string const &nm) const
void recallpointer (deque< rpnbase * > &ds, string const &nm) const

Static Public Attributes

static rpnprogram rpnhome
static deque< rpnprogram * > * ps
static deque< rpnbase * > ds2

Detailed Description

Definition at line 328 of file rpn.h.

Constructor & Destructor Documentation

rpnprogramstackstate::rpnprogramstackstate ( )
inline

Definition at line 348 of file rpn.h.

{}
rpnprogramstackstate::rpnprogramstackstate ( )
inline

Definition at line 300 of file rpn2.h.

{}

Member Function Documentation

void rpnprogramstackstate::add ( rpnbase x,
string const &  s 
)
void rpnprogramstackstate::add ( rpnbase x,
string const &  s 
)

Definition at line 737 of file rpn.cpp.

References ps.

Referenced by var::visit().

{
ps->front()->variables.push_front( new rpnvar(x,s) );
}
deque<rpnbase*>& rpnprogramstackstate::ds ( )
inline

Definition at line 306 of file rpn2.h.

{ return ps->front()->v; }
deque<rpnbase*>& rpnprogramstackstate::ds ( )
inline
void rpnprogramstackstate::erase ( string const &  nm)
void rpnprogramstackstate::erase ( string const &  nm)

Definition at line 697 of file rpn.cpp.

References find(), and ps.

Referenced by vardel::visit().

{
bool res;
unsigned int i,k;
rpnvar* x2;
find(res,i,k,x2,nm);
if (res)
{
deque<rpnprogram*>& w = *ps;
w[i]->variables.erase( w[i]->variables.begin()+k );
}
}
void rpnprogramstackstate::evaluate ( deque< rpnbase * > &  ds,
string const &  nm 
) const
void rpnprogramstackstate::evaluate ( deque< rpnbase * > &  ds,
string const &  nm 
) const

Definition at line 633 of file rpn.cpp.

References rpnbase::copy(), rpnbase::eval(), and rpnvar::x.

Referenced by vareval::visit().

{
bool res;
unsigned int i,k;
rpnvar* x;
find(res,i,k,x,nm);
if (res)
x->x->copy()->eval(ds);
}
void rpnprogramstackstate::exists ( bool res,
string const &  nm 
) const
void rpnprogramstackstate::exists ( bool res,
string const &  nm 
) const

Definition at line 620 of file rpn.cpp.

Referenced by varexists::visit().

{
unsigned int i,k;
rpnvar* x;
find(res,i,k,x,nm);
}
void rpnprogramstackstate::find ( bool result,
unsigned int &  indexi,
unsigned int &  indexk,
rpnvar *&  x,
string const &  nm 
) const
void rpnprogramstackstate::find ( bool result,
unsigned int &  indexi,
unsigned int &  indexk,
rpnvar *&  x,
string const &  nm 
) const

Definition at line 581 of file rpn.cpp.

Referenced by erase(), replace(), varinc::visit(), and vardec::visit().

{
result=false;
for (unsigned int i=0, imax=ps->size(); i<imax; ++i)
{
deque<rpnprogram*>& w = *ps; // <TODO> optimize.
if ( ! w[i]->variables.empty() )
{
deque<rpnvar*>& z = w[i]->variables;
for (unsigned int k=0, kmax=z.size(); k<kmax; ++k)
{
if (z[k]->varname==nm)
{
result=true;
indexi = i;
indexk = k;
x = z[k];
return;
}
}
}
}
}
void rpnprogramstackstate::findprogram ( bool found,
string &  path,
rpnprogram targ 
)
void rpnprogramstackstate::findprogram ( bool found,
string &  path,
rpnprogram targ 
)

Definition at line 744 of file rpn.cpp.

{
found = false;
if (targ==&rpnhome)
{
findprogrampath = path = "/";
found = true;
return;
}
findprogram(found,&rpnhome,"",targ);
if (found)
path = findprogrampath;
}
void rpnprogramstackstate::init ( )
void rpnprogramstackstate::init ( )

Definition at line 711 of file rpn.cpp.

References ps, and rpnhome.

Referenced by keyboardinterface::keyboardinterface(), test01(), test02(), and test03().

{
ps->push_front( &rpnhome );
}
void rpnprogramstackstate::pop ( )
inline

Definition at line 317 of file rpn2.h.

{ if(ps->size()>1) ps->pop_front(); }
void rpnprogramstackstate::pop ( )
inline

Definition at line 365 of file rpn.h.

Referenced by outerinput::eval(), varpopd::eval(), rpnprogram::eval_10(), rpnprogram::eval_11(), and pstream::visit().

{ if(ps->size()>1) ps->pop_front(); }
ostream& rpnprogramstackstate::print ( ostream os) const
ostream & rpnprogramstackstate::print ( ostream os) const

Definition at line 716 of file rpn.cpp.

References ps.

Referenced by operator<<().

{
for (unsigned int i=0, imax=ps->size(); i<imax; ++i)
{
os << "{ ";
deque<rpnprogram*>& w = *ps;
if ( ! w[i]->variables.empty() )
{
deque<rpnvar*>& z = w[i]->variables;
for (unsigned int k=0, kmax=z.size(); k<kmax; ++k)
{
os << "(" << z[k]->varname << ",";
z[k]->x->print(os);
os << ") ";
}
}
os << "}" << endl;
}
return os;
}
void rpnprogramstackstate::push ( rpnprogram p)
inline

Definition at line 315 of file rpn2.h.

{ ps->push_front(p); }
void rpnprogramstackstate::push ( rpnprogram p)
inline

Definition at line 363 of file rpn.h.

Referenced by innerinput::eval(), outerinput::eval(), varpushd::visit(), pathcd::visit(), and pstream::visit().

{ ps->push_front(p); }
void rpnprogramstackstate::recall ( deque< rpnbase * > &  ds,
string const &  nm 
) const
void rpnprogramstackstate::recall ( deque< rpnbase * > &  ds,
string const &  nm 
) const

Definition at line 648 of file rpn.cpp.

References rpnbase::copy(), and rpnvar::x.

Referenced by varrecall::visit().

{
bool res;
unsigned int i,k;
rpnvar* x;
find(res,i,k,x,nm);
if (res)
ds.push_front(x->x->copy());
}
void rpnprogramstackstate::recallpointer ( deque< rpnbase * > &  ds,
string const &  nm 
) const
void rpnprogramstackstate::recallpointer ( deque< rpnbase * > &  ds,
string const &  nm 
) const

Definition at line 663 of file rpn.cpp.

References rpnbase::inc(), and rpnvar::x.

Referenced by rpnpointermake::visit(), and rpnvectorpointermake::visit().

{
bool res;
unsigned int i,k;
rpnvar* x;
find(res,i,k,x,nm);
if (res)
{
x->x->inc();
ds.push_front(x->x);
}
}
void rpnprogramstackstate::replace ( rpnbase x,
string const &  nm 
)
void rpnprogramstackstate::replace ( rpnbase x,
string const &  nm 
)

Definition at line 681 of file rpn.cpp.

References rpnbase::dec(), find(), and rpnvar::x.

Referenced by varreplace::visit().

{
bool res;
unsigned int i,k;
rpnvar* x2;
find(res,i,k,x2,nm);
if (res)
{
x2->x->dec();
x2->x = x;
}
else
x->dec(); /* harsh */
}
deque<rpnvar*>& rpnprogramstackstate::vs ( )
inline

Definition at line 309 of file rpn2.h.

{ return ps->front()->variables; }
deque<rpnvar*>& rpnprogramstackstate::vs ( )
inline

Definition at line 357 of file rpn.h.

Referenced by rpnclearvar::eval(), rpnclearboth::eval(), varls::eval(), varmv::visit(), and rpncp::visit().

{ return ps->front()->variables; }

Member Data Documentation

deque< rpnbase * > rpnprogramstackstate::ds2
static

Definition at line 346 of file rpn.h.

Referenced by rpnpush::eval(), rpnpop::eval(), rpnpushn::visit(), and rpnpopn::visit().

deque< rpnprogram * > * rpnprogramstackstate::ps
static
Initial value:
new deque<rpnprogram*>()

Definition at line 343 of file rpn.h.

Referenced by add(), erase(), init(), keyboardinterface::print(), print(), print(), dictadd::visit(), and pathcd::visit().

rpnprogram rpnprogramstackstate::rpnhome
static

Definition at line 340 of file rpn.h.

Referenced by init().


The documentation for this class was generated from the following files: