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"
69 #include "ConnectDialog.h"
70 #include "KillDialog.h"
71 #include "LockDialog.h"
72 #include "OptionsDialog.h"
73 #include "MessageDialog.h"
75 #include "vlp/config.h"
76 #include "vlp/QtConfigurationFinder.h"
77 #include "vlp/exception/ConfigFileNotFound.h"
79 #include <sys/prctl.h>
80 /* File resides in top directory (where are Makefiles)*/
81 #include "../../config.h"
87 char CharLine[25] = "________________________";
90 * Event invoked on program close.
91 * Closes application. Displays additional window to confirm exit.
93 void QKernel::closeEvent(QCloseEvent * e)
98 on_actionQuit_triggered();
102 void QKernel::setLocked(bool locked)
106 actionQuit->setDisabled(locked);
108 actionExecute->setDisabled(locked);
109 actionKill->setDisabled(locked);
110 actionMessage->setDisabled(locked);
111 actionConnect->setDisabled(locked);
112 actionDisconnect->setDisabled(locked);
113 actionInfo->setDisabled(locked);
116 /* Enable only menu entry for unlocking */
117 actionEditor->setDisabled(locked);
118 actionOptions->setDisabled(locked);
119 actionLock_console->setDisabled(locked);
120 actionUnlock_console->setDisabled(!locked);
124 * Kernel program constructor.
125 * Prepares everything to work.
127 QKernel::QKernel(int argc, char **argv)
132 for(i = 0; (i < 5) && (i < argc-1); i++) {
133 strcpy(myargs[i], "");
135 strcpy(myargs[i], argv[i+1]);
139 loglan::vlp::QtConfigurationFinder configFinder;
140 configFinder.initSearchDirs();
142 QDir q(getRemoteDir());
145 q.mkpath(getRemoteDir());
148 info_messages = actionInfo_messages->isChecked();
149 wait_for_info = FALSE;
151 setWindowTitle(PACKAGE_NAME);
157 ActiveConnections = 0;
158 strcpy(LockPasswd, "");
160 loadConfig(configFinder.findConfig().c_str());
164 Net_Notify = new QSocketNotifier(net_sock, QSocketNotifier::Read, this);
165 connect(Net_Notify, SIGNAL(activated(int)), this, SLOT(NetMessage()));
167 WriteMessage("\n " PACKAGE_STRING ": READY \n");
170 QString QKernel::getConfigFilePath()
172 return homeDir.absoluteFilePath("vlp.cfg");
175 const char * QKernel::getHomeDir()
177 return homeDir.absolutePath().toStdString().c_str();
180 const char * QKernel::getRemoteDir()
182 return homeDir.absoluteFilePath(REMOTE_PATH).toStdString().c_str();
185 const char * QKernel::getNetModuleSocket()
187 return homeDir.absoluteFilePath(NPATH).toStdString().c_str();
190 const char * QKernel::getGraphModuleSocket()
192 return homeDir.absoluteFilePath(GPATH).toStdString().c_str();
195 void QKernel::loadConfig(const QString & fname)
197 loadConfig(fname.toStdString().c_str());
200 * Loads configuration from the given file.
201 * @param fname Filename of the configuration file.
203 void QKernel::loadConfig(const char * fname)
205 loglan::vlp::Config config;
206 if(config.load(fname)) {
207 NodeNumber = config.getNodeNumber();
208 ConType = config.getConnectionType();
211 std::vector<std::string> hosts = config.getHosts();
212 for (unsigned int i = 0; i < hosts.size(); i++) {
213 ConnectList.append(new ConnectEntry(hosts[i].c_str()));
216 strncpy(progdir, config.getProgramDir(), 256);
218 homeDir = QDir(QCoreApplication::applicationDirPath());
224 * Additional window id displayed to set which code to execute.
226 void QKernel::on_actionExecute_triggered()
228 QString s = QFileDialog::getOpenFileName(this, "Execute", progdir, "*.log");
231 int i = s.indexOf(".log");
236 // @TODO: if no interpreter is running will result in killing app
237 RunIntModule((char*)s.toAscii().data(), 0);
242 * Invokes editor program
244 void QKernel::on_actionEditor_triggered()
246 QString program = getHomeDir();
247 program += "/modules/logedit";
249 fprintf(stderr, "Run EDIT Module: %s, %s\n", program.toStdString().c_str(), getHomeDir());
252 if (execl(program.toStdString().c_str(),
262 WriteMessage("Executing logedit failed!");
266 WriteMessage("fork(logedit) failed!");
267 WriteMessage("Exiting...");
269 on_actionQuit_triggered();
275 * Invokes help program
277 void QKernel::on_actionHelp_triggered()
279 QString program = getHomeDir();
280 program += "/modules/loghelp";
282 QString docDir = getHomeDir();
285 fprintf(stderr, "Run HELP Module: %s, %s\n", program.toStdString().c_str(), docDir.toStdString().c_str());
289 if (execl(program.toStdString().c_str(),
291 docDir.toStdString().c_str(),
300 WriteMessage("Executing loghelp failed!");
304 WriteMessage("fork(loghelp) failed!");
305 WriteMessage("Exiting...");
307 on_actionQuit_triggered();
313 * Invokes graphics module
315 void QKernel::RunGraphModule(char *sk)
317 QString program = getHomeDir();
318 program += "/modules/loggraph";
320 fprintf(stderr, "Run GRAPH Module: %s, %s\n", program.toStdString().c_str(), sk);
324 if (execl(program.toStdString().c_str(),
335 WriteMessage("Executing loggraph failed!");
336 WriteMessage("Exiting...");
338 on_actionQuit_triggered();
342 WriteMessage("fork(loggraph) failed!");
343 WriteMessage("Exiting...");
345 on_actionQuit_triggered();
353 void QKernel::RunNetModule()
356 struct sockaddr_un svr;
361 QString program = getHomeDir();
362 program += "/modules/lognet";
364 fprintf(stderr, "Run NET Module: %s, %s %s\n", program.toStdString().c_str(), getNetModuleSocket(), getConfigFilePath().toStdString().c_str());
367 if (execl(program.toStdString().c_str(),
369 getNetModuleSocket(),
370 getConfigFilePath().toStdString().c_str(),
379 WriteMessage("Executing lognet failed!");
380 WriteMessage("Exiting...");
382 on_actionQuit_triggered();
386 WriteMessage("fork(lognet) failed!");
387 WriteMessage("Exiting...");
389 on_actionQuit_triggered();
393 /* -------- socket for NET module -------- */
394 unlink(getNetModuleSocket());
395 sock = socket(AF_UNIX, SOCK_STREAM, 0);
396 bzero(&svr, sizeof(svr));
397 svr.sun_family = AF_UNIX;
398 strcpy(svr.sun_path, getNetModuleSocket());
399 len = strlen(svr.sun_path) + sizeof(svr.sun_family);
400 bind(sock, (struct sockaddr*)&svr, len);
403 net_sock = accept(sock, (struct sockaddr*)0, (unsigned int*)0);
406 WriteMessage("NETWORK successfully connected");
407 fcntl(net_sock, F_SETFL, O_NONBLOCK|fcntl(net_sock, F_GETFL, 0));
409 setsockopt(net_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof(on));
411 WriteMessage("Cannot connect NETWORK resources");
412 WriteMessage("Exiting...");
414 on_actionQuit_triggered();
419 * Connects to the specified address
420 * Additional window is displayed to connect to the specified address
422 void QKernel::on_actionConnect_triggered()
426 dialog::ConnectDialog dialog(this);
429 m.msg_type = MSG_NET;
430 m.param.pword[0] = NET_CONNECT_TO;
431 strcpy(m.param.pstr, dialog.getAddress().toStdString().c_str());
432 write(net_sock, &m, sizeof(MESSAGE));
437 * Disconnects from virtual machine
439 void QKernel::on_actionDisconnect_triggered()
444 WriteMessage("Disconnecting from virtual machine");
446 msg.msg_type = MSG_NET;
447 msg.param.pword[0] = NET_DISCONNECT;
448 write(net_sock, &msg, sizeof(MESSAGE));
452 * Quits process. Closes VLP. Shows additional window to confirm exit.
454 void QKernel::on_actionQuit_triggered()
458 QMessageBox::StandardButton response = QMessageBox::question(this,
461 QMessageBox::Ok | QMessageBox::Cancel
465 if (response == QMessageBox::Cancel) {
469 msg.msg_type = MSG_NET;
470 msg.param.pword[0] = NET_DISCONNECT;
471 write(net_sock, &msg, sizeof(MESSAGE));*/
474 msg.msg_type = MSG_NET;
475 msg.param.pword[0] = NET_EXIT;
476 write(net_sock, &msg, sizeof(MESSAGE));
477 /* ::close(net_sock);*/
478 QApplication::instance()->quit();
482 * Sends message to node.
483 * Additional window is displayed to set Node Number of node where send message,
484 * and textfield to enter message.
486 void QKernel::on_actionMessage_triggered()
488 dialog::MessageDialog dialog(this);
492 m.msg_type = MSG_NET;
493 m.param.pword[0] = NET_PROPAGATE;
494 m.param.pword[1] = MSG_VLP;
495 m.param.pword[2] = NodeNumber;
496 m.param.pword[4] = dialog.getNodeNumber();
497 m.param.pword[6] = VLP_WRITE;
498 strcpy(m.param.pstr, dialog.getMessage().toStdString().c_str());
499 write(net_sock, &m, sizeof(MESSAGE));
505 * Additional window is displayed to get ID of interpreter which should be
508 void QKernel::on_actionKill_triggered()
510 dialog::KillInterpreterDialog dialog(this);
514 m.msg_type = MSG_INT;
515 m.param.pword[0] = INT_KILL;
517 InterpEntry *interpreter;
518 interpreter = findINTbyID(dialog.getInterpreterId());
520 if (interpreter != NULL) {
521 if (!(interpreter->remote)) {
522 write(interpreter->sock, &m, sizeof(MESSAGE));
525 WriteMessage("This is a remote instance of a program!");
529 WriteMessage("Interpreter not found");
535 * Sends message to the net module.
537 * \todo method needs to be refactored
539 void QKernel::NetMessage()
542 /* TODO: It has to be rewritten */
547 cnt = read(net_sock, &msg, sizeof(MESSAGE));
548 if ((cnt > 0) && (msg.msg_type == MSG_NET)) {
551 switch(msg.param.pword[0]) {
553 WriteMessage(msg.param.pstr);
556 switch(msg.param.pword[1]) {
558 /* pom = find_link_by_ID(msg.param.pword[5]);
559 msg.msg_type = MSG_NET;
560 msg.param.pword[0] = NET_PROPAGATE;
561 send_int(pom, &msg);*/
564 switch(msg.param.pword[6]) {
566 QApplication::beep();
567 WriteMessage(CharLine);
568 WriteMessage("### Incoming Messsage ###");
570 "Mesg from Node %d: %s",
575 WriteMessage(CharLine);
577 case VLP_REMOTE_INSTANCE:
578 sprintf(ss, "%s/%s", getRemoteDir(), msg.param.pstr);
581 WriteMessage("Running program:");
584 pom = RunIntModule(ss, 1);
586 pom->p_ctx.node = msg.param.pword[2];
587 pom->p_ctx.program_id =
589 pom->RInstances[msg.param.pword[2]] = msg.param.pword[7];
592 case VLP_CLOSE_INSTANCE:
593 msg.msg_type = MSG_INT;
594 msg.param.pword[0] = INT_CLOSE_INSTANCE;
595 pom = findINTbyID(msg.param.pword[7]);
597 write(pom->sock, &msg,
600 m1.msg_type = MSG_VLP;
601 m1.param.pword[0] = VLP_INTERPRETER_DOWN;
602 m1.param.pword[1] = pom->ID;
606 WriteMessage("Instance not found");
612 case NET_CONNECTIONS:
613 ActiveConnections = msg.param.pword[1];
614 WriteMessage(msg.param.pstr);
619 /* TODO: It has to be rewritten */
621 QString poms, poms1, poms2;
622 poms.sprintf("%s", msg.param.pstr);
623 while (poms.length() > 0) {
624 cnt = poms.indexOf(';');
626 poms1 = poms.left(cnt);
627 poms = poms.right(poms.length() - cnt - 1);
628 cnt = poms1.indexOf('=');
630 poms2 = poms1.left(cnt);
631 poms1 = poms1.right(poms1.length() - cnt - 1);
632 sprintf(ss, "Node: %s Addr: %s", poms2.toStdString().c_str(), poms1.toStdString().c_str());
640 wait_for_info = FALSE;
641 WriteMessage(CharLine);
648 * Sends message to the interpreter program.
649 * @param sock Interpreter socket to whom the message will be send.
651 void QKernel::IntMessage(int sock)
657 cnt = read(sock, &msg, sizeof(MESSAGE));
658 e = findINTbySocket(sock);
659 if ((cnt > 0) && (e != NULL)) {
660 switch (msg.msg_type) {
662 if (msg.param.pword[0] == GRAPH_ALLOCATE) {
663 fprintf(stderr, "Running graph module with arg: %s\n", msg.param.pstr);
664 RunGraphModule(msg.param.pstr);
668 write(net_sock, &msg, sizeof(MESSAGE));
671 switch(msg.param.pword[0]) {
672 case VLP_REMOTE_INSTANCE_PLEASE:
673 RemoteInstance(e, msg.param.pword[2]);
678 switch(msg.param.pword[0]) {
681 m.msg_type = MSG_VLP;
682 m.param.pword[0] = VLP_INTERPRETER_DOWN;
683 m.param.pword[1] = e->ID;
684 write(net_sock, &m, sizeof(MESSAGE));
689 /* TODO: Check this */
690 Interpreters.removeOne(e);
695 sprintf(ss, "%s : End of program "
696 "execution", msg.param.pstr);
701 msg.msg_type = MSG_INT;
702 msg.param.pword[0] = INT_CTX;
703 msg.param.pword[1] = NodeNumber;
704 msg.param.pword[2] = e->ID;
706 msg.param.pword[3] = e->p_ctx.node;
710 write(sock, &msg, sizeof(MESSAGE));
719 * Writes message to kernel logger.
720 * @parame msg String with message to log
722 void QKernel::WriteMessage(const char *msg)
726 x = desktop->textCursor().blockNumber();
727 // y = desktop->textCursor().columnNumber();
733 desktop->setReadOnly(FALSE);
734 desktop->append(msg);
735 desktop->setReadOnly(TRUE);
737 QTextCursor tmpCursor = desktop->textCursor();
738 tmpCursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
739 desktop->setTextCursor(tmpCursor);
743 if (desktop->document()->blockCount() > 100) {
749 * Adds checkbox to menu item. If it is checked additional info messages are
752 void QKernel::on_actionInfo_messages_triggered()
754 if (toolsMenu != NULL) {
755 info_messages = actionInfo_messages->isChecked();
756 actionInfo_messages->setChecked(info_messages);
761 * Allows to set options in GUI window.
762 * Additional window is displayed to set kernel options which are saved in
763 * vlp.cfg file in kernel executable directory.
765 void QKernel::on_actionOptions_triggered()
767 dialog::OptionsDialog optionsDialog(getConfigFilePath(), this);
768 if (optionsDialog.exec()) {
769 optionsDialog.saveConfig(getConfigFilePath());
771 loadConfig(getConfigFilePath());
776 * Locks kernel program.
777 * Additional window is displayed to enter password and retype it. If both are
778 * same kernel window is locked.
780 void QKernel::on_actionLock_console_triggered()
782 dialog::LockDialog lockDialog(this);
784 if (lockDialog.exec()) {
785 QString password = lockDialog.getPassword();
786 if (lockDialog.getPassword().size() > 0) {
787 strcpy(LockPasswd, password.toStdString().c_str());
790 if (lockDialog.exec()) {
791 password = lockDialog.getPassword();
792 if (password == LockPasswd) {
794 WriteMessage("CONSOLE LOCKED");
796 QMessageBox msg(this);
797 msg.setText("Not matching!");
798 msg.setButtonText(0, "Close");
800 strcpy(LockPasswd, "");
803 strcpy(LockPasswd, "");
810 * Unlocks kernel program.
811 * Additional window is displayed to enter password. If it is correct, kernel
814 void QKernel::on_actionUnlock_console_triggered()
816 dialog::LockDialog lockDialog(this);
818 if (lockDialog.exec()) {
819 QString password = lockDialog.getPassword();
820 if (strcmp(password.toStdString().c_str(), LockPasswd) == 0) {
822 WriteMessage("CONSOLE UNLOCKED");
824 QMessageBox msg(this);
825 msg.setText("Wrong password!");
826 msg.setButtonText(0, "Close");
833 * Finds Interpreter by its socket
834 * @param _id ID of the socket
835 * @return returns pointer to the found interpreter slot. NULL otherwise
837 InterpEntry *QKernel::findINTbySocket(int _id)
839 InterpEntry *pom = NULL;
841 for (auto interpreter : Interpreters) {
842 if (interpreter->sock == _id) {
852 * Finds Interpreter by its ID.
853 * @param _id ID of the interpreter
854 * @return returns pointer to the found interpreter slot. NULL otherwise
856 InterpEntry *QKernel::findINTbyID(int _id)
858 InterpEntry *pom = NULL;
860 for (auto interpreter : Interpreters) {
861 if (interpreter->ID == _id) {
872 * Connects interpreter
873 * @param ss full filepath with filename but without extension of the loglan
875 * @param r Interpreter execution mode. 0 if it will be local instance, 1 if
877 * @return Returns pointer to newly created interpreter slot, or NULL on error.
879 InterpEntry *QKernel::RunIntModule(char *ss, int r)
881 fprintf(stderr, "Run INT Module: %s, %d\n", ss, r);
883 struct sockaddr_un svr;
890 InterpEntry *newINT = NULL;
896 WriteMessage("File not found: no .ccd file");
905 WriteMessage("File not found: no .pcd file");
910 newINT = new InterpEntry;
911 for(i = 0; i < MAXINSTANCES; i++)
912 newINT->RInstances[i] =- 1;
914 strcpy(b, rindex(ss, '/'));
915 for(i = 0; i < strlen(b); i++)
918 sprintf(a, "%s : Start execution", b);
925 strcpy(newINT->shortname, b);
926 strcpy(newINT->fullname, ss);
928 sprintf(a, "%s%d", homeDir.absoluteFilePath(IPATH).toStdString().c_str(), newint);
929 sprintf(cmd, "%s/modules/logint %s %s",
936 // sprintf(b, " %s %s %s %s %s",
937 // myargs[0], myargs[1], myargs[2], myargs[3], myargs[4]);
938 // sprintf(cmd, "%s %s", cmd, b);
940 fprintf(stderr, "%s\n", cmd);
943 sock = socket(AF_UNIX, SOCK_STREAM, 0);
945 bzero(&svr, sizeof(svr));
946 svr.sun_family = AF_UNIX;
947 strcpy(svr.sun_path, a);
948 len = strlen(svr.sun_path)+sizeof(svr.sun_family);
949 bind(sock, (struct sockaddr*)&svr, len);
952 newINT->sock = accept(sock, (struct sockaddr*)0, (unsigned int *)0);
955 if (newINT->sock > 0) {
956 fcntl(newINT->sock, F_SETFL,
957 O_NONBLOCK|fcntl(newINT->sock, F_GETFL, 0));
959 setsockopt(newINT->sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on,
966 bzero(&msg, sizeof(MESSAGE));
967 msg.msg_type = MSG_VLP;
968 msg.param.pword[0] = VLP_REGINT;
969 msg.param.pword[1] = newINT->ID;
970 sprintf(msg.param.pstr, "logi%d.net", newint);
971 write(net_sock, &msg, sizeof(MESSAGE));
973 Interpreters.append(newINT);
974 newINT->notify = new QSocketNotifier(newINT->sock,
975 QSocketNotifier::Read);
976 connect(newINT->notify, SIGNAL(activated(int)), this,
977 SLOT(IntMessage(int)));
979 WriteMessage("INTERPRETER successfully connected");
981 WriteMessage("Cannot connect interpreter");
988 * Allocates remote instance of interpreter
989 * @param interp Interpreter slot
990 * @param on Node Number
992 void QKernel::RemoteInstance(InterpEntry *interp, int on)
996 m.msg_type = MSG_NET;
997 m.param.pword[0] = NET_NODE_EXIST;
998 m.param.pword[1] = on;
999 m.param.pword[2] = interp->ID;
1000 write(net_sock, &m, sizeof(MESSAGE));
1001 bzero(&m, sizeof(MESSAGE));
1002 while((m.msg_type!=MSG_NET) && (m.param.pword[0]!=NET_NODE_EXIST))
1003 read(net_sock, &m, sizeof(MESSAGE));
1005 /* means node exists */
1006 if (m.param.pword[1] == 1) {
1007 m.msg_type = MSG_NET;
1008 m.param.pword[0] = NET_TRANSMIT_CODE;
1009 m.param.pword[1] = interp->ID;
1010 m.param.pword[2] = on;
1011 strcpy(m.param.pstr, interp->fullname);
1012 write(net_sock, &m, sizeof(MESSAGE));
1014 Net_Notify->setEnabled(FALSE);
1015 while ((m.msg_type != MSG_NET) ||
1016 (m.param.pword[0] != NET_TRANSMITTED))
1017 read(net_sock, &m, sizeof(MESSAGE));
1019 m.msg_type = MSG_NET;
1020 m.param.pword[0] = NET_PROPAGATE;
1021 m.param.pword[1] = MSG_VLP;
1022 m.param.pword[2] = NodeNumber;
1023 m.param.pword[3] = 0;
1024 m.param.pword[4] = on;
1025 m.param.pword[5] = 0;
1026 m.param.pword[6] = VLP_REMOTE_INSTANCE;
1027 m.param.pword[7] = interp->ID;
1028 strcpy(m.param.pstr, interp->shortname);
1029 write(net_sock, &m, sizeof(MESSAGE));
1031 read(net_sock, &m, sizeof(MESSAGE));
1033 if ((m.param.pword[0] == NET_PROPAGATE) &&
1034 (m.param.pword[6] == VLP_REMOTE_INSTANCE_OK)) {
1035 interp->RInstances[on] = m.param.pword[7];
1038 read(net_sock, &m, sizeof(MESSAGE));
1041 Net_Notify->setEnabled(TRUE);
1043 /*bzero(&m, sizeof(MESSAGE));*/
1044 m.msg_type = MSG_VLP;
1045 m.param.pword[0] = VLP_REMOTE_INSTANCE_HERE;
1046 m.param.pword[1] = interp->RInstances[on];
1047 write(interp->sock, &m, sizeof(MESSAGE));
1048 } else { /* There is no such a node! */
1050 sprintf(s, "Warning: Node number %d not found!", on);
1052 WriteMessage("Allocating O-process on the local node");
1053 bzero(&m, sizeof(MESSAGE));
1054 m.msg_type = MSG_VLP;
1055 m.param.pword[0] = VLP_REMOTE_INSTANCE_HERE;
1056 m.param.pword[1] = interp->ID;
1057 write(interp->sock, &m, sizeof(MESSAGE));
1062 * Closes all remote instances
1064 void QKernel::CloseInstances(InterpEntry *e)
1070 WriteMessage("Closing remote instances");
1072 for(i=0; i < MAXINSTANCES; i++)
1073 if (e->RInstances[i]>=0) {
1074 msg.msg_type = MSG_NET;
1075 msg.param.pword[0] = NET_PROPAGATE;
1076 msg.param.pword[1] = MSG_VLP;
1077 msg.param.pword[2] = NodeNumber;
1078 msg.param.pword[4] = i;
1079 msg.param.pword[6] = VLP_CLOSE_INSTANCE;
1080 msg.param.pword[7] = e->RInstances[i];
1081 write(net_sock, &msg, sizeof(MESSAGE));
1086 * Displays information about virtual machine
1088 void QKernel::on_actionInfo_triggered()
1092 WriteMessage(CharLine);
1093 WriteMessage("### Virtual Machine Information ###");
1094 m.msg_type = MSG_NET;
1095 m.param.pword[0] = NET_GET_INFO;
1096 write(net_sock, &m, sizeof(MESSAGE));
1097 wait_for_info = TRUE;
1104 * Program main function
1105 * All program arguments but the first one (argv[0]: program name) are saved and
1106 * passed to all dependent programs on their invocation.
1107 * @param argc Number of program arguments
1108 * @param argv Program arguments
1110 int main(int argc, char **argv)
1114 QApplication * app = new QApplication(argc, argv);
1115 loglan::vlp::QKernel kernel(argc, argv);