|
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 COREINTERFACE_H 00047 #define COREINTERFACE_H 00048 00049 #include <QObject> 00050 00051 #include <QSettings> 00052 #include <QStringList> 00053 00054 #include "defines.h" 00055 00056 #include "parser/parser_types.h" 00057 00058 #include "symboltable.h" 00059 #include "step/step.h" 00060 00061 /* 00062 Para el guardado del estado del programa (variables y estados de los steps) 00063 sera necesario verificar que el programa cargado coincide con aquel cuyo 00064 estado se guardo. Para ello lo mas preciso sera calcular el HASH MD5 de todos 00065 los tokens durante el parsing y mantenerlo para verificacion y/o guardado. 00066 Una forma simple de hacer esto parece ser utilizar un objeto de la clase 00067 QCryptographicHash. 00068 */ 00069 00070 class CoreInterface : public QObject 00071 { 00072 Q_OBJECT 00073 public: 00076 T_STRING getLicense() { return T_STRING( tr(LICENSE) ) ; } 00077 00080 T_STRING getURL() { return T_STRING( tr(PROGRAM_URL) ) ; } 00081 00084 T_STRING getVersion() { return T_STRING( tr(PROGRAM_VERSION) ) ; } 00085 00086 00090 SymbolTable* beginEnviroment () ; 00091 00094 SymbolTable* getCurrentEnviroment () ; 00095 00100 SymbolTable* endCurrentEnviroment () ; 00101 00103 CoreFunctionsBuilder* getCoreFunctions () { return ( coreFunctions ) ; } 00104 00109 bool markFile ( T_STRING &fullFileName ) ; 00110 00112 QStringList getModulesDirs () ; 00113 00117 T_HASH_CALC* getHashCalculator () ; 00118 00119 /* Constructors */ 00120 CoreInterface() ; 00121 ~CoreInterface() ; 00122 00123 /* It's a temporal variable needed by 'yyscan()' */ 00124 Step* actualProcesingStep ; 00125 00126 public slots: 00127 void notifyStepCreated ( Step* newStep ) ; 00128 00130 void notifyMessage ( int severity , T_STRING msg ) ; 00131 void yyerror ( int severity , yyscan_t scanner , T_STRING msg ) ; 00132 00133 void loadFile ( T_STRING &fullFileName ) ; 00134 void clear () ; 00135 00136 signals: 00137 void stepCreated( Step* newStep ) ; 00138 void coreMessage ( QString msg , int severity ) ; 00139 00140 protected: 00141 SymbolTable* st ; 00142 T_ST_LIST stList ; 00143 CoreFunctionsBuilder* coreFunctions ; 00144 00145 /* Here we will keep a track of files that we have loaded, and don't try to 00146 * load these again 00147 */ 00148 QStringList markedFiles ; 00149 00151 T_STRING loadedProgramFile ; 00152 00153 /* Settings Manager */ 00154 QSettings *settings ; 00155 00156 /* ProgramID Calculator */ 00157 T_HASH_CALC *hashCalc ; 00158 }; 00159 00160 #endif // COREINTERFACE_H