Thread: [Redbutton-devel] SF.net SVN: redbutton: [417] redbutton-author/trunk/ccc.y (Page 2)
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-09-23 20:45:30
|
Revision: 417
http://redbutton.svn.sourceforge.net/redbutton/?rev=417&view=rev
Author: skilvington
Date: 2007-09-23 13:45:27 -0700 (Sun, 23 Sep 2007)
Log Message:
-----------
definitely don't need this anymore
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-23 20:38:15 UTC (rev 416)
+++ redbutton-author/trunk/ccc.y 2007-09-23 20:45:27 UTC (rev 417)
@@ -462,8 +462,6 @@
/* add a child ASN1 object */
if(asn1type(name) == ASN1TYPE_CHOICE)
buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_CHOICE);\n\n");
-// else
-// buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_ENUMERATED);\n\n");
/* peek at the next token */
buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
buf_append(&state.parse_fns, "\t/* CHOICE or ENUMERATED */\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-10-16 11:27:22
|
Revision: 440
http://redbutton.svn.sourceforge.net/redbutton/?rev=440&view=rev
Author: skilvington
Date: 2007-10-16 04:27:20 -0700 (Tue, 16 Oct 2007)
Log Message:
-----------
propogate the current tag to synthetic types
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-10-16 11:02:58 UTC (rev 439)
+++ redbutton-author/trunk/ccc.y 2007-10-16 11:27:20 UTC (rev 440)
@@ -867,6 +867,7 @@
/* while there is data left in the current object */
buf_append(&state.decode_fns, "\twhile(left > 0)\n\t{\n");
/* decode the next tag */
+ buf_append(&state.decode_fns, "\t\tlong pretag = ftell(der);\n");
buf_append(&state.decode_fns, "\t\tif((sublen = der_decode_Tag(der, &tag)) < 0)\n");
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= sublen;\n");
@@ -891,7 +892,16 @@
buf_append(&state.decode_fns, "\t\telse ");
first = false;
buf_append(&state.decode_fns, "if(is_%s(tag.class, tag.number))\n\t\t{\n", item->name);
- buf_append(&state.decode_fns, "\t\t\tasn1decode_%s(der, out, tag.length);\n", item->name);
+ /* if it is a synthetic type, we still need the current tag */
+ buf_append(&state.decode_fns, "\t\t\tif(ASN1TAGCLASS_%s == ASN1TAG_SYNTHETIC)\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\t{\n");
+ buf_append(&state.decode_fns, "\t\t\t\tfseek(der, pretag, SEEK_SET);\n");
+ buf_append(&state.decode_fns, "\t\t\t\tasn1decode_%s(der, out, sublen + tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\t}\n");
+ buf_append(&state.decode_fns, "\t\t\telse\n");
+ buf_append(&state.decode_fns, "\t\t\t{\n");
+ buf_append(&state.decode_fns, "\t\t\t\tasn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\t}\n");
buf_append(&state.decode_fns, "\t\t\tleft -= tag.length;\n");
buf_append(&state.decode_fns, "\t\t}\n");
item = item->next;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-10-18 16:09:41
|
Revision: 449
http://redbutton.svn.sourceforge.net/redbutton/?rev=449&view=rev
Author: skilvington
Date: 2007-10-18 09:09:40 -0700 (Thu, 18 Oct 2007)
Log Message:
-----------
make is_Xxx() functions look prettier
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-10-18 16:06:13 UTC (rev 448)
+++ redbutton-author/trunk/ccc.y 2007-10-18 16:09:40 UTC (rev 449)
@@ -813,7 +813,7 @@
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, "\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_OCTETSTRING);\n");
+ 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)
@@ -827,7 +827,7 @@
buf_append(&state.decode_fns, "\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\tleft -= sublen;\n\n");
buf_append(&state.decode_fns, "\tif(is_%s(tag.class, tag.number))\n\t{\n", item->name);
- /* if it is a synthetic or ENUMERATED type, we still need the current tag */
+ /* if it is a synthetic or primitive type, we still need the current tag */
buf_append(&state.decode_fns, "\t\tif(keep_tag(ASN1TAGCLASS_%s))\n", item->name);
buf_append(&state.decode_fns, "\t\t{\n");
buf_append(&state.decode_fns, "\t\t\tfseek(der, pretag, SEEK_SET);\n");
@@ -841,7 +841,7 @@
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, "\treturn is_%s(class, number);\n", item->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)
@@ -871,7 +871,7 @@
if(item->type != IT_IDENTIFIER)
fatal("not Identifier");
/* is_Xxx() - just match the first item */
- buf_append(&state.decode_is_fns, "\treturn is_%s(class, number);\n", item->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 */
buf_append(&state.decode_fns, "\tlong pretag;\n\n");
while(item && item->type != IT_LITERAL)
@@ -883,7 +883,7 @@
buf_append(&state.decode_fns, "\tleft -= sublen;\n\n");
/* is it what we expect */
buf_append(&state.decode_fns, "\tif(is_%s(tag.class, tag.number))\n\t{\n", item->name);
- /* if it is a synthetic or ENUMERATED type, we still need the current tag */
+ /* if it is a synthetic or primitive type, we still need the current tag */
buf_append(&state.decode_fns, "\t\tif(keep_tag(ASN1TAGCLASS_%s))\n", item->name);
buf_append(&state.decode_fns, "\t\t{\n");
buf_append(&state.decode_fns, "\t\t\tfseek(der, pretag, SEEK_SET);\n");
@@ -917,9 +917,9 @@
{
/* is_Xxx() */
if(first)
- buf_append(&state.decode_is_fns, "\treturn ");
+ buf_append(&state.decode_is_fns, "\t\treturn ");
else
- buf_append(&state.decode_is_fns, "\t || ");
+ 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)
@@ -932,7 +932,7 @@
buf_append(&state.decode_fns, "\t\telse ");
first = false;
buf_append(&state.decode_fns, "if(is_%s(tag.class, tag.number))\n\t\t{\n", item->name);
- /* if it is a synthetic or ENUMERATED type, we still need the current tag */
+ /* if it is a synthetic or primitive type, we still need the current tag */
buf_append(&state.decode_fns, "\t\t\tif(keep_tag(ASN1TAGCLASS_%s))\n", item->name);
buf_append(&state.decode_fns, "\t\t\t{\n");
buf_append(&state.decode_fns, "\t\t\t\tfseek(der, pretag, SEEK_SET);\n");
@@ -990,7 +990,7 @@
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, "\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_ENUMERATED);\n");
+ buf_append(&state.decode_is_fns, "\t\treturn MATCH_TAGCLASS(class, number, ASN1TAGCLASS_ENUMERATED);\n");
}
/* must be a CHOICE */
else
@@ -1005,9 +1005,9 @@
{
/* is_Xxx() function */
if(item == state.items)
- buf_append(&state.decode_is_fns, "\treturn ");
+ buf_append(&state.decode_is_fns, "\t\treturn ");
else
- buf_append(&state.decode_is_fns, "\t || ");
+ buf_append(&state.decode_is_fns, "\t\t || ");
buf_append(&state.decode_is_fns, "MATCH_TAGCLASS(class, number, ASN1TAGCLASS_%s)", item->name);
/* is it the last */
if(item->next == NULL)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-10-18 16:20:55
|
Revision: 450
http://redbutton.svn.sourceforge.net/redbutton/?rev=450&view=rev
Author: skilvington
Date: 2007-10-18 09:20:22 -0700 (Thu, 18 Oct 2007)
Log Message:
-----------
use is_Xxx() functions when decoding CHOICE types
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-10-18 16:09:40 UTC (rev 449)
+++ redbutton-author/trunk/ccc.y 2007-10-18 16:20:22 UTC (rev 450)
@@ -1008,7 +1008,7 @@
buf_append(&state.decode_is_fns, "\t\treturn ");
else
buf_append(&state.decode_is_fns, "\t\t || ");
- buf_append(&state.decode_is_fns, "MATCH_TAGCLASS(class, number, ASN1TAGCLASS_%s)", item->name);
+ 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, ";");
@@ -1019,7 +1019,7 @@
else
buf_append(&state.decode_fns, "\telse ");
/* TODO: does GenericObjectReference_direct_reference need a fseek(pretag) */
- buf_append(&state.decode_fns, "if(MATCH_TAGCLASS(tag.class, tag.number, ASN1TAGCLASS_%s))\n\t{\n", item->name);
+ buf_append(&state.decode_fns, "if(is_%s(tag.class, tag.number))\n\t{\n", item->name);
buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= sublen;\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-11-16 17:20:22
|
Revision: 464
http://redbutton.svn.sourceforge.net/redbutton/?rev=464&view=rev
Author: skilvington
Date: 2007-11-16 09:20:21 -0800 (Fri, 16 Nov 2007)
Log Message:
-----------
keep the compiler happy
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-11-16 17:16:23 UTC (rev 463)
+++ redbutton-author/trunk/ccc.y 2007-11-16 17:20:21 UTC (rev 464)
@@ -787,6 +787,7 @@
buf_append(&state.decode_fns, "\tint left = length;\n");
buf_append(&state.decode_fns, "\tint sublen;\n");
buf_append(&state.decode_fns, "\tstruct der_tag tag;\n\n");
+ buf_append(&state.decode_fns, "\t/* keep the compiler happy */\n\ttag = tag;\n\n");
buf_append(&state.decode_fns, "\tverbose(\"<%s>\\n\");\n\n", name);
/* ASN1 is_Xxx() functions */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-11-21 16:46:57
|
Revision: 467
http://redbutton.svn.sourceforge.net/redbutton/?rev=467&view=rev
Author: skilvington
Date: 2007-11-21 08:46:51 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
make the asn1decode.c code more compact
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-11-21 16:27:56 UTC (rev 466)
+++ redbutton-author/trunk/ccc.y 2007-11-21 16:46:51 UTC (rev 467)
@@ -889,14 +889,13 @@
if(keep_tag(asn1tagclass(item->name)))
{
buf_append(&state.decode_fns, "\t\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\t\tsublen = asn1decode_%s(der, out, sublen + tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\tif((sublen = asn1decode_%s(der, out, sublen + tag.length)) < 0)\n", item->name);
}
else
{
buf_append(&state.decode_fns, "\t\t\tleft -= sublen;\n");
- buf_append(&state.decode_fns, "\t\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
}
- buf_append(&state.decode_fns, "\t\t\tif(sublen < 0)\n");
buf_append(&state.decode_fns, "\t\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\t\tleft -= sublen;\n");
buf_append(&state.decode_fns, "\t\t}\n");
@@ -920,14 +919,13 @@
if(keep_tag(asn1tagclass(item->name)))
{
buf_append(&state.decode_fns, "\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, length)) < 0)\n", item->name);
}
else
{
buf_append(&state.decode_fns, "\t\tleft -= sublen;\n");
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
}
- buf_append(&state.decode_fns, "\t\tif(sublen < 0)\n");
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= sublen;\n");
buf_append(&state.decode_fns, "\t}\n");
@@ -982,8 +980,7 @@
if(keep_tag(asn1tagclass(item->name)))
{
buf_append(&state.decode_fns, "\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, sublen + tag.length);\n", item->name);
- buf_append(&state.decode_fns, "\t\tif(sublen < 0)\n");
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, sublen + tag.length)) < 0)\n", item->name);
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= tag.length;\n");
}
@@ -1002,16 +999,14 @@
buf_append(&state.decode_fns, "\t\telse\n");
buf_append(&state.decode_fns, "\t\t{\n");
buf_append(&state.decode_fns, "\t\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
- buf_append(&state.decode_fns, "\t\t\tif(sublen < 0)\n");
+ buf_append(&state.decode_fns, "\t\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
buf_append(&state.decode_fns, "\t\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\t\tleft -= tag.length;\n");
buf_append(&state.decode_fns, "\t\t}\n");
}
else
{
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
- buf_append(&state.decode_fns, "\t\tif(sublen < 0)\n");
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= tag.length;\n");
}
@@ -1078,13 +1073,12 @@
if(keep_tag(asn1tagclass(item->name)))
{
buf_append(&state.decode_fns, "\t\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\t\tsublen = asn1decode_%s(der, out, sublen + tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\tif((sublen = asn1decode_%s(der, out, sublen + tag.length)) < 0)\n", item->name);
}
else
{
- buf_append(&state.decode_fns, "\t\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
}
- buf_append(&state.decode_fns, "\t\t\tif(sublen < 0)\n");
buf_append(&state.decode_fns, "\t\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\t\tleft -= tag.length;\n");
buf_append(&state.decode_fns, "\t\t}\n");
@@ -1191,13 +1185,12 @@
if(keep_tag(asn1tagclass(item->name)))
{
buf_append(&state.decode_fns, "\t\tfseek(der, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, sublen + tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, sublen + tag.length)) < 0)\n", item->name);
}
else
{
- buf_append(&state.decode_fns, "\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\tif((sublen = asn1decode_%s(der, out, tag.length)) < 0)\n", item->name);
}
- buf_append(&state.decode_fns, "\t\tif(sublen < 0)\n");
buf_append(&state.decode_fns, "\t\t\treturn der_error(\"%s\");\n", name);
buf_append(&state.decode_fns, "\t\tleft -= tag.length;\n");
buf_append(&state.decode_fns, "\t}\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-11-29 17:15:32
|
Revision: 469
http://redbutton.svn.sourceforge.net/redbutton/?rev=469&view=rev
Author: skilvington
Date: 2007-11-29 09:15:30 -0800 (Thu, 29 Nov 2007)
Log Message:
-----------
don't need to explicitly deal with this case
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-11-28 17:31:34 UTC (rev 468)
+++ redbutton-author/trunk/ccc.y 2007-11-29 17:15:30 UTC (rev 469)
@@ -826,8 +826,14 @@
/* assert */
if(item->type != IT_IDENTIFIER && item->type != IT_ONEORMORE && item->type != IT_OPTIONAL)
fatal("not IDENTIFIER, ONEORMORE or OPTIONAL");
-/* TODO */
-/* is it OPTIONAL - check if length == 0, if so bomb out now */
+#if 0
+ /* is it OPTIONAL - check if length == 0, if so bomb out now */
+ /*
+ * only thing this effects is TokenManager ::= [MovementTable]
+ * which works without this check (because TokenGroupBody is a SET)
+ */
+ if(item->type == IT_OPTIONAL) printf("TODO: OPTIONAL %s->%s\n", name, item->name);
+#endif
/* is it a primitive type */
if(strcmp(item->name, "BOOLEAN") == 0
|| strcmp(item->name, "INTEGER") == 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|