Port most of the code to the Qt4
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Tue, 19 Jan 2016 21:24:45 +0000 (22:24 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Tue, 19 Jan 2016 21:24:45 +0000 (22:24 +0100)
INSTALL
Makefile.am
configure.ac
src/help/help.cpp
src/int/cint.c
src/kernel/kernel.cpp
src/lgconfig/lgconfig.cpp
src/net/lognet.cpp
src/preproc/prep.cpp

diff --git a/INSTALL b/INSTALL
index 007e9396d0a2492cd2d6e17d42f359655dfe0b5e..2099840756e6302d837dcd51b5dcd6262f7adb16 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -12,8 +12,8 @@ without warranty of any kind.
 Basic Installation
 ==================
 
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
 instructions specific to this package.  Some packages provide this
 `INSTALL' file but do not implement all of the features documented
index 782199dad86ff50a309081978228acf91952971b..c1005c7bf84d7036f4239731145d8f0deef67229 100644 (file)
@@ -5,8 +5,8 @@ MOC = ${MOCDIR}/${MOCNAME}
 
 #AM_CXXFLAGS= -Wall -pedantic -Wextra -fno-strength-reduce
 #AM_CXXFLAGS = -m32
-AM_CXXFLAGS = -I$(top_srcdir)/src/global
-AM_LDFLAGS= -fPIC
+AM_CXXFLAGS = -I$(top_srcdir)/src/global -I${QTDIR}/include/qt4 -pedantic -Wall -Wextra -DQT3_SUPPORT 
+AM_LDFLAGS= -fPIC -L$(QTDIR)/lib -lQtCore -lQtGui -lQt3Support
 
 EXTRA_DIST = \
        doc/examples \
@@ -18,15 +18,16 @@ EXTRA_DIST = \
        doc/CodingStyle \
        doc/vlp.cfg.sample
 
+#   bin/loggraph 
 bin_PROGRAMS = \
-  bin/loggraph \
   bin/lognet \
   bin/logker \
   bin/logint \
   bin/logedit \
   bin/lgconfig \
-  bin/logcomp \
-  bin/loghelp
+  bin/logcomp
+#   \
+#   bin/loghelp
 
 BUILT_SOURCES = \
   src/graph/loggraph.moc \
@@ -50,7 +51,7 @@ clean-loggraph-extra:
 
 bin_lognet_SOURCES = src/net/lognet.cpp src/net/lognet.moc.cpp
 bin_lognet_CPPFLAGS = $(bin_lognet_CFLAGS)
-bin_lognet_LDADD = $(bin_lognet_LIBS)
+bin_lognet_LDADD = $(bin_lognet_LIBS) -lconfig++
 bin_lognetdir = src/net
 bin_lognet_HEADERS = \
        src/net/soct.h
@@ -99,7 +100,8 @@ bin_logint_SOURCES = \
 # TODO: logint is compiled using gcc instead of g++, for some reason it losts -I./src/global directive
 #       force adding it.
 bin_logint_CPPFLAGS = $(bin_logint_CFLAGS) -DUNIX -DWORD_32BIT -DUSE_CLOCK -Dpascal= -DOBJECTADDR -DSYSV -I$(top_srcdir)/src/global -I/usr/include/qt3
-bin_logint_LDADD = $(bin_logint_LIBS) -lm -lqt-mt
+bin_logint_LDADD = $(bin_logint_LIBS) -lm
+# -lqt-mt
 bin_logintdir = src/int
 bin_logint_HEADERS = \
        src/int/genint.h \
@@ -136,7 +138,7 @@ clean-logedit-extra:
 
 bin_lgconfig_SOURCES = src/lgconfig/lgconfig.cpp src/lgconfig/lgconfig.moc
 bin_lgconfig_CPPFLAGS = $(bin_lgconfig_CFLAGS)
-bin_lgconfig_LDADD = $(bin_lgconfig_LIBS)
+bin_lgconfig_LDADD = $(bin_lgconfig_LIBS) -lconfig++
 src/lgconfig/lgconfig.moc:
        $(MOC) -i src/lgconfig/lgconfig.cpp -o src/lgconfig/lgconfig.moc
 
index 859f94e9173d06220112a9f70b2de2f330718ec1..f27d8a134a6e3dcbf5efc3ee9e13b58a203e9cad 100644 (file)
@@ -11,14 +11,14 @@ AC_CONFIG_FILES([Makefile])
 # libqt3-mt:i386
 #  libqt3-mt-dev:i386
 # qt3-dev-tools:i386
-PKG_CHECK_MODULES([bin_loggraph], [qt-mt < 4.0])
-PKG_CHECK_MODULES([bin_lognet], [qt-mt < 4.0 libconfig])
+#PKG_CHECK_MODULES([bin_loggraph], [qt-mt < 4.0])
+#PKG_CHECK_MODULES([bin_lognet], [qt-mt < 4.0 libconfig])
 PKG_CHECK_MODULES([bin_logker], [QtCore >= 4.0 QtGui >= 4.0 libconfig])
 #PKG_CHECK_MODULES([bin_logint], [qt-mt < 4.0])
 PKG_CHECK_MODULES([bin_logedit], [QtCore >= 4.0 QtGui >= 4.0 ])
-PKG_CHECK_MODULES([bin_lgconfig], [qt-mt < 4.0 libconfig])
-PKG_CHECK_MODULES([bin_logcomp], [qt-mt < 4.0])
-PKG_CHECK_MODULES([bin_loghelp], [qt-mt < 4.0])
+#PKG_CHECK_MODULES([bin_lgconfig], [qt-mt < 4.0 libconfig])
+#PKG_CHECK_MODULES([bin_logcomp], [qt-mt < 4.0])
+#PKG_CHECK_MODULES([bin_loghelp], [qt-mt < 4.0])
 
 # Get Qt3 library and include locations
 AC_ARG_WITH([moc-compiler-name],
@@ -35,6 +35,13 @@ AC_ARG_WITH([moc-compiler-dir],
   [MOCDIR='/usr/bin'])
 AC_SUBST([MOCDIR])
 
+AC_ARG_WITH([qt-dir],
+  [AS_HELP_STRING([--with-qt-dir=DIR],
+    [location of Qt library, defaults to: /usr])],
+  [QTDIR="$withval"],
+  [QTDIR='/usr'])
+AC_SUBST([QTDIR])
+
 AC_CHECK_PROGS([DOXYGEN], [doxygen])
 if test -z "$DOXYGEN";
    then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
index d2cf4f0de5ef139ad48c42c146848c884a83e940..01ccd377b1fff7b60b9c2cf41cb892190665330e 100644 (file)
@@ -1,17 +1,17 @@
-#include <qapp.h>
-#include <qframe.h>
-#include <qmlined.h>
+#include <QtGui/QApplication>
+#include <QtGui/QFrame>
+#include <Qt3Support/q3multilineedit.h>
 #include <qmenubar.h>
 #include <qpopmenu.h>
 #include <qdialog.h>
 #include <qbttngrp.h>
-#include <qlabel.h>
+#include <QtGui/QLabel>
 #include <qlined.h>
 #include <qlistbox.h>
-#include <qpushbt.h>
-#include <qradiobt.h>
-#include <qlist.h>
-#include <qfile.h>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtCore/QList>
+#include <QtCore/qfile.h>
 #include <qcombo.h>
 #include <qtooltip.h>
 #include <qfont.h>
@@ -20,8 +20,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <qfile.h>
-#include <qtstream.h>
+#include <QtCore/qfile.h>
+#include <QtCore/QTextStream>
 #include <qstring.h>
 #include <qfiledlg.h>
 #include <qfontmet.h>
index 222bf22c1f8a723762f300d01283a09b097bc333..ce16846e08f5a6ca442829709d136b2b54c1b3ce 100644 (file)
@@ -13,7 +13,7 @@
 #include <arpa/inet.h>
 #include <errno.h>
 #include <netdb.h>
-#include <qthread.h>
+// #include <qthread.h>
 
 #ifndef NO_PROTOTYPES
 static void load(char *);
index d2521abafcf342c3e570cd9918c8a96c2417bccd..b63a148ae4fba69ca2edd47b7fffaba7d49be9f8 100644 (file)
@@ -37,7 +37,7 @@
 #include <QtGui/QMessageBox>
 #include <QtGui/QFileDialog>
 #include <QtGui/QDialog>
-#include <qstring.h>
+#include <QtCore/QString>
 #include <QtGui/QLabel>
 #include <QtGui/QLineEdit>
 #include <QtGui/QPushButton>
index b130153b47e11ceef37ac4d923de6f27a6c4c48b..70a8bbc732902ecc81c15d74cb4283fbc2deec79 100644 (file)
@@ -1,22 +1,22 @@
-#include <qapp.h>
-#include <qframe.h>
-#include <qmlined.h>
-#include <qmenubar.h>
-#include <qpopmenu.h>
-#include <qdialog.h>
-#include <qbttngrp.h>
-#include <qlabel.h>
-#include <qlined.h>
-#include <qlistbox.h>
-#include <qpushbt.h>
-#include <qradiobt.h>
-#include <qlist.h>
-#include <qfile.h>
-#include <qcombo.h>
-#include <qtooltip.h>
-#include <qfont.h>
-#include <qpixmap.h>
-#include <qmsgbox.h>
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
+#include <Qt3Support/q3multilineedit.h>
+#include <QtGui/QMenuBar>
+// #include <qpopmenu.h>
+#include <QtGui/QDialog>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+#include <Qt3Support/Q3ListBox>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtCore/QList>
+#include <QtCore/qfile.h>
+#include <QtGui/qcombobox.h>
+#include <QtGui/QToolTip>
+#include <QtGui/QFont>
+#include <QtGui/QPixmap>
+#include <QtGui/QMessageBox>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -34,13 +34,13 @@ public:
        char item[255];
 };
 
-class QInstall: public QFrame {
+class QInstall: public QMainWindow {
        Q_OBJECT
 public:
        QMenuBar *bar;
-       QListBox *nodelist;
+       Q3ListBox *nodelist;
        QPushButton *infob;
-       QList<VLPEntry> Nodes;
+       QList<VLPEntry*> Nodes;
 
        QInstall();
        bool check_id(int);
@@ -61,19 +61,25 @@ QInstall::QInstall()
        QFont f("Helvetica", 12, QFont::Bold);
        QPixmap mp;
 
-       infob = new QPushButton(this);
+//     infob = new QPushButton(this);
 
-       bar = new QMenuBar(this);
-       bar->insertItem("Configure", this, SLOT(SetOptions()));
-       bar->insertItem("Quit", app, SLOT(quit()));
-       bar->setFont(f);
-       setCaption("VLP Configuration Tool");
-       infob->setGeometry(0, bar->height(), 200, 30);
+       setWindowTitle("VLP Configuration Tool");
+
+       QMenu * programMenu = NULL;
+       programMenu = menuBar()->addMenu("&Program");
+       programMenu->addAction("Configure", this, SLOT(SetOptions()));
+       programMenu->addAction("Quit", app, SLOT(quit()));
+
+//     bar = new QMenuBar(this);
+//     bar->insertItem("Configure", this, SLOT(SetOptions()));
+//     bar->insertItem("Quit", app, SLOT(quit()));
+//     bar->setFont(f);
+//     infob->setGeometry(0, bar->height(), 200, 30);
        if (mp.load("logo.bmp")) {
-               infob->setPixmap(mp);
-               infob->resize(mp.width(), mp.height());
+//             infob->setPixmap(mp);
+//             infob->resize(mp.width(), mp.height());
        }
-       resize(infob->width(), infob->height() + bar->height());
+//     resize(infob->width(), infob->height() + bar->height());
        Nodes.clear();
 }
 
@@ -85,7 +91,7 @@ bool QInstall::check_id(int id)
        while (pom != NULL) {
                if (pom->ID == id)
                        return FALSE;
-               pom = Nodes.next();
+               pom = Nodes.takeFirst();
        }
        return TRUE;
 }
@@ -98,7 +104,7 @@ bool QInstall::check_addr(char *addr)
        while (pom != NULL) {
                if (strcmp(pom->addr, addr) == 0)
                        return FALSE;
-               pom = Nodes.next();
+               pom = Nodes.takeFirst();
        }
        return TRUE;
 }
@@ -112,82 +118,81 @@ void QInstall::Info()
 
 void QInstall::AddNode()
 {
-       QDialog dlg(this, "", TRUE);
+       QDialog dlg(this);
        QLabel *tmpQLabel;
        QLineEdit *id, *addr, *progs, *home;
        QPushButton *okbtn, *cancelbtn;
        VLPEntry *pom;
        char pomstr[255];
 
-       tmpQLabel = new QLabel(&dlg, "Label_2");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(110, 10, 180, 30);
        tmpQLabel->setFrameStyle(49);
        tmpQLabel->setText("Virtual Processor Properties");
 
-       id = new QLineEdit(&dlg, "LineEdit_1");
+       id = new QLineEdit(&dlg);
        id->setGeometry(130, 50, 50, 30);
        id->setText("");
 
-       tmpQLabel = new QLabel(&dlg, "Label_3");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 50, 90, 30);
        tmpQLabel->setText("Node number");
 
-       tmpQLabel = new QLabel(&dlg, "Label_4");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 90, 80, 30);
        tmpQLabel->setText("IP Address");
 
-       addr = new QLineEdit(&dlg, "LineEdit_2");
+       addr = new QLineEdit(&dlg);
        addr->setGeometry(130, 90, 120, 30);
        addr->setText("");
 
-       tmpQLabel = new QLabel(&dlg, "Label_5");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 130, 100, 30);
        tmpQLabel->setText("Connection type");
 
        QComboBox* tmpQComboBox;
-       tmpQComboBox = new QComboBox(FALSE, &dlg, "ComboBox_1");
+       tmpQComboBox = new QComboBox(&dlg);
        tmpQComboBox->setGeometry(130, 130, 100, 30);
-       tmpQComboBox->setSizeLimit(2);
-       tmpQComboBox->setAutoResize(FALSE);
-       tmpQComboBox->insertItem("Explicit");
+//     tmpQComboBox->setSizeLimit(2);
+//     tmpQComboBox->setAutoResize(FALSE);
+       tmpQComboBox->insertItem(0, "Explicit");
 
-       tmpQLabel = new QLabel(&dlg, "Label_6");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 170, 110, 30);
        tmpQLabel->setText("Programs directory");
 
-       progs = new QLineEdit(&dlg, "LineEdit_4");
+       progs = new QLineEdit(&dlg);
        progs->setGeometry(130, 170, 230, 30);
        progs->setText("");
 
-       tmpQLabel = new QLabel(&dlg, "Label_7");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 210, 100, 30);
        tmpQLabel->setText("VLP directory");
 
-       home = new QLineEdit(&dlg, "LineEdit_5");
+       home = new QLineEdit(&dlg);
        home->setGeometry(130, 210, 230, 30);
        home->setText("");
 
-       okbtn = new QPushButton(&dlg, "PushButton_5");
+       okbtn = new QPushButton(&dlg);
        okbtn->setGeometry(80, 250, 100, 30);
        okbtn->setText("Ok");
        connect(okbtn,SIGNAL(clicked()), &dlg, SLOT(accept()));
-       cancelbtn = new QPushButton(&dlg, "PushButton_6");
+       cancelbtn = new QPushButton(&dlg);
        cancelbtn->setGeometry(210, 250, 100, 30);
        cancelbtn->setText("Cancel");
        connect(cancelbtn,SIGNAL(clicked()), &dlg, SLOT(reject()));
        dlg.resize(380, 300);
        if (dlg.exec()) {
                pom = new VLPEntry;
-               pom->ID = atoi(id->text());
+               pom->ID = id->text().toInt();
                if (check_id(pom->ID)) {
-                       strcpy(pom->addr, addr->text());
+                       strcpy(pom->addr, addr->text().toStdString().c_str());
                        if (check_addr(pom->addr)) {
-                               if (strcmp(tmpQComboBox->currentText(),
-                                                       "Explicit") == 0) {
+                               if (tmpQComboBox->currentText() == "Explicit") {
                                        pom->type=0;
                                }
-                               strcpy(pom->progdir, progs->text());
-                               strcpy(pom->homedir, home->text());
+                               strcpy(pom->progdir, progs->text().toStdString().c_str());
+                               strcpy(pom->homedir, home->text().toStdString().c_str());
                                Nodes.append(pom);
                                sprintf(pomstr, "Node: %d\t"
                                                "Addr: %s\t"
@@ -195,13 +200,10 @@ void QInstall::AddNode()
                                nodelist->insertItem(pomstr);
                                strcpy(pom->item, pomstr);
                        } else {
-                               QMessageBox::message("Error!",
-                                       "Only one VLP on a single computer!",
-                                       "Ok");
+                               QMessageBox::warning(this, "Error!", "Only one VLP on a single computer!", "Ok");
                        }
                } else {
-                       QMessageBox::message("Error!", "ID must be unique!",
-                                                                       "Ok");
+                       QMessageBox::warning(this, "Error!", "ID must be unique!", "Ok");
                }
        }
 }
@@ -212,25 +214,24 @@ void QInstall::DelNode()
        VLPEntry *vpom;
 
        if (nodelist->currentItem() >= 0) {
-               strcpy(pom, nodelist->text(nodelist->currentItem()));
+               strcpy(pom, nodelist->text(nodelist->currentItem()).toStdString().c_str());
                vpom = Nodes.first();
                while (vpom != NULL) {
                        if (strcmp(pom, vpom->item) == 0)
                                break;
-                       vpom = Nodes.next();
+                       vpom = Nodes.takeFirst();
                }
                if (vpom != NULL)
-                       if (QMessageBox::query("Delete VLP", "Are you sure?",
-                                                               "Yes", "No")) {
+                       if (QMessageBox::question(this, "Delete VLP", "Are you sure?", "Yes", "No")) {
                                nodelist->removeItem(nodelist->currentItem());
-                               Nodes.remove(vpom);
+                               Nodes.removeOne(vpom);
                        }
        }
 }
 
 void QInstall::SetOptions()
 {
-       QDialog dlg(this, "", TRUE);
+       QDialog dlg(this);
        QLabel *tmpQLabel;
        QPushButton *addbtn, *delbtn, *okbtn, *cancelbtn;
        VLPEntry *pom;
@@ -238,29 +239,29 @@ void QInstall::SetOptions()
        char pomstr[255];
 
        //dlg.setStyle(WindowsStyle);
-       nodelist = new QListBox(&dlg, "ListBox_1");
+       nodelist = new Q3ListBox(&dlg);
        nodelist->setGeometry(20, 40, 480, 160);
 
-       tmpQLabel = new QLabel(&dlg, "Label_1");
+       tmpQLabel = new QLabel(&dlg);
        tmpQLabel->setGeometry(20, 10, 100, 30);
        tmpQLabel->setText("Nodes:");
 
-       addbtn = new QPushButton(&dlg, "PushButton_1");
+       addbtn = new QPushButton(&dlg);
        addbtn->setGeometry(30, 210, 100, 30);
        addbtn->setText("Add VLP");
        connect(addbtn, SIGNAL(clicked()), this, SLOT(AddNode()));
 
-       delbtn = new QPushButton(&dlg, "PushButton_2");
+       delbtn = new QPushButton(&dlg);
        delbtn->setGeometry(150, 210, 100, 30);
        delbtn->setText("Del VLP");
        connect(delbtn, SIGNAL(clicked()), this, SLOT(DelNode()));
 
-       okbtn = new QPushButton(&dlg, "PushButton_3");
+       okbtn = new QPushButton(&dlg);
        okbtn->setGeometry(270, 210, 100, 30);
        okbtn->setText("Save files");
        connect(okbtn, SIGNAL(clicked()), &dlg, SLOT(accept()));
 
-       cancelbtn = new QPushButton(&dlg, "PushButton_4");
+       cancelbtn = new QPushButton(&dlg);
        cancelbtn->setGeometry(390, 210, 100, 30);
        cancelbtn->setText("Cancel");
        connect(cancelbtn, SIGNAL(clicked()), &dlg, SLOT(reject()));
@@ -271,7 +272,7 @@ void QInstall::SetOptions()
                if (!Nodes.isEmpty()) {
                        pom = Nodes.first();
                        while (pom != NULL) {
-                               j = Nodes.at();
+                               j = Nodes.indexOf(pom);
                                sprintf(pomstr, "%s.cfg", pom->addr);
 
                                config_t cfg;
@@ -321,7 +322,7 @@ void QInstall::SetOptions()
                                config_destroy(&cfg);
 
                                pom = Nodes.at(j);
-                               pom = Nodes.next();
+                               pom = Nodes.takeFirst();
                        }
                }
        }
@@ -334,7 +335,7 @@ int main(int argc, char **argv)
        app = new QApplication(argc,argv);
        QInstall cfg;
        //app->setStyle(WindowsStyle);
-       app->setMainWidget(&cfg);
+//     app->setMainWidget(&cfg);
        cfg.show();
        return app->exec();
 }
index 7a93bc0661b919dd188ef21523117900918aaadd..4c00e276ad149d01af2146a63ce18e7cbffb00b0 100644 (file)
 #include <signal.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <qlist.h>
-#include <qfile.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
 #include <unistd.h>
 
 #include <libconfig.h>
@@ -91,9 +91,9 @@ public:
        char kername[256];
 
        /* List of the Interpeter slots */
-       QList<INTlink> Interpreters;
+       QList<INTlink*> Interpreters;
        /* List of the Network slots */ 
-       QList<NETlink> Links;
+       QList<NETlink*> Links;
 
        NETMOD(char*);
 
@@ -385,7 +385,7 @@ void NETMOD::check_node(int n, int sc)
                        strcpy(m.param.pstr, pomlink->addr);
                        break;
                }
-               pomlink = Links.next();
+               pomlink = Links.takeFirst();
        }
        write(sc, &m, sizeof(MESSAGE));
 }
@@ -418,7 +418,7 @@ void NETMOD::get_internal()
                if (nrset < pomlink->sock) {
                        nrset = pomlink->sock;
                }
-               pomlink = Interpreters.next();
+               pomlink = Interpreters.takeFirst();
        }
 
        if (select(nrset + 1, &readset, &writeset, 0, (struct timeval *)&tout) >
@@ -450,7 +450,7 @@ void NETMOD::get_internal()
                                        }
                                }
                        } /* ISSET */
-                       pomlink=Interpreters.next();
+                       pomlink=Interpreters.takeFirst();
                } // while
 
                /* Check internal socket */
@@ -508,7 +508,7 @@ void NETMOD::get_internal()
                                                pomlink = findINTlink(msg.param.pword[1]);
                                                if (pomlink != NULL) {
                                                        close(pomlink->sock);
-                                                       Interpreters.remove(pomlink);
+                                                       Interpreters.removeOne(pomlink);
                                                }
                                                };
                                                break;
@@ -614,7 +614,7 @@ void NETMOD::get_message(NETlink *lnk)
                                                msg.param.pword[1]);
                                        write_at_console(pomstr);
                                        ::close(lnk->sock);
-                                       Links.remove(lnk);
+                                       Links.removeOne(lnk);
                                        delete lnk;
                                        break;
                                case NET_PROPAGATE:
@@ -652,7 +652,7 @@ void NETMOD::remote_messages()
                                max = pomlink->sock;
                        }
                }
-               pomlink=Links.next();
+               pomlink=Links.takeFirst();
        }
 
        if (select(max + 1, &rset, &wset, 0, (struct timeval *)&tout) > 0) {
@@ -661,7 +661,7 @@ void NETMOD::remote_messages()
                        if (FD_ISSET(pomlink->sock,&rset)) {
                                get_message(pomlink);
                        }
-                       pomlink=Links.next();
+                       pomlink=Links.takeFirst();
                }
        }
 }
@@ -690,7 +690,7 @@ void NETMOD::doitall() {
                if (max < pomlink2->sock) {
                        max=pomlink2->sock;
                }
-               pomlink2 = Interpreters.next();
+               pomlink2 = Interpreters.takeFirst();
        }
        pomlink = Links.first();
        while (pomlink != NULL) {
@@ -700,7 +700,7 @@ void NETMOD::doitall() {
                                max = pomlink->sock;
                        }
                }
-               pomlink=Links.next();
+               pomlink=Links.takeFirst();
        }
 
        /* odczyt */
@@ -751,7 +751,7 @@ void NETMOD::doitall() {
                                        }
                                }
                        }/* ISSET */
-                       pomlink2 = Interpreters.next();
+                       pomlink2 = Interpreters.takeFirst();
                }/* while */
 
                /* Check internal socket */
@@ -806,7 +806,7 @@ void NETMOD::doitall() {
                                                pomlink2 = findINTlink(msg.param.pword[1]);
                                                if (pomlink2 != NULL) {
                                                        close(pomlink2->sock);
-                                                       Interpreters.remove(pomlink2);
+                                                       Interpreters.removeOne(pomlink2);
                                                }
                                                };
                                                break;
@@ -821,7 +821,7 @@ void NETMOD::doitall() {
                while (pomlink != NULL) {
                        if (FD_ISSET(pomlink->sock, &rset))
                                get_message(pomlink);
-                       pomlink=Links.next();
+                       pomlink=Links.takeFirst();
                }
        } // select 
 }
@@ -858,7 +858,7 @@ void NETMOD::connect_seq(char *a)
        while (pom != NULL) {
                if (strcmp(pom->addr, a) == 0)
                        return;
-               pom = Links.next();
+               pom = Links.takeFirst();
        }
        pom = new NETlink;
        strcpy(pom->addr, a);
@@ -912,7 +912,7 @@ void NETMOD::check_links()
                                        sock_reopen(pomlink);
                                }
                        } /* not connected */
-                       pomlink = Links.next();
+                       pomlink = Links.takeFirst();
                } /* while */
        } /* if */
        all_connected = TRUE;
@@ -922,7 +922,7 @@ void NETMOD::check_links()
                        all_connected = FALSE;
                        break;
                }
-               pomlink = Links.next();
+               pomlink = Links.takeFirst();
        }
 }
 
@@ -979,7 +979,7 @@ void NETMOD::send_to_all(MESSAGE *msg)
        pomlink = Links.first();
        while (pomlink != NULL) {
                write(pomlink->sock, msg, sizeof(MESSAGE));
-               pomlink = Links.next();
+               pomlink = Links.takeFirst();
        }
 }
 
@@ -1006,7 +1006,7 @@ void NETMOD::exit_sequence()
        pomlink = Links.first();
        while (pomlink != NULL) {
                ::close(pomlink->sock);
-               pomlink = Links.next();
+               pomlink = Links.takeFirst();
        }
        exit(0);
 }
@@ -1024,12 +1024,12 @@ void NETMOD::disconnect_seq()
        p = Links.first();
        while(p != NULL) {
                send_to_node(p, &m);
-               p=Links.next();
+               p=Links.takeFirst();
        }
        p = Links.first();
        while(p != NULL) {
                ::close(p->sock);
-               p = Links.next();
+               p = Links.takeFirst();
        }
        Links.clear();
 }
@@ -1042,7 +1042,7 @@ NETlink * NETMOD::findNETlink(int node)
                if (pomlink->node_number == node)
                        return pomlink;
 
-               pomlink = Links.next();
+               pomlink = Links.takeFirst();
        } 
        return pomlink;
 }
@@ -1054,7 +1054,7 @@ INTlink * NETMOD::findINTlink(int id)
        while(pomlink != NULL) {
                if (pomlink->ID == id)
                        return pomlink;
-               pomlink = Interpreters.next();
+               pomlink = Interpreters.takeFirst();
        }
        return pomlink;
 }
@@ -1215,7 +1215,7 @@ void NETMOD::conn_info(int sk)
                        write(sk, &m, sizeof(MESSAGE));
                        k = 0;
                }
-               pom = Links.next();
+               pom = Links.takeFirst();
        }
        if (k > 0) {
                m.param.pword[1] = k;
index 285b2c899d69502b0dea048527afa23de6a7a9d3..dda3901c4149ad32f404b8ce82848306d95db08e 100644 (file)
@@ -1,10 +1,10 @@
-#include <qlist.h>
-#include <qstring.h>
+#include <QtCore/QList>
+#include <QtCore/QString>
 #include <stdio.h>
-#include <qfile.h>
-#include <qtstream.h>
+#include <QtCore/qfile.h>
+#include <QtCore/QTextStream>
 #include <string.h>
-#include <qdir.h>
+#include <QtCore/QDir>
 #include <unistd.h>
 #include <stdlib.h>
 
@@ -21,13 +21,15 @@ public:
        };
 };
 
-QList<IncFile> inc;
+QList<IncFile*> inc;
 
 IncFile *findTrueLine(int ln, int *trueline)
 {
-       IncFile *pom, *pom1;
-       QList<IncFile> pl;
-       int c1 = 0, c2 = 0;
+       IncFile *pom;
+       IncFile *pom1;
+       QList<IncFile*> pl;
+       int c1 = 0;
+//     int c2 = 0;
 
        if (inc.isEmpty()) {
                *trueline = ln;
@@ -46,7 +48,7 @@ IncFile *findTrueLine(int ln, int *trueline)
                        return pom;
                }
                pl.append(pom);
-               pom=inc.next();
+               pom=inc.takeFirst();
        }
 
        if (pom != NULL) {
@@ -54,7 +56,7 @@ IncFile *findTrueLine(int ln, int *trueline)
                c1=0;
                while (pom1 != NULL) {
                        c1 += pom1->len;
-                       pom1 = pl.next();
+                       pom1 = pl.takeFirst();
                }
                *trueline = ln - c1;
                return NULL;
@@ -63,7 +65,7 @@ IncFile *findTrueLine(int ln, int *trueline)
                c1 = 0;
                while (pom1 != NULL) {
                        c1 += pom1->len;
-                       pom1=inc.next();
+                       pom1=inc.takeFirst();
                }
                *trueline = ln - c1;
                return NULL;
@@ -89,7 +91,7 @@ int main(int argc,char **argv)
        //******* get home directory
        if (i != -1) {
                poms1 = poms.left(i + 1);
-               strcpy(homedir, poms1.data());
+               strcpy(homedir, poms1.toStdString().c_str());
        }
        else
                strcpy(homedir, "");
@@ -102,26 +104,25 @@ int main(int argc,char **argv)
        else
                poms1.sprintf(".");
 
-       strcpy(mydir,poms1.data());
+       strcpy(mydir, poms1.toStdString().c_str());
 
        poms.sprintf("%s", argv[1]);
        i = poms.findRev(".log", poms.length()-1, FALSE);
        poms1 = poms.left(i);
-       strcpy(fname, poms1.data());
+       strcpy(fname, poms1.toStdString().c_str());
 
        // ********************
 
        poms.sprintf("%s/.cmp00", mydir);
        poms1.sprintf("%s/cmp01.log", mydir);
-       unlink(poms.data());
-       unlink(poms1.data());
+       unlink(poms.toStdString().c_str());
+       unlink(poms1.toStdString().c_str());
 
-       QFile compfile(poms1.data());
+       QFile compfile(poms1);
        QFile srcfile(argv[1]);
 
        if (!compfile.open(IO_WriteOnly)) {
-               fprintf(stdout,"Cannot open temp file to write %s\n",
-                                                               poms1.data());
+               fprintf(stdout,"Cannot open temp file to write %s\n", poms1.toStdString().c_str());
                exit(1);
        }
 
@@ -133,7 +134,7 @@ int main(int argc,char **argv)
        QTextStream comps(&compfile);
        QTextStream src(&srcfile);
 
-       while (!src.eof()) {
+       while (!src.atEnd()) {
                poms = src.readLine();
                i = poms.find("#include");
                if (i != -1) {
@@ -147,17 +148,17 @@ int main(int argc,char **argv)
                                poms1 = poms.mid(i + 1, j - i - 1);
                                p = new IncFile((char*)poms1.ascii(),
                                                                currentline);
-                               poms2.sprintf("%s%s", homedir, poms1.data());
-                               QFile pomf(poms2.data());
+                               poms2.sprintf("%s%s", homedir, poms1.toStdString().c_str());
+                               QFile pomf(poms2.toStdString().c_str());
                                if (!pomf.open(IO_ReadOnly)) {
                                        fprintf(stdout, "Cannot open include "
-                                               "file: %s\n", poms2.data());
+                                               "file: %s\n", poms2.toStdString().c_str());
                                        exit(1);
                                }
                                QTextStream pomstream(&pomf);
-                               while (!pomstream.eof()) {
+                               while (!pomstream.atEnd()) {
                                        poms1 = pomstream.readLine();
-                                       comps << poms1.data();
+                                       comps << poms1.toStdString().c_str();
                                        comps << "\n";
                                        p->len++;
                                        currentline++;
@@ -166,7 +167,7 @@ int main(int argc,char **argv)
                                inc.append(p);
                        }
                } else {
-                       comps << poms.data();
+                       comps << poms.toStdString().c_str();
                        comps << "\n";
                }
                currentline++;
@@ -176,7 +177,7 @@ int main(int argc,char **argv)
        compfile.close();
 
        poms.sprintf("%s/cmp01.lcd", mydir);
-       unlink(poms.data());
+       unlink(poms.toStdString().c_str());
 
        sprintf(ss, "%s/loglan %s/cmp01 > %s/.cmp00", mydir, mydir, mydir);
        if (system(ss) == -1) {
@@ -186,9 +187,9 @@ int main(int argc,char **argv)
 
        poms1.sprintf("%s.lcd", fname);
 
-       if (QFile::exists(poms.data())) {
-               rename(poms.data(), poms1.data());
-               unlink(poms.data());
+       if (QFile::exists(poms.toStdString().c_str())) {
+               rename(poms.toStdString().c_str(), poms1.toStdString().c_str());
+               unlink(poms.toStdString().c_str());
                fprintf(stdout, "Compile ok\n");
                sprintf(ss,"%s/gen %s", mydir, fname);
                if (system(ss)==-1) {
@@ -196,13 +197,13 @@ int main(int argc,char **argv)
                        exit(1);
                }
                poms.sprintf("%s.ccd", fname);
-               if (QFile::exists(poms.data())) {
-                       unlink(poms1.data());
+               if (QFile::exists(poms.toStdString().c_str())) {
+                       unlink(poms1.toStdString().c_str());
                }
        } else {
                fprintf(stdout, "Errors\n");
                poms.sprintf("%s/.cmp00", mydir);
-               QFile err(poms.data());
+               QFile err(poms.toStdString().c_str());
 
                if (!err.open(IO_ReadOnly)) {
                        fprintf(stdout,"Cannot open error file\n");
@@ -213,12 +214,12 @@ int main(int argc,char **argv)
 
                poms = errstream.readLine();
                i = poms.find("LOGLAN-82");
-               while ((!errstream.eof()) && (i == -1)) {
+               while ((!errstream.atEnd()) && (i == -1)) {
                        poms = errstream.readLine();
                        i = poms.find("LOGLAN-82");
                }
 
-               while (!errstream.eof()) {
+               while (!errstream.atEnd()) {
                        poms = errstream.readLine();
                        i = poms.find("ERROR");
                        if (i != -1) {
@@ -231,16 +232,16 @@ int main(int argc,char **argv)
                                if (fl != NULL)
                                        fprintf(stdout, "%s: ", fl->filename);
                                fprintf(stdout, "%d  %s\n",
-                                                       tline, poms2.data());
+                                                       tline, poms2.toStdString().c_str());
                        }
                }
                err.close();
        } /* errors */
 
        poms.sprintf("%s/cmp01.log",mydir);
-       unlink(poms.data());
+       unlink(poms.toStdString().c_str());
        poms.sprintf("%s/.cmp00",mydir);
-       unlink(poms.data());
+       unlink(poms.toStdString().c_str());
 
        return 0;
 }