Update RTF parser to compile with more recent bison versions.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31825 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2011-01-03 08:25:42 +00:00
parent eeb4161156
commit 3831a1ef4e
9 changed files with 1116 additions and 687 deletions

View file

@ -1,3 +1,23 @@
2011-01-03 Wolfgang Lux <wolfgang.lux@gmail.com>
* TextConverters/RTF/rtfGrammar.y:
* TextConverters/RTF/RTFConsumerFunctions.h:
* TextConverters/RTF/RTFConsumer.m (GSRTFerror):
Upgrade to compile with more recent bison versions.
* TextConverters/RTF/GNUmakefile:
* TextConverters/RTF/GNUmakefile.postamble:
* TextConverters/RTF/rtfGrammar.y:
* TextConverters/RTF/rtfScanner.c:
Correct spelling (rtfGrammer->rtfGrammar).
* TextConverters/RTF/GNUmakefile.postamble:
Update rationale why bison rule is (still) not enabled.
* TextConverters/RTF/rtfGrammar.tab.h:
* TextConverters/RTF/rtfGrammar.tab.c:
Regenerated.
2011-01-03 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSMatrix.m (-setEnabled:): Implement method. It enables

View file

@ -32,7 +32,7 @@ RTFConverter_OBJC_FILES = \
RTFConsumer.m RTFProducer.m
RTFConverter_C_FILES = \
rtfGrammer.tab.c rtfScanner.c
rtfGrammar.tab.c rtfScanner.c
RTFConverter_PRINCIPAL_CLASS = RTFConsumer

View file

@ -25,6 +25,7 @@
BISON_FLAGS = -d -p GSRTF
BISON = BISON_SIMPLE=bison.simple bison
# This parser doesn't compile with newer bison programs. Needs to be fixed...
#rtfGrammer.tab.c: rtfGrammer.y
# Rule not enabled because not every system has bison installed...
# FIXME add configure check for bison?
#rtfGrammar.tab.c: rtfGrammar.y
# $(BISON) $(BISON_FLAGS) $<

View file

@ -698,7 +698,7 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
*/
/* handle errors (this is the yacc error mech) */
void GSRTFerror (const char *msg)
void GSRTFerror (void *ctxt, void *lctxt, const char *msg)
{
/* [NSException raise:NSInvalidArgumentException
format:@"Syntax error in RTF: %s", msg];*/

View file

@ -55,7 +55,7 @@ void GSRTFopenBlock(void *ctxt, BOOL ignore);
void GSRTFcloseBlock(void *ctxt, BOOL ignore);
/* handle errors */
void GSRTFerror(const char *msg);
void GSRTFerror(void *ctxt, void *lctxt, const char *msg);
/* handle rtf commands not expicated in the grammer */
void GSRTFgenericRTFcommand(void *ctxt, RTFcmd cmd);

View file

@ -1,7 +1,9 @@
/* A Bison parser, made from rtfGrammer.y, by GNU bison 1.75. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,16 +17,21 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
#ifndef BISON_RTFGRAMMER_TAB_H
# define BISON_RTFGRAMMER_TAB_H
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@ -109,6 +116,7 @@
RTFfamilyTech = 332
};
#endif
/* Tokens. */
#define RTFtext 258
#define RTFstart 259
#define RTFansi 260
@ -188,20 +196,21 @@
#ifndef YYSTYPE
#line 77 "rtfGrammer.y"
typedef union {
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 81 "rtfGrammar.y"
{
int number;
const char *text;
RTFcmd cmd;
} yystype;
/* Line 1281 of /usr/local/share/bison/yacc.c. */
#line 200 "rtfGrammer.tab.h"
# define YYSTYPE yystype
}
/* Line 1529 of yacc.c. */
#line 209 "rtfGrammar.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
#endif /* not BISON_RTFGRAMMER_TAB_H */

View file

@ -61,9 +61,9 @@
typedef void *GSRTFctxt;
// Two parameters are not supported by some bison versions. The declaration of
// yyparse in the .c file must be corrected to be able to compile it.
#define YYPARSE_PARAM ctxt, void *lctxt
/*#define YYPARSE_PARAM ctxt, void *lctxt*/
#define YYLEX_PARAM lctxt
#define YYLSP_NEEDED 0
/*#undef YYLSP_NEEDED*/
#define CTXT ctxt
#define YYERROR_VERBOSE
@ -75,6 +75,9 @@ int GSRTFlex(void *lvalp, void *lctxt);
%}
%parse-param {void *ctxt}
%parse-param {void *lctxt}
%union {
int number;
const char *text;

View file

@ -29,7 +29,7 @@
#include <string.h>
#include <ctype.h>
#include "rtfScanner.h"
#include "rtfGrammer.tab.h"
#include "rtfGrammar.tab.h"
// <§> scanner types and helpers