[Redbutton-devel] SF.net SVN: redbutton: [470] redbutton-author/trunk/ccc.y
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-11-30 16:25:38
|
Revision: 470
http://redbutton.svn.sourceforge.net/redbutton/?rev=470&view=rev
Author: skilvington
Date: 2007-11-30 08:25:35 -0800 (Fri, 30 Nov 2007)
Log Message:
-----------
move is_synthetic() checks out of asn1decode.c
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-11-29 17:15:30 UTC (rev 469)
+++ redbutton-author/trunk/ccc.y 2007-11-30 16:25:35 UTC (rev 470)
@@ -792,9 +792,8 @@
/* ASN1 is_Xxx() functions */
buf_append(&state.decode_is_fns, "bool is_%s(unsigned char class, unsigned int number)\n{\n", name);
- buf_append(&state.decode_is_fns, "\tif(!is_synthetic(ASN1TAGCLASS_%s))\n", name);
- buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_%s);\n", name);
- buf_append(&state.decode_is_fns, "\telse\n");
+ if(!is_synthetic(asn1tagclass(name)))
+ buf_append(&state.decode_is_fns, "\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_%s);\n", name);
/* count how many non-literal items there are */
nitems = 0;
@@ -815,7 +814,8 @@
buf_append(&state.decode_fns, "\t}\n\telse\n");
buf_append(&state.decode_fns, "\t{\n\t\treturn der_error(\"%s\");\n\t}\n\n", name);
/* is_Xxx() function */
- buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_OCTETSTRING);\n");
+ if(is_synthetic(asn1tagclass(name)))
+ buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_OCTETSTRING);\n");
}
/* has it got only 1 non-literal item */
else if(nitems == 1)
@@ -942,7 +942,8 @@
}
buf_append(&state.decode_fns, "\n");
/* is_Xxx() function */
- buf_append(&state.decode_is_fns, "\t\treturn is_%s(class, number);\n", item->name);
+ if(is_synthetic(asn1tagclass(name)))
+ buf_append(&state.decode_is_fns, "\t\treturn is_%s(class, number);\n", item->name);
/* output any literals at the end */
item = item->next;
while(item)
@@ -972,7 +973,8 @@
if(item->type != IT_IDENTIFIER)
fatal("not Identifier");
/* is_Xxx() - just match the first item */
- buf_append(&state.decode_is_fns, "\t\treturn is_%s(class, number);\n", item->name);
+ if(is_synthetic(asn1tagclass(name)))
+ buf_append(&state.decode_is_fns, "\t\treturn is_%s(class, number);\n", item->name);
/* decode_Xxx() - examine each non-literal item in turn */
while(item && item->type != IT_LITERAL)
{
@@ -1059,15 +1061,18 @@
while(item && item->type != IT_LITERAL)
{
/* is_Xxx() */
- if(first)
- buf_append(&state.decode_is_fns, "\t\treturn ");
- else
- buf_append(&state.decode_is_fns, "\t\t || ");
- buf_append(&state.decode_is_fns, "is_%s(class, number)", item->name);
- /* is it the last */
- if(item->next == NULL || item->next->type == IT_LITERAL)
- buf_append(&state.decode_is_fns, ";");
- buf_append(&state.decode_is_fns, "\n");
+ if(is_synthetic(asn1tagclass(name)))
+ {
+ if(first)
+ buf_append(&state.decode_is_fns, "\treturn ");
+ else
+ buf_append(&state.decode_is_fns, "\t || ");
+ buf_append(&state.decode_is_fns, "is_%s(class, number)", item->name);
+ /* is it the last */
+ if(item->next == NULL || item->next->type == IT_LITERAL)
+ buf_append(&state.decode_is_fns, ";");
+ buf_append(&state.decode_is_fns, "\n");
+ }
/* decode_Xxx() */
if(first)
buf_append(&state.decode_fns, "\t\t");
@@ -1158,7 +1163,8 @@
/* prototype */
buf_append(&state.decode_hdr, "int der_decode_%s(FILE *, FILE *, int);\n", name);
/* is_Xxx() function */
- buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_ENUMERATED);\n");
+ if(is_synthetic(asn1tagclass(name)))
+ buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_ENUMERATED);\n");
}
/* must be a CHOICE */
else
@@ -1172,15 +1178,18 @@
for(item=state.items; item; item=item->next)
{
/* is_Xxx() function */
- if(item == state.items)
- buf_append(&state.decode_is_fns, "\t\treturn ");
- else
- buf_append(&state.decode_is_fns, "\t\t || ");
- buf_append(&state.decode_is_fns, "is_%s(class, number)", item->name);
- /* is it the last */
- if(item->next == NULL)
- buf_append(&state.decode_is_fns, ";");
- buf_append(&state.decode_is_fns, "\n");
+ if(is_synthetic(asn1tagclass(name)))
+ {
+ if(item == state.items)
+ buf_append(&state.decode_is_fns, "\t\treturn ");
+ else
+ buf_append(&state.decode_is_fns, "\t\t || ");
+ buf_append(&state.decode_is_fns, "is_%s(class, number)", item->name);
+ /* is it the last */
+ if(item->next == NULL)
+ buf_append(&state.decode_is_fns, ";");
+ buf_append(&state.decode_is_fns, "\n");
+ }
/* decode_Xxx() function */
if(item == state.items)
buf_append(&state.decode_fns, "\t");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|