[Redbutton-devel] SF.net SVN: redbutton: [369] redbutton-author/trunk/ccc.y
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-09-08 17:32:33
|
Revision: 369
http://redbutton.svn.sourceforge.net/redbutton/?rev=369&view=rev
Author: skilvington
Date: 2007-09-08 10:32:26 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
find the value of enum names
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-31 14:56:23 UTC (rev 368)
+++ redbutton-author/trunk/ccc.y 2007-09-08 17:32:26 UTC (rev 369)
@@ -363,6 +363,7 @@
struct item *item;
struct item *next;
unsigned int nitems;
+ unsigned int enum_val;
/* prototype for the parse_Xxx function */
buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
@@ -458,6 +459,8 @@
fatal("CHOICE or ENUMERATED type, but and_items set");
buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
buf_append(&state.parse_fns, "\t/* CHOICE or ENUMERATED */\n");
+ /* enum values all start at 1 and are listed in order in the grammar */
+ enum_val = 1;
item = state.items;
for(item=state.items; item; item=item->next)
{
@@ -483,9 +486,10 @@
buf_append(&state.parse_enum_hdr, "void parse_%s(struct state *);\n", tok_name);
buf_append(&state.parse_enum_fns, "void parse_%s(struct state *state)\n{\n", tok_name);
buf_append(&state.parse_enum_fns, "\texpect_token(%s, %s);\n", tok_name, item->name);
- buf_append(&state.parse_enum_fns, "\n\tverbose(\"<ENUM value=%s/>\\n\");\n", tok_name);
+ buf_append(&state.parse_enum_fns, "\n\tverbose(\"<ENUM name=%s value=%u/>\\n\");\n", tok_name, enum_val);
buf_append(&state.parse_enum_fns, "\n\treturn;\n}\n\n");
free(tok_name);
+ enum_val ++;
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|