diff options
author | reinelt <> | 2001-02-14 07:40:16 +0000 |
---|---|---|
committer | reinelt <> | 2001-02-14 07:40:16 +0000 |
commit | 97f92ab56802c16175dc7934a71ce29c9cb271f2 (patch) | |
tree | dda7676a8ca4e9fb7ff67bccb2b53b284b4bf3d1 /parser.c | |
parent | b04158f298eca60f12aac3d75d468b6937005ae6 (diff) | |
download | lcd4linux-97f92ab56802c16175dc7934a71ce29c9cb271f2.tar.gz |
[lcd4linux @ 2001-02-14 07:40:16 by reinelt]
first (incomplete) GPO implementation
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: parser.c,v 1.7 2000/08/10 09:44:09 reinelt Exp $ +/* $Id: parser.c,v 1.8 2001/02/14 07:40:16 reinelt Exp $ * * row definition parser * @@ -20,6 +20,10 @@ * * * $Log: parser.c,v $ + * Revision 1.8 2001/02/14 07:40:16 reinelt + * + * first (incomplete) GPO implementation + * * Revision 1.7 2000/08/10 09:44:09 reinelt * * new debugging scheme: error(), info(), debug() @@ -63,11 +67,16 @@ /* * exported functions: * - * char *parse (char *string, int supported_bars, int usage[]) + * char *parse_row (char *string, int supported_bars, int usage[]) * converts a row definition from the config file * into the internal form using tokens * sets the array usage[token] to usage count * + * char parse_gpo (char *string, int usage[]) + * converts a GPO definition from the config file + * into the internal form using tokens + * sets the array usage[token] to usage count + * */ #include <stdlib.h> @@ -167,7 +176,7 @@ static TOKEN get_token (char *s, char **p, int bar, int usage[]) return -1; } -char *parse (char *string, int supported_bars, int usage[]) +char *parse_row (char *string, int supported_bars, int usage[]) { static char buffer[256]; char *s=string; @@ -254,3 +263,21 @@ char *parse (char *string, int supported_bars, int usage[]) *p='\0'; return buffer; } + +char parse_gpo (char *string, int usage[]) +{ + char *s=string; + TOKEN token=-1; + + if (*s=='%') { + if ((token=get_token (++s, &s, 0, usage))==-1) { + error ("WARNING: unknown token <%%%c> in <%s>", *s, string); + } + } + + if (*s!='\0') { + error ("WARNING: error while parsing <%s>", string); + } + + return token; +} |