From: Rafał Długołęcki Date: Tue, 19 Jan 2016 21:24:45 +0000 (+0100) Subject: Port most of the code to the Qt4 X-Git-Tag: 3.4-b1~61 X-Git-Url: https://git.dlugolecki.net.pl/?p=vlp.git;a=commitdiff_plain;h=b2bcd7aad84b87e82c1029ba9741953f559e317d Port most of the code to the Qt4 --- diff --git a/INSTALL b/INSTALL index 007e939..2099840 100644 --- 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 diff --git a/Makefile.am b/Makefile.am index 782199d..c1005c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 859f94e..f27d8a1 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/help/help.cpp b/src/help/help.cpp index d2cf4f0..01ccd37 100644 --- a/src/help/help.cpp +++ b/src/help/help.cpp @@ -1,17 +1,17 @@ -#include -#include -#include +#include +#include +#include #include #include #include #include -#include +#include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/int/cint.c b/src/int/cint.c index 222bf22..ce16846 100644 --- a/src/int/cint.c +++ b/src/int/cint.c @@ -13,7 +13,7 @@ #include #include #include -#include +// #include #ifndef NO_PROTOTYPES static void load(char *); diff --git a/src/kernel/kernel.cpp b/src/kernel/kernel.cpp index d2521ab..b63a148 100644 --- a/src/kernel/kernel.cpp +++ b/src/kernel/kernel.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/lgconfig/lgconfig.cpp b/src/lgconfig/lgconfig.cpp index b130153..70a8bbc 100644 --- a/src/lgconfig/lgconfig.cpp +++ b/src/lgconfig/lgconfig.cpp @@ -1,22 +1,22 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -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 Nodes; + QList 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(); } diff --git a/src/net/lognet.cpp b/src/net/lognet.cpp index 7a93bc0..4c00e27 100644 --- a/src/net/lognet.cpp +++ b/src/net/lognet.cpp @@ -16,10 +16,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -91,9 +91,9 @@ public: char kername[256]; /* List of the Interpeter slots */ - QList Interpreters; + QList Interpreters; /* List of the Network slots */ - QList Links; + QList 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; diff --git a/src/preproc/prep.cpp b/src/preproc/prep.cpp index 285b2c8..dda3901 100644 --- a/src/preproc/prep.cpp +++ b/src/preproc/prep.cpp @@ -1,10 +1,10 @@ -#include -#include +#include +#include #include -#include -#include +#include +#include #include -#include +#include #include #include @@ -21,13 +21,15 @@ public: }; }; -QList inc; +QList inc; IncFile *findTrueLine(int ln, int *trueline) { - IncFile *pom, *pom1; - QList pl; - int c1 = 0, c2 = 0; + IncFile *pom; + IncFile *pom1; + QList 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; }