Reporting patch.

This commit is contained in:
robijn
2001-11-29 14:09:13 +00:00
parent 3dc439e2c4
commit 285d29edf3
23 changed files with 534 additions and 477 deletions
+27 -29
View File
@@ -1,10 +1,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <syslog.h>
#include "shared/LL.h"
#include "shared/sockets.h"
#include "shared/debug.h"
#include "shared/report.h"
#include "screenlist.h"
#include "screen.h"
#include "clients.h"
@@ -26,11 +25,11 @@ int compare_addresses (void *one, void *two);
int
screenlist_init ()
{
debug ("screenlist_init()\n");
report (RPT_INFO, "screenlist_init()");
screenlist = LL_new ();
if (!screenlist) {
syslog(LOG_ERR, "screenlist_init: error allocating list");
report(RPT_ERR, "screenlist_init: error allocating list");
return -1;
}
@@ -43,7 +42,7 @@ screenlist_init ()
int
screenlist_shutdown ()
{
debug ("screenlist_shutdown()\n");
report (RPT_INFO, "screenlist_shutdown()");
LL_Destroy (screenlist);
@@ -53,7 +52,7 @@ screenlist_shutdown ()
int
screenlist_remove (screen * s)
{
debug ("screenlist_remove()\n");
report (RPT_INFO, "screenlist_remove()");
if (!LL_Remove (screenlist, s))
return -1;
@@ -66,12 +65,12 @@ screenlist_remove_all (screen * s)
{
int i = 0;
debug ("screenlist_remove_all()\n");
report (RPT_INFO, "screenlist_remove_all()");
while (LL_Remove (screenlist, s))
i++;
debug ("screenlist_remove_all()... got %i\n", i);
debug (RPT_DEBUG, "screenlist_remove_all()... got %i", i);
return i;
}
@@ -79,7 +78,7 @@ screenlist_remove_all (screen * s)
LinkedList *
screenlist_getlist ()
{
debug ("screenlist_getlist()\n");
report (RPT_INFO, "screenlist_getlist()");
return screenlist;
}
@@ -92,24 +91,25 @@ screenlist_current ()
static screen *old_s = NULL;
client *c;
//debug("screenlist_current:\n");
debug( RPT_INFO, "screenlist_current:");
//LL_dprint(screenlist);
s = (screen *) LL_GetFirst (screenlist);
// FIXME: Make sure the screen/client exists!
if (s != old_s) {
debug ("screenlist_current: new screen\n");
//debug (RPT_DEBUG, "screenlist_current: new screen");
timer = 0;
// Tell the client we're done with the current screen
if (old_s) {
//debug("screenlist_current: ignoring old screen\n");
//debug(RPT_DEBUG, "screenlist_current: ignoring old screen");
LL_Rewind (screenlist);
if (old_s != LL_Find (screenlist, compare_addresses, old_s)) {
debug ("screenlist: Didn't find screen 0x%8x!\n", (int) old_s);
report (RPT_WARNING, "screenlist: Didn't find screen 0x%8x!", (int) old_s);
} else {
//debug("screenlist_current: ... sending ignore\n");
//debug(RPT_DEBUG, "screenlist_current: ... sending ignore");
c = old_s->parent;
if (c) // Tell the client we're not listening any more...
{
@@ -119,11 +119,11 @@ screenlist_current ()
{
;
}
//debug("screenlist_current: ... sent ignore\n");
//debug(RPT_DEBUG, "screenlist_current: ... sent ignore");
}
}
if (s) {
//debug("screenlist_current: listening to new screen\n");
//debug(RPT_DEBUG, "screenlist_current: listening to new screen");
c = s->parent;
if (c) // Tell the client we're paying attention...
{
@@ -138,7 +138,7 @@ screenlist_current ()
old_s = s;
//debug("screenlist_current: return %8x\n", s);
//debug(RPT_DEBUG, "screenlist_current: return %8x", s);
return s;
}
@@ -155,7 +155,7 @@ screenlist_next ()
{
screen *s;
//debug("Screenlist_next()\n");
//debug(RPT_DEBUG, "Screenlist_next()");
s = screenlist_current ();
@@ -168,14 +168,14 @@ screenlist_next ()
// Otherwise, reset it to regular operation
screenlist_action = 0;
//debug("Screenlist_next: calling handler...\n");
//debug(RPT_DEBUG, "Screenlist_next: calling handler...");
// Call the selected queuing function...
// TODO: Different queueing modes...
s = screenlist_next_priority ();
//s = screenlist_next_roll();
//debug("Screenlist_next() done\n");
//debug(RPT_DEBUG, "Screenlist_next() done");
return s;
}
@@ -207,7 +207,7 @@ screenlist_prev ()
int
screenlist_add_end (screen * screen)
{
debug ("screenlist_add_end()\n");
debug (RPT_DEBUG, "screenlist_add_end()");
return LL_Push (screenlist, (void *) screen);
}
@@ -216,7 +216,7 @@ screenlist_add_end (screen * screen)
screen *
screenlist_next_roll ()
{
//debug("screenlist_next_roll()\n");
//debug(RPT_DEBUG, "screenlist_next_roll()");
if (LL_UnRoll (screenlist) != 0)
return NULL;
@@ -229,7 +229,7 @@ screen *
screenlist_next_priority ()
{
//screen *s, *t;
//debug("screenlist_next_priority\n");
//debug(RPT_DEBUG, "screenlist_next_priority");
if (LL_UnRoll (screenlist) != 0)
return NULL;
@@ -243,7 +243,7 @@ screenlist_next_priority ()
screen *
screenlist_prev_roll ()
{
//debug("screenlist_prev_roll()\n");
//debug(RPT_DEBUG, "screenlist_prev_roll()");
if (LL_Roll (screenlist) != 0)
return NULL;
@@ -256,7 +256,7 @@ compare_priority (void *one, void *two)
{
screen *a, *b;
//debug("compare_priority: %8x %8x\n", one, two);
//debug(RPT_DEBUG, "compare_priority: %8x %8x", one, two);
if (!one)
return 0;
@@ -266,7 +266,7 @@ compare_priority (void *one, void *two)
a = (screen *) one;
b = (screen *) two;
//debug("compare_priority: done?\n");
//debug(RPT_DEBUG, "compare_priority: done?");
return (a->priority - b->priority);
}
@@ -274,8 +274,6 @@ compare_priority (void *one, void *two)
int
compare_addresses (void *one, void *two)
{
//printf("compare_addresses: 0x%x == 0x%x ???\n", one, two);
//if(one == two) printf("Yes!\n");
//else printf("No!\n");
//printf(RPT_DEBUG, "compare_addresses: %p == %p ???", one, two);
return (one != two);
}