From 440ecfb4a2b273bfa1d11fc201793a98b02add51 Mon Sep 17 00:00:00 2001 From: geronet <> Date: Sat, 25 Feb 2006 13:36:33 +0000 Subject: [lcd4linux @ 2006-02-25 13:36:33 by geronet] updated indent.sh, applied coding style --- drv_Cwlinux.c | 9 ++++++--- drv_Noritake.c | 11 +++++++---- drv_generic_i2c.h | 28 +++++++++++++++------------- drv_generic_parport.c | 12 +++++++++--- drv_generic_text.c | 7 +++++-- evaluator.c | 7 +++++-- indent.sh | 9 ++++++++- lcd4linux_i2c.h | 8 ++++++-- plugin_i2c_sensors.c | 11 ++++++++--- plugin_mysql.c | 9 ++++++--- plugin_pop3.c | 11 ++++++++--- widget_icon.c | 11 +++++++---- widget_image.c | 28 +++++++++++++++------------- widget_image.h | 11 +++++++---- widget_keypad.h | 8 ++++++-- widget_timer.c | 21 ++++++++++++--------- widget_timer.h | 11 +++++++---- 17 files changed, 137 insertions(+), 75 deletions(-) diff --git a/drv_Cwlinux.c b/drv_Cwlinux.c index 49803b4..c476fc6 100644 --- a/drv_Cwlinux.c +++ b/drv_Cwlinux.c @@ -1,4 +1,4 @@ -/* $Id: drv_Cwlinux.c,v 1.25 2006/02/06 06:29:30 reinelt Exp $ +/* $Id: drv_Cwlinux.c,v 1.26 2006/02/25 13:36:33 geronet Exp $ * * new style driver for Cwlinux display modules * @@ -23,6 +23,9 @@ * * * $Log: drv_Cwlinux.c,v $ + * Revision 1.26 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.25 2006/02/06 06:29:30 reinelt * Image driver uses RGBA * @@ -247,7 +250,7 @@ static int drv_CW_GPO(const int num, const int val) /* Fixme: GPO's not yet implemented! */ error("%s: GPO's not yet implemented!", Name); /* Fixme: num*val to avoid compiler warning */ - return num*val; + return num * val; } @@ -422,7 +425,7 @@ int drv_CW_init(const char *section, const int quiet) WIDGET_CLASS wc; int ret; - info("%s: %s", Name, "$Revision: 1.25 $"); + info("%s: %s", Name, "$Revision: 1.26 $"); /* display preferences */ XRES = 6; /* pixel width of one char */ diff --git a/drv_Noritake.c b/drv_Noritake.c index 9aec59e..3bbc03b 100644 --- a/drv_Noritake.c +++ b/drv_Noritake.c @@ -1,4 +1,4 @@ -/* $Id: drv_Noritake.c,v 1.5 2006/01/30 06:25:53 reinelt Exp $ +/* $Id: drv_Noritake.c,v 1.6 2006/02/25 13:36:33 geronet Exp $ * * Driver for a Noritake GU128x32-311 graphical display. * @@ -22,6 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: drv_Noritake.c,v $ + * Revision 1.6 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.5 2006/01/30 06:25:53 reinelt * added CVS Revision * @@ -124,8 +127,8 @@ static unsigned char SIGNAL_CS; /* Chip select, OUTPUT, negative logic, pport AU static unsigned char SIGNAL_WR; /* Write OUTPUT, negative logic, pport STOBE */ static unsigned char SIGNAL_RESET; /* Reset, OUTPUT, negative logic, pport INIT */ static unsigned char SIGNAL_BLANK; /* Blank, OUTPUT , negative logic, pport SELECT-IN */ - /* static unsigned char SIGNAL_BUSY; *//* Busy, INPUT , positive logic, pport BUSY, not used */ - /* static unsigned char SIGNAL_FRP; *//* Frame Pulse, INPUT , positive logic, pport ACK, not used */ + /* static unsigned char SIGNAL_BUSY; *//* Busy, INPUT , positive logic, pport BUSY, not used */ + /* static unsigned char SIGNAL_FRP; *//* Frame Pulse, INPUT , positive logic, pport ACK, not used */ void (*drv_Noritake_clear) (void); /* Data port is positive logic */ @@ -345,7 +348,7 @@ int drv_Noritake_init(const char *section, const int quiet) WIDGET_CLASS wc; int ret; - info("%s: %s", Name, "$Revision: 1.5 $"); + info("%s: %s", Name, "$Revision: 1.6 $"); /* start display */ if ((ret = drv_Noritake_start(section)) != 0) diff --git a/drv_generic_i2c.h b/drv_generic_i2c.h index 3304109..2236267 100644 --- a/drv_generic_i2c.h +++ b/drv_generic_i2c.h @@ -1,4 +1,4 @@ -/* $Id: drv_generic_i2c.h,v 1.4 2005/05/31 21:32:00 lfcorreia Exp $ +/* $Id: drv_generic_i2c.h,v 1.5 2006/02/25 13:36:33 geronet Exp $ * * generic driver helper for i2c displays * @@ -23,6 +23,9 @@ * * * $Log: drv_generic_i2c.h,v $ + * Revision 1.5 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.4 2005/05/31 21:32:00 lfcorreia * fix my email address * @@ -41,8 +44,8 @@ * HD44780/I2C patch from Luis merged (still does not work for me) * * - */ - + */ + /* * * exported fuctions: @@ -66,15 +69,14 @@ * void drv_generic_i2c_command(unsigned char command, unsigned char *data,unsigned char length) * send command and the data to the i2c device * - */ - + */ + #ifndef _DRV_GENERIC_I2C_H_ #define _DRV_GENERIC_I2C_H_ - -int drv_generic_i2c_open(const char *section, const char *driver); -int drv_generic_i2c_close(void); -unsigned char drv_generic_i2c_wire(const char *name, const char *deflt); -void drv_generic_i2c_data(const unsigned char data); -void drv_generic_i2c_command(const unsigned char command, const unsigned char *data, const unsigned char length); - -#endif + int drv_generic_i2c_open(const char *section, const char *driver); + int drv_generic_i2c_close(void); + unsigned char drv_generic_i2c_wire(const char *name, const char *deflt); + void drv_generic_i2c_data(const unsigned char data); + void drv_generic_i2c_command(const unsigned char command, const unsigned char *data, const unsigned char length); + +#endif /* */ diff --git a/drv_generic_parport.c b/drv_generic_parport.c index 697634b..c97fb10 100644 --- a/drv_generic_parport.c +++ b/drv_generic_parport.c @@ -1,4 +1,4 @@ -/* $Id: drv_generic_parport.c,v 1.20 2005/12/12 05:52:03 reinelt Exp $ +/* $Id: drv_generic_parport.c,v 1.21 2006/02/25 13:36:33 geronet Exp $ * * generic driver helper for serial and parport access * @@ -23,6 +23,9 @@ * * * $Log: drv_generic_parport.c,v $ + * Revision 1.21 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.20 2005/12/12 05:52:03 reinelt * type of delays is 'unsigned long' * @@ -450,7 +453,9 @@ void drv_generic_parport_direction(const int direction) unsigned char drv_generic_parport_status(void) { - unsigned char mask = PARPORT_STATUS_ERROR | PARPORT_STATUS_SELECT | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ACK | PARPORT_STATUS_BUSY; + unsigned char mask = + PARPORT_STATUS_ERROR | PARPORT_STATUS_SELECT | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ACK | + PARPORT_STATUS_BUSY; unsigned char data; @@ -592,6 +597,7 @@ void drv_generic_parport_debug(void) debug("%cSTROBE %cAUTOFD %cINIT %cSLCTIN", control & PARPORT_CONTROL_STROBE ? '-' : '+', - control & PARPORT_CONTROL_AUTOFD ? '-' : '+', control & PARPORT_CONTROL_INIT ? '+' : '-', control & PARPORT_CONTROL_SELECT ? '-' : '+'); + control & PARPORT_CONTROL_AUTOFD ? '-' : '+', control & PARPORT_CONTROL_INIT ? '+' : '-', + control & PARPORT_CONTROL_SELECT ? '-' : '+'); } diff --git a/drv_generic_text.c b/drv_generic_text.c index 5296043..6816be0 100644 --- a/drv_generic_text.c +++ b/drv_generic_text.c @@ -1,4 +1,4 @@ -/* $Id: drv_generic_text.c,v 1.31 2006/01/30 05:47:38 reinelt Exp $ +/* $Id: drv_generic_text.c,v 1.32 2006/02/25 13:36:33 geronet Exp $ * * generic driver helper for text-based displays * @@ -23,6 +23,9 @@ * * * $Log: drv_generic_text.c,v $ + * Revision 1.32 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.31 2006/01/30 05:47:38 reinelt * graphic subsystem changed to full-color RGBA * @@ -764,7 +767,7 @@ static void drv_generic_text_bar_create_segments(void) break; /* hollow style, val(1,2) == 1, like '[' */ /* if (l1 == 1 && l2 == 1 && Segment[i].style == STYLE_FIRST && BarFB[n].style == STYLE_HOLLOW) - break; + break; *//* hollow style, val(1,2) == 1, like ']' */ /* if (l1 == 1 && l2 == 1 && Segment[i].style == STYLE_LAST && BarFB[n].style == STYLE_HOLLOW) break; diff --git a/evaluator.c b/evaluator.c index d22bbfa..8b4dbc9 100644 --- a/evaluator.c +++ b/evaluator.c @@ -1,4 +1,4 @@ -/* $Id: evaluator.c,v 1.30 2006/01/30 12:53:08 reinelt Exp $ +/* $Id: evaluator.c,v 1.31 2006/02/25 13:36:33 geronet Exp $ * * expression evaluation * @@ -23,6 +23,9 @@ * * * $Log: evaluator.c,v $ + * Revision 1.31 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.30 2006/01/30 12:53:08 reinelt * replaced strncpy with strcpy where possible * @@ -380,7 +383,7 @@ RESULT *SetResult(RESULT ** result, const int type, const void *value) if ((*result)->string) free((*result)->string); /* allocate memory in multiples of CHUNK_SIZE */ - (*result)->size = CHUNK_SIZE * ((len+1) / CHUNK_SIZE + 1); + (*result)->size = CHUNK_SIZE * ((len + 1) / CHUNK_SIZE + 1); (*result)->string = malloc((*result)->size); } strcpy((*result)->string, value); diff --git a/indent.sh b/indent.sh index 9885e49..3cb0e1f 100755 --- a/indent.sh +++ b/indent.sh @@ -4,5 +4,12 @@ # -l120 Set maximum line length for non-comment lines to 150. # -pmt Preserve access and modification times on output files. -indent -kr -l120 -pmt *.c *.h +indent -kr -l120 *.c *.h +for i in *.c *.h; do + if !(diff -q $i $i~); then + rm $i~ + else + mv $i~ $i + fi +done diff --git a/lcd4linux_i2c.h b/lcd4linux_i2c.h index 5978044..33505e0 100644 --- a/lcd4linux_i2c.h +++ b/lcd4linux_i2c.h @@ -1,4 +1,4 @@ -/* $Id: lcd4linux_i2c.h,v 1.3 2005/07/06 04:40:18 reinelt Exp $ +/* $Id: lcd4linux_i2c.h,v 1.4 2006/02/25 13:36:33 geronet Exp $ * * user space i2c sturctures and defines, taken from the official kernel i2c * includes to solve the problem when compiling user space application @@ -32,6 +32,9 @@ * * * $Log: lcd4linux_i2c.h,v $ + * Revision 1.4 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.3 2005/07/06 04:40:18 reinelt * GCC-4 fixes * @@ -217,7 +220,8 @@ extern int i2c_check_addr(struct i2c_adapter *adapter, int addr); * It will only call found_proc if some client is connected at the * specific address (unless a 'force' matched); */ -extern int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc) (struct i2c_adapter *, int, int)); +extern int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, + int (*found_proc) (struct i2c_adapter *, int, int)); /* An ioctl like call to set div. parameters of the adapter. */ diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c index 718f1e4..b3bbc2f 100644 --- a/plugin_i2c_sensors.c +++ b/plugin_i2c_sensors.c @@ -1,4 +1,4 @@ -/* $Id: plugin_i2c_sensors.c,v 1.24 2005/05/08 04:32:44 reinelt Exp $ +/* $Id: plugin_i2c_sensors.c,v 1.25 2006/02/25 13:36:33 geronet Exp $ * * I2C sensors plugin * @@ -23,6 +23,9 @@ * * * $Log: plugin_i2c_sensors.c,v $ + * Revision 1.25 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.24 2005/05/08 04:32:44 reinelt * CodingStyle added and applied * @@ -338,7 +341,8 @@ static void my_i2c_sensors_path(const char *method) while ((dir = readdir(fd1))) { /* Skip non-directories and '.' and '..' */ - if ((dir->d_type != DT_DIR && dir->d_type != DT_LNK) || strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { + if ((dir->d_type != DT_DIR && dir->d_type != DT_LNK) || strcmp(dir->d_name, ".") == 0 + || strcmp(dir->d_name, "..") == 0) { continue; } @@ -351,7 +355,8 @@ static void my_i2c_sensors_path(const char *method) done = 0; while ((file = readdir(fd2))) { /* FIXME : do all sensors have a temp_input1 ? */ - if (!strcmp(file->d_name, "temp_input1") || !strcmp(file->d_name, "temp1_input") || !strcmp(file->d_name, "temp1")) { + if (!strcmp(file->d_name, "temp_input1") || !strcmp(file->d_name, "temp1_input") + || !strcmp(file->d_name, "temp1")) { path = realloc(path, strlen(dname) + 1); strcpy(path, dname); done = 1; diff --git a/plugin_mysql.c b/plugin_mysql.c index 1ccdb0e..f616a39 100644 --- a/plugin_mysql.c +++ b/plugin_mysql.c @@ -1,4 +1,4 @@ -/* $Id: plugin_mysql.c,v 1.10 2006/01/20 15:58:05 reinelt Exp $ +/* $Id: plugin_mysql.c,v 1.11 2006/02/25 13:36:33 geronet Exp $ * * plugin for execute SQL queries into a MySQL DBSM. * @@ -23,6 +23,9 @@ * * * $Log: plugin_mysql.c,v $ + * Revision 1.11 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.10 2006/01/20 15:58:05 reinelt * MySQL::count() added again * @@ -170,7 +173,7 @@ static void my_MySQLcount(RESULT * result, RESULT * query) char *q; double value; MYSQL_RES *res; - + if (configure_mysql() < 0) { value = -1; SetResult(&result, R_NUMBER, &value); @@ -203,7 +206,7 @@ static void my_MySQLquery(RESULT * result, RESULT * query) char *q; double value; MYSQL_RES *res; - MYSQL_ROW row=NULL; + MYSQL_ROW row = NULL; if (configure_mysql() < 0) { value = -1; diff --git a/plugin_pop3.c b/plugin_pop3.c index f1cb799..9461a5a 100644 --- a/plugin_pop3.c +++ b/plugin_pop3.c @@ -1,4 +1,4 @@ -/* $Id: plugin_pop3.c,v 1.9 2005/05/08 04:32:44 reinelt Exp $ +/* $Id: plugin_pop3.c,v 1.10 2006/02/25 13:36:33 geronet Exp $ * * Plugin to check POP3 mail accounts * @@ -27,6 +27,9 @@ * * * $Log: plugin_pop3.c,v $ + * Revision 1.10 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.9 2005/05/08 04:32:44 reinelt * CodingStyle added and applied * @@ -305,12 +308,14 @@ static int getConfig(void) node->username = x; x = cfg_get(Section, password, ""); if (*x == '\0') { - info("[POP3] No '%s.%s' entry from %s, disabling POP3 account #%d", Section, password, cfg_source(), i); + info("[POP3] No '%s.%s' entry from %s, disabling POP3 account #%d", Section, password, cfg_source(), + i); free(x); } else { node->password = x; if (cfg_number(Section, port, POP3PORT, 1, 65536, &node->port) < 1) { - info("[POP3] No '%s.%s' entry from %s, %d will be used for account #%d", Section, port, cfg_source(), POP3PORT, i); + info("[POP3] No '%s.%s' entry from %s, %d will be used for account #%d", Section, port, + cfg_source(), POP3PORT, i); } check_node_add(&head, node); n++; diff --git a/widget_icon.c b/widget_icon.c index e677f56..38af359 100644 --- a/widget_icon.c +++ b/widget_icon.c @@ -1,4 +1,4 @@ -/* $Id: widget_icon.c,v 1.22 2006/01/23 06:17:18 reinelt Exp $ +/* $Id: widget_icon.c,v 1.23 2006/02/25 13:36:33 geronet Exp $ * * icon widget handling * @@ -21,6 +21,9 @@ * * * $Log: widget_icon.c,v $ + * Revision 1.23 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.22 2006/01/23 06:17:18 reinelt * timer widget added * @@ -208,17 +211,17 @@ void widget_icon_update(void *Self) Icon->visible = 0; DelResult(&result); } - + /* rotate icon bitmap */ Icon->curmap++; if (Icon->curmap >= Icon->maxmap) Icon->curmap = 0; } - + /* finally, draw it! */ if (W->class->draw) W->class->draw(W); - + /* add a new one-shot timer */ if (Icon->speed > 0) { timer_add(widget_icon_update, Self, Icon->speed, 1); diff --git a/widget_image.c b/widget_image.c index 1cd17f6..e0dc3fd 100644 --- a/widget_image.c +++ b/widget_image.c @@ -1,4 +1,4 @@ -/* $Id: widget_image.c,v 1.4 2006/02/19 07:20:54 reinelt Exp $ +/* $Id: widget_image.c,v 1.5 2006/02/25 13:36:33 geronet Exp $ * * image widget handling * @@ -21,6 +21,9 @@ * * * $Log: widget_image.c,v $ + * Revision 1.5 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.4 2006/02/19 07:20:54 reinelt * image support nearly finished * @@ -87,16 +90,16 @@ static void widget_image_render(const char *Name, WIDGET_IMAGE * Image) if (Image->bitmap) { int i; for (i = 0; i < Image->height * Image->width; i++) { - RGBA empty = { R: 0x00, G: 0x00, B: 0x00, A:0x00 }; + RGBA empty = { R: 0x00, G: 0x00, B: 0x00, A:0x00 }; Image->bitmap[i] = empty; } } - + if (Image->file == NULL || Image->file[0] == '\0') { error("Warning: Image %s has no file", Name); return; } - + fd = fopen(Image->file, "rb"); if (fd == NULL) { error("Warning: Image %s: fopen(%s) failed: %s", Name, Image->file, strerror(errno)); @@ -132,23 +135,23 @@ static void widget_image_render(const char *Name, WIDGET_IMAGE * Image) return; } for (i = 0; i < Image->height * Image->width; i++) { - RGBA empty = { R: 0x00, G: 0x00, B: 0x00, A:0x00 }; + RGBA empty = { R: 0x00, G: 0x00, B: 0x00, A:0x00 }; Image->bitmap[i] = empty; } } /* finally really render it */ - for (x=0; x < gdImage->sx; x++) { - for (y=0; y < gdImage->sy; y++) { - int p = gdImageGetTrueColorPixel (gdImage, x, y); + for (x = 0; x < gdImage->sx; x++) { + for (y = 0; y < gdImage->sy; y++) { + int p = gdImageGetTrueColorPixel(gdImage, x, y); int a = gdTrueColorGetAlpha(p); - int i = y*Image->width+x; - Image->bitmap[i].R = gdTrueColorGetRed(p); - Image->bitmap[i].G = gdTrueColorGetGreen (p); + int i = y * Image->width + x; + Image->bitmap[i].R = gdTrueColorGetRed(p); + Image->bitmap[i].G = gdTrueColorGetGreen(p); Image->bitmap[i].B = gdTrueColorGetBlue(p); /* GD's alpha is 0 (opaque) to 127 (tranparanet) */ /* our alpha is 0 (transparent) to 255 (opaque) */ - Image->bitmap[i].A = (a == 127) ? 0 : 255-2*a; + Image->bitmap[i].A = (a == 127) ? 0 : 255 - 2 * a; } } } @@ -192,7 +195,6 @@ static void widget_image_update(void *Self) Image->visible = 0; DelResult(&result); } - #ifdef WITH_GD /* render image into bitmap */ widget_image_render(W->name, Image); diff --git a/widget_image.h b/widget_image.h index c55b190..06927dc 100644 --- a/widget_image.h +++ b/widget_image.h @@ -1,4 +1,4 @@ -/* $Id: widget_image.h,v 1.2 2006/02/08 04:55:05 reinelt Exp $ +/* $Id: widget_image.h,v 1.3 2006/02/25 13:36:33 geronet Exp $ * * image widget handling * @@ -23,6 +23,9 @@ * * * $Log: widget_image.h,v $ + * Revision 1.3 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.2 2006/02/08 04:55:05 reinelt * moved widget registration to drv_generic_graphic * @@ -38,11 +41,11 @@ #include "rgb.h" typedef struct WIDGET_IMAGE { - RGBA *bitmap; /* image bitmap */ - int width, height; /* size of the image */ + RGBA *bitmap; /* image bitmap */ + int width, height; /* size of the image */ char *file_expr; /* expression for image filename */ void *file_tree; /* pre-compiled expression for image filename */ - char *file; /* evaluated filename */ + char *file; /* evaluated filename */ char *update_expr; /* expression for update interval */ void *update_tree; /* pre-compiled expression for update interval */ int update; /* update interval (msec) */ diff --git a/widget_keypad.h b/widget_keypad.h index e877aea..049cdc3 100644 --- a/widget_keypad.h +++ b/widget_keypad.h @@ -1,4 +1,4 @@ -/* $Id: widget_keypad.h,v 1.1 2006/02/21 05:50:34 reinelt Exp $ +/* $Id: widget_keypad.h,v 1.2 2006/02/25 13:36:33 geronet Exp $ * * keypad widget handling * @@ -23,6 +23,9 @@ * * * $Log: widget_keypad.h,v $ + * Revision 1.2 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.1 2006/02/21 05:50:34 reinelt * keypad support from Cris Maj * @@ -34,7 +37,8 @@ #define _WIDGET_KEYPAD_H_ typedef enum { KEY_UP = 1, KEY_DOWN = 2, KEY_LEFT = 4, KEY_RIGHT = 8, KEY_CONFIRM = 16, KEY_CANCEL = 32, KEY_PRESSED = - 64, KEY_RELEASED = 128 } KEYPADKEY; + 64, KEY_RELEASED = 128 +} KEYPADKEY; typedef struct WIDGET_KEYPAD { char *expression; /* expression that delivers the value */ diff --git a/widget_timer.c b/widget_timer.c index 6c9c832..0190acd 100644 --- a/widget_timer.c +++ b/widget_timer.c @@ -1,4 +1,4 @@ -/* $Id: widget_timer.c,v 1.1 2006/01/23 06:17:18 reinelt Exp $ +/* $Id: widget_timer.c,v 1.2 2006/02/25 13:36:33 geronet Exp $ * * timer widget handling * @@ -21,6 +21,9 @@ * * * $Log: widget_timer.c,v $ + * Revision 1.2 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.1 2006/01/23 06:17:18 reinelt * timer widget added * @@ -69,7 +72,7 @@ void widget_timer_update(void *Self) Timer->update = 10; DelResult(&result); } - + Timer->active = 1; if (Timer->active_tree != NULL) { Eval(Timer->active_tree, &result); @@ -78,13 +81,13 @@ void widget_timer_update(void *Self) Timer->active = 0; DelResult(&result); } - + /* finally, fire it! */ if (Timer->active) { Eval(Timer->expr_tree, &result); DelResult(&result); } - + /* add a new one-shot timer */ timer_add(widget_timer_update, Self, Timer->update, 1); } @@ -101,7 +104,7 @@ int widget_timer_init(WIDGET * Self) section = malloc(strlen(Self->name) + 8); strcpy(section, "Widget:"); strcat(section, Self->name); - + Timer = malloc(sizeof(WIDGET_TIMER)); memset(Timer, 0, sizeof(WIDGET_TIMER)); @@ -109,7 +112,7 @@ int widget_timer_init(WIDGET * Self) Timer->expression = cfg_get_raw(section, "axpression", NULL); Timer->update_expr = cfg_get_raw(section, "update", "100"); Timer->active_expr = cfg_get_raw(section, "active", "1"); - + /* sanity checks */ if (Timer->expression == NULL || *Timer->expression == '\0') { error("Timer %s has no expression, using '1'", Self->name); @@ -124,11 +127,11 @@ int widget_timer_init(WIDGET * Self) Compile(Timer->expression, &Timer->expr_tree); Compile(Timer->update_expr, &Timer->update_tree); Compile(Timer->active_expr, &Timer->active_tree); - - + + free(section); Self->data = Timer; - + /* just do it! */ widget_timer_update(Self); diff --git a/widget_timer.h b/widget_timer.h index bf122d4..2d789d7 100644 --- a/widget_timer.h +++ b/widget_timer.h @@ -1,4 +1,4 @@ -/* $Id: widget_timer.h,v 1.1 2006/01/23 06:17:18 reinelt Exp $ +/* $Id: widget_timer.h,v 1.2 2006/02/25 13:36:33 geronet Exp $ * * timer widget handling * @@ -23,6 +23,9 @@ * * * $Log: widget_timer.h,v $ + * Revision 1.2 2006/02/25 13:36:33 geronet + * updated indent.sh, applied coding style + * * Revision 1.1 2006/01/23 06:17:18 reinelt * timer widget added * @@ -33,14 +36,14 @@ #define _WIDGET_TIMER_H_ typedef struct WIDGET_TIMER { - char *expression; /* main timer expression */ - void *expr_tree; /* pre-compiled main expression */ + char *expression; /* main timer expression */ + void *expr_tree; /* pre-compiled main expression */ char *update_expr; /* expression for update interval */ void *update_tree; /* pre-compiled expression for update interval */ int update; /* update interval (msec) */ char *active_expr; /* expression for active */ void *active_tree; /* pre-compiled expression for active */ - int active; /* timer active? */ + int active; /* timer active? */ } WIDGET_TIMER; extern WIDGET_CLASS Widget_Timer; -- cgit v1.2.3