Gxxx n1 n2 TABLE {expression} = (x0, y0) (x1, y1) (x2, y2)

This commit is contained in:
h_vogt
2011-12-21 21:33:47 +00:00
parent d6e616a310
commit 94e9f07b90
4 changed files with 261 additions and 43 deletions
+34
View File
@@ -360,6 +360,40 @@ gettok_instance(char **s)
return ( token ) ;
}
/* get the next token starting at next non white spice, stopping
at p, if inc_p is true, then including p, else excluding p
*/
char *
gettok_char(char **s, char p, bool inc_p)
{
char c;
char *token ; /* return token */
SPICE_DSTRING buf ; /* allow any length string */
while ( isspace(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
return (NULL); /* return NULL if we come to end of line */
spice_dstring_init(&buf) ;
while ((c = **s) != '\0' &&
( **s != p )
) {
spice_dstring_append_char( &buf, *(*s)++ ) ;
}
if (inc_p)
spice_dstring_append_char( &buf, *(*s)++ ) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
(*s)++;
token = copy( spice_dstring_value(&buf) ) ;
spice_dstring_free(&buf) ;
return ( token ) ;
}
/*-------------------------------------------------------------------------*
* gettok_node was added by SDB on 12.3.2003
* It acts like gettok, except that it treats parens and commas like