mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
[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
This commit is contained in:
33
parser.c
33
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 <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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user