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 "emptycondexpression.h"
00036
00037 EmptyCondExpression::EmptyCondExpression(VarExpression * _var):
00038 CondExpression(ect_empty), var(_var), varstep(NULL), ncond(NULL) {
00039 }
00040
00041 EmptyCondExpression::EmptyCondExpression(VarStepExpression * _varstep):
00042 CondExpression(ect_empty), var(NULL), varstep(_varstep), ncond(NULL) {
00043 }
00044
00045 EmptyCondExpression::~EmptyCondExpression() {
00046 delete ncond;
00047 }
00048
00049 void EmptyCondExpression::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 EmptyCondExpression::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 EmptyCondExpression::extractFSAMap(FSAMap * fsamap, unsigned parent_var) {
00068 ncond->extractFSAMap(fsamap, parent_var);
00069 }
00070
00071 void EmptyCondExpression::extractParVarMap(ParVarMap * parvarmap) {
00072 ncond->extractParVarMap(parvarmap);
00073 }
00074
00075 void EmptyCondExpression::extractDependencies(vector < DependencySet * >*depset) {
00076 ncond->extractDependencies(depset);
00077 }
00078
00079 Expression *EmptyCondExpression::placeSignOffs(vector <
00080 SignOffExpression * >&signoffs) {
00081 ncond = (NotCondExpression *) ncond->placeSignOffs(signoffs);
00082
00083 return this;
00084 }
00085
00086 void EmptyCondExpression::rewriteEmptyFuncts() {
00087 if (var) {
00088 ncond = new NotCondExpression(new ExistsCondExpression(var));
00089 } else {
00090 ncond = new NotCondExpression(new ExistsCondExpression(varstep));
00091 }
00092 setType(ect_not);
00093 }
00094
00095 void EmptyCondExpression::rewriteAggregateFuncts() {
00096 ncond->rewriteAggregateFuncts();
00097 }
00098
00099 void EmptyCondExpression::print(OutputStream & dos) const {
00100 if (ncond) {
00101 dos << (*ncond);
00102 } else {
00103 if (var) {
00104 dos << "fn:empty(" << (*var) << ")";
00105 } else {
00106 dos << "fn:empty(" << (*varstep) << ")";
00107 }
00108 }
00109 }
00110
00111 void EmptyCondExpression::init(BufferNode * root) {
00112 ncond->init(root);
00113 }
00114
00115 void EmptyCondExpression::eval(OutputStream & eos, Environment * env,
00116 unsigned modus) {
00117 ncond->eval(eos, env, modus);
00118 }
00119
00120 bool EmptyCondExpression::evalCond(OutputStream & eos, Environment * env,
00121 unsigned modus) {
00122 return ncond->evalCond(eos, env, modus);
00123 }