00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00035 #include "varstepcondexpression.h"
00036
00037 VarstepCondExpression::VarstepCondExpression(VarExpression * _var):
00038 CondExpression(ect_varstep), var(_var), varstep(NULL), econd(NULL) {
00039 }
00040
00041 VarstepCondExpression::VarstepCondExpression(VarStepExpression * _varstep):
00042 CondExpression(ect_varstep), var(NULL), varstep(_varstep), econd(NULL) {
00043 }
00044
00045 VarstepCondExpression::~VarstepCondExpression() {
00046 delete econd;
00047 }
00048
00049 void VarstepCondExpression::scopeCheck(vector < unsigned >&def_vars,
00050 vector < unsigned >&introduced_vars,
00051 vector < unsigned >&violating_vars) {
00052 if (var) {
00053 var->scopeCheck(def_vars, introduced_vars, violating_vars);
00054 } else {
00055 varstep->scopeCheck(def_vars, introduced_vars, violating_vars);
00056 }
00057 }
00058
00059 void VarstepCondExpression::replaceVarId(unsigned old_id, unsigned new_id) {
00060 if (var) {
00061 var->replaceVarId(old_id, new_id);
00062 } else {
00063 varstep->replaceVarId(old_id, new_id);
00064 }
00065 }
00066
00067 void VarstepCondExpression::extractDependencies(vector <
00068 DependencySet * >*depset) {
00069 econd->extractDependencies(depset);
00070 }
00071
00072 void VarstepCondExpression::rewriteVarstepCondExps() {
00073 econd =
00074 var ? new ExistsCondExpression(var) : new ExistsCondExpression(varstep);
00075 setType(ect_exists);
00076 }
00077
00078 void VarstepCondExpression::print(OutputStream & dos) const {
00079 if (econd) {
00080 dos << (*econd);
00081 } else if (var) {
00082 dos << (*var);
00083 } else {
00084 dos << (*varstep);
00085 }
00086 }
00087
00088 void VarstepCondExpression::init(BufferNode * root) {
00089 econd->init(root);
00090 }
00091
00092 bool VarstepCondExpression::evalCond(OutputStream & eos, Environment * env,
00093 unsigned modus) {
00094 return econd->evalCond(eos, env, modus);
00095 }