1 /**************************************************************
3 Copyright (C) 1997 Oskar Swida
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 NOTE: This software is using the free software license of
23 the QT library v.1.30 from Troll Tech AS.
24 See the file LICENSE.QT.
27 To contact the author, write:
28 e-mail: swida@aragorn.pb.bialystok.pl
30 ************************************************************/
32 #include <QtGui/QApplication>
33 #include <QtGui/QMainWindow>
34 #include <QtGui/QTextEdit>
35 #include <QtGui/QMenuBar>
36 #include <QtGui/QMessageBox>
37 #include <QtGui/QFileDialog>
38 #include <QtGui/QDialog>
39 #include <QtCore/QString>
40 #include <QtGui/QLabel>
41 #include <QtGui/QLineEdit>
42 #include <QtGui/QPushButton>
43 #include <QtGui/QRadioButton>
44 #include <QtGui/QGroupBox>
45 #include <QtGui/QVBoxLayout>
46 #include <QtCore/QList>
47 #include <QtGui/QListWidget>
50 #include <QtCore/QSocketNotifier>
51 #include <QtGui/QCloseEvent>
52 #include <QtCore/QDir>
53 #include <QtCore/QProcess>
62 #include <netinet/in.h>
64 #include <libconfig.h>
68 #include "ui/kernelwindow.h"
71 #include "kill_interpreter_dialog.h"
72 #include "connect_dialog.h"
74 #include "vlp/config.h"
76 /* File resides in top directory (where are Makefiles)*/
77 #include "../../config.h"
80 char CharLine[25] = "________________________";
83 * Event invoked on program close.
84 * Closes application. Displays additional window to confirm exit.
86 void QKernel::closeEvent(QCloseEvent * e)
91 on_actionQuit_triggered();
95 void QKernel::setLocked(bool locked)
99 actionQuit->setDisabled(locked);
101 actionExecute->setDisabled(locked);
102 actionKill->setDisabled(locked);
103 actionMessage->setDisabled(locked);
104 actionConnect->setDisabled(locked);
105 actionDisconnect->setDisabled(locked);
106 actionInfo->setDisabled(locked);
109 /* Enable only menu entry for unlocking */
110 actionEditor->setDisabled(locked);
111 actionOptions->setDisabled(locked);
112 actionLock_console->setDisabled(locked);
113 actionUnlock_console->setDisabled(!locked);
117 * Kernel program constructor.
118 * Prepares everything to work.
120 QKernel::QKernel(int argc, char **argv)
124 QString arg0(argv[0]);
126 homeDir = QDir(arg0);
131 for(i = 0; (i < 5) && (i < argc-1); i++) {
132 strcpy(myargs[i], "");
134 strcpy(myargs[i], argv[i+1]);
138 QDir q(getRemoteDir());
141 q.mkpath(getRemoteDir());
144 info_messages = actionInfo_messages->isChecked();
145 wait_for_info = FALSE;
147 setWindowTitle(PACKAGE_NAME);
153 ActiveConnections = 0;
154 strcpy(LockPasswd, "");
156 loadConfig(getConfigFilePath());
160 Net_Notify = new QSocketNotifier(net_sock, QSocketNotifier::Read, this);
161 connect(Net_Notify, SIGNAL(activated(int)), this, SLOT(NetMessage()));
163 WriteMessage("\n " PACKAGE_STRING ": READY \n");
166 QString QKernel::getConfigFilePath()
168 return homeDir.absoluteFilePath("vlp.cfg");
171 const char * QKernel::getHomeDir()
173 return homeDir.absolutePath().toStdString().c_str();
176 const char * QKernel::getRemoteDir()
178 return homeDir.absoluteFilePath(REMOTE_PATH).toStdString().c_str();
181 const char * QKernel::getNetModuleSocket()
183 return homeDir.absoluteFilePath(NPATH).toStdString().c_str();
186 const char * QKernel::getGraphModuleSocket()
188 return homeDir.absoluteFilePath(GPATH).toStdString().c_str();
191 void QKernel::loadConfig(const QString & fname)
193 loadConfig(fname.toStdString().c_str());
196 * Loads configuration from the given file.
197 * @param fname Filename of the configuration file.
199 void QKernel::loadConfig(const char * fname)
201 loglan::vlp::Config config;
202 if(config.load(fname)) {
203 NodeNumber = config.getNodeNumber();
204 ConType = config.getConnectionType();
207 std::vector<std::string> hosts = config.getHosts();
208 for (unsigned int i = 0; i < hosts.size(); i++) {
209 ConnectList.append(new ConnectEntry(hosts[i].c_str()));
212 strncpy(progdir, config.getProgramDir(), 256);
218 * Additional window id displayed to set which code to execute.
220 void QKernel::on_actionExecute_triggered()
222 QString s = QFileDialog::getOpenFileName(this, "Execute", progdir, "*.log");
225 int i = s.indexOf(".log");
230 // @TODO: if no interpreter is running will result in killing app
231 RunIntModule((char*)s.toAscii().data(), 0);
236 * Invokes editor program
238 void QKernel::on_actionEditor_triggered()
240 QString program = getHomeDir();
241 program += "/modules/logedit";
245 if (execl(program.toStdString().c_str(),
254 WriteMessage("Executing logedit failed!");
258 WriteMessage("fork(logedit) failed!");
259 WriteMessage("Exiting...");
261 on_actionQuit_triggered();
267 * Invokes help program
269 void QKernel::on_actionHelp_triggered()
271 QString program = getHomeDir();
272 program += "/modules/loghelp";
274 QString docDir = getHomeDir();
279 if (execl(program.toStdString().c_str(),
280 docDir.toStdString().c_str(),
289 WriteMessage("Executing loghelp failed!");
293 WriteMessage("fork(loghelp) failed!");
294 WriteMessage("Exiting...");
296 on_actionQuit_triggered();
302 * Invokes graphics module
304 void QKernel::RunGraphModule(char *sk)
306 QString program = getHomeDir();
307 program += "/modules/loggraph";
311 if (execl(program.toStdString().c_str(),
312 program.toStdString().c_str(),
322 WriteMessage("Executing loggraph failed!");
323 WriteMessage("Exiting...");
325 on_actionQuit_triggered();
329 WriteMessage("fork(loggraph) failed!");
330 WriteMessage("Exiting...");
332 on_actionQuit_triggered();
340 void QKernel::RunNetModule()
342 struct sockaddr_un svr;
347 QString program = getHomeDir();
348 program += "/modules/lognet";
352 if (execl(program.toStdString().c_str(),
353 program.toStdString().c_str(),
354 getNetModuleSocket(),
355 getConfigFilePath().toStdString().c_str(),
364 WriteMessage("Executing lognet failed!");
365 WriteMessage("Exiting...");
367 on_actionQuit_triggered();
371 WriteMessage("fork(lognet) failed!");
372 WriteMessage("Exiting...");
374 on_actionQuit_triggered();
378 /* -------- socket for NET module -------- */
379 unlink(getNetModuleSocket());
380 sock = socket(AF_UNIX, SOCK_STREAM, 0);
381 bzero(&svr, sizeof(svr));
382 svr.sun_family = AF_UNIX;
383 strcpy(svr.sun_path, getNetModuleSocket());
384 len = strlen(svr.sun_path) + sizeof(svr.sun_family);
385 bind(sock, (struct sockaddr*)&svr, len);
388 net_sock = accept(sock, (struct sockaddr*)0, (unsigned int*)0);
391 WriteMessage("NETWORK successfully connected");
392 fcntl(net_sock, F_SETFL, O_NONBLOCK|fcntl(net_sock, F_GETFL, 0));
394 setsockopt(net_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof(on));
396 WriteMessage("Cannot connect NETWORK resources");
397 WriteMessage("Exiting...");
399 on_actionQuit_triggered();
404 * Connects to the specified address
405 * Additional window is displayed to connect to the specified address
407 void QKernel::on_actionConnect_triggered()
411 ConnectDialog dialog(this);
412 dialog.setWindowTitle("IP Address:");
415 m.msg_type = MSG_NET;
416 m.param.pword[0] = NET_CONNECT_TO;
417 strcpy(m.param.pstr, dialog.getAddress().toStdString().c_str());
418 write(net_sock, &m, sizeof(MESSAGE));
423 * Disconnects from virtual machine
425 void QKernel::on_actionDisconnect_triggered()
430 WriteMessage("Disconnecting from virtual machine");
432 msg.msg_type = MSG_NET;
433 msg.param.pword[0] = NET_DISCONNECT;
434 write(net_sock, &msg, sizeof(MESSAGE));
438 * Quits process. Closes VLP. Shows additional window to confirm exit.
440 void QKernel::on_actionQuit_triggered()
444 QMessageBox::StandardButton response = QMessageBox::question(this,
447 QMessageBox::Ok | QMessageBox::Cancel
451 if (response == QMessageBox::Cancel) {
455 msg.msg_type = MSG_NET;
456 msg.param.pword[0] = NET_DISCONNECT;
457 write(net_sock, &msg, sizeof(MESSAGE));*/
460 msg.msg_type = MSG_NET;
461 msg.param.pword[0] = NET_EXIT;
462 write(net_sock, &msg, sizeof(MESSAGE));
463 /* ::close(net_sock);*/
464 QApplication::instance()->quit();
468 * Sends message to node.
469 * Additional window is displayed to set Node Number of node where send message,
470 * and textfield to enter message.
472 void QKernel::on_actionMessage_triggered()
478 dlg = new QDialog(this, Qt::Dialog);
479 dlg->setWindowTitle("Send message to node");
481 nodenr = new QLineEdit("number", dlg);
482 nodenr->setGeometry(90, 10, 50, 30);
486 tmpQLabel = new QLabel("Node number:", dlg);
487 tmpQLabel->setGeometry(10, 10, 77, 30);
489 tmpQLabel = new QLabel("Message:", dlg);
490 tmpQLabel->setGeometry(10, 50, 70, 30);
493 msg = new QLineEdit("", dlg);
494 msg->setGeometry(80, 60, 330, 30);
497 ob = new QPushButton("Send", dlg);
498 ob->setGeometry(230, 10, 80, 30);
499 ob->setDefault(TRUE);
502 cb = new QPushButton("Cancel", dlg);
503 cb->setGeometry(330, 10, 80, 30);
504 dlg->resize(430, 110);
505 connect(ob, SIGNAL(clicked()), dlg, SLOT(accept()));
506 connect(cb, SIGNAL(clicked()), dlg, SLOT(reject()));
509 m.msg_type = MSG_NET;
510 m.param.pword[0] = NET_PROPAGATE;
511 m.param.pword[1] = MSG_VLP;
512 m.param.pword[2] = NodeNumber;
513 m.param.pword[4] = atoi(nodenr->text().toAscii().data());
514 m.param.pword[6] = VLP_WRITE;
515 strcpy(m.param.pstr, msg->text().toAscii().data());
516 write(net_sock, &m, sizeof(MESSAGE));
522 * Additional window is displayed to get ID of interpreter which should be
525 void QKernel::on_actionKill_triggered()
527 KillInterpreterDialog dialog(this);
528 dialog.setWindowTitle("Kill interpreter");
532 m.msg_type = MSG_INT;
533 m.param.pword[0] = INT_KILL;
535 InterpEntry *interpreter;
536 interpreter = findINTbyID(dialog.getInterpreterId());
538 if (interpreter != NULL) {
539 if (!(interpreter->remote)) {
540 write(interpreter->sock, &m, sizeof(MESSAGE));
543 WriteMessage("This is a remote instance of a program!");
547 WriteMessage("Interpreter not found");
553 * Sends message to the net module.
555 void QKernel::NetMessage()
558 /* TODO: It has to be rewritten */
563 cnt = read(net_sock, &msg, sizeof(MESSAGE));
564 if ((cnt > 0) && (msg.msg_type == MSG_NET)) {
567 switch(msg.param.pword[0]) {
569 WriteMessage(msg.param.pstr);
572 switch(msg.param.pword[1]) {
574 /* pom = find_link_by_ID(msg.param.pword[5]);
575 msg.msg_type = MSG_NET;
576 msg.param.pword[0] = NET_PROPAGATE;
577 send_int(pom, &msg);*/
580 switch(msg.param.pword[6]) {
582 QApplication::beep();
583 WriteMessage(CharLine);
585 "### Incoming Messsage ###");
586 sprintf(ss, "Mesg from Node %d: %s",
590 WriteMessage(CharLine);
592 case VLP_REMOTE_INSTANCE:
593 sprintf(ss, "%s/%s", getRemoteDir(),
597 WriteMessage("Running program:");
600 pom = RunIntModule(ss, 1);
602 pom->p_ctx.node = msg.param.pword[2];
603 pom->p_ctx.program_id =
605 pom->RInstances[msg.param.pword[2]] = msg.param.pword[7];
608 case VLP_CLOSE_INSTANCE:
609 msg.msg_type = MSG_INT;
610 msg.param.pword[0] = INT_CLOSE_INSTANCE;
611 pom = findINTbyID(msg.param.pword[7]);
613 write(pom->sock, &msg,
616 m1.msg_type = MSG_VLP;
617 m1.param.pword[0] = VLP_INTERPRETER_DOWN;
618 m1.param.pword[1] = pom->ID;
622 WriteMessage("Instance not found");
628 case NET_CONNECTIONS:
629 ActiveConnections = msg.param.pword[1];
630 WriteMessage(msg.param.pstr);
635 /* TODO: It has to be rewritten */
637 QString poms, poms1, poms2;
638 poms.sprintf("%s", msg.param.pstr);
639 while (poms.length() > 0) {
640 cnt = poms.indexOf(';');
642 poms1 = poms.left(cnt);
643 poms = poms.right(poms.length() - cnt - 1);
644 cnt = poms1.indexOf('=');
646 poms2 = poms1.left(cnt);
647 poms1 = poms1.right(poms1.length() - cnt - 1);
648 sprintf(ss, "Node: %s Addr: %s", poms2.toStdString().c_str(), poms1.toStdString().c_str());
656 wait_for_info = FALSE;
657 WriteMessage(CharLine);
664 * Sends message to the interpreter program.
665 * @param sock Interpreter socket to whom the message will be send.
667 void QKernel::IntMessage(int sock)
673 cnt = read(sock, &msg, sizeof(MESSAGE));
674 e = findINTbySocket(sock);
675 if ((cnt > 0) && (e != NULL)) {
676 switch (msg.msg_type) {
678 if (msg.param.pword[0] == GRAPH_ALLOCATE) {
679 RunGraphModule(msg.param.pstr);
683 write(net_sock, &msg, sizeof(MESSAGE));
686 switch(msg.param.pword[0]) {
687 case VLP_REMOTE_INSTANCE_PLEASE:
688 RemoteInstance(e, msg.param.pword[2]);
693 switch(msg.param.pword[0]) {
698 m.msg_type = MSG_VLP;
699 m.param.pword[0] = VLP_INTERPRETER_DOWN;
700 m.param.pword[1] = e->ID;
701 write(net_sock, &m, sizeof(MESSAGE));
706 /* TODO: Check this */
707 Interpreters.removeOne(e);
711 sprintf(ss, "%s : End of program "
712 "execution", msg.param.pstr);
717 msg.msg_type = MSG_INT;
718 msg.param.pword[0] = INT_CTX;
719 msg.param.pword[1] = NodeNumber;
720 msg.param.pword[2] = e->ID;
722 msg.param.pword[3] = e->p_ctx.node;
726 write(sock, &msg, sizeof(MESSAGE));
735 * Writes message to kernel logger.
736 * @parame msg String with message to log
738 void QKernel::WriteMessage(const char *msg)
742 x = desktop->textCursor().blockNumber();
743 // y = desktop->textCursor().columnNumber();
749 desktop->setReadOnly(FALSE);
750 desktop->append(msg);
751 desktop->setReadOnly(TRUE);
753 QTextCursor tmpCursor = desktop->textCursor();
754 tmpCursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
755 desktop->setTextCursor(tmpCursor);
759 if (desktop->document()->blockCount() > 100) {
765 * Adds checkbox to menu item. If it is checked additional info messages are
768 void QKernel::on_actionInfo_messages_triggered()
770 if (toolsMenu != NULL) {
771 info_messages = actionInfo_messages->isChecked();
772 actionInfo_messages->setChecked(info_messages);
777 * Allows to set options in GUI window.
778 * Additional window is displayed to set kernel options which are saved in
779 * vlp.cfg file in kernel executable directory.
781 void QKernel::on_actionOptions_triggered()
783 OptionsDialog optionsDialog(getConfigFilePath(), this);
784 if (optionsDialog.exec()) {
785 optionsDialog.saveConfig(getConfigFilePath());
787 loadConfig(getConfigFilePath());
792 * Locks kernel program.
793 * Additional window is displayed to enter password and retype it. If both are
794 * same kernel window is locked.
796 void QKernel::on_actionLock_console_triggered()
798 LockDialog lockDialog(this);
800 if (lockDialog.exec()) {
801 QString password = lockDialog.getPassword();
802 if (lockDialog.getPassword().size() > 0) {
803 strcpy(LockPasswd, password.toStdString().c_str());
806 if (lockDialog.exec()) {
807 password = lockDialog.getPassword();
808 if (password == LockPasswd) {
810 WriteMessage("CONSOLE LOCKED");
812 QMessageBox msg(this);
813 msg.setText("Not matching!");
814 msg.setButtonText(0, "Close");
816 strcpy(LockPasswd, "");
819 strcpy(LockPasswd, "");
826 * Unlocks kernel program.
827 * Additional window is displayed to enter password. If it is correct, kernel
830 void QKernel::on_actionUnlock_console_triggered()
832 LockDialog lockDialog(this);
834 if (lockDialog.exec()) {
835 QString password = lockDialog.getPassword();
836 if (strcmp(password.toStdString().c_str(), LockPasswd) == 0) {
838 WriteMessage("CONSOLE UNLOCKED");
840 QMessageBox msg(this);
841 msg.setText("Wrong password!");
842 msg.setButtonText(0, "Close");
849 * Finds Interpreter by its socket
850 * @param _id ID of the socket
851 * @return returns pointer to the found interpreter slot. NULL otherwise
853 InterpEntry *QKernel::findINTbySocket(int _id)
855 InterpEntry *pom = NULL;
857 for (auto interpreter : Interpreters) {
858 if (interpreter->sock == _id) {
868 * Finds Interpreter by its ID.
869 * @param _id ID of the interpreter
870 * @return returns pointer to the found interpreter slot. NULL otherwise
872 InterpEntry *QKernel::findINTbyID(int _id)
874 InterpEntry *pom = NULL;
876 for (auto interpreter : Interpreters) {
877 if (interpreter->ID == _id) {
888 * Connects interpreter
889 * @param ss full filepath with filename but without extension of the loglan
891 * @param r Interpreter execution mode. 0 if it will be local instance, 1 if
893 * @return Returns pointer to newly created interpreter slot, or NULL on error.
895 InterpEntry *QKernel::RunIntModule(char *ss, int r)
898 struct sockaddr_un svr;
905 InterpEntry *newINT = NULL;
911 WriteMessage("File not found: no .ccd file");
920 WriteMessage("File not found: no .pcd file");
925 newINT = new InterpEntry;
926 for(i = 0; i < MAXINSTANCES; i++)
927 newINT->RInstances[i] =- 1;
929 strcpy(b, rindex(ss, '/'));
930 for(i = 0; i < strlen(b); i++)
933 sprintf(a, "%s : Start execution", b);
940 strcpy(newINT->shortname, b);
941 strcpy(newINT->fullname, ss);
943 sprintf(a, "%s%d", IPATH, newint);
944 sprintf(cmd, "%s/modules/logint %s %s",
951 sprintf(b, " %s %s %s %s %s",
952 myargs[0], myargs[1], myargs[2], myargs[3], myargs[4]);
956 sock = socket(AF_UNIX, SOCK_STREAM, 0);
958 bzero(&svr, sizeof(svr));
959 svr.sun_family = AF_UNIX;
960 strcpy(svr.sun_path, a);
961 len = strlen(svr.sun_path)+sizeof(svr.sun_family);
962 bind(sock, (struct sockaddr*)&svr, len);
965 newINT->sock = accept(sock, (struct sockaddr*)0, (unsigned int *)0);
968 if (newINT->sock > 0) {
969 fcntl(newINT->sock, F_SETFL,
970 O_NONBLOCK|fcntl(newINT->sock, F_GETFL, 0));
972 setsockopt(newINT->sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on,
979 bzero(&msg, sizeof(MESSAGE));
980 msg.msg_type = MSG_VLP;
981 msg.param.pword[0] = VLP_REGINT;
982 msg.param.pword[1] = newINT->ID;
983 sprintf(msg.param.pstr, "logi%d.net", newint);
984 write(net_sock, &msg, sizeof(MESSAGE));
986 Interpreters.append(newINT);
987 newINT->notify = new QSocketNotifier(newINT->sock,
988 QSocketNotifier::Read);
989 connect(newINT->notify, SIGNAL(activated(int)), this,
990 SLOT(IntMessage(int)));
992 WriteMessage("INTERPRETER successfully connected");
994 WriteMessage("Cannot connect interpreter");
1001 * Allocates remote instance of interpreter
1002 * @param interp Interpreter slot
1003 * @param on Node Number
1005 void QKernel::RemoteInstance(InterpEntry *interp, int on)
1009 m.msg_type = MSG_NET;
1010 m.param.pword[0] = NET_NODE_EXIST;
1011 m.param.pword[1] = on;
1012 m.param.pword[2] = interp->ID;
1013 write(net_sock, &m, sizeof(MESSAGE));
1014 bzero(&m, sizeof(MESSAGE));
1015 while((m.msg_type!=MSG_NET) && (m.param.pword[0]!=NET_NODE_EXIST))
1016 read(net_sock, &m, sizeof(MESSAGE));
1018 /* means node exists */
1019 if (m.param.pword[1] == 1) {
1020 m.msg_type = MSG_NET;
1021 m.param.pword[0] = NET_TRANSMIT_CODE;
1022 m.param.pword[1] = interp->ID;
1023 m.param.pword[2] = on;
1024 strcpy(m.param.pstr, interp->fullname);
1025 write(net_sock, &m, sizeof(MESSAGE));
1027 Net_Notify->setEnabled(FALSE);
1028 while ((m.msg_type != MSG_NET) ||
1029 (m.param.pword[0] != NET_TRANSMITTED))
1030 read(net_sock, &m, sizeof(MESSAGE));
1032 m.msg_type = MSG_NET;
1033 m.param.pword[0] = NET_PROPAGATE;
1034 m.param.pword[1] = MSG_VLP;
1035 m.param.pword[2] = NodeNumber;
1036 m.param.pword[3] = 0;
1037 m.param.pword[4] = on;
1038 m.param.pword[5] = 0;
1039 m.param.pword[6] = VLP_REMOTE_INSTANCE;
1040 m.param.pword[7] = interp->ID;
1041 strcpy(m.param.pstr, interp->shortname);
1042 write(net_sock, &m, sizeof(MESSAGE));
1044 read(net_sock, &m, sizeof(MESSAGE));
1046 if ((m.param.pword[0] == NET_PROPAGATE) &&
1047 (m.param.pword[6] == VLP_REMOTE_INSTANCE_OK)) {
1048 interp->RInstances[on] = m.param.pword[7];
1051 read(net_sock, &m, sizeof(MESSAGE));
1054 Net_Notify->setEnabled(TRUE);
1056 /*bzero(&m, sizeof(MESSAGE));*/
1057 m.msg_type = MSG_VLP;
1058 m.param.pword[0] = VLP_REMOTE_INSTANCE_HERE;
1059 m.param.pword[1] = interp->RInstances[on];
1060 write(interp->sock, &m, sizeof(MESSAGE));
1061 } else { /* There is no such a node! */
1063 sprintf(s, "Warning: Node number %d not found!", on);
1065 WriteMessage("Allocating O-process on the local node");
1066 bzero(&m, sizeof(MESSAGE));
1067 m.msg_type = MSG_VLP;
1068 m.param.pword[0] = VLP_REMOTE_INSTANCE_HERE;
1069 m.param.pword[1] = interp->ID;
1070 write(interp->sock, &m, sizeof(MESSAGE));
1075 * Closes all remote instances
1077 void QKernel::CloseInstances(InterpEntry *e)
1083 WriteMessage("Closing remote instances");
1085 for(i=0; i < MAXINSTANCES; i++)
1086 if (e->RInstances[i]>=0) {
1087 msg.msg_type = MSG_NET;
1088 msg.param.pword[0] = NET_PROPAGATE;
1089 msg.param.pword[1] = MSG_VLP;
1090 msg.param.pword[2] = NodeNumber;
1091 msg.param.pword[4] = i;
1092 msg.param.pword[6] = VLP_CLOSE_INSTANCE;
1093 msg.param.pword[7] = e->RInstances[i];
1094 write(net_sock, &msg, sizeof(MESSAGE));
1099 * Displays information about virtual machine
1101 void QKernel::on_actionInfo_triggered()
1105 WriteMessage(CharLine);
1106 WriteMessage("### Virtual Machine Information ###");
1107 m.msg_type = MSG_NET;
1108 m.param.pword[0] = NET_GET_INFO;
1109 write(net_sock, &m, sizeof(MESSAGE));
1110 wait_for_info = TRUE;
1114 * Program main function
1115 * All program arguments but the first one (argv[0]: program name) are saved and
1116 * passed to all dependent programs on their invocation.
1117 * @param argc Number of program arguments
1118 * @param argv Program arguments
1120 int main(int argc, char **argv)
1124 QApplication * app = new QApplication(argc, argv);
1125 QKernel kernel(argc, argv);