From 97f92ab56802c16175dc7934a71ce29c9cb271f2 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Wed, 14 Feb 2001 07:40:16 +0000 Subject: [lcd4linux @ 2001-02-14 07:40:16 by reinelt] first (incomplete) GPO implementation --- parser.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index f9fd99d..35f1b70 100644 --- a/parser.c +++ b/parser.c @@ -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 @@ -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; +} -- cgit v1.2.3