-/* $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
// remove leading and trailing whitespace
-static char *strip (char *s, int strip_comments)
+static char *strip (char *s, const int strip_comments)
{
char *p;
// 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
}
-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;
}
-int l4l_cfg_cmd (char *arg)
+int cfg_cmd (const char *arg)
{
char *key, *val;
char buffer[256];
}
-char *l4l_cfg_list (char *section)
+char *cfg_list (const char *section)
{
int i, len;
char *key, *list;
}
-static char *cfg_lookup (char *section, char *key)
+static char *cfg_lookup (const char *section, const char *key)
{
int len;
char *buffer;
}
-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;
}
-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;
}
-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:
}
-static int cfg_read (char *file)
+static int cfg_read (const char *file)
{
FILE *stream;
char buffer[256];
}
-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);
}
-char *l4l_cfg_source (void)
+char *cfg_source (void)
{
if (Config_File)
return Config_File;
}
-int l4l_cfg_exit (void)
+int cfg_exit (void)
{
int i;
for (i=0; i<nConfig; i++) {
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;
-/* $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
-/* $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.
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];
-/* $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)
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)
-/* $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
}
-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++) {
}
-int drv_quit (int quiet)
+int drv_quit (const int quiet)
{
if (Drv->quit == NULL) return 0;
return Drv->quit(quiet);
-/* $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
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;
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
-/* $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
// *** 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";
}
-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];
}
-static int drv_BE_start (char *section, int quiet)
+static int drv_BE_start (const char *section, const int quiet)
{
int i;
char *model;
// 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;
// close driver & display
-int drv_BE_quit (int quiet) {
+int drv_BE_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
// 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--) {
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;
}
}
-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;
}
-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
}
-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
}
-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];
}
-static int drv_CF_start (char *section)
+static int drv_CF_start (const char *section)
{
int i;
char *model;
// ****************************************
-static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
+static void plugin_contrast (RESULT *result, const int argc, RESULT *argv[])
{
double contrast;
}
-static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
+static void plugin_backlight (RESULT *result, const int argc, RESULT *argv[])
{
double backlight;
}
-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;
// 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;
// close driver & display
-int drv_CF_quit (int quiet) {
+int drv_CF_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
}
-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) {
}
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
}
}
-static int drv_Curs_start (char *section, int quiet)
+static int drv_Curs_start (const char *section, const int quiet)
{
char *s;
// 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;
// close driver & display
-int drv_Curs_quit (int quiet) {
+int drv_Curs_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
// *** 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";
}
-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";
}
-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";
}
-static int drv_CW_start (char *section)
+static int drv_CW_start (const char *section)
{
int i;
char *model;
// ****************************************
-static void plugin_brightness (RESULT *result, int argc, RESULT *argv[])
+static void plugin_brightness (RESULT *result, const int argc, RESULT *argv[])
{
double brightness;
// 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;
// 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();
-/* $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
}
-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;
}
-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);
}
-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;
}
-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
ndelay(T_AS);
}
- while (len--) {
+ while (l--) {
if (UseBusy) {
wait_for_busy_flag(controller);
} else { // 4 bit mode
- while (len--) {
+ while (l--) {
if (UseBusy) wait_for_busy_flag(controller);
// send data with RS enabled
}
-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];
// Fixme: GPO's
#if 0
-static void drv_HD_setGPO (int bits)
+static void drv_HD_setGPO (const int bits)
{
if (Lcd.gpos>0) {
#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;
// 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;
// close driver & display
-int drv_HD_quit (int quiet) {
+int drv_HD_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
}
-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;
}
-static int drv_IMG_start (char *section)
+static int drv_IMG_start (const char *section)
{
char *s;
// 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;
// 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();
-/* $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
// *** 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
}
-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;
// Fixme: GPO's
#if 0
-static void drv_M5_setGPO (int bits)
+static void drv_M5_setGPO (const int bits)
{
if (Lcd.gpos>0) {
#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;
// 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;
// close driver & display
-int drv_M5_quit (int quiet) {
+int drv_M5_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
}
-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";
}
-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";
}
-static int drv_MO_start (char *section, int quiet)
+static int drv_MO_start (const char *section, const int quiet)
{
int i;
char *model;
// ****************************************
-static void plugin_contrast (RESULT *result, int argc, RESULT *argv[])
+static void plugin_contrast (RESULT *result, const int argc, RESULT *argv[])
{
double contrast;
}
-static void plugin_backlight (RESULT *result, int argc, RESULT *argv[])
+static void plugin_backlight (RESULT *result, const int argc, RESULT *argv[])
{
double backlight;
}
-static void plugin_gpo (RESULT *result, int argc, RESULT *argv[])
+static void plugin_gpo (RESULT *result, const int argc, RESULT *argv[])
{
double gpo;
}
-static void plugin_pwm (RESULT *result, int argc, RESULT *argv[])
+static void plugin_pwm (RESULT *result, const int argc, RESULT *argv[])
{
double pwm;
// 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;
// close driver & display
-int drv_MO_quit (int quiet) {
+int drv_MO_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
}
-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;
}
-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";
}
-static int drv_MI_start (char *section, int quiet)
+static int drv_MI_start (const char *section, const int quiet)
{
int i;
char *model;
// 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;
// close driver & display
-int drv_MI_quit (int quiet) {
+int drv_MI_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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;
// 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;
// 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();
-/* $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
}
-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();
}
-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();
}
-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();
#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);
}
-static void drv_T6_clear(unsigned short addr, int len)
+static void drv_T6_clear(const unsigned short addr, const int len)
{
int i;
}
-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;
}
-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;
}
}
-static int drv_T6_start (char *section)
+static int drv_T6_start (const char *section)
{
char *model, *s;
int rows, TROWS, TCOLS;
// 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;
// close driver & display
-int drv_T6_quit (int quiet) {
+int drv_T6_quit (const int quiet) {
info("%s: shutting down.", Name);
-/* $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
}
-static void drv_UL_command (unsigned char cmd)
+static void drv_UL_command (const unsigned char cmd)
{
*BufPtr++='\0';
*BufPtr++=cmd;
}
-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);
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;
}
-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;
// 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;
// close driver & display
-int drv_UL_quit (int quiet)
+int drv_UL_quit (const int quiet)
{
info("%s: shutting down.", Name);
-/* $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)
// *** 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;
}
-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:
}
-static int drv_X11_start (char *section)
+static int drv_X11_start (const char *section)
{
char *s;
XSetWindowAttributes wa;
// 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;
// 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();
*
*
* $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
// *** 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);
// 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,
// *** 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;
-/* $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)
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);
-/* $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
*
#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();
}
-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];
}
-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];
}
-void drv_generic_parport_direction (int direction)
+void drv_generic_parport_direction (const int direction)
{
#ifdef WITH_PPDEV
if (PPdev) {
}
-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;
}
-void drv_generic_parport_data (unsigned char data)
+void drv_generic_parport_data (const unsigned char data)
{
#ifdef WITH_PPDEV
if (PPdev) {
-/* $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);
-/* $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;
// *** 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];
}
-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;
}
-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') {
}
-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;
}
-int drv_generic_serial_read (unsigned char *string, int len)
+int drv_generic_serial_read (unsigned char *string, const int len)
{
int run, ret;
}
-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;
-/* $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
-/* $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
// *** 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));
// 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;
}
-int drv_generic_text_bar_init (int single_segments)
+int drv_generic_text_bar_init (const int single_segments)
{
if (BarFB) free (BarFB);
}
-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;
}
-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;
}
-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;
-/* $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
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
-/* $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
}
-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)
}
-static VARIABLE *FindVariable (char *name)
+static VARIABLE *FindVariable (const char *name)
{
int i;
}
-int SetVariable (char *name, RESULT *value)
+int SetVariable (const char *name, RESULT *value)
{
VARIABLE *V;
}
-int SetVariableNumeric (char *name, double value)
+int SetVariableNumeric (const char *name, const double value)
{
RESULT result = {0, 0, 0, NULL};
RESULT *rp = &result;
}
-int SetVariableString (char *name, char *value)
+int SetVariableString (const char *name, const char *value)
{
RESULT result = {0, 0, 0, NULL};
RESULT *rp = &result;
}
-static FUNCTION* FindFunction (char *name)
+static FUNCTION* FindFunction (const char *name)
{
int i;
}
-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));
}
-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();
-/* $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
} 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);
-/* $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
// 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;
// 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;
// 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;
// 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;
// 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;
// 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;
-/* $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
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);
-/* $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);
}
-int layout_init (char *layout)
+int layout_init (const char *layout)
{
char *section;
char *list, *l;
-/* $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)
#ifndef _LAYOUT_H_
#define _LAYOUT_H_
-int layout_init(char *section);
+int layout_init(const char *section);
#endif
-/* $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
}
-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;
-/* $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
// 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;
}
-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);
}
-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];
}
-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;
-/* $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
{"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];
* 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;
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);
}
-void my_i2c_sensors_path(char *method)
+void my_i2c_sensors_path(const char *method)
{
struct dirent *dir;
struct dirent *file;
-/* $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
* 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;
*----------------------------------------------------------------------------
*/
static void
-send_command (int fd, char * str)
+send_command (const int fd, const char * str)
{
char buf[256];
int len = strlen (str);
*----------------------------------------------------------------------------
*/
static char *
-get_answer (int fd)
+get_answer (const int fd)
{
static char buf[8192];
int len;
*----------------------------------------------------------------------------
*/
static char *
-get_value (char * cmd)
+get_value (const char * cmd)
{
char * answer;
}
}
-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;
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;
-/* $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
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];
#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];
-/* $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
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];
}
-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];
}
-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;
-/* $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'
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;
}
-char *struptime (unsigned int uptime, char *format)
+char *struptime (const unsigned int uptime, const char *format)
{
static char string[256];
const char *src;
}
-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;
-/* $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
};
-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 */
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;
-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];
}
-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];
}
-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];
}
-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];
}
-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];
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;
}
-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];
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;
}
-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);
-/* $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);
}
-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;
}
-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;
}
-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;
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;
case 's':
src++;
s = va_arg(ap, char *);
- while (len < size && *s != '\0') {
+ while (len < size-1 && *s != '\0') {
len++;
*dst++ = *s++;
}
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++;
}
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++;
}
va_end(ap);
// enforce terminating zero
- if (len>=size && *(dst-1)!='\0') {
+ if (len>=size-1 && *(dst-1)!='\0') {
len++;
*dst='\0';
}
-/* $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
}
-void mutex_lock (int semid)
+void mutex_lock (const int semid)
{
struct sembuf sembuf;
sembuf.sem_num = 0;
}
-void mutex_unlock (int semid)
+void mutex_unlock (const int semid)
{
struct sembuf sembuf;
sembuf.sem_num = 0;
}
-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;
}
-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;
-/* $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
-/* $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
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;
}
-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;
-/* $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
#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();
-/* $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;
}
-void ndelay (unsigned long nsec)
+void ndelay (const unsigned long nsec)
{
#ifdef HAVE_ASM_MSR_H
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
-/* $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
*
#endif
-void ndelay (unsigned long nsec);
+void ndelay (const unsigned long nsec);
#define udelay(usec) ndelay(usec*1000)
-/* $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.
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;
Widget=&(Widgets[nWidgets]);
nWidgets++;
- Widget->name = name;
+ Widget->name = (char*)name;
Widget->class = Class;
Widget->row = row;
Widget->col = col;
-/* $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
-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
-/* $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];