includes/operations/interface_addition.h \
includes/operations/matrix_multiplication.h \
includes/operations/matrix_division.h \
-includes/exps/floatexp.hxx \
-includes/exps/intexp.hxx \
includes/exps/returnexp.hxx \
includes/exps/doubleexp.hxx \
includes/exps/dollarvar.hxx \
includes/exps/dec.hxx \
includes/exps/logicalopexp.hxx \
includes/exps/decls.hxx \
-includes/exps/decs.hxx \
includes/exps/transposeexp.hxx \
includes/exps/ifexp.hxx \
includes/exps/whileexp.hxx \
includes/exps/stepvisitor.hxx \
includes/exps/controlexp.hxx \
includes/exps/assignlistexp.hxx \
-includes/exps/anydecs.hxx \
includes/exps/matrixexp.hxx \
includes/exps/allexp.hxx \
includes/exps/allvar.hxx \
includes/operations/interface_addition.h \
includes/operations/matrix_multiplication.h \
includes/operations/matrix_division.h \
-includes/exps/floatexp.hxx \
-includes/exps/intexp.hxx \
includes/exps/returnexp.hxx \
includes/exps/doubleexp.hxx \
includes/exps/dollarvar.hxx \
includes/exps/dec.hxx \
includes/exps/logicalopexp.hxx \
includes/exps/decls.hxx \
-includes/exps/decs.hxx \
includes/exps/transposeexp.hxx \
includes/exps/ifexp.hxx \
includes/exps/whileexp.hxx \
includes/exps/stepvisitor.hxx \
includes/exps/controlexp.hxx \
includes/exps/assignlistexp.hxx \
-includes/exps/anydecs.hxx \
includes/exps/matrixexp.hxx \
includes/exps/allexp.hxx \
includes/exps/allvar.hxx \
<ClInclude Include="includes\exps\alldec.hxx" />
<ClInclude Include="includes\exps\allexp.hxx" />
<ClInclude Include="includes\exps\allvar.hxx" />
- <ClInclude Include="includes\exps\anydecs.hxx" />
<ClInclude Include="includes\exps\arraylistexp.hxx" />
<ClInclude Include="includes\exps\arraylistvar.hxx" />
<ClInclude Include="includes\exps\assignexp.hxx" />
<ClInclude Include="includes\exps\controlexp.hxx" />
<ClInclude Include="includes\exps\dec.hxx" />
<ClInclude Include="includes\exps\decls.hxx" />
- <ClInclude Include="includes\exps\decs.hxx" />
<ClInclude Include="includes\exps\dollarvar.hxx" />
<ClInclude Include="includes\exps\doubleexp.hxx" />
<ClInclude Include="includes\exps\exp.hxx" />
<ClInclude Include="includes\exps\fieldexp.hxx" />
- <ClInclude Include="includes\exps\floatexp.hxx" />
<ClInclude Include="includes\exps\forexp.hxx" />
<ClInclude Include="includes\exps\functiondec.hxx" />
<ClInclude Include="includes\exps\ifexp.hxx" />
- <ClInclude Include="includes\exps\intexp.hxx" />
<ClInclude Include="includes\exps\listexp.hxx" />
<ClInclude Include="includes\exps\location.hxx" />
<ClInclude Include="includes\exps\logicalopexp.hxx" />
<ClInclude Include="includes\exps\selectexp.hxx" />
<ClInclude Include="includes\exps\seqexp.hxx" />
<ClInclude Include="includes\exps\simplevar.hxx" />
- <ClInclude Include="includes\exps\stepvisitor.hxx" />
<ClInclude Include="includes\exps\stringexp.hxx" />
<ClInclude Include="includes\exps\token.hxx" />
<ClInclude Include="includes\exps\transposeexp.hxx" />
<ClInclude Include="includes\exps\allvar.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
- <ClInclude Include="includes\exps\anydecs.hxx">
- <Filter>Header Files\exps</Filter>
- </ClInclude>
<ClInclude Include="includes\exps\arraylistexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
<ClInclude Include="includes\exps\decls.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
- <ClInclude Include="includes\exps\decs.hxx">
- <Filter>Header Files\exps</Filter>
- </ClInclude>
<ClInclude Include="includes\exps\dollarvar.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
<ClInclude Include="includes\exps\fieldexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
- <ClInclude Include="includes\exps\floatexp.hxx">
- <Filter>Header Files\exps</Filter>
- </ClInclude>
<ClInclude Include="includes\exps\forexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
<ClInclude Include="includes\exps\ifexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
- <ClInclude Include="includes\exps\intexp.hxx">
- <Filter>Header Files\exps</Filter>
- </ClInclude>
<ClInclude Include="includes\exps\listexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
<ClInclude Include="includes\exps\simplevar.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
- <ClInclude Include="includes\exps\stepvisitor.hxx">
- <Filter>Header Files\exps</Filter>
- </ClInclude>
<ClInclude Include="includes\exps\stringexp.hxx">
<Filter>Header Files\exps</Filter>
</ClInclude>
for (MapSymInfo::const_iterator i = symsinfo.begin(), end = symsinfo.end(); i != end; ++i)
{
- std::wcout << i->first.name_get() << L" -> " << i->second << std::endl;
+ std::wcout << i->first.getName() << L" -> " << i->second << std::endl;
}
std::wcout << std::endl;
}
}
- inline void result_set(Result & val)
+ inline void setResult(Result & val)
{
_result = val;
}
- inline void result_set(Result && val)
+ inline void setResult(Result && val)
{
_result = val;
}
- inline Result & result_get()
+ inline Result & getResult()
{
return _result;
}
void visit(ast::SimpleVar & e)
{
- symbol::Symbol & sym = e.name_get();
+ symbol::Symbol & sym = e.getName();
TIType typ = get_ti(sym);
- e.decorator_get().res = Result(typ, false);
- result_set(e.decorator_get().res);
- set_sym_use(e.name_get(), SymInfo::READ);
+ e.getDecorator().res = Result(typ, false);
+ setResult(e.getDecorator().res);
+ set_sym_use(e.getName(), SymInfo::READ);
}
void visit(ast::DollarVar & e)
void visit(ast::ArrayListVar & e)
{
- const std::list<ast::Var *> & vars = e.vars_get();
+ const std::list<ast::Var *> & vars = e.getVars();
for (std::list<ast::Var *>::const_iterator i = vars.begin(), end = vars.end(); i != end ; ++i)
{
(*i)->accept(*this);
}
}
- void visit(ast::IntExp & e)
- {
- // nothing to do
- }
-
- void visit(ast::FloatExp & e)
- {
- // nothing to do
- }
-
void visit(ast::DoubleExp & e)
{
- e.decorator_get().res = Result(TIType(TIType::DOUBLE, 1, 1), false);
- result_set(e.decorator_get().res);
+ e.getDecorator().res = Result(TIType(TIType::DOUBLE, 1, 1), false);
+ setResult(e.getDecorator().res);
}
void visit(ast::BoolExp & e)
{
- e.decorator_get().res = Result(TIType(TIType::BOOLEAN, 1, 1), false);
- result_set(e.decorator_get().res);
+ e.getDecorator().res = Result(TIType(TIType::BOOLEAN, 1, 1), false);
+ setResult(e.getDecorator().res);
}
void visit(ast::StringExp & e)
{
- e.decorator_get().res = Result(TIType(TIType::STRING, 1, 1), false);
- result_set(e.decorator_get().res);
+ e.getDecorator().res = Result(TIType(TIType::STRING, 1, 1), false);
+ setResult(e.getDecorator().res);
}
void visit(ast::CommentExp & e)
void visit(ast::CallExp & e)
{
- e.name_get().accept(*this);
+ e.getName().accept(*this);
const std::list<ast::Exp *> & args = e.args_get();
for (std::list<ast::Exp *>::const_iterator i = args.begin(), end = args.end(); i != end; ++i)
{
void visit(ast::OpExp & e)
{
e.left_get().accept(*this);
- Result LR = result_get();
+ Result LR = getResult();
e.right_get().accept(*this);
- Result & RR = result_get();
+ Result & RR = getResult();
const TIType & LT = LR.get_type();
const TIType & RT = RR.get_type();
TIType resT;
allocTmp = true;
}
- e.decorator_get().res = Result(resT, allocTmp);
- result_set(e.decorator_get().res);
+ e.getDecorator().res = Result(resT, allocTmp);
+ setResult(e.getDecorator().res);
}
void visit(ast::LogicalOpExp & e)
void visit(ast::AssignExp & e)
{
- if (e.left_exp_get().is_simple_var())
+ if (e.getLeftExp().isSimpleVar())
{
- ast::SimpleVar & var = static_cast<ast::SimpleVar &>(e.left_exp_get());
- symbol::Symbol & sym = var.name_get();
+ ast::SimpleVar & var = static_cast<ast::SimpleVar &>(e.getLeftExp());
+ symbol::Symbol & sym = var.getName();
- e.right_exp_get().accept(*this);
- var.decorator_get().res = result_get();
+ e.getRightExp().accept(*this);
+ var.getDecorator().res = getResult();
set_sym_use(sym, SymInfo::REPLACE);
- set_sym_type(sym, result_get().get_type());
+ set_sym_type(sym, getResult().get_type());
}
else
{
void visit(ast::IfExp & e)
{
- e.test_get().accept(*this);
- e.then_get().accept(*this);
- if (e.has_else())
+ e.getTest().accept(*this);
+ e.getThen().accept(*this);
+ if (e.hasElse())
{
- e.else_get().accept(*this);
+ e.getElse().accept(*this);
}
}
void visit(ast::WhileExp & e)
{
- e.test_get().accept(*this);
- e.body_get().accept(*this);
+ e.getTest().accept(*this);
+ e.getBody().accept(*this);
}
void visit(ast::ForExp & e)
{
- e.vardec_get().accept(*this);
- e.body_get().accept(*this);
+ e.getVardec().accept(*this);
+ e.getBody().accept(*this);
- MapSymInfo::const_iterator it = symsinfo.find(e.vardec_get().name_get());
+ MapSymInfo::const_iterator it = symsinfo.find(e.getVardec().getName());
if (it->second.read)
{
- e.vardec_get().list_info_get().set_read_in_loop(true);
+ e.getVardec().list_info_get().set_read_in_loop(true);
}
}
void visit(ast::SelectExp & e)
{
- e.select_get()->accept(*this);
- ast::cases_t * cases = e.cases_get();
+ e.getSelect()->accept(*this);
+ ast::cases_t * cases = e.getCases();
for (ast::cases_t::const_iterator i = cases->begin(), end = cases->end(); i != end; ++i)
{
(*i)->accept(*this);
void visit(ast::CaseExp & e)
{
- e.test_get()->accept(*this);
- e.body_get()->accept(*this);
+ e.getTest()->accept(*this);
+ e.getBody()->accept(*this);
}
void visit(ast::ReturnExp & e)
{
// a.b.c <=> (a.b).c where a.b is the head and c is the tail
- //e.head_get()->accept(*this);
- //e.tail_get()->accept(*this);
+ //e.getHead()->accept(*this);
+ //e.getTail()->accept(*this);
}
void visit(ast::NotExp & e)
void visit(ast::SeqExp & e)
{
- for (std::list<ast::Exp *>::const_iterator i = e.exps_get().begin(), end = e.exps_get().end(); i != end; ++i)
+ for (std::list<ast::Exp *>::const_iterator i = e.getExps().begin(), end = e.getExps().end(); i != end; ++i)
{
(*i)->accept(*this);
}
void visit(ast::ArrayListExp & e)
{
- const std::list<ast::Exp *> & exps = e.exps_get();
+ const std::list<ast::Exp *> & exps = e.getExps();
for (std::list<ast::Exp *>::const_iterator i = exps.begin(), end = exps.end(); i != end; ++i)
{
(*i)->accept(*this);
void visit(ast::VarDec & e)
{
// VarDec is only used in For loop for iterator declaration
- symbol::Symbol & sym = e.name_get();
- if (e.init_get().is_list_exp())
+ symbol::Symbol & sym = e.getSymbol();
+ if (e.getInit().isListExp())
{
- ast::ListExp & le = static_cast<ast::ListExp &>(e.init_get());
- if (le.start_get().is_double_exp() && le.step_get().is_double_exp() && le.end_get().is_double_exp())
+ ast::ListExp & le = static_cast<ast::ListExp &>(e.getInit());
+ if (le.start_get().isDoubleExp() && le.step_get().isDoubleExp() && le.end_get().isDoubleExp())
{
ForList64 fl(static_cast<const ast::DoubleExp &>(le.start_get()).value_get(),
static_cast<const ast::DoubleExp &>(le.step_get()).value_get(),
static_cast<const ast::DoubleExp &>(le.end_get()).value_get());
- e.list_info_set(fl);
+ e.setListInfo(fl);
set_sym_use(sym, SymInfo::REPLACE, SymInfo::FOR_IT);
set_sym_type(sym, fl.get_type());
// No need to visit the list (it has been visited just before)
}
else
{
- e.list_info_set(ForList64());
+ e.setListInfo(ForList64());
le.accept(*this);
}
}
{
e.args_get().accept(*this);
e.returns_get().accept(*this);
- e.body_get().accept(*this);
+ e.getBody().accept(*this);
}
void visit(ast::ListExp & e)
double step = std::numeric_limits<double>::quiet_NaN();
double end = std::numeric_limits<double>::quiet_NaN();
- if (e.start_get().is_double_exp())
+ if (e.start_get().isDoubleExp())
{
start = static_cast<const ast::DoubleExp &>(e.start_get()).value_get();
}
- if (e.step_get().is_double_exp())
+ if (e.step_get().isDoubleExp())
{
step = static_cast<ast::DoubleExp &>(e.step_get()).value_get();
}
- if (e.end_get().is_double_exp())
+ if (e.end_get().isDoubleExp())
{
end = static_cast<ast::DoubleExp &>(e.end_get()).value_get();
}
ForList(const double m, const double s, const double M) : constant(true), read_in_loop(false), min(m), step(s), max(M)
{
- if (!isempty())
+ if (!isEmpty())
{
- if (min >= 0 && step > 0 && is_int<typename std::make_unsigned<T>::type>(min) && is_int<typename std::make_unsigned<T>::type>(step) && !overflow<typename std::make_unsigned<T>::type>(min, step, max))
+ if (min >= 0 && step > 0 && isInt<typename std::make_unsigned<T>::type>(min) && isInt<typename std::make_unsigned<T>::type>(step) && !overflow<typename std::make_unsigned<T>::type>(min, step, max))
{
_int = true;
_unsigned = true;
}
- else if (is_int<typename std::make_signed<T>::type>(min) && is_int<typename std::make_signed<T>::type>(step) && !overflow<typename std::make_signed<T>::type>(min, step, max))
+ else if (isInt<typename std::make_signed<T>::type>(min) && isInt<typename std::make_signed<T>::type>(step) && !overflow<typename std::make_signed<T>::type>(min, step, max))
{
_int = true;
_unsigned = false;
}
}
- inline bool is_read_in_loop() const
+ inline bool isReadInLoop() const
{
return read_in_loop;
}
- inline void set_read_in_loop(const bool read)
+ inline void setReadInLoop(const bool read)
{
read_in_loop = read;
}
- inline bool is_constant() const
+ inline bool isConstant() const
{
return constant;
}
- inline bool is_int() const
+ inline bool isInt() const
{
return _int;
}
- inline bool is_uint() const
+ inline bool isUInt() const
{
return _unsigned;
}
template<typename U>
- inline U get_min() const
+ inline U getMin() const
{
return std::is_integral<U>::value ? TRUNC(min) : min;
}
template<typename U>
- inline U get_step() const
+ inline U getStep() const
{
return std::is_integral<U>::value ? TRUNC(step) : step;
}
template<typename U>
- inline U get_max() const
+ inline U getMax() const
{
return std::is_integral<U>::value ? TRUNC(max) : max;
}
- inline TIType get_type() const
+ inline TIType getType() const
{
/*
if (isempty())
private:
- inline bool isempty() const
+ inline bool isEmpty() const
{
return step == 0 || ISNAN(min) || ISNAN(step) || ISNAN(max) || !finite(min) || !finite(step) || !finite(max) || (min < max && step < 0) || (min > max && step > 0);
}
template<typename U>
- inline static bool is_int(const double x)
+ inline static bool isInt(const double x)
{
return x == TRUNC(x) && x <= std::numeric_limits<U>::max() && x >= std::numeric_limits<U>::min();
}
template<typename U>
- inline static U to_int(const double x)
+ inline static U toInt(const double x)
{
return TRUNC(x);
}
Result(const TIType & _type, const bool _temp) : type(_type), temp(_temp) { }
Result(TIType && _type, const bool _temp) : type(_type), temp(_temp) { }
- inline bool istemp() const
+ inline bool isTemp() const
{
return temp;
}
- inline const TIType & get_type() const
+ inline const TIType & getType() const
{
return type;
}
set(k2);
}
- inline bool is_just_read() const
+ inline bool isJustRead() const
{
return !write && !replace && read;
}
public :
virtual void visit (const StringExp &e);
virtual void visit (const CommentExp &e);
- virtual void visit (const IntExp &e);
- virtual void visit (const FloatExp &e);
virtual void visit (const DoubleExp &e);
virtual void visit (const BoolExp &e);
virtual void visit (const NilExp &e);
exit(2);
}
- IntExp::Prec get_IntExp_Prec(void)
- {
- int code = get_uint8();
- switch (code)
- {
- case 1:
- return IntExp::_8_;
- case 2:
- return IntExp::_16_;
- case 3:
- return IntExp::_32_;
- case 4:
- return IntExp::_64_;
- }
- std::cerr << "Unknown get_IntExp_Prec code " << code << std::endl;
- exit(2);
- }
-
TransposeExp::Kind get_TransposeExp_Kind(void)
{
int code = get_uint8();
int code = get_uint8();
size_t nodeNumber = get_uint64();
Location loc = get_location();
- bool is_verbose = get_bool();
- int is_break = get_bool();
- int is_breakable = get_bool();
- int is_return = get_bool();
- int is_returnable = get_bool();
- int is_continue = get_bool();
- int is_continuable = get_bool();
+ bool isVerbose = get_bool();
+ int isBreak = get_bool();
+ int isBreakable = get_bool();
+ int isReturn = get_bool();
+ int isReturnable = get_bool();
+ int isContinue = get_bool();
+ int isContinuable = get_bool();
switch (code)
}
case 14:
{
- bool has_else = get_bool();
+ bool hasElse = get_bool();
Exp* test = get_exp();
Exp* _then = get_exp();
IfExp* ifexp;
- if ( has_else )
+ if ( hasElse )
{
Exp* _else = get_exp();
ifexp = new IfExp(loc, *test, *_then, *_else);
exit(2);
}
- exp->set_verbose(is_verbose);
- if (is_break)
+ exp->setVerbose(isVerbose);
+ if (isBreak)
{
- exp->break_set();
+ exp->setBreak();
}
- if (is_breakable)
+ if (isBreakable)
{
- exp->breakable_set();
+ exp->setBreakable();
}
- if (is_return)
+ if (isReturn)
{
- exp->return_set();
+ exp->setReturn();
}
- if (is_returnable)
+ if (isReturnable)
{
- exp->returnable_set();
+ exp->setReturnable();
}
- if (is_continue)
+ if (isContinue)
{
- exp->continue_set();
+ exp->setContinue();
}
- if (is_continuable)
+ if (isContinuable)
{
- exp->continuable_set();
+ exp->setContinuable();
}
if (nodeNumber != 0)
{
- exp->nodeNumber_set(nodeNumber);
+ exp->setNodeNumber(nodeNumber);
}
return exp;
/*unsigned int size = */get_uint32();
// serialization version
/*unsigned char scilabVersion[4];
- scilabVersion[0] = */get_uint8();
- /*scilabVersion[1] = */get_uint8();
- /*scilabVersion[2] = */get_uint8();
- /*scilabVersion[3] = */get_uint8();
+ scilabVersion[0] = */
+ get_uint8();
+ /*scilabVersion[1] = */
+ get_uint8();
+ /*scilabVersion[2] = */
+ get_uint8();
+ /*scilabVersion[3] = */
+ get_uint8();
return get_exp();
}
virtual void visit (const MatrixExp &e)
{
std::list<MatrixLineExp *>::const_iterator i;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; ++i )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; ++i )
{
(*i)->accept (*this);
}
virtual void visit (const MatrixLineExp &e)
{
std::list<Exp *>::const_iterator i;
- for (i = e.columns_get().begin() ; i != e.columns_get().end() ; ++i)
+ for (i = e.getColumns().begin() ; i != e.getColumns().end() ; ++i)
{
(*i)->accept (*this);
}
virtual void visit (const CellExp &e)
{
std::list<MatrixLineExp *>::const_iterator i;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; ++i )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; ++i )
{
(*i)->accept (*this);
}
// Nothing to follow up ...
}
- virtual void visit (const IntExp &/*e*/)
- {
- // Nothing to follow up ...
- }
-
- virtual void visit (const FloatExp &/*e*/)
- {
- // Nothing to follow up ...
- }
-
virtual void visit (const DoubleExp &/*e*/)
{
// Nothing to follow up ...
virtual void visit (const ArrayListVar &e)
{
std::list<Var *>::const_iterator i;
- for (i = e.vars_get().begin() ; i != e.vars_get().end() ; ++i)
+ for (i = e.getVars().begin() ; i != e.getVars().end() ; ++i)
{
(*i)->accept (*this);
}
virtual void visit (const FieldExp &e)
{
- e.head_get()->accept(*this);
- e.tail_get()->accept(*this);
+ e.getHead()->accept(*this);
+ e.getTail()->accept(*this);
}
virtual void visit(const OpExp &e)
{
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
//e.oper_get();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
}
virtual void visit(const LogicalOpExp &e)
{
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
//e.oper_get();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
}
virtual void visit (const AssignExp &e)
{
- e.left_exp_get().accept (*this);
- e.right_exp_get().accept (*this);
+ e.getLeftExp().accept (*this);
+ e.getRightExp().accept (*this);
}
virtual void visit(const CellCallExp &e)
{
- e.name_get().accept (*this);
+ e.getName().accept (*this);
std::list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+ for (i = e.getArgs().begin (); i != e.getArgs().end (); ++i)
{
(*i)->accept (*this);
}
virtual void visit(const CallExp &e)
{
- e.name_get().accept (*this);
+ e.getName().accept (*this);
std::list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+ for (i = e.getArgs().begin (); i != e.getArgs().end (); ++i)
{
(*i)->accept (*this);
}
virtual void visit (const IfExp &e)
{
- e.test_get().accept(*this);
- e.then_get().accept(*this);
- if (e.has_else())
+ e.getTest().accept(*this);
+ e.getThen().accept(*this);
+ if (e.hasElse())
{
- e.else_get().accept(*this);
+ e.getElse().accept(*this);
}
}
virtual void visit (const TryCatchExp &e)
{
- e.try_get ().accept(*this);
- e.catch_get ().accept(*this);
+ e.getTry().accept(*this);
+ e.getCatch().accept(*this);
}
virtual void visit (const WhileExp &e)
{
- e.test_get().accept (*this);
- e.body_get().accept (*this);
+ e.getTest().accept (*this);
+ e.getBody().accept (*this);
}
virtual void visit (const ForExp &e)
{
- e.vardec_get().accept(*this);
- e.body_get().accept (*this);
+ e.getVardec().accept(*this);
+ e.getBody().accept (*this);
}
virtual void visit (const BreakExp &/*e*/)
virtual void visit (const ReturnExp &e)
{
- if (!e.is_global())
+ if (!e.isGlobal())
{
- e.exp_get().accept(*this);
+ e.getExp().accept(*this);
}
}
virtual void visit (const SelectExp &e)
{
- e.select_get()->accept(*this);
+ e.getSelect()->accept(*this);
ast::cases_t::iterator it;
- for (it = e.cases_get()->begin() ; it != e.cases_get()->end() ; ++it)
+ for (it = e.getCases()->begin() ; it != e.getCases()->end() ; ++it)
{
(*it)->accept(*this);
}
- if (e.default_case_get() != NULL)
+ if (e.getDefaultCase() != NULL)
{
- e.default_case_get()->accept(*this);
+ e.getDefaultCase()->accept(*this);
}
}
virtual void visit (const CaseExp &e)
{
- e.test_get()->accept(*this);
- e.body_get()->accept(*this);
+ e.getTest()->accept(*this);
+ e.getBody()->accept(*this);
}
virtual void visit (const SeqExp &e)
{
std::list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
(*i)->accept (*this);
}
virtual void visit (const ArrayListExp &e)
{
std::list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
(*i)->accept (*this);
}
virtual void visit (const AssignListExp &e)
{
std::list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
(*i)->accept (*this);
}
** \{ */
virtual void visit (const NotExp &e)
{
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
}
virtual void visit (const TransposeExp &e)
{
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
}
/** \} */
/** \brief Visit Var declarations. */
virtual void visit (const VarDec &e)
{
- e.init_get().accept(*this);
+ e.getInit().accept(*this);
}
virtual void visit (const FunctionDec &e)
{
- e.args_get().accept(*this);
- e.returns_get().accept(*this);
- e.body_get().accept(*this);
+ e.getArgs().accept(*this);
+ e.getReturns().accept(*this);
+ e.getBody().accept(*this);
}
/** \} */
** \{ */
virtual void visit(const ListExp &e)
{
- e.start_get().accept(*this);
- e.step_get().accept(*this);
- e.end_get().accept(*this);
+ e.getStart().accept(*this);
+ e.getStep().accept(*this);
+ e.getEnd().accept(*this);
}
/** \} */
};
visitprivate(e);
}
- void visit (const IntExp &e)
- {
- visitprivate(e);
- }
-
- void visit (const FloatExp &e)
- {
- visitprivate(e);
- }
-
void visit (const DoubleExp &e)
{
visitprivate(e);
public :
virtual void visit (const StringExp &e);
virtual void visit (const CommentExp &e);
- virtual void visit (const IntExp &e);
- virtual void visit (const FloatExp &e);
virtual void visit (const DoubleExp &e);
virtual void visit (const BoolExp &e);
virtual void visit (const NilExp &e);
public :
virtual void visit (const StringExp &e);
virtual void visit (const CommentExp &e);
- virtual void visit (const IntExp &e);
- virtual void visit (const FloatExp &e);
virtual void visit (const DoubleExp &e);
virtual void visit (const BoolExp &e);
virtual void visit (const NilExp &e);
~RunVisitor()
{
- result_clear();
+ clearResult();
}
- void result_clear_except_first()
+ void clearResultButFirst()
{
- if (!is_single_result() && _resultVect.size() > 1)
+ if (!isSingleResult() && _resultVect.size() > 1)
{
for (vector<types::InternalType*>::iterator rv = _resultVect.begin() + 1, end = _resultVect.end(); rv != end; ++rv)
{
}
}
- void result_clear()
+ void clearResult()
{
- if (is_single_result())
+ if (isSingleResult())
{
if (_result != NULL)
{
}
public:
- int expected_getSize(void)
+ int getExpectedSize(void)
{
return _excepted_result;
}
- int result_getSize(void)
+ void setExpectedSize(int _iSize)
{
- if (is_single_result())
+ _excepted_result = _iSize;
+ }
+
+ int getResultSize(void)
+ {
+ if (isSingleResult())
{
if (_result == NULL)
{
}
}
- void expected_setSize(int _iSize)
+ inline types::InternalType* getResult(void)
{
- _excepted_result = _iSize;
- }
-
- inline types::InternalType* result_get(void)
- {
- if (is_single_result())
+ if (isSingleResult())
{
return _result;
}
}
}
- types::InternalType* result_get(int _iPos)
+ types::InternalType* getResult(int _iPos)
{
- if (is_single_result() && _iPos == 0)
+ if (isSingleResult() && _iPos == 0)
{
return _result;
}
return _resultVect[_iPos];
}
- vector<types::InternalType*>* result_list_get()
+ vector<types::InternalType*>* getResultList()
{
// TODO: this function is not used but it could lead to a memleak
// (in the first case the vector is allocated and so must be freed)
- if (result_getSize() == 1)
+ if (getResultSize() == 1)
{
vector<types::InternalType*>* pList = new vector<types::InternalType*>;
pList->push_back(_result);
}
}
- void result_set(int _iPos, const types::InternalType *gtVal)
+ void setResult(int _iPos, const types::InternalType *gtVal)
{
m_bSingleResult = false;
if (_iPos < static_cast<int>(_resultVect.size()))
_resultVect[_iPos] = const_cast<types::InternalType *>(gtVal);
}
- inline void result_set(const types::InternalType *gtVal)
+ inline void setResult(const types::InternalType *gtVal)
{
m_bSingleResult = true;
_result = const_cast<types::InternalType *>(gtVal);
}
- inline void result_set(const types::typed_list & out)
+ inline void setResult(const types::typed_list & out)
{
if (out.size() == 0)
{
- result_set(NULL);
+ setResult(NULL);
}
else if (out.size() == 1)
{
- result_set(out[0]);
+ setResult(out[0]);
}
else
{
/*for (int i = 0 ; i < static_cast<int>(out.size()) ; i++)
{
- result_set(i, out[i]);
+ setResult(i, out[i]);
}*/
m_bSingleResult = false;
}
}
- inline bool is_single_result()
+ inline bool isSingleResult()
{
return m_bSingleResult;
}
- void clean_in(const types::typed_list & in, const types::typed_list & out)
+ void cleanIn(const types::typed_list & in, const types::typed_list & out)
{
// Check if in contains entries which are in out too.
// When an entry is in in and not in out, then in is killed.
}
}
- inline void clean_in_out(const types::typed_list & in, const types::typed_list & out)
+ inline void cleanInOut(const types::typed_list & in, const types::typed_list & out)
{
- clean_in(in, out);
- clean_out(out);
+ cleanIn(in, out);
+ cleanOut(out);
}
- void clean_out(const types::typed_list & out)
+ void cleanOut(const types::typed_list & out)
{
if (!out.empty())
{
}
}
- void clean_opt(const types::optional_list & opt)
+ void cleanOpt(const types::optional_list & opt)
{
if (!opt.empty())
{
for (std::list<Exp *>::const_iterator it = _plstArg.begin() ; it != _plstArg.end() ; ++it)
{
(*it)->accept(*this);
- if (result_getSize() > 1)
+ if (getResultSize() > 1)
{
- const int size = result_getSize();
+ const int size = getResultSize();
for (int i = 0 ; i < size; i++)
{
- pArgs->push_back(result_get(i));
+ pArgs->push_back(getResult(i));
}
}
else
{
- pArgs->push_back(result_get());
+ pArgs->push_back(getResult());
}
}
//to be sure, delete operation does not delete result
- result_set(NULL);
+ setResult(NULL);
return pArgs;
}
public :
- //not use
- void visitprivate(const IntExp &/*e*/) {}
- void visitprivate(const FloatExp &/*e*/) {}
-
//process in another node
void visitprivate(const MatrixLineExp &/*e*/) {}
void visitprivate(const CommentExp &/*e*/) {}
{
if (e.getBigString() == NULL)
{
- types::String *psz = new types::String(e.value_get().c_str());
+ types::String *psz = new types::String(e.getValue().c_str());
(const_cast<StringExp *>(&e))->setBigString(psz);
}
- result_set(e.getBigString());
+ setResult(e.getBigString());
}
{
if (e.getBigDouble() == NULL)
{
- Double *pdbl = new Double(e.value_get());
+ Double *pdbl = new Double(e.getValue());
(const_cast<DoubleExp *>(&e))->setBigDouble(pdbl);
}
- result_set(e.getBigDouble());
+ setResult(e.getBigDouble());
}
{
if (e.getBigBool() == NULL)
{
- Bool *pB = new Bool(e.value_get());
+ Bool *pB = new Bool(e.getValue());
(const_cast<BoolExp *>(&e))->setBigBool(pB);
}
- result_set(e.getBigBool());
+ setResult(e.getBigBool());
}
void visitprivate(const NilExp &/*e*/)
{
- result_set(new types::Void());
+ setResult(new types::Void());
}
void visitprivate(const SimpleVar &e)
{
- InternalType *pI = symbol::Context::getInstance()->get(((SimpleVar&)e).stack_get());
- result_set(pI);
+ InternalType *pI = symbol::Context::getInstance()->get(((SimpleVar&)e).getStack());
+ setResult(pI);
if (pI != NULL)
{
- if (e.is_verbose() && pI->isCallable() == false && ConfigVariable::isPromptShow())
+ if (e.isVerbose() && pI->isCallable() == false && ConfigVariable::isPromptShow())
{
std::wostringstream ostr;
- ostr << e.name_get().name_get() << L" = " << L"(" << pI->getRef() << L")" << std::endl;
+ ostr << e.getSymbol().getName() << L" = " << L"(" << pI->getRef() << L")" << std::endl;
ostr << std::endl;
scilabWriteW(ostr.str().c_str());
- VariableToString(pI, e.name_get().name_get().c_str());
+ VariableToString(pI, e.getSymbol().getName().c_str());
}
}
else
char pstError[bsiz];
wchar_t* pwstError;
- char* strErr = wide_string_to_UTF8(e.name_get().name_get().c_str());
+ char* strErr = wide_string_to_UTF8(e.getSymbol().getName().c_str());
sprintf(pstError, _("Undefined variable: %s\n"), strErr);
pwstError = to_wide_string(pstError);
FREE(strErr);
std::wstring wstError(pwstError);
FREE(pwstError);
- throw ScilabError(wstError, 999, e.location_get());
+ throw ScilabError(wstError, 999, e.getLocation());
//Err, SimpleVar doesn't exist in Scilab scopes.
}
}
void visitprivate(const ColonVar &/*e*/)
{
Colon *pC = new Colon();
- result_set(pC);
+ setResult(pC);
}
void visitprivate(const DollarVar &/*e*/)
{
Dollar* pVar = new Dollar();
- result_set(pVar);
+ setResult(pVar);
}
void visitprivate(const TryCatchExp &e)
ConfigVariable::setSilentError(1);
try
{
- e.try_get().accept(*this);
+ e.getTry().accept(*this);
//restore previous prompt mode
ConfigVariable::setSilentError(oldVal);
}
ConfigVariable::setSilentError(oldVal);
//to lock lasterror
ConfigVariable::setLastErrorCall();
- e.catch_get().accept(*this);
+ e.getCatch().accept(*this);
}
}
void visitprivate(const BreakExp &e)
{
- const_cast<BreakExp*>(&e)->break_set();
+ const_cast<BreakExp*>(&e)->setBreak();
}
void visitprivate(const ContinueExp &e)
{
- const_cast<ContinueExp*>(&e)->continue_set();
+ const_cast<ContinueExp*>(&e)->setContinue();
}
void visitprivate(const ArrayListExp &e)
int i = 0;
std::list<InternalType*> lstIT;
- for (it = e.exps_get().begin() ; it != e.exps_get().end() ; it++)
+ for (it = e.getExps().begin() ; it != e.getExps().end() ; it++)
{
(*it)->accept(*this);
- lstIT.push_back(result_get()->clone());
+ lstIT.push_back(getResult()->clone());
}
std::list<InternalType*>::iterator itIT = lstIT.begin();
for (; itIT != lstIT.end(); itIT++)
{
- result_set(i++, *itIT);
+ setResult(i++, *itIT);
}
}
try
{
/*getting what to assign*/
- e.init_get().accept(*this);
- result_get()->IncreaseRef();
+ e.getInit().accept(*this);
+ getResult()->IncreaseRef();
}
catch (ScilabError error)
{
add_uint8(code);
if (saveNodeNumber)
{
- add_uint64(e.nodeNumber_get());
+ add_uint64(e.getNodeNumber());
}
else
{
add_uint64((unsigned long long)0);
}
- add_location(e.location_get());
- add_uint8(e.is_verbose());
- add_uint8(e.is_break());
- add_uint8(e.is_breakable());
- add_uint8(e.is_return());
- add_uint8(e.is_returnable());
- add_uint8(e.is_continue());
- add_uint8(e.is_continuable());
+ add_location(e.getLocation());
+ add_uint8(e.isVerbose());
+ add_uint8(e.isBreak());
+ add_uint8(e.isBreakable());
+ add_uint8(e.isReturn());
+ add_uint8(e.isReturnable());
+ add_uint8(e.isContinue());
+ add_uint8(e.isContinuable());
}
/** @{ Low-level append to the buffer functions */
void add_vars(const ast::ArrayListVar& var)
{
- add_uint32((unsigned int)var.vars_get().size());
+ add_uint32((unsigned int)var.getVars().size());
std::list<Var *>::const_iterator it;
- for (it = var.vars_get().begin() ; it != var.vars_get().end() ; it++)
+ for (it = var.getVars().begin() ; it != var.getVars().end() ; it++)
{
(*it)->accept(*this);
}
void add_Symbol(const symbol::Symbol& e)
{
- add_wstring(e.name_get());
+ add_wstring(e.getName());
}
void add_exp(const ast::Exp* e)
add_uint8(code);
}
- void add_IntExp_Prec(const ast::IntExp::Prec prec)
- {
- int code = 251;
- switch (prec)
- {
- case ast::IntExp::_8_ :
- code = (1);
- break;
- case ast::IntExp::_16_:
- code = (2);
- break;
- case ast::IntExp::_32_:
- code = (3);
- break;
- case ast::IntExp::_64_:
- code = (4);
- break;
- }
- add_uint8(code);
- }
-
void add_TransposeExp_Kind(const ast::TransposeExp::Kind kind)
{
int code = 249;
void add_varDec(const ast::VarDec& varDec)
{
- add_Symbol(varDec.name_get());
- add_exp(varDec.init_get());
+ add_Symbol(varDec.getSymbol());
+ add_exp(varDec.getInit());
}
void add_MatrixLines(const std::list<ast::MatrixLineExp*> *lines)
std::list<MatrixLineExp *>::const_iterator it;
for (it = lines->begin() ; it != lines->end() ; it++)
{
- add_location((*it)->location_get());
- add_exps((*it)->columns_get());
+ add_location((*it)->getLocation());
+ add_exps((*it)->getColumns());
}
}
virtual void visit (const SeqExp &e) /* done */
{
add_ast(1, e);
- add_exps(e.exps_get());
+ add_exps(e.getExps());
}
void visit(const StringExp& e) /* done */
{
add_ast(2, e);
- add_wstring(e.value_get());
+ add_wstring(e.getValue());
}
void visit(const CommentExp& e) /* done */
{
add_ast(3, e);
- add_wstring(e.comment_get());
+ add_wstring(e.getComment());
}
void visit(const DoubleExp& e) /* done */
{
add_ast(6, e);
- add_double(e.value_get());
+ add_double(e.getValue());
}
void visit(const BoolExp& e) /* done */
{
add_ast(7, e);
- add_bool(e.value_get());
+ add_bool(e.getValue());
}
void visit(const NilExp& e) /* done */
{
void visit(const SimpleVar& e) /* done */
{
add_ast(9, e);
- add_Symbol(e.name_get());
+ add_Symbol(e.getSymbol());
}
void visit(const ColonVar& e) /* done */
{
void visit(const FieldExp& e) /* done */
{
add_ast(13, e);
- add_exp(e.head_get());
- add_exp(e.tail_get());
+ add_exp(e.getHead());
+ add_exp(e.getTail());
}
void visit(const IfExp& e) /* done */
{
add_ast(14, e);
- bool has_else = e.has_else();
- add_bool(has_else);
- add_exp(& e.test_get());
- add_exp(& e.then_get());
- if ( has_else )
+ bool hasElse = e.hasElse();
+ add_bool(hasElse);
+ add_exp(& e.getTest());
+ add_exp(& e.getThen());
+ if ( hasElse )
{
- add_exp(& e.else_get());
+ add_exp(& e.getElse());
}
}
void visit(const TryCatchExp& e) /* done */
{
add_ast(15, e);
- add_location(e.try_get().location_get());
- add_location(e.catch_get().location_get());
- add_exps(e.try_get().exps_get());
- add_exps(e.catch_get().exps_get());
+ add_location(e.getTry().getLocation());
+ add_location(e.getCatch().getLocation());
+ add_exps(e.getTry().getExps());
+ add_exps(e.getCatch().getExps());
}
void visit(const WhileExp& e) /* done */
{
add_ast(16, e);
- add_exp(& e.test_get());
- add_exp(& e.body_get());
+ add_exp(& e.getTest());
+ add_exp(& e.getBody());
}
void visit(const ForExp& e) /* done */
{
add_ast(17, e);
- add_location(e.vardec_get().location_get());
- add_varDec(e.vardec_get());
- add_exp(& e.body_get());
+ add_location(e.getVardec().getLocation());
+ add_varDec(e.getVardec());
+ add_exp(& e.getBody());
}
void visit(const BreakExp& e) /* done */
{
void visit(const ReturnExp& e) /* done */
{
add_ast(20, e);
- bool is_global = e.is_global();
+ bool is_global = e.isGlobal();
add_bool(is_global);
if ( !is_global ) /* otherwise exp is NULL */
{
- add_exp(& e.exp_get());
+ add_exp(& e.getExp());
}
}
void visit(const SelectExp& e)
{
add_ast(21, e);
- ast::SeqExp *default_case = e.default_case_get();
+ ast::SeqExp *default_case = e.getDefaultCase();
bool has_default = default_case != NULL;
add_bool( has_default );
if ( has_default )
{
- add_location(default_case->location_get());
- add_exps(default_case->exps_get());
+ add_location(default_case->getLocation());
+ add_exps(default_case->getExps());
}
- add_exp(e.select_get());
+ add_exp(e.getSelect());
- add_uint32((unsigned int)e.cases_get()->size());
+ add_uint32((unsigned int)e.getCases()->size());
cases_t::const_iterator it;
- for (it = e.cases_get()->begin() ; it != e.cases_get()->end() ; it++)
+ for (it = e.getCases()->begin() ; it != e.getCases()->end() ; it++)
{
const ast::CaseExp *ce = *it;
- add_location(ce->location_get() );
- add_location(ce->body_get()->location_get() );
- add_exp(ce->test_get());
- add_exps(ce->body_get()->exps_get() );
+ add_location(ce->getLocation() );
+ add_location(ce->getBody()->getLocation() );
+ add_exp(ce->getTest());
+ add_exps(ce->getBody()->getExps() );
}
}
void visit(const CellExp& e) /* done */
{
add_ast(23, e);
- add_MatrixLines(& e.lines_get());
+ add_MatrixLines(& e.getLines());
}
void visit(const ArrayListExp& e) /* done */
{
add_ast(24, e);
- add_exps(e.exps_get());
+ add_exps(e.getExps());
}
void visit(const AssignListExp& e) /* done */
{
add_ast(25, e);
- add_exps(e.exps_get());
+ add_exps(e.getExps());
}
void visit(const NotExp& e) /* done */
{
add_ast(26, e);
- add_exp(e.exp_get() );
+ add_exp(e.getExp() );
}
void visit(const TransposeExp& e) /* done */
{
add_ast(27, e);
- add_TransposeExp_Kind(e.conjugate_get());
- add_exp(e.exp_get());
+ add_TransposeExp_Kind(e.getConjugate());
+ add_exp(e.getExp());
}
void visit(const VarDec& e)
{
void visit(const FunctionDec& e) /* done */
{
add_ast(29, e);
- add_Symbol(e.name_get());
- add_location(e.args_get().location_get());
- add_location(e.returns_get().location_get());
- add_exp(e.body_get());
- add_vars(e.args_get());
- add_vars(e.returns_get());
+ add_Symbol(e.getSymbol());
+ add_location(e.getArgs().getLocation());
+ add_location(e.getReturns().getLocation());
+ add_exp(e.getBody());
+ add_vars(e.getArgs());
+ add_vars(e.getReturns());
}
void visit(const ListExp& e) /* done */
{
add_ast(30, e);
- add_exp(e.start_get() );
- add_exp(e.step_get() );
- add_exp(e.end_get() );
+ add_exp(e.getStart() );
+ add_exp(e.getStep() );
+ add_exp(e.getEnd() );
}
void visit(const AssignExp& e)
{
add_ast(31, e);
- add_exp(e.left_exp_get());
- add_exp(e.right_exp_get());
+ add_exp(e.getLeftExp());
+ add_exp(e.getRightExp());
}
void visit(const OpExp& e) /* done */
{
add_ast(32, e);
- add_OpExp_Oper(e.oper_get());
- e.left_get().accept(*this);
- e.right_get().accept(*this);
+ add_OpExp_Oper(e.getOper());
+ e.getLeft().accept(*this);
+ e.getRight().accept(*this);
}
void visit(const LogicalOpExp& e) /* done */
{
add_ast(33, e);
- add_OpExp_Oper(e.oper_get());
- e.left_get().accept(*this);
- e.right_get().accept(*this);
+ add_OpExp_Oper(e.getOper());
+ e.getLeft().accept(*this);
+ e.getRight().accept(*this);
}
void visit(const MatrixExp& e) /* done */
{
add_ast(34, e);
- add_MatrixLines(& e.lines_get());
+ add_MatrixLines(& e.getLines());
}
void visit(const CallExp& e) /* done */
{
add_ast(35, e);
- add_exp( e.name_get());
- add_exps(e.args_get());
+ add_exp( e.getName());
+ add_exps(e.getArgs());
}
void visit(const MatrixLineExp& e) /* SHOULD NEVER HAPPEN */
{
void visit(const CellCallExp& e) /* done */
{
add_ast(37, e);
- add_exp( e.name_get());
- add_exps(e.args_get());
+ add_exp( e.getName());
+ add_exps(e.getArgs());
}
public :
virtual void visit (const DollarVar &/*e*/) {}
virtual void visit (const ColonVar &/*e*/) {}
virtual void visit (const ArrayListVar &/*e*/) {}
- virtual void visit (const IntExp &/*e*/) {}
- virtual void visit (const FloatExp &/*e*/) {}
virtual void visit (const DoubleExp &/*e*/) {}
virtual void visit (const BoolExp &/*e*/) {}
virtual void visit (const StringExp &/*e*/) {}
void visit(const SeqExp &e)
{
std::list<Exp*>::const_iterator it;
- for (it = e.exps_get().begin() ; it != e.exps_get().end() ; ++it)
+ for (it = e.getExps().begin() ; it != e.getExps().end() ; ++it)
{
PrintVisitor *pv = new PrintVisitor(std::wcerr);
(*it)->accept(*pv);
visitprivate(e);
}
- void visit (const IntExp &e)
- {
- visitprivate(e);
- }
-
- void visit (const FloatExp &e)
- {
- visitprivate(e);
- }
-
void visit (const DoubleExp &e)
{
visitprivate(e);
Timer timer;
timer.start();
visitprivate(e);
- const_cast<SeqExp&>(e).elapsedtime_set(timer.elapsed_time());
+ const_cast<SeqExp&>(e).setElapsedtime(timer.elapsed_time());
}
void visit (const MatrixExp &e)
visitprivate(e);
}
- void visit (const IntExp &e)
- {
- visitprivate(e);
- }
-
- void visit (const FloatExp &e)
- {
- visitprivate(e);
- }
-
void visit (const DoubleExp &e)
{
visitprivate(e);
/** \name Visit Constant Expressions related nodes.
** \{ */
public:
- virtual void visit (typename select_const<K, IntExp>::t & e) = 0;
- virtual void visit (typename select_const<K, FloatExp>::t & e) = 0;
virtual void visit (typename select_const<K, DoubleExp>::t & e) = 0;
virtual void visit (typename select_const<K, BoolExp>::t & e) = 0;
virtual void visit (typename select_const<K, StringExp>::t & e) = 0;
#define AST_ALLDEC_HXX
#include "dec.hxx"
-
#include "vardec.hxx"
#include "functiondec.hxx"
-//#include "typedec.hxx"
-
-//#include "decs.hxx"
-
-//#include "anydecs.hxx"
-
#endif // ! AST_ALLDEC_HXX
/*
** Constant Expressions
-** \{
*/
#include "constexp.hxx"
#include "boolexp.hxx"
-#include "intexp.hxx"
-#include "floatexp.hxx"
#include "doubleexp.hxx"
#include "stringexp.hxx"
#include "commentexp.hxx"
#include "nilexp.hxx"
-/*
-** \}
-*/
/*
** Control Expressions
-** \{
*/
#include "controlexp.hxx"
#include "ifexp.hxx"
#include "returnexp.hxx"
#include "selectexp.hxx"
#include "caseexp.hxx"
-/*
-** \}
-*/
/*
** Mathematical Expressions
-** \{
*/
#include "mathexp.hxx"
#include "notexp.hxx"
#include "matrixlineexp.hxx"
// Cell Expressions
#include "cellexp.hxx"
-/*
-** \}
-*/
#include "callexp.hxx"
#define AST_ALLVAR_HXX
#include "var.hxx"
-
#include "simplevar.hxx"
-
#include "arraylistvar.hxx"
-
#include "dollarvar.hxx"
#include "colonvar.hxx"
+++ /dev/null
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - DIGITEO - Bruno JOFRET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/**
- ** \file anydecs.hxx
- ** Define the Any Decs class.
- */
-
-#ifndef AST_ANYDECS_HXX
-#define AST_ANYDECS_HXX
-
-#include <list>
-
-#include "decs.hxx"
-
-#include "vardec.hxx"
-#include "typedec.hxx"
-#include "functiondec.hxx"
-
-namespace ast
-{
-
-template < typename D >
-/** \brief Abstract a "list of D-declarations" node. */
-class AnyDecs : public Decs
-{
-public:
- /** \brief Define shortand type for list of D-declarations. */
- typedef std::list< D* > Ds;
-
- /** \name Ctor & dtor.
- ** \{ */
-public:
- /** \brief Construct an Any Decs node.
- ** \param location scanner position informations */
- AnyDecs (const Location& location) :
- Decs (location),
- _decs (new Ds ())
- {
- }
- /** \brief Construct an Any Decs node with a list of D-declarations.
- ** \param location scanner position informations
- ** \param decs list of D-declarations */
- AnyDecs (const Location& location, Ds& decs) :
- Decs (location),
- _decs (&decs)
- {
- }
-
- /** \brief Destroys an AnyDecs node.
- **
- ** Free list and its content. */
- ~AnyDecs ()
- {
- for (typename Ds::iterator i = _decs->begin(); i != _decs->end(); ++i)
- {
- delete *i;
- }
- delete _decs;
- }
- /** \} */
-
-
- /** \name Visitors entry point.
- ** \{ */
-public:
- /** \brief Accept a const visitor \a v. */
- virtual void accept (Visitor& v)
- {
- v.visit (*this);
- }
- /** \brief Accept a non-const visitor \a v. */
- virtual void accept (ConstVisitor& v) const
- {
- v.visit (*this);
- }
- /** \} */
-
-
- /** \name Accessors.
- ** \{ */
-public:
- /** \brief Push a D-declaration into the list.
- ** \param d declaration to push */
- AnyDecs< D >& push_back (D& d)
- {
- location_set (location_get () + d.location_get ());
- _decs->push_back (&d);
- return *this;
- }
-
- /** \brief Access to list of D-declarations (read and write). */
- Ds& decs_get ()
- {
- return *_decs;
- }
- /** \brief Access to list of D-declarations (read only). */
- const Ds& decs_get () const
- {
- return *_decs;
- }
- /** \} */
-
-private:
- Ds* _decs;
-};
-
-/** \brief Define shortand type for Variable declarations. */
-typedef AnyDecs< VarDec > VarDecs;
-/** \brief Define shortand type for Type declarations. */
-typedef AnyDecs< TypeDec > TypeDecs;
-/** \brief Define shortand type for Function declarations. */
-typedef AnyDecs< FunctionDec > FunctionDecs;
-
-} // namespace ast
-
-#endif // !AST_ANYDECS_HXX
exps->push_back((*it)->clone());
}
- ArrayListExp* cloned = new ArrayListExp(location_get(), *exps);
- cloned->set_verbose(is_verbose());
+ ArrayListExp* cloned = new ArrayListExp(getLocation(), *exps);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
/** \name Accessors.
** \{ */
public:
- const std::list<Exp *>& exps_get() const
+ const std::list<Exp *>& getExps() const
{
return *_exps;
}
- std::list<Exp *>& exps_get()
+ std::list<Exp *>& getExps()
{
return *_exps;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return ARRAYLISTEXP;
+ }
+ inline bool isArrayListExp() const
+ {
+ return true;
+ }
protected:
std::list<Exp *>* _exps;
};
vars->push_back(static_cast<Var*>((*it)->clone()));
}
- ArrayListVar* cloned = new ArrayListVar(location_get(), *vars);
- cloned->set_verbose(is_verbose());
+ ArrayListVar* cloned = new ArrayListVar(getLocation(), *vars);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Accessors.
** \{ */
public:
- const std::list<Var *>& vars_get() const
+ const std::list<Var *>& getVars() const
{
return *_vars;
}
- std::list<Var *>& vars_get()
+ std::list<Var *>& getVars()
{
return *_vars;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return ARRAYLISTVAR;
+ }
+ inline bool isArrayListVar()
+ {
+ return true;
+ }
protected:
std::list<Var *>* _vars;
virtual AssignExp* clone()
{
- AssignExp* cloned = new AssignExp(location_get(), *left_exp_get().clone(), *right_exp_get().clone());
- cloned->set_verbose(is_verbose());
+ AssignExp* cloned = new AssignExp(getLocation(), *getLeftExp().clone(), *getRightExp().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
** \{ */
public:
/** \brief Return the name of the size (read only). */
- Exp& left_exp_get() const
+ Exp& getLeftExp() const
{
return *_left_exp;
}
/** \brief Return the name of the size */
- Exp& left_exp_get()
+ Exp& getLeftExp()
{
return *_left_exp;
}
/** \brief Return the name of the init (read only). */
- Exp& right_exp_get() const
+ Exp& getRightExp() const
{
return *_right_exp;
}
/** \brief Return the name of the init */
- Exp& right_exp_get()
+ Exp& getRightExp()
{
return *_right_exp;
}
- types::InternalType* right_val_get()
+ types::InternalType* getRightVal()
{
return _pIT;
}
- types::InternalType* right_val_get() const
+ types::InternalType* getRightVal() const
{
return _pIT;
}
- inline bool is_assign_exp() const
- {
- return true;
- }
-
- void set_lr_owner(const bool b)
+ void setLrOwner(const bool b)
{
lr_owner = b;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return ASSIGNEXP;
+ }
+ inline bool isAssignExp() const
+ {
+ return true;
+ }
+
protected:
/** \brief Left variable which is affected. */
Exp* _left_exp;
exps->push_back((*it)->clone());
}
- AssignListExp* cloned = new AssignListExp(location_get(), *exps);
- cloned->set_verbose(is_verbose());
+ AssignListExp* cloned = new AssignListExp(getLocation(), *exps);
+ cloned->setVerbose(isVerbose());
return cloned;
}
}
/** \} */
+ virtual ExpType getType()
+ {
+ return ASSIGNLISTEXP;
+ }
+ inline bool isAssignListExp() const
+ {
+ return true;
+ }
};
} // namespace ast
public:
/** \brief Construct an Ast node.
** \param location scanner position informations */
- Ast (const Location& location) : _location (location), decorator()
+ Ast (const Location& location) : _location (location), decorator(), parent(NULL)
{
nodeNumber = globalNodeNumber++;
}
**
** Return a reference to this.
*/
- Ast& location_set (const Location& location)
+ Ast& setLocation(const Location& location)
{
_location = location;
return *this;
}
/** \brief Get scanner position informations stored. */
- inline const Location& location_get () const
+ inline const Location& getLocation() const
{
return _location;
}
/** \brief Get scanner position informations stored. */
- inline Location& location_get ()
+ inline Location& getLocation()
{
return _location;
}
virtual void accept (Visitor& v) = 0;
/** \} */
- void elapsedtime_set(double _dblElapsedTime)
+ void setElapsedtime(double _dblElapsedTime)
{
m_dblElapsedTime = _dblElapsedTime;
}
- size_t nodeNumber_get() const
+ size_t getNodeNumber() const
{
return nodeNumber;
}
- void nodeNumber_set(size_t _nodeNumber)
+ void setNodeNumber(size_t _nodeNumber)
{
nodeNumber = _nodeNumber;
}
- const analysis::Decorator & decorator_get() const
+ const analysis::Decorator & getDecorator() const
{
return decorator;
}
- analysis::Decorator & decorator_get()
+ analysis::Decorator & getDecorator()
{
return decorator;
}
- void decorator_set(analysis::Decorator & _decorator)
+ void setDecorator(analysis::Decorator & _decorator)
{
decorator = _decorator;
}
+ Ast* getParent() const
+ {
+ return parent;
+ }
+
+ Ast* getParent()
+ {
+ return parent;
+ }
+
+ void setParent(Ast* _ast)
+ {
+ parent = _ast;
+ }
private:
/** \brief Construct an Ast by copy. */
analysis::Decorator decorator;
+ Ast* parent;
Ast (const Ast&);
/** \brief Assign an Ast to this. */
Ast& operator= (const Ast&);
virtual BoolExp* clone()
{
- BoolExp* cloned = new BoolExp(location_get(), value_get());
- cloned->set_verbose(is_verbose());
+ BoolExp* cloned = new BoolExp(getLocation(), getValue());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the value */
- bool value_get() const
+ bool getValue() const
{
return _value;
}
_bigBool->IncreaseRef();
}
/** \} */
+
+ virtual ExpType getType()
+ {
+ return BOOLEXP;
+ }
+ inline bool isBoolExp() const
+ {
+ return true;
+ }
+
protected:
bool _value;
types::Bool* _bigBool;
virtual BreakExp* clone()
{
- BreakExp* cloned = new BreakExp(location_get());
- cloned->set_verbose(is_verbose());
+ BreakExp* cloned = new BreakExp(getLocation());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
v.visit (*this);
}
/** \} */
+ virtual ExpType getType()
+ {
+ return BREAKEXP;
+ }
+ inline bool isBreakExp() const
+ {
+ return true;
+ }
};
} // namespace ast
args->push_back((*it)->clone());
}
- CallExp* cloned = new CallExp(location_get(), *name_get().clone(), *args);
- cloned->set_verbose(is_verbose());
+ CallExp* cloned = new CallExp(getLocation(), *getName().clone(), *args);
+ cloned->setVerbose(isVerbose());
return cloned;
}
// \brief Accessors.
public:
- const Exp& name_get() const
+ const Exp& getName() const
{
return *_name;
}
- Exp& name_get()
+ Exp& getName()
{
return *_name;
}
- void name_set (Exp *name)
+ void setName (Exp *name)
{
_name = name;
}
- const std::list<Exp *>& args_get() const
+ const std::list<Exp *>& getArgs() const
{
return *_args;
}
- std::list<Exp *>& args_get()
+ std::list<Exp *>& getArgs()
{
return *_args;
}
+ virtual ExpType getType()
+ {
+ return CALLEXP;
+ }
+ inline bool isCallExp() const
+ {
+ return true;
+ }
+
protected:
- Exp* _name;
- std::list<Exp *>* _args;
+ Exp* _name;
+ std::list<Exp *>* _args;
};
} // namespace ast
virtual CaseExp* clone()
{
- CaseExp* cloned = new CaseExp(location_get(), *test_get()->clone(), *body_get()->clone());
- cloned->set_verbose(is_verbose());
+ CaseExp* cloned = new CaseExp(getLocation(), *getTest()->clone(), *getBody()->clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
/** \} */
public :
- Exp* test_get() const
+ Exp* getTest() const
{
return _test;
}
- SeqExp* body_get() const
+ SeqExp* getBody() const
{
return _body;
}
+ virtual ExpType getType()
+ {
+ return CASEEXP;
+ }
+ inline bool isCaseExp() const
+ {
+ return true;
+ }
private :
Exp* _test;
SeqExp *_body;
args->push_back((*it)->clone());
}
- CellCallExp* cloned = new CellCallExp(location_get(), *name_get().clone(), *args);
- cloned->set_verbose(is_verbose());
+ CellCallExp* cloned = new CellCallExp(getLocation(), *getName().clone(), *args);
+ cloned->setVerbose(isVerbose());
return cloned;
}
v.visit (*this);
}
- inline virtual bool is_cellcall_exp() const
+ /** \} */
+
+ virtual ExpType getType()
+ {
+ return CELLCALLEXP;
+ }
+ inline bool isCellCallExp() const
{
return true;
}
- /** \} */
};
virtual CellExp* clone()
{
std::list<MatrixLineExp *>* lines = new std::list<MatrixLineExp *>;
- for (std::list<MatrixLineExp *>::const_iterator it = lines_get().begin() ; it != lines_get().end() ; ++it)
- {
- lines->push_back((*it)->clone());
- }
-
- CellExp* cloned = new CellExp(location_get(), *lines);
- cloned->set_verbose(is_verbose());
+ std::copy(getLines().begin(), getLines().end(), lines->begin());
+ CellExp* cloned = new CellExp(getLocation(), *lines);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
}
/** \} */
+ virtual ExpType getType()
+ {
+ return CELLEXP;
+ }
+ inline bool isCallExp() const
+ {
+ return true;
+ }
};
} // namespace ast
virtual ColonVar* clone()
{
- ColonVar* cloned = new ColonVar(location_get());
- cloned->set_verbose(is_verbose());
+ ColonVar* cloned = new ColonVar(getLocation());
+ cloned->setVerbose(isVerbose());
return cloned;
}
- /** \name Visitors entry point.
- ** \{ */
-public:
/** \brief Accept a const visitor \a v. */
virtual void accept (Visitor& v)
{
{
v.visit (*this);
}
- /** \} */
+
+ virtual ExpType getType()
+ {
+ return COLONVAR;
+ }
+ inline bool isColonVar() const
+ {
+ return true;
+ }
};
virtual CommentExp* clone()
{
- CommentExp* cloned = new CommentExp(location_get(), new std::wstring(comment_get()));
- cloned->set_verbose(is_verbose());
+ CommentExp* cloned = new CommentExp(getLocation(), new std::wstring(getComment()));
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the comment (read only). */
- std::wstring &comment_get () const
+ std::wstring &getComment() const
{
return *_comment;
}
/** \} */
+
+ virtual ExpType getType()
+ {
+ return COMMENTEXP;
+ }
+ inline bool isCommentExp() const
+ {
+ return true;
+ }
protected:
std::wstring* _comment;
};
virtual ~ConstExp ()
{
}
-
- //virtual ConstExp* clone()
- //{
- // Location* newloc = const_cast<Location*>(&location_get())->clone();
- // return new ConstExp(*newloc);
- //}
};
} // namespace ast
#endif
virtual ContinueExp* clone()
{
- ContinueExp* cloned = new ContinueExp(location_get());
- cloned->set_verbose(is_verbose());
+ ContinueExp* cloned = new ContinueExp(getLocation());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
v.visit (*this);
}
/** \} */
+ virtual ExpType getType()
+ {
+ return CONTINUEEXP;
+ }
+ inline bool isContinueExp() const
+ {
+ return true;
+ }
};
} // namespace ast
virtual ~ControlExp ()
{
}
-
- //virtual ControlExp* clone()
- //{
- // Location* newloc = const_cast<Location*>(&location_get())->clone();
- // return new ControlExp(location_get());
- //}
};
} // namespace ast
#endif /* !AST_CONTROLEXP_HXX */
{
}
/** \} */
-
- //virtual Dec* clone()
- //{
- // Location* newloc = const_cast<Location*>(&location_get())->clone();
- // return new Dec(location_get());
- //}
};
} // namespace ast
// Low Level Expressions.
// Const Exp
-class IntExp;
class StringExp;
-class FloatExp;
class DoubleExp;
class BoolExp;
class CommentExp;
+++ /dev/null
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008-2008 - DIGITEO - Bruno JOFRET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/**
- ** \file ast/decs.hxx
- ** Define the Decs class.
- */
-
-#ifndef AST_DECS_HXX
-#define AST_DECS_HXX
-
-#include <list>
-
-#include "ast/ast.hxx"
-
-namespace ast
-{
-
-/** \brief Abstract a Declarations node. */
-class Decs : public Ast
-{
-
- /** \name Ctor & dtor.
- ** \{ */
-public:
- /** \brief Construct a Declarations node.
- ** \param location scanner position informations */
- Decs (const Location& location)
- : Ast (location)
- {
- }
-
- virtual Decs* clone()
- {
- Location* newloc = const_cast<Location*>(&location_get())->clone();
- return new Decs(*newloc);
- }
-};
-/** \brief Define shortand type for list of Declarations. */
-typedef std::list<Decs *> decs_t;
-
-} // namespace ast
-
-#endif // !AST_DECS_HXX
virtual DollarVar* clone()
{
- DollarVar* cloned = new DollarVar(location_get());
- cloned->set_verbose(is_verbose());
+ DollarVar* cloned = new DollarVar(getLocation());
+ cloned->setVerbose(isVerbose());
return cloned;
}
- /** \name Visitors entry point.
- ** \{ */
-public:
/** \brief Accept a const visitor \a v. */
virtual void accept (Visitor& v)
{
{
v.visit (*this);
}
- /** \} */
+
+ virtual ExpType getType()
+ {
+ return DOLLARVAR;
+ }
+ inline bool isDollarVar() const
+ {
+ return true;
+ }
};
} // namespace ast
virtual DoubleExp* clone()
{
- DoubleExp* cloned = new DoubleExp(location_get(), value_get());
- cloned->set_verbose(is_verbose());
+ DoubleExp* cloned = new DoubleExp(getLocation(), getValue());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
** \{ */
public:
/** \brief Return the value */
- double value_get() const
+ double getValue() const
{
return _value;
}
_bigDouble->IncreaseRef();
}
+ virtual ExpType getType()
+ {
+ return DOUBLEEXP;
+ }
+ inline bool isDoubleExp() const
+ {
+ return true;
+ }
+
protected:
double _value;
types::Double* _bigDouble;
}
/** \brief Return if an expression should be displayed or not. */
- inline void set_verbose(bool verbose)
+ inline void setVerbose(bool verbose)
{
_verbose = verbose;
}
/** \brief Return if an expression should be displayed or not. */
- inline bool is_verbose(void) const
+ inline virtual bool isVerbose(void) const
{
return _verbose;
}
- inline void break_set(void)
+ inline void setBreak(void)
{
_bBreak = true;
}
- inline void break_reset(void)
+ inline void resetBreak(void)
{
_bBreak = false;
}
- inline bool is_break(void) const
+ inline virtual bool isBreak(void) const
{
return _bBreak;
}
- inline void breakable_set(void)
+ inline void setBreakable(void)
{
_bBreakable = true;
}
- inline void breakable_reset(void)
+ inline void resetBreakable(void)
{
_bBreakable = false;
}
- inline bool is_breakable(void) const
+ inline virtual bool isBreakable(void) const
{
return _bBreakable;
}
- inline void return_set(void)
+ inline void setReturn(void)
{
_bReturn = true;
}
- inline void return_reset(void)
+ inline void resetReturn(void)
{
_bReturn = false;
}
- inline bool is_return(void) const
+ inline virtual bool isReturn(void) const
{
return _bReturn;
}
- inline void returnable_set(void)
+ inline void setReturnable(void)
{
_bReturnable = true;
}
- inline void returnable_reset(void)
+ inline void resetReturnable(void)
{
_bReturnable = false;
}
- inline bool is_returnable(void) const
+ inline virtual bool isReturnable(void) const
{
return _bReturnable;
}
- inline void continue_set(void)
+ inline void setContinue(void)
{
_bContinue = true;
}
- inline void continue_reset(void)
+ inline void resetContinue(void)
{
_bContinue = false;
}
- inline bool is_continue(void) const
+ inline virtual bool isContinue(void) const
{
return _bContinue;
}
- inline void continuable_set(void)
+ inline void setContinuable(void)
{
_bContinuable = true;
}
- inline void continuable_reset(void)
+ inline void resetContinuable(void)
{
_bContinuable = false;
}
- inline bool is_continuable(void) const
+ inline virtual bool isContinuable(void) const
{
return _bContinuable;
}
- inline virtual bool is_simple_var() const
+ //manage derived exp
+ enum ExpType
+ {
+ SIMPLEVAR,
+ DOLLARVAR,
+ COLONVAR,
+ ARRAYLISTVAR,
+ DOUBLEEXP,
+ BOOLEXP,
+ STRINGEXP,
+ COMMENTEXP,
+ NILEXP,
+ CALLEXP,
+ CELLCALLEXP,
+ OPEXP,
+ LOGICALOPEXP,
+ ASSIGNEXP,
+ IFEXP,
+ WHILEEXP,
+ FOREXP,
+ BREAKEXP,
+ CONTINUEEXP,
+ TRYCATCHEXP,
+ SELECTEXP,
+ CASEEXP,
+ RETURNEXP,
+ FIELDEXP,
+ NOTEXP,
+ TRANSPOSEEXP,
+ MATRIXEXP,
+ MATRIXLINEEXP,
+ CELLEXP,
+ SEQEXP,
+ ARRAYLISTEXP,
+ ASSIGNLISTEXP,
+ VARDEC,
+ FUNCTIONDEC,
+ LISTEXP,
+ OPTIMIZEDEXP
+ };
+
+ virtual ExpType getType() = 0;
+
+ template <class T>
+ inline T* getAs(void)
+ {
+ return static_cast<T*>(this);
+ }
+
+ inline virtual bool isSimpleVar() const
+ {
+ return false;
+ }
+
+ inline virtual bool isDollarVar() const
+ {
+ return false;
+ }
+
+ inline virtual bool isColonVar() const
+ {
+ return false;
+ }
+
+ inline virtual bool isArrayListVar() const
+ {
+ return false;
+ }
+
+ inline virtual bool isDoubleExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isBoolExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isStringExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isCommentExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isNilExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isCallExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isCellCallExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isOpExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isLogicalOpExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isAssignExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isIfExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isWhileExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isForExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isBreakExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isContinueExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isTryCatchExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isSelectExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isCaseExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isReturnExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isFieldExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isNotExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isTransposeExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isMatrixExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isMatrixLineExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isCellExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isSeqExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isArrayListExp() const
+ {
+ return false;
+ }
+
+ inline virtual bool isAssignListExp() const
{
return false;
}
- inline virtual bool is_assign_exp() const
+ inline virtual bool isVarDec() const
{
return false;
}
- inline virtual bool is_return_exp() const
+ inline virtual bool isFunctionDec() const
{
return false;
}
- inline virtual bool is_cellcall_exp() const
+ inline virtual bool isListExp() const
{
return false;
}
virtual FieldExp* clone()
{
- FieldExp* cloned = new FieldExp(location_get(), *head_get()->clone(), *tail_get()->clone());
- cloned->set_verbose(is_verbose());
+ FieldExp* cloned = new FieldExp(getLocation(), *getHead()->clone(), *getTail()->clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the name of the field (read only). */
- const Exp* head_get() const
+ const Exp* getHead() const
{
return _head;
}
/** \brief Return the initial value of the field (read only). */
- const Exp* tail_get() const
+ const Exp* getTail() const
{
return _tail;
}
/** \brief Return the initial value of the field (read and write). */
- Exp* head_get()
+ Exp* getHead()
{
return _head;
}
/** \brief Return the initial value of the field (read and write). */
- Exp* tail_get()
+ Exp* getTail()
{
return _tail;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return FIELDEXP;
+ }
+ inline bool isFieldExp() const
+ {
+ return true;
+ }
protected:
/** \brief Name of the field. */
Exp* _head;
+++ /dev/null
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - DIGITEO - Bruno JOFRET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-#ifndef AST_FLOATEXP_HXX
-#define AST_FLOATEXP_HXX
-
-#include "constexp.hxx"
-
-namespace ast
-{
-/** \brief Abstract an Float Expression node.
-**
-** \b Example: 42.51 */
-class FloatExp : public ConstExp
-{
-public:
- FloatExp (const Location& location, float value)
- : ConstExp (location),
- _value (value)
- {
- }
- /** \brief Destroy an Float Expression node.
- **
- ** Delete size et init (exp) (see constructor). */
- virtual ~FloatExp ()
- {
- }
- /** \} */
-
- virtual FloatExp* clone()
- {
- FloatExp* cloned = new FloatExp(location_get(), value_get());
- cloned->set_verbose(is_verbose());
- return cloned;
- }
- /** \name Visitors entry point.
- ** \{ */
-public:
- /** \brief Accept a const visitor \a v. */
- virtual void accept (Visitor& v)
- {
- v.visit (*this);
- }
- /** \brief Accept a non-const visitor \a v. */
- virtual void accept (ConstVisitor& v) const
- {
- v.visit (*this);
- }
- /** \} */
-
-
- /** \name Accessors.
- ** \{ */
-public:
- /** \brief Return the value */
- float value_get() const
- {
- return _value;
- }
- /** \} */
-
-protected:
- float _value;
-};
-
-} // namespace ast
-#endif
virtual ForExp* clone()
{
- ForExp* cloned = new ForExp(location_get(), *vardec_get().clone(), *body_get().clone());
- cloned->set_verbose(is_verbose());
+ ForExp* cloned = new ForExp(getLocation(), *getVardec().clone(), *getBody().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the implicit variable declaration (read only) */
- VarDec& vardec_get () const
+ VarDec& getVardec() const
{
return *_vardec;
}
/** \brief Return the implicit variable declaration (read and write) */
- VarDec& vardec_get ()
+ VarDec& getVardec()
{
return *_vardec;
}
/** \brief Return the body of the loop (read only) */
- const Exp& body_get () const
+ const Exp& getBody() const
{
return *_body;
}
/** \brief Return the body of the loop (read and write) */
- Exp& body_get ()
+ Exp& getBody()
{
return *_body;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return FOREXP;
+ }
+ inline bool isForExp() const
+ {
+ return true;
+ }
protected:
/** \brief Implicit variable declaration. */
virtual FunctionDec* clone()
{
- FunctionDec* cloned = new FunctionDec(location_get(), *new symbol::Symbol(name_get().name_get()), *args_get().clone(), *returns_get().clone(), *body_get().clone());
- cloned->set_verbose(is_verbose());
+ FunctionDec* cloned = new FunctionDec(getLocation(), *new symbol::Symbol(getSymbol().getName()), *getArgs().clone(), *getReturns().clone(), *getBody().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
// \name Accessors.
public:
- symbol::Symbol& name_get (void) const
+ symbol::Symbol& getSymbol(void) const
{
return _name;
}
- const Exp& body_get (void) const
+ const Exp& getBody(void) const
{
return *_body;
}
- Exp& body_get (void)
+ Exp& getBody (void)
{
return *_body;
}
- const ArrayListVar& args_get () const
+ const ArrayListVar& getArgs() const
{
return *_args;
}
- ArrayListVar& args_get ()
+ ArrayListVar& getArgs()
{
return *_args;
}
- const ArrayListVar& returns_get () const
+ const ArrayListVar& getReturns() const
{
return *_returns;
}
- ArrayListVar& returns_get ()
+ ArrayListVar& getReturns()
{
return *_returns;
}
- void body_set(Exp *body)
+ void setBody(Exp *body)
{
_body = body;
}
- symbol::Variable* stack_get()
+ symbol::Variable* getStack()
{
if (_stack == NULL)
{
return _stack;
}
+ virtual ExpType getType()
+ {
+ return FUNCTIONDEC;
+ }
+ inline bool isFunctionDec() const
+ {
+ return true;
+ }
protected:
symbol::Symbol& _name;
ArrayListVar* _args;
_test (&test),
_then (&t),
_else (&e),
- _has_else (true)
+ _hasElse (true)
{
}
_then (&t),
_else (new ast::CommentExp(location, new std::wstring(L"No else !!"))),
// For first display in order to see what appends
- _has_else (false)
+ _hasElse (false)
{
}
virtual IfExp* clone()
{
- IfExp* cloned = new IfExp(location_get(), *test_get().clone(), *then_get().clone(), *else_get().clone());
- cloned->set_verbose(is_verbose());
+ IfExp* cloned = new IfExp(getLocation(), *getTest().clone(), *getThen().clone(), *getElse().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
// \brief Accessors.
public:
// \brief Return the select condition of the loop (read only).
- const Exp& test_get() const
+ const Exp& getTest() const
{
return *_test;
}
// \brief Return the select condition of the loop (read and write).
- Exp& test_get()
+ Exp& getTest()
{
return *_test;
}
// \brief Return the intructions if test is true (read only).
- const Exp& then_get() const
+ const Exp& getThen() const
{
return *_then;
}
// \brief Return the instructions if test is true (read and write).
- Exp& then_get()
+ Exp& getThen()
{
return *_then;
}
// \brief Return the instruction if test is false (read only).
- const Exp& else_get() const
+ const Exp& getElse() const
{
return *_else;
}
// \brief Return the instruction if test is false (read and write).
- Exp& else_get()
+ Exp& getElse()
{
return *_else;
}
// \brief Return if there is an else body
- bool has_else()
+ bool hasElse()
{
- return _has_else;
+ return _hasElse;
}
// \brief Return if there is an else body
- bool has_else() const
+ bool hasElse() const
{
- return _has_else;
+ return _hasElse;
}
+ virtual ExpType getType()
+ {
+ return IFEXP;
+ }
+ inline bool isIfExp() const
+ {
+ return true;
+ }
protected:
// \brief "has a value" qualifier.
Exp* _test;
Exp* _then;
Exp* _else;
- bool _has_else;
+ bool _hasElse;
};
} // namespace ast
+++ /dev/null
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - DIGITEO - Bruno JOFRET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-#ifndef AST_INTEXP_HXX
-#define AST_INTEXP_HXX
-
-#include "constexp.hxx"
-
-namespace ast
-{
-/** \brief Abstract an Int Expression node.
-**
-** \b Example: 25 */
-class IntExp : public ConstExp
-{
-public :
- /** \brief Precision qualifier */
- enum Prec
- {
- /** \brief 8-bit Integer */ _8_,
- /** \brief 16-bit Integer */ _16_,
- /** \brief 32-bit Integer */ _32_,
- /** \brief 64-bit Integer */ _64_
- };
-public:
- IntExp (const Location& location, Prec prec, int value)
- : ConstExp (location),
- _prec (prec),
- _value (value)
- {
- }
-
- IntExp (const Location& location, int value)
- : ConstExp (location),
- _prec (_32_),
- _value (value)
- {
- }
-
- /** \brief Destroy an Int Expression node.
- **
- ** Delete size et init (exp) (see constructor). */
- virtual ~IntExp ()
- {
- }
- /** \} */
-
- virtual IntExp* clone()
- {
- IntExp* cloned = new IntExp(location_get(), prec_get(), value_get());
- cloned->set_verbose(is_verbose());
- return cloned;
- }
-
- /** \name Visitors entry point.
- ** \{ */
-public:
- /** \brief Accept a const visitor \a v. */
- virtual void accept (Visitor& v)
- {
- v.visit (*this);
- }
- /** \brief Accept a non-const visitor \a v. */
- virtual void accept (ConstVisitor& v) const
- {
- v.visit (*this);
- }
- /** \} */
-
- /** \name Accessors.
- ** \{ */
-public:
- /** \brief Return the value */
- int value_get() const
- {
- return _value;
- }
-
- Prec prec_get() const
- {
- return _prec;
- }
- /** \} */
-
-protected:
- Prec _prec;
- int _value;
-};
-
-} // namespace ast
-#endif
** \li "stop" is the end of the list (the max value)
*/
ListExp (const Location& location,
- Exp& start, Exp& step, Exp& end, bool explicitStep=false)
+ Exp& start, Exp& step, Exp& end, bool explicitStep = false)
: Exp (location),
_start (&start),
_step (&step),
virtual ListExp* clone()
{
- ListExp* cloned = new ListExp(location_get(), *start_get().clone(), *step_get().clone(), *end_get().clone());
- cloned->set_verbose(is_verbose());
+ ListExp* cloned = new ListExp(getLocation(), *getStart().clone(), *getStep().clone(), *getEnd().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the expression (read only) */
- const Exp& start_get () const
+ const Exp& getStart () const
{
return *_start;
}
/** \brief Return the expression (read and write) */
- Exp& start_get ()
+ Exp& getStart ()
{
return *_start;
}
/** \brief Return the expression (read only) */
- const Exp& step_get () const
+ const Exp& getStep () const
{
return *_step;
}
/** \brief Return the expression (read and write) */
- Exp& step_get ()
+ Exp& getStep ()
{
return *_step;
}
/** \brief Return the expression (read only) */
- const Exp& end_get () const
+ const Exp& getEnd () const
{
return *_end;
}
/** \brief Return the expression (read and write) */
- Exp& end_get ()
+ Exp& getEnd ()
{
return *_end;
}
}
/** \} */
+ virtual ExpType getType()
+ {
+ return LISTEXP;
+ }
+ inline bool isListExp() const
+ {
+ return true;
+ }
protected:
/** \brief start expression of the list. */
}
/** \} */
- std::wstring location_getString() const
+ std::wstring getLocationString() const
{
std::wostringstream os;
os << L" (" << first_line << L"," << first_column << L")";
virtual LogicalOpExp* clone()
{
- LogicalOpExp* cloned = new LogicalOpExp(location_get(), *left_get().clone(), oper_get(), *right_get().clone());
- cloned->set_verbose(is_verbose());
+ LogicalOpExp* cloned = new LogicalOpExp(getLocation(), *getLeft().clone(), getOper(), *getRight().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \} */
/** \brief set the operator description (read only) */
- void oper_set(Oper oper)
+ void setOper(Oper oper)
{
_oper = oper;
}
+ virtual ExpType getType()
+ {
+ return LOGICALOPEXP;
+ }
+ inline bool isLogicalOpExp() const
+ {
+ return true;
+ }
};
} // namespace ast
virtual ~MathExp ()
{
}
-
- //virtual MathExp* clone()
- //{
- // Location* newloc = const_cast<Location*>(&location_get())->clone();
- // return new MathExp(*newloc);
- //}
};
} // namespace ast
#endif /* !__AST_MATHEXP_HXX__ */
virtual MatrixExp* clone()
{
std::list<MatrixLineExp *>* lines = new std::list<MatrixLineExp *>;
- for (std::list<MatrixLineExp *>::const_iterator it = lines_get().begin(), end = lines_get().end(); it != end; ++it)
+ for (std::list<MatrixLineExp *>::const_iterator it = getLines().begin(), end = getLines().end(); it != end; ++it)
{
lines->push_back((*it)->clone());
}
- MatrixExp* cloned = new MatrixExp(location_get(), *lines);
- cloned->set_verbose(is_verbose());
+ MatrixExp* cloned = new MatrixExp(getLocation(), *lines);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
/** \name Accessors.
** \{ */
public:
- const std::list<MatrixLineExp *>& lines_get() const
+ const std::list<MatrixLineExp *>& getLines() const
{
return *_lines;
}
- std::list<MatrixLineExp *>& lines_get()
+ std::list<MatrixLineExp *>& getLines()
{
return *_lines;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return MATRIXEXP;
+ }
+ inline bool isMatrixExp() const
+ {
+ return true;
+ }
protected:
std::list<MatrixLineExp *>* _lines;
};
virtual MatrixLineExp* clone()
{
std::list<Exp *>* columns = new std::list<Exp *>;
- for (std::list<Exp *>::const_iterator it = columns_get().begin() ; it != columns_get().end() ; ++it)
+ for (std::list<Exp *>::const_iterator it = getColumns().begin() ; it != getColumns().end() ; ++it)
{
columns->push_back((*it)->clone());
}
- MatrixLineExp* cloned = new MatrixLineExp(location_get(), *columns);
- cloned->set_verbose(is_verbose());
+ MatrixLineExp* cloned = new MatrixLineExp(getLocation(), *columns);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Accessors.
** \{ */
public:
- const std::list<Exp *>& columns_get() const
+ const std::list<Exp *>& getColumns() const
{
return *_columns;
}
- std::list<Exp *>& columns_get()
+ std::list<Exp *>& getColumns()
{
return *_columns;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return MATRIXLINEEXP;
+ }
+ inline bool isMatrixLineExp() const
+ {
+ return true;
+ }
protected:
std::list<Exp *>* _columns;
};
virtual NilExp* clone()
{
- NilExp* cloned = new NilExp(location_get());
- cloned->set_verbose(is_verbose());
+ NilExp* cloned = new NilExp(getLocation());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
}
/** \} */
+ virtual ExpType getType()
+ {
+ return NILEXP;
+ }
+ inline bool isNilExp() const
+ {
+ return true;
+ }
};
} // namespace ast
virtual NotExp* clone()
{
- NotExp* cloned = new NotExp(location_get(), *exp_get().clone());
- cloned->set_verbose(is_verbose());
+ NotExp* cloned = new NotExp(getLocation(), *getExp().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the expression of the operation (read only) */
- const Exp& exp_get () const
+ const Exp& getExp() const
{
return *_exp;
}
/** \brief Return the expression of the operation (read and write) */
- Exp& exp_get ()
+ Exp& getExp()
{
return *_exp;
}
+ virtual ExpType getType()
+ {
+ return NOTEXP;
+ }
+ inline bool isNotExp() const
+ {
+ return true;
+ }
protected:
/** \brief Left expression of the operation. */
Exp* _exp;
virtual OpExp* clone()
{
- OpExp* cloned = new OpExp(location_get(), *left_get().clone(), oper_get(), *right_get().clone());
- cloned->set_verbose(is_verbose());
+ OpExp* cloned = new OpExp(getLocation(), *getLeft().clone(), getOper(), *getRight().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Setters.
** \{ */
public :
- virtual void left_set(Exp& left)
+ virtual void setLeft(Exp& left)
{
_left = &left;
}
** \{ */
public:
/** \brief Return the left expression of the operation (read only) */
- const Exp& left_get () const
+ const Exp& getLeft() const
{
return *_left;
}
/** \brief Return the left expression of the operation (read and write) */
- Exp& left_get ()
+ Exp& getLeft()
{
return *_left;
}
/** \brief Return the operator description (read only) */
- Oper oper_get () const
+ Oper getOper() const
{
return _oper;
}
/** \brief Return the right expression of the operation (read only) */
- const Exp& right_get () const
+ const Exp& getRight() const
{
return *_right;
}
/** \brief Return the right expression of the operation (read and write) */
- Exp& right_get ()
+ Exp& getRight()
{
return *_right;
}
+ virtual ExpType getType()
+ {
+ return OPEXP;
+ }
+ inline bool isOpExp() const
+ {
+ return true;
+ }
protected:
/** \brief Left expression of the operation. */
virtual ReturnExp* clone()
{
ReturnExp* cloned = NULL;
- if (is_global())
+ if (isGlobal())
{
- cloned = new ReturnExp(location_get());
+ cloned = new ReturnExp(getLocation());
}
else
{
- cloned = new ReturnExp(location_get(), exp_get().clone());
+ cloned = new ReturnExp(getLocation(), getExp().clone());
}
- cloned->set_verbose(is_verbose());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Accessors.
** \{ */
public:
- const Exp & exp_get() const
+ const Exp & getExp() const
{
return *_exp;
}
- Exp & exp_get()
+ Exp & getExp()
{
return *_exp;
}
- bool is_global() const
+ bool isGlobal() const
{
return _is_global;
}
- inline virtual bool is_return_exp() const
+ virtual ExpType getType()
+ {
+ return RETURNEXP;
+ }
+ inline virtual bool isReturnExp() const
{
return true;
}
-
- /** \} */
-
-
protected:
Exp *_exp;
bool _is_global;
virtual SelectExp* clone()
{
cases_t* cases = new cases_t;
- for (cases_t::const_iterator it = cases_get()->begin() ; it != cases_get()->end() ; it++)
+ for (cases_t::const_iterator it = getCases()->begin() ; it != getCases()->end() ; it++)
{
cases->push_back((*it)->clone());
}
SelectExp* cloned = NULL;
if (_default != NULL)
{
- cloned = new SelectExp(location_get(), *select_get()->clone(), *cases, *default_case_get()->clone());
+ cloned = new SelectExp(getLocation(), *getSelect()->clone(), *cases, *getDefaultCase()->clone());
}
else
{
- cloned = new SelectExp(location_get(), *select_get()->clone(), *cases);
+ cloned = new SelectExp(getLocation(), *getSelect()->clone(), *cases);
}
- cloned->set_verbose(is_verbose());
+ cloned->setVerbose(isVerbose());
return cloned;
}
public :
- Exp* select_get() const
+ Exp* getSelect() const
{
return _selectme;
}
- cases_t* cases_get() const
+ cases_t* getCases() const
{
return _cases;
}
- SeqExp* default_case_get() const
+ SeqExp* getDefaultCase() const
{
return _default;
}
}
/** \} */
+ virtual ExpType getType()
+ {
+ return SELECTEXP;
+ }
+ inline bool isSelectExp() const
+ {
+ return true;
+ }
private :
Exp* _selectme;
cases_t* _cases;
virtual SeqExp* clone()
{
std::list<Exp *>* exp = new std::list<Exp *>;
- for (std::list<Exp *>::const_iterator it = exps_get().begin() ; it != exps_get().end() ; ++it)
+ for (std::list<Exp *>::const_iterator it = getExps().begin() ; it != getExps().end() ; ++it)
{
exp->push_back((*it)->clone());
}
- SeqExp* cloned = new SeqExp(location_get(), *exp);
- cloned->set_verbose(is_verbose());
+ SeqExp* cloned = new SeqExp(getLocation(), *exp);
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
/** \name Accessors.
** \{ */
public:
- const std::list<Exp *>& exps_get() const
+ const std::list<Exp *>& getExps() const
{
return *_l_body;
}
- std::list<Exp *>& exps_get()
+ std::list<Exp *>& gExps()
{
return *_l_body;
}
- void exps_clear()
+ void clearExps()
{
_l_body->clear();
}
/** \} */
+ virtual ExpType getType()
+ {
+ return SEQEXP;
+ }
+ inline bool isSeqExp() const
+ {
+ return true;
+ }
protected:
std::list<Exp *>* _l_body;
};
virtual SimpleVar* clone()
{
- SimpleVar* cloned = new SimpleVar(location_get(), *new symbol::Symbol(name_get().name_get()));
- cloned->set_verbose(is_verbose());
+ SimpleVar* cloned = new SimpleVar(getLocation(), *new symbol::Symbol(getSymbol().getName()));
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the Variable's name. */
- symbol::Symbol& name_get () const
+ symbol::Symbol& getSymbol () const
{
return _name;
}
- symbol::Variable* stack_get()
+ symbol::Variable* getStack()
{
if (_stack == NULL)
{
bool operator== (const SimpleVar &rhs) const
{
- return _name == rhs.name_get();
+ return _name == rhs.getSymbol();
}
- inline bool is_simple_var() const
+
+ virtual ExpType getType()
+ {
+ return SIMPLEVAR;
+ }
+ inline bool isSimpleVar() const
{
return true;
}
-
protected:
/** \brief Variable's name */
symbol::Symbol& _name;
visitprivate(e);
}
- void visit (const IntExp &e)
- {
- visitprivate(e);
- }
-
- void visit (const FloatExp &e)
- {
- visitprivate(e);
- }
-
void visit (const DoubleExp &e)
{
visitprivate(e);
virtual StringExp* clone()
{
- StringExp* cloned = new StringExp(location_get(), value_get());
- cloned->set_verbose(is_verbose());
+ StringExp* cloned = new StringExp(getLocation(), getValue());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
** \{ */
public:
/** \brief Return the name of the type name (read only). */
- const std::wstring value_get () const
+ const std::wstring getValue() const
{
return _value;
}
/** \} */
+
+ virtual ExpType getType()
+ {
+ return STRINGEXP;
+ }
+ inline bool isStringExp() const
+ {
+ return true;
+ }
+
protected:
const std::wstring _value;
types::String* _bigString;
virtual TransposeExp* clone()
{
- TransposeExp* cloned = new TransposeExp(location_get(), *exp_get().clone(), conjugate_get());
- cloned->set_verbose(is_verbose());
+ TransposeExp* cloned = new TransposeExp(getLocation(), *getExp().clone(), getConjugate());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the expression of the operation (read only) */
- const Exp& exp_get () const
+ const Exp& getExp() const
{
return *_exp;
}
/** \brief Return the expression of the operation (read and write) */
- Exp& exp_get ()
+ Exp& getExp()
{
return *_exp;
}
/** \brief Return the conjugate kind of the transposition */
- Kind conjugate_get () const
+ Kind getConjugate() const
{
return _conjugate;
}
+ virtual ExpType getType()
+ {
+ return TRANSPOSEEXP;
+ }
+ inline bool isTransposeExp() const
+ {
+ return true;
+ }
protected:
/** \brief Left expression of the operation. */
Exp* _exp;
virtual TryCatchExp* clone()
{
- TryCatchExp* cloned = new TryCatchExp(location_get(), *try_get().clone(), *catch_get().clone());
- cloned->set_verbose(is_verbose());
+ TryCatchExp* cloned = new TryCatchExp(getLocation(), *getTry().clone(), *getCatch().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
/** \name Accessors.
** \{ */
public:
- const SeqExp& try_get() const
+ const SeqExp& getTry() const
{
return *_tryme;
}
- SeqExp& try_get()
+ SeqExp& getTry()
{
return *_tryme;
}
- const SeqExp& catch_get() const
+ const SeqExp& getCatch() const
{
return *_catchme;
}
- SeqExp& catch_get()
+ SeqExp& getCatch()
{
return *_catchme;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return TRYCATCHEXP;
+ }
+ inline bool isTryCatchExp() const
+ {
+ return true;
+ }
protected:
SeqExp* _tryme;
class Var : public Exp
{
- /** \name Ctor & dtor.
- ** \{ */
public:
/** \brief Construct a Declaration node.
** \param location scanner position informations */
virtual ~Var()
{
}
- /** \} */
-
- //virtual Var* clone()
- //{
- // Location* newloc = const_cast<Location*>(&location_get())->clone();
- // return new Var(*newloc);
- //}
};
/** \brief Define a shorthand for list of Exp* manipulation. */
#include "dec.hxx"
#include "context.hxx"
+#include "ForList.hxx"
namespace ast
{
virtual VarDec* clone()
{
- VarDec* cloned = new VarDec(location_get(), *new symbol::Symbol(name_get().name_get()), *init_get().clone());
- cloned->set_verbose(is_verbose());
+ VarDec* cloned = new VarDec(getLocation(), *new symbol::Symbol(getSymbol().getName()), *getInit().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
/** \name Visitors entry point.
** \{ */
public:
/** \brief Return the variable name (read only). */
- symbol::Symbol& name_get (void) const
+ symbol::Symbol& getSymbol (void) const
{
return _name;
}
- symbol::Variable* stack_get()
+ symbol::Variable* getStack()
{
if (_stack == NULL)
{
}
/** \brief Return the initial expression value (read only). */
- const Exp& init_get (void) const
+ const Exp& getInit (void) const
{
return *_init;
}
/** \brief Return the initial expression value (read and write). */
- Exp& init_get (void)
+ Exp& getInit (void)
{
return *_init;
}
+ analysis::ForList64 getListInfo() const
+ {
+ return list_info;
+ }
+
+ analysis::ForList64 & getListInfo()
+ {
+ return list_info;
+ }
+
+ void setListInfo(analysis::ForList64 & _list_info)
+ {
+ list_info = _list_info;
+ }
+
+ void setListInfo(analysis::ForList64 && _list_info)
+ {
+ list_info = _list_info;
+ }
+
+ virtual ExpType getType()
+ {
+ return VARDEC;
+ }
+ inline bool isVarDec() const
+ {
+ return true;
+ }
protected:
+ analysis::ForList64 list_info;
/** \brief Name of the declared variable. */
symbol::Symbol& _name;
+ symbol::Variable* _stack;
/** \brief The initial value (expression) assigned to the variable. */
Exp* _init;
-
- symbol::Variable* _stack;
};
} // namespace ast
#endif // !AST_VARDEC_HXX
+
virtual WhileExp* clone()
{
- WhileExp* cloned = new WhileExp(location_get(), *test_get().clone(), *body_get().clone());
- cloned->set_verbose(is_verbose());
+ WhileExp* cloned = new WhileExp(getLocation(), *getTest().clone(), *getBody().clone());
+ cloned->setVerbose(isVerbose());
return cloned;
}
** \{ */
public:
/** \brief Return the exit condition of the loop (read only). */
- const Exp& test_get() const
+ const Exp& getTest() const
{
return *_test;
}
/** \brief Return the exit condition of the loop (read and write). */
- Exp& test_get()
+ Exp& getTest()
{
return *_test;
}
/** \brief Return the body of the loop (read only). */
- const Exp& body_get() const
+ const Exp& getBody() const
{
return *_body;
}
/** \brief Return the body of the loop (read and write). */
- Exp& body_get()
+ Exp& getBody()
{
return *_body;
}
/** \} */
+ virtual ExpType getType()
+ {
+ return WHILEEXP;
+ }
+ inline bool isWhileExp() const
+ {
+ return true;
+ }
protected:
/** \brief Exit condition of the loop. */
Exp* _test;
types::MacroFile* getMacroFile(const Symbol& _key)
{
- return m_pLib->get(_key.name_get());
+ return m_pLib->get(_key.getName());
}
int m_iLevel;
** \{ */
public:
/** \brief Return the wstring referenced by this Symbol. */
- const std::wstring& name_get () const;
+ const std::wstring& getName () const;
/** \brief Return the number of referenced strings. */
- static size_type map_size ();
+ static size_type getSize ();
/** \brief Return all symbols. */
- static wchar_t** get_all ();
+ static wchar_t** getAll ();
/** \} */
bool operator< (const Symbol &rhs) const;
/** \} */
- const string_set_type::const_iterator get_node() const
+ const string_set_type::const_iterator getNode() const
{
return _set_node;
}
stack.pop();
}
- inline Symbol name_get() const
+ inline Symbol getSymbol() const
{
return name;
}
types::InternalType* pIT = it->second->top()->m_pIT;
if (pIT && (pIT->isMacro() || pIT->isMacroFile()))
{
- plOut->push_back(it->first.name_get().c_str());
+ plOut->push_back(it->first.getName().c_str());
}
}
}
pIT->isMacroFile() == false &&
pIT->isFunction() == false)
{
- plOut->push_back(it->first.name_get().c_str());
+ plOut->push_back(it->first.getName().c_str());
}
}
}
types::InternalType* pIT = it->second->top()->m_pIT;
if (pIT && pIT->isFunction())
{
- plOut->push_back(it->first.name_get().c_str());
+ plOut->push_back(it->first.getName().c_str());
}
}
}
static int m_iPromptMode;
static int m_iSilentError;
- //set before function call to know status of e.is_verbose in functions
+ //set before function call to know status of e.isVerbose in functions
static bool m_bVerbose;
public :
{
std::wostringstream os;
os << _W("Invalid index.\n");
- throw ast::ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+ throw ast::ScilabError(os.str(), 999, (*e.getArgs().begin())->getLocation());
}
out.push_back(_out);
}
{
std::wostringstream os;
os << _W("Invalid index.\n");
- throw ast::ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+ throw ast::ScilabError(os.str(), 999, (*e.getArgs().begin())->getLocation());
}
out.push_back(_out);
}
{
std::wostringstream os;
os << _W("Invalid index.\n");
- throw ast::ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+ throw ast::ScilabError(os.str(), 999, (*e.getArgs().begin())->getLocation());
}
out.push_back(_out);
}
static void DEBUG_START_NODE(const ast::Ast& e)
{
- wcerr << L"(" << e.nodeNumber_get() << L") ";
+ wcerr << L"(" << e.getNodeNumber() << L") ";
++level;
}
}
wcerr << str;
- Location loc = e.location_get();
+ Location loc = e.getLocation();
wcerr << L" @(" << loc.first_line << L"." << loc.first_column << L" -> ";
wcerr << loc.last_line << L"." << loc.last_column << L")" << endl;
}
DEBUG_START_NODE(e);
DEBUG(L"Exec MatrixExp", e);
list<MatrixLineExp *>::const_iterator i;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; ++i )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; ++i )
{
(*i)->accept (*this);
}
DEBUG_START_NODE(e);
DEBUG(L"Exec MatrixLineExp", e);
list<Exp *>::const_iterator i;
- for (i = e.columns_get().begin() ; i != e.columns_get().end() ; ++i)
+ for (i = e.getColumns().begin() ; i != e.getColumns().end() ; ++i)
{
(*i)->accept (*this);
}
DEBUG_START_NODE(e);
DEBUG(L"Exec CellExp", e);
list<MatrixLineExp *>::const_iterator i;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; ++i )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; ++i )
{
(*i)->accept (*this);
}
void DebugVisitor::visit (const StringExp &e)
{
DEBUG_START_NODE(e);
- DEBUG(L"Exec StringExp : " + e.value_get(), e);
+ DEBUG(L"Exec StringExp : " + e.getValue(), e);
DEBUG_END_NODE();
}
void DebugVisitor::visit (const CommentExp &e)
{
DEBUG_START_NODE(e);
- DEBUG(L"Exec CommentExp : " + e.comment_get(), e);
- DEBUG_END_NODE();
-}
-
-void DebugVisitor::visit (const IntExp &e)
-{
- DEBUG_START_NODE(e);
- DEBUG(L"Exec IntExp : " + e.value_get(), e);
- DEBUG_END_NODE();
-}
-
-void DebugVisitor::visit (const FloatExp &e)
-{
- DEBUG_START_NODE(e);
- wostringstream stream;
- stream << e.value_get();
- DEBUG(L"Exec FloatExp : " + stream.str(), e);
+ DEBUG(L"Exec CommentExp : " + e.getComment(), e);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
wostringstream stream;
- stream << e.value_get();
+ stream << e.getValue();
DEBUG(L"Exec DoubleExp : " + stream.str(), e);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
wostringstream stream;
- stream << e.value_get();
- DEBUG(L"Exec BoolExp : " + stream.str(), e);
+ stream << e.getValue();
+ DEBUG(L"Exec getv : " + stream.str(), e);
DEBUG_END_NODE();
}
void DebugVisitor::visit (const SimpleVar &e)
{
DEBUG_START_NODE(e);
- DEBUG(L"Exec SimpleVar : " + e.name_get().name_get(), e);
+ DEBUG(L"Exec SimpleVar : " + e.getSymbol().getName(), e);
DEBUG_END_NODE();
}
DEBUG_START_NODE(e);
DEBUG(L"Exec ArrayListVar", e);
list<Var *>::const_iterator i;
- for (i = e.vars_get().begin() ; i != e.vars_get().end() ; ++i)
+ for (i = e.getVars().begin() ; i != e.getVars().end() ; ++i)
{
(*i)->accept (*this);
}
DEBUG(L"Exec FieldExp", e);
// FIXME
{
- e.head_get()->accept(*this);
- e.tail_get()->accept(*this);
+ e.getHead()->accept(*this);
+ e.getTail()->accept(*this);
}
DEBUG_END_NODE();
}
DEBUG(L"Exec OpExp", e);
// FIXME
{
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
//e.oper_get();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
}
DEBUG_END_NODE();
}
DEBUG(L"Exec LogicalOpExp", e);
// FIXME
{
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
//e.oper_get();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
}
DEBUG_END_NODE();
}
DEBUG(L"Exec AssignExp", e);
//FIXME
{
- e.left_exp_get().accept (*this);
- e.right_exp_get().accept (*this);
+ e.getLeftExp().accept (*this);
+ e.getRightExp().accept (*this);
}
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec CellCallExp", e);
- e.name_get().accept (*this);
+ e.getName().accept (*this);
// FIXME
{
list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+ for (i = e.getArgs().begin (); i != e.getArgs().end (); ++i)
{
(*i)->accept (*this);
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec CallExp", e);
- e.name_get().accept (*this);
+ e.getName().accept (*this);
// FIXME
{
list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+ for (i = e.getArgs().begin (); i != e.getArgs().end (); ++i)
{
(*i)->accept (*this);
}
DEBUG(L"Exec IfExp", e);
// FIXME
{
- e.test_get ().accept(*this);
- e.then_get ().accept(*this);
- if (e.has_else())
+ e.getTest ().accept(*this);
+ e.getThen ().accept(*this);
+ if (e.hasElse())
{
- e.else_get ().accept(*this);
+ e.getElse ().accept(*this);
}
}
DEBUG_END_NODE();
DEBUG(L"Exec TryCatchExp", e);
// FIXME
{
- e.try_get ().accept(*this);
- e.catch_get ().accept(*this);
+ e.getTry ().accept(*this);
+ e.getCatch ().accept(*this);
}
DEBUG_END_NODE();
}
DEBUG_START_NODE(e);
DEBUG(L"Exec WhileExp", e);
// FIMXE
- e.test_get().accept (*this);
- e.body_get().accept (*this);
+ e.getTest().accept (*this);
+ e.getBody().accept (*this);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec ForExp", e);
- e.vardec_get().accept(*this);
- e.body_get().accept (*this);
+ e.getVardec().accept(*this);
+ e.getBody().accept (*this);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec ReturnExp", e);
- if (!e.is_global())
+ if (!e.isGlobal())
{
- e.exp_get().accept(*this);
+ e.getExp().accept(*this);
}
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec SelectExp", e);
- e.select_get()->accept(*this);
+ e.getSelect()->accept(*this);
ast::cases_t::iterator it;
- for (it = e.cases_get()->begin() ; it != e.cases_get()->end() ; ++it)
+ for (it = e.getCases()->begin() ; it != e.getCases()->end() ; ++it)
{
(*it)->accept(*this);
}
- if (e.default_case_get() != NULL)
+ if (e.getDefaultCase() != NULL)
{
- e.default_case_get()->accept(*this);
+ e.getDefaultCase()->accept(*this);
}
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec CaseExp", e);
- e.test_get()->accept(*this);
- e.body_get()->accept(*this);
+ e.getTest()->accept(*this);
+ e.getBody()->accept(*this);
DEBUG_END_NODE();
}
DEBUG_START_NODE(e);
DEBUG(L"Exec SeqExp", e);
list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
- if (!(*i)->is_verbose())
+ if (!(*i)->isVerbose())
{
DEBUG(L"__MUTE__");
}
DEBUG_START_NODE(e);
DEBUG(L"Exec ArrayListExp", e);
list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
(*i)->accept (*this);
}
DEBUG_START_NODE(e);
DEBUG(L"Exec AssignListExp", e);
list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
(*i)->accept (*this);
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec NotExp", e);
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec TransposeExp", e);
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
DEBUG_END_NODE();
}
/** \} */
DEBUG(L"Exec VarDec", e);
{
DEBUG_START_NODE(e);
- DEBUG(L"Exec Symbol : " + e.name_get().name_get(), e);
+ DEBUG(L"Exec Symbol : " + e.getSymbol().getName(), e);
DEBUG_END_NODE();
}
- e.init_get().accept(*this);
+ e.getInit().accept(*this);
DEBUG_END_NODE();
}
//visit(e.returns_get());
// Then get the function name
- //visit(e.name_get());
+ //visit(e.getName());
// Then get function args
//visit(e.args_get());
// Now debug function body
- e.body_get().accept(*this);
+ e.getBody().accept(*this);
DEBUG_END_NODE();
}
{
DEBUG_START_NODE(e);
DEBUG(L"Exec ListExp", e);
- e.start_get().accept(*this);
- e.step_get().accept(*this);
- e.end_get().accept(*this);
+ e.getStart().accept(*this);
+ e.getStep().accept(*this);
+ e.getEnd().accept(*this);
DEBUG_END_NODE();
}
/** \} */
std::wstring wcsExp = L"";
if (m_pExp)
{
- wcsExp = m_pExp->name_get().name_get();
+ wcsExp = m_pExp->getSymbol().getName();
}
return wcsExp;
{
void MacrovarVisitor::visit (const SimpleVar &e)
{
- m_current = e.name_get().name_get();
+ m_current = e.getSymbol().getName();
}
void MacrovarVisitor::visit(const CallExp &e)
{
- e.name_get().accept (*this);
+ e.getName().accept (*this);
add();
std::list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+ for (i = e.getArgs().begin (); i != e.getArgs().end (); ++i)
{
(*i)->accept (*this);
add();
void MacrovarVisitor::visit(const AssignExp &e)
{
- e.left_exp_get().accept (*this);
+ e.getLeftExp().accept (*this);
add();
- e.right_exp_get().accept (*this);
+ e.getRightExp().accept (*this);
add();
}
void MacrovarVisitor::visit (const VarDec &e)
{
- e.init_get().accept(*this);
+ e.getInit().accept(*this);
add(m_local);
}
void MuteVisitor::visit (const MatrixExp &e)
{
std::list<MatrixLineExp *>::const_iterator row;
- for (row = e.lines_get().begin() ; row != e.lines_get().end() ; ++row )
+ for (row = e.getLines().begin() ; row != e.getLines().end() ; ++row )
{
(*row)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const MatrixLineExp &e)
{
std::list<Exp *>::const_iterator col;
- for (col = e.columns_get().begin() ; col != e.columns_get().end() ; ++col)
+ for (col = e.getColumns().begin() ; col != e.getColumns().end() ; ++col)
{
(*col)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const CellExp &e)
{
std::list<MatrixLineExp *>::const_iterator row;
- for (row = e.lines_get().begin() ; row != e.lines_get().end() ; ++row )
+ for (row = e.getLines().begin() ; row != e.getLines().end() ; ++row )
{
(*row)->mute();
MuteVisitor mute;
{
}
-void MuteVisitor::visit (const IntExp &/*e*/)
-{
-}
-
-void MuteVisitor::visit (const FloatExp &/*e*/)
-{
-}
-
void MuteVisitor::visit (const DoubleExp &/*e*/)
{
}
void MuteVisitor::visit (const ArrayListVar &e)
{
std::list<Var *>::const_iterator var;
- for (var = e.vars_get().begin() ; var != e.vars_get().end() ; var++)
+ for (var = e.getVars().begin() ; var != e.getVars().end() ; var++)
{
(*var)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const FieldExp &e)
{
- const_cast<Exp*>(e.head_get())->mute();
- const_cast<Exp*>(e.tail_get())->mute();
+ const_cast<Exp*>(e.getHead())->mute();
+ const_cast<Exp*>(e.getTail())->mute();
MuteVisitor mute;
- e.head_get()->accept(mute);
- e.tail_get()->accept(mute);
+ e.getHead()->accept(mute);
+ e.getTail()->accept(mute);
}
void MuteVisitor::visit(const OpExp &e)
{
- const_cast<Exp&>(e.left_get()).mute();
- const_cast<Exp&>(e.right_get()).mute();
+ const_cast<Exp&>(e.getLeft()).mute();
+ const_cast<Exp&>(e.getRight()).mute();
MuteVisitor mute;
- e.left_get().accept(mute);
- e.right_get().accept(mute);
+ e.getLeft().accept(mute);
+ e.getRight().accept(mute);
}
void MuteVisitor::visit(const LogicalOpExp &e)
{
- const_cast<Exp&>(e.left_get()).mute();
- const_cast<Exp&>(e.right_get()).mute();
+ const_cast<Exp&>(e.getLeft()).mute();
+ const_cast<Exp&>(e.getRight()).mute();
MuteVisitor mute;
- e.left_get().accept(mute);
- e.right_get().accept(mute);
+ e.getLeft().accept(mute);
+ e.getRight().accept(mute);
}
void MuteVisitor::visit (const AssignExp &e)
{
- const_cast<Exp&>(e.left_exp_get()).mute();
- const_cast<Exp&>(e.right_exp_get()).mute();
+ const_cast<Exp&>(e.getLeftExp()).mute();
+ const_cast<Exp&>(e.getRightExp()).mute();
MuteVisitor mute;
- e.left_exp_get().accept(mute);
- e.right_exp_get().accept(mute);
+ e.getLeftExp().accept(mute);
+ e.getRightExp().accept(mute);
}
void MuteVisitor::visit(const CallExp &e)
{
std::list<Exp *>::const_iterator arg;
- for (arg = e.args_get().begin() ; arg != e.args_get().end() ; arg++)
+ for (arg = e.getArgs().begin() ; arg != e.getArgs().end() ; arg++)
{
(*arg)->mute();
MuteVisitor mute;
void MuteVisitor::visit(const CellCallExp &e)
{
std::list<Exp *>::const_iterator arg;
- for (arg = e.args_get().begin() ; arg != e.args_get().end() ; arg++)
+ for (arg = e.getArgs().begin() ; arg != e.getArgs().end() ; arg++)
{
(*arg)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const IfExp &e)
{
- const_cast<Exp&>(e.test_get()).mute();
- const_cast<Exp&>(e.then_get()).mute();
- if (e.has_else())
+ const_cast<Exp&>(e.getTest()).mute();
+ const_cast<Exp&>(e.getThen()).mute();
+ if (e.hasElse())
{
- const_cast<Exp&>(e.else_get()).mute();
+ const_cast<Exp&>(e.getElse()).mute();
}
MuteVisitor mute;
- e.test_get().accept(mute);
- e.then_get().accept(mute);
- if (e.has_else())
+ e.getTest().accept(mute);
+ e.getThen().accept(mute);
+ if (e.hasElse())
{
- e.else_get().accept(mute);
+ e.getElse().accept(mute);
}
}
void MuteVisitor::visit (const TryCatchExp &e)
{
- const_cast<SeqExp&>(e.try_get()).mute();
- const_cast<SeqExp&>(e.catch_get()).mute();
+ const_cast<SeqExp&>(e.getTry()).mute();
+ const_cast<SeqExp&>(e.getCatch()).mute();
MuteVisitor mute;
- e.try_get().accept(mute);
- e.catch_get().accept(mute);
+ e.getTry().accept(mute);
+ e.getCatch().accept(mute);
}
void MuteVisitor::visit (const WhileExp &e)
{
- const_cast<Exp&>(e.test_get()).mute();
- const_cast<Exp&>(e.body_get()).mute();
+ const_cast<Exp&>(e.getTest()).mute();
+ const_cast<Exp&>(e.getBody()).mute();
MuteVisitor mute;
- e.test_get().accept(mute);
- e.body_get().accept(mute);
+ e.getTest().accept(mute);
+ e.getBody().accept(mute);
}
void MuteVisitor::visit (const ForExp &e)
{
- const_cast<Exp&>(e.body_get()).mute();
+ const_cast<Exp&>(e.getBody()).mute();
MuteVisitor mute;
- e.body_get().accept(mute);
+ e.getBody().accept(mute);
}
void MuteVisitor::visit (const BreakExp &/*e*/)
void MuteVisitor::visit (const SeqExp &e)
{
std::list<Exp *>::const_iterator seq;
- for (seq = e.exps_get().begin() ; seq != e.exps_get().end() ; seq++)
+ for (seq = e.getExps().begin() ; seq != e.getExps().end() ; seq++)
{
(*seq)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const ArrayListExp &e)
{
std::list<Exp *>::const_iterator exp;
- for (exp = e.exps_get().begin() ; exp != e.exps_get().end() ; exp++)
+ for (exp = e.getExps().begin() ; exp != e.getExps().end() ; exp++)
{
(*exp)->mute();
MuteVisitor mute;
void MuteVisitor::visit (const FunctionDec &e)
{
- const_cast<Exp&>(e.body_get()).mute();
+ const_cast<Exp&>(e.getBody()).mute();
MuteVisitor mute;
- e.body_get().accept(mute);
+ e.getBody().accept(mute);
}
void MuteVisitor::visit(const ListExp &/*e*/)
*ostr << SCI_OPEN_MATRIX;
++indent;
this->is_last_matrix_line = false;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; )
{
j = i;
- if (++j == e.lines_get().end())
+ if (++j == e.getLines().end())
{
this->is_last_matrix_line = true;
}
(*i)->accept (*this);
++i;
- if (e.lines_get().size() > 1)
+ if (e.getLines().size() > 1)
{
*ostr << std::endl;
this->apply_indent();
std::list<Exp *>::const_iterator i;
bool last_column_is_comment = false;
- for (i = e.columns_get().begin() ; i != e.columns_get().end() ; )
+ for (i = e.getColumns().begin() ; i != e.getColumns().end() ; )
{
(*i)->accept (*this);
if (dynamic_cast<ast::CommentExp*>(*i) != NULL)
{
last_column_is_comment = true;
}
- if (++i != e.columns_get().end())
+ if (++i != e.getColumns().end())
{
if (dynamic_cast<ast::CommentExp*>(*i) == NULL)
{
std::list<MatrixLineExp *>::const_iterator i;
*ostr << SCI_OPEN_CELL;
++indent;
- for (i = e.lines_get().begin() ; i != e.lines_get().end() ; )
+ for (i = e.getLines().begin() ; i != e.getLines().end() ; )
{
(*i)->accept (*this);
- if (++i != e.lines_get().end())
+ if (++i != e.getLines().end())
{
*ostr << SCI_LINE_SEPARATOR << std::endl;
this->apply_indent();
std::wstring::const_iterator it;
*ostr << SCI_OPEN_STRING;
- std::wstring value = e.value_get();
+ std::wstring value = e.getValue();
for (it = value.begin() ; it != value.end() ; ++it)
{
void PrintVisitor::visit (const CommentExp &e)
{
*ostr << SCI_OPEN_COMMENT;
- *ostr << e.comment_get();
-}
-
-void PrintVisitor::visit (const IntExp &e)
-{
- switch (e.prec_get())
- {
- case IntExp::_8_:
- *ostr << SCI_INT8;
- break;
- case IntExp::_16_:
- *ostr << SCI_INT16;
- break;
- case IntExp::_32_:
- *ostr << SCI_INT32;
- break;
- case IntExp::_64_:
- *ostr << SCI_INT64;
- break;
- }
- *ostr << SCI_LPAREN << e.value_get() << SCI_RPAREN;
-}
-
-void PrintVisitor::visit (const FloatExp &e)
-{
- *ostr << e.value_get();
+ *ostr << e.getComment();
}
void PrintVisitor::visit (const DoubleExp &e)
{
- *ostr << e.value_get();
+ *ostr << e.getValue();
}
void PrintVisitor::visit (const BoolExp &e)
{
- if (e.value_get() == true)
+ if (e.getValue() == true)
{
*ostr << SCI_TRUE;
}
** \{ */
void PrintVisitor::visit (const SimpleVar &e)
{
- *ostr << e.name_get().name_get();
+ *ostr << e.getSymbol().getName();
}
void PrintVisitor::visit (const ColonVar &/*e*/)
void PrintVisitor::visit (const ArrayListVar &e)
{
std::list<Var *>::const_iterator i;
- for (i = e.vars_get().begin() ; i != e.vars_get().end() ; )
+ for (i = e.getVars().begin() ; i != e.getVars().end() ; )
{
(*i)->accept (*this);
- if (++i != e.vars_get().end())
+ if (++i != e.getVars().end())
{
*ostr << ", ";
}
void PrintVisitor::visit (const FieldExp &e)
{
- e.head_get()->accept(*this);
+ e.getHead()->accept(*this);
*ostr << SCI_FVAR_SEPARATOR;
- e.tail_get()->accept(*this);
+ e.getTail()->accept(*this);
}
void PrintVisitor::visit(const OpExp &e)
*ostr << SCI_LPAREN;
}
- if (e.oper_get() != OpExp::unaryMinus)
+ if (e.getOper() != OpExp::unaryMinus)
{
// Getting Left Operand
this->enable_force_parenthesis();
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
this->set_force_parenthesis(old_force_parenthesis);
*ostr << " ";
}
- switch (e.oper_get())
+ switch (e.getOper())
{
// Arithmetics.
case OpExp::plus:
// Now getting right operand
this->enable_force_parenthesis();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
this->set_force_parenthesis(old_force_parenthesis);
if (force_parenthesis)
// Getting Left Operand
this->enable_force_parenthesis();
- e.left_get().accept(*this);
+ e.getLeft().accept(*this);
this->set_force_parenthesis(old_force_parenthesis);
*ostr << " ";
- switch (e.oper_get())
+ switch (e.getOper())
{
// Binary Operators
case LogicalOpExp::logicalAnd:
// Now getting right operand
this->enable_force_parenthesis();
- e.right_get().accept(*this);
+ e.getRight().accept(*this);
this->set_force_parenthesis(old_force_parenthesis);
if (force_parenthesis)
void PrintVisitor::visit (const AssignExp &e)
{
- e.left_exp_get ().accept (*this);
+ e.getLeftExp().accept (*this);
*ostr << " " << SCI_ASSIGN << " ";
- e.right_exp_get ().accept (*this);
+ e.getRightExp().accept (*this);
}
void PrintVisitor::visit(const CellCallExp &e)
{
- e.name_get().accept (*this);
+ e.getName().accept (*this);
*ostr << SCI_OPEN_CELL;
std::list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end ();)
+ for (i = e.getArgs().begin (); i != e.getArgs().end ();)
{
(*i)->accept (*this);
- if (++i != e.args_get().end ())
+ if (++i != e.getArgs().end ())
{
*ostr << SCI_COMMA << " ";
}
void PrintVisitor::visit(const CallExp &e)
{
- e.name_get().accept (*this);
+ e.getName().accept (*this);
*ostr << SCI_OPEN_CALL;
std::list<Exp *>::const_iterator i;
- for (i = e.args_get().begin (); i != e.args_get().end ();)
+ for (i = e.getArgs().begin(); i != e.getArgs().end();)
{
(*i)->accept (*this);
- if (++i != e.args_get().end ())
+ if (++i != e.getArgs().end())
{
*ostr << SCI_COMMA << " ";
}
{
*ostr << SCI_IF;
*ostr << " " << SCI_OPEN_TEST;
- e.test_get ().accept(*this);
+ e.getTest().accept(*this);
*ostr << SCI_CLOSE_TEST << " ";
*ostr << SCI_THEN << std::endl;
++indent;
- e.then_get ().accept(*this);
+ e.getThen().accept(*this);
--indent;
- if (e.has_else())
+ if (e.hasElse())
{
this->apply_indent();
*ostr << SCI_ELSE << std::endl;
++indent;
- e.else_get ().accept(*this);
+ e.getElse().accept(*this);
--indent;
}
this->apply_indent();
{
*ostr << SCI_TRY << std::endl;
++indent;
- e.try_get ().accept(*this);
+ e.getTry().accept(*this);
--indent;
this->apply_indent();
*ostr << SCI_CATCH << std::endl;
++indent;
- e.catch_get ().accept(*this);
+ e.getCatch().accept(*this);
--indent;
this->apply_indent();
*ostr << SCI_ENDTRY;
{
*ostr << SCI_WHILE;
*ostr << " " << SCI_OPEN_TEST;
- e.test_get().accept (*this);
+ e.getTest().accept (*this);
*ostr << SCI_CLOSE_TEST << " " << SCI_DO << std::endl;
++indent;
- e.body_get().accept (*this);
+ e.getBody().accept (*this);
--indent;
this->apply_indent();
*ostr << SCI_ENDWHILE;
{
*ostr << SCI_FOR;
*ostr << " " << SCI_OPEN_TEST;
- e.vardec_get().accept(*this);
+ e.getVardec().accept(*this);
*ostr << SCI_CLOSE_TEST << " ";
*ostr << SCI_DO << std::endl;
++indent;
- e.body_get().accept (*this);
+ e.getBody().accept (*this);
--indent;
this->apply_indent();
*ostr << SCI_ENDFOR;
void PrintVisitor::visit (const ReturnExp &e)
{
*ostr << SCI_RETURN;
- if (!e.is_global())
+ if (!e.isGlobal())
{
*ostr << " " ;
- e.exp_get().accept(*this);
+ e.getExp().accept(*this);
}
}
{
*ostr << SCI_SELECT;
*ostr << " " << SCI_OPEN_TEST;
- e.select_get()->accept(*this);
+ e.getSelect()->accept(*this);
*ostr << SCI_CLOSE_TEST << std::endl;
++indent;
cases_t::const_iterator it;
- for (it = e.cases_get()->begin() ; it != e.cases_get()->end() ; ++it)
+ for (it = e.getCases()->begin() ; it != e.getCases()->end() ; ++it)
{
(*it)->accept (*this);
}
- if (e.default_case_get() != NULL)
+ if (e.getDefaultCase() != NULL)
{
this->apply_indent();
*ostr << SCI_DEFAULT_CASE << std::endl;
++indent;
- e.default_case_get()->accept(*this);
+ e.getDefaultCase()->accept(*this);
--indent;
}
--indent;
this->apply_indent();
*ostr << SCI_CASE;
*ostr << " " << SCI_OPEN_TEST;
- e.test_get()->accept(*this);
+ e.getTest()->accept(*this);
*ostr << SCI_CLOSE_TEST << std::endl;
indent++;
- e.body_get()->accept(*this);
+ e.getBody()->accept(*this);
indent--;
}
void PrintVisitor::visit (const SeqExp &e)
{
std::list<Exp *>::const_iterator i;
- for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
+ for (i = e.getExps().begin (); i != e.getExps().end (); ++i)
{
this->apply_indent();
(*i)->accept (*this);
- if (!(*i)->is_verbose())
+ if (!(*i)->isVerbose())
{
*ostr << ";";
}
{
std::list<Exp *>::const_iterator i;
*ostr << SCI_LPAREN;
- for (i = e.exps_get().begin (); i != e.exps_get().end ();)
+ for (i = e.getExps().begin (); i != e.getExps().end ();)
{
(*i)->accept (*this);
- if (++i != e.exps_get().end ())
+ if (++i != e.getExps().end ())
{
*ostr << SCI_COMMA << " ";
}
{
std::list<Exp *>::const_iterator i;
*ostr << SCI_LBRACK;
- for (i = e.exps_get().begin (); i != e.exps_get().end ();)
+ for (i = e.getExps().begin (); i != e.getExps().end ();)
{
(*i)->accept (*this);
- if (++i != e.exps_get().end ())
+ if (++i != e.getExps().end ())
{
*ostr << SCI_COMMA << " ";
}
{
*ostr << SCI_NOT;
*ostr << SCI_LPAREN;
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
*ostr << SCI_RPAREN;
}
void PrintVisitor::visit (const TransposeExp &e)
{
*ostr << SCI_LPAREN;
- e.exp_get().accept (*this);
+ e.getExp().accept (*this);
*ostr << SCI_RPAREN;
- if (e.conjugate_get() == TransposeExp::_Conjugate_)
+ if (e.getConjugate() == TransposeExp::_Conjugate_)
{
*ostr << SCI_CONJUGATE_TRANSPOSE;
}
- if (e.conjugate_get() == TransposeExp::_NonConjugate_)
+ if (e.getConjugate() == TransposeExp::_NonConjugate_)
{
*ostr << SCI_TRANSPOSE;
}
/** \brief Visit Var declarations. */
void PrintVisitor::visit (const VarDec &e)
{
- *ostr << e.name_get().name_get();
+ *ostr << e.getSymbol().getName();
*ostr << SCI_ASSIGN;
- e.init_get ().accept (*this);
+ e.getInit().accept (*this);
}
void PrintVisitor::visit (const FunctionDec &e)
*ostr << SCI_FUNCTION << " ";
// First ask if there are some return values.
- if (e.returns_get().vars_get().size() > 1)
+ if (e.getReturns().getVars().size() > 1)
{
*ostr << SCI_OPEN_RETURNS;
}
- visit(e.returns_get());
+ visit(e.getReturns());
- if (e.returns_get().vars_get().size() > 1)
+ if (e.getReturns().getVars().size() > 1)
{
*ostr << SCI_CLOSE_RETURNS;
}
*ostr << " ";
- if (e.returns_get().vars_get().size() > 0)
+ if (e.getReturns().getVars().size() > 0)
{
*ostr << SCI_ASSIGN << " ";
}
// Then get the function name
- *ostr << e.name_get().name_get();
+ *ostr << e.getSymbol().getName();
// Then get function args
*ostr << SCI_OPEN_ARGS;
- visit(e.args_get());
+ visit(e.getArgs());
*ostr << SCI_CLOSE_ARGS << std::endl;
// Now print function body
++indent;
- e.body_get().accept(*this);
+ e.getBody().accept(*this);
--indent;
this->apply_indent();
void PrintVisitor::visit(const ListExp &e)
{
*ostr << SCI_LPAREN;
- e.start_get().accept(*this);
+ e.getStart().accept(*this);
if (e.hasExplicitStep())
{
*ostr << SCI_IMPLICIT_LIST;
- e.step_get().accept(*this);
+ e.getStep().accept(*this);
}
*ostr << SCI_IMPLICIT_LIST;
- e.end_get().accept(*this);
+ e.getEnd().accept(*this);
*ostr << SCI_RPAREN;
}
/** \} */
try
{
SimpleVar * pVar = NULL;
- if (e.left_exp_get().is_simple_var())
+ if (e.getLeftExp().isSimpleVar())
{
- pVar = static_cast<SimpleVar*>(&e.left_exp_get());
+ pVar = static_cast<SimpleVar*>(&e.getLeftExp());
}
/*get king of left hand*/
{
// x = ?
/*getting what to assign*/
- InternalType *pIT = e.right_val_get();
+ InternalType *pIT = e.getRightVal();
if (pIT == NULL)
{
- expected_setSize(1);
- e.right_exp_get().accept(*this);
+ setExpectedSize(1);
+ e.getRightExp().accept(*this);
- if (result_getSize() != 1)
+ if (getResultSize() != 1)
{
std::wostringstream os;
os << _W("Can not assign multiple value in a single variable") << std::endl;
- //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ //os << ((Location)e.getRightExp().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
- pIT = result_get();
+ pIT = getResult();
//reset result
- result_set(NULL);
+ setResult(NULL);
}
if (pIT->isImplicitList())
if (pIT->isListDelete())
{
//used to delete a variable in current scope
- symbol::Context::getInstance()->remove(pVar->name_get());
+ symbol::Context::getInstance()->remove(pVar->getSymbol());
}
- result_set(NULL);
+ setResult(NULL);
return;
}
- if (e.right_exp_get().is_return_exp())
+ if (e.getLeftExp().isReturnExp())
{
//ReturnExp so, put the value in the previous scope
- symbol::Context::getInstance()->putInPreviousScope(pVar->stack_get(), pIT);
- ((AssignExp*)&e)->return_set();
+ symbol::Context::getInstance()->putInPreviousScope(pVar->getStack(), pIT);
+ ((AssignExp*)&e)->setReturn();
}
else
{
- symbol::Context::getInstance()->put(pVar->stack_get(), pIT);
+ symbol::Context::getInstance()->put(pVar->getStack(), pIT);
}
- if (e.is_verbose() && ConfigVariable::isPromptShow())
+ if (e.isVerbose() && ConfigVariable::isPromptShow())
{
std::wostringstream ostr;
- ostr << pVar->name_get().name_get() << L" = " << std::endl << std::endl;
+ ostr << pVar->getSymbol().getName() << L" = " << std::endl << std::endl;
scilabWriteW(ostr.str().c_str());
- VariableToString(pIT, pVar->name_get().name_get().c_str());
+ VariableToString(pIT, pVar->getSymbol().getName().c_str());
}
return;
}
- CellCallExp *pCell = dynamic_cast<CellCallExp*>(&e.left_exp_get());
+ CellCallExp *pCell = dynamic_cast<CellCallExp*>(&e.getLeftExp());
if (pCell)
{
InternalType *pOut = NULL;
/*getting what to assign*/
- InternalType* pITR = e.right_val_get();
+ InternalType* pITR = e.getRightVal();
if (pITR == NULL)
{
- e.right_exp_get().accept(*this);
- pITR = result_get();
+ e.getRightExp().accept(*this);
+ pITR = getResult();
//reset result
- result_set(NULL);
+ setResult(NULL);
}
if (pITR == NULL)
// if the right hand is NULL.
std::wostringstream os;
os << _W("Unable to extract right part expression.\n");
- throw ast::ScilabError(os.str(), 999, e.left_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getLeftExp().getLocation());
}
std::list<ExpHistory*> fields;
}
std::wostringstream os;
os << _W("Get fields from expression failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
pOut = evaluateFields(pCell, fields, pITR);
{
std::wostringstream os;
os << _W("Fields evaluation failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
if (pOut != NULL)
{
- if (e.is_verbose() && ConfigVariable::isPromptShow())
+ if (e.isVerbose() && ConfigVariable::isPromptShow())
{
std::wostringstream ostr;
const wchar_t* wcsVarName;
if (pVar)
{
- ostr << pVar->name_get().name_get() << L" = " << std::endl;
- wcsVarName = pVar->name_get().name_get().c_str();
+ ostr << pVar->getSymbol().getName() << L" = " << std::endl;
+ wcsVarName = pVar->getSymbol().getName().c_str();
}
else
{
//manage error
std::wostringstream os;
os << _W("Invalid Index.\n");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
return;
}
- CallExp *pCall = dynamic_cast<CallExp*>(&e.left_exp_get());
+ CallExp *pCall = dynamic_cast<CallExp*>(&e.getLeftExp());
if (pCall)
{
//x(?) = ?
InternalType *pOut = NULL;
/*getting what to assign*/
- InternalType* pITR = e.right_val_get();
+ InternalType* pITR = e.getRightVal();
if (pITR == NULL)
{
- e.right_exp_get().accept(*this);
- pITR = result_get();
+ e.getRightExp().accept(*this);
+ pITR = getResult();
//reset result
- result_set(NULL);
+ setResult(NULL);
}
if (pITR == NULL)
// if the right hand is NULL.
std::wostringstream os;
os << _W("Unable to extract right part expression.\n");
- throw ast::ScilabError(os.str(), 999, e.left_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getLeftExp().getLocation());
}
std::list<ExpHistory*> fields;
}
std::wostringstream os;
os << _W("Get fields from expression failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
pOut = evaluateFields(pCall, fields, pITR);
{
std::wostringstream os;
os << _W("Fields evaluation failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
- if (e.is_verbose() && ConfigVariable::isPromptShow())
+ if (e.isVerbose() && ConfigVariable::isPromptShow())
{
std::wostringstream ostr;
const wchar_t* wcsVarName;
- ostr << *getStructNameFromExp(&pCall->name_get()) << L" = " << std::endl;
- wcsVarName = getStructNameFromExp(&pCall->name_get())->c_str();
+ ostr << *getStructNameFromExp(&pCall->getName()) << L" = " << std::endl;
+ wcsVarName = getStructNameFromExp(&pCall->getName())->c_str();
ostr << std::endl;
scilabWriteW(ostr.str().c_str());
pITR->killMe();
- result_clear();
+ clearResult();
return;
}
- AssignListExp *pList = dynamic_cast<AssignListExp*>(&e.left_exp_get());
+ AssignListExp *pList = dynamic_cast<AssignListExp*>(&e.getLeftExp());
if (pList)
{
//[x,y] = ?
- int iLhsCount = (int)pList->exps_get().size();
+ int iLhsCount = (int)pList->getExps().size();
/*getting what to assign*/
T exec;
- exec.expected_setSize(iLhsCount);
- e.right_exp_get().accept(exec);
+ exec.setExpectedSize(iLhsCount);
+ e.getRightExp().accept(exec);
- if (exec.result_getSize() != iLhsCount)
+ if (exec.getResultSize() != iLhsCount)
{
std::wostringstream os;
- os << _W("Incompatible assignation: trying to assign ") << exec.result_getSize();
+ os << _W("Incompatible assignation: trying to assign ") << exec.getResultSize();
os << _W(" values in ") << iLhsCount << _W(" variables.") << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
std::list<Exp *>::const_reverse_iterator it;
int i = (int)iLhsCount - 1;
- for (it = pList->exps_get().rbegin() ; it != pList->exps_get().rend() ; it++, i--)
+ for (it = pList->getExps().rbegin() ; it != pList->getExps().rend() ; it++, i--)
{
//create a new AssignExp and run it
- types::InternalType* pIT = exec.result_get(i);
+ types::InternalType* pIT = exec.getResult(i);
//protect temporary result from delete
pIT->IncreaseRef();
- AssignExp pAssign((*it)->location_get(), *(*it), *const_cast<Exp*>(&e.right_exp_get()), pIT);
- pAssign.set_lr_owner(false);
- pAssign.set_verbose(e.is_verbose());
+ AssignExp pAssign((*it)->getLocation(), *(*it), *const_cast<Exp*>(&e.getRightExp()), pIT);
+ pAssign.setLrOwner(false);
+ pAssign.setVerbose(e.isVerbose());
pAssign.accept(*this);
//unprotect temporary result
pIT->DecreaseRef();
//clear result to take care of [n,n]
- exec.result_set(i, NULL);
+ exec.setResult(i, NULL);
}
- exec.result_clear();
+ exec.clearResult();
return;
}
- FieldExp *pField = dynamic_cast<FieldExp*>(&e.left_exp_get());
+ FieldExp *pField = dynamic_cast<FieldExp*>(&e.getLeftExp());
if (pField)
{
//a.b = x
//a.b can be a struct or a tlist/mlist or a handle
/*getting what to assign*/
- expected_setSize(1);
- e.right_exp_get().accept(*this);
- InternalType *pIT = result_get();
+ setExpectedSize(1);
+ e.getRightExp().accept(*this);
+ InternalType *pIT = getResult();
if (pIT->isImplicitList())
{
if (pIT->getAs<ImplicitList>()->isComputable())
{
InternalType *pTemp = pIT->getAs<ImplicitList>()->extractFullMatrix();
delete pIT;
- result_set(NULL);
+ setResult(NULL);
pIT = pTemp;
}
}
}
std::wostringstream os;
os << _W("Get fields from expression failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
if (evaluateFields(pField, fields, pIT) == NULL)
}
std::wostringstream os;
os << _W("Fields evaluation failed.");
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
for (std::list<ExpHistory*>::const_iterator i = fields.begin(), end = fields.end(); i != end; i++)
delete *i;
}
- if (e.is_verbose() && ConfigVariable::isPromptShow())
+ if (e.isVerbose() && ConfigVariable::isPromptShow())
{
const wstring *pstName = getStructNameFromExp(pField);
VariableToString(pPrint, pstName->c_str());
}
- result_clear();
+ clearResult();
return;
}
std::wostringstream os;
os << _W("unknow script form");
- //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_exp_get().location_get());
+ //os << ((Location)e.getRightExp().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRightExp().getLocation());
}
catch (ast::ScilabError error)
{
{
std::list<Exp *>::const_iterator itExp;
- e.name_get().accept(*this);
+ e.getName().accept(*this);
- if (result_get() != NULL && result_get()->isInvokable())
+ if (getResult() != NULL && getResult()->isInvokable())
{
//function call
- types::InternalType* pIT = result_get();
+ types::InternalType* pIT = getResult();
types::typed_list out;
types::typed_list in;
types::optional_list opt;
- int iRetCount = expected_getSize();
+ int iRetCount = getExpectedSize();
int iSaveExpectedSize = iRetCount;
// manage case [a,b]=foo() where foo is defined as a=foo()
if (pIT->getInvokeNbOut() != -1 && pIT->getInvokeNbOut() < iRetCount)
{
- result_clear();
+ clearResult();
std::wostringstream os;
os << _W("Wrong number of output arguments.\n") << std::endl;
- throw ast::ScilabError(os.str(), 999, e.location_get());
+ throw ast::ScilabError(os.str(), 999, e.getLocation());
}
//get function arguments
- for (itExp = e.args_get().begin (); itExp != e.args_get().end (); ++itExp)
+ for (itExp = e.getArgs().begin (); itExp != e.getArgs().end (); ++itExp)
{
- if ((*itExp)->is_assign_exp())
+ if ((*itExp)->isAssignExp())
{
AssignExp* pAssign = static_cast<AssignExp*>(*itExp);
//optional parameter
- Exp* pL = &pAssign->left_exp_get();
- if (!pL->is_simple_var())
+ Exp* pL = &pAssign->getLeftExp();
+ if (!pL->isSimpleVar())
{
- result_clear();
- clean_opt(opt);
- clean_in(in, out);
+ clearResult();
+ cleanOpt(opt);
+ cleanIn(in, out);
std::wostringstream os;
os << _W("left side of optional parameter must be a variable") << std::endl;
- throw ast::ScilabError(os.str(), 999, e.location_get());
+ throw ast::ScilabError(os.str(), 999, e.getLocation());
}
SimpleVar* pVar = static_cast<SimpleVar*>(pL);
- Exp* pR = &pAssign->right_exp_get();
+ Exp* pR = &pAssign->getRightExp();
pR->accept(*this);
- InternalType* pITR = result_get();
+ InternalType* pITR = getResult();
// IncreaseRef to protect opt argument of scope_end delete
// It will be deleted by clear_opt
pITR->IncreaseRef();
if (pIT->hasInvokeOption())
{
- opt.push_back(std::pair<std::wstring, InternalType*>(pVar->name_get().name_get(), pITR));
+ opt.push_back(std::pair<std::wstring, InternalType*>(pVar->getSymbol().getName(), pITR));
//in case of macro/macrofile, we have to shift input param
//so add NULL item in in list to keep initial order
if (pIT->isMacro() || pIT->isMacroFile())
in.push_back(pITR);
}
- result_clear();
+ clearResult();
continue;
}
- int iSize = expected_getSize();
- expected_setSize(-1);
+ int iSize = getExpectedSize();
+ setExpectedSize(-1);
(*itExp)->accept(*this);
- expected_setSize(iSize);
+ setExpectedSize(iSize);
- if (result_get() == NULL)
+ if (getResult() == NULL)
{
//special case for empty extraction of list ( list()(:) )
continue;
}
- InternalType * pITArg = result_get();
+ InternalType * pITArg = getResult();
if (pITArg->isImplicitList())
{
types::ImplicitList* pIL = pITArg->getAs<types::ImplicitList>();
if (pIL->isComputable())
{
- result_set(pIL->extractFullMatrix());
+ setResult(pIL->extractFullMatrix());
pITArg->killMe();
}
}
- if (is_single_result())
+ if (isSingleResult())
{
- in.push_back(result_get());
- result_get()->IncreaseRef();
- result_clear();
+ in.push_back(getResult());
+ getResult()->IncreaseRef();
+ clearResult();
}
else
{
- for (int i = 0 ; i < result_getSize() ; i++)
+ for (int i = 0 ; i < getResultSize() ; i++)
{
- InternalType * pITArg = result_get(i);
+ InternalType * pITArg = getResult(i);
pITArg->IncreaseRef();
in.push_back(pITArg);
}
- result_clear();
+ clearResult();
}
}
try
{
- expected_setSize(iSaveExpectedSize);
+ setExpectedSize(iSaveExpectedSize);
iRetCount = std::max(1, iRetCount);
if (pIT->invoke(in, opt, iRetCount, out, *this, e))
{
{
std::wostringstream os;
os << _W("bad lhs, expected : ") << iRetCount << _W(" returned : ") << out.size() << std::endl;
- throw ScilabError(os.str(), 999, e.location_get());
+ throw ScilabError(os.str(), 999, e.getLocation());
}
- expected_setSize(iSaveExpectedSize);
- result_set(out);
- clean_in(in, out);
- clean_opt(opt);
+ setExpectedSize(iSaveExpectedSize);
+ setResult(out);
+ cleanIn(in, out);
+ cleanOpt(opt);
- // In case a.b(), result_get contain pIT ("b").
+ // In case a.b(), getResult contain pIT ("b").
// If out == pIT, do not delete it.
- if (result_get() != pIT)
+ if (getResult() != pIT)
{
pIT->killMe();
}
{
std::wostringstream os;
os << _W("Invalid index.\n");
- throw ast::ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+ throw ast::ScilabError(os.str(), 999, (*e.getArgs().begin())->getLocation());
}
}
catch (ScilabMessage & sm)
{
- expected_setSize(iSaveExpectedSize);
- result_clear();
- clean_in_out(in, out);
- clean_opt(opt);
+ setExpectedSize(iSaveExpectedSize);
+ clearResult();
+ cleanInOut(in, out);
+ cleanOpt(opt);
pIT->killMe();
throw sm;
}
catch (InternalAbort & ia)
{
- expected_setSize(iSaveExpectedSize);
- result_clear();
- clean_in_out(in, out);
- clean_opt(opt);
+ setExpectedSize(iSaveExpectedSize);
+ clearResult();
+ cleanInOut(in, out);
+ cleanOpt(opt);
pIT->killMe();
throw ia;
}
catch (ScilabError & se)
{
- expected_setSize(iSaveExpectedSize);
- result_clear();
- clean_in_out(in, out);
- clean_opt(opt);
+ setExpectedSize(iSaveExpectedSize);
+ clearResult();
+ cleanInOut(in, out);
+ cleanOpt(opt);
pIT->killMe();
throw se;
{
//get head
T execMeCell;
- e.name_get().accept(execMeCell);
+ e.getName().accept(execMeCell);
- if (execMeCell.result_get() != NULL)
+ if (execMeCell.getResult() != NULL)
{
//a{xxx} with a variable, extraction
types::InternalType *pIT = NULL;
- pIT = execMeCell.result_get();
+ pIT = execMeCell.getResult();
if (pIT)
{
if (pIT->isCell() == false)
{
- throw ast::ScilabError(_W("[error] Cell contents reference from a non-cell array object.\n"), 999, (*e.args_get().begin())->location_get());
+ throw ast::ScilabError(_W("[error] Cell contents reference from a non-cell array object.\n"), 999, (*e.getArgs().begin())->getLocation());
}
//Create list of indexes
- types::typed_list *pArgs = GetArgumentList(e.args_get());
+ types::typed_list *pArgs = GetArgumentList(e.getArgs());
types::List* pList = pIT->getAs<types::Cell>()->extractCell(pArgs);
delete pArgs;
std::wostringstream os;
os << _W("inconsistent row/column dimensions\n");
- //os << ((*e.args_get().begin())->location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+ //os << ((*e.args_get().begin())->getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, (*e.getArgs().begin())->getLocation());
}
if (pList->getSize() == 1)
{
- result_set(pList->get(0));
+ setResult(pList->get(0));
}
else
{
- result_set(pList);
+ setResult(pList);
}
//clean pArgs return by GetArgumentList
InternalType *poResult = NULL;
list<InternalType*> rowList;
- if (e.lines_get().size() == 0)
+ if (e.getLines().size() == 0)
{
- result_set(Double::Empty());
+ setResult(Double::Empty());
return;
}
//do all [x,x]
- for (row = e.lines_get().begin() ; row != e.lines_get().end() ; row++)
+ for (row = e.getLines().begin() ; row != e.getLines().end() ; row++)
{
InternalType* poRow = NULL;
- for (col = (*row)->columns_get().begin() ; col != (*row)->columns_get().end() ; col++)
+ for (col = (*row)->getColumns().begin() ; col != (*row)->getColumns().end() ; col++)
{
- result_set(NULL); // Reset value on loop re-start
+ setResult(NULL); // Reset value on loop re-start
(*col)->accept(*this);
- InternalType *pIT = result_get();
+ InternalType *pIT = getResult();
if (pIT == NULL)
{
continue;
}
//reset result but whitout delete the value
- result_clear_except_first();
+ clearResultButFirst();
if (pIT->isImplicitList())
{
pIT->killMe();
std::wostringstream os;
os << _W("unable to concatenate\n");
- throw ast::ScilabError(os.str(), 999, (*col)->location_get());
+ throw ast::ScilabError(os.str(), 999, (*col)->getLocation());
}
GenericType* pGT = pIT->getAs<GenericType>();
}
std::wostringstream os;
os << _W("inconsistent row/column dimensions\n");
- throw ast::ScilabError(os.str(), 999, (*row)->location_get());
+ throw ast::ScilabError(os.str(), 999, (*row)->getLocation());
}
// if we concatenate [Double Sparse], transform the Double to Sparse and perform [Sparse Sparse]
}
std::wostringstream os;
os << _W("inconsistent row/column dimensions\n");
- throw ast::ScilabError(os.str(), 999, (*e.lines_get().begin())->location_get());
+ throw ast::ScilabError(os.str(), 999, (*e.getLines().begin())->getLocation());
}
// if we concatenate [Double Sparse], transform the Double to Sparse and perform [Sparse Sparse]
if (poResult)
{
- result_set(poResult);
+ setResult(poResult);
}
else
{
- result_set(Double::Empty());
+ setResult(Double::Empty());
}
}
catch (ast::ScilabError error)
if (Ret != Callable::OK)
{
- clean_in_out(in, out);
+ cleanInOut(in, out);
throw ScilabError();
}
- clean_in(in, out);
+ cleanIn(in, out);
if (out.empty())
{
try
{
/*getting what to assign*/
- e.left_get().accept(*this);
- if (is_single_result() == false)
+ e.getLeft().accept(*this);
+ if (isSingleResult() == false)
{
- result_clear();
+ clearResult();
std::wostringstream os;
os << _W("Incompatible output argument.\n");
- //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_get().location_get());
+ //os << ((Location)e.right_get().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRight().getLocation());
}
- pITL = result_get();
+ pITL = getResult();
/*getting what to assign*/
- e.right_get().accept(*this);
- if (is_single_result() == false)
+ e.getRight().accept(*this);
+ if (isSingleResult() == false)
{
- result_clear();
+ clearResult();
std::wostringstream os;
os << _W("Incompatible output argument.\n");
- //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_get().location_get());
+ //os << ((Location)e.right_get().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRight().getLocation());
}
- pITR = result_get();
+ pITR = getResult();
if (pITL->getType() == GenericType::ScilabImplicitList)
{
}
}
- switch (e.oper_get())
+ switch (e.getOper())
{
case OpExp::plus :
{
if (pResult == NULL)
{
// We did not have any algorithm matching, so we try to call OverLoad
- pResult = callOverloadOpExp(e.oper_get(), pITL, pITR);
+ pResult = callOverloadOpExp(e.getOper(), pITL, pITR);
}
- result_set(pResult);
+ setResult(pResult);
//clear left and/or right operands
if (pResult != pITL)
}
catch (ast::ScilabError & error)
{
- result_set(NULL);
+ setResult(NULL);
if (pResult)
{
pResult->killMe();
pITR->killMe();
}
- error.SetErrorLocation(e.location_get());
+ error.SetErrorLocation(e.getLocation());
throw error;
}
InternalType *pITR = NULL; //assign only in non shortcut operations.
/*getting what to assign*/
- e.left_get().accept(*this);
- InternalType *pITL = result_get();
- if (is_single_result() == false)
+ e.getLeft().accept(*this);
+ InternalType *pITL = getResult();
+ if (isSingleResult() == false)
{
std::wostringstream os;
os << _W("Incompatible output argument.\n");
- //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_get().location_get());
+ //os << ((Location)e.right_get().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRight().getLocation());
}
- result_set(NULL);
+ setResult(NULL);
if (pITL->getType() == GenericType::ScilabImplicitList)
{
InternalType *pResult = NULL;
- switch (e.oper_get())
+ switch (e.getOper())
{
case LogicalOpExp::logicalShortCutAnd :
{
case LogicalOpExp::logicalAnd :
{
/*getting what to assign*/
- e.right_get().accept(*this);
- pITR = result_get();
- if (is_single_result() == false)
+ e.getRight().accept(*this);
+ pITR = getResult();
+ if (isSingleResult() == false)
{
std::wostringstream os;
os << _W("Incompatible output argument.\n");
- //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_get().location_get());
+ //os << ((Location)e.right_get().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRight().getLocation());
}
if (pITR->getType() == GenericType::ScilabImplicitList)
case LogicalOpExp::logicalOr :
{
/*getting what to assign*/
- e.right_get().accept(*this);
- pITR = result_get();
- if (is_single_result() == false)
+ e.getRight().accept(*this);
+ pITR = getResult();
+ if (isSingleResult() == false)
{
std::wostringstream os;
os << _W("Incompatible output argument.\n");
- //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
- throw ast::ScilabError(os.str(), 999, e.right_get().location_get());
+ //os << ((Location)e.right_get().getLocation()).getLocationString() << std::endl;
+ throw ast::ScilabError(os.str(), 999, e.getRight().getLocation());
}
if (pITR->getType() == GenericType::ScilabImplicitList)
if (pResult == NULL)
{
// We did not have any algorithm matching, so we try to call OverLoad
- pResult = callOverloadOpExp(e.oper_get(), pITL, pITR);
+ pResult = callOverloadOpExp(e.getOper(), pITL, pITR);
}
- result_set(pResult);
+ setResult(pResult);
//clear left and/or right operands
pITL->killMe();
}
catch (ast::ScilabError error)
{
- result_clear();
- error.SetErrorLocation(e.location_get());
+ clearResult();
+ error.SetErrorLocation(e.getLocation());
throw error;
}
int iColMax = 0;
//check dimmension
- for (row = e.lines_get().begin() ; row != e.lines_get().end() ; ++row )
+ for (row = e.getLines().begin() ; row != e.getLines().end() ; ++row )
{
if (iColMax == 0)
{
- iColMax = static_cast<int>((*row)->columns_get().size());
+ iColMax = static_cast<int>((*row)->getColumns().size());
}
- if (iColMax != static_cast<int>((*row)->columns_get().size()))
+ if (iColMax != static_cast<int>((*row)->getColumns().size()))
{
std::wostringstream os;
os << _W("inconsistent row/column dimensions\n");
- //os << ((Location)(*row)->location_get()).location_getString() << std::endl;
- throw ScilabError(os.str(), 999, (*row)->location_get());
+ //os << ((Location)(*row)->getLocation()).getLocationString() << std::endl;
+ throw ScilabError(os.str(), 999, (*row)->getLocation());
}
}
//alloc result cell
- types::Cell *pC = new types::Cell(static_cast<int>(e.lines_get().size()), iColMax);
+ types::Cell *pC = new types::Cell(static_cast<int>(e.getLines().size()), iColMax);
int i = 0;
int j = 0;
//insert items in cell
- for (i = 0, row = e.lines_get().begin() ; row != e.lines_get().end() ; ++row, ++i)
+ for (i = 0, row = e.getLines().begin() ; row != e.getLines().end() ; ++row, ++i)
{
- for (j = 0, col = (*row)->columns_get().begin() ; col != (*row)->columns_get().end() ; ++col, ++j)
+ for (j = 0, col = (*row)->getColumns().begin() ; col != (*row)->getColumns().end() ; ++col, ++j)
{
(*col)->accept(*this);
- InternalType *pIT = result_get();
+ InternalType *pIT = getResult();
if (pIT->isImplicitList())
{
InternalType * _pIT = pIT->getAs<ImplicitList>()->extractFullMatrix();
{
pC->set(i, j, pIT);
}
- result_clear();
+ clearResult();
}
}
//return new cell
- result_set(pC);
+ setResult(pC);
}
template <class T>
a.b
*/
- if (!e.tail_get()->is_simple_var())
+ if (!e.getTail()->isSimpleVar())
{
wchar_t szError[bsiz];
os_swprintf(szError, bsiz, _W("/!\\ Unmanaged FieldExp.\n").c_str());
- throw ScilabError(szError, 999, e.location_get());
+ throw ScilabError(szError, 999, e.getLocation());
}
try
{
- e.head_get()->accept(*this);
+ e.getHead()->accept(*this);
}
catch (const ScilabError& error)
{
throw error;
}
- if (result_get() == NULL)
+ if (getResult() == NULL)
{
wchar_t szError[bsiz];
os_swprintf(szError, bsiz, _W("Attempt to reference field of non-structure array.\n").c_str());
- throw ScilabError(szError, 999, e.location_get());
+ throw ScilabError(szError, 999, e.getLocation());
}
// TODO: handle case where getSize() > 1
// l=list(struct("toto","coucou"),struct("toto","hello"),1,2);[a,b]=l(1:2).toto
//
- if (result_getSize() > 1)
+ if (getResultSize() > 1)
{
- result_clear();
+ clearResult();
wchar_t szError[bsiz];
os_swprintf(szError, bsiz, _W("Not yet implemented in Scilab.\n").c_str());
- throw ScilabError(szError, 999, e.location_get());
+ throw ScilabError(szError, 999, e.getLocation());
}
- SimpleVar * psvRightMember = static_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
- std::wstring wstField = psvRightMember->name_get().name_get();
- InternalType * pValue = result_get();
+ SimpleVar * psvRightMember = static_cast<SimpleVar *>(const_cast<Exp *>(e.getTail()));
+ std::wstring wstField = psvRightMember->getSymbol().getName();
+ InternalType * pValue = getResult();
InternalType * pReturn = NULL;
bool ok;
catch (std::wstring & err)
{
pValue->killMe();
- throw ScilabError(err.c_str(), 999, e.tail_get()->location_get());
+ throw ScilabError(err.c_str(), 999, e.getTail()->getLocation());
}
if (ok)
{
- result_set(pReturn);
+ setResult(pReturn);
}
else if (pValue->isFieldExtractionOverloadable())
{
if (Ret != Callable::OK)
{
- clean_in_out(in, out);
+ cleanInOut(in, out);
throw ScilabError();
}
- result_set(out);
- clean_in(in, out);
+ setResult(out);
+ cleanIn(in, out);
}
else
{
pValue->killMe();
wchar_t szError[bsiz];
os_swprintf(szError, bsiz, _W("Attempt to reference field of non-structure array.\n").c_str());
- throw ScilabError(szError, 999, e.location_get());
+ throw ScilabError(szError, 999, e.getLocation());
}
}
bool bTestStatus = false;
//condition
- e.test_get().accept(SCTest);
- e.test_get().accept(*this);
+ e.getTest().accept(SCTest);
+ e.getTest().accept(*this);
- bTestStatus = result_get()->isTrue();
- result_clear();
+ bTestStatus = getResult()->isTrue();
+ clearResult();
if (bTestStatus == true)
{
//condition == true
- if (e.is_breakable())
+ if (e.isBreakable())
{
- const_cast<IfExp*>(&e)->break_reset();
- const_cast<Exp*>(&e.then_get())->breakable_set();
+ const_cast<IfExp*>(&e)->resetBreak();
+ const_cast<Exp*>(&e.getThen())->setBreakable();
}
- if (e.is_continuable())
+ if (e.isContinuable())
{
- const_cast<IfExp*>(&e)->continue_reset();
- const_cast<Exp*>(&e.then_get())->continuable_set();
+ const_cast<IfExp*>(&e)->resetContinue();
+ const_cast<Exp*>(&e.getThen())->setContinuable();
}
- if (e.is_returnable())
+ if (e.isReturnable())
{
- const_cast<IfExp*>(&e)->return_reset();
- const_cast<Exp*>(&e.then_get())->returnable_set();
+ const_cast<IfExp*>(&e)->resetReturn();
+ const_cast<Exp*>(&e.getThen())->setReturnable();
}
- e.then_get().accept(*this);
+ e.getThen().accept(*this);
}
else
{
//condition == false
- if (e.has_else())
+ if (e.hasElse())
{
- if (e.is_breakable())
+ if (e.isBreakable())
{
- const_cast<Exp*>(&e.else_get())->breakable_set();
+ const_cast<Exp*>(&e.getElse())->setBreakable();
}
- if (e.is_continuable())
+ if (e.isContinuable())
{
- const_cast<IfExp*>(&e)->continue_reset();
- const_cast<Exp*>(&e.else_get())->continuable_set();
+ const_cast<IfExp*>(&e)->resetContinue();
+ const_cast<Exp*>(&e.getElse())->setContinuable();
}
- if (e.is_returnable())
+ if (e.isReturnable())
{
- const_cast<Exp*>(&e.else_get())->returnable_set();
+ const_cast<Exp*>(&e.getElse())->setReturnable();
}
- e.else_get().accept(*this);
+ e.getElse().accept(*this);
}
}
- if (e.is_breakable()
- && ( (&e.else_get())->is_break()
- || (&e.then_get())->is_break() ))
+ if (e.isBreakable()
+ && ( (&e.getElse())->isBreak()
+ || (&e.getThen())->isBreak() ))
{
- const_cast<IfExp*>(&e)->break_set();
- const_cast<Exp*>(&e.else_get())->break_reset();
- const_cast<Exp*>(&e.then_get())->break_reset();
+ const_cast<IfExp*>(&e)->setBreak();
+ const_cast<Exp*>(&e.getElse())->resetBreak();
+ const_cast<Exp*>(&e.getThen())->resetBreak();
}
- if (e.is_continuable()
- && ( (&e.else_get())->is_continue()
- || (&e.then_get())->is_continue() ))
+ if (e.isContinuable()
+ && ( (&e.getElse())->isContinue()
+ || (&e.getThen())->isContinue() ))
{
- const_cast<IfExp*>(&e)->continue_set();
- const_cast<Exp*>(&e.else_get())->continue_reset();
- const_cast<Exp*>(&e.then_get())->continue_reset();
+ const_cast<IfExp*>(&e)->setContinue();
+ const_cast<Exp*>(&e.getElse())->resetContinue();
+ const_cast<Exp*>(&e.getThen())->resetContinue();
}
- if (e.is_returnable()
- && ( (&e.else_get())->is_return()
- || (&e.then_get())->is_return() ))
+ if (e.isReturnable()
+ && ( (&e.getElse())->isReturn()
+ || (&e.getThen())->isReturn() ))
{
- const_cast<IfExp*>(&e)->return_set();
- const_cast<Exp*>(&e.else_get())->return_reset();
- const_cast<Exp*>(&e.then_get())->return_reset();
+ const_cast<IfExp*>(&e)->setReturn();
+ const_cast<Exp*>(&e.getElse())->resetReturn();
+ const_cast<Exp*>(&e.getThen())->resetReturn();
}
}
void RunVisitorT<T>::visitprivate(const WhileExp &e)
{
//allow break and continue operations
- const_cast<Exp*>(&e.body_get())->breakable_set();
- const_cast<Exp*>(&e.body_get())->continuable_set();
+ const_cast<Exp*>(&e.getBody())->setBreakable();
+ const_cast<Exp*>(&e.getBody())->setContinuable();
//allow return operation
- if (e.is_returnable())
+ if (e.isReturnable())
{
- (&e.body_get())->is_returnable();
+ (&e.getBody())->isReturnable();
}
//condition
- e.test_get().accept(*this);
- while (result_get()->isTrue())
+ e.getTest().accept(*this);
+ while (getResult()->isTrue())
{
- e.body_get().accept(*this);
- if (e.body_get().is_break())
+ e.getBody().accept(*this);
+ if (e.getBody().isBreak())
{
- const_cast<Exp*>(&(e.body_get()))->break_reset();
+ const_cast<Exp*>(&(e.getBody()))->resetBreak();
break;
}
- if (e.body_get().is_return())
+ if (e.getBody().isReturn())
{
- const_cast<WhileExp*>(&e)->return_set();
- const_cast<Exp*>(&(e.body_get()))->return_reset();
+ const_cast<WhileExp*>(&e)->setReturn();
+ const_cast<Exp*>(&(e.getBody()))->resetReturn();
break;
}
- if (e.body_get().is_continue())
+ if (e.getBody().isContinue())
{
- const_cast<WhileExp*>(&e)->continue_set();
- const_cast<Exp*>(&(e.body_get()))->continue_reset();
- e.test_get().accept(*this);
+ const_cast<WhileExp*>(&e)->setContinue();
+ const_cast<Exp*>(&(e.getBody()))->resetContinue();
+ e.getTest().accept(*this);
continue;
}
//clear old result value before evaluate new one
- if (result_get() != NULL)
+ if (getResult() != NULL)
{
- result_get()->killMe();
+ getResult()->killMe();
}
- e.test_get().accept(*this);
+ e.getTest().accept(*this);
}
//clear result of condition or result of body
- result_clear();
+ clearResult();
}
template <class T>
void RunVisitorT<T>::visitprivate(const ForExp &e)
{
- e.vardec_get().accept(*this);
- InternalType* pIT = result_get();
+ e.getVardec().accept(*this);
+ InternalType* pIT = getResult();
//allow break and continue operations
- const_cast<Exp&>(e.body_get()).breakable_set();
- const_cast<Exp&>(e.body_get()).continuable_set();
+ const_cast<Exp&>(e.getBody()).setBreakable();
+ const_cast<Exp&>(e.getBody()).setContinuable();
//allow return operation
- if (e.is_returnable())
+ if (e.isReturnable())
{
- e.body_get().is_returnable();
+ e.getBody().isReturnable();
}
- if (result_get()->isImplicitList())
+ if (getResult()->isImplicitList())
{
ImplicitList* pVar = pIT->getAs<ImplicitList>();
for (int i = 0; i < pVar->getSize(); ++i)
{
//TODO : maybe it would be interesting here to reuse the same InternalType (to avoid delete/new)
InternalType * pIL = pVar->extractValue(i);
- symbol::Context::getInstance()->put(e.vardec_get().stack_get(), pIL);
+ symbol::Context::getInstance()->put(e.getVardec().getStack(), pIL);
- e.body_get().accept(*this);
- if (e.body_get().is_break())
+ e.getBody().accept(*this);
+ if (e.getBody().isBreak())
{
- const_cast<Exp&>(e.body_get()).break_reset();
+ const_cast<Exp&>(e.getBody()).resetBreak();
break;
}
- if (e.body_get().is_continue())
+ if (e.getBody().isContinue())
{
- const_cast<Exp&>(e.body_get()).continue_reset();
+ const_cast<Exp&>(e.getBody()).resetContinue();
continue;
}
- if (e.body_get().is_return())
+ if (e.getBody().isReturn())
{
- const_cast<ForExp&>(e).return_set();
+ const_cast<ForExp&>(e).setReturn();
break;
}
}
}
- else if (result_get()->isList())
+ else if (getResult()->isList())
{
List* pL = pIT->getAs<List>();
const int size = pL->getSize();
for (int i = 0; i < size; ++i)
{
InternalType* pNew = pL->get(i);
- symbol::Context::getInstance()->put(e.vardec_get().stack_get(), pNew);
+ symbol::Context::getInstance()->put(e.getVardec().getStack(), pNew);
- e.body_get().accept(*this);
- if (e.body_get().is_break())
+ e.getBody().accept(*this);
+ if (e.getBody().isBreak())
{
- const_cast<Exp*>(&(e.body_get()))->break_reset();
+ const_cast<Exp*>(&(e.getBody()))->resetBreak();
break;
}
- if (e.body_get().is_continue())
+ if (e.getBody().isContinue())
{
- const_cast<Exp*>(&(e.body_get()))->continue_reset();
+ const_cast<Exp*>(&(e.getBody()))->resetContinue();
continue;
}
- if (e.body_get().is_return())
+ if (e.getBody().isReturn())
{
- const_cast<ForExp*>(&e)->return_set();
+ const_cast<ForExp*>(&e)->setReturn();
break;
}
}
pIT->DecreaseRef();
pIT->killMe();
- throw ScilabError(_W("for expression can only manage 1 or 2 dimensions variables\n"), 999, e.vardec_get().location_get());
+ throw ScilabError(_W("for expression can only manage 1 or 2 dimensions variables\n"), 999, e.getVardec().getLocation());
}
for (int i = 0; i < pVar->getCols(); i++)
{
GenericType* pNew = pVar->getColumnValues(i);
- symbol::Context::getInstance()->put(e.vardec_get().stack_get(), pNew);
+ symbol::Context::getInstance()->put(e.getVardec().getStack(), pNew);
- e.body_get().accept(*this);
- if (e.body_get().is_break())
+ e.getBody().accept(*this);
+ if (e.getBody().isBreak())
{
- const_cast<Exp*>(&(e.body_get()))->break_reset();
+ const_cast<Exp*>(&(e.getBody()))->resetBreak();
break;
}
- if (e.body_get().is_continue())
+ if (e.getBody().isContinue())
{
- const_cast<Exp*>(&(e.body_get()))->continue_reset();
+ const_cast<Exp*>(&(e.getBody()))->resetContinue();
continue;
}
- if (e.body_get().is_return())
+ if (e.getBody().isReturn())
{
- const_cast<ForExp*>(&e)->return_set();
+ const_cast<ForExp*>(&e)->setReturn();
break;
}
}
pIT->DecreaseRef();
pIT->killMe();
- result_set(NULL);
+ setResult(NULL);
}
template <class T>
void RunVisitorT<T>::visitprivate(const ReturnExp &e)
{
- if (e.is_global())
+ if (e.isGlobal())
{
//return or resume
if (ConfigVariable::getPauseLevel() != 0)
}
else
{
- const_cast<ReturnExp*>(&e)->return_set();
+ const_cast<ReturnExp*>(&e)->setReturn();
}
}
else
//return(x)
//in case of CallExp, we can return only one values
- int iSaveExpectedSize = expected_getSize();
- expected_setSize(1);
- e.exp_get().accept(*this);
- expected_setSize(iSaveExpectedSize);
+ int iSaveExpectedSize = getExpectedSize();
+ setExpectedSize(1);
+ e.getExp().accept(*this);
+ setExpectedSize(iSaveExpectedSize);
- if (result_getSize() == 1)
+ if (getResultSize() == 1)
{
//protect variable
- result_get()->IncreaseRef();
+ getResult()->IncreaseRef();
}
else
{
- for (int i = 0 ; i < result_getSize() ; i++)
+ for (int i = 0 ; i < getResultSize() ; i++)
{
//protect variable
- result_get(i)->IncreaseRef();
+ getResult(i)->IncreaseRef();
}
}
- if (result_getSize() == 1)
+ if (getResultSize() == 1)
{
//unprotect variable
- result_get()->DecreaseRef();
+ getResult()->DecreaseRef();
}
else
{
- for (int i = 0 ; i < result_getSize() ; i++)
+ for (int i = 0 ; i < getResultSize() ; i++)
{
//unprotect variable
- result_get(i)->DecreaseRef();
+ getResult(i)->DecreaseRef();
}
}
- const_cast<ReturnExp*>(&e)->return_set();
+ const_cast<ReturnExp*>(&e)->setReturn();
}
}
void RunVisitorT<T>::visitprivate(const SelectExp &e)
{
// FIXME : exec select ... case ... else ... end
- e.select_get()->accept(*this);
+ e.getSelect()->accept(*this);
bool bCase = false;
- InternalType* pIT = result_get();
- result_set(NULL);
+ InternalType* pIT = getResult();
+ setResult(NULL);
if (pIT)
{
//find good case
cases_t::iterator it;
- for (it = e.cases_get()->begin(); it != e.cases_get()->end() ; it++)
+ for (it = e.getCases()->begin(); it != e.getCases()->end() ; it++)
{
CaseExp* pCase = *it;
- pCase->test_get()->accept(*this);
- InternalType *pITCase = result_get();
- result_set(NULL);
+ pCase->getTest()->accept(*this);
+ InternalType *pITCase = getResult();
+ setResult(NULL);
if (pITCase)
{
if (pITCase->isContainer()) //WARNING ONLY FOR CELL
}
else if (*pITCase == *pIT)
{
- if (e.is_breakable())
+ if (e.isBreakable())
{
- const_cast<SelectExp*>(&e)->break_reset();
- pCase->body_get()->breakable_set();
+ const_cast<SelectExp*>(&e)->resetBreak();
+ pCase->getBody()->setBreakable();
}
- if (e.is_continuable())
+ if (e.isContinuable())
{
- const_cast<SelectExp*>(&e)->continue_reset();
- pCase->body_get()->continuable_set();
+ const_cast<SelectExp*>(&e)->resetContinue();
+ pCase->getBody()->setContinuable();
}
- if (e.is_returnable())
+ if (e.isReturnable())
{
- const_cast<SelectExp*>(&e)->return_reset();
- pCase->body_get()->returnable_set();
+ const_cast<SelectExp*>(&e)->resetReturn();
+ pCase->getBody()->setReturnable();
}
//the good one
- pCase->body_get()->accept(*this);
+ pCase->getBody()->accept(*this);
- if (e.is_breakable() && pCase->body_get()->is_break())
+ if (e.isBreakable() && pCase->getBody()->isBreak())
{
- const_cast<SelectExp*>(&e)->break_set();
- pCase->body_get()->break_reset();
+ const_cast<SelectExp*>(&e)->setBreak();
+ pCase->getBody()->resetBreak();
}
- if (e.is_continuable() && pCase->body_get()->is_continue())
+ if (e.isContinuable() && pCase->getBody()->isContinue())
{
- const_cast<SelectExp*>(&e)->continue_set();
- pCase->body_get()->continue_reset();
+ const_cast<SelectExp*>(&e)->setContinue();
+ pCase->getBody()->resetContinue();
}
- if (e.is_returnable() && pCase->body_get()->is_return())
+ if (e.isReturnable() && pCase->getBody()->isReturn())
{
- const_cast<SelectExp*>(&e)->return_set();
- pCase->body_get()->return_reset();
+ const_cast<SelectExp*>(&e)->setReturn();
+ pCase->getBody()->resetReturn();
}
bCase = true;
}
}
- if (bCase == false && e.default_case_get() != NULL)
+ if (bCase == false && e.getDefaultCase() != NULL)
{
- if (e.is_breakable())
+ if (e.isBreakable())
{
- const_cast<SelectExp*>(&e)->break_reset();
- e.default_case_get()->breakable_set();
+ const_cast<SelectExp*>(&e)->resetBreak();
+ e.getDefaultCase()->setBreakable();
}
- if (e.is_continuable())
+ if (e.isContinuable())
{
- const_cast<SelectExp*>(&e)->continue_reset();
- e.default_case_get()->continuable_set();
+ const_cast<SelectExp*>(&e)->resetContinue();
+ e.getDefaultCase()->setContinuable();
}
- if (e.is_returnable())
+ if (e.isReturnable())
{
- const_cast<SelectExp*>(&e)->return_reset();
- e.default_case_get()->returnable_set();
+ const_cast<SelectExp*>(&e)->resetReturn();
+ e.getDefaultCase()->setReturnable();
}
//default case
- e.default_case_get()->accept(*this);
+ e.getDefaultCase()->accept(*this);
- if (e.is_breakable() && e.default_case_get()->is_break())
+ if (e.isBreakable() && e.getDefaultCase()->isBreak())
{
- const_cast<SelectExp*>(&e)->break_set();
- e.default_case_get()->break_reset();
+ const_cast<SelectExp*>(&e)->setBreak();
+ e.getDefaultCase()->resetBreak();
}
- if (e.is_continuable() && e.default_case_get()->is_continue())
+ if (e.isContinuable() && e.getDefaultCase()->isContinue())
{
- const_cast<SelectExp*>(&e)->continue_set();
- e.default_case_get()->continue_reset();
+ const_cast<SelectExp*>(&e)->setContinue();
+ e.getDefaultCase()->resetContinue();
}
- if (e.is_returnable() && e.default_case_get()->is_return())
+ if (e.isReturnable() && e.getDefaultCase()->isReturn())
{
- const_cast<SelectExp*>(&e)->return_set();
- e.default_case_get()->return_reset();
+ const_cast<SelectExp*>(&e)->setReturn();
+ e.getDefaultCase()->resetReturn();
}
}
- result_clear();
+ clearResult();
}
template <class T>
//T execMe;
std::list<Exp *>::const_iterator itExp;
- for (itExp = e.exps_get().begin (); itExp != e.exps_get().end (); ++itExp)
+ for (itExp = e.getExps().begin (); itExp != e.getExps().end (); ++itExp)
{
- if (e.is_breakable())
+ if (e.isBreakable())
{
- (*itExp)->break_reset();
- (*itExp)->breakable_set();
+ (*itExp)->resetBreak();
+ (*itExp)->setBreakable();
}
- if (e.is_continuable())
+ if (e.isContinuable())
{
- (*itExp)->continue_reset();
- (*itExp)->continuable_set();
+ (*itExp)->resetContinue();
+ (*itExp)->setContinuable();
}
- if (e.is_returnable())
+ if (e.isReturnable())
{
- (*itExp)->returnable_set();
+ (*itExp)->setReturnable();
}
try
{
//reset default values
- result_set(NULL);
- expected_setSize(-1);
+ setResult(NULL);
+ setExpectedSize(-1);
(*itExp)->accept(*this);
- InternalType * pIT = result_get();
+ InternalType * pIT = getResult();
if (pIT != NULL)
{
&nb