void HTMLAnalyzer::DumpList()
{
Tag *pom;
- pom = tags.first();
- while (pom != NULL) {
+ QListIterator<Tag *> tagsIterator(tags);
+
+ while (tagsIterator.hasNext()) {
+ pom = tagsIterator.next();
fprintf(stderr, "%s:%s,%s,%s\n", names[pom->tag_type],
pom->tag_text, pom->tag_link, pom->tag_label);
- pom=tags.takeFirst();
}
}
{
Tag *pom,*pom1;
char s[255];
+ QListIterator<Tag *> tagsIterator(tags);
- pom = tags.first();
- while (pom!=NULL) {
+ while (tagsIterator.hasNext()) {
+ pom = tagsIterator.next();
if ((pom->tag_type == TAG_LINK) ||
(pom->tag_type == TAG_ANCHOR)) {
- pom1 = tags.takeFirst();
+ pom1 = tagsIterator.next();
strcpy(s, "");
while ((pom1 != NULL) &&
(pom1->tag_type != TAG_LINK_END)) {
tags.removeOne(pom1);
pom = tags.current();
} else {
- pom = tags.takeFirst();
+ pom = tagsIterator.next();
}
}
}
Tag *HTMLAnalyzer::CheckTag(int x,int y)
{
Tag *pom;
- pom=tags.first();
- while (pom != NULL) {
+ QListIterator<Tag *> tagsIterator(tags);
+
+ while (tagsIterator.hasNext()) {
+ pom = tagsIterator.next();
if (pom->tag_type==TAG_LINK)
if ((x >= pom->x) && (x <= pom->x + pom->w) &&
(y >= pom->y) && (y <= pom->y + pom->h)) {
return pom;
}
- pom=tags.takeFirst();
}
return NULL;
}
Tag *HTMLAnalyzer::FindAnchor(char *name)
{
Tag *pom;
- pom = tags.first();
- while (pom != NULL) {
+ QListIterator<Tag *> tagsIterator(tags);
+
+ while (tagsIterator.hasNext()) {
+ pom = tagsIterator.next();
if ((pom->tag_type == TAG_ANCHOR) &&
(strcmp(pom->tag_label, name) == 0)) {
return(pom);
}
- pom=tags.takeFirst();
}
return pom;
}
map->fill(backgroundColor());
p.begin(map);
- pom = analyzer->tags.first();
- while (pom != NULL) {
+ QListIterator<Tag *> tagsIterator(tags);
+
+ while (tagsIterator.hasNext()) {
+ pom = tagsIterator.next();
switch(pom->tag_type) {
case TAG_TEXT:
p.setFont(*actual_font);
cy = cy + p.fontMetrics().height();
break;
}
- pom = analyzer->tags.takeFirst();
}
p.end();
repaint();
m.msg_type = MSG_NET;
m.param.pword[0] = NET_NODE_EXIST;
-
- pomlink = Links.first();
m.param.pword[1] = 0;
- while (pomlink != NULL) {
+
+ QListIterator<NETlink*> linksIterator(Links);
+
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (pomlink->node_number == n) {
m.param.pword[1] = 1;
strcpy(m.param.pstr, pomlink->addr);
break;
}
- pomlink = Links.takeFirst();
}
write(sc, &m, sizeof(MESSAGE));
}
FD_SET(kernel_sock, &readset);
nrset = kernel_sock;
- pomlink = Interpreters.first();
- while (pomlink != NULL) {
+ QListIterator<INTlink*> interpretersIterator(Interpreters);
+ while (interpretersIterator.hasNext()) {
+ pomlink = interpretersIterator.next();
FD_SET(pomlink->sock, &readset);
if (nrset < pomlink->sock) {
nrset = pomlink->sock;
}
- pomlink = Interpreters.takeFirst();
}
if (select(nrset + 1, &readset, &writeset, 0, (struct timeval *)&tout) >
0) {
/* Check request sockets */
- pomlink = Interpreters.first();
- while (pomlink != NULL) {
+ interpretersIterator.toFront();
+ while (interpretersIterator.hasNext()) {
+ pomlink = interpretersIterator.next();
if (FD_ISSET(pomlink->sock, &readset)) {
nr = read(pomlink->sock, &msg, sizeof(MESSAGE));
if (nr > 0) {
}
}
} /* ISSET */
- pomlink=Interpreters.takeFirst();
} // while
/* Check internal socket */
FD_ZERO(&wset);
max = 0;
- pomlink = Links.first();
- while (pomlink != NULL) {
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (pomlink->connected) {
FD_SET(pomlink->sock, &rset);
if (max < pomlink->sock){
max = pomlink->sock;
}
}
- pomlink=Links.takeFirst();
}
if (select(max + 1, &rset, &wset, 0, (struct timeval *)&tout) > 0) {
- pomlink=Links.first();
- while (pomlink!=NULL) {
+ linksIterator.toFront();
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (FD_ISSET(pomlink->sock,&rset)) {
get_message(pomlink);
}
- pomlink=Links.takeFirst();
}
}
}
if (max < kernel_sock) {
max=kernel_sock;
}
- pomlink2 = Interpreters.first();
- while (pomlink2 != NULL) {
+
+ QListIterator<INTlink*> interpretersIterator(Interpreters);
+ while (interpretersIterator.hasNext()) {
+ pomlink2 = interpretersIterator.next();
FD_SET(pomlink2->sock, &rset);
if (max < pomlink2->sock) {
- max=pomlink2->sock;
+ max = pomlink2->sock;
}
- pomlink2 = Interpreters.takeFirst();
}
- pomlink = Links.first();
- while (pomlink != NULL) {
+
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (pomlink->connected) {
FD_SET(pomlink->sock, &rset);
if (max < pomlink->sock) {
max = pomlink->sock;
}
}
- pomlink=Links.takeFirst();
}
/* odczyt */
/* get internal message*/
/* Check request sockets */
- pomlink2 = Interpreters.first();
- while (pomlink2 != NULL) {
+ interpretersIterator.toFront();
+ while (interpretersIterator.hasNext()) {
+ pomlink2 = interpretersIterator.next();
if (FD_ISSET(pomlink2->sock,&rset)) {
nr = read(pomlink2->sock, &msg, sizeof(MESSAGE));
if (nr > 0) {
}
}
}/* ISSET */
- pomlink2 = Interpreters.takeFirst();
}/* while */
/* Check internal socket */
/* get remote message*/
- pomlink=Links.first();
- while (pomlink != NULL) {
+ linksIterator.toFront();
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (FD_ISSET(pomlink->sock, &rset))
get_message(pomlink);
- pomlink=Links.takeFirst();
}
} // select
}
struct sockaddr_in svr;
int j, on;
- pom = Links.first();
- while (pom != NULL) {
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pom = linksIterator.next();
if (strcmp(pom->addr, a) == 0)
return;
- pom = Links.takeFirst();
}
pom = new NETlink;
strcpy(pom->addr, a);
int j = 1;
struct sockaddr_in svr;
NETlink *pomlink;
+ QListIterator<NETlink*> linksIterator(Links);
/* connect to all other nodes */
if (!all_connected) {
- pomlink = Links.first();
- while (pomlink != NULL) {
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (!(pomlink->connected)) {
bzero(&svr, sizeof(svr));
svr.sin_family = AF_INET;
sock_reopen(pomlink);
}
} /* not connected */
- pomlink = Links.takeFirst();
} /* while */
} /* if */
all_connected = TRUE;
- pomlink = Links.first();
- while(pomlink != NULL) {
+ linksIterator.toFront();
+ while(linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
if (pomlink->connected == FALSE) {
all_connected = FALSE;
break;
}
- pomlink = Links.takeFirst();
}
}
void NETMOD::send_to_all(MESSAGE *msg)
{
NETlink *pomlink;
- pomlink = Links.first();
- while (pomlink != NULL) {
+
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
write(pomlink->sock, msg, sizeof(MESSAGE));
- pomlink = Links.takeFirst();
}
}
::close(kernel_sock);
::close(listen_sock);
unlink(kername);
- pomlink = Links.first();
- while (pomlink != NULL) {
+
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
::close(pomlink->sock);
- pomlink = Links.takeFirst();
}
exit(0);
}
m.param.pword[0] = NET_DISCONNECT;
m.param.pword[1] = MyNode;
- p = Links.first();
- while(p != NULL) {
+ QListIterator<NETlink*> linksIterator(Links);
+ while(linksIterator.hasNext()) {
+ p = linksIterator.next();
send_to_node(p, &m);
- p=Links.takeFirst();
}
- p = Links.first();
- while(p != NULL) {
+
+ linksIterator.toFront();
+ while(linksIterator.hasNext()) {
+ p = linksIterator.next();
::close(p->sock);
- p = Links.takeFirst();
}
Links.clear();
}
NETlink * NETMOD::findNETlink(int node)
{
- NETlink *pomlink;
- pomlink = Links.first();
- while(pomlink != NULL) {
+ NETlink *pomlink = NULL;
+ QListIterator<NETlink*> linksIterator(Links);
+
+ while(linksIterator.hasNext()) {
+ pomlink = linksIterator.next();
+
if (pomlink->node_number == node)
return pomlink;
-
- pomlink = Links.takeFirst();
- }
+ }
return pomlink;
}
INTlink * NETMOD::findINTlink(int id)
{
- INTlink *pomlink;
- pomlink = Interpreters.first();
- while(pomlink != NULL) {
+ INTlink *pomlink = NULL;
+ QListIterator<INTlink*> interpretersIterator(Interpreters);
+ while(interpretersIterator.hasNext()) {
+ pomlink = interpretersIterator.next();
if (pomlink->ID == id)
return pomlink;
- pomlink = Interpreters.takeFirst();
}
return pomlink;
}
m.msg_type = MSG_NET;
m.param.pword[0] = NET_INFO;
strcpy(m.param.pstr, "");
- pom = Links.first();
- while (pom != NULL) {
+
+ QListIterator<NETlink*> linksIterator(Links);
+ while (linksIterator.hasNext()) {
+ pom = linksIterator.next();
sprintf(poms, "%d=%s;", pom->node_number, pom->addr);
strcat(m.param.pstr, poms);
k++;
write(sk, &m, sizeof(MESSAGE));
k = 0;
}
- pom = Links.takeFirst();
}
if (k > 0) {
m.param.pword[1] = k;