[Redbutton-devel] SF.net SVN: redbutton: [453] redbutton-author/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-10-25 16:07:06
|
Revision: 453
http://redbutton.svn.sourceforge.net/redbutton/?rev=453&view=rev
Author: skilvington
Date: 2007-10-25 09:06:59 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
mhegd can now correctly decode the helloworld example
Modified Paths:
--------------
redbutton-author/trunk/TODO
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/TODO
===================================================================
--- redbutton-author/trunk/TODO 2007-10-19 16:25:28 UTC (rev 452)
+++ redbutton-author/trunk/TODO 2007-10-25 16:06:59 UTC (rev 453)
@@ -1,3 +1,4 @@
+mhegc
output filename should default to App/Scene GroupIdentifier rather than "a"
(but warn if file exists - stops accidental overwrite of source!)
@@ -3,4 +4,22 @@
---
+mhegd
+HorizontalJustification doesn't work
+EventTypeEnum does
+ie ENUMERATED types without an explicit ENUMERATED tag don't work
+
+---
+
+mhegd
+check NoTokenActionSlots (empty and not empty)
+check MovementTable (empty and not empty)
+
+---
+
+mhegd
+:ContentRef ContentReference keeps the tag as part of the OctetString
+
+---
+
clean up ccc.y
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-10-19 16:25:28 UTC (rev 452)
+++ redbutton-author/trunk/asn1tag.h 2007-10-25 16:06:59 UTC (rev 453)
@@ -754,18 +754,18 @@
#define ASN1TAGCLASS_ContentReference ASN1TAG_SYNTHETIC
/* needed by mhegd */
-#define FIXME 9999
#define ASN1TAGCLASS_InterchangedObject ASN1TAG_SYNTHETIC
#define ASN1TAGCLASS_ActionSlot ASN1TAG_CHOICE
-#define ASN1TAGCLASS_ActionSlotSeq FIXME
+/* TODO: check this, also make sure NoTokenActionSlots are decoded correctly */
+#define ASN1TAGCLASS_ActionSlotSeq ASN1TAGCLASS_SEQUENCE
#define ASN1TAGCLASS_ButtonStyleEnum ASN1TAGCLASS_ENUMERATED
#define ASN1TAGCLASS_Colour ASN1TAG_CHOICE
-#define ASN1TAGCLASS_ContentBody FIXME
+#define ASN1TAGCLASS_ContentBody ASN1TAG_CHOICE
#define ASN1TAGCLASS_DefaultAttribute ASN1TAG_CHOICE
#define ASN1TAGCLASS_ElementaryAction ASN1TAG_CHOICE
#define ASN1TAGCLASS_EventDataBody ASN1TAG_CHOICE
#define ASN1TAGCLASS_EventTypeEnum ASN1TAGCLASS_ENUMERATED
-#define ASN1TAGCLASS_FontBody FIXME
+#define ASN1TAGCLASS_FontBody ASN1TAG_CHOICE
#define ASN1TAGCLASS_GenericBoolean ASN1TAG_CHOICE
#define ASN1TAGCLASS_GenericContentReference ASN1TAG_CHOICE
#define ASN1TAGCLASS_GenericInteger ASN1TAG_CHOICE
@@ -776,18 +776,18 @@
#define ASN1TAGCLASS_JustificationEnum ASN1TAGCLASS_ENUMERATED
#define ASN1TAGCLASS_LineOrientationEnum ASN1TAGCLASS_ENUMERATED
#define ASN1TAGCLASS_OrientationEnum ASN1TAGCLASS_ENUMERATED
-#define ASN1TAGCLASS_OriginalValueBody FIXME
-#define ASN1TAGCLASS_Parameter FIXME
+#define ASN1TAGCLASS_OriginalValueBody ASN1TAG_CHOICE
+#define ASN1TAGCLASS_Parameter ASN1TAG_CHOICE
#define ASN1TAGCLASS_SliderStyleEnum ASN1TAGCLASS_ENUMERATED
#define ASN1TAGCLASS_StartCornerEnum ASN1TAGCLASS_ENUMERATED
#define ASN1TAGCLASS_StorageEnum ASN1TAGCLASS_ENUMERATED
-#define ASN1TAGCLASS_StreamComponent FIXME
+#define ASN1TAGCLASS_StreamComponent ASN1TAG_CHOICE
#define ASN1TAGCLASS_TerminationEnum ASN1TAGCLASS_ENUMERATED
-#define ASN1TAGCLASS_ComparisonValue FIXME
-#define ASN1TAGCLASS_EmulatedEventData FIXME
-#define ASN1TAGCLASS_NewColour FIXME
-#define ASN1TAGCLASS_NewContent FIXME
-#define ASN1TAGCLASS_NewFont FIXME
-#define ASN1TAGCLASS_NewVariableValue FIXME
+#define ASN1TAGCLASS_ComparisonValue ASN1TAG_CHOICE
+#define ASN1TAGCLASS_EmulatedEventData ASN1TAG_CHOICE
+#define ASN1TAGCLASS_NewColour ASN1TAG_CHOICE
+#define ASN1TAGCLASS_NewContent ASN1TAG_CHOICE
+#define ASN1TAGCLASS_NewFont ASN1TAG_CHOICE
+#define ASN1TAGCLASS_NewVariableValue ASN1TAG_CHOICE
#endif /* __ASN1TAG_H__ */
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-10-19 16:25:28 UTC (rev 452)
+++ redbutton-author/trunk/ccc.y 2007-10-25 16:06:59 UTC (rev 453)
@@ -824,49 +824,76 @@
/* assert */
if(item->type != IT_IDENTIFIER && item->type != IT_ONEORMORE && item->type != IT_OPTIONAL)
fatal("not IDENTIFIER, ONEORMORE or OPTIONAL");
-/* is it OPTIONAL - check if length == 0 */
-/* then do the decode as for IDENTIFIER - as below... */
+/* is it OPTIONAL - check if length == 0, if so bomb out now */
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-#if 0
-/* TextContentHook needs it to work this way... */
- /* is it a primitive type => no extra tag to decode */
- if(strcmp(item->name, "BOOLEAN") == 0 || strcmp(item->name, "INTEGER") == 0)
+ /* is it a primitive type */
+ if(strcmp(item->name, "BOOLEAN") == 0
+ || strcmp(item->name, "INTEGER") == 0
+ || strcmp(item->name, "OctetString") == 0)
{
/* assert */
if(item->type != IT_IDENTIFIER)
fatal("Primitive but not Identifier");
- buf_append(&state.decode_fns, "\tder_decode_%s(der, out, length);\n", item->name);
+ /* does it need an extra explicit tag for the primitive type? */
+ buf_append(&state.decode_fns, "\tif(ASN1TAGCLASS_%s != ASN1TAGCLASS_%s)\n", name, item->name);
+ buf_append(&state.decode_fns, "\t{\n");
+ buf_append(&state.decode_fns, "\t\tif((sublen = der_decode_%s(der, out, 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");
+ buf_append(&state.decode_fns, "\t}\n");
+ buf_append(&state.decode_fns, "\telse\n");
}
+ /* is it ONEORMORE - need a while(left > 0) loop */
+ if(item->type == IT_ONEORMORE)
+ {
+ buf_append(&state.decode_fns, "\twhile(left > 0)\n\t{\n");
+ /* decode the item */
+ 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\n");
+ buf_append(&state.decode_fns, "\t\tif(is_%s(tag.class, tag.number))\n\t\t{\n", item->name);
+ /* 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, -sublen, SEEK_CUR);\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\t\telse\n");
+ buf_append(&state.decode_fns, "\t\t{\n\t\t\treturn der_error(\"%s\");\n\t\t}\n", name);
+ buf_append(&state.decode_fns, "\t}\n");
+ }
else
-/* ObjectNumber needs it to work this way... */
-#endif
{
- /* is it ONEORMORE - need a while(left > 0) loop */
- if(item->type == IT_ONEORMORE)
- buf_append(&state.decode_fns, "\t\twhile(left > 0)\n\t{\n");
+ /* the whole length is the sub types value */
+ buf_append(&state.decode_fns, "\t{\n");
/* decode the item */
- buf_append(&state.decode_fns, "\tif((sublen = der_decode_Tag(der, &tag)) < 0)\n");
- 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);
+ 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\tif(is_%s(tag.class, tag.number))\n\t\t{\n", item->name);
/* 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, -sublen, SEEK_CUR);\n");
- buf_append(&state.decode_fns, "\t\t\tasn1decode_%s(der, out, sublen + tag.length);\n", item->name);
- buf_append(&state.decode_fns, "\t\t}\n");
- buf_append(&state.decode_fns, "\t\telse\n");
- buf_append(&state.decode_fns, "\t\t{\n");
- buf_append(&state.decode_fns, "\t\t\tasn1decode_%s(der, out, tag.length);\n", item->name);
- buf_append(&state.decode_fns, "\t\t}\n");
- buf_append(&state.decode_fns, "\t\tleft -= tag.length;\n");
- buf_append(&state.decode_fns, "\t}\n\telse\n");
- buf_append(&state.decode_fns, "\t{\n\t\treturn der_error(\"%s\");\n\t}\n", name);
- /* is it ONEORMORE - need a while(left > 0) loop */
- if(item->type == IT_ONEORMORE)
- buf_append(&state.decode_fns, "\t}\n");
- buf_append(&state.decode_fns, "\n");
+ 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, -sublen, SEEK_CUR);\n");
+ buf_append(&state.decode_fns, "\t\t\t\tsublen = asn1decode_%s(der, out, 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\tleft -= sublen;\n");
+ buf_append(&state.decode_fns, "\t\t\t\tsublen = asn1decode_%s(der, out, tag.length);\n", item->name);
+ buf_append(&state.decode_fns, "\t\t\t}\n");
+ 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\n");
+ buf_append(&state.decode_fns, "\t\t}\n\t\telse\n");
+ buf_append(&state.decode_fns, "\t\t{\n\t\t\treturn der_error(\"%s\");\n\t\t}\n", name);
+ buf_append(&state.decode_fns, "\t}\n");
}
+ buf_append(&state.decode_fns, "\n");
/* is_Xxx() function */
buf_append(&state.decode_is_fns, "\t\treturn is_%s(class, number);\n", item->name);
/* output any literals at the end */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|