diff options
author | reinelt <> | 2004-03-08 16:26:26 +0000 |
---|---|---|
committer | reinelt <> | 2004-03-08 16:26:26 +0000 |
commit | 6225b16ed402393732cb733093f92d1be5679f28 (patch) | |
tree | be92cbd024c7ec44efa84f89922cd99e1fabb4e4 | |
parent | 3d4be5f0273220ea69c39cff2a00dd2bdf7cdc18 (diff) | |
download | lcd4linux-6225b16ed402393732cb733093f92d1be5679f28.tar.gz |
[lcd4linux @ 2004-03-08 16:26:26 by reinelt]
re-introduced \nnn (octal) characters in strings
text widgets can have a 'update' speed of 0 which means 'never'
(may be used for static content)
Diffstat (limited to '')
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | cfg.c | 38 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 2 | ||||
-rw-r--r-- | widget_text.c | 16 |
5 files changed, 46 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am index 528eeff..22dea96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ plugin_ppp.c \ plugin_dvb.c \ plugin_i2c_sensors.c \ plugin_imon.c \ -plugin_xmms.c +plugin_xmms.c #liblcd4linux_la_DEPENDENCIES = @DRIVERS@ #liblcd4linux_la_LDFLAGS = -version-info 9:12:9 diff --git a/Makefile.in b/Makefile.in index f596ea5..842a8a8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@ #remove next line for liblcd4linux lcd4linux_DEPENDENCIES = @DRIVERS@ -lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h lock.c lock.h pid.c pid.h timer.c timer.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_netdev.c plugin_ppp.c plugin_dvb.c plugin_i2c_sensors.c plugin_imon.c plugin_xmms.c +lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h lock.c lock.h pid.c pid.h timer.c timer.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_netdev.c plugin_ppp.c plugin_dvb.c plugin_i2c_sensors.c plugin_imon.c plugin_xmms.c #liblcd4linux_la_DEPENDENCIES = @DRIVERS@ @@ -1,4 +1,4 @@ -/* $Id: cfg.c,v 1.37 2004/03/06 20:31:16 reinelt Exp $^ +/* $Id: cfg.c,v 1.38 2004/03/08 16:26:26 reinelt Exp $^ * * config file stuff * @@ -23,6 +23,11 @@ * * * $Log: cfg.c,v $ + * Revision 1.38 2004/03/08 16:26:26 reinelt + * re-introduced \nnn (octal) characters in strings + * text widgets can have a 'update' speed of 0 which means 'never' + * (may be used for static content) + * * Revision 1.37 2004/03/06 20:31:16 reinelt * Complete rewrite of the evaluator to get rid of the code * from mark Morley (because of license issues). @@ -307,14 +312,33 @@ static char *strip (char *s, int strip_comments) // unquote a string static char *dequote (char *string) { - char *s=string; - char *p=string; + int quote=0; + char *s = string; + char *p = string; do { - if (*s=='\\' && *(s+1)=='#') { - *p++=*++s; - } else { - *p++=*s; + if (*s == '\'') { + quote = !quote; + *p++ = *s; + } + else if (quote && *s == '\\') { + s++; + if (*s >= '0' && *s <= '7') { + int n; + unsigned int c = 0; + sscanf (s, "%3o%n", &c, &n); + if (c == 0 || c > 255) { + error ("WARNING: illegal '\\' in <%s>", string); + } else { + *p++ = c; + s += n-1; + } + } else { + *p++ = *s; + } + } + else { + *p++ = *s; } } while (*s++); diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 1147236..707e7d7 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -9,13 +9,13 @@ Display LK204 { Display CF631 { - Icons 5 Driver 'Crystalfontz' Model '631' Port '/dev/usb/tts/0' Speed 115200 Contrast 95 Backlight 100 + Icons 1 } Display CF632 { diff --git a/widget_text.c b/widget_text.c index 0610220..3c8d2dc 100644 --- a/widget_text.c +++ b/widget_text.c @@ -1,4 +1,4 @@ -/* $Id: widget_text.c,v 1.15 2004/03/06 20:31:16 reinelt Exp $ +/* $Id: widget_text.c,v 1.16 2004/03/08 16:26:26 reinelt Exp $ * * simple text widget handling * @@ -21,6 +21,11 @@ * * * $Log: widget_text.c,v $ + * Revision 1.16 2004/03/08 16:26:26 reinelt + * re-introduced \nnn (octal) characters in strings + * text widgets can have a 'update' speed of 0 which means 'never' + * (may be used for static content) + * * Revision 1.15 2004/03/06 20:31:16 reinelt * Complete rewrite of the evaluator to get rid of the code * from mark Morley (because of license issues). @@ -373,8 +378,10 @@ int widget_text_init (WIDGET *Self) } free (c); - // update interval (msec), default 1 sec - cfg_number (section, "update", 1000, 10, 99999, &(Text->update)); + // update interval (msec), default 1 sec, 0 stands for never + cfg_number (section, "update", 1000, 0, 99999, &(Text->update)); + // limit update interval to min 10 msec + if (Text->update > 0 && Text->update < 10) Text->update = 10; // marquee scroller speed: interval (msec), default 500msec if (Text->align==ALIGN_MARQUEE) { @@ -387,7 +394,8 @@ int widget_text_init (WIDGET *Self) free (section); Self->data=Text; - timer_add (widget_text_update, Self, Text->update, 0); + // add update timer, use one-shot if 'update' is zero + timer_add (widget_text_update, Self, Text->update, Text->update==0); // a marquee scroller has its own timer and callback if (Text->align==ALIGN_MARQUEE) { |