00001 #include "text.h" 00002 #include "image.h" 00003 #include "runtime.h" 00004 #include "point.h" 00005 00009 Value * Runtime::neg(Value * a) 00010 { 00011 if (!a) return NULL; 00012 if (typeid(*a)==typeid(TextValue)) 00013 { 00014 TextValue * A = (TextValue*)a; 00015 return new TextValue(-A->number()); 00016 } 00017 if (typeid(*a)==typeid(ImageValue)) 00018 { 00019 ImageValue * A = (ImageValue*)a; 00020 ImageValue * R = A->deepCopy(); 00021 R->negate(); 00022 return R; 00023 } 00024 if (typeid(*a)==typeid(PointValue)) 00025 { 00026 PointValue * A = (PointValue*)a; 00027 PointValue * R = new PointValue(); 00028 R->x=-A->x; 00029 R->y=-A->y; 00030 return R; 00031 } 00032 assert(0); 00033 }