author | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
commit | 6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (side-by-side diff) | |
tree | 6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/backend/vcc_yacc.cpp | |
parent | d10cddb3c9ce75bc90b14add14bc133737fe35aa (diff) | |
download | opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2 |
Qtopia1-6 merge
still to test
bic changes to be resolved
more changes to be made?
Diffstat (limited to 'library/backend/vcc_yacc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | library/backend/vcc_yacc.cpp | 169 |
1 files changed, 100 insertions, 69 deletions
diff --git a/library/backend/vcc_yacc.cpp b/library/backend/vcc_yacc.cpp index cb24631..19a108f 100644 --- a/library/backend/vcc_yacc.cpp +++ b/library/backend/vcc_yacc.cpp @@ -1,15 +1,40 @@ #ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; +/*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/ +static char yyrcsid[] = "$Id$"; #endif #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define yyclearin (yychar=(-1)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -#line 1 "vcc.y" +#define yyparse vccparse +#define yylex vcclex +#define yyerror vccerror +#define yychar vccchar +#define yyval vccval +#define yylval vcclval +#define yydebug vccdebug +#define yynerrs vccnerrs +#define yyerrflag vccerrflag +#define yyss vccss +#define yyssp vccssp +#define yyvs vccvs +#define yyvsp vccvsp +#define yylhs vcclhs +#define yylen vcclen +#define yydefred vccdefred +#define yydgoto vccdgoto +#define yysindex vccsindex +#define yyrindex vccrindex +#define yygindex vccgindex +#define yytable vcctable +#define yycheck vcccheck +#define yyname vccname +#define yyrule vccrule +#define YYPREFIX "vcc" +#line 1 "backend/vcc.y" /***************************************************************************
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
@@ -72,8 +97,9 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. /* assign local name to parser variables and functions so that
we can use more than one yacc based parser.
*/
+#if 0
#define yyparse mime_parse
#define yylex mime_lex
#define yyerror mime_error
#define yychar mime_char
@@ -104,8 +130,9 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. #ifdef YYPREFIX
#undef YYPREFIX
#endif
#define YYPREFIX "mime_"
+#endif
#ifndef _NO_LINE_FOLDING
#define _SUPPORT_LINE_FOLDING 1
@@ -127,22 +154,19 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#ifdef PALMTOPCENTER -#include <qpe/vobject_p.h>
-#include <qpe/qfiledirect_p.h> -#else +/*#ifdef PALMTOPCENTER
*/ +/*#include <qpe/vobject_p.h>
*/ +/*#else
*/ #include "vobject_p.h"
-#include "qfiledirect_p.h" -#endif +/*#endif
*/ /**** Types, Constants ****/
#define YYDEBUG 0 /* 1 to compile in some debugging code */
#define MAXTOKEN 256 /* maximum token (line) length */
-#define YYSTACKSIZE 100 /* ~unref ? -*/ +#define YYSTACKSIZE 100 /* ~unref ?
*/ #define MAXLEVEL 10 /* max # of nested objects parseable */
/* (includes outermost) */
@@ -187,16 +211,18 @@ static int lexWithinMode(enum LexMode mode); static void lexPushMode(enum LexMode mode);
static void enterProps(const char *s);
static void enterAttr(const char *s1, const char *s2);
static void enterValues(const char *value);
+#define mime_error yyerror
+void mime_error(char *s);
void mime_error_(char *s);
-#line 185 "vcc.y" +#line 189 "backend/vcc.y" typedef union {
char *str;
VObject *vobj;
} YYSTYPE; -#line 196 "y.tab.c" +#line 225 "y.tab.c" #define EQ 257 #define COLON 258 #define DOT 259 #define SEMICOLON 260 @@ -214,58 +240,58 @@ typedef union { #define END_VTODO 272 #define ID 273 #define STRING 274 #define YYERRCODE 256 -short yylhs[] = { -1, +short vcclhs[] = { -1, 0, 6, 6, 5, 5, 8, 3, 9, 3, 7, 7, 13, 10, 10, 15, 11, 11, 14, 14, 16, 17, 17, 1, 18, 12, 12, 2, 2, 20, 4, 21, 4, 19, 19, 22, 22, 22, 25, 23, 26, 23, 27, 24, 28, 24, }; -short yylen[] = { 2, +short vcclen[] = { 2, 1, 2, 1, 1, 1, 0, 4, 0, 3, 2, 1, 0, 5, 1, 0, 3, 1, 2, 1, 2, 1, 3, 1, 0, 4, 1, 1, 0, 0, 4, 0, 3, 2, 1, 1, 1, 1, 0, 4, 0, 3, 0, 4, 0, 3, }; -short yydefred[] = { 0, +short vccdefred[] = { 0, 0, 0, 0, 4, 5, 3, 0, 0, 0, 0, 0, 2, 14, 23, 0, 0, 11, 0, 9, 0, 0, 0, 0, 34, 35, 36, 32, 0, 7, 10, 12, 0, 0, 0, 0, 30, 33, 0, 0, 19, 0, 0, 41, 0, 45, 0, 20, 18, 27, 0, 0, 39, 43, 0, 24, 13, 22, 0, 25, }; -short yydgoto[] = { 3, +short vccdgoto[] = { 3, 15, 50, 4, 5, 6, 7, 22, 8, 9, 17, 18, 51, 41, 39, 28, 40, 47, 58, 23, 10, 11, 24, 25, 26, 32, 33, 34, 35, }; -short yysindex[] = { -262, +short vccsindex[] = { -262, 0, 0, 0, 0, 0, 0, -262, -252, -219, -249, -256, 0, 0, 0, 0, -227, 0, -242, 0, 0, 0, -252, -254, 0, 0, 0, 0, -208, 0, 0, 0, -252, -228, -252, -213, 0, 0, -212, -208, 0, -214, -233, 0, -224, 0, -195, 0, 0, 0, -197, -199, 0, 0, -212, 0, 0, 0, -214, 0, }; -short yyrindex[] = { 0, +short vccrindex[] = { 0, -222, -238, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, -215, 0, 0, 0, 0, -220, -218, -260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -192, 0, -250, 0, 0, 0, 0, -202, 0, 0, 0, -196, 0, 0, 0, 0, 0, 0, 0, -250, 0, }; -short yygindex[] = { 0, +short vccgindex[] = { 0, 3, 0, 0, 0, 61, 0, -7, 0, 0, -16, 0, 11, 0, 0, 0, 31, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, }; #define YYTABLESIZE 71 -short yytable[] = { 30, +short vcctable[] = { 30, 16, 13, 1, 13, 2, 30, 13, 37, 37, 28, 37, 27, 28, 36, 20, 31, 21, 29, 14, 20, 14, 21, 13, 14, 42, 30, 44, 30, 13, 31, 29, 13, 29, 6, 29, 38, 52, 42, 29, 14, @@ -273,9 +299,9 @@ short yytable[] = { 30, 6, 38, 38, 44, 42, 21, 57, 21, 45, 49, 14, 54, 55, 56, 1, 16, 26, 12, 59, 48, 37, }; -short yycheck[] = { 16, +short vcccheck[] = { 16, 8, 256, 265, 256, 267, 22, 256, 268, 269, 260, 271, 268, 263, 268, 269, 258, 271, 256, 273, 269, 273, 271, 256, 273, 32, 42, 34, 44, 256, 268, 269, 256, 271, 256, 273, 256, 270, 256, 266, 273, @@ -289,9 +315,9 @@ short yycheck[] = { 16, #define YYDEBUG 0 #endif #define YYMAXTOKEN 274 #if YYDEBUG -char *yyname[] = { +char *vccname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -300,9 +326,9 @@ char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"EQ","COLON","DOT","SEMICOLON", "SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD","BEGIN_VCAL", "END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","ID","STRING", }; -char *yyrule[] = { +char *vccrule[] = { "$accept : mime", "mime : vobjects", "vobjects : vobjects vobject", "vobjects : vobject", @@ -371,9 +397,9 @@ YYSTYPE yyval; YYSTYPE yylval; short yyss[YYSTACKSIZE]; YYSTYPE yyvs[YYSTACKSIZE]; #define yystacksize YYSTACKSIZE -#line 378 "vcc.y" +#line 382 "backend/vcc.y" /*------------------------------------*/
static int pushVObject(const char *prop)
{
@@ -510,9 +536,9 @@ static int lexWithinMode(enum LexMode mode) { if (mode == lexBuf.lexModeStack[i]) return 1;
return 0;
}
-static char lexGetc_()
+static int lexGetc_()
{
/* get next char from input, no buffering. */
if (lexBuf.curPos == lexBuf.inputLen)
return EOF;
@@ -924,9 +950,9 @@ static int match_begin_end_name(int end) { }
static char* lexGetQuotedPrintable()
{
- char cur;
+ int cur;
lexClearToken();
do {
cur = lexGetc();
@@ -966,15 +992,15 @@ static char* lexGetQuotedPrintable() case '\n': {
lexPushLookaheadc('\n');
goto EndString;
}
- case (char)EOF:
+ case (int)EOF:
break;
default:
lexAppendc(cur);
break;
} /* switch */
- } while (cur != (char)EOF);
+ } while (cur != (int)EOF);
EndString:
lexAppendc(0);
return lexStr();
@@ -1149,15 +1175,20 @@ VObject* Parse_MIME_FromFile(FILE *file) }
DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
{
- QFileDirect f( fname );
- if ( !f.open( IO_ReadOnly ) ) {
- qWarning("Unable to open mime for reading %s", fname);
- return 0;
+ FILE *fp = fopen(fname,"r");
+ if (fp) {
+ VObject* o = Parse_MIME_FromFile(fp);
+ fclose(fp);
+ return o;
+ }
+ else {
+ char msg[80];
+ sprintf(msg, "can't open file '%s' for reading\n", fname);
+ mime_error_(msg);
+ return 0;
}
-
- return Parse_MIME_FromFile( f.directHandle() );
}
#endif
@@ -1185,15 +1216,19 @@ void mime_error_(char *s) mimeErrorHandler(s);
}
}
-#line 1192 "y.tab.c" +#line 1221 "y.tab.c" #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int +#if defined(__STDC__) +yyparse(void) +#else yyparse() +#endif { register int yym, yyn, yystate; #if YYDEBUG register char *yys; @@ -1215,9 +1250,9 @@ yyparse() yyvsp = yyvs; *yyssp = yystate = 0; yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG @@ -1255,12 +1290,8 @@ yyloop: yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: yyerror("syntax error"); #ifdef lint goto yyerrlab; #endif @@ -1327,167 +1358,167 @@ yyreduce: yyval = yyvsp[1-yym]; switch (yyn) { case 2: -#line 217 "vcc.y" +#line 221 "backend/vcc.y" { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } break; case 3: -#line 219 "vcc.y" +#line 223 "backend/vcc.y" { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } break; case 6: -#line 228 "vcc.y" +#line 232 "backend/vcc.y" {
lexPushMode(L_VCARD);
if (!pushVObject(VCCardProp)) YYERROR;
} break; case 7: -#line 233 "vcc.y" +#line 237 "backend/vcc.y" {
lexPopMode(0);
yyval.vobj = popVObject();
} break; case 8: -#line 238 "vcc.y" +#line 242 "backend/vcc.y" {
lexPushMode(L_VCARD);
if (!pushVObject(VCCardProp)) YYERROR;
} break; case 9: -#line 243 "vcc.y" +#line 247 "backend/vcc.y" {
lexPopMode(0);
yyval.vobj = popVObject();
} break; case 12: -#line 254 "vcc.y" +#line 258 "backend/vcc.y" {
lexPushMode(L_VALUES);
} break; case 13: -#line 258 "vcc.y" +#line 262 "backend/vcc.y" {
if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
lexPopMode(0);
lexPopMode(0);
} break; case 15: -#line 267 "vcc.y" +#line 271 "backend/vcc.y" {
enterProps(yyvsp[0].str);
} break; case 17: -#line 272 "vcc.y" +#line 276 "backend/vcc.y" {
enterProps(yyvsp[0].str);
} break; case 21: -#line 285 "vcc.y" +#line 289 "backend/vcc.y" {
enterAttr(yyvsp[0].str,0);
} break; case 22: -#line 289 "vcc.y" +#line 293 "backend/vcc.y" {
enterAttr(yyvsp[-2].str,yyvsp[0].str);
} break; case 24: -#line 298 "vcc.y" +#line 302 "backend/vcc.y" { enterValues(yyvsp[-1].str); } break; case 26: -#line 300 "vcc.y" +#line 304 "backend/vcc.y" { enterValues(yyvsp[0].str); } break; case 28: -#line 305 "vcc.y" +#line 309 "backend/vcc.y" { yyval.str = 0; } break; case 29: -#line 310 "vcc.y" +#line 314 "backend/vcc.y" { if (!pushVObject(VCCalProp)) YYERROR; } break; case 30: -#line 313 "vcc.y" +#line 317 "backend/vcc.y" { yyval.vobj = popVObject(); } break; case 31: -#line 315 "vcc.y" +#line 319 "backend/vcc.y" { if (!pushVObject(VCCalProp)) YYERROR; } break; case 32: -#line 317 "vcc.y" +#line 321 "backend/vcc.y" { yyval.vobj = popVObject(); } break; case 38: -#line 332 "vcc.y" +#line 336 "backend/vcc.y" {
lexPushMode(L_VEVENT);
if (!pushVObject(VCEventProp)) YYERROR;
} break; case 39: -#line 338 "vcc.y" +#line 342 "backend/vcc.y" {
lexPopMode(0);
popVObject();
} break; case 40: -#line 343 "vcc.y" +#line 347 "backend/vcc.y" {
lexPushMode(L_VEVENT);
if (!pushVObject(VCEventProp)) YYERROR;
} break; case 41: -#line 348 "vcc.y" +#line 352 "backend/vcc.y" {
lexPopMode(0);
popVObject();
} break; case 42: -#line 356 "vcc.y" +#line 360 "backend/vcc.y" {
lexPushMode(L_VTODO);
if (!pushVObject(VCTodoProp)) YYERROR;
} break; case 43: -#line 362 "vcc.y" +#line 366 "backend/vcc.y" {
lexPopMode(0);
popVObject();
} break; case 44: -#line 367 "vcc.y" +#line 371 "backend/vcc.y" {
lexPushMode(L_VTODO);
if (!pushVObject(VCTodoProp)) YYERROR;
} break; case 45: -#line 372 "vcc.y" +#line 376 "backend/vcc.y" {
lexPopMode(0);
popVObject();
} break; -#line 1492 "y.tab.c" +#line 1521 "y.tab.c" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; |