Changeset 391 for trunk/yao


Ignore:
Timestamp:
07/31/10 21:19:33 (14 years ago)
Author:
yerima
Message:

Uploading an existing project is possible with defval and hatname's directive. We are going to manage the saving and the saving_as control this week-end.

Location:
trunk/yao/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/yao/src/Translator.cpp

    r323 r391  
    6868 */ 
    6969void Translator::generateCode(){ 
    70   this->description(); // Description analysis. 
     70  this->descriptionVisualYAO(); // Description analysis. 
    7171 
    7272  if(theDisplay.isHelp()) // Display the help menu if requested in the description file. 
  • trunk/yao/src/interface/Makefile

    r390 r391  
    1212CXX           = g++ 
    1313DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
    14 CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) 
    15 CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) 
    16 INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -Isrc/include -I. -I../../share/boost_1_39_0/ -I. 
     14ANTLRDIR      = ../../share/antlr-2.7.7/lib/cpp/ 
     15CFLAGS        = #-pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) 
     16CXXFLAGS      = -I$(ANTLRDIR)#-pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) 
     17INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc/include -I. -I../../share/boost_1_39_0 $(CXXFLAGS) 
    1718LINK          = g++ 
    18 LFLAGS        = -Wl,-O1 
    19 LIBS          = $(SUBLIBS)  -L/usr/lib -lQtGui -lQtCore -lpthread  
     19LFLAGS        = -Wl,-O1 #-L$(ANTLRDIR)src -lantlr   
     20LIBS          = $(SUBLIBS)  -L/usr/lib -lQtGui -lQtCore -lpthread -L../../share/antlr-2.7.7/lib/cpp/src -lantlr 
    2021AR            = ar cqs 
    2122RANLIB        =  
  • trunk/yao/src/interface/src/ConnectionWindow.cpp

    r381 r391  
    4848                         
    4949                        m_ctinModulInCombo->insertItem(1, QString(it->getName().c_str())); 
    50                         m_ctinModulOutCombo->insertItem(1, QString(it->getName().c_str()));  
     50                        //m_ctinModulOutCombo->insertItem(1, QString(it->getName().c_str()));  
    5151                        //m_ctinModel->setItem(row, 0, new QStandardItem(QString(it->getName().c_str()))); /*!< Gets the name.*/ 
    5252                        //m_ctinModel->setItem(row, 1, new QStandardItem(QString(it->getSpaceOrOperator().c_str())));  
  • trunk/yao/src/interface/src/ConstantWindow.cpp

    r389 r391  
    11//! \file    ConstantWindow.cpp 
    22//! \brief   Implementation of the Constant window for visual_YAO. 
    3 //! \version 2010/05/12 (yyyy/mm/dd) 
     3//! \version 2010/07/30 (yyyy/mm/dd) 
    44//! \author  MAYAKI Abdouramane & MAYOMBO Alexis. 
    55 
     
    191191        if (!(m_ligneNom->text().isEmpty()) && !(m_ligneValeur->text().isEmpty())) { //When the two QLineEdit content data, show a confirmation box.     
    192192         
    193         int ret = QMessageBox::warning(this, tr("Confirmation de fermeture"), tr("Voulez-vous vraiment quitter?"), 
     193        int ret = QMessageBox::warning(this, tr("Confirmation de fermeture"), tr("Voulez-vous quitter sans sauvegarder les données contenues dans les champs?"), 
    194194                          QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape); 
    195195         
  • trunk/yao/src/interface/src/MainWindow.cpp

    r389 r391  
    1717//using namespace antlr; 
    1818using namespace std; 
     19using namespace antlr; 
    1920using namespace yao; 
    2021 
     
    3536*/ 
    3637 
    37 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_constantWindow(NULL), m_hatnameWindow(NULL), m_contextWindow(NULL), m_trajectoryWindow(NULL), m_spaceWindow(NULL), m_operaWindow(NULL), m_netwardWindow(NULL), m_modulWindow(NULL), m_ctinWindow(NULL), m_orderWindow(NULL), m_insertFCTWindow(NULL), m_newProjectWindow(NULL), m_newProjectName("")    
     38MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_constantWindow(NULL), m_hatnameWindow(NULL), m_contextWindow(NULL), m_trajectoryWindow(NULL), m_spaceWindow(NULL), m_operaWindow(NULL), m_netwardWindow(NULL), m_modulWindow(NULL), m_ctinWindow(NULL), m_orderWindow(NULL), m_insertFCTWindow(NULL), m_newProjectWindow(NULL), m_newProjectName(""), theConstantTablePt(theConstantTable)     
    3839{ 
    3940 
     
    7475                 
    7576         
     77} 
     78 
     79/******************************************* Implementation of the method setTitle() *****************************************************************/ 
     80MainWindow::MainWindow(Table <Constant> aConstantTable): theConstantTablePt(aConstantTable) 
     81{ 
     82        theConstantTablePt = aConstantTable; 
     83        //theConstantTable;                      
    7684} 
    7785 
     
    223231 
    224232/********************************* Implementation of the method Implémentation de la methode createToolBar() ****************************************/ 
    225  
    226233void MainWindow::createToolBar() { 
    227234 
     
    245252 
    246253/******************************** Implementation of the method Implémentation de la methode cacherBarreOutils() ***************************************/ 
    247  
    248254void MainWindow::cacherBarreOutils() { 
    249255 
     
    252258 
    253259} 
     260 
    254261/********************************** Implementation of the method Implementation de la methode toolBarActions() ****************************************/ 
    255262void MainWindow::toolBarActions(QWorkspace &espace)  
     
    297304        desactivateToolBarButtons(); // Désactive tous les boutons de la barre d'outils 
    298305} 
     306 
    299307/*********************************************** Implementation of the method createDefvalWindow() *************************************************/ 
    300308void MainWindow::createDefvalWindow()  
     
    314322 
    315323} 
     324 
    316325/******************************************** Implementation of the method createHatNameWindow() ***************************************************/ 
    317326void MainWindow::createHatNameWindow() { 
     
    326335        connect(m_hatnameWindow, SIGNAL(hatWindowIsClosed(int)), this, SLOT(initializeWindow(int)));// The signal is in the HatNameWindow.hpp file. 
    327336} 
     337 
    328338/********************************************* Implementation of the method createContextWindow() *************************************************/ 
    329339void MainWindow::createContextWindow() { 
     
    338348        connect(m_contextWindow, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    339349} 
     350 
    340351/********************************************* Implementation of the method createTrajectoryWindow() ************************************************/ 
    341352void MainWindow::createTrajectoryWindow() { 
     
    353364        connect(m_trajectoryWindow, SIGNAL(trajRowIsAdded(bool)), m_operaButton, SLOT(setEnabled(bool))); 
    354365} 
     366 
    355367/********************************************* Implementation of the method createSpaceWindow() ************************************************/ 
    356368void MainWindow::createSpaceWindow() { 
     
    392404 
    393405} 
     406 
    394407/********************************************* Implementation of the method createModulWindow() ************************************************/ 
    395408void MainWindow::createModulWindow() { 
     
    402415 
    403416        connect(m_modulWindow, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    404  
    405417} 
    406418 
     
    418430 
    419431} 
     432 
    420433/********************************************* Implementation of the method createOrderWindow() ************************************************/ 
    421434void MainWindow::createOrderWindow() { 
     
    430443 
    431444} 
     445 
    432446/********************************************* Implementation of the method createInsertFCTWindow() ************************************************/ 
    433447void MainWindow::createInsertFCTWindow() { 
     
    443457 
    444458} 
     459 
    445460/********************************************* Implementation of the method directivesManage() *****************************************************/ 
    446461void MainWindow::directivesManager() { 
     
    464479        m_orderButton->setEnabled(true); 
    465480        m_insertFCTButton->setEnabled(true); 
    466  
    467 } 
     481} 
     482 
    468483/********************************** Implementation of the method desactivateToolBarButtons() *******************************************************/ 
    469484void MainWindow::desactivateToolBarButtons() { 
     
    526541 //     exitStatus = EXIT_SUCCESS; 
    527542      //cout << "End application" << endl; 
    528    
     543        QFileDialog *dialogue = new QFileDialog(this); //Crée une boite de dialogue 
     544 
     545        QString cheminFichier = dialogue->getOpenFileName(this, tr("Ouverture d'un project existant."), QDir::homePath(), tr("*.d *.i *.txt")); //Retourne le chemin du fichier. 
     546  
    529547//      translator.theConstantTable; 
    530548        //m_ConstantCopy = new ConstantWindow(&theConstantTable, &theHeaderList);  
     
    536554   
    537555         // translator.theConstantTable; 
    538          
    539  
    540         QFileDialog *dialogue = new QFileDialog(this); //Crée une boite de dialogue 
    541  
    542         QString cheminFichier = dialogue->getOpenFileName(this, tr("Ouverture d'un project existant."), QDir::homePath(), tr("*.d *.i *.txt")); //Retourne le chemin du fichier. 
     556 
     557        QProcess builder; 
     558 
     559        builder.setProcessChannelMode(QProcess::MergedChannels); 
     560        builder.start("Yao9Generator " + cheminFichier);//, QStringList() 
     561// <<"-e" 
     562// <<"/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf" 
     563 
     564// ); 
     565//char *test2[]; 
     566//QDebug ( QString * string ) 
     567 if (!builder.waitForFinished()) 
     568     qDebug() << "Make failed:" << builder.errorString(); 
     569 else 
     570     //qDebug << "Make output:" << builder.readAll(); 
     571        { 
     572                QString test(builder.readAll()); 
     573                //for (int i = 0; i <= test.size(); i++) 
     574                //      { 
     575                //              if (test.at(i) == ' ') 
     576                                         
     577                //      } 
     578 
     579                istringstream iss(test.toStdString()); 
     580                 
     581                FilePath mot; 
     582                FilePath name; 
     583                while ( getline(iss, mot, '\n' ) ) 
     584                        { 
     585                                 
     586                                if (mot.getExtension() == ".def1") 
     587                                {                        
     588                                        //cout << mot.getTitle() << endl; 
     589                                        name = mot; 
     590                                } 
     591                                if (mot.getExtension() == ".def2" && name.getExtension() == ".def1") 
     592                                { 
     593                                        Constant aConstant(name.getTitle(), mot.getTitle());     
     594                                        theConstantTable.push_back(aConstant); 
     595                                         
     596                                } 
     597                                if (mot.getExtension() == ".h") 
     598                                { 
     599                                        cout << mot << endl; 
     600                                        theHeaderList.push_back(mot);    
     601                                         
     602                                }               //theConstantTable.push_back(mot.getTitle()); 
     603                         
     604                        } 
     605        activateToolBarButtons(); 
     606         
     607                //cout << "Voici le resulat: " << test.toStdString() << endl; 
     608        } 
     609         
     610        //Tokenizer tokenizer("test_00.d");//cheminFichier.toStdString()); 
     611        //Translator translator(tokenizer); 
     612        //translator.descriptionVisualYAO(); 
     613        //translator.theConstantTable; 
     614        //for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 
     615        //      cout << it->getName() << " " << it->getText() << endl; 
     616        //string test << qDebug(); 
     617 
     618        /*QProcess process; 
     619         
     620        process.start( "sudo ", QStringList()  
     621        << "-S"  
     622        << "-p" << "password:\n"  
     623        << "gnome-terminal" ); 
     624*/ 
     625        //string test = "Yao9Generator " + cheminFichier.toStdString();  
     626        //system(test.c_str());// "Yao9Generator projects/test_04/test_04.d");   
     627 
     628         
     629         
     630 
    543631        //QMessageBox::about(this, "test", "Ouverture un projet existant."); 
    544632} 
     633 
    545634/**************************************** Implementation of the method hatUpdate() ****************************************************************/ 
    546635void MainWindow::hatUpdate() { 
     
    580669                return; 
    581670} 
     671 
    582672/******************************************* Implementation of the method contextUpdate(QString choix) ************************************************/ 
    583673void MainWindow::contextUpdate() { 
     
    598688                return; 
    599689} 
     690 
    600691/***************************************** Implementation of the method montrerActionGenererD() ****************************************************/ 
    601  
    602692void MainWindow::montrerActionGenererD() { 
    603693 
     
    610700        actionCompilation->setEnabled(true); 
    611701} 
     702  
    612703/************************************************* Implementation of the method setProjectName(string chaine) **************************************/ 
    613704void MainWindow::setProjectName(string chaine) { 
     
    623714 
    624715/************************************* Implementation of the method setProjectPath(string aPath) ******************************************/ 
    625   
    626716void MainWindow::setProjectPath(string aPath) { 
    627717  
  • trunk/yao/src/interface/src/ModulWindow.cpp

    r389 r391  
    11//! \file    ModulWindow.cpp 
    22//! \brief   Implementation of the Modul window for visual_YAO. 
    3 //! \version 2010/07/05 (yyyy/mm/dd) 
     3//! \version 2010/07/30 (yyyy/mm/dd) 
    44//! \author  MAYAKI Abdouramane. 
    55 
     
    184184 
    185185                } 
    186         if (!(!target.empty() && output.empty())) { 
    187                                 QMessageBox::critical(this, "Erreur", "Si target est défini, output doit-être obligatoirement renseigné."); 
    188                                 return; // Arrêt de la méthode 
    189                         } 
     186        //if (!(!target.empty() && output.empty())) { 
     187        //                      QMessageBox::critical(this, "Erreur", "Si target est défini, output doit-être obligatoirement renseigné."); 
     188        //                      return; // Arrêt de la méthode 
     189        //              } 
    190190 
    191191        if (!modulName.empty() && !modulParent.empty())  
     
    213213                                m_modulModel->setItem(row, 7, new QStandardItem("non")); 
    214214                                m_modulModel->setItem(row, 8, new QStandardItem("non")); 
    215                         }        
     215                                 
     216                        } 
     217                else 
     218                        { 
     219                                QMessageBox::about(this, "Avis", "Un fichier .h portant le nom du module vient d'etre cree."); 
     220                                 //return; // Arrêt de la méthode 
     221 
     222                        } 
    216223                //bool aBool = m_modulSpaceRadioButton->isChecked()? true: false; 
    217224 
  • trunk/yao/src/interface/src/include/MainWindow.hpp

    r387 r391  
    55#include <exception> 
    66#include <cstdlib> 
     7#include <sstream> 
    78 
    89#include <iostream> 
    910#include "../../../help/FilePath.hpp" 
    10 //#include "../../../Translator.hpp" 
    11 //#include "../../../analyzers/BaseLexer.hpp" 
     11#include "../../../Translator.hpp" 
     12#include "../../../Tokenizer.hpp" 
     13#include "../../../analyzers/BaseParser.hpp" 
     14//#include "../../../analyzers/grammar.g" 
    1215#include "../../../help/Display.hpp" 
    13 //#include <antlr/TokenStreamRecognitionException.hpp> 
     16#include <antlr/TokenStreamRecognitionException.hpp> 
    1417 
    1518  
     
    6063 
    6164                        MainWindow(QWidget *parent = 0); 
     65                        MainWindow(yao::Table <yao::Constant> aConstantTable); 
    6266                         
    6367                        void toolBarActions(QWorkspace &espace); 
     
    246250                        yao::Constant m_theConstant; 
    247251                        yao::Table <yao::Constant> theConstantTable;                     
     252                        yao::Table <yao::Constant> &theConstantTablePt;                  
     253                         
    248254                        std::vector <string> theHeaderList; 
    249255                        yao::Context theContext; 
  • trunk/yao/src/interface/src/include/ModulWindow.hpp

    r389 r391  
    1616#include "../../ui_modulwindow.h" 
    1717 
     18//#include "../../../help/FilePath.hpp" 
     19//#include "../../../Translator.hpp" 
     20//#include "../../../Tokenizer.hpp" 
     21 
     22//#include "../../../analyzers/grammar.g" 
    1823 
    1924class ModulWindow: public QWidget, public Ui::ModulWindow/*, public yao::Modul*/ { 
  • trunk/yao/src/interface/src/ui_/netwardwindow.ui

    r366 r391  
    2929    <enum>QFrame::Raised</enum> 
    3030   </property> 
    31    <widget class="QWidget" name="layoutWidget"> 
     31   <widget class="QWidget" name=""> 
    3232    <property name="geometry"> 
    3333     <rect> 
    3434      <x>40</x> 
    3535      <y>10</y> 
    36       <width>261</width> 
    37       <height>103</height> 
    38      </rect> 
    39     </property> 
    40     <layout class="QHBoxLayout" name="horizontalLayout_2"> 
     36      <width>281</width> 
     37      <height>97</height> 
     38     </rect> 
     39    </property> 
     40    <layout class="QHBoxLayout" name="horizontalLayout_4"> 
    4141     <item> 
    4242      <layout class="QVBoxLayout" name="verticalLayout_2"> 
     
    6969       </item> 
    7070       <item> 
    71         <widget class="QLabel" name="label_2"> 
    72          <property name="text"> 
    73           <string>Nombre d'entrées (nbi)</string> 
    74          </property> 
    75         </widget> 
    76        </item> 
    77        <item> 
    78         <widget class="QLabel" name="label_3"> 
    79          <property name="text"> 
    80           <string>Nombre de sorties (nbs)</string> 
    81          </property> 
    82         </widget> 
     71        <layout class="QHBoxLayout" name="horizontalLayout_3"> 
     72         <item> 
     73          <widget class="QLabel" name="label_2"> 
     74           <property name="text"> 
     75            <string>Nombre d'entrées (nbi)</string> 
     76           </property> 
     77          </widget> 
     78         </item> 
     79         <item> 
     80          <spacer name="horizontalSpacer_2"> 
     81           <property name="orientation"> 
     82            <enum>Qt::Horizontal</enum> 
     83           </property> 
     84           <property name="sizeHint" stdset="0"> 
     85            <size> 
     86             <width>40</width> 
     87             <height>20</height> 
     88            </size> 
     89           </property> 
     90          </spacer> 
     91         </item> 
     92        </layout> 
     93       </item> 
     94       <item> 
     95        <layout class="QHBoxLayout" name="horizontalLayout_2"> 
     96         <item> 
     97          <widget class="QLabel" name="label_3"> 
     98           <property name="text"> 
     99            <string>Nombre de sorties (nbs)</string> 
     100           </property> 
     101          </widget> 
     102         </item> 
     103         <item> 
     104          <spacer name="horizontalSpacer_3"> 
     105           <property name="orientation"> 
     106            <enum>Qt::Horizontal</enum> 
     107           </property> 
     108           <property name="sizeHint" stdset="0"> 
     109            <size> 
     110             <width>40</width> 
     111             <height>20</height> 
     112            </size> 
     113           </property> 
     114          </spacer> 
     115         </item> 
     116        </layout> 
    83117       </item> 
    84118      </layout> 
     
    120154      <x>282</x> 
    121155      <y>70</y> 
    122       <width>81</width> 
     156      <width>87</width> 
    123157      <height>95</height> 
    124158     </rect> 
  • trunk/yao/src/interface/ui_newprojectwindow.h

    r389 r391  
    22** Form generated from reading UI file 'newprojectwindow.ui' 
    33** 
    4 ** Created: Wed Jul 21 16:50:22 2010 
     4** Created: Fri Jul 30 10:30:58 2010 
    55**      by: Qt User Interface Compiler version 4.6.3 
    66** 
  • trunk/yao/src/main.cpp

    r28 r391  
    1616// PURPOSE. 
    1717 
     18 
    1819#include <cstring> 
    1920#include <iostream> 
     
    2122#include "Translator.hpp" 
    2223#include "help/Display.hpp" 
    23  
     24#include "interface/src/include/MainController.hpp" 
    2425#include <antlr/TokenStreamRecognitionException.hpp> 
    2526 
     
    3738    // Check argument count. 
    3839    if(argc <= 1) 
    39       throw runtime_error("no file specified"); 
     40      throw runtime_error("No file specified"); 
    4041 
    4142    // Check if help menu is required. 
     
    4445      exit(EXIT_SUCCESS); 
    4546    } 
    46  
     47         
    4748    filename = argv[1]; 
    4849    if(filename.getExtension().empty()) 
     
    5455    Translator translator(tokenizer); 
    5556    // Code generation of the files Y1ProjectName.h and Y2ProjectName.h 
    56     translator.generateCode(); 
     57    //translator.generateCode(); 
     58        translator.descriptionVisualYAO(); 
    5759    exitStatus = EXIT_SUCCESS; 
    5860    //cout << "End application" << endl; 
     61 
     62        //QMessageBox msgBox; 
     63        //msgBox.setWindowTitle("Aide sur la création d'un nouveau projet."); 
     64         
     65         
     66        translator.theConstantTable; 
     67        //MainController MainController(translator.theConstantTable); 
     68        //m_ConstantCopy = new ConstantWindow(&theConstantTable, &theHeaderList);  
     69         
     70        for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 
     71        {        
     72                //Constant test(it->getName(), it->getText()); 
     73                //MainController MainController(test);  
     74                cout    << it->getName() << ".def1" << endl << it->getText() << ".def2" << endl; 
     75                //cout << "#" << endl;      
     76        //msgBox.setText("Le dernier parametre est:" + it->getName() + it->getText()); 
     77        } 
     78        translator.theHeaderList; 
     79        for (vector<string>::iterator it = translator.theHeaderList.begin(); it != translator.theHeaderList.end(); it++) 
     80                        cout << it->c_str() << endl; 
     81        translator.theHeaderList; 
     82        for (vector<string>::iterator it = translator.theHeaderList.begin(); it != translator.theHeaderList.end(); it++) 
     83                        cout << it->c_str() << endl; 
     84        for (Table<Trajectory>::iterator it = theTrajectoryTable.begin(); it != theTrajectoryTable.end(); it++) 
     85                        cout << it->getName() << ".traj1" << endl << it->getType() << ".traj2" << endl << it->getBoot() << ".traj3" << endl << it->getOffset() << ".traj4" << it->getStep() << ".traj5" << it->getSize()<< " " << endl; 
     86 
    5987  } 
    6088  catch (RecognitionException& e){ 
  • trunk/yao/src/makefile

    r309 r391  
    99BOOSTDIR        = ../share/boost_1_39_0 
    1010BOOSTFLAG       = -I $(BOOSTDIR) 
    11  
    1211 
    1312#LFLAGS         = -L../lib -lantlr 
     
    3332         
    3433        $(CP) $(EXEC) ../bin/ 
    35  
     34        $(CP) $(EXEC) interface/ 
    3635        #@echo   
    3736        #@echo "Nardi's application---------------"  
     
    5857# target for compiling Visual YAO########################################################## 
    5958visual:  
    60         cd interface/; qmake -project; qmake; make; 
     59        #make 
     60        #make -C interface/ 
     61         
     62         
     63        @echo "-----Done----- " 
    6164         
    6265# visual clean target ############ 
     
    128131        $(CP) $(MQNDIR)/src/$(MQNLIB) $(MQNDIR)/bin/ 
    129132        -@echo " $(EXEC) installed." 
    130  
     133        cd interface/; make; ./interface; cd - 
    131134# DO NOT DELETE 
Note: See TracChangeset for help on using the changeset viewer.