summaryrefslogtreecommitdiff
path: root/library/backend/vcc_yacc.cpp
Side-by-side diff
Diffstat (limited to 'library/backend/vcc_yacc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/vcc_yacc.cpp169
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,4 +1,5 @@
#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
@@ -8,6 +9,30 @@ static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#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"
@@ -74,4 +99,5 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
*/
+#if 0
#define yyparse mime_parse
#define yylex mime_lex
@@ -106,4 +132,5 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#endif
#define YYPREFIX "mime_"
+#endif
@@ -129,11 +156,9 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#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 ****/
@@ -141,6 +166,5 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#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) */
@@ -189,12 +213,14 @@ 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
@@ -216,5 +242,5 @@ typedef union {
#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,
@@ -223,5 +249,5 @@ short yylhs[] = { -1,
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,
@@ -230,5 +256,5 @@ short yylen[] = { 2,
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,
@@ -238,10 +264,10 @@ short yydefred[] = { 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,
@@ -251,5 +277,5 @@ short yysindex[] = { -262,
-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,
@@ -259,5 +285,5 @@ short yyrindex[] = { 0,
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,
@@ -265,5 +291,5 @@ short yygindex[] = { 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,
@@ -275,5 +301,5 @@ short yytable[] = { 30,
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,
@@ -291,5 +317,5 @@ short yycheck[] = { 16,
#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,
@@ -302,5 +328,5 @@ char *yyname[] = {
"END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","ID","STRING",
};
-char *yyrule[] = {
+char *vccrule[] = {
"$accept : mime",
"mime : vobjects",
@@ -373,5 +399,5 @@ short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#define yystacksize YYSTACKSIZE
-#line 378 "vcc.y"
+#line 382 "backend/vcc.y"
/*------------------------------------*/
@@ -512,5 +538,5 @@ static int lexWithinMode(enum LexMode mode) {
}
-static char lexGetc_()
+static int lexGetc_()
{
/* get next char from input, no buffering. */
@@ -926,5 +952,5 @@ static int match_begin_end_name(int end) {
static char* lexGetQuotedPrintable()
{
- char cur;
+ int cur;
lexClearToken();
@@ -968,5 +994,5 @@ static char* lexGetQuotedPrintable()
goto EndString;
}
- case (char)EOF:
+ case (int)EOF:
break;
default:
@@ -974,5 +1000,5 @@ static char* lexGetQuotedPrintable()
break;
} /* switch */
- } while (cur != (char)EOF);
+ } while (cur != (int)EOF);
EndString:
@@ -1151,11 +1177,16 @@ 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() );
}
@@ -1187,5 +1218,5 @@ void mime_error_(char *s)
}
-#line 1192 "y.tab.c"
+#line 1221 "y.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
@@ -1193,5 +1224,9 @@ void mime_error_(char *s)
#define YYERROR goto yyerrlab
int
+#if defined(__STDC__)
+yyparse(void)
+#else
yyparse()
+#endif
{
register int yym, yyn, yystate;
@@ -1217,5 +1252,5 @@ yyparse()
yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
if (yychar < 0)
{
@@ -1257,8 +1292,4 @@ yyloop:
}
if (yyerrflag) goto yyinrecovery;
-#ifdef lint
- goto yynewerror;
-#endif
-yynewerror:
yyerror("syntax error");
#ifdef lint
@@ -1329,13 +1360,13 @@ yyreduce:
{
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);
@@ -1344,5 +1375,5 @@ case 6:
break;
case 7:
-#line 233 "vcc.y"
+#line 237 "backend/vcc.y"
{
lexPopMode(0);
@@ -1351,5 +1382,5 @@ case 7:
break;
case 8:
-#line 238 "vcc.y"
+#line 242 "backend/vcc.y"
{
lexPushMode(L_VCARD);
@@ -1358,5 +1389,5 @@ case 8:
break;
case 9:
-#line 243 "vcc.y"
+#line 247 "backend/vcc.y"
{
lexPopMode(0);
@@ -1365,5 +1396,5 @@ case 9:
break;
case 12:
-#line 254 "vcc.y"
+#line 258 "backend/vcc.y"
{
lexPushMode(L_VALUES);
@@ -1371,5 +1402,5 @@ case 12:
break;
case 13:
-#line 258 "vcc.y"
+#line 262 "backend/vcc.y"
{
if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
@@ -1379,5 +1410,5 @@ case 13:
break;
case 15:
-#line 267 "vcc.y"
+#line 271 "backend/vcc.y"
{
enterProps(yyvsp[0].str);
@@ -1385,5 +1416,5 @@ case 15:
break;
case 17:
-#line 272 "vcc.y"
+#line 276 "backend/vcc.y"
{
enterProps(yyvsp[0].str);
@@ -1391,5 +1422,5 @@ case 17:
break;
case 21:
-#line 285 "vcc.y"
+#line 289 "backend/vcc.y"
{
enterAttr(yyvsp[0].str,0);
@@ -1397,5 +1428,5 @@ case 21:
break;
case 22:
-#line 289 "vcc.y"
+#line 293 "backend/vcc.y"
{
enterAttr(yyvsp[-2].str,yyvsp[0].str);
@@ -1404,33 +1435,33 @@ case 22:
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);
@@ -1439,5 +1470,5 @@ case 38:
break;
case 39:
-#line 338 "vcc.y"
+#line 342 "backend/vcc.y"
{
lexPopMode(0);
@@ -1446,5 +1477,5 @@ case 39:
break;
case 40:
-#line 343 "vcc.y"
+#line 347 "backend/vcc.y"
{
lexPushMode(L_VEVENT);
@@ -1453,5 +1484,5 @@ case 40:
break;
case 41:
-#line 348 "vcc.y"
+#line 352 "backend/vcc.y"
{
lexPopMode(0);
@@ -1460,5 +1491,5 @@ case 41:
break;
case 42:
-#line 356 "vcc.y"
+#line 360 "backend/vcc.y"
{
lexPushMode(L_VTODO);
@@ -1467,5 +1498,5 @@ case 42:
break;
case 43:
-#line 362 "vcc.y"
+#line 366 "backend/vcc.y"
{
lexPopMode(0);
@@ -1474,5 +1505,5 @@ case 43:
break;
case 44:
-#line 367 "vcc.y"
+#line 371 "backend/vcc.y"
{
lexPushMode(L_VTODO);
@@ -1481,5 +1512,5 @@ case 44:
break;
case 45:
-#line 372 "vcc.y"
+#line 376 "backend/vcc.y"
{
lexPopMode(0);
@@ -1487,5 +1518,5 @@ case 45:
}
break;
-#line 1492 "y.tab.c"
+#line 1521 "y.tab.c"
}
yyssp -= yym;