redbutton-devel Mailing List for RedButton MHEG Engine (Page 11)
Brought to you by:
skilvington
You can subscribe to this list here.
| 2006 |
Jan
(1) |
Feb
(4) |
Mar
(27) |
Apr
(6) |
May
(46) |
Jun
(45) |
Jul
(7) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(10) |
Dec
(11) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(49) |
Feb
(29) |
Mar
(35) |
Apr
(43) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(58) |
Sep
(66) |
Oct
(27) |
Nov
(15) |
Dec
(1) |
| 2008 |
Jan
(11) |
Feb
|
Mar
(8) |
Apr
|
May
|
Jun
(30) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
(6) |
| 2009 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(5) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(6) |
| 2010 |
Jan
(6) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(4) |
Oct
|
Nov
(11) |
Dec
(4) |
| 2011 |
Jan
|
Feb
(11) |
Mar
(8) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
(2) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ski...@us...> - 2007-09-17 09:09:54
|
Revision: 386
http://redbutton.svn.sourceforge.net/redbutton/?rev=386&view=rev
Author: skilvington
Date: 2007-09-17 02:09:47 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
ignore // comments
Modified Paths:
--------------
redbutton-author/trunk/parser.l.footer
redbutton-author/trunk/parser.l.header
redbutton-author/trunk/tokens.h.header
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-09-16 20:24:33 UTC (rev 385)
+++ redbutton-author/trunk/parser.l.footer 2007-09-17 09:09:47 UTC (rev 386)
@@ -19,6 +19,12 @@
{
token_t tok = yylex();
+ while(tok == COMMENT)
+ {
+ vverbose("peek: skip comment '%s'\n", yytext);
+ tok = yylex();
+ }
+
vverbose("peek: '%s'\n", yytext);
/* return it to the input stream */
@@ -41,6 +47,12 @@
{
token_t tok = yylex();
+ while(tok == COMMENT)
+ {
+ vverbose("next: skip comment '%s'\n", yytext);
+ tok = yylex();
+ }
+
vverbose("next: '%s'\n", yytext);
return tok;
Modified: redbutton-author/trunk/parser.l.header
===================================================================
--- redbutton-author/trunk/parser.l.header 2007-09-16 20:24:33 UTC (rev 385)
+++ redbutton-author/trunk/parser.l.header 2007-09-17 09:09:47 UTC (rev 386)
@@ -8,6 +8,7 @@
extern int yylineno;
%}
%%
+\/\/[^\n\r\f]* return COMMENT;
([-0-9][0-9]*)|(0x[0-9a-f]+) return INTEGER;
true|false return BOOLEAN;
\"((\\\")|[^"])*\" return STRING;
Modified: redbutton-author/trunk/tokens.h.header
===================================================================
--- redbutton-author/trunk/tokens.h.header 2007-09-16 20:24:33 UTC (rev 385)
+++ redbutton-author/trunk/tokens.h.header 2007-09-17 09:09:47 UTC (rev 386)
@@ -1,8 +1,9 @@
#define END_OF_SRC 0 /* must be 0 */
-#define INVALID 1
-#define INTEGER 2
-#define BOOLEAN 3
-#define STRING 4
-#define QPRINTABLE 5
-#define BASE64 6
-#define Null 7
+#define COMMENT 1
+#define INVALID 2
+#define INTEGER 3
+#define BOOLEAN 4
+#define STRING 5
+#define QPRINTABLE 6
+#define BASE64 7
+#define Null 8
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-16 20:24:37
|
Revision: 385
http://redbutton.svn.sourceforge.net/redbutton/?rev=385&view=rev
Author: skilvington
Date: 2007-09-16 13:24:33 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
do a couple by hand so I can see how to automate it
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-16 20:09:47 UTC (rev 384)
+++ redbutton-author/trunk/asn1tag.h 2007-09-16 20:24:33 UTC (rev 385)
@@ -23,6 +23,9 @@
#define ASN1TAG_CHOICE 10001
/* ENUMERATED types are encoded as INTEGERs */
#define ASN1TAG_ENUMERATED 10002
+/* SEQUENCEs and SETs are just used to group their children together */
+#define ASN1TAG_SEQUENCE 10003
+#define ASN1TAG_SET 10004
/* abstract types */
#define ASN1TAGCLASS_Root ASN1TAG_SYNTHETIC
@@ -554,11 +557,11 @@
/* UNIVERSAL ASN1 types in the grammar */
#define ASN1TAGCLASS_JointIsoItuIdentifier ASN1TAGCLASS_INTEGER
#define ASN1TAGCLASS_MHEGStandardIdentifier ASN1TAGCLASS_INTEGER
+#define ASN1TAGCLASS_DirectFont ASN1TAGCLASS_OctetString
+#define ASN1TAGCLASS_IndirectFont ASN1TAG_SYNTHETIC
/* start TODO */
#define ASN1TAG_FIXME 99999
-#define ASN1TAGCLASS_DirectFont ASN1TAG_FIXME
-#define ASN1TAGCLASS_IndirectFont ASN1TAG_FIXME
#define ASN1TAGCLASS_XScene ASN1TAG_FIXME
#define ASN1TAGCLASS_YScene ASN1TAG_FIXME
#define ASN1TAGCLASS_Width ASN1TAG_FIXME
@@ -699,7 +702,7 @@
#define ASN1TAGCLASS_XPosition ASN1TAG_FIXME
#define ASN1TAGCLASS_YPosition ASN1TAG_FIXME
#define ASN1TAGCLASS_ReferencedContent ASN1TAG_FIXME
-#define ASN1TAGCLASS_XYPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_XYPosition ASN1TAG_SEQUENCE
#define ASN1TAGCLASS_Point ASN1TAG_FIXME
#define ASN1TAGCLASS_Rational ASN1TAG_FIXME
#define ASN1TAGCLASS_ExternalReference ASN1TAG_FIXME
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-16 20:09:50
|
Revision: 384
http://redbutton.svn.sourceforge.net/redbutton/?rev=384&view=rev
Author: skilvington
Date: 2007-09-16 13:09:47 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
FontBody is a choice
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-16 09:39:52 UTC (rev 383)
+++ redbutton-author/trunk/asn1tag.h 2007-09-16 20:09:47 UTC (rev 384)
@@ -557,7 +557,6 @@
/* start TODO */
#define ASN1TAG_FIXME 99999
-#define ASN1TAGCLASS_FontBody ASN1TAG_FIXME
#define ASN1TAGCLASS_DirectFont ASN1TAG_FIXME
#define ASN1TAGCLASS_IndirectFont ASN1TAG_FIXME
#define ASN1TAGCLASS_XScene ASN1TAG_FIXME
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-16 09:39:53
|
Revision: 383
http://redbutton.svn.sourceforge.net/redbutton/?rev=383&view=rev
Author: skilvington
Date: 2007-09-16 02:39:52 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
something to think about
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-16 09:36:30 UTC (rev 382)
+++ redbutton-author/trunk/ccc.y 2007-09-16 09:39:52 UTC (rev 383)
@@ -459,6 +459,7 @@
/* assert */
if(state.and_items)
fatal("CHOICE or ENUMERATED type, but and_items set");
+/* TODO: these can probably both be ASN1TAGCLASS_SYNTHETIC */
/* add a child ASN1 object */
if(asn1type(name) == ASN1TYPE_CHOICE)
buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_CHOICE);\n\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-16 09:36:33
|
Revision: 382
http://redbutton.svn.sourceforge.net/redbutton/?rev=382&view=rev
Author: skilvington
Date: 2007-09-16 02:36:30 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
should have left the auto-conversion alone
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-14 16:12:22 UTC (rev 381)
+++ redbutton-author/trunk/asn1tag.h 2007-09-16 09:36:30 UTC (rev 382)
@@ -85,7 +85,7 @@
#define ASN1TAG_BackgroundColour 39
#define ASN1TAG_TextContentHook 40
#define ASN1TAG_TextColour 41
-#define ASN1TAG_FontBody 42
+#define ASN1TAG_Font 42
#define ASN1TAG_FontAttributes 43
#define ASN1TAG_InterchangedProgramContentHook 44
#define ASN1TAG_StreamContentHook 45
@@ -335,7 +335,7 @@
#define ASN1TAGCLASS_BackgroundColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BackgroundColour)
#define ASN1TAGCLASS_TextContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextContentHook)
#define ASN1TAGCLASS_TextColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextColour)
-#define ASN1TAGCLASS_FontBody ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_FontBody)
+#define ASN1TAGCLASS_Font ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Font)
#define ASN1TAGCLASS_FontAttributes ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_FontAttributes)
#define ASN1TAGCLASS_InterchangedProgramContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InterchangedProgramContentHook)
#define ASN1TAGCLASS_StreamContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StreamContentHook)
@@ -557,7 +557,7 @@
/* start TODO */
#define ASN1TAG_FIXME 99999
-#define ASN1TAGCLASS_Font ASN1TAG_FIXME
+#define ASN1TAGCLASS_FontBody ASN1TAG_FIXME
#define ASN1TAGCLASS_DirectFont ASN1TAG_FIXME
#define ASN1TAGCLASS_IndirectFont ASN1TAG_FIXME
#define ASN1TAGCLASS_XScene ASN1TAG_FIXME
@@ -699,11 +699,9 @@
#define ASN1TAGCLASS_AbsoluteColour ASN1TAG_FIXME
#define ASN1TAGCLASS_XPosition ASN1TAG_FIXME
#define ASN1TAGCLASS_YPosition ASN1TAG_FIXME
-/* TODO: need to look at these - have different values in different places */
#define ASN1TAGCLASS_ReferencedContent ASN1TAG_FIXME
#define ASN1TAGCLASS_XYPosition ASN1TAG_FIXME
#define ASN1TAGCLASS_Point ASN1TAG_FIXME
-/* TODO: as above, but only used once */
#define ASN1TAGCLASS_Rational ASN1TAG_FIXME
#define ASN1TAGCLASS_ExternalReference ASN1TAG_FIXME
#define ASN1TAGCLASS_NewReferencedContent ASN1TAG_FIXME
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-14 16:12:24
|
Revision: 381
http://redbutton.svn.sourceforge.net/redbutton/?rev=381&view=rev
Author: skilvington
Date: 2007-09-14 09:12:22 -0700 (Fri, 14 Sep 2007)
Log Message:
-----------
build the whole ASN1 object tree
Modified Paths:
--------------
redbutton-author/trunk/Makefile
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/ccc.y
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.c.header
Added Paths:
-----------
redbutton-author/trunk/asn1tag.c
redbutton-author/trunk/der_encode.c
redbutton-author/trunk/der_encode.h
Modified: redbutton-author/trunk/Makefile
===================================================================
--- redbutton-author/trunk/Makefile 2007-09-14 15:06:29 UTC (rev 380)
+++ redbutton-author/trunk/Makefile 2007-09-14 16:12:22 UTC (rev 381)
@@ -14,6 +14,8 @@
OBJS= mhegc.o \
lex.parser.o \
parser.o \
+ der_encode.o \
+ asn1tag.o \
utils.o
TARDIR=`basename ${PWD}`
Added: redbutton-author/trunk/asn1tag.c
===================================================================
--- redbutton-author/trunk/asn1tag.c (rev 0)
+++ redbutton-author/trunk/asn1tag.c 2007-09-14 16:12:22 UTC (rev 381)
@@ -0,0 +1,17 @@
+/*
+ * asn1tag.c
+ */
+
+#include "asn1tag.h"
+
+char *
+asn1class_name(unsigned int c)
+{
+ if(c == ASN1CLASS_UNIVERSAL) return "UNIVERSAL";
+ if(c == ASN1CLASS_APPLICATION) return "APPLICATION";
+ if(c == ASN1CLASS_CONTEXT) return "CONTEXT";
+ if(c == ASN1CLASS_PRIVATE) return "PRIVATE";
+
+ return "ILLEGAL-ASN1-CLASS-NUMBER";
+}
+
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-14 15:06:29 UTC (rev 380)
+++ redbutton-author/trunk/asn1tag.h 2007-09-14 16:12:22 UTC (rev 381)
@@ -11,6 +11,8 @@
#define ASN1CLASS_CONTEXT 0x80
#define ASN1CLASS_PRIVATE 0xc0
+char *asn1class_name(unsigned int);
+
/*
* a synthetic object created as a result of the grammar definition
* eg TextBody etc
@@ -34,35 +36,13 @@
#define ASN1TAGCLASS_TokenManager ASN1TAG_SYNTHETIC
/* tokens synthesised by the grammar */
+#define ASN1TAGCLASS_ObjectIdentifier ASN1TAG_SYNTHETIC
#define ASN1TAGCLASS_TokenGroupBody ASN1TAG_SYNTHETIC
#define ASN1TAGCLASS_LineArtBody ASN1TAG_SYNTHETIC
#define ASN1TAGCLASS_TextBody ASN1TAG_SYNTHETIC
#define ASN1TAGCLASS_PushButtonBody ASN1TAG_SYNTHETIC
-/* start TODO */
-#define ASN1TAG_FIXME 99999
-/* TODO: need to look at these - have different values in different places */
-#define ASN1TAGCLASS_ReferencedContent ASN1TAG_FIXME
-#define ASN1TAGCLASS_XYPosition ASN1TAG_FIXME
-#define ASN1TAGCLASS_Point ASN1TAG_FIXME
-/* TODO: as above, but only used once */
-#define ASN1TAGCLASS_Rational ASN1TAG_FIXME
-#define ASN1TAGCLASS_ExternalReference ASN1TAG_FIXME
-#define ASN1TAGCLASS_NewReferencedContent ASN1TAG_FIXME
-#define ASN1TAGCLASS_NextScene ASN1TAG_FIXME
-#define ASN1TAGCLASS_TokenGroupItem ASN1TAG_FIXME
-/* TODO: an INTEGER ie class=UNIVERSAL, tag=2 */
-#define ASN1TAGCLASS_Movement ASN1TAG_FIXME
-/* TODO: sequences */
-#define ASN1TAGCLASS_ActionSlots ASN1TAG_FIXME
-#define ASN1TAGCLASS_InVariables ASN1TAG_FIXME
-#define ASN1TAGCLASS_OutVariables ASN1TAG_FIXME
-#define ASN1TAGCLASS_ActionClass ASN1TAG_FIXME
-#define ASN1TAGCLASS_Parameters ASN1TAG_FIXME
-#define ASN1TAGCLASS_PointList ASN1TAG_FIXME
-/* end TODO */
-
-/* ASN1 tags */
+/* ASN1 CONTEXT tag values */
#define ASN1TAG_ApplicationClass 0
#define ASN1TAG_SceneClass 1
#define ASN1TAG_StandardIdentifier 2
@@ -562,5 +542,183 @@
#define ASN1TAGCLASS_GetBitmapDecodeOffset ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetBitmapDecodeOffset)
#define ASN1TAGCLASS_SetSliderParameters ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetSliderParameters)
+/* ASN1 UNIVERSAL tag values */
+#define ASN1TAG_BOOLEAN 1
+#define ASN1TAG_INTEGER 2
+#define ASN1TAG_OctetString 4
+/* and with the class included */
+#define ASN1TAGCLASS_BOOLEAN ((ASN1CLASS_UNIVERSAL << 24) | ASN1TAG_BOOLEAN)
+#define ASN1TAGCLASS_INTEGER ((ASN1CLASS_UNIVERSAL << 24) | ASN1TAG_INTEGER)
+#define ASN1TAGCLASS_OctetString ((ASN1CLASS_UNIVERSAL << 24) | ASN1TAG_OctetString)
+
+/* UNIVERSAL ASN1 types in the grammar */
+#define ASN1TAGCLASS_JointIsoItuIdentifier ASN1TAGCLASS_INTEGER
+#define ASN1TAGCLASS_MHEGStandardIdentifier ASN1TAGCLASS_INTEGER
+
+/* start TODO */
+#define ASN1TAG_FIXME 99999
+#define ASN1TAGCLASS_Font ASN1TAG_FIXME
+#define ASN1TAGCLASS_DirectFont ASN1TAG_FIXME
+#define ASN1TAGCLASS_IndirectFont ASN1TAG_FIXME
+#define ASN1TAGCLASS_XScene ASN1TAG_FIXME
+#define ASN1TAGCLASS_YScene ASN1TAG_FIXME
+#define ASN1TAGCLASS_Width ASN1TAG_FIXME
+#define ASN1TAGCLASS_Height ASN1TAG_FIXME
+#define ASN1TAGCLASS_SceneRef ASN1TAG_FIXME
+#define ASN1TAGCLASS_SceneWeight ASN1TAG_FIXME
+#define ASN1TAGCLASS_IncludedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_EventSource ASN1TAG_FIXME
+#define ASN1TAGCLASS_EventType ASN1TAG_FIXME
+#define ASN1TAGCLASS_EventData ASN1TAG_FIXME
+#define ASN1TAGCLASS_ObjectReferenceValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_ContentReferenceValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_Presentable ASN1TAG_FIXME
+#define ASN1TAGCLASS_TargetElement ASN1TAG_FIXME
+#define ASN1TAGCLASS_AVisible ASN1TAG_FIXME
+#define ASN1TAGCLASS_Position ASN1TAG_FIXME
+#define ASN1TAGCLASS_OriginalBoxSize ASN1TAG_FIXME
+#define ASN1TAGCLASS_XLength ASN1TAG_FIXME
+#define ASN1TAGCLASS_YLength ASN1TAG_FIXME
+#define ASN1TAGCLASS_OriginalLineStyle ASN1TAG_FIXME
+#define ASN1TAGCLASS_AbsoluteTime ASN1TAG_FIXME
+#define ASN1TAGCLASS_Address ASN1TAG_FIXME
+#define ASN1TAGCLASS_Answer ASN1TAG_FIXME
+#define ASN1TAGCLASS_AppendValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_ArcAngle ASN1TAG_FIXME
+#define ASN1TAGCLASS_AvailabilityStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_CallSucceeded ASN1TAG_FIXME
+#define ASN1TAGCLASS_CellIndex ASN1TAG_FIXME
+#define ASN1TAGCLASS_CloneRefVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_ConnectionTag ASN1TAG_FIXME
+#define ASN1TAGCLASS_Denominator ASN1TAG_FIXME
+#define ASN1TAGCLASS_EllipseHeight ASN1TAG_FIXME
+#define ASN1TAGCLASS_EllipseWidth ASN1TAG_FIXME
+#define ASN1TAGCLASS_EmulatedEventSource ASN1TAG_FIXME
+#define ASN1TAGCLASS_EmulatedEventType ASN1TAG_FIXME
+#define ASN1TAGCLASS_EntryPointVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_ForkSucceeded ASN1TAG_FIXME
+#define ASN1TAGCLASS_Feature ASN1TAG_FIXME
+#define ASN1TAGCLASS_FillColourVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_FirstItemVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_HighlightStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_Index ASN1TAG_FIXME
+#define ASN1TAGCLASS_InFileName ASN1TAG_FIXME
+#define ASN1TAGCLASS_InteractionStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_ItemIndex ASN1TAG_FIXME
+#define ASN1TAGCLASS_ItemRefVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_ItemStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_ItemsToScroll ASN1TAG_FIXME
+#define ASN1TAGCLASS_LabelVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_LastAnchorFiredVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_LineColourVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_LineStyleVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_LineWidthVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_MovementIdentifier ASN1TAG_FIXME
+#define ASN1TAGCLASS_NbOfSteps ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewCachePriority ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewCounterEndPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewCounterPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewCounterValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewCursorShape ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewEntryPoint ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewFirstItem ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewGenericOctetString ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewHighlightStatus ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewIncludedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewInteractionStatus ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewLabel ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewLineStyle ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewLineWidth ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewOverwriteMode ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewPaletteRef ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewPortion ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewSliderValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewSpeed ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewTransparency ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewVolume ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewXPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewYPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_Numerator ASN1TAG_FIXME
+#define ASN1TAGCLASS_OpenSucceeded ASN1TAG_FIXME
+#define ASN1TAGCLASS_Operator ASN1TAG_FIXME
+#define ASN1TAGCLASS_OutFileName ASN1TAG_FIXME
+#define ASN1TAGCLASS_OverwriteModeVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_PortionVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_Protocol ASN1TAG_FIXME
+#define ASN1TAGCLASS_ReadSucceeded ASN1TAG_FIXME
+#define ASN1TAGCLASS_ReferenceVisible ASN1TAG_FIXME
+#define ASN1TAGCLASS_RunningStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_SelectionStatusVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_SizeVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_SliderValueVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_StartAngle ASN1TAG_FIXME
+#define ASN1TAGCLASS_StoreSucceeded ASN1TAG_FIXME
+#define ASN1TAGCLASS_Target ASN1TAG_FIXME
+#define ASN1TAGCLASS_TextContentVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_TextDataVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_TimerID ASN1TAG_FIXME
+#define ASN1TAGCLASS_TimerValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_TokenPositionVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_TransitionEffect ASN1TAG_FIXME
+#define ASN1TAGCLASS_TriggerIdentifier ASN1TAG_FIXME
+#define ASN1TAGCLASS_Value ASN1TAG_FIXME
+#define ASN1TAGCLASS_VisibleReference ASN1TAG_FIXME
+#define ASN1TAGCLASS_VolumeVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_X ASN1TAG_FIXME
+#define ASN1TAGCLASS_X1 ASN1TAG_FIXME
+#define ASN1TAGCLASS_X2 ASN1TAG_FIXME
+#define ASN1TAGCLASS_XBoxSizeVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_XCursor ASN1TAG_FIXME
+#define ASN1TAGCLASS_XNewBoxSize ASN1TAG_FIXME
+#define ASN1TAGCLASS_XOut ASN1TAG_FIXME
+#define ASN1TAGCLASS_XPositionVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_XScale ASN1TAG_FIXME
+#define ASN1TAGCLASS_Y ASN1TAG_FIXME
+#define ASN1TAGCLASS_Y1 ASN1TAG_FIXME
+#define ASN1TAGCLASS_Y2 ASN1TAG_FIXME
+#define ASN1TAGCLASS_YBoxSizeVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_YCursor ASN1TAG_FIXME
+#define ASN1TAGCLASS_YNewBoxSize ASN1TAG_FIXME
+#define ASN1TAGCLASS_YOut ASN1TAG_FIXME
+#define ASN1TAGCLASS_YPositionVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_YScale ASN1TAG_FIXME
+#define ASN1TAGCLASS_XOffsetVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_YOffsetVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewXOffset ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewYOffset ASN1TAG_FIXME
+#define ASN1TAGCLASS_FocusPositionVar ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewFocusPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewMinValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewMaxValue ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewStepSize ASN1TAG_FIXME
+#define ASN1TAGCLASS_InternalReference ASN1TAG_FIXME
+#define ASN1TAGCLASS_GroupIdentifier ASN1TAG_FIXME
+#define ASN1TAGCLASS_ObjectNumber ASN1TAG_FIXME
+#define ASN1TAGCLASS_DirectReference ASN1TAG_FIXME
+#define ASN1TAGCLASS_ColourIndex ASN1TAG_FIXME
+#define ASN1TAGCLASS_AbsoluteColour ASN1TAG_FIXME
+#define ASN1TAGCLASS_XPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_YPosition ASN1TAG_FIXME
+/* TODO: need to look at these - have different values in different places */
+#define ASN1TAGCLASS_ReferencedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_XYPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_Point ASN1TAG_FIXME
+/* TODO: as above, but only used once */
+#define ASN1TAGCLASS_Rational ASN1TAG_FIXME
+#define ASN1TAGCLASS_ExternalReference ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewReferencedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_NextScene ASN1TAG_FIXME
+#define ASN1TAGCLASS_TokenGroupItem ASN1TAG_FIXME
+/* TODO: an INTEGER ie class=UNIVERSAL, tag=2 */
+#define ASN1TAGCLASS_Movement ASN1TAG_FIXME
+/* TODO: sequences */
+#define ASN1TAGCLASS_ActionSlots ASN1TAG_FIXME
+#define ASN1TAGCLASS_InVariables ASN1TAG_FIXME
+#define ASN1TAGCLASS_OutVariables ASN1TAG_FIXME
+#define ASN1TAGCLASS_ActionClass ASN1TAG_FIXME
+#define ASN1TAGCLASS_Parameters ASN1TAG_FIXME
+#define ASN1TAGCLASS_PointList ASN1TAG_FIXME
+/* end TODO */
+
#endif /* __ASN1TAG_H__ */
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-14 15:06:29 UTC (rev 380)
+++ redbutton-author/trunk/ccc.y 2007-09-14 16:12:22 UTC (rev 381)
@@ -389,6 +389,8 @@
/* a single item (not including literals) */
if(nitems == 1)
{
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
/* eat literals at the start */
item = state.items;
while(item && item->type == IT_LITERAL)
@@ -403,11 +405,6 @@
buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
if(item->type == IT_IDENTIFIER)
{
-#if 0
- /* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
- /* read the item */
-#endif
buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
@@ -416,18 +413,12 @@
}
else if(item->type == IT_OPTIONAL)
{
- /* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
- /* read the item */
buf_append(&state.parse_fns, "\t/* [%s] */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
}
else if(item->type == IT_ONEORMORE)
{
- /* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
- /* read the item */
buf_append(&state.parse_fns, "\t/* %s+ */\n", item->name);
buf_append(&state.parse_fns, "\twhile(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t{\n");
@@ -504,6 +495,7 @@
buf_append(&state.parse_enum_fns, "void parse_%s(struct node *parent)\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 name=\\\"\"%s\"\\\" value=%u/>\\n\");\n", item->name, enum_val);
+ buf_append(&state.parse_enum_fns, "\n\tder_encode_INTEGER(&parent->value, &parent->length, %u);\n", enum_val);
buf_append(&state.parse_enum_fns, "\n\treturn;\n}\n\n");
free(tok_name);
enum_val ++;
@@ -557,8 +549,8 @@
while(item && item->type == IT_LITERAL)
{
char *tok_name = unquote(item->name);
- buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
- buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ buf_append(&state.parse_fns, "\n\t/* %s */\n", item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n", tok_name, item->name);
free(tok_name);
item = item->next;
}
Added: redbutton-author/trunk/der_encode.c
===================================================================
--- redbutton-author/trunk/der_encode.c (rev 0)
+++ redbutton-author/trunk/der_encode.c 2007-09-14 16:12:22 UTC (rev 381)
@@ -0,0 +1,38 @@
+/*
+ * der_encode.c
+ */
+
+#include <stdbool.h>
+
+#include "utils.h"
+
+void
+der_encode_BOOLEAN(unsigned char **out, unsigned int *len, bool val)
+{
+ /* assert */
+ if(*out != NULL || *len != 0)
+ fatal("der_encode_BOOLEAN: length already %u", *len);
+
+ return;
+}
+
+void
+der_encode_INTEGER(unsigned char **out, unsigned int *len, int val)
+{
+ /* assert */
+ if(*out != NULL || *len != 0)
+ fatal("der_encode_INTEGER: length already %u", *len);
+
+ return;
+}
+
+void
+der_encode_OctetString(unsigned char **out, unsigned int *len, const char *str)
+{
+ /* assert */
+ if(*out != NULL || *len != 0)
+ fatal("der_encode_OctetString: length already %u", *len);
+
+ return;
+}
+
Added: redbutton-author/trunk/der_encode.h
===================================================================
--- redbutton-author/trunk/der_encode.h (rev 0)
+++ redbutton-author/trunk/der_encode.h 2007-09-14 16:12:22 UTC (rev 381)
@@ -0,0 +1,15 @@
+/*
+ * der_encode.h
+ */
+
+#ifndef __DER_ENCODE_H__
+#define __DER_ENCODE_H__
+
+#include <stdbool.h>
+
+void der_encode_BOOLEAN(unsigned char **, unsigned int *, bool);
+void der_encode_INTEGER(unsigned char **, unsigned int *, int);
+void der_encode_OctetString(unsigned char **, unsigned int *, const char *);
+
+#endif /* __DER_ENCODE_H__ */
+
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-09-14 15:06:29 UTC (rev 380)
+++ redbutton-author/trunk/mhegc.c 2007-09-14 16:12:22 UTC (rev 381)
@@ -27,7 +27,12 @@
#include <strings.h>
#include "parser.h"
+#include "asn1tag.h"
+#include "utils.h"
+void print_node(struct node *, unsigned int);
+void print_indent(unsigned int);
+
void usage(char *);
static int _verbose = 0;
@@ -69,6 +74,16 @@
if(next_token())
parse_error("Unexpected text after InterchangedObject");
+ /* assert */
+ if(asn1obj.siblings != NULL)
+ fatal("Top level object has siblings");
+
+ if(_verbose)
+ {
+ verbose("\nASN1 object tree:\n");
+ print_node(&asn1obj, 0);
+ }
+
return EXIT_SUCCESS;
}
@@ -77,6 +92,39 @@
*/
void
+print_node(struct node *n, unsigned int indent)
+{
+ struct node *kid;
+
+ print_indent(indent);
+ fprintf(stderr, "[%s %d]\n", asn1class_name(n->asn1class), n->asn1tag);
+
+ if(n->children)
+ {
+ print_indent(indent);
+ fprintf(stderr, "{\n");
+ for(kid=n->children; kid; kid=kid->siblings)
+ print_node(kid, indent + 1);
+ print_indent(indent);
+ fprintf(stderr, "}\n");
+ }
+
+ return;
+}
+
+void
+print_indent(unsigned int indent)
+{
+ while(indent > 0)
+ {
+ fprintf(stderr, " ");
+ indent --;
+ }
+
+ return;
+}
+
+void
verbose(const char *fmt, ...)
{
va_list ap;
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-09-14 15:06:29 UTC (rev 380)
+++ redbutton-author/trunk/parser.c.header 2007-09-14 16:12:22 UTC (rev 381)
@@ -1,7 +1,9 @@
#include <stdio.h>
+#include <string.h>
#include "parser.h"
#include "tokens.h"
+#include "der_encode.h"
#include "utils.h"
/*
@@ -60,27 +62,31 @@
* parser functions for the predefined types
*/
-void parse_INTEGER(struct node *parent)
+void parse_BOOLEAN(struct node *parent)
{
- if(next_token() != INTEGER)
- parse_error("Unexpected token '%s'; expecting an integer", token_text());
+ if(next_token() != BOOLEAN)
+ parse_error("Unexpected token '%s'; expecting 'true' or 'false'", token_text());
- verbose("<INTEGER value=%s/>\n", token_text());
+ verbose("<BOOLEAN value=%s/>\n", token_text());
+ der_encode_BOOLEAN(&parent->value, &parent->length, strcmp(token_text(), "false"));
+
return;
}
-void parse_BOOLEAN(struct node *parent)
+
+void parse_INTEGER(struct node *parent)
{
- if(next_token() != BOOLEAN)
- parse_error("Unexpected token '%s'; expecting 'true' or 'false'", token_text());
+ if(next_token() != INTEGER)
+ parse_error("Unexpected token '%s'; expecting an integer", token_text());
- verbose("<BOOLEAN value=%s/>\n", token_text());
+ verbose("<INTEGER value=%s/>\n", token_text());
+ der_encode_INTEGER(&parent->value, &parent->length, strtol(token_text(), NULL, 0));
+
return;
}
-
void parse_STRING(struct node *parent)
{
if(next_token() != STRING)
@@ -88,6 +94,8 @@
verbose("<STRING value=%s/>\n", token_text());
+ der_encode_OctetString(&parent->value, &parent->length, token_text());
+
return;
}
@@ -99,6 +107,8 @@
verbose("<QPRINTABLE value=%s/>\n", token_text());
+ der_encode_OctetString(&parent->value, &parent->length, token_text());
+
return;
}
@@ -110,6 +120,8 @@
verbose("<BASE64 value=%s/>\n", token_text());
+ der_encode_OctetString(&parent->value, &parent->length, token_text());
+
return;
}
@@ -121,6 +133,10 @@
verbose("<Null/>\n");
+ /* assert */
+ if(parent->length != 0)
+ fatal("Null: length=%u", parent->length);
+
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-14 15:06:34
|
Revision: 380
http://redbutton.svn.sourceforge.net/redbutton/?rev=380&view=rev
Author: skilvington
Date: 2007-09-14 08:06:29 -0700 (Fri, 14 Sep 2007)
Log Message:
-----------
combine the tag and the class into a single value for the parser
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/ccc.y
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-13 16:12:21 UTC (rev 379)
+++ redbutton-author/trunk/asn1tag.h 2007-09-14 15:06:29 UTC (rev 380)
@@ -23,43 +23,43 @@
#define ASN1TAG_ENUMERATED 10002
/* abstract types */
-#define ASN1TAG_Group ASN1TAG_SYNTHETIC
-#define ASN1TAG_Ingredient ASN1TAG_SYNTHETIC
-#define ASN1TAG_Program ASN1TAG_SYNTHETIC
-#define ASN1TAG_Variable ASN1TAG_SYNTHETIC
-#define ASN1TAG_Visible ASN1TAG_SYNTHETIC
-#define ASN1TAG_Interactible ASN1TAG_SYNTHETIC
-#define ASN1TAG_Button ASN1TAG_SYNTHETIC
-#define ASN1TAG_TokenManager ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Root ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Group ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Ingredient ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Program ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Variable ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Visible ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Interactible ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_Button ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_TokenManager ASN1TAG_SYNTHETIC
/* tokens synthesised by the grammar */
-#define ASN1TAG_TokenGroupBody ASN1TAG_SYNTHETIC
-#define ASN1TAG_LineArtBody ASN1TAG_SYNTHETIC
-#define ASN1TAG_TextBody ASN1TAG_SYNTHETIC
-#define ASN1TAG_PushButtonBody ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_TokenGroupBody ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_LineArtBody ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_TextBody ASN1TAG_SYNTHETIC
+#define ASN1TAGCLASS_PushButtonBody ASN1TAG_SYNTHETIC
-
/* start TODO */
#define ASN1TAG_FIXME 99999
/* TODO: need to look at these - have different values in different places */
-#define ASN1TAG_ReferencedContent ASN1TAG_FIXME
-#define ASN1TAG_XYPosition ASN1TAG_FIXME
-#define ASN1TAG_Point ASN1TAG_FIXME
+#define ASN1TAGCLASS_ReferencedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_XYPosition ASN1TAG_FIXME
+#define ASN1TAGCLASS_Point ASN1TAG_FIXME
/* TODO: as above, but only used once */
-#define ASN1TAG_Rational ASN1TAG_FIXME
-#define ASN1TAG_ExternalReference ASN1TAG_FIXME
-#define ASN1TAG_NewReferencedContent ASN1TAG_FIXME
-#define ASN1TAG_NextScene ASN1TAG_FIXME
-#define ASN1TAG_TokenGroupItem ASN1TAG_FIXME
+#define ASN1TAGCLASS_Rational ASN1TAG_FIXME
+#define ASN1TAGCLASS_ExternalReference ASN1TAG_FIXME
+#define ASN1TAGCLASS_NewReferencedContent ASN1TAG_FIXME
+#define ASN1TAGCLASS_NextScene ASN1TAG_FIXME
+#define ASN1TAGCLASS_TokenGroupItem ASN1TAG_FIXME
/* TODO: an INTEGER ie class=UNIVERSAL, tag=2 */
-#define ASN1TAG_Movement ASN1TAG_FIXME
+#define ASN1TAGCLASS_Movement ASN1TAG_FIXME
/* TODO: sequences */
-#define ASN1TAG_ActionSlots ASN1TAG_FIXME
-#define ASN1TAG_InVariables ASN1TAG_FIXME
-#define ASN1TAG_OutVariables ASN1TAG_FIXME
-#define ASN1TAG_ActionClass ASN1TAG_FIXME
-#define ASN1TAG_Parameters ASN1TAG_FIXME
-#define ASN1TAG_PointList ASN1TAG_FIXME
+#define ASN1TAGCLASS_ActionSlots ASN1TAG_FIXME
+#define ASN1TAGCLASS_InVariables ASN1TAG_FIXME
+#define ASN1TAGCLASS_OutVariables ASN1TAG_FIXME
+#define ASN1TAGCLASS_ActionClass ASN1TAG_FIXME
+#define ASN1TAGCLASS_Parameters ASN1TAG_FIXME
+#define ASN1TAGCLASS_PointList ASN1TAG_FIXME
/* end TODO */
/* ASN1 tags */
@@ -156,7 +156,7 @@
#define ASN1TAG_TextWrapping 91
#define ASN1TAG_Multiplex 92
#define ASN1TAG_Storage 93
-// TODO 94
+#define ASN1TAG_Looping 94
#define ASN1TAG_AudioClass 95
#define ASN1TAG_VideoClass 96
#define ASN1TAG_RTGraphicsClass 97
@@ -298,7 +298,7 @@
#define ASN1TAG_NewFontReference 233
#define ASN1TAG_NewContentSize 234
#define ASN1TAG_NewContentCachePriority 235
-// TODO 236
+#define ASN1TAG_IndirectReference 236
#define ASN1TAG_SetBackgroundColour 237
#define ASN1TAG_SetCellPosition 238
#define ASN1TAG_SetInputReg 239
@@ -312,5 +312,255 @@
#define ASN1TAG_GetBitmapDecodeOffset 247
#define ASN1TAG_SetSliderParameters 248
+/* tag and class in a single value */
+#define ASN1TAGCLASS_ApplicationClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ApplicationClass)
+#define ASN1TAGCLASS_SceneClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SceneClass)
+#define ASN1TAGCLASS_StandardIdentifier ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StandardIdentifier)
+#define ASN1TAGCLASS_StandardVersion ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StandardVersion)
+#define ASN1TAGCLASS_ObjectInformation ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ObjectInformation)
+#define ASN1TAGCLASS_OnStartUp ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OnStartUp)
+#define ASN1TAGCLASS_OnCloseDown ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OnCloseDown)
+#define ASN1TAGCLASS_OriginalGroupCachePriority ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalGroupCachePriority)
+#define ASN1TAGCLASS_Items ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Items)
+#define ASN1TAGCLASS_ResidentProgramClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ResidentProgramClass)
+#define ASN1TAGCLASS_RemoteProgramClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_RemoteProgramClass)
+#define ASN1TAGCLASS_InterchangedProgramClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InterchangedProgramClass)
+#define ASN1TAGCLASS_PaletteClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_PaletteClass)
+#define ASN1TAGCLASS_FontClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_FontClass)
+#define ASN1TAGCLASS_CursorShapeClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_CursorShapeClass)
+#define ASN1TAGCLASS_BooleanVariableClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BooleanVariableClass)
+#define ASN1TAGCLASS_IntegerVariableClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_IntegerVariableClass)
+#define ASN1TAGCLASS_OctetStringVariableClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OctetStringVariableClass)
+#define ASN1TAGCLASS_ObjectRefVariableClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ObjectRefVariableClass)
+#define ASN1TAGCLASS_ContentRefVariableClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ContentRefVariableClass)
+#define ASN1TAGCLASS_LinkClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LinkClass)
+#define ASN1TAGCLASS_StreamClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StreamClass)
+#define ASN1TAGCLASS_BitmapClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BitmapClass)
+#define ASN1TAGCLASS_LineArtClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LineArtClass)
+#define ASN1TAGCLASS_DynamicLineArtClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DynamicLineArtClass)
+#define ASN1TAGCLASS_RectangleClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_RectangleClass)
+#define ASN1TAGCLASS_HotspotClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_HotspotClass)
+#define ASN1TAGCLASS_SwitchButtonClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SwitchButtonClass)
+#define ASN1TAGCLASS_PushButtonClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_PushButtonClass)
+#define ASN1TAGCLASS_TextClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextClass)
+#define ASN1TAGCLASS_EntryFieldClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_EntryFieldClass)
+#define ASN1TAGCLASS_HyperTextClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_HyperTextClass)
+#define ASN1TAGCLASS_SliderClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SliderClass)
+#define ASN1TAGCLASS_TokenGroupClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TokenGroupClass)
+#define ASN1TAGCLASS_ListGroupClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ListGroupClass)
+#define ASN1TAGCLASS_OnSpawnCloseDown ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OnSpawnCloseDown)
+#define ASN1TAGCLASS_OnRestart ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OnRestart)
+#define ASN1TAGCLASS_DefaultAttributes ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DefaultAttributes)
+#define ASN1TAGCLASS_CharacterSet ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_CharacterSet)
+#define ASN1TAGCLASS_BackgroundColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BackgroundColour)
+#define ASN1TAGCLASS_TextContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextContentHook)
+#define ASN1TAGCLASS_TextColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextColour)
+#define ASN1TAGCLASS_FontBody ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_FontBody)
+#define ASN1TAGCLASS_FontAttributes ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_FontAttributes)
+#define ASN1TAGCLASS_InterchangedProgramContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InterchangedProgramContentHook)
+#define ASN1TAGCLASS_StreamContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StreamContentHook)
+#define ASN1TAGCLASS_BitmapContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BitmapContentHook)
+#define ASN1TAGCLASS_LineArtContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LineArtContentHook)
+#define ASN1TAGCLASS_ButtonRefColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ButtonRefColour)
+#define ASN1TAGCLASS_HighlightRefColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_HighlightRefColour)
+#define ASN1TAGCLASS_SliderRefColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SliderRefColour)
+#define ASN1TAGCLASS_InputEventRegister ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InputEventRegister)
+#define ASN1TAGCLASS_SceneCoordinateSystem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SceneCoordinateSystem)
+#define ASN1TAGCLASS_AspectRatio ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_AspectRatio)
+#define ASN1TAGCLASS_MovingCursor ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MovingCursor)
+#define ASN1TAGCLASS_NextScenes ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NextScenes)
+#define ASN1TAGCLASS_InitiallyActive ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InitiallyActive)
+#define ASN1TAGCLASS_ContentHook ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ContentHook)
+#define ASN1TAGCLASS_OriginalContent ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalContent)
+#define ASN1TAGCLASS_Shared ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Shared)
+#define ASN1TAGCLASS_ContentSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ContentSize)
+#define ASN1TAGCLASS_ContentCachePriority ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ContentCachePriority)
+#define ASN1TAGCLASS_LinkCondition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LinkCondition)
+#define ASN1TAGCLASS_LinkEffect ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LinkEffect)
+#define ASN1TAGCLASS_Name ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Name)
+#define ASN1TAGCLASS_InitiallyAvailable ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InitiallyAvailable)
+#define ASN1TAGCLASS_ProgramConnectionTag ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ProgramConnectionTag)
+#define ASN1TAGCLASS_OriginalValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalValue)
+#define ASN1TAGCLASS_ObjectReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ObjectReference)
+#define ASN1TAGCLASS_ContentReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ContentReference)
+#define ASN1TAGCLASS_MovementTable ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MovementTable)
+#define ASN1TAGCLASS_TokenGroupItems ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TokenGroupItems)
+#define ASN1TAGCLASS_NoTokenActionSlots ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NoTokenActionSlots)
+#define ASN1TAGCLASS_Positions ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Positions)
+#define ASN1TAGCLASS_WrapAround ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_WrapAround)
+#define ASN1TAGCLASS_MultipleSelection ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MultipleSelection)
+#define ASN1TAGCLASS_BoxSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BoxSize)
+#define ASN1TAGCLASS_OriginalPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalPosition)
+#define ASN1TAGCLASS_OriginalPaletteRef ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalPaletteRef)
+#define ASN1TAGCLASS_Tiling ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Tiling)
+#define ASN1TAGCLASS_OriginalTransparency ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalTransparency)
+#define ASN1TAGCLASS_BorderedBoundingBox ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BorderedBoundingBox)
+#define ASN1TAGCLASS_OriginalLineWidth ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalLineWidth)
+#define ASN1TAGCLASS_OriginalRefLineColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalRefLineColour)
+#define ASN1TAGCLASS_OriginalRefFillColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalRefFillColour)
+#define ASN1TAGCLASS_OriginalFont ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalFont)
+#define ASN1TAGCLASS_HorizontalJustification ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_HorizontalJustification)
+#define ASN1TAGCLASS_VerticalJustification ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_VerticalJustification)
+#define ASN1TAGCLASS_LineOrientation ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LineOrientation)
+#define ASN1TAGCLASS_StartCorner ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StartCorner)
+#define ASN1TAGCLASS_TextWrapping ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TextWrapping)
+#define ASN1TAGCLASS_Multiplex ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Multiplex)
+#define ASN1TAGCLASS_Storage ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Storage)
+#define ASN1TAGCLASS_Looping ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Looping)
+#define ASN1TAGCLASS_AudioClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_AudioClass)
+#define ASN1TAGCLASS_VideoClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_VideoClass)
+#define ASN1TAGCLASS_RTGraphicsClass ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_RTGraphicsClass)
+#define ASN1TAGCLASS_ComponentTag ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ComponentTag)
+#define ASN1TAGCLASS_OriginalVolume ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalVolume)
+#define ASN1TAGCLASS_Termination ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Termination)
+#define ASN1TAGCLASS_EngineResp ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_EngineResp)
+#define ASN1TAGCLASS_Orientation ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Orientation)
+#define ASN1TAGCLASS_MaxValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MaxValue)
+#define ASN1TAGCLASS_MinValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MinValue)
+#define ASN1TAGCLASS_InitialValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InitialValue)
+#define ASN1TAGCLASS_InitialPortion ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InitialPortion)
+#define ASN1TAGCLASS_StepSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StepSize)
+#define ASN1TAGCLASS_SliderStyle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SliderStyle)
+#define ASN1TAGCLASS_InputType ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_InputType)
+#define ASN1TAGCLASS_CharList ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_CharList)
+#define ASN1TAGCLASS_ObscuredInput ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ObscuredInput)
+#define ASN1TAGCLASS_MaxLength ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MaxLength)
+#define ASN1TAGCLASS_OriginalLabel ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OriginalLabel)
+#define ASN1TAGCLASS_ButtonStyle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ButtonStyle)
+#define ASN1TAGCLASS_Activate ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Activate)
+#define ASN1TAGCLASS_Add ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Add)
+#define ASN1TAGCLASS_AddItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_AddItem)
+#define ASN1TAGCLASS_Append ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Append)
+#define ASN1TAGCLASS_BringToFront ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_BringToFront)
+#define ASN1TAGCLASS_Call ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Call)
+#define ASN1TAGCLASS_CallActionSlot ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_CallActionSlot)
+#define ASN1TAGCLASS_Clear ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Clear)
+#define ASN1TAGCLASS_Clone ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Clone)
+#define ASN1TAGCLASS_CloseConnection ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_CloseConnection)
+#define ASN1TAGCLASS_Deactivate ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Deactivate)
+#define ASN1TAGCLASS_DelItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DelItem)
+#define ASN1TAGCLASS_Deselect ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Deselect)
+#define ASN1TAGCLASS_DeselectItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DeselectItem)
+#define ASN1TAGCLASS_Divide ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Divide)
+#define ASN1TAGCLASS_DrawArc ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawArc)
+#define ASN1TAGCLASS_DrawLine ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawLine)
+#define ASN1TAGCLASS_DrawOval ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawOval)
+#define ASN1TAGCLASS_DrawPolygon ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawPolygon)
+#define ASN1TAGCLASS_DrawPolyline ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawPolyline)
+#define ASN1TAGCLASS_DrawRectangle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawRectangle)
+#define ASN1TAGCLASS_DrawSector ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_DrawSector)
+#define ASN1TAGCLASS_Fork ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Fork)
+#define ASN1TAGCLASS_GetAvailabilityStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetAvailabilityStatus)
+#define ASN1TAGCLASS_GetBoxSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetBoxSize)
+#define ASN1TAGCLASS_GetCellItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetCellItem)
+#define ASN1TAGCLASS_GetCursorPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetCursorPosition)
+#define ASN1TAGCLASS_GetEngineSupport ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetEngineSupport)
+#define ASN1TAGCLASS_GetEntryPoint ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetEntryPoint)
+#define ASN1TAGCLASS_GetFillColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetFillColour)
+#define ASN1TAGCLASS_GetFirstItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetFirstItem)
+#define ASN1TAGCLASS_GetHighlightStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetHighlightStatus)
+#define ASN1TAGCLASS_GetInteractionStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetInteractionStatus)
+#define ASN1TAGCLASS_GetItemStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetItemStatus)
+#define ASN1TAGCLASS_GetLabel ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetLabel)
+#define ASN1TAGCLASS_GetLastAnchorFired ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetLastAnchorFired)
+#define ASN1TAGCLASS_GetLineColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetLineColour)
+#define ASN1TAGCLASS_GetLineStyle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetLineStyle)
+#define ASN1TAGCLASS_GetLineWidth ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetLineWidth)
+#define ASN1TAGCLASS_GetListItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetListItem)
+#define ASN1TAGCLASS_GetListSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetListSize)
+#define ASN1TAGCLASS_GetOverwriteMode ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetOverwriteMode)
+#define ASN1TAGCLASS_GetPortion ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetPortion)
+#define ASN1TAGCLASS_GetPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetPosition)
+#define ASN1TAGCLASS_GetRunningStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetRunningStatus)
+#define ASN1TAGCLASS_GetSelectionStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetSelectionStatus)
+#define ASN1TAGCLASS_GetSliderValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetSliderValue)
+#define ASN1TAGCLASS_GetTextContent ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetTextContent)
+#define ASN1TAGCLASS_GetTextData ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetTextData)
+#define ASN1TAGCLASS_GetTokenPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetTokenPosition)
+#define ASN1TAGCLASS_GetVolume ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetVolume)
+#define ASN1TAGCLASS_Launch ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Launch)
+#define ASN1TAGCLASS_LockScreen ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_LockScreen)
+#define ASN1TAGCLASS_Modulo ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Modulo)
+#define ASN1TAGCLASS_Move ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Move)
+#define ASN1TAGCLASS_MoveTo ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_MoveTo)
+#define ASN1TAGCLASS_Multiply ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Multiply)
+#define ASN1TAGCLASS_OpenConnection ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_OpenConnection)
+#define ASN1TAGCLASS_Preload ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Preload)
+#define ASN1TAGCLASS_PutBefore ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_PutBefore)
+#define ASN1TAGCLASS_PutBehind ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_PutBehind)
+#define ASN1TAGCLASS_Quit ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Quit)
+#define ASN1TAGCLASS_ReadPersistent ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ReadPersistent)
+#define ASN1TAGCLASS_Run ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Run)
+#define ASN1TAGCLASS_ScaleBitmap ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ScaleBitmap)
+#define ASN1TAGCLASS_ScaleVideo ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ScaleVideo)
+#define ASN1TAGCLASS_ScrollItems ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ScrollItems)
+#define ASN1TAGCLASS_Select ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Select)
+#define ASN1TAGCLASS_SelectItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SelectItem)
+#define ASN1TAGCLASS_SendEvent ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SendEvent)
+#define ASN1TAGCLASS_SendToBack ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SendToBack)
+#define ASN1TAGCLASS_SetBoxSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetBoxSize)
+#define ASN1TAGCLASS_SetCachePriority ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCachePriority)
+#define ASN1TAGCLASS_SetCounterEndPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCounterEndPosition)
+#define ASN1TAGCLASS_SetCounterPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCounterPosition)
+#define ASN1TAGCLASS_SetCounterTrigger ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCounterTrigger)
+#define ASN1TAGCLASS_SetCursorPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCursorPosition)
+#define ASN1TAGCLASS_SetCursorShape ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCursorShape)
+#define ASN1TAGCLASS_SetData ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetData)
+#define ASN1TAGCLASS_SetEntryPoint ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetEntryPoint)
+#define ASN1TAGCLASS_SetFillColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetFillColour)
+#define ASN1TAGCLASS_SetFirstItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetFirstItem)
+#define ASN1TAGCLASS_SetFontRef ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetFontRef)
+#define ASN1TAGCLASS_SetHighlightStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetHighlightStatus)
+#define ASN1TAGCLASS_SetInteractionStatus ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetInteractionStatus)
+#define ASN1TAGCLASS_SetLabel ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetLabel)
+#define ASN1TAGCLASS_SetLineColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetLineColour)
+#define ASN1TAGCLASS_SetLineStyle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetLineStyle)
+#define ASN1TAGCLASS_SetLineWidth ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetLineWidth)
+#define ASN1TAGCLASS_SetOverwriteMode ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetOverwriteMode)
+#define ASN1TAGCLASS_SetPaletteRef ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetPaletteRef)
+#define ASN1TAGCLASS_SetPortion ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetPortion)
+#define ASN1TAGCLASS_SetPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetPosition)
+#define ASN1TAGCLASS_SetSliderValue ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetSliderValue)
+#define ASN1TAGCLASS_SetSpeed ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetSpeed)
+#define ASN1TAGCLASS_SetTimer ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetTimer)
+#define ASN1TAGCLASS_SetTransparency ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetTransparency)
+#define ASN1TAGCLASS_SetVariable ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetVariable)
+#define ASN1TAGCLASS_SetVolume ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetVolume)
+#define ASN1TAGCLASS_Spawn ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Spawn)
+#define ASN1TAGCLASS_Step ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Step)
+#define ASN1TAGCLASS_Stop ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Stop)
+#define ASN1TAGCLASS_StorePersistent ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_StorePersistent)
+#define ASN1TAGCLASS_Subtract ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Subtract)
+#define ASN1TAGCLASS_TestVariable ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TestVariable)
+#define ASN1TAGCLASS_Toggle ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Toggle)
+#define ASN1TAGCLASS_ToggleItem ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_ToggleItem)
+#define ASN1TAGCLASS_TransitionTo ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_TransitionTo)
+#define ASN1TAGCLASS_Unload ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_Unload)
+#define ASN1TAGCLASS_UnlockScreen ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_UnlockScreen)
+#define ASN1TAGCLASS_NewGenericBoolean ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewGenericBoolean)
+#define ASN1TAGCLASS_NewGenericInteger ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewGenericInteger)
+#define ASN1TAGCLASS_NewGenericOctetstring ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewGenericOctetstring)
+#define ASN1TAGCLASS_NewGenericObjectReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewGenericObjectReference)
+#define ASN1TAGCLASS_NewGenericContentReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewGenericContentReference)
+#define ASN1TAGCLASS_NewColourIndex ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewColourIndex)
+#define ASN1TAGCLASS_NewAbsoluteColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewAbsoluteColour)
+#define ASN1TAGCLASS_NewFontName ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewFontName)
+#define ASN1TAGCLASS_NewFontReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewFontReference)
+#define ASN1TAGCLASS_NewContentSize ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewContentSize)
+#define ASN1TAGCLASS_NewContentCachePriority ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_NewContentCachePriority)
+#define ASN1TAGCLASS_IndirectReference ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_IndirectReference)
+#define ASN1TAGCLASS_SetBackgroundColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetBackgroundColour)
+#define ASN1TAGCLASS_SetCellPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetCellPosition)
+#define ASN1TAGCLASS_SetInputReg ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetInputReg)
+#define ASN1TAGCLASS_SetTextColour ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetTextColour)
+#define ASN1TAGCLASS_SetFontAttributes ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetFontAttributes)
+#define ASN1TAGCLASS_SetVideoDecodeOffset ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetVideoDecodeOffset)
+#define ASN1TAGCLASS_GetVideoDecodeOffset ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetVideoDecodeOffset)
+#define ASN1TAGCLASS_GetFocusPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetFocusPosition)
+#define ASN1TAGCLASS_SetFocusPosition ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetFocusPosition)
+#define ASN1TAGCLASS_SetBitmapDecodeOffset ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetBitmapDecodeOffset)
+#define ASN1TAGCLASS_GetBitmapDecodeOffset ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_GetBitmapDecodeOffset)
+#define ASN1TAGCLASS_SetSliderParameters ((ASN1CLASS_CONTEXT << 24) | ASN1TAG_SetSliderParameters)
+
#endif /* __ASN1TAG_H__ */
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-13 16:12:21 UTC (rev 379)
+++ redbutton-author/trunk/ccc.y 2007-09-14 15:06:29 UTC (rev 380)
@@ -405,7 +405,7 @@
{
#if 0
/* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
/* read the item */
#endif
buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
@@ -417,7 +417,7 @@
else if(item->type == IT_OPTIONAL)
{
/* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
/* read the item */
buf_append(&state.parse_fns, "\t/* [%s] */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
@@ -426,7 +426,7 @@
else if(item->type == IT_ONEORMORE)
{
/* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
/* read the item */
buf_append(&state.parse_fns, "\t/* %s+ */\n", item->name);
buf_append(&state.parse_fns, "\twhile(is_%s(next))\n", item->name);
@@ -470,9 +470,9 @@
fatal("CHOICE or ENUMERATED type, but and_items set");
/* add a child ASN1 object */
if(asn1type(name) == ASN1TYPE_CHOICE)
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_CHOICE, 0);\n\n");
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_CHOICE);\n\n");
else
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_ENUMERATED, 0);\n\n");
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_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");
@@ -523,7 +523,7 @@
if(!state.and_items)
fatal("SET but and_items not set");
/* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
/* eat any literals at the start */
item = state.items;
while(item && item->type == IT_LITERAL)
@@ -569,7 +569,7 @@
if(!state.and_items)
fatal("SEQUENCE but and_items not set");
/* add a child ASN1 object */
- buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAGCLASS_%s);\n\n", name);
buf_append(&state.parse_fns, "\t/* SEQUENCE */\n");
item = state.items;
for(item=state.items; item; item=item->next)
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-09-13 16:12:21 UTC (rev 379)
+++ redbutton-author/trunk/parser.c.header 2007-09-14 15:06:29 UTC (rev 380)
@@ -27,12 +27,13 @@
*/
struct node *
-add_child(struct node *parent, unsigned int asn1tag, unsigned int asn1class)
+add_child(struct node *parent, uint32_t asn1tagclass)
{
struct node *child = safe_malloc(sizeof(struct node));
- child->asn1tag = asn1tag;
- child->asn1class = asn1class;
+ /* class is in the top 8 bits, tag is the bottom 24 bits */
+ child->asn1tag = asn1tagclass & 0xffffff;
+ child->asn1class = (asn1tagclass >> 24) & 0xff;
child->length = 0;
child->value = NULL;
child->children = NULL;
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-13 16:12:21 UTC (rev 379)
+++ redbutton-author/trunk/parser.h.header 2007-09-14 15:06:29 UTC (rev 380)
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdbool.h>
+#include <stdint.h>
#include "asn1tag.h"
@@ -21,7 +22,7 @@
};
/* add a child to a node */
-struct node *add_child(struct node *, unsigned int, unsigned int);
+struct node *add_child(struct node *, uint32_t);
/* lexer token type */
typedef int token_t;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-13 16:12:28
|
Revision: 379
http://redbutton.svn.sourceforge.net/redbutton/?rev=379&view=rev
Author: skilvington
Date: 2007-09-13 09:12:21 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
build more ASN1 types
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-13 13:16:03 UTC (rev 378)
+++ redbutton-author/trunk/asn1tag.h 2007-09-13 16:12:21 UTC (rev 379)
@@ -30,6 +30,7 @@
#define ASN1TAG_Visible ASN1TAG_SYNTHETIC
#define ASN1TAG_Interactible ASN1TAG_SYNTHETIC
#define ASN1TAG_Button ASN1TAG_SYNTHETIC
+#define ASN1TAG_TokenManager ASN1TAG_SYNTHETIC
/* tokens synthesised by the grammar */
#define ASN1TAG_TokenGroupBody ASN1TAG_SYNTHETIC
@@ -37,8 +38,10 @@
#define ASN1TAG_TextBody ASN1TAG_SYNTHETIC
#define ASN1TAG_PushButtonBody ASN1TAG_SYNTHETIC
+
+/* start TODO */
+#define ASN1TAG_FIXME 99999
/* TODO: need to look at these - have different values in different places */
-#define ASN1TAG_FIXME 99999
#define ASN1TAG_ReferencedContent ASN1TAG_FIXME
#define ASN1TAG_XYPosition ASN1TAG_FIXME
#define ASN1TAG_Point ASN1TAG_FIXME
@@ -46,6 +49,18 @@
#define ASN1TAG_Rational ASN1TAG_FIXME
#define ASN1TAG_ExternalReference ASN1TAG_FIXME
#define ASN1TAG_NewReferencedContent ASN1TAG_FIXME
+#define ASN1TAG_NextScene ASN1TAG_FIXME
+#define ASN1TAG_TokenGroupItem ASN1TAG_FIXME
+/* TODO: an INTEGER ie class=UNIVERSAL, tag=2 */
+#define ASN1TAG_Movement ASN1TAG_FIXME
+/* TODO: sequences */
+#define ASN1TAG_ActionSlots ASN1TAG_FIXME
+#define ASN1TAG_InVariables ASN1TAG_FIXME
+#define ASN1TAG_OutVariables ASN1TAG_FIXME
+#define ASN1TAG_ActionClass ASN1TAG_FIXME
+#define ASN1TAG_Parameters ASN1TAG_FIXME
+#define ASN1TAG_PointList ASN1TAG_FIXME
+/* end TODO */
/* ASN1 tags */
#define ASN1TAG_ApplicationClass 0
@@ -56,6 +71,7 @@
#define ASN1TAG_OnStartUp 5
#define ASN1TAG_OnCloseDown 6
#define ASN1TAG_OriginalGroupCachePriority 7
+#define ASN1TAG_Items 8
#define ASN1TAG_ResidentProgramClass 9
#define ASN1TAG_RemoteProgramClass 10
#define ASN1TAG_InterchangedProgramClass 11
@@ -84,6 +100,7 @@
#define ASN1TAG_ListGroupClass 34
#define ASN1TAG_OnSpawnCloseDown 35
#define ASN1TAG_OnRestart 36
+#define ASN1TAG_DefaultAttributes 37
#define ASN1TAG_CharacterSet 38
#define ASN1TAG_BackgroundColour 39
#define ASN1TAG_TextContentHook 40
@@ -101,7 +118,7 @@
#define ASN1TAG_SceneCoordinateSystem 52
#define ASN1TAG_AspectRatio 53
#define ASN1TAG_MovingCursor 54
-#define ASN1TAG_NextScene 55
+#define ASN1TAG_NextScenes 55
#define ASN1TAG_InitiallyActive 56
#define ASN1TAG_ContentHook 57
#define ASN1TAG_OriginalContent 58
@@ -116,10 +133,10 @@
#define ASN1TAG_OriginalValue 67
#define ASN1TAG_ObjectReference 68
#define ASN1TAG_ContentReference 69
-// TODO 70
-#define ASN1TAG_TokenGroupItem 71
-// TODO 72
-// TODO 73
+#define ASN1TAG_MovementTable 70
+#define ASN1TAG_TokenGroupItems 71
+#define ASN1TAG_NoTokenActionSlots 72
+#define ASN1TAG_Positions 73
#define ASN1TAG_WrapAround 74
#define ASN1TAG_MultipleSelection 75
#define ASN1TAG_BoxSize 76
@@ -137,7 +154,7 @@
#define ASN1TAG_LineOrientation 89
#define ASN1TAG_StartCorner 90
#define ASN1TAG_TextWrapping 91
-// TODO 92
+#define ASN1TAG_Multiplex 92
#define ASN1TAG_Storage 93
// TODO 94
#define ASN1TAG_AudioClass 95
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-13 13:16:03 UTC (rev 378)
+++ redbutton-author/trunk/ccc.y 2007-09-13 16:12:21 UTC (rev 379)
@@ -403,6 +403,11 @@
buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
if(item->type == IT_IDENTIFIER)
{
+#if 0
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ /* read the item */
+#endif
buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
@@ -411,12 +416,18 @@
}
else if(item->type == IT_OPTIONAL)
{
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ /* read the item */
buf_append(&state.parse_fns, "\t/* [%s] */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
}
else if(item->type == IT_ONEORMORE)
{
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
+ /* read the item */
buf_append(&state.parse_fns, "\t/* %s+ */\n", item->name);
buf_append(&state.parse_fns, "\twhile(is_%s(next))\n", item->name);
buf_append(&state.parse_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-09-13 13:16:06
|
Revision: 378
http://redbutton.svn.sourceforge.net/redbutton/?rev=378&view=rev
Author: skilvington
Date: 2007-09-13 06:16:03 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
build part of the ASN1 object tree
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-13 11:45:48 UTC (rev 377)
+++ redbutton-author/trunk/asn1tag.h 2007-09-13 13:16:03 UTC (rev 378)
@@ -16,43 +16,72 @@
* eg TextBody etc
* don't output this object, just output its children
*/
-#define ASN1TAG_SYNTHETIC 99999
+#define ASN1TAG_SYNTHETIC 10000
+/* the tag for CHOICE types is determined by which choice we choose */
+#define ASN1TAG_CHOICE 10001
+/* ENUMERATED types are encoded as INTEGERs */
+#define ASN1TAG_ENUMERATED 10002
+/* abstract types */
+#define ASN1TAG_Group ASN1TAG_SYNTHETIC
+#define ASN1TAG_Ingredient ASN1TAG_SYNTHETIC
+#define ASN1TAG_Program ASN1TAG_SYNTHETIC
+#define ASN1TAG_Variable ASN1TAG_SYNTHETIC
+#define ASN1TAG_Visible ASN1TAG_SYNTHETIC
+#define ASN1TAG_Interactible ASN1TAG_SYNTHETIC
+#define ASN1TAG_Button ASN1TAG_SYNTHETIC
+
+/* tokens synthesised by the grammar */
+#define ASN1TAG_TokenGroupBody ASN1TAG_SYNTHETIC
+#define ASN1TAG_LineArtBody ASN1TAG_SYNTHETIC
+#define ASN1TAG_TextBody ASN1TAG_SYNTHETIC
+#define ASN1TAG_PushButtonBody ASN1TAG_SYNTHETIC
+
+/* TODO: need to look at these - have different values in different places */
+#define ASN1TAG_FIXME 99999
+#define ASN1TAG_ReferencedContent ASN1TAG_FIXME
+#define ASN1TAG_XYPosition ASN1TAG_FIXME
+#define ASN1TAG_Point ASN1TAG_FIXME
+/* TODO: as above, but only used once */
+#define ASN1TAG_Rational ASN1TAG_FIXME
+#define ASN1TAG_ExternalReference ASN1TAG_FIXME
+#define ASN1TAG_NewReferencedContent ASN1TAG_FIXME
+
/* ASN1 tags */
-#define ASN1TAG_Application 0
-#define ASN1TAG_Scene 1
+#define ASN1TAG_ApplicationClass 0
+#define ASN1TAG_SceneClass 1
#define ASN1TAG_StandardIdentifier 2
#define ASN1TAG_StandardVersion 3
#define ASN1TAG_ObjectInformation 4
#define ASN1TAG_OnStartUp 5
#define ASN1TAG_OnCloseDown 6
#define ASN1TAG_OriginalGroupCachePriority 7
-#define ASN1TAG_ResidentProgram 9
-#define ASN1TAG_RemoteProgram 10
-#define ASN1TAG_InterchangedProgram 11
-#define ASN1TAG_Palette 12
+#define ASN1TAG_ResidentProgramClass 9
+#define ASN1TAG_RemoteProgramClass 10
+#define ASN1TAG_InterchangedProgramClass 11
+#define ASN1TAG_PaletteClass 12
#define ASN1TAG_FontClass 13
-#define ASN1TAG_CursorShape 14
-#define ASN1TAG_BooleanVariable 15
-#define ASN1TAG_IntegerVariable 16
-#define ASN1TAG_OctetStringVariable 17
-#define ASN1TAG_ObjectRefVariable 18
-#define ASN1TAG_ContentRefVariable 19
-#define ASN1TAG_Link 20
-#define ASN1TAG_Stream 21
-#define ASN1TAG_Bitmap 22
-#define ASN1TAG_LineArt 23
-#define ASN1TAG_DynamicLineArt 24
-#define ASN1TAG_Rectangle 25
-#define ASN1TAG_Hotspot 26
-#define ASN1TAG_SwitchButton 27
-#define ASN1TAG_PushButton 28
-#define ASN1TAG_Text 29
-#define ASN1TAG_EntryField 30
-#define ASN1TAG_HyperText 31
-#define ASN1TAG_Slider 32
-#define ASN1TAG_TokenGroup 33
-#define ASN1TAG_ListGroup 34
+#define ASN1TAG_CursorShapeClass 14
+#define ASN1TAG_BooleanVariableClass 15
+#define ASN1TAG_IntegerVariableClass 16
+#define ASN1TAG_OctetStringVariableClass 17
+#define ASN1TAG_ObjectRefVariableClass 18
+#define ASN1TAG_ContentRefVariableClass 19
+#define ASN1TAG_LinkClass 20
+#define ASN1TAG_StreamClass 21
+#define ASN1TAG_BitmapClass 22
+#define ASN1TAG_LineArtClass 23
+#define ASN1TAG_DynamicLineArtClass 24
+#define ASN1TAG_RectangleClass 25
+#define ASN1TAG_HotspotClass 26
+#define ASN1TAG_SwitchButtonClass 27
+#define ASN1TAG_PushButtonClass 28
+#define ASN1TAG_TextClass 29
+#define ASN1TAG_EntryFieldClass 30
+#define ASN1TAG_HyperTextClass 31
+#define ASN1TAG_SliderClass 32
+#define ASN1TAG_TokenGroupClass 33
+#define ASN1TAG_ListGroupClass 34
#define ASN1TAG_OnSpawnCloseDown 35
#define ASN1TAG_OnRestart 36
#define ASN1TAG_CharacterSet 38
@@ -72,6 +101,7 @@
#define ASN1TAG_SceneCoordinateSystem 52
#define ASN1TAG_AspectRatio 53
#define ASN1TAG_MovingCursor 54
+#define ASN1TAG_NextScene 55
#define ASN1TAG_InitiallyActive 56
#define ASN1TAG_ContentHook 57
#define ASN1TAG_OriginalContent 58
@@ -86,9 +116,13 @@
#define ASN1TAG_OriginalValue 67
#define ASN1TAG_ObjectReference 68
#define ASN1TAG_ContentReference 69
+// TODO 70
+#define ASN1TAG_TokenGroupItem 71
+// TODO 72
+// TODO 73
#define ASN1TAG_WrapAround 74
#define ASN1TAG_MultipleSelection 75
-#define ASN1TAG_OriginalBoxSize 76
+#define ASN1TAG_BoxSize 76
#define ASN1TAG_OriginalPosition 77
#define ASN1TAG_OriginalPaletteRef 78
#define ASN1TAG_Tiling 79
@@ -103,10 +137,12 @@
#define ASN1TAG_LineOrientation 89
#define ASN1TAG_StartCorner 90
#define ASN1TAG_TextWrapping 91
+// TODO 92
#define ASN1TAG_Storage 93
-#define ASN1TAG_Audio 95
-#define ASN1TAG_Video 96
-#define ASN1TAG_Rtgraphics 97
+// TODO 94
+#define ASN1TAG_AudioClass 95
+#define ASN1TAG_VideoClass 96
+#define ASN1TAG_RTGraphicsClass 97
#define ASN1TAG_ComponentTag 98
#define ASN1TAG_OriginalVolume 99
#define ASN1TAG_Termination 100
@@ -245,9 +281,10 @@
#define ASN1TAG_NewFontReference 233
#define ASN1TAG_NewContentSize 234
#define ASN1TAG_NewContentCachePriority 235
+// TODO 236
#define ASN1TAG_SetBackgroundColour 237
#define ASN1TAG_SetCellPosition 238
-#define ASN1TAG_SetInputRegister 239
+#define ASN1TAG_SetInputReg 239
#define ASN1TAG_SetTextColour 240
#define ASN1TAG_SetFontAttributes 241
#define ASN1TAG_SetVideoDecodeOffset 242
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-13 11:45:48 UTC (rev 377)
+++ redbutton-author/trunk/ccc.y 2007-09-13 13:16:03 UTC (rev 378)
@@ -457,6 +457,12 @@
/* assert */
if(state.and_items)
fatal("CHOICE or ENUMERATED type, but and_items set");
+ /* add a child ASN1 object */
+ if(asn1type(name) == ASN1TYPE_CHOICE)
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_CHOICE, 0);\n\n");
+ else
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_ENUMERATED, 0);\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");
/* enum values all start at 1 and are listed in order in the grammar */
@@ -505,6 +511,8 @@
/* assert */
if(!state.and_items)
fatal("SET but and_items not set");
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
/* eat any literals at the start */
item = state.items;
while(item && item->type == IT_LITERAL)
@@ -549,6 +557,8 @@
/* assert */
if(!state.and_items)
fatal("SEQUENCE but and_items not set");
+ /* add a child ASN1 object */
+ buf_append(&state.parse_fns, "\tparent = add_child(parent, ASN1TAG_%s, ASN1CLASS_CONTEXT);\n\n", name);
buf_append(&state.parse_fns, "\t/* SEQUENCE */\n");
item = state.items;
for(item=state.items; item; 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-09-13 11:45:57
|
Revision: 377
http://redbutton.svn.sourceforge.net/redbutton/?rev=377&view=rev
Author: skilvington
Date: 2007-09-13 04:45:48 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
we will need to store the ASN1 tag class after all
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-12 13:17:20 UTC (rev 376)
+++ redbutton-author/trunk/asn1tag.h 2007-09-13 11:45:48 UTC (rev 377)
@@ -5,6 +5,12 @@
#ifndef __ASN1TAG_H__
#define __ASN1TAG_H__
+/* tag classes */
+#define ASN1CLASS_UNIVERSAL 0x00
+#define ASN1CLASS_APPLICATION 0x40
+#define ASN1CLASS_CONTEXT 0x80
+#define ASN1CLASS_PRIVATE 0xc0
+
/*
* a synthetic object created as a result of the grammar definition
* eg TextBody etc
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-09-12 13:17:20 UTC (rev 376)
+++ redbutton-author/trunk/parser.c.header 2007-09-13 11:45:48 UTC (rev 377)
@@ -2,7 +2,12 @@
#include "parser.h"
#include "tokens.h"
+#include "utils.h"
+/*
+ * lexer functions we need to provide
+ */
+
int yylineno = 1;
void
@@ -18,6 +23,39 @@
}
/*
+ * parser helper functions
+ */
+
+struct node *
+add_child(struct node *parent, unsigned int asn1tag, unsigned int asn1class)
+{
+ struct node *child = safe_malloc(sizeof(struct node));
+
+ child->asn1tag = asn1tag;
+ child->asn1class = asn1class;
+ child->length = 0;
+ child->value = NULL;
+ child->children = NULL;
+ child->siblings = NULL;
+
+ /* is it the first */
+ if(parent->children == NULL)
+ {
+ parent->children = child;
+ }
+ else
+ {
+ /* add it to the end of the siblings list */
+ struct node *sib = parent->children;
+ while(sib->siblings != NULL)
+ sib = sib->siblings;
+ sib->siblings = child;
+ }
+
+ return child;
+}
+
+/*
* parser functions for the predefined types
*/
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-12 13:17:20 UTC (rev 376)
+++ redbutton-author/trunk/parser.h.header 2007-09-13 11:45:48 UTC (rev 377)
@@ -11,6 +11,7 @@
{
/* DER type */
unsigned int asn1tag; /* ASN1 tag number */
+ unsigned int asn1class; /* only UNIVERSAL or CONTEXT */
/* DER value */
unsigned int length; /* length of the value data */
unsigned char *value; /* DER encoded value */
@@ -19,9 +20,13 @@
struct node *siblings; /* linked list of children */
};
+/* add a child to a node */
+struct node *add_child(struct node *, unsigned int, unsigned int);
+
/* lexer token type */
typedef int token_t;
+/* lexer functions */
void set_input_file(char *);
token_t peek_token(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-12 13:17:23
|
Revision: 376
http://redbutton.svn.sourceforge.net/redbutton/?rev=376&view=rev
Author: skilvington
Date: 2007-09-12 06:17:20 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
start to use the ASN1 tags
Modified Paths:
--------------
redbutton-author/trunk/asn1tag.h
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h 2007-09-12 13:11:33 UTC (rev 375)
+++ redbutton-author/trunk/asn1tag.h 2007-09-12 13:17:20 UTC (rev 376)
@@ -25,7 +25,7 @@
#define ASN1TAG_RemoteProgram 10
#define ASN1TAG_InterchangedProgram 11
#define ASN1TAG_Palette 12
-#define ASN1TAG_Font 13
+#define ASN1TAG_FontClass 13
#define ASN1TAG_CursorShape 14
#define ASN1TAG_BooleanVariable 15
#define ASN1TAG_IntegerVariable 16
@@ -53,7 +53,7 @@
#define ASN1TAG_BackgroundColour 39
#define ASN1TAG_TextContentHook 40
#define ASN1TAG_TextColour 41
-#define ASN1TAG_Font 42
+#define ASN1TAG_FontBody 42
#define ASN1TAG_FontAttributes 43
#define ASN1TAG_InterchangedProgramContentHook 44
#define ASN1TAG_StreamContentHook 45
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-09-12 13:11:33 UTC (rev 375)
+++ redbutton-author/trunk/mhegc.c 2007-09-12 13:17:20 UTC (rev 376)
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <strings.h>
#include "parser.h"
@@ -61,6 +62,8 @@
else if(optind != argc)
usage(prog_name);
+ bzero(&asn1obj, sizeof(struct node));
+ asn1obj.asn1tag = ASN1TAG_SYNTHETIC;
parse_InterchangedObject(&asn1obj);
if(next_token())
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-12 13:11:33 UTC (rev 375)
+++ redbutton-author/trunk/parser.h.header 2007-09-12 13:17:20 UTC (rev 376)
@@ -4,6 +4,8 @@
#include <stdio.h>
#include <stdbool.h>
+#include "asn1tag.h"
+
/* the parser builds a tree of ASN1 types */
struct node
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-12 13:11:34
|
Revision: 375
http://redbutton.svn.sourceforge.net/redbutton/?rev=375&view=rev
Author: skilvington
Date: 2007-09-12 06:11:33 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
ASN1 tags used in MHEG5 objects
Added Paths:
-----------
redbutton-author/trunk/asn1tag.h
Added: redbutton-author/trunk/asn1tag.h
===================================================================
--- redbutton-author/trunk/asn1tag.h (rev 0)
+++ redbutton-author/trunk/asn1tag.h 2007-09-12 13:11:33 UTC (rev 375)
@@ -0,0 +1,256 @@
+/*
+ * asn1tag.h
+ */
+
+#ifndef __ASN1TAG_H__
+#define __ASN1TAG_H__
+
+/*
+ * a synthetic object created as a result of the grammar definition
+ * eg TextBody etc
+ * don't output this object, just output its children
+ */
+#define ASN1TAG_SYNTHETIC 99999
+
+/* ASN1 tags */
+#define ASN1TAG_Application 0
+#define ASN1TAG_Scene 1
+#define ASN1TAG_StandardIdentifier 2
+#define ASN1TAG_StandardVersion 3
+#define ASN1TAG_ObjectInformation 4
+#define ASN1TAG_OnStartUp 5
+#define ASN1TAG_OnCloseDown 6
+#define ASN1TAG_OriginalGroupCachePriority 7
+#define ASN1TAG_ResidentProgram 9
+#define ASN1TAG_RemoteProgram 10
+#define ASN1TAG_InterchangedProgram 11
+#define ASN1TAG_Palette 12
+#define ASN1TAG_Font 13
+#define ASN1TAG_CursorShape 14
+#define ASN1TAG_BooleanVariable 15
+#define ASN1TAG_IntegerVariable 16
+#define ASN1TAG_OctetStringVariable 17
+#define ASN1TAG_ObjectRefVariable 18
+#define ASN1TAG_ContentRefVariable 19
+#define ASN1TAG_Link 20
+#define ASN1TAG_Stream 21
+#define ASN1TAG_Bitmap 22
+#define ASN1TAG_LineArt 23
+#define ASN1TAG_DynamicLineArt 24
+#define ASN1TAG_Rectangle 25
+#define ASN1TAG_Hotspot 26
+#define ASN1TAG_SwitchButton 27
+#define ASN1TAG_PushButton 28
+#define ASN1TAG_Text 29
+#define ASN1TAG_EntryField 30
+#define ASN1TAG_HyperText 31
+#define ASN1TAG_Slider 32
+#define ASN1TAG_TokenGroup 33
+#define ASN1TAG_ListGroup 34
+#define ASN1TAG_OnSpawnCloseDown 35
+#define ASN1TAG_OnRestart 36
+#define ASN1TAG_CharacterSet 38
+#define ASN1TAG_BackgroundColour 39
+#define ASN1TAG_TextContentHook 40
+#define ASN1TAG_TextColour 41
+#define ASN1TAG_Font 42
+#define ASN1TAG_FontAttributes 43
+#define ASN1TAG_InterchangedProgramContentHook 44
+#define ASN1TAG_StreamContentHook 45
+#define ASN1TAG_BitmapContentHook 46
+#define ASN1TAG_LineArtContentHook 47
+#define ASN1TAG_ButtonRefColour 48
+#define ASN1TAG_HighlightRefColour 49
+#define ASN1TAG_SliderRefColour 50
+#define ASN1TAG_InputEventRegister 51
+#define ASN1TAG_SceneCoordinateSystem 52
+#define ASN1TAG_AspectRatio 53
+#define ASN1TAG_MovingCursor 54
+#define ASN1TAG_InitiallyActive 56
+#define ASN1TAG_ContentHook 57
+#define ASN1TAG_OriginalContent 58
+#define ASN1TAG_Shared 59
+#define ASN1TAG_ContentSize 60
+#define ASN1TAG_ContentCachePriority 61
+#define ASN1TAG_LinkCondition 62
+#define ASN1TAG_LinkEffect 63
+#define ASN1TAG_Name 64
+#define ASN1TAG_InitiallyAvailable 65
+#define ASN1TAG_ProgramConnectionTag 66
+#define ASN1TAG_OriginalValue 67
+#define ASN1TAG_ObjectReference 68
+#define ASN1TAG_ContentReference 69
+#define ASN1TAG_WrapAround 74
+#define ASN1TAG_MultipleSelection 75
+#define ASN1TAG_OriginalBoxSize 76
+#define ASN1TAG_OriginalPosition 77
+#define ASN1TAG_OriginalPaletteRef 78
+#define ASN1TAG_Tiling 79
+#define ASN1TAG_OriginalTransparency 80
+#define ASN1TAG_BorderedBoundingBox 81
+#define ASN1TAG_OriginalLineWidth 82
+#define ASN1TAG_OriginalRefLineColour 84
+#define ASN1TAG_OriginalRefFillColour 85
+#define ASN1TAG_OriginalFont 86
+#define ASN1TAG_HorizontalJustification 87
+#define ASN1TAG_VerticalJustification 88
+#define ASN1TAG_LineOrientation 89
+#define ASN1TAG_StartCorner 90
+#define ASN1TAG_TextWrapping 91
+#define ASN1TAG_Storage 93
+#define ASN1TAG_Audio 95
+#define ASN1TAG_Video 96
+#define ASN1TAG_Rtgraphics 97
+#define ASN1TAG_ComponentTag 98
+#define ASN1TAG_OriginalVolume 99
+#define ASN1TAG_Termination 100
+#define ASN1TAG_EngineResp 101
+#define ASN1TAG_Orientation 102
+#define ASN1TAG_MaxValue 103
+#define ASN1TAG_MinValue 104
+#define ASN1TAG_InitialValue 105
+#define ASN1TAG_InitialPortion 106
+#define ASN1TAG_StepSize 107
+#define ASN1TAG_SliderStyle 108
+#define ASN1TAG_InputType 109
+#define ASN1TAG_CharList 110
+#define ASN1TAG_ObscuredInput 111
+#define ASN1TAG_MaxLength 112
+#define ASN1TAG_OriginalLabel 113
+#define ASN1TAG_ButtonStyle 114
+#define ASN1TAG_Activate 115
+#define ASN1TAG_Add 116
+#define ASN1TAG_AddItem 117
+#define ASN1TAG_Append 118
+#define ASN1TAG_BringToFront 119
+#define ASN1TAG_Call 120
+#define ASN1TAG_CallActionSlot 121
+#define ASN1TAG_Clear 122
+#define ASN1TAG_Clone 123
+#define ASN1TAG_CloseConnection 124
+#define ASN1TAG_Deactivate 125
+#define ASN1TAG_DelItem 126
+#define ASN1TAG_Deselect 127
+#define ASN1TAG_DeselectItem 128
+#define ASN1TAG_Divide 129
+#define ASN1TAG_DrawArc 130
+#define ASN1TAG_DrawLine 131
+#define ASN1TAG_DrawOval 132
+#define ASN1TAG_DrawPolygon 133
+#define ASN1TAG_DrawPolyline 134
+#define ASN1TAG_DrawRectangle 135
+#define ASN1TAG_DrawSector 136
+#define ASN1TAG_Fork 137
+#define ASN1TAG_GetAvailabilityStatus 138
+#define ASN1TAG_GetBoxSize 139
+#define ASN1TAG_GetCellItem 140
+#define ASN1TAG_GetCursorPosition 141
+#define ASN1TAG_GetEngineSupport 142
+#define ASN1TAG_GetEntryPoint 143
+#define ASN1TAG_GetFillColour 144
+#define ASN1TAG_GetFirstItem 145
+#define ASN1TAG_GetHighlightStatus 146
+#define ASN1TAG_GetInteractionStatus 147
+#define ASN1TAG_GetItemStatus 148
+#define ASN1TAG_GetLabel 149
+#define ASN1TAG_GetLastAnchorFired 150
+#define ASN1TAG_GetLineColour 151
+#define ASN1TAG_GetLineStyle 152
+#define ASN1TAG_GetLineWidth 153
+#define ASN1TAG_GetListItem 154
+#define ASN1TAG_GetListSize 155
+#define ASN1TAG_GetOverwriteMode 156
+#define ASN1TAG_GetPortion 157
+#define ASN1TAG_GetPosition 158
+#define ASN1TAG_GetRunningStatus 159
+#define ASN1TAG_GetSelectionStatus 160
+#define ASN1TAG_GetSliderValue 161
+#define ASN1TAG_GetTextContent 162
+#define ASN1TAG_GetTextData 163
+#define ASN1TAG_GetTokenPosition 164
+#define ASN1TAG_GetVolume 165
+#define ASN1TAG_Launch 166
+#define ASN1TAG_LockScreen 167
+#define ASN1TAG_Modulo 168
+#define ASN1TAG_Move 169
+#define ASN1TAG_MoveTo 170
+#define ASN1TAG_Multiply 171
+#define ASN1TAG_OpenConnection 172
+#define ASN1TAG_Preload 173
+#define ASN1TAG_PutBefore 174
+#define ASN1TAG_PutBehind 175
+#define ASN1TAG_Quit 176
+#define ASN1TAG_ReadPersistent 177
+#define ASN1TAG_Run 178
+#define ASN1TAG_ScaleBitmap 179
+#define ASN1TAG_ScaleVideo 180
+#define ASN1TAG_ScrollItems 181
+#define ASN1TAG_Select 182
+#define ASN1TAG_SelectItem 183
+#define ASN1TAG_SendEvent 184
+#define ASN1TAG_SendToBack 185
+#define ASN1TAG_SetBoxSize 186
+#define ASN1TAG_SetCachePriority 187
+#define ASN1TAG_SetCounterEndPosition 188
+#define ASN1TAG_SetCounterPosition 189
+#define ASN1TAG_SetCounterTrigger 190
+#define ASN1TAG_SetCursorPosition 191
+#define ASN1TAG_SetCursorShape 192
+#define ASN1TAG_SetData 193
+#define ASN1TAG_SetEntryPoint 194
+#define ASN1TAG_SetFillColour 195
+#define ASN1TAG_SetFirstItem 196
+#define ASN1TAG_SetFontRef 197
+#define ASN1TAG_SetHighlightStatus 198
+#define ASN1TAG_SetInteractionStatus 199
+#define ASN1TAG_SetLabel 200
+#define ASN1TAG_SetLineColour 201
+#define ASN1TAG_SetLineStyle 202
+#define ASN1TAG_SetLineWidth 203
+#define ASN1TAG_SetOverwriteMode 204
+#define ASN1TAG_SetPaletteRef 205
+#define ASN1TAG_SetPortion 206
+#define ASN1TAG_SetPosition 207
+#define ASN1TAG_SetSliderValue 208
+#define ASN1TAG_SetSpeed 209
+#define ASN1TAG_SetTimer 210
+#define ASN1TAG_SetTransparency 211
+#define ASN1TAG_SetVariable 212
+#define ASN1TAG_SetVolume 213
+#define ASN1TAG_Spawn 214
+#define ASN1TAG_Step 215
+#define ASN1TAG_Stop 216
+#define ASN1TAG_StorePersistent 217
+#define ASN1TAG_Subtract 218
+#define ASN1TAG_TestVariable 219
+#define ASN1TAG_Toggle 220
+#define ASN1TAG_ToggleItem 221
+#define ASN1TAG_TransitionTo 222
+#define ASN1TAG_Unload 223
+#define ASN1TAG_UnlockScreen 224
+#define ASN1TAG_NewGenericBoolean 225
+#define ASN1TAG_NewGenericInteger 226
+#define ASN1TAG_NewGenericOctetstring 227
+#define ASN1TAG_NewGenericObjectReference 228
+#define ASN1TAG_NewGenericContentReference 229
+#define ASN1TAG_NewColourIndex 230
+#define ASN1TAG_NewAbsoluteColour 231
+#define ASN1TAG_NewFontName 232
+#define ASN1TAG_NewFontReference 233
+#define ASN1TAG_NewContentSize 234
+#define ASN1TAG_NewContentCachePriority 235
+#define ASN1TAG_SetBackgroundColour 237
+#define ASN1TAG_SetCellPosition 238
+#define ASN1TAG_SetInputRegister 239
+#define ASN1TAG_SetTextColour 240
+#define ASN1TAG_SetFontAttributes 241
+#define ASN1TAG_SetVideoDecodeOffset 242
+#define ASN1TAG_GetVideoDecodeOffset 243
+#define ASN1TAG_GetFocusPosition 244
+#define ASN1TAG_SetFocusPosition 245
+#define ASN1TAG_SetBitmapDecodeOffset 246
+#define ASN1TAG_GetBitmapDecodeOffset 247
+#define ASN1TAG_SetSliderParameters 248
+
+#endif /* __ASN1TAG_H__ */
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-12 12:52:48
|
Revision: 374
http://redbutton.svn.sourceforge.net/redbutton/?rev=374&view=rev
Author: skilvington
Date: 2007-09-12 05:52:39 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
all our ASN1 objects have CONTEXT tag numbers
Modified Paths:
--------------
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-12 12:47:58 UTC (rev 373)
+++ redbutton-author/trunk/parser.h.header 2007-09-12 12:52:39 UTC (rev 374)
@@ -9,7 +9,6 @@
{
/* DER type */
unsigned int asn1tag; /* ASN1 tag number */
- unsigned int asn1class; /* UNIVERSAL/CONTEXT/etc */
/* DER value */
unsigned int length; /* length of the value data */
unsigned char *value; /* DER encoded value */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-12 12:48:00
|
Revision: 373
http://redbutton.svn.sourceforge.net/redbutton/?rev=373&view=rev
Author: skilvington
Date: 2007-09-12 05:47:58 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
don't rebuild more than we need to
Modified Paths:
--------------
redbutton-author/trunk/Makefile
Modified: redbutton-author/trunk/Makefile
===================================================================
--- redbutton-author/trunk/Makefile 2007-09-10 16:10:10 UTC (rev 372)
+++ redbutton-author/trunk/Makefile 2007-09-12 12:47:58 UTC (rev 373)
@@ -26,11 +26,9 @@
${YACC} -b ccc -d ccc.y
${CC} ${CFLAGS} ${DEFS} -o ccc lex.ccc.c ccc.tab.c asn1type.o
-lex.parser.o parser.o parser.h: parser.l.* parser.c.* parser.h.* tokens.h.* grammar ccc
+lex.parser.c parser.c parser.h: parser.l.* parser.c.* parser.h.* tokens.h.* grammar ccc
cat grammar | ./ccc -l parser.l -p parser.c -h parser.h -t tokens.h
${LEX} -i -t parser.l > lex.parser.c
- ${CC} ${CFLAGS} ${DEFS} -c lex.parser.c
- ${CC} ${CFLAGS} ${DEFS} -c parser.c
.c.o:
${CC} ${CFLAGS} ${DEFS} -c $<
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-10 16:10:11
|
Revision: 372
http://redbutton.svn.sourceforge.net/redbutton/?rev=372&view=rev
Author: skilvington
Date: 2007-09-10 09:10:10 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
build a tree of ASN1 objects
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-10 15:31:01 UTC (rev 371)
+++ redbutton-author/trunk/ccc.y 2007-09-10 16:10:10 UTC (rev 372)
@@ -366,10 +366,10 @@
unsigned int enum_val;
/* prototype for the parse_Xxx function */
- buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
+ buf_append(&state.parse_hdr, "void parse_%s(struct node *);\n", name);
/* C code for the parse_Xxx functions */
- buf_append(&state.parse_fns, "void parse_%s(struct state *state)\n{\n", name);
+ buf_append(&state.parse_fns, "void parse_%s(struct node *parent)\n{\n", name);
buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
buf_append(&state.parse_fns, "\tverbose(\"<%s>\\n\");\n\n", name);
@@ -405,7 +405,7 @@
{
buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
buf_append(&state.parse_fns, "\telse\n");
buf_append(&state.parse_fns, "\t\tparse_error(\"Expecting %s\");\n", item->name);
}
@@ -413,14 +413,14 @@
{
buf_append(&state.parse_fns, "\t/* [%s] */\n", item->name);
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
}
else if(item->type == IT_ONEORMORE)
{
buf_append(&state.parse_fns, "\t/* %s+ */\n", item->name);
buf_append(&state.parse_fns, "\twhile(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t{\n");
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
buf_append(&state.parse_fns, "\t\tnext = peek_token();\n");
buf_append(&state.parse_fns, "\t}\n");
}
@@ -472,7 +472,7 @@
if(item->type == IT_IDENTIFIER)
{
buf_append(&state.parse_fns, "if(is_%s(next))\n", item->name);
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
}
else if(item->type == IT_LITERAL)
{
@@ -481,10 +481,10 @@
if(asn1type(name) != ASN1TYPE_ENUMERATED)
fatal("literal but not enum");
buf_append(&state.parse_fns, "if(is_%s(next))\n", tok_name);
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", tok_name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", tok_name);
/* create a parse_Xxx function for the enum value */
- 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_hdr, "void parse_%s(struct node *);\n", tok_name);
+ buf_append(&state.parse_enum_fns, "void parse_%s(struct node *parent)\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 name=\\\"\"%s\"\\\" value=%u/>\\n\");\n", item->name, enum_val);
buf_append(&state.parse_enum_fns, "\n\treturn;\n}\n\n");
@@ -526,7 +526,7 @@
fatal("SET but not Identifier or Optional");
buf_append(&state.parse_fns, "\t\t/* %s */\n", item->name);
buf_append(&state.parse_fns, "\t\tif(is_%s(next))\n\t\t{\n", item->name);
- buf_append(&state.parse_fns, "\t\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\t\tparse_%s(parent);\n", item->name);
buf_append(&state.parse_fns, "\t\t\tcontinue;\n\t\t}\n");
item = item->next;
}
@@ -568,7 +568,7 @@
{
buf_append(&state.parse_fns, "\tnext = peek_token();\n");
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
- buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
+ buf_append(&state.parse_fns, "\t\tparse_%s(parent);\n", item->name);
if(item->type != IT_OPTIONAL)
{
buf_append(&state.parse_fns, "\telse\n");
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-09-10 15:31:01 UTC (rev 371)
+++ redbutton-author/trunk/mhegc.c 2007-09-10 16:10:10 UTC (rev 372)
@@ -36,7 +36,7 @@
{
char *prog_name = argv[0];
int arg;
- struct state state;
+ struct node asn1obj;
while((arg = getopt(argc, argv, "v")) != EOF)
{
@@ -61,7 +61,7 @@
else if(optind != argc)
usage(prog_name);
- parse_InterchangedObject(&state);
+ parse_InterchangedObject(&asn1obj);
if(next_token())
parse_error("Unexpected text after InterchangedObject");
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-09-10 15:31:01 UTC (rev 371)
+++ redbutton-author/trunk/parser.c.header 2007-09-10 16:10:10 UTC (rev 372)
@@ -21,20 +21,20 @@
* parser functions for the predefined types
*/
-void parse_INTEGER(struct state *state)
+void parse_INTEGER(struct node *parent)
{
if(next_token() != INTEGER)
- yyerror("Expecting INTEGER");
+ parse_error("Unexpected token '%s'; expecting an integer", token_text());
verbose("<INTEGER value=%s/>\n", token_text());
return;
}
-void parse_BOOLEAN(struct state *state)
+void parse_BOOLEAN(struct node *parent)
{
if(next_token() != BOOLEAN)
- yyerror("Expecting BOOLEAN");
+ parse_error("Unexpected token '%s'; expecting 'true' or 'false'", token_text());
verbose("<BOOLEAN value=%s/>\n", token_text());
@@ -42,10 +42,10 @@
}
-void parse_STRING(struct state *state)
+void parse_STRING(struct node *parent)
{
if(next_token() != STRING)
- yyerror("Expecting STRING");
+ parse_error("Unexpected token '%s'; expecting \"STRING\"", token_text());
verbose("<STRING value=%s/>\n", token_text());
@@ -53,10 +53,10 @@
}
-void parse_QPRINTABLE(struct state *state)
+void parse_QPRINTABLE(struct node *parent)
{
if(next_token() != QPRINTABLE)
- yyerror("Expecting QPRINTABLE");
+ parse_error("Unexpected token '%s'; expecting 'QPRINTABLE'", token_text());
verbose("<QPRINTABLE value=%s/>\n", token_text());
@@ -64,10 +64,10 @@
}
-void parse_BASE64(struct state *state)
+void parse_BASE64(struct node *parent)
{
if(next_token() != BASE64)
- yyerror("Expecting BASE64");
+ parse_error("Unexpected token '%s'; expecting `BASE64`", token_text());
verbose("<BASE64 value=%s/>\n", token_text());
@@ -75,10 +75,10 @@
}
-void parse_Null(struct state *state)
+void parse_Null(struct node *parent)
{
if(next_token() != Null)
- yyerror("Expecting Null");
+ parse_error("Unexpected token '%s'; expecting 'Null'", token_text());
verbose("<Null/>\n");
@@ -88,3 +88,4 @@
/*
* auto-generated parser functions follow
*/
+
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-10 15:31:01 UTC (rev 371)
+++ redbutton-author/trunk/parser.h.header 2007-09-10 16:10:10 UTC (rev 372)
@@ -4,7 +4,21 @@
#include <stdio.h>
#include <stdbool.h>
-struct state { int dummy; };
+/* the parser builds a tree of ASN1 types */
+struct node
+{
+ /* DER type */
+ unsigned int asn1tag; /* ASN1 tag number */
+ unsigned int asn1class; /* UNIVERSAL/CONTEXT/etc */
+ /* DER value */
+ unsigned int length; /* length of the value data */
+ unsigned char *value; /* DER encoded value */
+ /* a tree of nodes */
+ struct node *children; /* NULL if not a constructed type */
+ struct node *siblings; /* linked list of children */
+};
+
+/* lexer token type */
typedef int token_t;
void set_input_file(char *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-10 15:31:11
|
Revision: 371
http://redbutton.svn.sourceforge.net/redbutton/?rev=371&view=rev
Author: skilvington
Date: 2007-09-10 08:31:01 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
print the unexpected token in error messages
Modified Paths:
--------------
redbutton-author/trunk/parser.l.footer
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-09-10 08:44:58 UTC (rev 370)
+++ redbutton-author/trunk/parser.l.footer 2007-09-10 15:31:01 UTC (rev 371)
@@ -31,7 +31,7 @@
expect_token(token_t tok, char *name)
{
if(next_token() != tok)
- parse_error("Unexpected token; expecting '%s'", name);
+ parse_error("Unexpected token '%s'; expecting '%s'", token_text(), name);
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-09-10 08:45:01
|
Revision: 370
http://redbutton.svn.sourceforge.net/redbutton/?rev=370&view=rev
Author: skilvington
Date: 2007-09-10 01:44:58 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
print the real names of enums, not the names of their lex tokens
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-09-08 17:32:26 UTC (rev 369)
+++ redbutton-author/trunk/ccc.y 2007-09-10 08:44:58 UTC (rev 370)
@@ -486,7 +486,7 @@
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 name=%s value=%u/>\\n\");\n", tok_name, enum_val);
+ buf_append(&state.parse_enum_fns, "\n\tverbose(\"<ENUM name=\\\"\"%s\"\\\" value=%u/>\\n\");\n", item->name, enum_val);
buf_append(&state.parse_enum_fns, "\n\treturn;\n}\n\n");
free(tok_name);
enum_val ++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <ski...@us...> - 2007-08-31 16:09:34
|
Revision: 367
http://redbutton.svn.sourceforge.net/redbutton/?rev=367&view=rev
Author: skilvington
Date: 2007-08-31 07:29:38 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
tidy up the comments now it's all settled down a bit
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-31 13:56:33 UTC (rev 366)
+++ redbutton-author/trunk/ccc.y 2007-08-31 14:29:38 UTC (rev 367)
@@ -36,7 +36,7 @@
char *name;
};
-/* build up the separate parts of the output file in these buffers */
+/* build up the separate parts of the output files in these buffers */
struct buf
{
char *str; /* the buffer */
@@ -50,13 +50,13 @@
struct item *items; /* NULL => start a new identifier */
bool and_items; /* true => identifier must contain all items */
struct buf lexer; /* lex output file */
- struct str_list *tokens; /* "%token" section of the yacc output file */
+ struct str_list *tokens; /* tokens returned by the lexer */
struct buf parse_fns; /* parse_Xxx() C functions for the parser */
- struct buf parse_enum_fns; /* parse_Xxx() functions for enum values */
+ struct buf parse_enum_fns; /* parse_Xxx() C functions for enum values */
struct buf is_fns; /* is_Xxx() C functions for the parser */
struct buf parse_hdr; /* parse_Xxx() prototypes for the parser */
struct buf parse_enum_hdr; /* parse_Xxx() prototypes for enum values */
- struct buf is_hdr; /* is_Xxx() C prototypes for the parser */
+ struct buf is_hdr; /* is_Xxx() prototypes for the parser */
} state;
/* header for files we generate */
@@ -296,7 +296,7 @@
snprintf(header, sizeof(header), "%s.header", tokens_name);
file_append(tokens_file, header);
/* output our stuff */
- tok_val = 256;
+ tok_val = 256; // just needs to be larger than the last one in tokens.h.header
for(t=state.tokens; t; t=t->next)
fprintf(tokens_file, "#define %s\t%u\n", t->name, tok_val++);
/* output the footer if there is one */
@@ -333,13 +333,13 @@
if(new_item == NULL || name == NULL)
fatal("Out of memory");
+ /* find the end of the list */
if(state.items == NULL)
{
state.items = new_item;
}
else
{
- /* find the end of the list */
struct item *i = state.items;
while(i->next)
i = i->next;
@@ -364,11 +364,14 @@
struct item *next;
unsigned int nitems;
+ /* prototype for the parse_Xxx function */
+ buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
+
/* C code for the parse_Xxx functions */
- buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
buf_append(&state.parse_fns, "void parse_%s(struct state *state)\n{\n", name);
buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
buf_append(&state.parse_fns, "\tverbose(\"<%s>\\n\");\n\n", name);
+
/* count how many items make it up */
nitems = 0;
/* skip literals at the start */
@@ -381,8 +384,11 @@
nitems ++;
item = item->next;
}
+
+ /* a single item (not including literals) */
if(nitems == 1)
{
+ /* eat literals at the start */
item = state.items;
while(item && item->type == IT_LITERAL)
{
@@ -392,6 +398,7 @@
free(tok_name);
item = item->next;
}
+ /* see if the next token is what we are expecting */
buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
if(item->type == IT_IDENTIFIER)
{
@@ -418,8 +425,10 @@
}
else
{
+ /* assert */
fatal("nitems==1 but not Identifier/[Identifier]/Identifier+");
}
+ /* eat literals at the end */
item = item->next;
while(item)
{
@@ -430,8 +439,16 @@
item = item->next;
}
}
+ /* more than one item (not including literals) */
else
{
+ /*
+ * do we need to pick one item, or do we need them all?
+ * ie are we building a CHOICE/ENUMERATED or a SET/SEQUENCE type
+ * does the order in which the items appear matter?
+ * ie are we building an ordered (SEQUENCE) or unordered (SET) type
+ */
+/* TODO: could probably just check and_items rather than doing asn1type() now we know the grammar is consistent */
switch(asn1type(name))
{
case ASN1TYPE_CHOICE:
@@ -457,11 +474,12 @@
else if(item->type == IT_LITERAL)
{
char *tok_name = unquote(item->name);
+ /* assert */
+ if(asn1type(name) != ASN1TYPE_ENUMERATED)
+ fatal("literal but not enum");
buf_append(&state.parse_fns, "if(is_%s(next))\n", tok_name);
buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", tok_name);
/* create a parse_Xxx function for the enum value */
- if(asn1type(name) != ASN1TYPE_ENUMERATED)
- fatal("literal but not enum");
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);
@@ -471,6 +489,7 @@
}
else
{
+ /* assert */
fatal("CHOICE/ENUMERATED but not Identifier or Literal");
}
}
@@ -482,6 +501,7 @@
/* assert */
if(!state.and_items)
fatal("SET but and_items not set");
+ /* eat any literals at the start */
item = state.items;
while(item && item->type == IT_LITERAL)
{
@@ -491,11 +511,13 @@
free(tok_name);
item = item->next;
}
+ /* keep parsing items until we get one that should not be in the SET */
buf_append(&state.parse_fns, "\t/* SET */\n");
buf_append(&state.parse_fns, "\twhile(true)\n\t{\n");
buf_append(&state.parse_fns, "\t\tnext = peek_token();\n");
while(item && item->type != IT_LITERAL)
{
+ /* assert */
if(item->type != IT_IDENTIFIER && item->type != IT_OPTIONAL)
fatal("SET but not Identifier or Optional");
buf_append(&state.parse_fns, "\t\t/* %s */\n", item->name);
@@ -527,8 +549,10 @@
item = state.items;
for(item=state.items; item; item=item->next)
{
+ /* assert */
if(item->type != IT_IDENTIFIER && item->type != IT_LITERAL && item->type != IT_OPTIONAL)
fatal("SEQUENCE but not Identifier, Literal or Optional");
+ /* eat literals, parse [optional] identifiers */
buf_append(&state.parse_fns, "\n\t/* %s */\n", item->name);
if(item->type == IT_LITERAL)
{
@@ -551,6 +575,7 @@
break;
default:
+ /* assert */
fatal("Illegal ASN1TYPE");
break;
}
@@ -558,22 +583,40 @@
buf_append(&state.parse_fns, "\n\tverbose(\"</%s>\\n\");\n", name);
buf_append(&state.parse_fns, "\n\treturn;\n}\n\n");
+ /*
+ * generate the is_Xxx(token_t) functions
+ * these functions should return true if the given token can be the first token for this type
+ * for unordered types (SET/CHOICE/ENUMERATED) check if any of the items match the token
+ * for ordered types (SEQUENCE) check if the first item matches the token
+ */
+
+ /* prototype for the is_Xxx functions */
+ buf_append(&state.is_hdr, "bool is_%s(token_t);\n", name);
+
/* C code for the is_Xxx functions */
- buf_append(&state.is_hdr, "bool is_%s(token_t);\n", name);
buf_append(&state.is_fns, "bool is_%s(token_t tok)\n{\n", name);
+
+ /* count the number of items */
nitems = 0;
for(item=state.items; item; item=item->next)
nitems ++;
+
+ /*
+ * for single items (or ones that start with a literal) the token must match the first item
+ * unless it's an ENUMERATED type,
+ * in which case all items are literals and the token can match any of them
+ */
if(nitems == 1
|| state.items->type == IT_LITERAL)
{
- /* if it is an enum, check if any item matches the token */
+ /* if it is an enum, check if any of the enum items match the token */
bool is_enum = true;
for(item=state.items; item && is_enum; item=item->next)
is_enum = is_enum && (item->type == IT_LITERAL);
item = state.items;
if(is_enum)
{
+ /* assert */
if(asn1type(name) != ASN1TYPE_ENUMERATED)
fatal("is_enum but not ENUMERATED");
buf_append(&state.is_fns, "\treturn ");
@@ -590,7 +633,7 @@
item = item->next;
}
}
- /* just check if the first item matches the token */
+ /* not an enum, just check if the first item matches the token */
else if(item->type == IT_LITERAL)
{
char *tok_name = unquote(item->name);
@@ -606,13 +649,15 @@
{
switch(asn1type(name))
{
+/* TODO: we have taken care of ENUMERATED above */
+ case ASN1TYPE_ENUMERATED:
case ASN1TYPE_CHOICE:
- case ASN1TYPE_ENUMERATED:
case ASN1TYPE_SET:
/* check if any of the items match the token */
buf_append(&state.is_fns, "\treturn ");
for(item=state.items; item; item=item->next)
{
+ /* assert */
if(item->type != IT_IDENTIFIER && item->type != IT_OPTIONAL)
fatal("is_fns: expecting Identifier or [Identifier]");
buf_append(&state.is_fns, "is_%s(tok)", item->name);
@@ -639,11 +684,13 @@
}
else
{
+ /* assert */
fatal("SEQUENCE but first item not Literal or Identifier");
}
break;
default:
+ /* assert */
fatal("Illegal ASN1TYPE");
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 14:56:28
|
Revision: 368
http://redbutton.svn.sourceforge.net/redbutton/?rev=368&view=rev
Author: skilvington
Date: 2007-08-31 07:56:23 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
don't have to cat input files into mhegc anymore
Modified Paths:
--------------
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.h.header
redbutton-author/trunk/parser.l.footer
redbutton-author/trunk/parser.l.header
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-08-31 14:29:38 UTC (rev 367)
+++ redbutton-author/trunk/mhegc.c 2007-08-31 14:56:23 UTC (rev 368)
@@ -52,7 +52,13 @@
}
}
- if(optind != argc)
+ /*
+ * a single param is the name of a source file
+ * default is to read from stdin
+ */
+ if(optind == argc - 1)
+ set_input_file(argv[optind]);
+ else if(optind != argc)
usage(prog_name);
parse_InterchangedObject(&state);
@@ -100,7 +106,7 @@
void
usage(char *prog_name)
{
- fprintf(stderr, "Usage: %s [-vv]\n", prog_name);
+ fprintf(stderr, "Usage: %s [-vv] [<input_file>]\n", prog_name);
exit(EXIT_FAILURE);
}
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-08-31 14:29:38 UTC (rev 367)
+++ redbutton-author/trunk/parser.h.header 2007-08-31 14:56:23 UTC (rev 368)
@@ -7,6 +7,8 @@
struct state { int dummy; };
typedef int token_t;
+void set_input_file(char *);
+
token_t peek_token(void);
void expect_token(token_t, char *);
token_t next_token(void);
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-08-31 14:29:38 UTC (rev 367)
+++ redbutton-author/trunk/parser.l.footer 2007-08-31 14:56:23 UTC (rev 368)
@@ -1,6 +1,18 @@
. return INVALID;
%%
+void
+set_input_file(char *src_name)
+{
+ if((yyin = fopen(src_name, "r")) == NULL)
+ {
+ fprintf(stderr, "Unable to read %s: %s\n", src_name, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ return;
+}
+
/* don't use #define in case they are macros too */
token_t
peek_token(void)
Modified: redbutton-author/trunk/parser.l.header
===================================================================
--- redbutton-author/trunk/parser.l.header 2007-08-31 14:29:38 UTC (rev 367)
+++ redbutton-author/trunk/parser.l.header 2007-08-31 14:56:23 UTC (rev 368)
@@ -1,6 +1,8 @@
%{
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
#include "parser.h"
#include "tokens.h"
extern int yylineno;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 13:56:42
|
Revision: 366
http://redbutton.svn.sourceforge.net/redbutton/?rev=366&view=rev
Author: skilvington
Date: 2007-08-31 06:56:33 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
remove unused code
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-31 13:44:42 UTC (rev 365)
+++ redbutton-author/trunk/ccc.y 2007-08-31 13:56:33 UTC (rev 366)
@@ -27,7 +27,6 @@
struct item *next;
char *name;
enum item_type type;
- bool include; /* should we output this optional item or not */
};
/* a list of strings */
@@ -350,7 +349,6 @@
new_item->next = NULL;
new_item->name = name; /* lex strdup's it for us */
new_item->type = type;
- new_item->include = true;
/* if it is a literal, make a token for it */
if(new_item->type == IT_LITERAL)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 13:44:53
|
Revision: 365
http://redbutton.svn.sourceforge.net/redbutton/?rev=365&view=rev
Author: skilvington
Date: 2007-08-31 06:44:42 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
add -v (verbose) flag to mhegc
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.header
redbutton-author/trunk/parser.l.footer
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-31 11:18:02 UTC (rev 364)
+++ redbutton-author/trunk/ccc.y 2007-08-31 13:44:42 UTC (rev 365)
@@ -369,7 +369,8 @@
/* C code for the parse_Xxx functions */
buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
buf_append(&state.parse_fns, "void parse_%s(struct state *state)\n{\n", name);
-buf_append(&state.parse_fns, "printf(\"<%s>\\n\");\n", name);
+ buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
+ buf_append(&state.parse_fns, "\tverbose(\"<%s>\\n\");\n\n", name);
/* count how many items make it up */
nitems = 0;
/* skip literals at the start */
@@ -384,7 +385,6 @@
}
if(nitems == 1)
{
- buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
item = state.items;
while(item && item->type == IT_LITERAL)
{
@@ -441,7 +441,7 @@
/* assert */
if(state.and_items)
fatal("CHOICE or ENUMERATED type, but and_items set");
- buf_append(&state.parse_fns, "\ttoken_t next = peek_token();\n\n");
+ buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
buf_append(&state.parse_fns, "\t/* CHOICE or ENUMERATED */\n");
item = state.items;
for(item=state.items; item; item=item->next)
@@ -467,8 +467,8 @@
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, "printf(\"<ENUM value=%s/>\\n\");\n", tok_name);
- buf_append(&state.parse_enum_fns, "}\n\n");
+ buf_append(&state.parse_enum_fns, "\n\tverbose(\"<ENUM value=%s/>\\n\");\n", tok_name);
+ buf_append(&state.parse_enum_fns, "\n\treturn;\n}\n\n");
free(tok_name);
}
else
@@ -484,7 +484,6 @@
/* assert */
if(!state.and_items)
fatal("SET but and_items not set");
- buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
item = state.items;
while(item && item->type == IT_LITERAL)
{
@@ -527,7 +526,6 @@
if(!state.and_items)
fatal("SEQUENCE but and_items not set");
buf_append(&state.parse_fns, "\t/* SEQUENCE */\n");
- buf_append(&state.parse_fns, "\ttoken_t next;\n");
item = state.items;
for(item=state.items; item; item=item->next)
{
@@ -537,7 +535,7 @@
if(item->type == IT_LITERAL)
{
char *tok_name = unquote(item->name);
- buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n", tok_name, item->name);
free(tok_name);
}
else
@@ -559,8 +557,8 @@
break;
}
}
-buf_append(&state.parse_fns, "printf(\"</%s>\\n\");\n", name);
- buf_append(&state.parse_fns, "}\n\n");
+ buf_append(&state.parse_fns, "\n\tverbose(\"</%s>\\n\");\n", name);
+ buf_append(&state.parse_fns, "\n\treturn;\n}\n\n");
/* C code for the is_Xxx functions */
buf_append(&state.is_hdr, "bool is_%s(token_t);\n", name);
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-08-31 11:18:02 UTC (rev 364)
+++ redbutton-author/trunk/mhegc.c 2007-08-31 13:44:42 UTC (rev 365)
@@ -20,16 +20,41 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include "parser.h"
+void usage(char *);
+
+static int _verbose = 0;
+
int
main(int argc, char *argv[])
{
+ char *prog_name = argv[0];
+ int arg;
struct state state;
+ while((arg = getopt(argc, argv, "v")) != EOF)
+ {
+ switch(arg)
+ {
+ case 'v':
+ _verbose ++;
+ break;
+
+ default:
+ usage(prog_name);
+ break;
+ }
+ }
+
+ if(optind != argc)
+ usage(prog_name);
+
parse_InterchangedObject(&state);
if(next_token())
@@ -38,3 +63,44 @@
return EXIT_SUCCESS;
}
+/*
+ * verbose functions send output to stderr so error messages get interleaved correctly
+ */
+
+void
+verbose(const char *fmt, ...)
+{
+ va_list ap;
+
+ if(_verbose)
+ {
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
+
+ return;
+}
+
+void
+vverbose(const char *fmt, ...)
+{
+ va_list ap;
+
+ if(_verbose > 1)
+ {
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
+
+ return;
+}
+
+void
+usage(char *prog_name)
+{
+ fprintf(stderr, "Usage: %s [-vv]\n", prog_name);
+
+ exit(EXIT_FAILURE);
+}
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-08-31 11:18:02 UTC (rev 364)
+++ redbutton-author/trunk/parser.c.header 2007-08-31 13:44:42 UTC (rev 365)
@@ -8,8 +8,7 @@
void
yyerror(const char *str)
{
-// fprintf(stderr, "Error: %s at line %d\n", str, yylineno);
-printf("Error: %s at line %d\n", str, yylineno);
+ fprintf(stderr, "Error: %s at line %d\n", str, yylineno);
}
int
@@ -27,7 +26,7 @@
if(next_token() != INTEGER)
yyerror("Expecting INTEGER");
-printf("<INTEGER value=%s/>\n", token_text());
+ verbose("<INTEGER value=%s/>\n", token_text());
return;
}
@@ -37,7 +36,7 @@
if(next_token() != BOOLEAN)
yyerror("Expecting BOOLEAN");
-printf("<BOOLEAN value=%s/>\n", token_text());
+ verbose("<BOOLEAN value=%s/>\n", token_text());
return;
}
@@ -48,7 +47,7 @@
if(next_token() != STRING)
yyerror("Expecting STRING");
-printf("<STRING value=%s/>\n", token_text());
+ verbose("<STRING value=%s/>\n", token_text());
return;
}
@@ -59,7 +58,7 @@
if(next_token() != QPRINTABLE)
yyerror("Expecting QPRINTABLE");
-printf("<QPRINTABLE value=%s/>\n", token_text());
+ verbose("<QPRINTABLE value=%s/>\n", token_text());
return;
}
@@ -70,7 +69,7 @@
if(next_token() != BASE64)
yyerror("Expecting BASE64");
-printf("<BASE64 value=%s/>\n", token_text());
+ verbose("<BASE64 value=%s/>\n", token_text());
return;
}
@@ -81,8 +80,11 @@
if(next_token() != Null)
yyerror("Expecting Null");
-printf("<Null/>\n");
+ verbose("<Null/>\n");
return;
}
+/*
+ * auto-generated parser functions follow
+ */
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-08-31 11:18:02 UTC (rev 364)
+++ redbutton-author/trunk/parser.h.header 2007-08-31 13:44:42 UTC (rev 365)
@@ -14,3 +14,5 @@
void parse_error(const char *, ...);
+void verbose(const char *, ...);
+void vverbose(const char *, ...);
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-08-31 11:18:02 UTC (rev 364)
+++ redbutton-author/trunk/parser.l.footer 2007-08-31 13:44:42 UTC (rev 365)
@@ -7,7 +7,8 @@
{
token_t tok = yylex();
-printf("peek: '%s'\n", yytext);
+ vverbose("peek: '%s'\n", yytext);
+
/* return it to the input stream */
yyless(0);
@@ -26,10 +27,11 @@
token_t
next_token(void)
{
-// return yylex();
-token_t tok = yylex();
-printf("next: '%s'\n", yytext);
-return tok;
+ token_t tok = yylex();
+
+ vverbose("next: '%s'\n", yytext);
+
+ return tok;
}
char *
@@ -49,7 +51,7 @@
va_start(ap, fmt);
if(vasprintf(&err, fmt, ap) < 0)
{
- fprintf(stderr, "Out of memory or illegal format string");
+ fprintf(stderr, "Out of memory or illegal format string '%s'", fmt);
exit(EXIT_FAILURE);
}
va_end(ap);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 11:18:06
|
Revision: 364
http://redbutton.svn.sourceforge.net/redbutton/?rev=364&view=rev
Author: skilvington
Date: 2007-08-31 04:18:02 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
OCR error in a comment
Modified Paths:
--------------
redbutton-author/trunk/grammar
Modified: redbutton-author/trunk/grammar
===================================================================
--- redbutton-author/trunk/grammar 2007-08-31 08:38:43 UTC (rev 363)
+++ redbutton-author/trunk/grammar 2007-08-31 11:18:02 UTC (rev 364)
@@ -309,7 +309,7 @@
DynamicLineArtClass ::= "{:DynamicLineArt" LineArtBody "}" .
-// B.4.29 Text Cfass
+// B.4.29 Text Class
TextClass ::= "{:Text" TextBody "}" .
TextBody ::= Visible [OriginalFont] [FontAttributes]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 08:38:48
|
Revision: 363
http://redbutton.svn.sourceforge.net/redbutton/?rev=363&view=rev
Author: skilvington
Date: 2007-08-31 01:38:43 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
parse enums too
Modified Paths:
--------------
redbutton-author/trunk/ccc.y
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.l.footer
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-31 07:21:40 UTC (rev 362)
+++ redbutton-author/trunk/ccc.y 2007-08-31 08:38:43 UTC (rev 363)
@@ -53,8 +53,10 @@
struct buf lexer; /* lex output file */
struct str_list *tokens; /* "%token" section of the yacc output file */
struct buf parse_fns; /* parse_Xxx() C functions for the parser */
+ struct buf parse_enum_fns; /* parse_Xxx() functions for enum values */
struct buf is_fns; /* is_Xxx() C functions for the parser */
struct buf parse_hdr; /* parse_Xxx() prototypes for the parser */
+ struct buf parse_enum_hdr; /* parse_Xxx() prototypes for enum values */
struct buf is_hdr; /* is_Xxx() C prototypes for the parser */
} state;
@@ -221,27 +223,17 @@
buf_init(&state.lexer);
state.tokens = NULL;
buf_init(&state.parse_fns);
+ buf_init(&state.parse_enum_fns);
buf_init(&state.is_fns);
buf_init(&state.parse_hdr);
+ buf_init(&state.parse_enum_hdr);
buf_init(&state.is_hdr);
yyparse();
-
- /*
- * add parse_Xxx functions for the tokens
- * #define is_Xxx functions for the tokens
- */
+ /* #define is_Xxx functions for the tokens */
for(t=state.tokens; t; t=t->next)
- {
- buf_append(&state.parse_fns, "void parse_%s(struct state *state)\n{\n", t->name);
-buf_append(&state.parse_fns, "// TODO\n");
- buf_append(&state.parse_fns, "}\n\n", t->name);
- /* parse_Xxx prototype */
- buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", t->name);
- /* #define is_Xxx function */
buf_append(&state.is_hdr, "#define is_%s(TOK)\t(TOK == %s)\n", t->name, t->name);
- }
/* output lexer */
if(lexer_name != NULL)
@@ -269,6 +261,7 @@
file_append(parser_file, header);
/* output our stuff */
fprintf(parser_file, "%s", state.parse_fns.str);
+ fprintf(parser_file, "%s", state.parse_enum_fns.str);
fprintf(parser_file, "%s", state.is_fns.str);
/* output the footer if there is one */
snprintf(footer, sizeof(footer), "%s.footer", parser_name);
@@ -286,6 +279,7 @@
file_append(header_file, header);
/* output our stuff */
fprintf(header_file, "%s", state.parse_hdr.str);
+ fprintf(header_file, "%s", state.parse_enum_hdr.str);
fprintf(header_file, "%s", state.is_hdr.str);
/* output the footer if there is one */
snprintf(footer, sizeof(footer), "%s.footer", header_name);
@@ -467,6 +461,14 @@
char *tok_name = unquote(item->name);
buf_append(&state.parse_fns, "if(is_%s(next))\n", tok_name);
buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", tok_name);
+ /* create a parse_Xxx function for the enum value */
+ if(asn1type(name) != ASN1TYPE_ENUMERATED)
+ fatal("literal but not enum");
+ 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, "printf(\"<ENUM value=%s/>\\n\");\n", tok_name);
+ buf_append(&state.parse_enum_fns, "}\n\n");
free(tok_name);
}
else
@@ -569,10 +571,32 @@
if(nitems == 1
|| state.items->type == IT_LITERAL)
{
- /* check if the first item matches the token */
+ /* if it is an enum, check if any item matches the token */
+ bool is_enum = true;
+ for(item=state.items; item && is_enum; item=item->next)
+ is_enum = is_enum && (item->type == IT_LITERAL);
item = state.items;
- if(item->type == IT_LITERAL)
+ if(is_enum)
{
+ if(asn1type(name) != ASN1TYPE_ENUMERATED)
+ fatal("is_enum but not ENUMERATED");
+ buf_append(&state.is_fns, "\treturn ");
+ while(item)
+ {
+ char *tok_name = unquote(item->name);
+ buf_append(&state.is_fns, "is_%s(tok)", tok_name);
+ free(tok_name);
+ /* is it the last one */
+ if(item->next)
+ buf_append(&state.is_fns, "\n\t || ");
+ else
+ buf_append(&state.is_fns, ";\n");
+ item = item->next;
+ }
+ }
+ /* just check if the first item matches the token */
+ else if(item->type == IT_LITERAL)
+ {
char *tok_name = unquote(item->name);
buf_append(&state.is_fns, "\treturn is_%s(tok);\n", tok_name);
free(tok_name);
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-08-31 07:21:40 UTC (rev 362)
+++ redbutton-author/trunk/parser.c.header 2007-08-31 08:38:43 UTC (rev 363)
@@ -8,7 +8,8 @@
void
yyerror(const char *str)
{
- fprintf(stderr, "Error: %s at line %d\n", str, yylineno);
+// fprintf(stderr, "Error: %s at line %d\n", str, yylineno);
+printf("Error: %s at line %d\n", str, yylineno);
}
int
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-08-31 07:21:40 UTC (rev 362)
+++ redbutton-author/trunk/parser.l.footer 2007-08-31 08:38:43 UTC (rev 363)
@@ -7,6 +7,7 @@
{
token_t tok = yylex();
+printf("peek: '%s'\n", yytext);
/* return it to the input stream */
yyless(0);
@@ -25,7 +26,10 @@
token_t
next_token(void)
{
- return yylex();
+// return yylex();
+token_t tok = yylex();
+printf("next: '%s'\n", yytext);
+return tok;
}
char *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-08-31 07:22:12
|
Revision: 362
http://redbutton.svn.sourceforge.net/redbutton/?rev=362&view=rev
Author: skilvington
Date: 2007-08-31 00:21:40 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
parse everything except enum values
Modified Paths:
--------------
redbutton-author/trunk/Makefile
redbutton-author/trunk/ccc.y
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.footer
redbutton-author/trunk/parser.h.header
redbutton-author/trunk/parser.l.footer
redbutton-author/trunk/parser.l.header
redbutton-author/trunk/tokens.h.header
Modified: redbutton-author/trunk/Makefile
===================================================================
--- redbutton-author/trunk/Makefile 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/Makefile 2007-08-31 07:21:40 UTC (rev 362)
@@ -1,6 +1,9 @@
CC=gcc
CFLAGS=-Wall -O2
+# for vasprintf
+DEFS=-D_GNU_SOURCE
+
LEX=flex
YACC=bison
#LEX=lex
@@ -16,21 +19,21 @@
TARDIR=`basename ${PWD}`
mhegc: parser.h ${OBJS}
- ${CC} ${CFLAGS} -o mhegc ${OBJS} ${LIBS}
+ ${CC} ${CFLAGS} ${DEFS} -o mhegc ${OBJS} ${LIBS}
ccc: ccc.y ccc.l asn1type.o
${LEX} -i -t ccc.l > lex.ccc.c
${YACC} -b ccc -d ccc.y
- ${CC} ${CFLAGS} -o ccc lex.ccc.c ccc.tab.c asn1type.o
+ ${CC} ${CFLAGS} ${DEFS} -o ccc lex.ccc.c ccc.tab.c asn1type.o
lex.parser.o parser.o parser.h: parser.l.* parser.c.* parser.h.* tokens.h.* grammar ccc
cat grammar | ./ccc -l parser.l -p parser.c -h parser.h -t tokens.h
${LEX} -i -t parser.l > lex.parser.c
- ${CC} ${CFLAGS} -c lex.parser.c
- ${CC} ${CFLAGS} -c parser.c
+ ${CC} ${CFLAGS} ${DEFS} -c lex.parser.c
+ ${CC} ${CFLAGS} ${DEFS} -c parser.c
.c.o:
- ${CC} ${CFLAGS} -c $<
+ ${CC} ${CFLAGS} ${DEFS} -c $<
install: mhegc
install -m 755 mhegc ${DESTDIR}/bin
Modified: redbutton-author/trunk/ccc.y
===================================================================
--- redbutton-author/trunk/ccc.y 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/ccc.y 2007-08-31 07:21:40 UTC (rev 362)
@@ -1,5 +1,4 @@
%{
-#define _GNU_SOURCE /* for vasprintf */
#include <unistd.h>
#include <stdio.h>
#include <string.h>
@@ -72,7 +71,6 @@
void output_def(char *);
-void print_tokens(struct str_list *);
char *add_token(struct str_list **, char *);
char *unquote(char *);
@@ -377,6 +375,7 @@
/* C code for the parse_Xxx functions */
buf_append(&state.parse_hdr, "void parse_%s(struct state *);\n", name);
buf_append(&state.parse_fns, "void parse_%s(struct state *state)\n{\n", name);
+buf_append(&state.parse_fns, "printf(\"<%s>\\n\");\n", name);
/* count how many items make it up */
nitems = 0;
/* skip literals at the start */
@@ -391,13 +390,17 @@
}
if(nitems == 1)
{
+ buf_append(&state.parse_fns, "\ttoken_t next;\n\n");
item = state.items;
while(item && item->type == IT_LITERAL)
{
-buf_append(&state.parse_fns, "// TODO: eat %s\n\n", item->name);
+ char *tok_name = unquote(item->name);
+ buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ free(tok_name);
item = item->next;
}
- buf_append(&state.parse_fns, "\ttoken_t next = next_token();\n\n");
+ buf_append(&state.parse_fns, "\tnext = peek_token();\n\n");
if(item->type == IT_IDENTIFIER)
{
buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
@@ -418,9 +421,8 @@
buf_append(&state.parse_fns, "\twhile(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t{\n");
buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
- buf_append(&state.parse_fns, "\t\tnext = next_token();\n");
+ buf_append(&state.parse_fns, "\t\tnext = peek_token();\n");
buf_append(&state.parse_fns, "\t}\n");
- buf_append(&state.parse_fns, "\n\tunget_token(next);\n");
}
else
{
@@ -429,7 +431,10 @@
item = item->next;
while(item)
{
-buf_append(&state.parse_fns, "\n// TODO: eat %s\n", item->name);
+ char *tok_name = unquote(item->name);
+ buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ free(tok_name);
item = item->next;
}
}
@@ -442,7 +447,7 @@
/* assert */
if(state.and_items)
fatal("CHOICE or ENUMERATED type, but and_items set");
- buf_append(&state.parse_fns, "\ttoken_t next = next_token();\n\n");
+ buf_append(&state.parse_fns, "\ttoken_t next = peek_token();\n\n");
buf_append(&state.parse_fns, "\t/* CHOICE or ENUMERATED */\n");
item = state.items;
for(item=state.items; item; item=item->next)
@@ -481,12 +486,15 @@
item = state.items;
while(item && item->type == IT_LITERAL)
{
-buf_append(&state.parse_fns, "// TODO: eat %s\n\n", item->name);
+ char *tok_name = unquote(item->name);
+ buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ free(tok_name);
item = item->next;
}
buf_append(&state.parse_fns, "\t/* SET */\n");
buf_append(&state.parse_fns, "\twhile(true)\n\t{\n");
- buf_append(&state.parse_fns, "\t\tnext = next_token();\n");
+ buf_append(&state.parse_fns, "\t\tnext = peek_token();\n");
while(item && item->type != IT_LITERAL)
{
if(item->type != IT_IDENTIFIER && item->type != IT_OPTIONAL)
@@ -504,7 +512,10 @@
/* eat any trailing literals */
while(item && item->type == IT_LITERAL)
{
-buf_append(&state.parse_fns, "\n// TODO: eat %s\n", item->name);
+ char *tok_name = unquote(item->name);
+ buf_append(&state.parse_fns, "\t/* %s */\n", item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ free(tok_name);
item = item->next;
}
break;
@@ -523,11 +534,13 @@
buf_append(&state.parse_fns, "\n\t/* %s */\n", item->name);
if(item->type == IT_LITERAL)
{
-buf_append(&state.parse_fns, "// TODO: eat %s\n", item->name);
+ char *tok_name = unquote(item->name);
+ buf_append(&state.parse_fns, "\texpect_token(%s, %s);\n\n", tok_name, item->name);
+ free(tok_name);
}
else
{
- buf_append(&state.parse_fns, "\tnext = next_token();\n");
+ buf_append(&state.parse_fns, "\tnext = peek_token();\n");
buf_append(&state.parse_fns, "\tif(is_%s(next))\n", item->name);
buf_append(&state.parse_fns, "\t\tparse_%s(state);\n", item->name);
if(item->type != IT_OPTIONAL)
@@ -544,6 +557,7 @@
break;
}
}
+buf_append(&state.parse_fns, "printf(\"</%s>\\n\");\n", name);
buf_append(&state.parse_fns, "}\n\n");
/* C code for the is_Xxx functions */
@@ -630,18 +644,6 @@
return;
}
-void
-print_tokens(struct str_list *t)
-{
- while(t)
- {
- printf("%%token %s\n", t->name);
- t = t->next;
- }
-
- return;
-}
-
char *
add_token(struct str_list **head, char *quoted)
{
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/mhegc.c 2007-08-31 07:21:40 UTC (rev 362)
@@ -32,6 +32,9 @@
parse_InterchangedObject(&state);
+ if(next_token())
+ parse_error("Unexpected text after InterchangedObject");
+
return EXIT_SUCCESS;
}
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/parser.c.header 2007-08-31 07:21:40 UTC (rev 362)
@@ -5,8 +5,6 @@
int yylineno = 1;
-int yylex(void);
-
void
yyerror(const char *str)
{
@@ -25,29 +23,65 @@
void parse_INTEGER(struct state *state)
{
+ if(next_token() != INTEGER)
+ yyerror("Expecting INTEGER");
+
+printf("<INTEGER value=%s/>\n", token_text());
+
+ return;
}
void parse_BOOLEAN(struct state *state)
{
+ if(next_token() != BOOLEAN)
+ yyerror("Expecting BOOLEAN");
+
+printf("<BOOLEAN value=%s/>\n", token_text());
+
+ return;
}
void parse_STRING(struct state *state)
{
+ if(next_token() != STRING)
+ yyerror("Expecting STRING");
+
+printf("<STRING value=%s/>\n", token_text());
+
+ return;
}
void parse_QPRINTABLE(struct state *state)
{
+ if(next_token() != QPRINTABLE)
+ yyerror("Expecting QPRINTABLE");
+
+printf("<QPRINTABLE value=%s/>\n", token_text());
+
+ return;
}
void parse_BASE64(struct state *state)
{
+ if(next_token() != BASE64)
+ yyerror("Expecting BASE64");
+
+printf("<BASE64 value=%s/>\n", token_text());
+
+ return;
}
void parse_Null(struct state *state)
{
+ if(next_token() != Null)
+ yyerror("Expecting Null");
+
+printf("<Null/>\n");
+
+ return;
}
Modified: redbutton-author/trunk/parser.h.footer
===================================================================
--- redbutton-author/trunk/parser.h.footer 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/parser.h.footer 2007-08-31 07:21:40 UTC (rev 362)
@@ -6,5 +6,4 @@
#define is_BASE64(TOK) (TOK == BASE64)
#define is_Null(TOK) (TOK == Null)
-#endif /* __NEW_PARSER_H__ */
-
+#endif /* __PARSER_H__ */
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/parser.h.header 2007-08-31 07:21:40 UTC (rev 362)
@@ -1,8 +1,16 @@
-#ifndef __NEW_PARSER_H__
-#define __NEW_PARSER_H__
+#ifndef __PARSER_H__
+#define __PARSER_H__
+#include <stdio.h>
#include <stdbool.h>
struct state { int dummy; };
typedef int token_t;
+token_t peek_token(void);
+void expect_token(token_t, char *);
+token_t next_token(void);
+char *token_text(void);
+
+void parse_error(const char *, ...);
+
Modified: redbutton-author/trunk/parser.l.footer
===================================================================
--- redbutton-author/trunk/parser.l.footer 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/parser.l.footer 2007-08-31 07:21:40 UTC (rev 362)
@@ -3,19 +3,57 @@
/* don't use #define in case they are macros too */
token_t
+peek_token(void)
+{
+ token_t tok = yylex();
+
+ /* return it to the input stream */
+ yyless(0);
+
+ return tok;
+}
+
+void
+expect_token(token_t tok, char *name)
+{
+ if(next_token() != tok)
+ parse_error("Unexpected token; expecting '%s'", name);
+
+ return;
+}
+
+token_t
next_token(void)
{
return yylex();
}
-void
-unget_token(token_t tok)
+char *
+token_text(void)
{
- unput(tok);
+ return yytext;
}
+void yyerror(const char *);
+
void
-parse_error(char *err)
+parse_error(const char *fmt, ...)
{
+ va_list ap;
+ char *err;
+
+ va_start(ap, fmt);
+ if(vasprintf(&err, fmt, ap) < 0)
+ {
+ fprintf(stderr, "Out of memory or illegal format string");
+ exit(EXIT_FAILURE);
+ }
+ va_end(ap);
+
yyerror(err);
+
+ free(err);
+
+ return;
}
+
Modified: redbutton-author/trunk/parser.l.header
===================================================================
--- redbutton-author/trunk/parser.l.header 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/parser.l.header 2007-08-31 07:21:40 UTC (rev 362)
@@ -1,4 +1,6 @@
%{
+#include <stdio.h>
+#include <stdarg.h>
#include "parser.h"
#include "tokens.h"
extern int yylineno;
Modified: redbutton-author/trunk/tokens.h.header
===================================================================
--- redbutton-author/trunk/tokens.h.header 2007-08-30 16:29:28 UTC (rev 361)
+++ redbutton-author/trunk/tokens.h.header 2007-08-31 07:21:40 UTC (rev 362)
@@ -1,3 +1,4 @@
+#define END_OF_SRC 0 /* must be 0 */
#define INVALID 1
#define INTEGER 2
#define BOOLEAN 3
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|