|
Hormiga 1.0
|
00001 00002 /* 00003 # Hormiga - Software de cálculo programable. 00004 # 00005 # Copyright (C) 2008, 2009 Leonardo Román, Hugo J. Curti, Norma Ercoli, 00006 # Universidad Nacional del Centro de la Provincia de Buenos Aires 00007 # (UNCPBA) 00008 # 00009 # Este programa es parte de Hormiga. 00010 # 00011 # Hormiga es software libre. Puede redistribuirlo y/o modificarlo 00012 # bajo los términos de la Licencia Pública General de GNU según es 00013 # publicada por la Free Software Foundation, versión 2. Vea el archivo 00014 # COPIA (español, no oficial) o COPYING (inglés, oficial) en directorio 00015 # raíz. 00016 # 00017 # Hormiga se distribuye con la esperanza de que sea útil, pero SIN 00018 # NINGUNA GARANTÍA, incluso sin la garantía MERCANTIL implícita o sin 00019 # garantizar la CONVENIENCIA PARA UN PROPÓSITO PARTICULAR. Véase la 00020 # Licencia Pública General de GNU para más detalles. 00021 # 00022 # Debería haber recibido una copia de la Licencia Pública General junto 00023 # con Hormiga. Si no ha sido así, escriba a la Free Software 00024 # Foundation, Inc., en 675 Mass Ave, Cambridge, MA 02139, EEUU. 00025 # Añada también información sobre cómo contactar con usted mediante 00026 # correo electrónico y postal. 00027 # 00028 # This file is part of Hormiga. 00029 # 00030 # Hormiga is free software; you can redistribute it and/or modify 00031 # it under the terms of the GNU General Public License version 2 00032 # as published by the Free Software Foundation; see the file COPYING 00033 # in the top directory for details. 00034 # 00035 # Hormiga is distributed in the hope that it will be useful, 00036 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00037 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00038 # GNU General Public License for more details. 00039 # 00040 # You should have received a copy of the GNU General Public License 00041 # along with Hormiga; if not, write to the Free Software 00042 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00043 # USA 00044 */ 00045 00046 #ifndef STATEMENT_H 00047 #define STATEMENT_H 00048 00049 #include "statement/statement_interface.h" 00050 00051 #include "defines.h" 00052 #include "oper/operand.h" 00053 00054 class OperatorAsig : public BinaryOperator , public Statement 00055 { 00056 public: 00057 virtual T_STRING getSymbol () const ; 00058 virtual T_MAGNITUDE getValue() const ; 00059 virtual T_STRING toString() const ; 00060 virtual bool exec () ; 00061 // Here we only accept a 'variable' as op1: 00062 OperatorAsig ( Operand *op1 , Operand *op2 ) ; 00063 protected: 00064 static T_STRING symbol ; 00065 Seteable *sop ; 00066 }; 00067 00068 00072 class Statements : public Statement 00073 { 00074 public: 00075 virtual bool exec () ; 00076 virtual T_STRING toString() const ; 00077 Statements ( T_STMT_BLOCK *block ) ; 00078 virtual ~Statements () ; 00079 virtual T_STMT_BLOCK* getStatements () { return ( block ) ; } 00080 virtual void append ( Statement *s ) { this->block->append (s) ; } 00081 protected: 00082 T_STMT_BLOCK *block ; 00083 }; 00084 00085 class For : public Statement 00086 { 00087 public: 00088 virtual bool exec () ; 00089 virtual T_STRING toString() const ; 00090 For ( VarValue* var , Sequence *interval , Statement *block ) ; 00091 virtual ~For () ; 00092 protected: 00093 Statement *block ; 00094 Sequence *interval ; 00095 VarValue* var ; 00096 }; 00097 00098 class If : public Statement 00099 { 00100 public: 00101 virtual bool exec () ; 00102 virtual T_STRING toString() const ; 00103 If ( Operand* condition , Statement *blockTrue , Statement *blockFalse ) ; 00104 virtual ~If () ; 00105 protected: 00106 Operand* condition ; 00107 Statement *blockTrue ; 00108 Statement *blockFalse ; 00109 }; 00110 00111 class While : public Statement 00112 { 00113 public: 00114 virtual bool exec () ; 00115 virtual T_STRING toString() const ; 00116 While ( Operand* condition , Statement *blockTrue ) ; 00117 virtual ~While () ; 00118 protected: 00119 Operand* condition ; 00120 Statement *blockTrue ; 00121 }; 00122 00123 #endif // STATEMENT_H