-
-
#include "depend.h"
#include "genint.h"
#include "int.h"
int main();
#endif
-
+/**
+ * @file
+ * @brief Compiler and interpreter code
+ */
int internal_sock, graph_sock, net_sock, connected = 0;
struct sockaddr_un svr;
abend("Memory size too large (use /m option)\n");
addext(filename, ".ccd");
+ fprintf(stderr, "logint: Reading static data from %s file\n", filename);
if ((fp = fopen(filename, BINARYREAD)) == NULL) {
fprintf(stderr, "Cannot open .ccd file\n");
endrun(10);
ic += n;
left -= n;
} while (n != 0);
+ fprintf(stderr, "logint: Static data from %s file has been read\n", filename);
/* now ic = number of words read */
fclose(fp);
/* Read prototypes from .pcd file */
addext(filename, ".pcd");
+ fprintf(stderr, "logint: Reading prototypes from %s file\n", filename);
if ((fp = fopen(filename, BINARYREAD)) == NULL) {
fprintf(stderr,"Cannot open .pcd file\n");
endrun(10);
abend("Cannot read .pcd file\n");
}
fclose(fp);
+ fprintf(stderr, "logint: Prototypes from: %s file has been read\n", filename);
/* Open trace file */
if (debug) {
/**
* Establishes configuration parameters
* Creates two sockets for program run
+ *
+ * @param argc number of passed values in argv array
+ * @param argv[1]
+ * @param argv[2]
+ * @param argv[3] if value is equal to: "r", sets global #remote variable to
+ * TRUE, FALSE otherwise
*/
static void initiate(int argc, char **argv)
{
svr.sun_family = AF_UNIX;
strcpy(svr.sun_path, mynname);
len = strlen(svr.sun_path) + sizeof(svr.sun_family);
+ fprintf(stderr, "logint: Binding to socket: %s\n", svr.sun_path);
bind(sock, (struct sockaddr*)&svr, len);
listen(sock, 5);
strcpy(svr.sun_path, argv[1]);
strcpy(mykname, argv[1]);
len = strlen(svr.sun_path) + sizeof(svr.sun_family);
+ fprintf(stderr, "logint: Connecting to socket: %s\n", svr.sun_path);
i = connect(internal_sock, (struct sockaddr*)&svr, len);
if (i==0) {
fcntl(internal_sock,F_SETFL, O_NONBLOCK |
fcntl(internal_sock,F_GETFL,0));
}
- else
+ else {
while (i!=0) {
close(internal_sock);
internal_sock = socket(AF_UNIX, SOCK_STREAM, 0);
fcntl(internal_sock, F_GETFL, 0));
i = connect(internal_sock, (struct sockaddr*)&svr, len);
}
+ }
on = 1;
setsockopt(internal_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on,
sizeof(on));
close(sock);
/* load code and prototypes */
- if (filename != NULL)
+ if (filename != NULL) {
+ fprintf(stderr, "logint: loading code: %s\n", filename);
load(filename);
- else
+ }
+ else {
usage();
+ }
}
/**
*
*/
-void decode(){
+void decode() {
extopcode *eop;
/* pointer to extended opcode in M */
/**
* Reads message from net module.
+ *
* @param msg Message to read.
*/
int read_from_net(MESSAGE *msg)
}
-/**
+/**
* Gets graphic resource number
*/
int get_graph_res()
/**
* Writes string
+ *
+ * Passed string is send to graph module by G_MESSAGE packet using send_to_graph
+ *
* @param s String to write
*/
void write_str(char *s)
/**
* Writes char
+ *
+ * Passed char is send to graph module by G_MESSAGE packet using send_to_graph
+ *
* @param a Character to write
*/
void write_char(char a)
send_to_graph(&m1);
}
-
+/**
+ * Sends MESSAGE
+ */
void send_ready()
{
int sock, len;
* strcpy(filename, argv[2]);
* strcpy(ProgName, argv[2]);
*
- * argv[1] = base name of this interpreter instance.
+ * @param argv[1] = base name of this interpreter instance.
* For network there is created argv[1].net socket
* For graphics there is created argv[1].gr socket
- * argv[2] = up to 80 characters string (with terminating \0). It is used to
+ * @param argv[2] = up to 80 characters string (with terminating \0). It is used to
* load selected program
- * argv[3] = if exists and is equal to 'r', this is a remote call
+ * @param argv[3] = if exists and is equal to 'r', this is a remote call
*/
int main(int argc, char **argv)
{
+ fprintf(stderr, "logint: initializing\n");
/* initialize executor */
initiate(argc, argv);
/* initialize running system */
+ fprintf(stderr, "logint: runsys\n");
runsys();
+ fprintf(stderr, "logint: initializing scheduler\n");
init_scheduler();
+ fprintf(stderr, "logint: acquiring GRAPH resource\n");
GraphRes = get_graph_res();
- if (GraphRes < 0)
+ if (GraphRes < 0) {
+ fprintf(stderr, "logint: > acquiring GRAPH resource failed\n");
exit(12);
+ }
request_id();
if (remote)