diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-02-14 07:40:16 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-02-14 07:40:16 +0000 |
commit | f73848014030f0fb62b4f9738e9192621fae1aa2 (patch) | |
tree | dda7676a8ca4e9fb7ff67bccb2b53b284b4bf3d1 /parser.c | |
parent | 41b5b222a3b3a1d0e2956e5ac7e30eb3dba1304e (diff) | |
download | lcd4linux-f73848014030f0fb62b4f9738e9192621fae1aa2.tar.gz |
[lcd4linux @ 2001-02-14 07:40:16 by reinelt]
first (incomplete) GPO implementation
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@80 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-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; +} |