char CharLine[25] = "________________________";
char myargs[5][255];
-
-/* --------------- interpreter slot -----------------*/
+/**
+ * Interpreter slot
+ */
class InterpEntry {
public:
- /* INT identifier */
+ /** Interpreter identifier */
int ID;
- /* Am I remote ? */
+ /** Defines if interpreter is remote or not */
bool remote;
/* Program name */
char fullname[255];
QSocketNotifier *notify;
/* IDs of my remote INT modules */
int RInstances[MAXINSTANCES];
- /* parent INT info */
+ /* Parent interpreter info */
ctx_struct p_ctx;
};
-/*++++++++++++++++++++++++++++++++++++++++++*/
-/*----------------- connection slot -------------*/
+/**
+ * Connection slot
+ */
class ConnectEntry {
public:
char addr[256];
};
};
-/* ++++++++++++++++++++++++++++++++++++++++++ */
-
QApplication *app;
-
-/* ---------------------------------------------------------- */
-/* KERNEL CLASS DEFINITION */
-/* ---------------------------------------------------------- */
-
+/**
+ * Kernel class
+ */
class QKernel : public QFrame {
Q_OBJECT
public:
- QMultiLineEdit *desktop;
- QMenuBar *bar;
+ QMultiLineEdit *desktop;
+ QMenuBar *bar;
QPopupMenu *p;
QPopupMenu *p1;
QPopupMenu *p2;
- char progdir[256];
+ char progdir[256];
int NodeNumber;
int ConType;
void RemoteInstance(InterpEntry*, int);
void CloseInstances(InterpEntry*);
};
-/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
-void QKernel::closeEvent (QCloseEvent * e)
+/**
+ * Event invoked on program close.
+ * @copydoc QWidget::closeEvent(QCloseEvent*)
+ */
+void QKernel::closeEvent(QCloseEvent * e)
{
e->ignore();
}
+/**
+ * Kernel program constructor.
+ * Prepares everything to work.
+ */
QKernel::QKernel()
{
QFont f("Helvetica", 10, QFont::Bold);
connect(Net_Notify, SIGNAL(activated(int)), this, SLOT(NetMessage()));
}
+/**
+ * Event invoked on resizing kernel application window.
+ * @copydoc QWidget::resizeEvent(QResizeEvent*)
+ */
void QKernel::resizeEvent(QResizeEvent *ev)
{
QFrame::resizeEvent(ev);
height() - bar->height());
}
+/**
+ * Displays window with information about not implemented functionality.
+ */
void QKernel::n_impl()
{
QMessageBox::information(this, "Function info", "This function is not "
"implemented yet...", "Ok");
}
-
-/* ########### load configuration from file ############# */
-
+/**
+ * Loads configuration from the given file.
+ * @param fname Filename of the configuration file.
+ */
void QKernel::LoadConfig(char * fname)
{
config_t cfg;
config_destroy(&cfg);
fclose(file);
}
-/* +++++++++++++++++++++++++++++++++++++++++++++++ */
+/**
+ * Executes program.
+ * Additional window id displayed to set which code to execute.
+ */
void QKernel::Run_Prog()
{
int i;
}
}
+/**
+ * Invokes editor program
+ */
void QKernel::Edit()
{
char cmd[255];
system(cmd);
}
+/**
+ * Invokes help program
+ */
void QKernel::Help()
{
char cmd[255];
system(cmd);
}
-
+/**
+ * Invokes graphics module
+ */
void QKernel::RunGraphModule(char *sk)
{
char cmd[255];
WriteMessage("Cannot connect GRAPH resources");
}
-
-
+/**
+ * Invokes net module
+ */
void QKernel::RunNetModule()
{
struct sockaddr_un svr;
}
}
+/**
+ * Connects to the specified address
+ * Additional window is displayed to connect to the specified address
+ */
void QKernel::Connect()
{
QDialog d(this, "", TRUE);
}
}
+/**
+ * Disconnects from virtual machine
+ */
void QKernel::Disconnect()
{
MESSAGE msg;
write(net_sock, &msg, sizeof(MESSAGE));
}
+/**
+ * Quits process. Closes VLP. Shows additional window to confirm exit.
+ */
void QKernel::QuitProc()
{
MESSAGE msg;
}
}
+/**
+ * Adds IP address to the configuration.
+ * Additional window is displayed to add address to the list
+ */
void QKernel::AddAddress()
{
QDialog d(this, "", TRUE);
}
}
+/**
+ * Deletes current address from available connections.
+ */
void QKernel::DelAddress()
{
if (connections) {
}
}
+/**
+ * Sends message to node.
+ * Additional window is displayed to set Node Number of node where send message,
+ * and textfield to enter message.
+ */
void QKernel::MessageToNode()
{
QDialog *dlg;
}
}
+/**
+ * Kills interpreter.
+ * Additional window is displayed to get ID of interpreter which should be
+ * killed.
+ */
void QKernel::KillInterpreter()
{
QDialog *dlg;
}
}
-
-
+/**
+ * Sends message to the net module.
+ */
void QKernel::NetMessage()
{
}
}
+/**
+ * Sends message to the interpreter program.
+ * @param sock Interpreter socket to whom the message will be send.
+ */
void QKernel::IntMessage(int sock)
{
MESSAGE msg;
write(sock, &msg, sizeof(MESSAGE));
break;
};
- break; /* switch param.pword[0] */
- } /* switch type */
- } /* if */
+ break;
+ }
+ }
}
+/**
+ * Writes message to kernel logger.
+ * @parame msg String with message to log
+ */
void QKernel::WriteMessage(char *msg)
{
int x;
}
}
+/**
+ * Adds checkbox to menu item. It it is checked additional info messages are
+ * shown.
+ */
void QKernel::SetMessages()
{
if (p2 != NULL) {
p2->setItemChecked(msgid, TRUE);
info_messages=TRUE;
}
- } /* !=NULL */
+ }
/* bar->repaint(); */
}
+/**
+ * Allows to set options in GUI window.
+ * Additional window is displayed to set kernel options which are saved in
+ * vlp.cfg file in kernel executable directory.
+ */
void QKernel::SetOptions()
{
QDialog dlg(this, "Options", TRUE);
}
}
+/**
+ * Locks kernel program.
+ * Additional window is displayed to enter password and retype it. If both are
+ * same kernel window is locked.
+ */
void QKernel::LockConsole()
{
QDialog d(this, "Enter password", TRUE);
}
}
+/**
+ * Unlocks kernel program.
+ * Additional window is displayed to enter password. If it is correct, kernel
+ * window is unlocked
+ */
void QKernel::UnlockConsole()
{
QDialog d(this, "Enter password", TRUE);
}
}
+/**
+ * Writes init message in kernel
+ */
void QKernel::InitMessage()
{
WriteMessage("\n Virtual LOGLAN Processor - ver 1.9: READY \n");
}
+/**
+ * Finds Interpreter by its socket
+ * @param _id ID of the socket
+ * @return returns pointer to the found interpreter slot
+ */
InterpEntry *QKernel::findINTbySocket(int _id)
{
InterpEntry *pom;
pom = Interpreters.next();
}
- return(pom);
+ return pom;
}
+/**
+ * Finds Interpreter by its ID.
+ * @param _id ID of the interpreter
+ * @return returns pointer to the found interpreter slot
+ */
InterpEntry *QKernel::findINTbyID(int _id)
{
InterpEntry *pom;
break;
pom = Interpreters.next();
}
- return(pom);
+ return pom;
}
-/* ------------------ Connect INT module -----------------*/
-
+/**
+ * Connects interpreter
+ * @param ss full filepath with filename but without extension of the loglan
+ * program to run.
+ * @param r Interpreter execution mode. 0 if it will be local instance, 1 if
+ * remote
+ * @return Returns pointer to newly created interpreter slot, or NULL on error.
+ */
InterpEntry *QKernel::RunIntModule(char *ss, int r)
{
char a[256], b[255];
return newINT;
}
-/* ---------------------------------------------------------*/
-/* Allocate remote instance */
-
+/**
+ * Allocates remote instance of interpreter
+ * @param interp Interpreter slot
+ * @param on Node Number
+ */
void QKernel::RemoteInstance(InterpEntry *interp, int on)
{
MESSAGE m;
}
}
-
-/*-----------------------------------------------*/
-/* Close all remote instances */
-
+/**
+ * Closes all remote instances
+ */
void QKernel::CloseInstances(InterpEntry *e)
{
MESSAGE msg;
}
}
-
+/**
+ * Displays information about virtual machine
+ */
void QKernel::Info()
{
MESSAGE m;
#include "kernel.moc"
+/**
+ * Program main function
+ * All program arguments but the first one (argv[0]: program name) are saved and
+ * passed to all dependent programs on their invocation.
+ * @param argc Number of program arguments
+ * @param argv Program arguments
+ */
int main(int argc, char **argv)
{
int i;
- for(i=0; i < 5; i++) {
+ for(i = 0; i < 5; i++) {
strcpy(myargs[i], "");
}
- for(i=1; i < argc; i++) {
- strcpy(myargs[i-1], argv[i]);
+ for(i = 1; i < argc; i++) {
+ strcpy(myargs[i - 1], argv[i]);
}
app = new QApplication(argc, argv);