From c93d8517f5609af29641b70460f61fb1363f468e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Thu, 1 Aug 2013 23:30:48 +0200 Subject: [PATCH] vlp-7 More documentation in code. --- src/help/help.cpp | 13 +++++----- src/lgconfig/lgconfig.cpp | 6 ++++- src/net/lognet.cpp | 51 ++++++++++++++++++++++++--------------- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/src/help/help.cpp b/src/help/help.cpp index 12839ec..d2cf4f0 100644 --- a/src/help/help.cpp +++ b/src/help/help.cpp @@ -55,8 +55,7 @@ char names[14][40] = { class Tag { public: - Tag() - { + Tag() { tag_type=0; strcpy(tag_label, ""); strcpy(tag_link, ""); @@ -93,7 +92,6 @@ HTMLAnalyzer::HTMLAnalyzer() verbatim = FALSE; } - bool HTMLAnalyzer::LoadFile(char *fname) { QFile f(fname); @@ -146,13 +144,13 @@ bool HTMLAnalyzer::LoadFile(char *fname) tags.append(pomt); break; } - }/* while length>0 */ + } if (verbatim) { pomt = new Tag; pomt->tag_type = TAG_BREAK; tags.append(pomt); } - } /* eof */ + } f.close(); return TRUE; } @@ -463,6 +461,9 @@ void QHTML::mousePressEvent(QMouseEvent *ev) } } +/** + * @attention Currently not in use + */ void QHTML::back() { } @@ -580,7 +581,7 @@ void QHTML::DrawList() cx = 5; cy = cy + p.fontMetrics().height(); break; - }//switch + } pom = analyzer->tags.next(); } p.end(); diff --git a/src/lgconfig/lgconfig.cpp b/src/lgconfig/lgconfig.cpp index ce241aa..b130153 100644 --- a/src/lgconfig/lgconfig.cpp +++ b/src/lgconfig/lgconfig.cpp @@ -27,7 +27,8 @@ class VLPEntry { public: int ID; char addr[255]; - int type; /* 0 - explicit */ + /** 0 - explicit */ + int type; char progdir[255]; char homedir[255]; char item[255]; @@ -102,6 +103,9 @@ bool QInstall::check_addr(char *addr) return TRUE; } +/** + * @attention Currently not in use + */ void QInstall::Info() { } diff --git a/src/net/lognet.cpp b/src/net/lognet.cpp index f6211bb..7a93bc0 100644 --- a/src/net/lognet.cpp +++ b/src/net/lognet.cpp @@ -289,11 +289,20 @@ void NETMOD::write_at_console(char *s) send_to_kernel(&msg); } +/** + * Sends message to kernel + * @param msg Message to send. + */ void NETMOD::send_to_kernel(MESSAGE *msg) { write(kernel_sock, msg, sizeof(MESSAGE)); } +/** + * Sends message to given node + * @param lnk Interpreter link. + * @param msg Message to send. + */ void NETMOD::send_to_node(NETlink *lnk, MESSAGE *msg) { msg->msg_type = MSG_NET; @@ -303,6 +312,10 @@ void NETMOD::send_to_node(NETlink *lnk, MESSAGE *msg) } } +/** + * Sends message to interpreter + * @param msg Message to send. + */ void NETMOD::send_to_int(MESSAGE *msg) { INTlink *pomlink; @@ -313,8 +326,6 @@ void NETMOD::send_to_int(MESSAGE *msg) } } - - void NETMOD::accept_connection() { unsigned int sz; @@ -380,8 +391,9 @@ void NETMOD::check_node(int n, int sc) } -/************** Internal message from kernel or INT ********************/ - +/** + * Internal message from kernel or INT + */ void NETMOD::get_internal() { int nr; @@ -501,11 +513,11 @@ void NETMOD::get_internal() }; break; break; - } /* MSg_VLP */ + } } } - }/* ISSET */ - } /* select >0 */ + } + } } void NETMOD::get_message(NETlink *lnk) @@ -612,11 +624,11 @@ void NETMOD::get_message(NETlink *lnk) send_to_int(&msg); } break; - } /* end switch */ - } - } /* nr > 0 */ + } + } + } - } /* end if used */ + } } @@ -824,7 +836,7 @@ void NETMOD::propagate_msg(MESSAGE *msg) pomlink = findNETlink(msg->param.pword[4]); if ((pomlink != NULL) && (pomlink->connected)) - send_to_node(pomlink,msg); + send_to_node(pomlink, msg); else { if (msg->param.pword[1] == MSG_INT) { send_to_int(msg); @@ -1022,7 +1034,7 @@ void NETMOD::disconnect_seq() Links.clear(); } -NETlink *NETMOD::findNETlink(int node) +NETlink * NETMOD::findNETlink(int node) { NETlink *pomlink; pomlink = Links.first(); @@ -1035,7 +1047,7 @@ NETlink *NETMOD::findNETlink(int node) return pomlink; } -INTlink *NETMOD::findINTlink(int id) +INTlink * NETMOD::findINTlink(int id) { INTlink *pomlink; pomlink = Interpreters.first(); @@ -1048,8 +1060,9 @@ INTlink *NETMOD::findINTlink(int id) } -/* ---------------- Sending code to a remote node -------------- */ - +/** + * Sending code to a remote node + */ void NETMOD::transmit_file(int ton, char *fname, int fromINT) { FILE *f; @@ -1065,7 +1078,7 @@ void NETMOD::transmit_file(int ton, char *fname, int fromINT) fd_set rset; fd_set wset; - /***************** CCD FILE*/ + /***************** CCD FILE */ strcpy(fn, fname); strcat(fn, ".ccd"); f = fopen(fn, "rb"); @@ -1157,7 +1170,7 @@ void NETMOD::transmit_file(int ton, char *fname, int fromINT) if (FD_ISSET(sock, &rset)) tsock = accept(sock, (struct sockaddr*)&svr, &sz); - if (tsock>0) { + if (tsock > 0) { close(sock); while (!feof(f)) { i = fread(&proto, 1, sizeof(proto), f); @@ -1213,7 +1226,7 @@ void NETMOD::conn_info(int sk) write(sk, &m, sizeof(MESSAGE)); } -int main(int argc,char **argv) +int main(int argc, char **argv) { NETMOD netter(argv[1]); netter.run(); -- 2.30.2