-#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>
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);
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();
}
while (pom != NULL) {
if (pom->ID == id)
return FALSE;
- pom = Nodes.next();
+ pom = Nodes.takeFirst();
}
return TRUE;
}
while (pom != NULL) {
if (strcmp(pom->addr, addr) == 0)
return FALSE;
- pom = Nodes.next();
+ pom = Nodes.takeFirst();
}
return TRUE;
}
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"
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");
}
}
}
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;
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()));
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;
config_destroy(&cfg);
pom = Nodes.at(j);
- pom = Nodes.next();
+ pom = Nodes.takeFirst();
}
}
}
app = new QApplication(argc,argv);
QInstall cfg;
//app->setStyle(WindowsStyle);
- app->setMainWidget(&cfg);
+// app->setMainWidget(&cfg);
cfg.show();
return app->exec();
}
#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>
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*);
strcpy(m.param.pstr, pomlink->addr);
break;
}
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
write(sc, &m, sizeof(MESSAGE));
}
if (nrset < pomlink->sock) {
nrset = pomlink->sock;
}
- pomlink = Interpreters.next();
+ pomlink = Interpreters.takeFirst();
}
if (select(nrset + 1, &readset, &writeset, 0, (struct timeval *)&tout) >
}
}
} /* ISSET */
- pomlink=Interpreters.next();
+ pomlink=Interpreters.takeFirst();
} // while
/* Check internal socket */
pomlink = findINTlink(msg.param.pword[1]);
if (pomlink != NULL) {
close(pomlink->sock);
- Interpreters.remove(pomlink);
+ Interpreters.removeOne(pomlink);
}
};
break;
msg.param.pword[1]);
write_at_console(pomstr);
::close(lnk->sock);
- Links.remove(lnk);
+ Links.removeOne(lnk);
delete lnk;
break;
case NET_PROPAGATE:
max = pomlink->sock;
}
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
if (select(max + 1, &rset, &wset, 0, (struct timeval *)&tout) > 0) {
if (FD_ISSET(pomlink->sock,&rset)) {
get_message(pomlink);
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
}
}
if (max < pomlink2->sock) {
max=pomlink2->sock;
}
- pomlink2 = Interpreters.next();
+ pomlink2 = Interpreters.takeFirst();
}
pomlink = Links.first();
while (pomlink != NULL) {
max = pomlink->sock;
}
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
/* odczyt */
}
}
}/* ISSET */
- pomlink2 = Interpreters.next();
+ pomlink2 = Interpreters.takeFirst();
}/* while */
/* Check internal socket */
pomlink2 = findINTlink(msg.param.pword[1]);
if (pomlink2 != NULL) {
close(pomlink2->sock);
- Interpreters.remove(pomlink2);
+ Interpreters.removeOne(pomlink2);
}
};
break;
while (pomlink != NULL) {
if (FD_ISSET(pomlink->sock, &rset))
get_message(pomlink);
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
} // select
}
while (pom != NULL) {
if (strcmp(pom->addr, a) == 0)
return;
- pom = Links.next();
+ pom = Links.takeFirst();
}
pom = new NETlink;
strcpy(pom->addr, a);
sock_reopen(pomlink);
}
} /* not connected */
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
} /* while */
} /* if */
all_connected = TRUE;
all_connected = FALSE;
break;
}
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
}
pomlink = Links.first();
while (pomlink != NULL) {
write(pomlink->sock, msg, sizeof(MESSAGE));
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
}
pomlink = Links.first();
while (pomlink != NULL) {
::close(pomlink->sock);
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
exit(0);
}
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();
}
if (pomlink->node_number == node)
return pomlink;
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
return pomlink;
}
while(pomlink != NULL) {
if (pomlink->ID == id)
return pomlink;
- pomlink = Interpreters.next();
+ pomlink = Interpreters.takeFirst();
}
return pomlink;
}
write(sk, &m, sizeof(MESSAGE));
k = 0;
}
- pom = Links.next();
+ pom = Links.takeFirst();
}
if (k > 0) {
m.param.pword[1] = k;
-#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>
};
};
-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;
return pom;
}
pl.append(pom);
- pom=inc.next();
+ pom=inc.takeFirst();
}
if (pom != NULL) {
c1=0;
while (pom1 != NULL) {
c1 += pom1->len;
- pom1 = pl.next();
+ pom1 = pl.takeFirst();
}
*trueline = ln - c1;
return NULL;
c1 = 0;
while (pom1 != NULL) {
c1 += pom1->len;
- pom1=inc.next();
+ pom1=inc.takeFirst();
}
*trueline = ln - c1;
return NULL;
//******* get home directory
if (i != -1) {
poms1 = poms.left(i + 1);
- strcpy(homedir, poms1.data());
+ strcpy(homedir, poms1.toStdString().c_str());
}
else
strcpy(homedir, "");
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);
}
QTextStream comps(&compfile);
QTextStream src(&srcfile);
- while (!src.eof()) {
+ while (!src.atEnd()) {
poms = src.readLine();
i = poms.find("#include");
if (i != -1) {
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++;
inc.append(p);
}
} else {
- comps << poms.data();
+ comps << poms.toStdString().c_str();
comps << "\n";
}
currentline++;
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) {
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) {
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");
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) {
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;
}