]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2004-06-20 10:09:52 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 20 Jun 2004 10:09:56 +0000 (10:09 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 20 Jun 2004 10:09:56 +0000 (10:09 +0000)
'const'ified the whole source

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@476 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

51 files changed:
cfg.c
cfg.h
debug.c
debug.h
drv.c
drv.h
drv_BeckmannEgle.c
drv_Crystalfontz.c
drv_Curses.c
drv_Cwlinux.c
drv_HD44780.c
drv_Image.c
drv_M50530.c
drv_MatrixOrbital.c
drv_MilfordInstruments.c
drv_NULL.c
drv_T6963.c
drv_USBLCD.c
drv_X11.c
drv_generic_graphic.c
drv_generic_graphic.h
drv_generic_parport.c
drv_generic_parport.h
drv_generic_serial.c
drv_generic_serial.h
drv_generic_text.c
drv_generic_text.h
evaluator.c
evaluator.h
hash.c
hash.h
layout.c
layout.h
plugin_cfg.c
plugin_exec.c
plugin_i2c_sensors.c
plugin_imon.c
plugin_isdn.c
plugin_proc_stat.c
plugin_uptime.c
plugin_wireless.c
qprintf.c
thread.c
thread.h
timer.c
timer.h
udelay.c
udelay.h
widget.c
widget.h
widget_icon.c

diff --git a/cfg.c b/cfg.c
index 8d9388e58e30dc46da8dc2afb5127b97ee79f6ac..4a9ebea6436e2484f1c38cf8546324eb92f8885f 100644 (file)
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.39 2004/03/11 06:39:58 reinelt Exp $^
+/* $Id: cfg.c,v 1.40 2004/06/20 10:09:52 reinelt Exp $^
  *
  * config file stuff
  *
  *
  *
  * $Log: cfg.c,v $
+ * Revision 1.40  2004/06/20 10:09:52  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.39  2004/03/11 06:39:58  reinelt
  * big patch from Martin:
  * - reuse filehandles
@@ -299,7 +303,7 @@ static int c_sort (const void *a, const void *b)
 
 
 // remove leading and trailing whitespace
-static char *strip (char *s, int strip_comments)
+static char *strip (char *s, const int strip_comments)
 {
   char *p;
   
@@ -356,9 +360,9 @@ static char *dequote (char *string)
 
 // which if a string contains only valid chars
 // i.e. start with a char and contains chars and nums
-static int validchars (char *string)
+static int validchars (const char *string)
 {
-  char *c;
+  const char *c;
 
   for (c=string; *c; c++) {
     // first and following chars
@@ -371,7 +375,7 @@ static int validchars (char *string)
 }
 
 
-static void cfg_add (char *section, char *key, char *val, int lock)
+static void cfg_add (const char *section, const char *key, const char *val, const int lock)
 {
   char *buffer;
   ENTRY *entry;
@@ -410,7 +414,7 @@ static void cfg_add (char *section, char *key, char *val, int lock)
 }
 
 
-int l4l_cfg_cmd (char *arg)
+int cfg_cmd (const char *arg)
 {
   char *key, *val;
   char buffer[256];
@@ -430,7 +434,7 @@ int l4l_cfg_cmd (char *arg)
 }
 
 
-char *l4l_cfg_list (char *section)
+char *cfg_list (const char *section)
 {
   int i, len;
   char *key, *list;
@@ -461,7 +465,7 @@ char *l4l_cfg_list (char *section)
 }
 
 
-static char *cfg_lookup (char *section, char *key)
+static char *cfg_lookup (const char *section, const char *key)
 {
   int len;
   char *buffer;
@@ -496,16 +500,16 @@ static char *cfg_lookup (char *section, char *key)
 }
 
 
-char *l4l_cfg_get_raw (char *section, char *key, char *defval)
+char *cfg_get_raw (const char *section, const char *key, const char *defval)
 {
   char *val=cfg_lookup(section, key);
   
   if (val!=NULL) return val;
-  return defval;
+  return (char *)defval;
 }
 
 
-char *l4l_cfg_get (char *section, char *key, char *defval)
+char *cfg_get (const char *section, const char *key, const char *defval)
 {
   char *expression;
   char *retval;
@@ -530,7 +534,7 @@ char *l4l_cfg_get (char *section, char *key, char *defval)
 }
 
 
-int l4l_cfg_number (char *section, char *key, int defval, int min, int max, int *value) 
+int cfg_number (const char *section, const char *key, const int defval, const int min, const int max, int *value) 
 {
   char *expression;
   void *tree = NULL;
@@ -575,7 +579,7 @@ int l4l_cfg_number (char *section, char *key, int defval, int min, int max, int
 }
 
 
-static int cfg_check_source(char *file)
+static int cfg_check_source(const char *file)
 {
   /* as passwords and commands are stored in the config file,
    * we will check that:
@@ -616,7 +620,7 @@ static int cfg_check_source(char *file)
 }
 
 
-static int cfg_read (char *file)
+static int cfg_read (const char *file)
 {
   FILE *stream;
   char buffer[256];
@@ -757,7 +761,7 @@ static int cfg_read (char *file)
 }
 
 
-int l4l_cfg_init (char *file)
+int cfg_init (const char *file)
 {
   if (cfg_check_source(file) == -1) {
     error("config file '%s' is insecure, aborting", file);
@@ -773,7 +777,7 @@ int l4l_cfg_init (char *file)
 }
 
 
-char *l4l_cfg_source (void)
+char *cfg_source (void)
 {
   if (Config_File)
     return Config_File;
@@ -782,7 +786,7 @@ char *l4l_cfg_source (void)
 }
 
 
-int l4l_cfg_exit (void)
+int cfg_exit (void)
 {
   int i;
   for (i=0; i<nConfig; i++) {    
@@ -803,13 +807,3 @@ int l4l_cfg_exit (void)
   return 0;
 }
 
-
-int   (*cfg_init)    (char *source)                           = l4l_cfg_init;
-char *(*cfg_source)  (void)                                   = l4l_cfg_source;
-int   (*cfg_cmd)     (char *arg)                              = l4l_cfg_cmd;
-char *(*cfg_list)    (char *section)                          = l4l_cfg_list;
-char *(*cfg_get_raw) (char *section, char *key, char *defval) = l4l_cfg_get_raw;
-char *(*cfg_get)     (char *section, char *key, char *defval) = l4l_cfg_get;
-int   (*cfg_number)  (char *section, char *key, int   defval, 
-                     int min, int max, int *value)           = l4l_cfg_number;
-int   (*cfg_exit)    (void)                                   = l4l_cfg_exit;
diff --git a/cfg.h b/cfg.h
index 2a43eed050d8832f0c1e51bb123197458c575fce..38b04e4432b9ffc12f3ec947d971f21e8ef23872 100644 (file)
--- a/cfg.h
+++ b/cfg.h
@@ -1,4 +1,4 @@
-/* $Id: cfg.h,v 1.10 2004/01/30 20:57:55 reinelt Exp $
+/* $Id: cfg.h,v 1.11 2004/06/20 10:09:53 reinelt Exp $
  *
  * config file stuff
  *
  *
  *
  * $Log: cfg.h,v $
+ * Revision 1.11  2004/06/20 10:09:53  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.10  2004/01/30 20:57:55  reinelt
  * HD44780 patch from Martin Hejl
  * dmalloc integrated
 #ifndef _CFG_H_
 #define _CFG_H_
 
-extern int   (*cfg_init)    (char *source);
-extern char *(*cfg_source)  (void);
-extern int   (*cfg_cmd)     (char *arg);
-extern char *(*cfg_list)    (char *section);
-extern char *(*cfg_get_raw) (char *section, char *key, char *defval);
-extern char *(*cfg_get)     (char *section, char *key, char *defval);
-extern int   (*cfg_number)  (char *section, char *key, int   defval, 
-                            int min, int max, int *value);
-extern int   (*cfg_exit)    (void);
-
-int   l4l_cfg_init    (char *file);
-char *l4l_cfg_source  (void);
-int   l4l_cfg_cmd     (char *arg);
-char *l4l_cfg_list    (char *section);
-char *l4l_cfg_get_raw (char *section, char *key, char *defval);
-char *l4l_cfg_get     (char *section, char *key, char *defval);
-int   l4l_cfg_number  (char *section, char *key, int   defval, 
-                      int min, int max, int *value);
-int   l4l_cfg_exit    (void);
+int   cfg_init    (const char *file);
+char *cfg_source  (void);
+int   cfg_cmd     (const char *arg);
+char *cfg_list    (const char *section);
+char *cfg_get_raw (const char *section, const char *key, const char *defval);
+char *cfg_get     (const char *section, const char *key, const char *defval);
+int   cfg_number  (const char *section, const char *key, const int   defval, 
+                  const int min, const int max, int *value);
+int   cfg_exit    (void);
 
 #endif
diff --git a/debug.c b/debug.c
index 55bb16dc71c63eb802ac7fce0b6c4730e027e6c2..ecfe034a3e27bdcf68eafeb371d859b3a98e11c4 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -1,4 +1,4 @@
-/* $Id: debug.c,v 1.8 2004/05/26 11:37:36 reinelt Exp $
+/* $Id: debug.c,v 1.9 2004/06/20 10:09:54 reinelt Exp $
  *
  * debug() and error() functions
  *
  *
  *
  * $Log: debug.c,v $
+ * Revision 1.9  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.8  2004/05/26 11:37:36  reinelt
  *
  * Curses driver ported.
@@ -78,7 +82,7 @@ int running_background = 0;
 
 int verbose_level = 0;
 
-void message (int level, const char *format, ...)
+void message (const int level, const char *format, ...)
 {
   va_list ap;
   char buffer[256];
diff --git a/debug.h b/debug.h
index f730cb23d3d62897f266e77299c9567a9fa4e79f..2a30d8ce4b3b15256209eca2751973896e8bd27a 100644 (file)
--- a/debug.h
+++ b/debug.h
@@ -1,4 +1,4 @@
-/* $Id: debug.h,v 1.7 2004/04/12 04:55:59 reinelt Exp $
+/* $Id: debug.h,v 1.8 2004/06/20 10:09:54 reinelt Exp $
  *
  * debug messages
  *
  *
  *
  * $Log: debug.h,v $
+ * Revision 1.8  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.7  2004/04/12 04:55:59  reinelt
  * emitted a BIG FAT WARNING if msr.h could not be found (and therefore
  * the gettimeofday() delay loop would be used)
@@ -62,7 +66,7 @@ extern int running_foreground;
 extern int running_background;
 extern int verbose_level;
 
-void message (int level, const char *format, ...);
+void message (const int level, const char *format, ...);
 
 #define debug(args...) message (2, __FILE__ ": " args)
 #define info(args...)  message (1, args)
diff --git a/drv.c b/drv.c
index 4c2a6e87e2279e7875ff6d056b2a0a4b063e57d9..55fdf627397819d8dbb56967ded17156988b11c1 100644 (file)
--- a/drv.c
+++ b/drv.c
@@ -1,4 +1,4 @@
-/* $Id: drv.c,v 1.18 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv.c,v 1.19 2004/06/20 10:09:54 reinelt Exp $
  *
  * new framework for display drivers
  *
  *
  *
  * $Log: drv.c,v $
+ * Revision 1.19  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.18  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -230,7 +234,7 @@ int drv_list (void)
 }
 
 
-int drv_init (char *section, char *driver, int quiet)
+int drv_init (const char *section, const char *driver, const int quiet)
 {
   int i;
   for (i = 0; Driver[i]; i++) {
@@ -245,7 +249,7 @@ int drv_init (char *section, char *driver, int quiet)
 }
 
 
-int drv_quit (int quiet)
+int drv_quit (const int quiet)
 {
   if (Drv->quit == NULL) return 0;
   return Drv->quit(quiet);
diff --git a/drv.h b/drv.h
index 4635c3dec3b88ad2e7e6889a423aba4f86f1fabb..bd9b9b19b2fb590be14e663106d3ddd3a0a7640c 100644 (file)
--- a/drv.h
+++ b/drv.h
@@ -1,4 +1,4 @@
-/* $Id: drv.h,v 1.5 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv.h,v 1.6 2004/06/20 10:09:54 reinelt Exp $
  *
  * new framework for display drivers
  *
  *
  *
  * $Log: drv.h,v $
+ * Revision 1.6  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -56,8 +60,8 @@
 typedef struct DRIVER {
   char *name;
   int (*list)  (void);
-  int (*init)  (char *section, int quiet);
-  int (*quit)  (int quiet);
+  int (*init)  (const char *section, const int quiet);
+  int (*quit)  (const int quiet);
 } DRIVER;
 
 
@@ -67,7 +71,7 @@ typedef struct DRIVER {
 extern char *output;
 
 int drv_list (void);
-int drv_init (char *section, char *driver, int quiet);
-int drv_quit (int quiet);
+int drv_init (const char *section, const char *driver, const int quiet);
+int drv_quit (const int quiet);
 
 #endif
index 082fad72b5db2fb7b51169c1e8b1ee1410f5009d..9cbe4185cf491b1d6c361d8dc2edb9a977641ea8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_BeckmannEgle.c,v 1.7 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_BeckmannEgle.c,v 1.8 2004/06/20 10:09:54 reinelt Exp $
  *
  * driver for Beckmann+Egle mini terminals
  * Copyright 2000 Michael Reinelt <reinelt@eunet.at>
  *
  *
  * $Log: drv_BeckmannEgle.c,v $
+ * Revision 1.8  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.7  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -116,7 +120,7 @@ static int  Model;
 // ***  hardware dependant functions    ***
 // ****************************************
 
-static void drv_BE_write (int row, int col, unsigned char *data, int len)
+static void drv_BE_write (const int row, const int col, const unsigned char *data, const int len)
 {
   char cmd[] = "\033[y;xH";
 
@@ -128,7 +132,7 @@ static void drv_BE_write (int row, int col, unsigned char *data, int len)
 }
 
 
-static void drv_BE_defchar (int ascii, unsigned char *matrix)
+static void drv_BE_defchar (const int ascii, const unsigned char *matrix)
 {
   int  i;
   char cmd[32];
@@ -156,7 +160,7 @@ static void drv_BE_clear (void)
 }
 
 
-static int drv_BE_start (char *section, int quiet)
+static int drv_BE_start (const char *section, const int quiet)
 {
   int i;  
   char *model;
@@ -235,7 +239,7 @@ int drv_BE_list (void)
 
 
 // initialize driver & display
-int drv_BE_init (char *section, int quiet)
+int drv_BE_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -295,7 +299,7 @@ int drv_BE_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_BE_quit (int quiet) {
+int drv_BE_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index fb75ac00724f7ef30ebb5e6c851fe485322ee504..1102cbcc3ea662a19c050b372ad6ce456eef38df 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_Crystalfontz.c,v 1.26 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_Crystalfontz.c,v 1.27 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for Crystalfontz display modules
  *
  *
  *
  * $Log: drv_Crystalfontz.c,v $
+ * Revision 1.27  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.26  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -223,7 +227,7 @@ static MODEL Models[] = {
 // x^0 + x^5 + x^12
 #define CRCPOLY 0x8408 
 
-static unsigned short CRC (unsigned char *p, size_t len, unsigned short seed)
+static unsigned short CRC (const unsigned char *p, size_t len, unsigned short seed)
 {
   int i;
   while (len--) {
@@ -234,12 +238,12 @@ static unsigned short CRC (unsigned char *p, size_t len, unsigned short seed)
   return ~seed;
 }
 
-static unsigned char LSB (unsigned short word)
+static unsigned char LSB (const unsigned short word)
 {
   return word & 0xff;
 }
 
-static unsigned char MSB (unsigned short word)
+static unsigned char MSB (const unsigned short word)
 {
   return word >> 8;
 }
@@ -363,7 +367,7 @@ static void drv_CF_timer (void *notused)
 }
 
 
-static void drv_CF_send (int cmd, int len, char *data)
+static void drv_CF_send (const int cmd, int len, const unsigned char *data)
 {
   unsigned char buffer[22];
   unsigned short crc;
@@ -389,7 +393,7 @@ static void drv_CF_send (int cmd, int len, char *data)
 }
 
 
-static void drv_CF_write1 (int row, int col, unsigned char *data, int len)
+static void drv_CF_write1 (const int row, const int col, const unsigned char *data, const int len)
 {
   char cmd[3]="\021xy"; // set cursor position
   
@@ -405,46 +409,49 @@ static void drv_CF_write1 (int row, int col, unsigned char *data, int len)
 }
 
 
-static void drv_CF_write2 (int row, int col, unsigned char *data, int len)
+static void drv_CF_write2 (const int row, const int col, const unsigned char *data, const int len)
 {
+  int l = len;
+
   // limit length
-  if (col+len>16) len=16-col;
-  if (len<0) len=0;
+  if (col + l > 16) l = 16 - col;
+  if (l < 0) l = 0;
   
   // sanity check
-  if (row>=2 || col+len>16) {
+  if (row >= 2 || col + l > 16) {
     error ("%s: internal error: write outside linebuffer bounds!", Name);
     return;
   }
-  memcpy (Line+16*row+col, data, len);
-  drv_CF_send (7+row, 16, Line+16*row);
+  memcpy (Line + 16 * row + col, data, l);
+  drv_CF_send (7 + row, 16, Line + 16 * row);
 }
 
 
-static void drv_CF_write3 (int row, int col, unsigned char *data, int len)
+static void drv_CF_write3 (const int row, const int col, const unsigned char *data, const int len)
 {
+  int l = len;
   char cmd[23];
 
   // limit length
-  if (col + len > 20) len = 20 - col;
-  if (len < 0) len = 0;
+  if (col + l > 20) l = 20 - col;
+  if (l < 0) l = 0;
 
   // sanity check
-  if (row >= 2 || col + len > 20) {
+  if (row >= 2 || col + l > 20) {
     error ("%s: internal error: write outside display bounds!", Name);
     return;
   }
 
   cmd[0] = col;
   cmd[1] = row;
-  memcpy (cmd+2, data, len);
+  memcpy (cmd+2, data, l);
 
-  drv_CF_send (31, len+2, cmd);
+  drv_CF_send (31, l+2, cmd);
   
 }
 
 
-static void drv_CF_defchar1 (int ascii, unsigned char *matrix)
+static void drv_CF_defchar1 (const int ascii, const unsigned char *matrix)
 {
   int i;
   char cmd[10]="\031n"; // set custom char bitmap
@@ -458,7 +465,7 @@ static void drv_CF_defchar1 (int ascii, unsigned char *matrix)
 }
 
 
-static void drv_CF_defchar23 (int ascii, unsigned char *matrix)
+static void drv_CF_defchar23 (const int ascii, const unsigned char *matrix)
 {
   int i;
   char buffer[9];
@@ -759,7 +766,7 @@ static void drv_CF_start_3 (void)
 }
 
 
-static int drv_CF_start (char *section)
+static int drv_CF_start (const char *section)
 {
   int i;  
   char *model;
@@ -851,7 +858,7 @@ static int drv_CF_start (char *section)
 // ****************************************
 
 
-static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
+static void plugin_contrast (RESULT *result, const int argc, RESULT *argv[])
 {
   double contrast;
   
@@ -871,7 +878,7 @@ static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
 }
 
 
-static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
+static void plugin_backlight (RESULT *result, const int argc, RESULT *argv[])
 {
   double backlight;
   
@@ -891,7 +898,7 @@ static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
 }
 
 
-static void plugin_fan_pwm (RESULT *result, int argc, RESULT *argv[])
+static void plugin_fan_pwm (RESULT *result, const int argc, RESULT *argv[])
 {
   double pwm;
   
@@ -941,7 +948,7 @@ int drv_CF_list (void)
 
 
 // initialize driver & display
-int drv_CF_init (char *section, int quiet)
+int drv_CF_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -1031,7 +1038,7 @@ int drv_CF_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_CF_quit (int quiet) {
+int drv_CF_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index 7550e6bca0255353976692abe5ed823ebdd08f5f..7b1be2d15a9cd3ceb497426aae8e9d0cdbc95d00 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_Curses.c,v 1.5 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_Curses.c,v 1.6 2004/06/20 10:09:54 reinelt Exp $
  *
  * pure ncurses based text driver
  *
  *
  *
  * $Log: drv_Curses.c,v $
+ * Revision 1.6  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -96,8 +100,9 @@ static void drv_Curs_clear (void)
 }
 
 
-static void drv_Curs_write (int row, int col, unsigned char *data, int len)
+static void drv_Curs_write (const int row, const int col, const unsigned char *data, const int len)
 {
+  int l = len;
   char *p;
   
   while ((p = strpbrk(data, "\r\n")) != NULL) {
@@ -105,15 +110,15 @@ static void drv_Curs_write (int row, int col, unsigned char *data, int len)
   }
   
   if (col < DCOLS) {
-    if (DCOLS-col < len ) len = DCOLS-col;
-    mvwprintw(w, row+1 , col+1, "%.*s", DCOLS-col, data);
+    if (DCOLS-col < l ) l = DCOLS-col;
+    mvwprintw(w, row+1 , col+1, "%.*s", l, data);
     wmove(w, DROWS+1, 0);
     wrefresh(w);  
   }
 }
 
 
-static void drv_Curs_defchar (int ascii, unsigned char *buffer)
+static void drv_Curs_defchar (const int ascii, const unsigned char *buffer)
 {
   // empty
 }
@@ -161,7 +166,7 @@ int curses_error(char *buffer)
 }
 
 
-static int drv_Curs_start (char *section, int quiet)
+static int drv_Curs_start (const char *section, const int quiet)
 {
   char *s;
   
@@ -245,7 +250,7 @@ int drv_Curs_list (void)
 
 
 // initialize driver & display
-int drv_Curs_init (char *section, int quiet)
+int drv_Curs_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -296,7 +301,7 @@ int drv_Curs_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_Curs_quit (int quiet) {
+int drv_Curs_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index 9d230884f7c4b0681e91bdb7d9d177eb07b1c366..00973bd3a55ca8f947426d5e4154d7a111a97d46 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_Cwlinux.c,v 1.16 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_Cwlinux.c,v 1.17 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for Cwlinux display modules
  *
  *
  *
  * $Log: drv_Cwlinux.c,v $
+ * Revision 1.17  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.16  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -159,7 +163,7 @@ static MODEL Models[] = {
 // ***  hardware dependant functions    ***
 // ****************************************
 
-static void drv_CW_write (int row, int col, unsigned char *data, int len)
+static void drv_CW_write (const int row, const int col, const unsigned char *data, const int len)
 {
   char cmd[6]="\376Gxy\375";
   
@@ -171,7 +175,7 @@ static void drv_CW_write (int row, int col, unsigned char *data, int len)
 }
 
 
-static void drv_CW1602_defchar (int ascii, unsigned char *buffer)
+static void drv_CW1602_defchar (const int ascii, const unsigned char *buffer)
 {
   int i;
   char cmd[12]="\376Nn12345678\375";
@@ -186,7 +190,7 @@ static void drv_CW1602_defchar (int ascii, unsigned char *buffer)
 }
 
 
-static void drv_CW12232_defchar (int ascii, unsigned char *buffer)
+static void drv_CW12232_defchar (const int ascii, const unsigned char *buffer)
 {
   int i, j;
   char cmd[10]="\376Nn123456\375";
@@ -256,7 +260,7 @@ static int drv_CW_brightness (int brightness)
 }
 
 
-static int drv_CW_start (char *section)
+static int drv_CW_start (const char *section)
 {
   int i;  
   char *model;
@@ -323,7 +327,7 @@ static int drv_CW_start (char *section)
 // ****************************************
 
 
-static void plugin_brightness (RESULT *result, int argc, RESULT *argv[])
+static void plugin_brightness (RESULT *result, const int argc, RESULT *argv[])
 {
   double brightness;
   
@@ -370,7 +374,7 @@ int drv_CW_list (void)
 
 
 // initialize driver & display
-int drv_CW_init (char *section, int quiet)
+int drv_CW_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -445,7 +449,7 @@ int drv_CW_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_CW_quit (int quiet) {
+int drv_CW_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
   drv_generic_text_quit();
index f71bab8578b51f262cc3fcd83308c4ee57a85231..8dea43ae80ec95a3edd830ce3beeb1cc00503d30 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_HD44780.c,v 1.29 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_HD44780.c,v 1.30 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for HD44780-based displays
  *
  *
  *
  * $Log: drv_HD44780.c,v $
+ * Revision 1.30  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.29  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -366,7 +370,7 @@ static void wait_for_busy_flag(int controller)
 }
 
 
-static void drv_HD_nibble(unsigned char controller, unsigned char nibble)
+static void drv_HD_nibble(const unsigned char controller, const unsigned char nibble)
 {
   unsigned char enable;
 
@@ -397,7 +401,7 @@ static void drv_HD_nibble(unsigned char controller, unsigned char nibble)
 }
 
 
-static void drv_HD_byte (unsigned char controller, unsigned char data, unsigned char RS)
+static void drv_HD_byte (const unsigned char controller, const unsigned char data, const unsigned char RS)
 {
   // send high nibble of the data
   drv_HD_nibble (controller, ((data>>4)&0x0f)|RS);
@@ -410,7 +414,7 @@ static void drv_HD_byte (unsigned char controller, unsigned char data, unsigned
 }
 
 
-static void drv_HD_command (unsigned char controller, unsigned char cmd, int delay)
+static void drv_HD_command (const unsigned char controller, const unsigned char cmd, const int delay)
 {
   unsigned char enable;
 
@@ -450,8 +454,9 @@ static void drv_HD_command (unsigned char controller, unsigned char cmd, int del
 }
 
 
-static void drv_HD_data (unsigned char controller, char *string, int len, int delay)
+static void drv_HD_data (const unsigned char controller, const char *string, const int len, const int delay)
 {
+  int l = len;
   unsigned char enable;
 
   // sanity check
@@ -474,7 +479,7 @@ static void drv_HD_data (unsigned char controller, char *string, int len, int de
       ndelay(T_AS);
     }
     
-    while (len--) {
+    while (l--) {
 
       if (UseBusy) {
        wait_for_busy_flag(controller);
@@ -496,7 +501,7 @@ static void drv_HD_data (unsigned char controller, char *string, int len, int de
     
   } else { // 4 bit mode
     
-    while (len--) {
+    while (l--) {
       if (UseBusy) wait_for_busy_flag(controller);
 
       // send data with RS enabled
@@ -548,14 +553,14 @@ static void drv_HD_goto (int row, int col)
 }
 
 
-static void drv_HD_write (int row, int col, unsigned char *data, int len)
+static void drv_HD_write (const int row, const int col, const unsigned char *data, const int len)
 {
   drv_HD_goto (row, col);
   drv_HD_data (currController, data, len, T_EXEC);
 }
 
 
-static void drv_HD_defchar (int ascii, unsigned char *matrix)
+static void drv_HD_defchar (const int ascii, const unsigned char *matrix)
 {
   int i;
   unsigned char buffer[8];
@@ -590,7 +595,7 @@ static int drv_HD_brightness (int brightness)
   
 // Fixme: GPO's
 #if 0
-static void drv_HD_setGPO (int bits)
+static void drv_HD_setGPO (const int bits)
 {
   if (Lcd.gpos>0) {
     
@@ -608,7 +613,7 @@ static void drv_HD_setGPO (int bits)
 #endif
 
 
-static int drv_HD_start (char *section, int quiet)
+static int drv_HD_start (const char *section, const int quiet)
 {
   char *model, *strsize;
   int rows=-1, cols=-1, gpos=-1;
@@ -806,7 +811,7 @@ int drv_HD_list (void)
 
 
 // initialize driver & display
-int drv_HD_init (char *section, int quiet)
+int drv_HD_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int asc255bug;
@@ -874,7 +879,7 @@ int drv_HD_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_HD_quit (int quiet) {
+int drv_HD_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index 3d5b08634df0f379e1c64313d4a8edf608824f89..41daaeb003ad2c59b32fa56b61bf6733cf65fb2b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_Image.c,v 1.6 2004/06/19 08:20:19 reinelt Exp $
+/* $Id: drv_Image.c,v 1.7 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style Image (PPM/PNG) Driver for LCD4Linux 
  *
  *
  *
  * $Log: drv_Image.c,v $
+ * Revision 1.7  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.6  2004/06/19 08:20:19  reinelt
  *
  * compiler warning in image driver fixed
@@ -329,7 +333,7 @@ static void drv_IMG_timer (void *notused)
 }
 
 
-static void drv_IMG_blit(int row, int col, int height, int width)
+static void drv_IMG_blit(const int row, const int col, const int height, const int width)
 {
   int r, c;
 
@@ -345,7 +349,7 @@ static void drv_IMG_blit(int row, int col, int height, int width)
 }
 
 
-static int drv_IMG_start (char *section)
+static int drv_IMG_start (const char *section)
 {
   char *s;
 
@@ -485,7 +489,7 @@ int drv_IMG_list (void)
 
 
 // initialize driver & display
-int drv_IMG_init (char *section, int quiet)
+int drv_IMG_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -525,7 +529,7 @@ int drv_IMG_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_IMG_quit (int quiet) {
+int drv_IMG_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
   drv_generic_graphic_quit();
index 2749912d42c651bfafdc2acea849456b4651d700..cddf0cc9bb5f28b757e3e825ff5b1c357eb76ca7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_M50530.c,v 1.11 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_M50530.c,v 1.12 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for M50530-based displays
  *
  *
  *
  * $Log: drv_M50530.c,v $
+ * Revision 1.12  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.11  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -138,7 +142,7 @@ static MODEL Models[] = {
 // ***  hardware dependant functions    ***
 // ****************************************
 
-static void drv_M5_command (unsigned int cmd, int delay)
+static void drv_M5_command (const unsigned int cmd, const int delay)
 {
     
   // put data on DB1..DB8
@@ -170,23 +174,24 @@ static void drv_M5_clear (void)
 }
 
 
-static void drv_M5_write (int row, int col, unsigned char *data, int len)
+static void drv_M5_write (const int row, const int col, const unsigned char *data, const int len)
 {
+  int l = len;
   unsigned int cmd;
   unsigned int pos;
   
-  pos=row*48+col;
-  if (row>3) pos-=168;
-  drv_M5_command (0x300|pos, 20);
+  pos = row * 48 + col;
+  if (row > 3) pos -= 168;
+  drv_M5_command (0x300 | pos, 20);
   
-  while (len--) {
-    cmd=*data++;
-    drv_M5_command (0x100|cmd, 20);
+  while (l--) {
+    cmd = *data++;
+    drv_M5_command (0x100 | cmd, 20);
   }
 }
 
 
-static void drv_M5_defchar (int ascii, unsigned char *matrix)
+static void drv_M5_defchar (const int ascii, const unsigned char *matrix)
 {
   int i;
   
@@ -202,7 +207,7 @@ static void drv_M5_defchar (int ascii, unsigned char *matrix)
 
 // Fixme: GPO's
 #if 0
-static void drv_M5_setGPO (int bits)
+static void drv_M5_setGPO (const int bits)
 {
   if (Lcd.gpos>0) {
 
@@ -220,7 +225,7 @@ static void drv_M5_setGPO (int bits)
 #endif
 
 
-static int drv_M5_start (char *section, int quiet)
+static int drv_M5_start (const char *section, const int quiet)
 {
   char *model, *s;
   int rows=-1, cols=-1, gpos=-1;
@@ -329,7 +334,7 @@ int drv_M5_list (void)
 
 
 // initialize driver & display
-int drv_M5_init (char *section, int quiet)
+int drv_M5_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -388,7 +393,7 @@ int drv_M5_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_M5_quit (int quiet) {
+int drv_M5_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index 6e7cbc8d95c6a6555f30c59c9269c9086cda2146..0b9af926fce62deeb29af945d10853c9119d76a5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_MatrixOrbital.c,v 1.32 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.33 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for Matrix Orbital serial display modules
  *
  *
  *
  * $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.33  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.32  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -254,7 +258,7 @@ static void drv_MO_clear (void)
 }
 
 
-static void drv_MO_write (int row, int col, unsigned char *data, int len)
+static void drv_MO_write (const int row, const int col, const unsigned char *data, const int len)
 {
   char cmd[5]="\376Gyx";
 
@@ -266,7 +270,7 @@ static void drv_MO_write (int row, int col, unsigned char *data, int len)
 }
 
 
-static void drv_MO_defchar (int ascii, unsigned char *matrix)
+static void drv_MO_defchar (const int ascii, const unsigned char *matrix)
 {
   int i;
   char cmd[11]="\376N";
@@ -420,7 +424,7 @@ static int drv_MO_rpm (int num)
 }
 
 
-static int drv_MO_start (char *section, int quiet)
+static int drv_MO_start (const char *section, const int quiet)
 {
   int i;  
   char *model;
@@ -527,7 +531,7 @@ static int drv_MO_start (char *section, int quiet)
 // ****************************************
 
 
-static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
+static void plugin_contrast (RESULT *result, const int argc, RESULT *argv[])
 {
   double contrast;
   
@@ -547,7 +551,7 @@ static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
 }
 
 
-static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
+static void plugin_backlight (RESULT *result, const int argc, RESULT *argv[])
 {
   double backlight;
   
@@ -567,7 +571,7 @@ static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
 }
 
 
-static void plugin_gpo (RESULT *result, int argc, RESULT *argv[])
+static void plugin_gpo (RESULT *result, const int argc, RESULT *argv[])
 {
   double gpo;
   
@@ -587,7 +591,7 @@ static void plugin_gpo (RESULT *result, int argc, RESULT *argv[])
 }
 
 
-static void plugin_pwm (RESULT *result, int argc, RESULT *argv[])
+static void plugin_pwm (RESULT *result, const int argc, RESULT *argv[])
 {
   double pwm;
   
@@ -643,7 +647,7 @@ int drv_MO_list (void)
 
 
 // initialize driver & display
-int drv_MO_init (char *section, int quiet)
+int drv_MO_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -707,7 +711,7 @@ int drv_MO_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_MO_quit (int quiet) {
+int drv_MO_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index 8e9e6bbedd998729fbf44ea92bb7e51d37d2ec81..396ce86c61916da46c4b10762a3ca3778f0112cd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_MilfordInstruments.c,v 1.9 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_MilfordInstruments.c,v 1.10 2004/06/20 10:09:54 reinelt Exp $
  *
  * driver for Milford Instruments 'BPK' piggy-back serial interface board
  * for standard Hitachi 44780 compatible lcd modules.
  *
  *
  * $Log: drv_MilfordInstruments.c,v $
+ * Revision 1.10  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.9  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
@@ -118,7 +122,7 @@ static void drv_MI_clear (void)
 }
 
 
-static void drv_MI_write (int row, int col, unsigned char *data, int len)
+static void drv_MI_write (const int row, const int col, const unsigned char *data, const int len)
 {
   char cmd[2] = "\376x";
   char ddbase = 128;
@@ -135,7 +139,7 @@ static void drv_MI_write (int row, int col, unsigned char *data, int len)
 }
 
 
-static void drv_MI_defchar (int ascii, unsigned char *matrix)
+static void drv_MI_defchar (const int ascii, const unsigned char *matrix)
 {
   int i;
   char cmd[10]="\376x";
@@ -150,7 +154,7 @@ static void drv_MI_defchar (int ascii, unsigned char *matrix)
 }
 
 
-static int drv_MI_start (char *section, int quiet)
+static int drv_MI_start (const char *section, const int quiet)
 {
   int i;  
   char *model;
@@ -225,7 +229,7 @@ int drv_MI_list (void)
 
 
 // initialize driver & display
-int drv_MI_init (char *section, int quiet)
+int drv_MI_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -285,7 +289,7 @@ int drv_MI_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_MI_quit (int quiet) {
+int drv_MI_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
 
index daafeedb2752a6489a21f05adf5c96dc57d797a8..1527c65259c60990bc1a79e6c988dd995fdcb719 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_NULL.c,v 1.3 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_NULL.c,v 1.4 2004/06/20 10:09:54 reinelt Exp $
  *
  * NULL driver (for testing)
  *
  *
  *
  * $Log: drv_NULL.c,v $
+ * Revision 1.4  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.3  2004/06/06 06:51:59  reinelt
  *
  * do not display end splash screen if quiet=1
 #include "drv_generic_text.h"
 
 
-static char Name[]="NULL";
+static char Name[] = "NULL";
 
 
 // ****************************************
 // ***  hardware dependant functions    ***
 // ****************************************
 
-static void drv_NULL_write (int row, int col, unsigned char *data, int len)
+static void drv_NULL_write (const int row, const int col, const unsigned char *data, const int len)
 {
   // empty
 }
 
 
-static void drv_NULL_defchar (int ascii, unsigned char *matrix)
+static void drv_NULL_defchar (const int ascii, const unsigned char *matrix)
 {
   // empty
 }
 
 
-static int drv_NULL_start (char *section)
+static int drv_NULL_start (const char *section)
 {
   char *s;
   
@@ -132,7 +136,7 @@ int drv_NULL_list (void)
 
 
 // initialize driver & display
-int drv_NULL_init (char *section, int quiet)
+int drv_NULL_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -182,7 +186,7 @@ int drv_NULL_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_NULL_quit (int quiet) {
+int drv_NULL_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
   drv_generic_text_quit();
index 870d274f76b82f37c4b3fcbcd666832e69dd6a9f..e2560757dcea0476fa90fe60bcaeb960d6291537 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_T6963.c,v 1.9 2004/06/17 06:23:39 reinelt Exp $
+/* $Id: drv_T6963.c,v 1.10 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for T6963-based displays
  *
  *
  *
  * $Log: drv_T6963.c,v $
+ * Revision 1.10  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.9  2004/06/17 06:23:39  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -199,7 +203,7 @@ static void drv_T6_status2 (void)
 }
 
 
-static void drv_T6_write_cmd (unsigned char cmd)
+static void drv_T6_write_cmd (const unsigned char cmd)
 {
   // wait until the T6963 is idle
   drv_T6_status1();
@@ -221,7 +225,7 @@ static void drv_T6_write_cmd (unsigned char cmd)
 }
 
 
-static void drv_T6_write_data (unsigned char data)
+static void drv_T6_write_data (const unsigned char data)
 {
   // wait until the T6963 is idle
   drv_T6_status1();
@@ -252,7 +256,7 @@ static void drv_T6_write_data (unsigned char data)
 }
 
 
-static void drv_T6_write_auto (unsigned char data)
+static void drv_T6_write_auto (const unsigned char data)
 {
   // wait until the T6963 is idle
   drv_T6_status2();
@@ -284,14 +288,14 @@ static void drv_T6_write_auto (unsigned char data)
 
 
 #if 0 // not used
-static void drv_T6_send_byte (unsigned char cmd, unsigned char data)
+static void drv_T6_send_byte (const unsigned char cmd, const unsigned char data)
 {
   drv_T6_write_data(data);
   drv_T6_write_cmd(cmd);
 }
 #endif
 
-static void drv_T6_send_word (unsigned char cmd, unsigned short data)
+static void drv_T6_send_word (const unsigned char cmd, const unsigned short data)
 {
   drv_T6_write_data(data&0xff);
   drv_T6_write_data(data>>8);
@@ -299,7 +303,7 @@ static void drv_T6_send_word (unsigned char cmd, unsigned short data)
 }
 
 
-static void drv_T6_clear(unsigned short addr, int len)
+static void drv_T6_clear(const unsigned short addr, const int len)
 {
   int i;
   
@@ -317,7 +321,7 @@ static void drv_T6_clear(unsigned short addr, int len)
 }
 
 
-static void drv_T6_copy(unsigned short addr, unsigned char *data, int len)
+static void drv_T6_copy(const unsigned short addr, const unsigned char *data, const int len)
 {
   int i;
   
@@ -335,7 +339,7 @@ static void drv_T6_copy(unsigned short addr, unsigned char *data, int len)
 }
 
 
-static void drv_T6_blit(int row, int col, int height, int width)
+static void drv_T6_blit(const int row, const int col, const int height, const int width)
 {
   int i, j, e, m;
   int r, c;
@@ -370,7 +374,7 @@ static void drv_T6_blit(int row, int col, int height, int width)
   }
 }
 
-static int drv_T6_start (char *section)
+static int drv_T6_start (const char *section)
 {
   char *model, *s;
   int rows, TROWS, TCOLS;
@@ -529,7 +533,7 @@ int drv_T6_list (void)
 
 
 // initialize driver & display
-int drv_T6_init (char *section, int quiet)
+int drv_T6_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -578,7 +582,7 @@ int drv_T6_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_T6_quit (int quiet) {
+int drv_T6_quit (const int quiet) {
   
   info("%s: shutting down.", Name);
   
index 52355b60a01fdf4b3f8102d026d67bd3c9449e62..b625b5374d49021ae882ee0d781182262d5621f3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_USBLCD.c,v 1.11 2004/06/19 08:20:19 reinelt Exp $
+/* $Id: drv_USBLCD.c,v 1.12 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style driver for USBLCD displays
  *
  *
  *
  * $Log: drv_USBLCD.c,v $
+ * Revision 1.12  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.11  2004/06/19 08:20:19  reinelt
  *
  * compiler warning in image driver fixed
@@ -148,7 +152,7 @@ static void drv_UL_send ()
 }
 
 
-static void drv_UL_command (unsigned char cmd)
+static void drv_UL_command (const unsigned char cmd)
 {
   *BufPtr++='\0';
   *BufPtr++=cmd;
@@ -163,7 +167,7 @@ static void drv_UL_clear (void)
 }
 
 
-static void drv_UL_write (int row, int col, unsigned char *data, int len)
+static void drv_UL_write (const int row, const int col, const unsigned char *data, int len)
 {
   int pos = (row%2)*64 + (row/2)*20 + col;
   drv_UL_command (0x80|pos);
@@ -176,7 +180,7 @@ static void drv_UL_write (int row, int col, unsigned char *data, int len)
   drv_UL_send();
 }
 
-static void drv_UL_defchar (int ascii, unsigned char *matrix)
+static void drv_UL_defchar (const int ascii, const unsigned char *matrix)
 {
   int i;
   
@@ -191,7 +195,7 @@ static void drv_UL_defchar (int ascii, unsigned char *matrix)
 }
 
 
-static int drv_UL_start (char *section, int quiet)
+static int drv_UL_start (const char *section, const int quiet)
 {
   int rows=-1, cols=-1;
   int major, minor;
@@ -331,7 +335,7 @@ int drv_UL_list (void)
 
 
 // initialize driver & display
-int drv_UL_init (char *section, int quiet)
+int drv_UL_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int asc255bug;
@@ -398,7 +402,7 @@ int drv_UL_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_UL_quit (int quiet) 
+int drv_UL_quit (const int quiet)
 {
 
   info("%s: shutting down.", Name);
index db349063938f1e398ffaaeabb69052ae95c55490..78a256330c127b68f15a9dab697a6515ee0e6596 100644 (file)
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -1,4 +1,4 @@
-/* $Id: drv_X11.c,v 1.5 2004/06/08 21:46:38 reinelt Exp $
+/* $Id: drv_X11.c,v 1.6 2004/06/20 10:09:54 reinelt Exp $
  *
  * new style X11 Driver for LCD4Linux 
  *
  *
  *
  * $Log: drv_X11.c,v $
+ * Revision 1.6  2004/06/20 10:09:54  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2004/06/08 21:46:38  reinelt
  *
  * splash screen for X11 driver (and generic graphic driver)
@@ -115,7 +119,7 @@ static Pixmap pm;
 // ***  hardware dependant functions    ***
 // ****************************************
 
-static void drv_X11_blit(int row, int col, int height, int width)
+static void drv_X11_blit(const int row, const int col, const int height, const int width)
 {
   int r, c;
   int dirty = 0;
@@ -138,7 +142,7 @@ static void drv_X11_blit(int row, int col, int height, int width)
 }
 
 
-static void drv_X11_expose(int x, int y, int width, int height)
+static void drv_X11_expose(const int x, const int y, const int width, const int height)
 {
   /*
    * theory of operation:
@@ -181,7 +185,7 @@ static void drv_X11_timer (void *notused)
 }
 
 
-static int drv_X11_start (char *section)
+static int drv_X11_start (const char *section)
 {
   char *s;
   XSetWindowAttributes wa;
@@ -350,7 +354,7 @@ int drv_X11_list (void)
 
 
 // initialize driver & display
-int drv_X11_init (char *section, int quiet)
+int drv_X11_init (const char *section, const int quiet)
 {
   WIDGET_CLASS wc;
   int ret;  
@@ -403,7 +407,7 @@ int drv_X11_init (char *section, int quiet)
 
 
 // close driver & display
-int drv_X11_quit (int quiet) {
+int drv_X11_quit (const int quiet) {
 
   info("%s: shutting down.", Name);
   drv_generic_graphic_quit();
index 1ca96e0fd47151d856395b204c14536fe252cf32..a57102438419152a7ba77f0b66f7e8f026d0888f 100644 (file)
  *
  *
  * $Log: drv_generic_graphic.c,v $
+ * Revision 1.10  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.9  2004/06/09 06:40:29  reinelt
  *
  * splash screen for T6963 driver
@@ -175,7 +179,7 @@ int drv_generic_graphic_clear (void)
 // *** generic text handling            ***
 // ****************************************
 
-static void drv_generic_graphic_render (int row, int col, unsigned char *txt)
+static void drv_generic_graphic_render (const int row, const int col, const unsigned char *txt)
 {
   int c, r, x, y;
   int len = strlen(txt);
@@ -206,7 +210,7 @@ static void drv_generic_graphic_render (int row, int col, unsigned char *txt)
 
 
 // say hello to the user
-int drv_generic_graphic_greet (char *msg1, char *msg2)
+int drv_generic_graphic_greet (const char *msg1, const char *msg2)
 {
   char *line1[] = { "* LCD4Linux " VERSION " *",
                    "LCD4Linux " VERSION,
@@ -393,10 +397,10 @@ int drv_generic_graphic_bar_draw (WIDGET *W)
 // *** generic init/quit                ***
 // ****************************************
 
-int drv_generic_graphic_init (char *section, char *driver)
+int drv_generic_graphic_init (const char *section, const char *driver)
 {
-  Section=section;
-  Driver=driver;
+  Section = (char*)section;
+  Driver  = (char*)driver;
   
   // init layout framebuffer
   LROWS = 0;
index ef7ee5a6b13ae1d9b2b9efccc77b3ec9277676bb..e868fb00dad81ae9851886fbbd8fe855e2ac5307 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_graphic.h,v 1.4 2004/06/08 21:46:38 reinelt Exp $
+/* $Id: drv_generic_graphic.h,v 1.5 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for graphic displays
  *
  *
  *
  * $Log: drv_generic_graphic.h,v $
+ * Revision 1.5  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.4  2004/06/08 21:46:38  reinelt
  *
  * splash screen for X11 driver (and generic graphic driver)
@@ -60,12 +64,12 @@ extern int XRES,  YRES;  // pixel width/height of one char
 extern unsigned char *drv_generic_graphic_FB;
 
 // these functions must be implemented by the real driver
-void (*drv_generic_graphic_real_blit)(int row, int col, int height, int width);
+void (*drv_generic_graphic_real_blit)(const int row, const int col, const int height, const int width);
 
 // generic functions and widget callbacks
-int drv_generic_graphic_init      (char *section, char *driver);
+int drv_generic_graphic_init      (const char *section, const char *driver);
 int drv_generic_graphic_clear     (void);
-int drv_generic_graphic_greet     (char *msg1, char *msg2);
+int drv_generic_graphic_greet     (const char *msg1, const char *msg2);
 int drv_generic_graphic_draw      (WIDGET *W);
 int drv_generic_graphic_icon_draw (WIDGET *W);
 int drv_generic_graphic_bar_draw  (WIDGET *W);
index a4b7643e1a6bb708cf4764f27af4fbabdc550c37..277cf5ecb59f9ccfcb5d43b9f77bd6ca081f0eb3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_parport.c,v 1.5 2004/04/12 05:14:42 reinelt Exp $
+/* $Id: drv_generic_parport.c,v 1.6 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for serial and parport access
  *
  *
  *
  * $Log: drv_generic_parport.c,v $
+ * Revision 1.6  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2004/04/12 05:14:42  reinelt
  * another BIG FAT WARNING on the use of raw ports instead of ppdev
  *
@@ -115,12 +119,12 @@ static int PPfd=-1;
 #endif
 
 
-int drv_generic_parport_open (char *section, char *driver)
+int drv_generic_parport_open (const char *section, const char *driver)
 {
   char *s, *e;
   
-  Section=section;
-  Driver=driver;
+  Section = (char*)section;
+  Driver  = (char*)driver;
   
   udelay_init();
   
@@ -230,7 +234,7 @@ int drv_generic_parport_close (void)
 }
 
 
-unsigned char drv_generic_parport_wire_ctrl (char *name, unsigned char *deflt)
+unsigned char drv_generic_parport_wire_ctrl (const char *name, const unsigned char *deflt)
 {
   unsigned char w;
   char wire[256];
@@ -275,7 +279,7 @@ unsigned char drv_generic_parport_wire_ctrl (char *name, unsigned char *deflt)
 }
 
 
-unsigned char drv_generic_parport_wire_data (char *name, unsigned char *deflt)
+unsigned char drv_generic_parport_wire_data (const char *name, const unsigned char *deflt)
 {
   unsigned char w;
   char wire[256];
@@ -305,7 +309,7 @@ unsigned char drv_generic_parport_wire_data (char *name, unsigned char *deflt)
 }
 
 
-void drv_generic_parport_direction (int direction)
+void drv_generic_parport_direction (const int direction)
 {
 #ifdef WITH_PPDEV
   if (PPdev) {
@@ -320,32 +324,34 @@ void drv_generic_parport_direction (int direction)
 }
 
 
-void drv_generic_parport_control (unsigned char mask, unsigned char value)
+void drv_generic_parport_control (const unsigned char mask, const unsigned char value)
 {
+  unsigned char val;
+  
   // any signal affected?
   // Note: this may happen in case a signal is hardwired to GND
   if (mask==0) return;
 
   // Strobe, Select and AutoFeed are inverted!
-  value = mask & (value ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
+  val = mask & (value ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
 
 #ifdef WITH_PPDEV
   if (PPdev) {
     struct ppdev_frob_struct frob;
     frob.mask=mask;
-    frob.val=value;
+    frob.val=val;
     ioctl (PPfd, PPFCONTROL, &frob);
   } else
 #endif
     {
       // code stolen from linux/parport_pc.h
-      ctr = (ctr & ~mask) ^ value;
+      ctr = (ctr & ~mask) ^ val;
       outb (ctr, Port+2);
     }
 }
 
 
-void drv_generic_parport_toggle (unsigned char bits, int level, int delay)
+void drv_generic_parport_toggle (const unsigned char bits, const int level, const int delay)
 {
   unsigned char value1, value2;
 
@@ -394,7 +400,7 @@ void drv_generic_parport_toggle (unsigned char bits, int level, int delay)
 }
 
 
-void drv_generic_parport_data (unsigned char data)
+void drv_generic_parport_data (const unsigned char data)
 {
 #ifdef WITH_PPDEV
   if (PPdev) {
index 5e35ca69a9eaf8518ce424f146ead6037f508093..7e23205643fad70e58baeb310b19df4d901178dc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_parport.h,v 1.2 2004/01/20 15:32:49 reinelt Exp $
+/* $Id: drv_generic_parport.h,v 1.3 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for parallel port displays
  *
  *
  *
  * $Log: drv_generic_parport.h,v $
+ * Revision 1.3  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.2  2004/01/20 15:32:49  reinelt
  * first version of Next Generation HD44780 (untested! but it compiles...)
  * some cleanup in the other drivers
 #ifndef _DRV_GENERIC_PARPORT_H_
 #define _DRV_GENERIC_PARPORT_H_
 
-int           drv_generic_parport_open       (char *section, char *driver);
+int           drv_generic_parport_open       (const char *section, const char *driver);
 int           drv_generic_parport_close      (void);
-unsigned char drv_generic_parport_wire_ctrl  (char *name, unsigned char *deflt);
-unsigned char drv_generic_parport_wire_data  (char *name, unsigned char *deflt);
-void          drv_generic_parport_direction  (int direction);
-void          drv_generic_parport_control    (unsigned char mask, unsigned char value);
-void          drv_generic_parport_toggle     (unsigned char bit, int level, int delay);
-void          drv_generic_parport_data       (unsigned char data);
+unsigned char drv_generic_parport_wire_ctrl  (const char *name, const unsigned char *deflt);
+unsigned char drv_generic_parport_wire_data  (const char *name, const unsigned char *deflt);
+void          drv_generic_parport_direction  (const int direction);
+void          drv_generic_parport_control    (const unsigned char mask, const unsigned char value);
+void          drv_generic_parport_toggle     (const unsigned char bit, const int level, const int delay);
+void          drv_generic_parport_data       (const unsigned char data);
 unsigned char drv_generic_parport_read       (void);
 void          drv_generic_parport_debug      (void);
 
index 05489813038055760cde0bb5abf86184f9ea4cf4..b1e1feff2208918603e870313b8d5740f2f1ad95 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_serial.c,v 1.11 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: drv_generic_serial.c,v 1.12 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for serial and usbserial displays
  *
  *
  *
  * $Log: drv_generic_serial.c,v $
+ * Revision 1.12  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.11  2004/06/01 06:45:30  reinelt
  *
  * some Fixme's processed
 #include "drv_generic_serial.h"
 
 
+static char   *Section;
 static char   *Driver;
 static char   *Port;
 static speed_t Speed;
@@ -138,7 +143,7 @@ static int     Device=-1;
 // *** generic serial/USB communication ***
 // ****************************************
 
-static pid_t drv_generic_serial_lock_port (char *Port)
+static pid_t drv_generic_serial_lock_port (const char *Port)
 {
   char lockfile[256];
   char tempfile[256];
@@ -236,7 +241,7 @@ static pid_t drv_generic_serial_lock_port (char *Port)
 }
 
 
-static pid_t drv_generic_serial_unlock_port (char *Port)
+static pid_t drv_generic_serial_unlock_port (const char *Port)
 {
   char lockfile[256];
   char *port, *p;
@@ -259,13 +264,14 @@ static pid_t drv_generic_serial_unlock_port (char *Port)
 }
 
 
-int drv_generic_serial_open (char *section, char *driver, unsigned int flags)
+int drv_generic_serial_open (const char *section, const char *driver, const unsigned int flags)
 {
   int i, fd;
   pid_t pid;
   struct termios portset;
   
-  Driver = driver;
+  Section = (char*)section;
+  Driver  = (char*)driver;
 
   Port=cfg_get(section, "Port", NULL);
   if (Port==NULL || *Port=='\0') {
@@ -326,7 +332,7 @@ int drv_generic_serial_open (char *section, char *driver, unsigned int flags)
 }
 
 
-int drv_generic_serial_poll (unsigned char *string, int len)
+int drv_generic_serial_poll (unsigned char *string, const int len)
 {
   int ret;
   if (Device == -1) return -1;
@@ -338,7 +344,7 @@ int drv_generic_serial_poll (unsigned char *string, int len)
 }
 
 
-int drv_generic_serial_read (unsigned char *string, int len)
+int drv_generic_serial_read (unsigned char *string, const int len)
 {
   int run, ret;
   
@@ -357,7 +363,7 @@ int drv_generic_serial_read (unsigned char *string, int len)
 }
 
 
-void drv_generic_serial_write (unsigned char *string, int len)
+void drv_generic_serial_write (const unsigned char *string, const int len)
 {
   int run, ret;
   
index 42c9bb5deb0bf7e0ee900eee70ee7cd253a30147..c90333a4dfdc7dc094b62b192d49ddf1cc955f70 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_serial.h,v 1.5 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: drv_generic_serial.h,v 1.6 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for serial and usbserial displays
  *
  *
  *
  * $Log: drv_generic_serial.h,v $
+ * Revision 1.6  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2004/06/01 06:45:30  reinelt
  *
  * some Fixme's processed
 #ifndef _DRV_GENERIC_SERIALH_
 #define _DRV_GENERIC_SERIAL_H_
 
-int   drv_generic_serial_open  (char *section, char *driver, unsigned int flags);
-int   drv_generic_serial_poll  (unsigned char *string, int len);
-int   drv_generic_serial_read  (unsigned char *string, int len);
-void  drv_generic_serial_write (unsigned char *string, int len);
+int   drv_generic_serial_open  (const char *section, const char *driver, const unsigned int flags);
+int   drv_generic_serial_poll  (unsigned char *string, const int len);
+int   drv_generic_serial_read  (unsigned char *string, const int len);
+void  drv_generic_serial_write (const unsigned char *string, const int len);
 int   drv_generic_serial_close (void);
 
 #endif
index a8d1d1d2dc8b52742eae665e37ce207d615f9082..bd938490ad248f204a9d5c29fec9a938c42bf60c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_text.c,v 1.17 2004/06/05 06:41:40 reinelt Exp $
+/* $Id: drv_generic_text.c,v 1.18 2004/06/20 10:09:55 reinelt Exp $
  *
  * generic driver helper for text-based displays
  *
  *
  *
  * $Log: drv_generic_text.c,v $
+ * Revision 1.18  2004/06/20 10:09:55  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.17  2004/06/05 06:41:40  reinelt
  *
  * chancged splash screen again
@@ -278,11 +282,11 @@ static void drv_generic_text_resizeFB (int rows, int cols)
 // *** generic text handling            ***
 // ****************************************
 
-int drv_generic_text_init (char *section, char *driver)
+int drv_generic_text_init (const char *section, const char *driver)
 {
 
-  Section=section;
-  Driver=driver;
+  Section = (char*)section;
+  Driver  = (char*)driver;
 
   // init display framebuffer
   DisplayFB = (char*)malloc(DCOLS*DROWS*sizeof(char));
@@ -305,7 +309,7 @@ int drv_generic_text_init (char *section, char *driver)
 
 
 // say hello to the user
-int drv_generic_text_greet (char *msg1, char *msg2)
+int drv_generic_text_greet (const char *msg1, const char *msg2)
 {
   int i;
   int flag = 0;
@@ -513,7 +517,7 @@ static void drv_generic_text_bar_clear(void)
 }
 
 
-int drv_generic_text_bar_init (int single_segments)
+int drv_generic_text_bar_init (const int single_segments)
 {
   if (BarFB) free (BarFB);
   
@@ -533,7 +537,7 @@ int drv_generic_text_bar_init (int single_segments)
 }
 
 
-void drv_generic_text_bar_add_segment(int val1, int val2, DIRECTION dir, int ascii)
+void drv_generic_text_bar_add_segment(const int val1, const int val2, const DIRECTION dir, const int ascii)
 {
   Segment[fSegment].val1=val1;
   Segment[fSegment].val2=val2;
@@ -546,7 +550,7 @@ void drv_generic_text_bar_add_segment(int val1, int val2, DIRECTION dir, int asc
 }
 
 
-static void drv_generic_text_bar_create_bar (int row, int col, DIRECTION dir, int len, int val1, int val2)
+static void drv_generic_text_bar_create_bar (int row, int col, const DIRECTION dir, int len, int val1, int val2)
 {
   int rev=0;
 
@@ -650,7 +654,7 @@ static void drv_generic_text_bar_create_segments (void)
 }
 
 
-static int drv_generic_text_bar_segment_error (int i, int j)
+static int drv_generic_text_bar_segment_error (const int i, const int j)
 {
   int res;
   int i1, i2, j1, j2;
index 9bf9b4a70ada0100da021285e72d69ef7fd297b1..5740de57e53568c0e2ca440e96172b1666e0579f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_text.h,v 1.12 2004/06/05 06:41:40 reinelt Exp $
+/* $Id: drv_generic_text.h,v 1.13 2004/06/20 10:09:56 reinelt Exp $
  *
  * generic driver helper for text-based displays
  *
  *
  *
  * $Log: drv_generic_text.h,v $
+ * Revision 1.13  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.12  2004/06/05 06:41:40  reinelt
  *
  * chancged splash screen again
@@ -91,20 +95,19 @@ extern int CHARS, CHAR0; // number of user-defineable characters, ASCII of first
 extern int ICONS;        // number of user-defineable characters reserved for icons
 
 // these functions must be implemented by the real driver
-void (*drv_generic_text_real_write)(int row, int col, unsigned char *data, int len);
-void (*drv_generic_text_real_defchar)(int ascii, unsigned char *buffer);
+void (*drv_generic_text_real_write)(const int row, const int col, const unsigned char *data, const int len);
+void (*drv_generic_text_real_defchar)(const int ascii, const unsigned char *buffer);
 
 // generic functions and widget callbacks
-int  drv_generic_text_init            (char *section, char *driver);
-int  drv_generic_text_greet           (char *msg1, char *msg2);
+int  drv_generic_text_init            (const char *section, const char *driver);
+int  drv_generic_text_greet           (const char *msg1, const char *msg2);
 int  drv_generic_text_draw            (WIDGET *W);
 int  drv_generic_text_icon_init       (void);
 int  drv_generic_text_icon_draw       (WIDGET *W);
-int  drv_generic_text_bar_init        (int single_segments);
-void drv_generic_text_bar_add_segment (int val1, int val2, DIRECTION dir, int ascii);
+int  drv_generic_text_bar_init        (const int single_segments);
+void drv_generic_text_bar_add_segment (const int val1, const int val2, const DIRECTION dir, const int ascii);
 int  drv_generic_text_bar_draw        (WIDGET *W);
 int  drv_generic_text_quit            (void);
 
 
-
 #endif
index 9902d03a61d2e8d88d800c88586a05617353d09e..2be3b7ecd66a0a4f60810576d602f5f2d6a9facb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: evaluator.c,v 1.19 2004/04/12 11:12:25 reinelt Exp $
+/* $Id: evaluator.c,v 1.20 2004/06/20 10:09:56 reinelt Exp $
  *
  * expression evaluation
  *
  *
  *
  * $Log: evaluator.c,v $
+ * Revision 1.20  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.19  2004/04/12 11:12:25  reinelt
  * added plugin_isdn, removed old ISDN client
  * fixed some real bad bugs in the evaluator
@@ -337,7 +341,7 @@ static RESULT* DupResult (RESULT *result)
 }
 
 
-RESULT* SetResult (RESULT **result, int type, void *value)
+RESULT* SetResult (RESULT **result, const int type, const void *value)
 {
   if (*result == NULL) {
     if ((*result = NewResult()) == NULL) 
@@ -422,7 +426,7 @@ char* R2S (RESULT *result)
   
 }
 
-static VARIABLE *FindVariable (char *name)
+static VARIABLE *FindVariable (const char *name)
 {
   int i;
 
@@ -435,7 +439,7 @@ static VARIABLE *FindVariable (char *name)
 }
 
 
-int SetVariable (char *name, RESULT *value)
+int SetVariable (const char *name, RESULT *value)
 {
   VARIABLE *V;
 
@@ -455,7 +459,7 @@ int SetVariable (char *name, RESULT *value)
 }
 
 
-int SetVariableNumeric (char *name, double value)
+int SetVariableNumeric (const char *name, const double value)
 {
   RESULT result = {0, 0, 0, NULL};
   RESULT *rp = &result;
@@ -466,7 +470,7 @@ int SetVariableNumeric (char *name, double value)
 }
 
 
-int SetVariableString (char *name, char *value)
+int SetVariableString (const char *name, const char *value)
 {
   RESULT result = {0, 0, 0, NULL};
   RESULT *rp = &result;
@@ -491,7 +495,7 @@ void DeleteVariables(void)
 }
 
 
-static FUNCTION* FindFunction (char *name)
+static FUNCTION* FindFunction (const char *name)
 {
   int i;
 
@@ -504,7 +508,7 @@ static FUNCTION* FindFunction (char *name)
 }
 
 
-int AddFunction (char *name, int argc, void (*func)())
+int AddFunction (const char *name, const int argc, void (*func)())
 {
   nFunction++;
   Function = realloc(Function, nFunction*sizeof(FUNCTION));
@@ -1174,13 +1178,13 @@ static int EvalTree (NODE *Root)
 }
 
 
-int Compile (char* expression, void **tree)
+int Compile (const char* expression, void **tree)
 {
   NODE *Root;
   
   *tree = NULL;
   
-  Expression = expression;
+  Expression = (char*) expression;
   ExprPtr    = Expression;
   
   Parse();
index 12b52bad70e0ce4e8a31657a1d192385ed47b300..6b5339cf6df3e3217e02f661416f1271a114d0cb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: evaluator.h,v 1.6 2004/03/11 06:39:59 reinelt Exp $
+/* $Id: evaluator.h,v 1.7 2004/06/20 10:09:56 reinelt Exp $
  *
  * expression evaluation
  *
  *
  *
  * $Log: evaluator.h,v $
+ * Revision 1.7  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.6  2004/03/11 06:39:59  reinelt
  * big patch from Martin:
  * - reuse filehandles
@@ -76,22 +80,22 @@ typedef struct {
 } RESULT;
 
 
-int  SetVariable        (char *name, RESULT *value);
-int  SetVariableNumeric (char *name, double  value);
-int  SetVariableString  (char *name, char   *value);
+int  SetVariable        (const char *name, RESULT *value);
+int  SetVariableNumeric (const char *name, const double  value);
+int  SetVariableString  (const char *name, const char   *value);
 
-int  AddFunction        (char *name, int argc, void (*func)());
+int  AddFunction        (const char *name, const int argc, void (*func)());
 
 void DeleteVariables    (void);
 void DeleteFunctions    (void);
 
 void    DelResult (RESULT *result);
-RESULT* SetResult (RESULT **result, int type, void *value);
+RESULT* SetResult (RESULT **result, const int type, const void *value);
 
 double R2N (RESULT *result);
 char*  R2S (RESULT *result);
 
-int  Compile (char *expression, void **tree);
+int  Compile (const char *expression, void **tree);
 int  Eval    (void *tree, RESULT *result);
 void DelTree (void *tree);
 
diff --git a/hash.c b/hash.c
index bd3f73c87b90f0243be9e3b2b54aed525c38c046..3a43f7e5cc0108c03be8cddd794e420a35e068c7 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.21 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: hash.c,v 1.22 2004/06/20 10:09:56 reinelt Exp $
  *
  * hashes (associative arrays)
  *
  *
  *
  * $Log: hash.c,v $
+ * Revision 1.22  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.21  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -227,7 +231,7 @@ static int hash_sort_column (const void *a, const void *b)
 // split a value into columns and 
 // return the nth column in a string
 // WARNING: does return a pointer to a static string!!
-static char* split (const char *val, int column, const char *delimiter)
+static char* split (const char *val, const int column, const char *delimiter)
 {
   static char buffer[256];
   int num, len;
@@ -261,7 +265,7 @@ static char* split (const char *val, int column, const char *delimiter)
 // If the table is flagged "sorted", the entry is looked
 // up using the bsearch function. If the table is 
 // unsorted, it will be searched in a linear way
-static HASH_ITEM* hash_lookup (HASH *Hash, const char *key, int do_sort)
+static HASH_ITEM* hash_lookup (HASH *Hash, const char *key, const int do_sort)
 {
   HASH_ITEM *Item = NULL;
   
@@ -318,7 +322,7 @@ int hash_age (HASH *Hash, const char *key)
 
 
 // add an entry to the column header table
-void hash_set_column (HASH *Hash, int number, const char *column)
+void hash_set_column (HASH *Hash, const int number, const char *column)
 {
   if (Hash == NULL) return;
   
@@ -369,7 +373,7 @@ char *hash_get (HASH *Hash, const char *key, const char *column)
 
 
 // get a delta value from the delta table
-double hash_get_delta (HASH *Hash, const char *key, const char *column, int delay)
+double hash_get_delta (HASH *Hash, const char *key, const char *column, const int delay)
 {
   HASH_ITEM *Item;
   HASH_SLOT *Slot1, *Slot2;  
@@ -432,7 +436,7 @@ double hash_get_delta (HASH *Hash, const char *key, const char *column, int dela
 // get a delta value from the delta table
 // key may contain regular expressions, and the sum 
 // of all matching entries is returned.
-double hash_get_regex (HASH *Hash, const char *key, const char *column, int delay)
+double hash_get_regex (HASH *Hash, const char *key, const char *column, const int delay)
 {
   double sum;
   regex_t preg;
@@ -467,7 +471,7 @@ double hash_get_regex (HASH *Hash, const char *key, const char *column, int dela
 // Otherwise, the entry is appended at the end, and 
 // the table will be flagged 'unsorted' afterwards
 
-static HASH_ITEM* hash_set (HASH *Hash, const char *key, const char *value, int delta)
+static HASH_ITEM* hash_set (HASH *Hash, const char *key, const char *value, const int delta)
 {
   HASH_ITEM *Item;
   HASH_SLOT *Slot;
diff --git a/hash.h b/hash.h
index a5b8c0affa9ccbd40ee4394cbef78a0f5fffc891..cb4d7055691ea4df3af90adba3897b86e7dc0203 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -1,4 +1,4 @@
-/* $Id: hash.h,v 1.14 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: hash.h,v 1.15 2004/06/20 10:09:56 reinelt Exp $
  *
  * hashes (associative arrays)
  *
  *
  *
  * $Log: hash.h,v $
+ * Revision 1.15  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.14  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -131,12 +135,12 @@ void   hash_create        (HASH *Hash);
 
 int    hash_age           (HASH *Hash, const char *key);
 
-void   hash_set_column    (HASH *Hash, int number, const char *column);
+void   hash_set_column    (HASH *Hash, const int number, const char *column);
 void   hash_set_delimiter (HASH *Hash, const char *delimiter);
 
 char  *hash_get           (HASH *Hash, const char *key, const char *column);
-double hash_get_delta     (HASH *Hash, const char *key, const char *column, int delay);
-double hash_get_regex     (HASH *Hash, const char *key, const char *column, int delay);
+double hash_get_delta     (HASH *Hash, const char *key, const char *column, const int delay);
+double hash_get_regex     (HASH *Hash, const char *key, const char *column, const int delay);
 
 void   hash_put           (HASH *Hash, const char *key, const char *value);
 void   hash_put_delta     (HASH *Hash, const char *key, const char *value);
index c60a4ff6235ec991735428b4607f05f5c0600173..ef560ddb2256979354a2dcbfb98c12ae51ca7c70 100644 (file)
--- a/layout.c
+++ b/layout.c
@@ -1,4 +1,4 @@
-/* $Id: layout.c,v 1.11 2004/06/02 09:41:19 reinelt Exp $
+/* $Id: layout.c,v 1.12 2004/06/20 10:09:56 reinelt Exp $
  *
  * new layouter framework
  *
  *
  *
  * $Log: layout.c,v $
+ * Revision 1.12  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.11  2004/06/02 09:41:19  reinelt
  *
  * prepared support for startup splash screen
 #endif
 
 
-int layout_addItem (char *name, int row, int col)
+int layout_addItem (const char *name, const int row, const int col)
 {
   // allocate widget
   widget_add (name, row-1, col-1);
@@ -104,7 +108,7 @@ int layout_addItem (char *name, int row, int col)
 }
 
 
-int layout_init (char *layout)
+int layout_init (const char *layout)
 {
   char *section;
   char *list, *l;
index 2870260e2ecf0c81033c63db09f2337537f7673a..8c3490ec01744c92271266b60f1098e696a35525 100644 (file)
--- a/layout.h
+++ b/layout.h
@@ -1,4 +1,4 @@
-/* $Id: layout.h,v 1.1 2004/01/10 20:22:33 reinelt Exp $
+/* $Id: layout.h,v 1.2 2004/06/20 10:09:56 reinelt Exp $
  *
  * new layouter framework
  *
  *
  *
  * $Log: layout.h,v $
+ * Revision 1.2  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.1  2004/01/10 20:22:33  reinelt
  * added new function 'cfg_list()' (not finished yet)
  * added layout.c (will replace processor.c someday)
@@ -34,6 +38,6 @@
 #ifndef _LAYOUT_H_
 #define _LAYOUT_H_
 
-int layout_init(char *section);
+int layout_init(const char *section);
 
 #endif
index e2abcd7873342f5c5399d9ff74437f8de0177d8e..874360cfa9685c7eac1255a23d8cc6b7634ae566 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_cfg.c,v 1.8 2004/03/11 06:39:59 reinelt Exp $
+/* $Id: plugin_cfg.c,v 1.9 2004/06/20 10:09:56 reinelt Exp $
  *
  * plugin for config file access
  *
  *
  *
  * $Log: plugin_cfg.c,v $
+ * Revision 1.9  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.8  2004/03/11 06:39:59  reinelt
  * big patch from Martin:
  * - reuse filehandles
@@ -127,7 +131,7 @@ static void load_variables (void)
 }
 
 
-static void my_cfg (RESULT *result, int argc, RESULT *argv[])
+static void my_cfg (RESULT *result, const int argc, RESULT *argv[])
 {
   int i, len;
   char *value;
index a9a37c82f8ec9af52ba721cd48e1cae30765b2d1..54a8aa117cff42510266057dcd4faebb62786f02 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_exec.c,v 1.3 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_exec.c,v 1.4 2004/06/20 10:09:56 reinelt Exp $
  *
  * plugin for external processes
  *
  *
  *
  * $Log: plugin_exec.c,v $
+ * Revision 1.4  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.3  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -88,7 +92,7 @@ static HASH EXEC;
 // x^0 + x^5 + x^12
 #define CRCPOLY 0x8408 
   
-static unsigned short CRC (unsigned char *s)
+static unsigned short CRC (const unsigned char *s)
 {
   int i;
   unsigned short crc;
@@ -149,7 +153,7 @@ static void exec_thread (void *data)
 }
 
 
-static void destroy_exec_thread (int n)
+static void destroy_exec_thread (const int n)
 {
   if (Thread[n].mutex != 0) mutex_destroy(Thread[n].mutex); 
   if (Thread[n].cmd) free (Thread[n].cmd);
@@ -166,7 +170,7 @@ static void destroy_exec_thread (int n)
 }
 
 
-static int create_exec_thread (char *cmd, char *key, int delay)
+static int create_exec_thread (const char *cmd, const char *key, const int delay)
 {
   char name[10];
 
@@ -208,7 +212,7 @@ static int create_exec_thread (char *cmd, char *key, int delay)
 }    
 
 
-static int do_exec (char *cmd, char *key, int delay)
+static int do_exec (const char *cmd, const char *key, int delay)
 {
   int i, age;
   
index 14ef61e0f9baa765407c82241b37642ec9c660f8..cf6cdebef4827dfc106127623ff5c3e54de82736 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_i2c_sensors.c,v 1.18 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_i2c_sensors.c,v 1.19 2004/06/20 10:09:56 reinelt Exp $
  *
  * I2C sensors plugin
  *
  *
  *
  * $Log: plugin_i2c_sensors.c,v $
+ * Revision 1.19  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.18  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -168,13 +172,13 @@ static const char *procfs_tokens[4][3] = {
   {"fan_min", "fan_input", ""}                 // for fan#
 };
 
-static int (*parse_i2c_sensors)(char *key);
+static int (*parse_i2c_sensors)(const char *key);
 
        /***********************************************\
        * Parsing for new 2.6 kernels 'sysfs' interface *
        \***********************************************/
 
-static int parse_i2c_sensors_sysfs(char *key)
+static int parse_i2c_sensors_sysfs(const char *key)
 {
   char val[32];
   char buffer[32];
@@ -221,7 +225,7 @@ static int parse_i2c_sensors_sysfs(char *key)
        * Parsing for old 2.4 kernels 'procfs' interface *
        \************************************************/
 
-static int parse_i2c_sensors_procfs(char *key)
+static int parse_i2c_sensors_procfs(const char *key)
 {
   char file[64];
   FILE *stream;
@@ -232,7 +236,7 @@ static int parse_i2c_sensors_procfs(char *key)
   int pos=0;
   const char delim[3]=" \n";
   char final_key[32];
-  char *number = &key[strlen(key)-1];
+  const char *number = &key[strlen(key)-1];
   int tokens_index;
   // debug("%s  ->  %s", key, number);
   strcpy(file, path);
@@ -310,7 +314,7 @@ void my_i2c_sensors(RESULT *result, RESULT *arg)
 }
 
 
-void my_i2c_sensors_path(char *method)
+void my_i2c_sensors_path(const char *method)
 {
   struct dirent *dir;
   struct dirent *file;
index 7566f01cb2f899b6e3d471cbb7ef1ae6a1ae3eec..d80c0bfb87b7af5bfb4c93215d9fe58b506568e1 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: plugin_imon.c,v 1.9 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_imon.c,v 1.10 2004/06/20 10:09:56 reinelt Exp $
  *
  * imond/telmond data processing
  *
  *
  *
  * $Log: plugin_imon.c,v $
+ * Revision 1.10  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.9  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -101,7 +105,7 @@ static int err=0;
  *  service_connect (host_name, port)       - connect to tcp-service
  *----------------------------------------------------------------------------
  */
-static int service_connect (char * host_name, int port){
+static int service_connect (const char * host_name, const int port){
     struct sockaddr_in  addr;
     struct hostent *    host_p;
     int                 fd;
@@ -150,7 +154,7 @@ static int service_connect (char * host_name, int port){
  *----------------------------------------------------------------------------
  */
 static void
-send_command (int fd, char * str)
+send_command (const int fd, const char * str)
 {
     char    buf[256];
     int     len = strlen (str);
@@ -167,7 +171,7 @@ send_command (int fd, char * str)
  *----------------------------------------------------------------------------
  */
 static char *
-get_answer (int fd)
+get_answer (const int fd)
 {
     static char buf[8192];
     int         len;
@@ -207,7 +211,7 @@ get_answer (int fd)
  *----------------------------------------------------------------------------
  */
 static char *
-get_value (char * cmd)
+get_value (const char * cmd)
 {
     char *  answer;
 
@@ -316,7 +320,7 @@ void init(){
  }
 }
 
-static int parse_imon(char *cmd){
+static int parse_imon(const char *cmd){
  // reread every half sec only
  int age=hash_age(&IMON, cmd);
  if (age>0 && age<=500) return 0;
@@ -357,7 +361,7 @@ static void my_imon_version (RESULT *result){
  SetResult(&result, R_STRING, val); 
 }
 
-static int parse_imon_rates(char *channel){
+static int parse_imon_rates(const char *channel){
  char buf[128],in[25],out[25];
  char *s;
  int age;
index 4298d94a85cbd462561a482892811a2262d97892..aaf2d4a30f9b5149d50c393c772ee85db08c0be5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_isdn.c,v 1.2 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_isdn.c,v 1.3 2004/06/20 10:09:56 reinelt Exp $
  *
  * plugin for ISDN subsystem
  *
  *
  *
  * $Log: plugin_isdn.c,v $
+ * Revision 1.3  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.2  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -78,7 +82,7 @@ static HASH ISDN_INFO;
 static HASH ISDN_CPS;
 
 
-static void hash_put_info (char *name, int channel, char *val)
+static void hash_put_info (const char *name, const int channel, const char *val)
 {
   char key[16];
 
@@ -162,7 +166,7 @@ static void my_isdn_info (RESULT *result, RESULT *arg1, RESULT *arg2)
 
 #ifdef HAVE_LINUX_ISDN_H
 
-static void hash_put_cps (int channel, CPS *cps)
+static void hash_put_cps (const int channel, const CPS *cps)
 {
   char key[16], val[16];
 
index 6c20755ae02eb33b77ae0b6312a458f29cc00e91..b55c22bbe6a6b798252377eb6dd3d115199d357a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_proc_stat.c,v 1.20 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_proc_stat.c,v 1.21 2004/06/20 10:09:56 reinelt Exp $
  *
  * plugin for /proc/stat parsing
  *
  *
  *
  * $Log: plugin_proc_stat.c,v $
+ * Revision 1.21  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.20  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -131,13 +135,13 @@ static HASH Stat;
 static FILE *stream = NULL;
 
 
-static void hash_put1 (char *key1, char *val) 
+static void hash_put1 (const char *key1, const char *val) 
 {
   hash_put_delta (&Stat, key1, val);
 }
 
 
-static void hash_put2 (char *key1, char *key2, char *val) 
+static void hash_put2 (const char *key1, const char *key2, const char *val) 
 {
   char key[32];
   
@@ -146,7 +150,7 @@ static void hash_put2 (char *key1, char *key2, char *val)
 }
 
 
-static void hash_put3 (char *key1, char *key2, char *key3, char *val) 
+static void hash_put3 (const char *key1, const char *key2, const char *key3, const char *val) 
 {
   char key[32];
   
@@ -276,7 +280,7 @@ static int parse_proc_stat (void)
 }
 
 
-static void my_proc_stat (RESULT *result, int argc, RESULT *argv[])
+static void my_proc_stat (RESULT *result, const int argc, RESULT *argv[])
 {
   char  *string;
   double number;
index 1519ad1e6c7b66f64600d888108fdb30fa5fa08f..7b701c36b8b9941e1b1433f21b082fd5e933aa12 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_uptime.c,v 1.1 2004/05/22 18:30:02 reinelt Exp $
+/* $Id: plugin_uptime.c,v 1.2 2004/06/20 10:09:56 reinelt Exp $
  *
  * plugin for uptime
  *
  *
  *
  * $Log: plugin_uptime.c,v $
+ * Revision 1.2  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.1  2004/05/22 18:30:02  reinelt
  *
  * added plugin 'uptime'
@@ -56,7 +60,7 @@
 static int fd = -2;
 
 
-static char *itoa(char* buffer, size_t size, unsigned int value)
+static char *itoa(char* buffer, const size_t size, unsigned int value)
 {
   char *p;
  
@@ -78,7 +82,7 @@ static char *itoa(char* buffer, size_t size, unsigned int value)
 } 
 
 
-char *struptime (unsigned int uptime, char *format) 
+char *struptime (const unsigned int uptime, const char *format) 
 {
   static char string[256];
   const char *src;
@@ -186,7 +190,7 @@ double getuptime (void)
 }
 
 
-static void my_uptime (RESULT *result, int argc, RESULT *argv[])
+static void my_uptime (RESULT *result, const int argc, RESULT *argv[])
 {
   int age;
   static double uptime = 0.0;
index 23385faa3c69eb90e8d3f5cad7867bab447edadc..4c0807f9f4d51a13e769379f187a590769009d15 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: plugin_wireless.c,v 1.4 2004/06/17 06:23:43 reinelt Exp $
+/* $Id: plugin_wireless.c,v 1.5 2004/06/20 10:09:56 reinelt Exp $
  *
  * Wireless Extension plugin
  *
  *
  *
  * $Log: plugin_wireless.c,v $
+ * Revision 1.5  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.4  2004/06/17 06:23:43  reinelt
  *
  * hash handling rewritten to solve performance issues
@@ -123,13 +127,13 @@ static char *operation_mode[] = {
         };
 
 
-static void ioctl_error(int line) {
+static void ioctl_error(const int line) {
        error("IOCTL call to wireless extensions in line %d returned error", line);     
 }
 
-int do_ioctl(int  sock,    /* Socket to the kernel */
-     char *    ifname,     /* Device name */
-     int      request,     /* WE ID */
+int do_ioctl(const int  sock,    /* Socket to the kernel */
+     const char *    ifname,     /* Device name */
+     const int      request,     /* WE ID */
      struct iwreq *  pwrq) /* Fixed part of the request */
 {
   /* Set device name */
@@ -139,8 +143,8 @@ int do_ioctl(int  sock,    /* Socket to the kernel */
   return(ioctl(sock, request, pwrq));
 }
 
-int get_range_info(  int    sock,
-          char *  ifname,
+int get_range_info(const int    sock,
+          const char *  ifname,
           struct iw_range *range)
 {
   struct iwreq    req;
@@ -167,7 +171,7 @@ int get_range_info(  int    sock,
 
 
 
-static int get_ifname(struct iwreq *preq, char *dev) {
+static int get_ifname(struct iwreq *preq, const char *dev) {
   /* do not cache this call !!! */
   struct iwreq req;
   char key_buffer[32];
@@ -190,7 +194,7 @@ static int get_ifname(struct iwreq *preq, char *dev) {
 
 }
 
-static int get_frequency(char* dev,char* key) {    
+static int get_frequency(const char* dev,const char* key) {    
   /* Get frequency / channel */
   struct iwreq  req; 
   char qprintf_buffer[1024];
@@ -235,7 +239,7 @@ static int get_frequency(char* dev,char* key) {
   
 }
 
-static int get_essid(char* dev,char* key) {    
+static int get_essid(const char* dev, const char* key) {    
   /* Get ESSID */
   struct iwreq  req; 
   char key_buffer[32];
@@ -270,7 +274,7 @@ static int get_essid(char* dev,char* key) {
   
 }
 
-static int get_op_mode(char* dev,char* key) {    
+static int get_op_mode(const char* dev, const char* key) {    
   /* Get operation mode */
   struct iwreq  req; 
   char key_buffer[32];
@@ -302,7 +306,7 @@ static int get_op_mode(char* dev,char* key) {
       
 }
 
-static int get_bitrate(char* dev,char* key) {    
+static int get_bitrate(const char* dev, const char* key) {    
   /* Get bit rate */
   struct iwreq  req; 
   char key_buffer[32];
@@ -344,7 +348,7 @@ static int get_bitrate(char* dev,char* key) {
   return(0);
 }
     
-static int get_sens(char* dev,char* key) {
+static int get_sens(const char* dev, const char* key) {
   /* Get sensitivity */
   struct iwreq  req; 
   struct iw_range range;
@@ -394,7 +398,7 @@ static int get_sens(char* dev,char* key) {
 }
     
 
-static int get_sec_mode(char* dev,char* key) {
+static int get_sec_mode(const char* dev, const char* key) {
   // Get encryption information 
   struct iwreq  req; 
   char key_buffer[32];
@@ -441,7 +445,7 @@ static int get_sec_mode(char* dev,char* key) {
     return(0);
 }
 
-static int get_stats(char *dev, char *key)
+static int get_stats(const char *dev, const char *key)
 {
   struct iw_statistics stats;
   struct iwreq  req; 
@@ -523,7 +527,7 @@ static int check_socket() {
   
 }
 
-static void save_result(RESULT *result, char* dev, char* key, int res) {
+static void save_result(RESULT *result, const char* dev, const char* key, const int res) {
   char key_buffer[64];
   char* val=NULL;
   qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev,key);
index 4b9a42d17b0aa2847940103ae5d6752a847fae36..0d831c8f4eff79b1f5ce909e53c673168f16203d 100644 (file)
--- a/qprintf.c
+++ b/qprintf.c
@@ -1,4 +1,4 @@
-/* $Id: qprintf.c,v 1.3 2004/04/12 11:12:26 reinelt Exp $
+/* $Id: qprintf.c,v 1.4 2004/06/20 10:09:56 reinelt Exp $
  *
  * simple but quick snprintf() replacement
  *
  *
  *
  * $Log: qprintf.c,v $
+ * Revision 1.4  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.3  2004/04/12 11:12:26  reinelt
  * added plugin_isdn, removed old ISDN client
  * fixed some real bad bugs in the evaluator
 #include <stdarg.h>
 #include <string.h>
 
-static char *itoa(char* buffer, size_t size, int value)
+static char *itoa(char* buffer, const size_t size, int value)
 {
   char *p;
   int sign;
+  
   // sanity checks
   if (buffer==NULL || size<2) return (NULL);
   
@@ -88,7 +92,7 @@ static char *itoa(char* buffer, size_t size, int value)
 } 
 
 
-static char *utoa(char* buffer, size_t size, unsigned int value)
+static char *utoa(char* buffer, const size_t size, unsigned int value)
 {
   char *p;
  
@@ -110,7 +114,7 @@ static char *utoa(char* buffer, size_t size, unsigned int value)
 } 
 
 
-static char *utox(char* buffer, size_t size, unsigned int value)
+static char *utox(char* buffer, const size_t size, unsigned int value)
 {
   char *p;
   int digit;
@@ -134,7 +138,7 @@ static char *utox(char* buffer, size_t size, unsigned int value)
 } 
 
 
-int qprintf(char *str, size_t size, const char *format, ...) {
+int qprintf(char *str, const size_t size, const char *format, ...) {
 
   va_list ap;
   const char *src;
@@ -145,12 +149,10 @@ int qprintf(char *str, size_t size, const char *format, ...) {
   dst = str;
   len = 0;
   
-  // leave room for terminating zero 
-  size--;
-  
   va_start(ap, format);
   
-  while (len < size) {
+  // use size-1 for terminating zero
+  while (len < size-1) {
     
     if (*src=='%') {
       char buf[12], *s;
@@ -160,7 +162,7 @@ int qprintf(char *str, size_t size, const char *format, ...) {
       case 's':
        src++;
        s = va_arg(ap, char *);
-       while (len < size && *s != '\0') {
+       while (len < size-1 && *s != '\0') {
          len++;
          *dst++ = *s++;
        }
@@ -178,7 +180,7 @@ int qprintf(char *str, size_t size, const char *format, ...) {
        src++;
        u = va_arg(ap, unsigned int);
        s = utoa (buf, sizeof(buf), u);
-       while (len < size && *s != '\0') {
+       while (len < size-1 && *s != '\0') {
          len++;
          *dst++ = *s++;
        }
@@ -187,7 +189,7 @@ int qprintf(char *str, size_t size, const char *format, ...) {
        src++;
        u = va_arg(ap, unsigned int);
        s = utox (buf, sizeof(buf), u);
-       while (len < size && *s != '\0') {
+       while (len < size-1 && *s != '\0') {
          len++;
          *dst++ = *s++;
        }
@@ -206,7 +208,7 @@ int qprintf(char *str, size_t size, const char *format, ...) {
   va_end(ap);
   
   // enforce terminating zero
-  if (len>=size && *(dst-1)!='\0') {
+  if (len>=size-1 && *(dst-1)!='\0') {
     len++;
     *dst='\0';
   }
index 99c51fea15184ccd35a20a1c36cb7ddca0757841..4a9fffda5a7c36bee1aa6b8758b3b606bb6680f3 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.4 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: thread.c,v 1.5 2004/06/20 10:09:56 reinelt Exp $
  *
  * thread handling (mutex, shmem, ...)
  *
  *
  *
  * $Log: thread.c,v $
+ * Revision 1.5  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.4  2004/06/01 06:45:30  reinelt
  *
  * some Fixme's processed
@@ -123,7 +127,7 @@ int mutex_create (void)
 }
 
 
-void mutex_lock (int semid) 
+void mutex_lock (const int semid) 
 {
   struct sembuf sembuf;
   sembuf.sem_num =  0;
@@ -133,7 +137,7 @@ void mutex_lock (int semid)
 }
 
 
-void mutex_unlock (int semid) 
+void mutex_unlock (const int semid) 
 {
   struct sembuf sembuf;
   sembuf.sem_num = 0;
@@ -143,14 +147,14 @@ void mutex_unlock (int semid)
 }
 
 
-void mutex_destroy (int semid)
+void mutex_destroy (const int semid)
 {
   union semun arg;
   semctl(semid, 0, IPC_RMID, arg);
 }
 
 
-int shm_create (void **buffer, int size) 
+int shm_create (void **buffer, const int size) 
 {
   int shmid;
   
@@ -170,14 +174,14 @@ int shm_create (void **buffer, int size)
 }
 
 
-void shm_destroy (int shmid, void *buffer) 
+void shm_destroy (const int shmid, const void *buffer) 
 {
   shmdt (buffer);
   shmctl(shmid, IPC_RMID, NULL);
 }
 
 
-int thread_create (char *name, void (*thread)(void *data), void *data)
+int thread_create (const char *name, void (*thread)(void *data), void *data)
 {
   pid_t pid, ppid;
 
index 30ea1a9031eca3ca3cb30bbde425e7134c2dcf9b..16b5eccb5146c746da0d715e44b28b49c478f228 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -1,4 +1,4 @@
-/* $Id: thread.h,v 1.3 2004/04/08 10:48:25 reinelt Exp $
+/* $Id: thread.h,v 1.4 2004/06/20 10:09:56 reinelt Exp $
  *
  * thread handling (mutex, shmem, ...)
  *
  *
  *
  * $Log: thread.h,v $
+ * Revision 1.4  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.3  2004/04/08 10:48:25  reinelt
  * finished plugin_exec
  * modified thread handling
 #define _THREAD_H_
 
 int  mutex_create  (void);
-void mutex_lock    (int semid);
-void mutex_unlock  (int semid);
-void mutex_destroy (int semid);
+void mutex_lock    (const int semid);
+void mutex_unlock  (const int semid);
+void mutex_destroy (const int semid);
 
-int  shm_create    (void **buffer, int size);
-void shm_destroy   (int shmid, void *buffer) ;
+int  shm_create    (void **buffer, const int size);
+void shm_destroy   (const int shmid, const void *buffer);
 
-int thread_create (char *name, void (*thread)(void *data), void *data);
+int thread_create  (const char *name, void (*thread)(void *data), void *data);
 
 #endif
diff --git a/timer.c b/timer.c
index 6d478d07d743c4d2c03437962ea4509550075fd6..14b82399fc657374deeee2ddf313738222b83725 100644 (file)
--- a/timer.c
+++ b/timer.c
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.7 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: timer.c,v 1.8 2004/06/20 10:09:56 reinelt Exp $
  *
  * generic timer handling
  *
  *
  *
  * $Log: timer.c,v $
+ * Revision 1.8  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.7  2004/06/01 06:45:30  reinelt
  *
  * some Fixme's processed
@@ -99,7 +103,7 @@ TIMER *Timers=NULL;
 int   nTimers=0;
 
 
-static void timer_inc (struct timeval *tv, int msec)
+static void timer_inc (struct timeval *tv, const int msec)
 {
   tv->tv_sec  +=  msec                     / 1000;
   tv->tv_usec += (msec - 1000*(msec/1000)) * 1000;
@@ -111,7 +115,7 @@ static void timer_inc (struct timeval *tv, int msec)
 }
 
 
-int timer_add (void (*callback)(void *data), void *data, int interval, int one_shot)
+int timer_add (void (*callback)(void *data), void *data, const int interval, const int one_shot)
 {
   int i;
   struct timeval now;
diff --git a/timer.h b/timer.h
index 4f54676b4401fb3ac7232406e8f22e4b9f60e0f5..9ff9e9550a899b31edd36532dd4daf141901d4d8 100644 (file)
--- a/timer.h
+++ b/timer.h
@@ -1,4 +1,4 @@
-/* $Id: timer.h,v 1.3 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: timer.h,v 1.4 2004/06/20 10:09:56 reinelt Exp $
  *
  * generic timer handling
  *
  *
  *
  * $Log: timer.h,v $
+ * Revision 1.4  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.3  2004/06/01 06:45:30  reinelt
  *
  * some Fixme's processed
@@ -45,7 +49,7 @@
 #ifndef _TIMER_H_
 #define _TIMER_H_
 
-int timer_add (void(*callback)(void *data), void *data, int interval, int one_shot);
+int timer_add (void(*callback)(void *data), void *data, const int interval, const int one_shot);
 int timer_process (struct timespec *delay);
 void timer_exit();
 
index f332bb07bf4d1662a07d4c2eea83fd4dca012741..bfbdf00645a51f3c10dbf2984429b1b5513bb64c 100644 (file)
--- a/udelay.c
+++ b/udelay.c
@@ -1,4 +1,4 @@
-/* $Id: udelay.c,v 1.16 2004/04/12 05:14:42 reinelt Exp $
+/* $Id: udelay.c,v 1.17 2004/06/20 10:09:56 reinelt Exp $
  *
  * short delays
  *
  *
  *
  * $Log: udelay.c,v $
+ * Revision 1.17  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.16  2004/04/12 05:14:42  reinelt
  * another BIG FAT WARNING on the use of raw ports instead of ppdev
  *
 
 unsigned long loops_per_usec;
 
-void ndelay (unsigned long nsec)
+void ndelay (const unsigned long nsec)
 {
   unsigned long loop=(nsec*loops_per_usec+999)/1000;
   
@@ -265,7 +269,7 @@ void udelay_init (void)
 }
 
 
-void ndelay (unsigned long nsec)
+void ndelay (const unsigned long nsec)
 {
 
 #ifdef HAVE_ASM_MSR_H
@@ -273,14 +277,15 @@ void ndelay (unsigned long nsec)
   if (ticks_per_usec) {
 
     unsigned int t1, t2;
-    
-    nsec=(nsec*ticks_per_usec+999)/1000;
+    unsigned long tsc;
+
+    tsc=(nsec*ticks_per_usec+999)/1000;
 
     rdtscl(t1);
     do {
       rep_nop();
       rdtscl(t2);
-    } while ((t2-t1)<nsec);
+    } while ((t2-t1)<tsc);
     
   } else
 
index fd7e873f1bf8e9a95fdbc090fc29adff4b7752f7..ddfc8d95748403c397ccae551f166ecb751f6036 100644 (file)
--- a/udelay.h
+++ b/udelay.h
@@ -1,4 +1,4 @@
-/* $Id: udelay.h,v 1.5 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: udelay.h,v 1.6 2004/06/20 10:09:56 reinelt Exp $
  *
  * short delays 
  *
  *
  *
  * $Log: udelay.h,v $
+ * Revision 1.6  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.5  2003/10/05 17:58:50  reinelt
  * libtool junk; copyright messages cleaned up
  *
@@ -70,7 +74,7 @@ void udelay_init (void);
 
 #endif
 
-void ndelay (unsigned long nsec);
+void ndelay (const unsigned long nsec);
 
 #define udelay(usec) ndelay(usec*1000)
 
index e7be927155c76ff1dca99261411d663dea202c4c..79387b57acf41a49541eef9f02b13e5879152d64 100644 (file)
--- a/widget.c
+++ b/widget.c
@@ -1,4 +1,4 @@
-/* $Id: widget.c,v 1.14 2004/05/26 11:37:36 reinelt Exp $
+/* $Id: widget.c,v 1.15 2004/06/20 10:09:56 reinelt Exp $
  *
  * generic widget handling
  *
  *
  *
  * $Log: widget.c,v $
+ * Revision 1.15  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.14  2004/05/26 11:37:36  reinelt
  *
  * Curses driver ported.
@@ -153,7 +157,7 @@ void widget_unregister(void) {
   nClasses=0;
 }
 
-int widget_add (char *name, int row, int col)
+int widget_add (const char *name, const int row, const int col)
 {
   int i;
   char *section;
@@ -210,7 +214,7 @@ int widget_add (char *name, int row, int col)
   Widget=&(Widgets[nWidgets]);
   nWidgets++;
   
-  Widget->name  = name;
+  Widget->name  = (char*)name;
   Widget->class = Class;
   Widget->row   = row;
   Widget->col   = col;
index 6fcfe116bfb85a845a9521dee1ee408a513f261c..af386be2da181df230883e95d3767d434f70f810 100644 (file)
--- a/widget.h
+++ b/widget.h
@@ -1,4 +1,4 @@
-/* $Id: widget.h,v 1.8 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: widget.h,v 1.9 2004/06/20 10:09:56 reinelt Exp $
  *
  * generic widget handling
  *
  *
  *
  * $Log: widget.h,v $
+ * Revision 1.9  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.8  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -86,8 +90,8 @@ typedef struct WIDGET{
 
 
 
-int widget_register (WIDGET_CLASS *widget);
+int  widget_register   (WIDGET_CLASS *widget);
 void widget_unregister (void);
-int widget_add      (char *name, int row, int col);
+int  widget_add        (const char *name, const int row, const int col);
 
 #endif
index 95edb8fb84aa934d32ebc3ff8dce877e821bfe53..a516cb2aaf316d6fbbd82390acca7957629bc233 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: widget_icon.c,v 1.11 2004/03/11 06:39:59 reinelt Exp $
+/* $Id: widget_icon.c,v 1.12 2004/06/20 10:09:56 reinelt Exp $
  *
  * icon widget handling
  *
  *
  *
  * $Log: widget_icon.c,v $
+ * Revision 1.12  2004/06/20 10:09:56  reinelt
+ *
+ * 'const'ified the whole source
+ *
  * Revision 1.11  2004/03/11 06:39:59  reinelt
  * big patch from Martin:
  * - reuse filehandles
 // icons always are 8 pixels high 
 #define YRES 8
 
-static void widget_icon_read_bitmap (char *section, WIDGET_ICON *Icon)
+static void widget_icon_read_bitmap (const char *section, WIDGET_ICON *Icon)
 {
   int row, n;
   char  key[15];