Added underline, script, colour and tailindent.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6715 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-06-17 17:53:14 +00:00
parent c7dfd932ee
commit 3d5cc5d9e7
6 changed files with 488 additions and 343 deletions

View file

@ -52,11 +52,6 @@ readNSString(StringContext *ctxt)
? [ctxt->string characterAtIndex:ctxt->position++]: EOF; ? [ctxt->string characterAtIndex:ctxt->position++]: EOF;
} }
/*
we must implement from the rtfConsumerSkeleton.h file (Supporting files)
this includes the yacc error handling and output
*/
// Hold the attributs of the current run // Hold the attributs of the current run
@interface RTFAttribute: NSObject <NSCopying> @interface RTFAttribute: NSObject <NSCopying>
{ {
@ -74,6 +69,10 @@ readNSString(StringContext *ctxt)
} }
- (NSFont*) currentFont; - (NSFont*) currentFont;
- (NSNumber*) script;
- (NSNumber*) underline;
- (void) resetParagraphStyle;
- (void) resetFont;
@end @end
@ -81,16 +80,8 @@ readNSString(StringContext *ctxt)
- (id) init - (id) init
{ {
NSFont *font = [NSFont userFontOfSize:12]; [self resetFont];
[self resetParagraphStyle];
ASSIGN(fontName, [font familyName]);
fontSize = 12.0;
italic = NO;
bold = NO;
underline = NO;
script = 0;
paragraph = [NSMutableParagraphStyle defaultParagraphStyle];
changed = YES;
return self; return self;
} }
@ -150,8 +141,53 @@ readNSString(StringContext *ctxt)
traits: traits traits: traits
weight: weight weight: weight
size: fontSize]; size: fontSize];
if (font == nil)
{
NSDebugMLLog(@"RTFParser",
@"Could not find font %@ size %f traits %d weight %d",
fontName, fontSize, traits, weight);
font = [NSFont userFontOfSize: fontSize];
}
return font; return font;
} }
- (NSNumber*) script
{
return [NSNumber numberWithInt: script];
}
- (NSNumber*) underline
{
if (underline)
return [NSNumber numberWithInt: NSSingleUnderlineStyle];
else
return nil;
}
- (void) resetParagraphStyle
{
ASSIGN(paragraph, [NSMutableParagraphStyle defaultParagraphStyle]);
changed = YES;
}
- (void) resetFont
{
NSFont *font = [NSFont userFontOfSize:12];
ASSIGN(fontName, [font familyName]);
fontSize = 12.0;
italic = NO;
bold = NO;
underline = NO;
script = 0;
DESTROY(fgColour);
DESTROY(bgColour);
changed = YES;
}
@end @end
@ -163,15 +199,15 @@ readNSString(StringContext *ctxt)
NSMutableArray *colours; NSMutableArray *colours;
NSMutableArray *attrs; NSMutableArray *attrs;
NSMutableAttributedString *result; NSMutableAttributedString *result;
int textPosition;
int ignore; int ignore;
} }
- (NSDictionary*) documentAttributes; - (NSDictionary*) documentAttributes;
- (NSAttributedString*) result;
- (RTFAttribute*) attr; - (RTFAttribute*) attr;
- (void) push; - (void) push;
- (void) pop; - (void) pop;
- (NSAttributedString*) result;
@end @end
@ -179,16 +215,12 @@ readNSString(StringContext *ctxt)
- (id) init - (id) init
{ {
RTFAttribute *attr = [RTFAttribute new];
textPosition = 0;
ignore = 0; ignore = 0;
result = [[NSMutableAttributedString alloc] init]; result = nil;
ASSIGN(documentAttributes, [NSMutableDictionary dictionary]); documentAttributes = nil;
ASSIGN(fonts, [NSMutableDictionary dictionary]); fonts = nil;
ASSIGN(attrs, [NSMutableArray array]); attrs = nil;
ASSIGN(colours, [NSMutableArray array]); colours = nil;
[attrs addObject: attr];
return self; return self;
} }
@ -209,6 +241,20 @@ readNSString(StringContext *ctxt)
return AUTORELEASE(documentAttributes); return AUTORELEASE(documentAttributes);
} }
- (void) reset
{
RTFAttribute *attr = [RTFAttribute new];
ignore = 0;
DESTROY(result);
result = [[NSMutableAttributedString alloc] init];
ASSIGN(documentAttributes, [NSMutableDictionary dictionary]);
ASSIGN(fonts, [NSMutableDictionary dictionary]);
ASSIGN(attrs, [NSMutableArray array]);
ASSIGN(colours, [NSMutableArray array]);
[attrs addObject: attr];
}
- (RTFAttribute*) attr - (RTFAttribute*) attr
{ {
return [attrs lastObject]; return [attrs lastObject];
@ -240,9 +286,8 @@ readNSString(StringContext *ctxt)
initWithData: rtfData initWithData: rtfData
encoding: NSASCIIStringEncoding]; encoding: NSASCIIStringEncoding];
// Has this RFTConsumer allready been used? Is so, reset! // Reset this RFTConsumer, as it might already have been used!
if (textPosition) [self reset];
[self init];
initStringContext(&stringCtxt, rtfString); initStringContext(&stringCtxt, rtfString);
lexInitContext(&scanner, &stringCtxt, (int (*)(void*))readNSString); lexInitContext(&scanner, &stringCtxt, (int (*)(void*))readNSString);
@ -268,7 +313,7 @@ readNSString(StringContext *ctxt)
#define COLOURS ((RTFConsumer *)ctxt)->colours #define COLOURS ((RTFConsumer *)ctxt)->colours
#define RESULT ((RTFConsumer *)ctxt)->result #define RESULT ((RTFConsumer *)ctxt)->result
#define IGNORE ((RTFConsumer *)ctxt)->ignore #define IGNORE ((RTFConsumer *)ctxt)->ignore
#define TEXTPOSITION ((RTFConsumer *)ctxt)->textPosition #define TEXTPOSITION [RESULT length]
#define DOCUMENTATTRIBUTES ((RTFConsumer*)ctxt)->documentAttributes #define DOCUMENTATTRIBUTES ((RTFConsumer*)ctxt)->documentAttributes
#define CTXT [((RTFConsumer *)ctxt) attr] #define CTXT [((RTFConsumer *)ctxt) attr]
@ -288,20 +333,23 @@ readNSString(StringContext *ctxt)
#define TOPMARGIN @"TopMargin" #define TOPMARGIN @"TopMargin"
#define BUTTOMMARGIN @"ButtomMargin" #define BUTTOMMARGIN @"ButtomMargin"
/*
we must implement from the rtfConsumerFunctions.h file (Supporting files)
this includes the yacc error handling and output
*/
/* handle errors (this is the yacc error mech) */ /* handle errors (this is the yacc error mech) */
void GSRTFerror(const char *msg) void GSRTFerror(const char *msg)
{ {
[NSException raise:NSInvalidArgumentException [NSException raise:NSInvalidArgumentException
format:@"Syntax error in RTF:%s", msg]; format:@"Syntax error in RTF: %s", msg];
} }
void GSRTFgenericRTFcommand(void *ctxt, RTFcmd cmd) void GSRTFgenericRTFcommand(void *ctxt, RTFcmd cmd)
{ {
NSLog(@"encountered rtf cmd:%s", cmd.name); NSDebugLLog(@"RTFParser", @"encountered rtf cmd:%s", cmd.name);
if (cmd.isEmpty) if (!cmd.isEmpty)
NSLog(@" argument is empty\n"); NSDebugLLog(@"RTFParser", @" argument is %d\n", cmd.parameter);
else
NSLog(@" argument is %d\n", cmd.parameter);
} }
//Start: we're doing some initialization //Start: we're doing some initialization
@ -338,26 +386,33 @@ void GSRTFmangleText(void *ctxt, const char *text)
{ {
int oldPosition = TEXTPOSITION; int oldPosition = TEXTPOSITION;
int textlen = strlen(text); int textlen = strlen(text);
int newPosition = oldPosition + textlen;
NSRange insertionRange = NSMakeRange(oldPosition,0); NSRange insertionRange = NSMakeRange(oldPosition,0);
NSDictionary *attributes; NSMutableDictionary *attributes;
NSFont *font;
if (!IGNORE && textlen) if (!IGNORE && textlen)
{ {
TEXTPOSITION = newPosition;
[RESULT replaceCharactersInRange: insertionRange [RESULT replaceCharactersInRange: insertionRange
withString: [NSString stringWithCString:text]]; withString: [NSString stringWithCString:text]];
if (CHANGED) if (CHANGED)
{ {
font = [CTXT currentFont]; attributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
attributes = [NSDictionary dictionaryWithObjectsAndKeys: [CTXT currentFont], NSFontAttributeName,
font, NSFontAttributeName, PARAGRAPH, NSParagraphStyleAttributeName,
SCRIPT, NSSuperscriptAttributeName, nil];
PARAGRAPH, NSParagraphStyleAttributeName, if (UNDERLINE)
nil]; [attributes setObject: [CTXT underline]
forKey: NSUnderlineStyleAttributeName];
if (SCRIPT)
[attributes setObject: [CTXT script]
forKey: NSSuperscriptAttributeName];
if (FGCOLOUR != nil)
[attributes setObject: FGCOLOUR
forKey: NSForegroundColorAttributeName];
if (BGCOLOUR != nil)
[attributes setObject: BGCOLOUR
forKey: NSBackgroundColorAttributeName];
[RESULT setAttributes: attributes range: [RESULT setAttributes: attributes range:
NSMakeRange(oldPosition, textlen)]; NSMakeRange(oldPosition, textlen)];
CHANGED = NO; CHANGED = NO;
@ -373,8 +428,8 @@ void GSRTFregisterFont(void *ctxt, const char *fontName,
if (!fontName || !*fontName) if (!fontName || !*fontName)
{ {
[NSException raise:NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format:@"Error in RTF (font omitted?), position:%d", format: @"Error in RTF (font omitted?), position:%d",
TEXTPOSITION]; TEXTPOSITION];
} }
// exclude trailing ';' from fontName // exclude trailing ';' from fontName
@ -510,6 +565,33 @@ void GSRTFleftIndent(void *ctxt, int indent)
} }
} }
void GSRTFrightIndent(void *ctxt, int indent)
{
NSMutableParagraphStyle *para = PARAGRAPH;
float findent = twips2points(indent);
// for attributed strings only positiv indent is allowed
if ((findent >= 0.0) && ([para tailIndent] != findent))
{
[para setTailIndent: findent];
CHANGED = YES;
}
}
void GSRTFtabstop(void *ctxt, int location)
{
/*
NSMutableParagraphStyle *para = PARAGRAPH;
float flocation = twips2points(location);
if (flocation >= 0.0))
{
//[para addTab: flocation];
CHANGED = YES;
}
*/
}
void GSRTFalignCenter(void *ctxt) void GSRTFalignCenter(void *ctxt)
{ {
NSMutableParagraphStyle *para = PARAGRAPH; NSMutableParagraphStyle *para = PARAGRAPH;
@ -543,6 +625,12 @@ void GSRTFalignRight(void *ctxt)
} }
} }
void GSRTFdefaultParagraph(void *ctxt)
{
GSRTFmangleText(ctxt, "\n");
[CTXT resetParagraphStyle];
}
void GSRTFstyle(void *ctxt, int style) void GSRTFstyle(void *ctxt, int style)
{ {
} }

View file

@ -88,12 +88,18 @@ void GSRTFmarginButtom(void *ctxt, int margin);
void GSRTFfirstLineIndent(void *ctxt, int indent); void GSRTFfirstLineIndent(void *ctxt, int indent);
/* set left indent */ /* set left indent */
void GSRTFleftIndent(void *ctxt, int indent); void GSRTFleftIndent(void *ctxt, int indent);
/* set right indent */
void GSRTFrightIndent(void *ctxt, int indent);
/* set tabstop */
void GSRTFtabstop(void *ctxt, int location);
/* set center alignment */ /* set center alignment */
void GSRTFalignCenter(void *ctxt); void GSRTFalignCenter(void *ctxt);
/* set left alignment */ /* set left alignment */
void GSRTFalignLeft(void *ctxt); void GSRTFalignLeft(void *ctxt);
/* set right alignment */ /* set right alignment */
void GSRTFalignRight(void *ctxt); void GSRTFalignRight(void *ctxt);
/* set default paragraph style */
void GSRTFdefaultParagraph(void *ctxt);
/* set paragraph style */ /* set paragraph style */
void GSRTFstyle(void *ctxt, int style); void GSRTFstyle(void *ctxt, int style);
/* Add a colour to the colour table*/ /* Add a colour to the colour table*/

View file

@ -43,31 +43,33 @@
#define RTFmarginButtom 284 #define RTFmarginButtom 284
#define RTFfirstLineIndent 285 #define RTFfirstLineIndent 285
#define RTFleftIndent 286 #define RTFleftIndent 286
#define RTFalignCenter 287 #define RTFrightIndent 287
#define RTFalignLeft 288 #define RTFalignCenter 288
#define RTFalignRight 289 #define RTFalignLeft 289
#define RTFstyle 290 #define RTFalignRight 290
#define RTFbold 291 #define RTFstyle 291
#define RTFitalic 292 #define RTFbold 292
#define RTFunderline 293 #define RTFitalic 293
#define RTFunderlineStop 294 #define RTFunderline 294
#define RTFsubscript 295 #define RTFunderlineStop 295
#define RTFsuperscript 296 #define RTFsubscript 296
#define RTFtabulator 297 #define RTFsuperscript 297
#define RTFparagraph 298 #define RTFtabulator 298
#define RTFdefaultParagraph 299 #define RTFtabstop 299
#define RTFfcharset 300 #define RTFparagraph 300
#define RTFfprq 301 #define RTFdefaultParagraph 301
#define RTFcpg 302 #define RTFfcharset 302
#define RTFOtherStatement 303 #define RTFfprq 303
#define RTFfontListStart 304 #define RTFcpg 304
#define RTFfamilyNil 305 #define RTFOtherStatement 305
#define RTFfamilyRoman 306 #define RTFfontListStart 306
#define RTFfamilySwiss 307 #define RTFfamilyNil 307
#define RTFfamilyModern 308 #define RTFfamilyRoman 308
#define RTFfamilyScript 309 #define RTFfamilySwiss 309
#define RTFfamilyDecor 310 #define RTFfamilyModern 310
#define RTFfamilyTech 311 #define RTFfamilyScript 311
#define RTFfamilyDecor 312
#define RTFfamilyTech 313
#line 35 "Parsers/rtfGrammer.y" #line 35 "Parsers/rtfGrammer.y"
@ -137,11 +139,11 @@ typedef
#define YYFINAL 107 #define YYFINAL 110
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 60 #define YYNTBASE 62
#define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 83) #define YYTRANSLATE(x) ((unsigned)(x) <= 313 ? yytranslate[x] : 85)
static const char yytranslate[] = { 0, static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@ -153,10 +155,10 @@ static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 57, 2, 58, 2, 2, 2, 2, 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@ -175,7 +177,7 @@ static const char yytranslate[] = { 0,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56 56, 57, 58
}; };
#if YYDEBUG != 0 #if YYDEBUG != 0
@ -185,47 +187,47 @@ static const short yyprhs[] = { 0,
55, 61, 62, 68, 69, 75, 76, 82, 83, 89, 55, 61, 62, 68, 69, 75, 76, 82, 83, 89,
92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110,
112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130,
132, 134, 136, 138, 143, 144, 147, 152, 157, 158, 132, 134, 136, 138, 140, 142, 144, 149, 150, 153,
161, 164, 167, 170, 172, 174, 176, 178, 180, 182, 158, 163, 164, 167, 170, 173, 176, 178, 180, 182,
184, 189, 190, 193, 198, 200 184, 186, 188, 190, 195, 196, 199, 204, 206
}; };
static const short yyrhs[] = { -1, static const short yyrhs[] = { -1,
0, 57, 61, 4, 63, 64, 62, 58, 0, 5, 0, 59, 63, 4, 65, 66, 64, 60, 0, 5,
0, 6, 0, 7, 0, 8, 0, 0, 64, 75, 0, 6, 0, 7, 0, 8, 0, 0, 66, 77,
0, 64, 80, 0, 64, 74, 0, 64, 3, 0, 0, 66, 82, 0, 66, 76, 0, 66, 3, 0,
64, 65, 0, 0, 57, 66, 64, 58, 0, 0, 66, 67, 0, 0, 59, 68, 66, 60, 0, 0,
57, 67, 9, 64, 58, 0, 0, 57, 68, 10, 59, 69, 9, 66, 60, 0, 0, 59, 70, 10,
64, 58, 0, 0, 57, 69, 11, 64, 58, 0, 66, 60, 0, 0, 59, 71, 11, 66, 60, 0,
0, 57, 70, 12, 64, 58, 0, 0, 57, 71, 0, 59, 72, 12, 66, 60, 0, 0, 59, 73,
13, 64, 58, 0, 0, 57, 72, 14, 64, 58, 13, 66, 60, 0, 0, 59, 74, 14, 66, 60,
0, 0, 57, 73, 15, 64, 58, 0, 57, 58, 0, 0, 59, 75, 15, 66, 60, 0, 59, 60,
0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26,
0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31,
0, 32, 0, 33, 0, 34, 0, 35, 0, 19, 0, 32, 0, 44, 0, 33, 0, 34, 0, 35,
0, 20, 0, 40, 0, 41, 0, 36, 0, 37, 0, 46, 0, 36, 0, 19, 0, 20, 0, 41,
0, 38, 0, 39, 0, 48, 0, 57, 49, 76, 0, 42, 0, 37, 0, 38, 0, 39, 0, 40,
58, 0, 0, 76, 77, 0, 76, 57, 77, 58, 0, 50, 0, 59, 51, 78, 60, 0, 0, 78,
0, 22, 79, 78, 3, 0, 0, 78, 45, 0, 79, 0, 78, 59, 79, 60, 0, 22, 81, 80,
78, 46, 0, 78, 47, 0, 78, 65, 0, 50, 3, 0, 0, 80, 47, 0, 80, 48, 0, 80,
0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 49, 0, 80, 67, 0, 52, 0, 53, 0, 54,
0, 56, 0, 57, 21, 81, 58, 0, 0, 81, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59,
82, 0, 16, 17, 18, 3, 0, 3, 0, 59, 21, 83, 60, 0, 0, 83, 84, 0, 16, 17,
0 18, 3, 0, 3, 0, 61, 0
}; };
#endif #endif
#if YYDEBUG != 0 #if YYDEBUG != 0
static const short yyrline[] = { 0, static const short yyrline[] = { 0,
142, 142, 143, 145, 146, 147, 148, 151, 152, 153, 144, 144, 145, 147, 148, 149, 150, 153, 154, 155,
154, 155, 156, 159, 159, 160, 160, 161, 161, 162, 156, 157, 158, 161, 161, 162, 162, 163, 163, 164,
162, 163, 163, 164, 164, 165, 165, 166, 166, 167, 164, 165, 165, 166, 166, 167, 167, 168, 168, 169,
175, 182, 189, 196, 203, 210, 217, 224, 231, 238, 177, 184, 191, 198, 205, 212, 219, 226, 233, 240,
245, 246, 247, 248, 249, 256, 263, 270, 277, 284, 247, 254, 261, 262, 263, 264, 265, 266, 273, 280,
291, 298, 299, 306, 309, 310, 311, 317, 321, 322, 287, 294, 301, 308, 315, 316, 323, 326, 327, 328,
323, 324, 325, 329, 331, 332, 333, 334, 335, 336, 334, 338, 339, 340, 341, 342, 346, 348, 349, 350,
344, 347, 348, 352, 357, 367 351, 352, 353, 361, 364, 365, 369, 374, 384
}; };
#endif #endif
@ -237,27 +239,27 @@ static const char * const yytname[] = { "$","error","$undefined.","RTFtext",
"RTFfootnote","RTFheader","RTFfooter","RTFpict","RTFred","RTFgreen","RTFblue", "RTFfootnote","RTFheader","RTFfooter","RTFpict","RTFred","RTFgreen","RTFblue",
"RTFcolorbg","RTFcolorfg","RTFcolortable","RTFfont","RTFfontSize","RTFpaperWidth", "RTFcolorbg","RTFcolorfg","RTFcolortable","RTFfont","RTFfontSize","RTFpaperWidth",
"RTFpaperHeight","RTFmarginLeft","RTFmarginRight","RTFmarginTop","RTFmarginButtom", "RTFpaperHeight","RTFmarginLeft","RTFmarginRight","RTFmarginTop","RTFmarginButtom",
"RTFfirstLineIndent","RTFleftIndent","RTFalignCenter","RTFalignLeft","RTFalignRight", "RTFfirstLineIndent","RTFleftIndent","RTFrightIndent","RTFalignCenter","RTFalignLeft",
"RTFstyle","RTFbold","RTFitalic","RTFunderline","RTFunderlineStop","RTFsubscript", "RTFalignRight","RTFstyle","RTFbold","RTFitalic","RTFunderline","RTFunderlineStop",
"RTFsuperscript","RTFtabulator","RTFparagraph","RTFdefaultParagraph","RTFfcharset", "RTFsubscript","RTFsuperscript","RTFtabulator","RTFtabstop","RTFparagraph","RTFdefaultParagraph",
"RTFfprq","RTFcpg","RTFOtherStatement","RTFfontListStart","RTFfamilyNil","RTFfamilyRoman", "RTFfcharset","RTFfprq","RTFcpg","RTFOtherStatement","RTFfontListStart","RTFfamilyNil",
"RTFfamilySwiss","RTFfamilyModern","RTFfamilyScript","RTFfamilyDecor","RTFfamilyTech", "RTFfamilyRoman","RTFfamilySwiss","RTFfamilyModern","RTFfamilyScript","RTFfamilyDecor",
"'{'","'}'","'\\'","rtfFile","@1","@2","rtfCharset","rtfIngredients","rtfBlock", "RTFfamilyTech","'{'","'}'","'\\'","rtfFile","@1","@2","rtfCharset","rtfIngredients",
"@3","@4","@5","@6","@7","@8","@9","@10","rtfStatement","rtfFontList","rtfFonts", "rtfBlock","@3","@4","@5","@6","@7","@8","@9","@10","rtfStatement","rtfFontList",
"rtfFontStatement","rtfFontAttrs","rtfFontFamily","rtfColorDef","rtfColors", "rtfFonts","rtfFontStatement","rtfFontAttrs","rtfFontFamily","rtfColorDef","rtfColors",
"rtfColorStatement", NULL "rtfColorStatement", NULL
}; };
#endif #endif
static const short yyr1[] = { 0, static const short yyr1[] = { 0,
61, 62, 60, 63, 63, 63, 63, 64, 64, 64, 63, 64, 62, 65, 65, 65, 65, 66, 66, 66,
64, 64, 64, 66, 65, 67, 65, 68, 65, 69, 66, 66, 66, 68, 67, 69, 67, 70, 67, 71,
65, 70, 65, 71, 65, 72, 65, 73, 65, 65, 67, 72, 67, 73, 67, 74, 67, 75, 67, 67,
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
74, 74, 74, 75, 76, 76, 76, 77, 78, 78, 76, 76, 76, 76, 76, 76, 77, 78, 78, 78,
78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 81, 81, 81, 81,
80, 81, 81, 82, 82, -1 81, 81, 81, 82, 83, 83, 84, 84, -1
}; };
static const short yyr2[] = { 0, static const short yyr2[] = { 0,
@ -266,143 +268,147 @@ static const short yyr2[] = { 0,
5, 0, 5, 0, 5, 0, 5, 0, 5, 2, 5, 0, 5, 0, 5, 0, 5, 0, 5, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 4, 0, 2, 4, 4, 0, 2, 1, 1, 1, 1, 1, 1, 4, 0, 2, 4,
2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4, 0, 2, 2, 2, 2, 1, 1, 1, 1,
4, 0, 2, 4, 1, 1 1, 1, 1, 4, 0, 2, 4, 1, 1
}; };
static const short yydefact[] = { 0, static const short yydefact[] = { 0,
1, 0, 0, 4, 5, 6, 7, 8, 2, 12, 1, 0, 0, 4, 5, 6, 7, 8, 2, 12,
45, 46, 31, 32, 33, 34, 35, 36, 37, 38, 48, 49, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 49, 50, 51, 52, 39, 40, 41, 43, 44, 45, 47, 52, 53, 54,
47, 48, 53, 14, 0, 13, 11, 9, 10, 72, 55, 50, 51, 42, 46, 56, 14, 0, 13, 11,
55, 30, 8, 0, 0, 0, 0, 0, 0, 0, 9, 10, 75, 58, 30, 8, 0, 0, 0, 0,
3, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 3, 0, 0, 0, 8, 8, 8,
8, 75, 0, 71, 73, 0, 0, 54, 56, 15, 8, 8, 8, 8, 78, 0, 74, 76, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 64, 65, 57, 59, 15, 0, 0, 0, 0, 0, 0, 0,
66, 67, 68, 69, 70, 59, 0, 17, 19, 21, 0, 67, 68, 69, 70, 71, 72, 73, 62, 0,
23, 25, 27, 29, 0, 0, 57, 74, 58, 60, 17, 19, 21, 23, 25, 27, 29, 0, 0, 60,
61, 62, 14, 63, 0, 0, 0 77, 61, 63, 64, 65, 14, 66, 0, 0, 0
}; };
static const short yydefgoto[] = { 105, static const short yydefgoto[] = { 108,
2, 35, 8, 9, 36, 43, 44, 45, 46, 47, 2, 38, 8, 9, 39, 46, 47, 48, 49, 50,
48, 49, 50, 37, 38, 53, 69, 96, 86, 39, 51, 52, 53, 40, 41, 56, 72, 99, 89, 42,
52, 65 55, 68
}; };
static const short yypact[] = { -56, static const short yypact[] = { -58,
-32768, -2, 44,-32768,-32768,-32768,-32768,-32768, 318,-32768, -32768, -2, 85,-32768,-32768,-32768,-32768,-32768, 333,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768, 358, -55,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 375, -57,-32768,-32768,
-32768,-32768,-32768, -4, 4, 7, 3, 26, 29, 38, -32768,-32768,-32768,-32768,-32768,-32768, -4, 5, -5, 6,
-32768, 316, -16, -3,-32768,-32768,-32768,-32768,-32768,-32768, 33, 38, 36,-32768, 37, -15, -3,-32768,-32768,-32768,
-32768,-32768, 27,-32768,-32768, -43, 57,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 65,-32768,-32768, -44, 32,
37, 77, 117, 157, 197, 237, 277, 63,-32768,-32768, -32768,-32768,-32768, 39, 81, 123, 165, 207, 249, 291,
-32768,-32768,-32768,-32768,-32768,-32768, 24,-32768,-32768,-32768, 68,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 27,
-32768,-32768,-32768,-32768, 80, 1,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 52, 1,-32768,
-32768,-32768, 278,-32768, 84, 86,-32768 -32768,-32768,-32768,-32768,-32768, 334,-32768, 88, 94,-32768
}; };
static const short yypgoto[] = {-32768, static const short yypgoto[] = {-32768,
-32768,-32768,-32768, 333, -9,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 345, 3,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 21,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 25,-32768,-32768,-32768,
-32768,-32768 -32768,-32768
}; };
#define YYLAST 416 #define YYLAST 435
static const short yytable[] = { 10, static const short yytable[] = { 10,
1, 3, 51, 99, 55, 66, 79, 80, 81, 82, 1, 3, 54, 102, 58, 60, 69, 82, 83, 84,
83, 84, 85, 56, 58, 11, 12, 57, 13, 14, 85, 86, 87, 88, 59, 11, 12, 61, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 59, 10, 25, 26, 27, 28, 29, 30, 31, 32, 33, 65,
67, 68, 60, 78, 33, 100, 101, 102, 4, 5, 34, 10, 35, 70, 71, 62, 36, 103, 104, 105,
6, 7, 61, 34, 70, 11, 12, 103, 13, 14, 64, 63, 66, 69, 101, 37, 73, 11, 12, 106,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 81, 34, 10, 35, 98, 100, 109, 36, 4,
5, 6, 7, 110, 90, 0, 67, 37, 91, 11,
12, 107, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 0, 34, 10, 35, 0, 0, 0,
36, 0, 0, 0, 0, 0, 0, 0, 0, 37,
92, 11, 12, 0, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 0, 34, 10, 35, 0,
0, 0, 36, 0, 0, 0, 0, 0, 0, 0,
0, 37, 93, 11, 12, 0, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 0, 34, 10,
35, 0, 0, 0, 36, 0, 0, 0, 0, 0,
0, 0, 0, 37, 94, 11, 12, 0, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 66, 10, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0,
95, 97, 98, 106, 33, 107, 104, 87, 0, 0, 34, 10, 35, 0, 0, 0, 36, 0, 0, 0,
0, 0, 0, 34, 88, 11, 12, 0, 13, 14, 0, 0, 0, 0, 0, 37, 95, 11, 12, 0,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
25, 26, 27, 28, 29, 30, 31, 32, 0, 10, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 33, 0, 34, 10, 35, 0, 0, 0, 36, 0,
0, 0, 0, 34, 89, 11, 12, 0, 13, 14, 0, 0, 0, 0, 0, 0, 0, 37, 96, 11,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, 0, 13, 14, 15, 16, 17, 18, 19, 20,
25, 26, 27, 28, 29, 30, 31, 32, 0, 10, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 31, 32, 33, 0, 34, 10, 35, 0, 0, 0,
0, 0, 0, 34, 90, 11, 12, 0, 13, 14, 36, 0, -16, -18, -20, -22, -24, -26, -28, 37,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 97, 11, 12, 0, 13, 14, 15, 16, 17, 18,
25, 26, 27, 28, 29, 30, 31, 32, 0, 10, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 0, 34, 0, 35, 0,
0, 0, 0, 34, 91, 11, 12, 0, 13, 14, 0, 0, 36, -16, -18, -20, -22, -24, -26, -28,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 57, 37, 0, 45, 0, 43, 0, 0, 0, 0,
25, 26, 27, 28, 29, 30, 31, 32, 0, 10, 0, 0, 74, 75, 76, 77, 78, 79, 80, 0,
0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 34, 92, 11, 12, 0, 13, 14, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, 0, 45
25, 26, 27, 28, 29, 30, 31, 32, 0, 10,
0, 0, 0, 0, 33, 0, -16, -18, -20, -22,
-24, -26, -28, 34, 93, 11, 12, 0, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 62, 0,
10, 0, 0, 0, 33, 0, 0, 0, 0, 0,
0, 63, 0, 34, 94, 42, 11, 12, 0, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 0,
0, 0, 0, 0, 0, 33, -16, -18, -20, -22,
-24, -26, -28, 64, 34, 54, 0, 0, 40, 0,
0, 0, 0, 0, 0, 0, 0, 71, 72, 73,
74, 75, 76, 77, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 41, 0, 0, 0,
0, 0, 0, 0, 0, 42
}; };
static const short yycheck[] = { 3, static const short yycheck[] = { 3,
57, 4, 58, 3, 9, 22, 50, 51, 52, 53, 59, 4, 60, 3, 9, 11, 22, 52, 53, 54,
54, 55, 56, 10, 12, 19, 20, 11, 22, 23, 55, 56, 57, 58, 10, 19, 20, 12, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 13, 3, 34, 35, 36, 37, 38, 39, 40, 41, 42, 3,
57, 58, 14, 17, 48, 45, 46, 47, 5, 6, 44, 3, 46, 59, 60, 13, 50, 47, 48, 49,
7, 8, 15, 57, 58, 19, 20, 57, 22, 23, 15, 14, 16, 22, 3, 59, 60, 19, 20, 59,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 17, 44, 3, 46, 18, 60, 0, 50, 5,
6, 7, 8, 0, 70, -1, 60, 59, 60, 19,
20, 99, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, -1, 44, 3, 46, -1, -1, -1,
50, -1, -1, -1, -1, -1, -1, -1, -1, 59,
60, 19, 20, -1, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, -1, 44, 3, 46, -1,
-1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
-1, 59, 60, 19, 20, -1, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, -1, 44, 3,
46, -1, -1, -1, 50, -1, -1, -1, -1, -1,
-1, -1, -1, 59, 60, 19, 20, -1, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 22, 3, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
18, 58, 3, 0, 48, 0, 96, 67, -1, -1, 44, 3, 46, -1, -1, -1, 50, -1, -1, -1,
-1, -1, -1, 57, 58, 19, 20, -1, 22, 23, -1, -1, -1, -1, -1, 59, 60, 19, 20, -1,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
34, 35, 36, 37, 38, 39, 40, 41, -1, 3, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
-1, -1, -1, -1, 48, -1, -1, -1, -1, -1, 42, -1, 44, 3, 46, -1, -1, -1, 50, -1,
-1, -1, -1, 57, 58, 19, 20, -1, 22, 23, -1, -1, -1, -1, -1, -1, -1, 59, 60, 19,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 20, -1, 22, 23, 24, 25, 26, 27, 28, 29,
34, 35, 36, 37, 38, 39, 40, 41, -1, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
-1, -1, -1, -1, 48, -1, -1, -1, -1, -1, 40, 41, 42, -1, 44, 3, 46, -1, -1, -1,
-1, -1, -1, 57, 58, 19, 20, -1, 22, 23, 50, -1, 9, 10, 11, 12, 13, 14, 15, 59,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 60, 19, 20, -1, 22, 23, 24, 25, 26, 27,
34, 35, 36, 37, 38, 39, 40, 41, -1, 3, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
-1, -1, -1, -1, 48, -1, -1, -1, -1, -1, 38, 39, 40, 41, 42, -1, 44, -1, 46, -1,
-1, -1, -1, 57, 58, 19, 20, -1, 22, 23, -1, -1, 50, 9, 10, 11, 12, 13, 14, 15,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 46, 59, -1, 60, -1, 21, -1, -1, -1, -1,
34, 35, 36, 37, 38, 39, 40, 41, -1, 3, -1, -1, 58, 59, 60, 61, 62, 63, 64, -1,
-1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 57, 58, 19, 20, -1, 22, 23, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, -1, -1, -1, -1, 60
34, 35, 36, 37, 38, 39, 40, 41, -1, 3,
-1, -1, -1, -1, 48, -1, 9, 10, 11, 12,
13, 14, 15, 57, 58, 19, 20, -1, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 3, -1,
3, -1, -1, -1, 48, -1, -1, -1, -1, -1,
-1, 16, -1, 57, 58, 58, 19, 20, -1, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
-1, -1, -1, -1, -1, 48, 9, 10, 11, 12,
13, 14, 15, 58, 57, 43, -1, -1, 21, -1,
-1, -1, -1, -1, -1, -1, -1, 55, 56, 57,
58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
-1, -1, -1, -1, -1, 58
}; };
#define YYPURE 1 #define YYPURE 1
@ -906,99 +912,99 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 1: case 1:
#line 142 "Parsers/rtfGrammer.y" #line 144 "Parsers/rtfGrammer.y"
{ GSRTFstart(ctxt); ; { GSRTFstart(ctxt); ;
break;} break;}
case 2: case 2:
#line 142 "Parsers/rtfGrammer.y" #line 144 "Parsers/rtfGrammer.y"
{ GSRTFstop(ctxt); ; { GSRTFstop(ctxt); ;
break;} break;}
case 4: case 4:
#line 145 "Parsers/rtfGrammer.y" #line 147 "Parsers/rtfGrammer.y"
{ yyval.number = 1; ; { yyval.number = 1; ;
break;} break;}
case 5: case 5:
#line 146 "Parsers/rtfGrammer.y" #line 148 "Parsers/rtfGrammer.y"
{ yyval.number = 2; ; { yyval.number = 2; ;
break;} break;}
case 6: case 6:
#line 147 "Parsers/rtfGrammer.y" #line 149 "Parsers/rtfGrammer.y"
{ yyval.number = 3; ; { yyval.number = 3; ;
break;} break;}
case 7: case 7:
#line 148 "Parsers/rtfGrammer.y" #line 150 "Parsers/rtfGrammer.y"
{ yyval.number = 4; ; { yyval.number = 4; ;
break;} break;}
case 12: case 12:
#line 155 "Parsers/rtfGrammer.y" #line 157 "Parsers/rtfGrammer.y"
{ GSRTFmangleText(ctxt, yyvsp[0].text); free((void *)yyvsp[0].text); ; { GSRTFmangleText(ctxt, yyvsp[0].text); free((void *)yyvsp[0].text); ;
break;} break;}
case 14: case 14:
#line 159 "Parsers/rtfGrammer.y" #line 161 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, NO); ; { GSRTFopenBlock(ctxt, NO); ;
break;} break;}
case 15: case 15:
#line 159 "Parsers/rtfGrammer.y" #line 161 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, NO); ; { GSRTFcloseBlock(ctxt, NO); ;
break;} break;}
case 16: case 16:
#line 160 "Parsers/rtfGrammer.y" #line 162 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 17: case 17:
#line 160 "Parsers/rtfGrammer.y" #line 162 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 18: case 18:
#line 161 "Parsers/rtfGrammer.y" #line 163 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 19: case 19:
#line 161 "Parsers/rtfGrammer.y" #line 163 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 20: case 20:
#line 162 "Parsers/rtfGrammer.y" #line 164 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 21: case 21:
#line 162 "Parsers/rtfGrammer.y" #line 164 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 22: case 22:
#line 163 "Parsers/rtfGrammer.y" #line 165 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 23: case 23:
#line 163 "Parsers/rtfGrammer.y" #line 165 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 24: case 24:
#line 164 "Parsers/rtfGrammer.y" #line 166 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 25: case 25:
#line 164 "Parsers/rtfGrammer.y" #line 166 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 26: case 26:
#line 165 "Parsers/rtfGrammer.y" #line 167 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 27: case 27:
#line 165 "Parsers/rtfGrammer.y" #line 167 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 28: case 28:
#line 166 "Parsers/rtfGrammer.y" #line 168 "Parsers/rtfGrammer.y"
{ GSRTFopenBlock(ctxt, YES); ; { GSRTFopenBlock(ctxt, YES); ;
break;} break;}
case 29: case 29:
#line 166 "Parsers/rtfGrammer.y" #line 168 "Parsers/rtfGrammer.y"
{ GSRTFcloseBlock(ctxt, YES); ; { GSRTFcloseBlock(ctxt, YES); ;
break;} break;}
case 31: case 31:
#line 175 "Parsers/rtfGrammer.y" #line 177 "Parsers/rtfGrammer.y"
{ int font; { int font;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1008,7 +1014,7 @@ case 31:
GSRTFfontNumber(ctxt, font); ; GSRTFfontNumber(ctxt, font); ;
break;} break;}
case 32: case 32:
#line 182 "Parsers/rtfGrammer.y" #line 184 "Parsers/rtfGrammer.y"
{ int size; { int size;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1018,7 +1024,7 @@ case 32:
GSRTFfontSize(ctxt, size); ; GSRTFfontSize(ctxt, size); ;
break;} break;}
case 33: case 33:
#line 189 "Parsers/rtfGrammer.y" #line 191 "Parsers/rtfGrammer.y"
{ int width; { int width;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1028,7 +1034,7 @@ case 33:
GSRTFpaperWidth(ctxt, width);; GSRTFpaperWidth(ctxt, width);;
break;} break;}
case 34: case 34:
#line 196 "Parsers/rtfGrammer.y" #line 198 "Parsers/rtfGrammer.y"
{ int height; { int height;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1038,7 +1044,7 @@ case 34:
GSRTFpaperHeight(ctxt, height);; GSRTFpaperHeight(ctxt, height);;
break;} break;}
case 35: case 35:
#line 203 "Parsers/rtfGrammer.y" #line 205 "Parsers/rtfGrammer.y"
{ int margin; { int margin;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1048,7 +1054,7 @@ case 35:
GSRTFmarginLeft(ctxt, margin);; GSRTFmarginLeft(ctxt, margin);;
break;} break;}
case 36: case 36:
#line 210 "Parsers/rtfGrammer.y" #line 212 "Parsers/rtfGrammer.y"
{ int margin; { int margin;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1058,7 +1064,7 @@ case 36:
GSRTFmarginRight(ctxt, margin); ; GSRTFmarginRight(ctxt, margin); ;
break;} break;}
case 37: case 37:
#line 217 "Parsers/rtfGrammer.y" #line 219 "Parsers/rtfGrammer.y"
{ int margin; { int margin;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1068,7 +1074,7 @@ case 37:
GSRTFmarginTop(ctxt, margin); ; GSRTFmarginTop(ctxt, margin); ;
break;} break;}
case 38: case 38:
#line 224 "Parsers/rtfGrammer.y" #line 226 "Parsers/rtfGrammer.y"
{ int margin; { int margin;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1078,7 +1084,7 @@ case 38:
GSRTFmarginButtom(ctxt, margin); ; GSRTFmarginButtom(ctxt, margin); ;
break;} break;}
case 39: case 39:
#line 231 "Parsers/rtfGrammer.y" #line 233 "Parsers/rtfGrammer.y"
{ int indent; { int indent;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1088,7 +1094,7 @@ case 39:
GSRTFfirstLineIndent(ctxt, indent); ; GSRTFfirstLineIndent(ctxt, indent); ;
break;} break;}
case 40: case 40:
#line 238 "Parsers/rtfGrammer.y" #line 240 "Parsers/rtfGrammer.y"
{ int indent; { int indent;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1098,23 +1104,47 @@ case 40:
GSRTFleftIndent(ctxt, indent);; GSRTFleftIndent(ctxt, indent);;
break;} break;}
case 41: case 41:
#line 245 "Parsers/rtfGrammer.y" #line 247 "Parsers/rtfGrammer.y"
{ GSRTFalignCenter(ctxt); ; { int indent;
if (yyvsp[0].cmd.isEmpty)
indent = 0;
else
indent = yyvsp[0].cmd.parameter;
GSRTFrightIndent(ctxt, indent);;
break;} break;}
case 42: case 42:
#line 246 "Parsers/rtfGrammer.y" #line 254 "Parsers/rtfGrammer.y"
{ GSRTFalignLeft(ctxt); ; { int location;
if (yyvsp[0].cmd.isEmpty)
location = 0;
else
location = yyvsp[0].cmd.parameter;
GSRTFtabstop(ctxt, location);;
break;} break;}
case 43: case 43:
#line 247 "Parsers/rtfGrammer.y" #line 261 "Parsers/rtfGrammer.y"
{ GSRTFalignRight(ctxt); ; { GSRTFalignCenter(ctxt); ;
break;} break;}
case 44: case 44:
#line 248 "Parsers/rtfGrammer.y" #line 262 "Parsers/rtfGrammer.y"
{ GSRTFstyle(ctxt, yyvsp[0].cmd.parameter); ; { GSRTFalignLeft(ctxt); ;
break;} break;}
case 45: case 45:
#line 249 "Parsers/rtfGrammer.y" #line 263 "Parsers/rtfGrammer.y"
{ GSRTFalignRight(ctxt); ;
break;}
case 46:
#line 264 "Parsers/rtfGrammer.y"
{ GSRTFdefaultParagraph(ctxt); ;
break;}
case 47:
#line 265 "Parsers/rtfGrammer.y"
{ GSRTFstyle(ctxt, yyvsp[0].cmd.parameter); ;
break;}
case 48:
#line 266 "Parsers/rtfGrammer.y"
{ int color; { int color;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1123,8 +1153,8 @@ case 45:
color = yyvsp[0].cmd.parameter; color = yyvsp[0].cmd.parameter;
GSRTFcolorbg(ctxt, color); ; GSRTFcolorbg(ctxt, color); ;
break;} break;}
case 46: case 49:
#line 256 "Parsers/rtfGrammer.y" #line 273 "Parsers/rtfGrammer.y"
{ int color; { int color;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1133,8 +1163,8 @@ case 46:
color = yyvsp[0].cmd.parameter; color = yyvsp[0].cmd.parameter;
GSRTFcolorfg(ctxt, color); ; GSRTFcolorfg(ctxt, color); ;
break;} break;}
case 47: case 50:
#line 263 "Parsers/rtfGrammer.y" #line 280 "Parsers/rtfGrammer.y"
{ int script; { int script;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1143,8 +1173,8 @@ case 47:
script = yyvsp[0].cmd.parameter; script = yyvsp[0].cmd.parameter;
GSRTFsubscript(ctxt, script); ; GSRTFsubscript(ctxt, script); ;
break;} break;}
case 48: case 51:
#line 270 "Parsers/rtfGrammer.y" #line 287 "Parsers/rtfGrammer.y"
{ int script; { int script;
if (yyvsp[0].cmd.isEmpty) if (yyvsp[0].cmd.isEmpty)
@ -1153,8 +1183,8 @@ case 48:
script = yyvsp[0].cmd.parameter; script = yyvsp[0].cmd.parameter;
GSRTFsuperscript(ctxt, script); ; GSRTFsuperscript(ctxt, script); ;
break;} break;}
case 49: case 52:
#line 277 "Parsers/rtfGrammer.y" #line 294 "Parsers/rtfGrammer.y"
{ BOOL on; { BOOL on;
if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter) if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter)
@ -1163,8 +1193,8 @@ case 49:
on = NO; on = NO;
GSRTFbold(ctxt, on); ; GSRTFbold(ctxt, on); ;
break;} break;}
case 50: case 53:
#line 284 "Parsers/rtfGrammer.y" #line 301 "Parsers/rtfGrammer.y"
{ BOOL on; { BOOL on;
if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter) if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter)
@ -1173,8 +1203,8 @@ case 50:
on = NO; on = NO;
GSRTFitalic(ctxt, on); ; GSRTFitalic(ctxt, on); ;
break;} break;}
case 51: case 54:
#line 291 "Parsers/rtfGrammer.y" #line 308 "Parsers/rtfGrammer.y"
{ BOOL on; { BOOL on;
if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter) if (yyvsp[0].cmd.isEmpty || yyvsp[0].cmd.parameter)
@ -1183,63 +1213,63 @@ case 51:
on = NO; on = NO;
GSRTFunderline(ctxt, on); ; GSRTFunderline(ctxt, on); ;
break;} break;}
case 52: case 55:
#line 298 "Parsers/rtfGrammer.y" #line 315 "Parsers/rtfGrammer.y"
{ GSRTFunderline(ctxt, NO); ; { GSRTFunderline(ctxt, NO); ;
break;} break;}
case 53: case 56:
#line 299 "Parsers/rtfGrammer.y" #line 316 "Parsers/rtfGrammer.y"
{ GSRTFgenericRTFcommand(ctxt, yyvsp[0].cmd); ; { GSRTFgenericRTFcommand(ctxt, yyvsp[0].cmd); ;
break;} break;}
case 58: case 61:
#line 317 "Parsers/rtfGrammer.y" #line 334 "Parsers/rtfGrammer.y"
{ GSRTFregisterFont(ctxt, yyvsp[0].text, yyvsp[-2].number, yyvsp[-3].cmd.parameter); { GSRTFregisterFont(ctxt, yyvsp[0].text, yyvsp[-2].number, yyvsp[-3].cmd.parameter);
free((void *)yyvsp[0].text); ; free((void *)yyvsp[0].text); ;
break;} break;}
case 64: case 67:
#line 330 "Parsers/rtfGrammer.y" #line 347 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyNil - RTFfamilyNil; ; { yyval.number = RTFfamilyNil - RTFfamilyNil; ;
break;} break;}
case 65: case 68:
#line 331 "Parsers/rtfGrammer.y" #line 348 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyRoman - RTFfamilyNil; ; { yyval.number = RTFfamilyRoman - RTFfamilyNil; ;
break;} break;}
case 66: case 69:
#line 332 "Parsers/rtfGrammer.y" #line 349 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilySwiss - RTFfamilyNil; ; { yyval.number = RTFfamilySwiss - RTFfamilyNil; ;
break;} break;}
case 67: case 70:
#line 333 "Parsers/rtfGrammer.y" #line 350 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyModern - RTFfamilyNil; ; { yyval.number = RTFfamilyModern - RTFfamilyNil; ;
break;} break;}
case 68: case 71:
#line 334 "Parsers/rtfGrammer.y" #line 351 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyScript - RTFfamilyNil; ; { yyval.number = RTFfamilyScript - RTFfamilyNil; ;
break;} break;}
case 69: case 72:
#line 335 "Parsers/rtfGrammer.y" #line 352 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyDecor - RTFfamilyNil; ; { yyval.number = RTFfamilyDecor - RTFfamilyNil; ;
break;} break;}
case 70: case 73:
#line 336 "Parsers/rtfGrammer.y" #line 353 "Parsers/rtfGrammer.y"
{ yyval.number = RTFfamilyTech - RTFfamilyNil; ; { yyval.number = RTFfamilyTech - RTFfamilyNil; ;
break;} break;}
case 74: case 77:
#line 353 "Parsers/rtfGrammer.y" #line 370 "Parsers/rtfGrammer.y"
{ {
GSRTFaddColor(ctxt, yyvsp[-3].cmd.parameter, yyvsp[-2].cmd.parameter, yyvsp[-1].cmd.parameter); GSRTFaddColor(ctxt, yyvsp[-3].cmd.parameter, yyvsp[-2].cmd.parameter, yyvsp[-1].cmd.parameter);
free((void *)yyvsp[0].text); free((void *)yyvsp[0].text);
; ;
break;} break;}
case 75: case 78:
#line 358 "Parsers/rtfGrammer.y" #line 375 "Parsers/rtfGrammer.y"
{ {
GSRTFaddDefaultColor(ctxt); GSRTFaddDefaultColor(ctxt);
free((void *)yyvsp[0].text); free((void *)yyvsp[0].text);
; ;
break;} break;}
case 76: case 79:
#line 367 "Parsers/rtfGrammer.y" #line 384 "Parsers/rtfGrammer.y"
{ yylsp[0].first_line; ; { yylsp[0].first_line; ;
break;} break;}
} }
@ -1440,7 +1470,7 @@ yyerrhandle:
yystate = yyn; yystate = yyn;
goto yynewstate; goto yynewstate;
} }
#line 370 "Parsers/rtfGrammer.y" #line 387 "Parsers/rtfGrammer.y"
/* some C code here */ /* some C code here */

View file

@ -49,29 +49,31 @@ typedef
#define RTFmarginButtom 284 #define RTFmarginButtom 284
#define RTFfirstLineIndent 285 #define RTFfirstLineIndent 285
#define RTFleftIndent 286 #define RTFleftIndent 286
#define RTFalignCenter 287 #define RTFrightIndent 287
#define RTFalignLeft 288 #define RTFalignCenter 288
#define RTFalignRight 289 #define RTFalignLeft 289
#define RTFstyle 290 #define RTFalignRight 290
#define RTFbold 291 #define RTFstyle 291
#define RTFitalic 292 #define RTFbold 292
#define RTFunderline 293 #define RTFitalic 293
#define RTFunderlineStop 294 #define RTFunderline 294
#define RTFsubscript 295 #define RTFunderlineStop 295
#define RTFsuperscript 296 #define RTFsubscript 296
#define RTFtabulator 297 #define RTFsuperscript 297
#define RTFparagraph 298 #define RTFtabulator 298
#define RTFdefaultParagraph 299 #define RTFtabstop 299
#define RTFfcharset 300 #define RTFparagraph 300
#define RTFfprq 301 #define RTFdefaultParagraph 301
#define RTFcpg 302 #define RTFfcharset 302
#define RTFOtherStatement 303 #define RTFfprq 303
#define RTFfontListStart 304 #define RTFcpg 304
#define RTFfamilyNil 305 #define RTFOtherStatement 305
#define RTFfamilyRoman 306 #define RTFfontListStart 306
#define RTFfamilySwiss 307 #define RTFfamilyNil 307
#define RTFfamilyModern 308 #define RTFfamilyRoman 308
#define RTFfamilyScript 309 #define RTFfamilySwiss 309
#define RTFfamilyDecor 310 #define RTFfamilyModern 310
#define RTFfamilyTech 311 #define RTFfamilyScript 311
#define RTFfamilyDecor 312
#define RTFfamilyTech 313

View file

@ -103,6 +103,7 @@ typedef void * GSRTFctxt;
%token <cmd> RTFmarginButtom %token <cmd> RTFmarginButtom
%token <cmd> RTFfirstLineIndent %token <cmd> RTFfirstLineIndent
%token <cmd> RTFleftIndent %token <cmd> RTFleftIndent
%token <cmd> RTFrightIndent
%token <cmd> RTFalignCenter %token <cmd> RTFalignCenter
%token <cmd> RTFalignLeft %token <cmd> RTFalignLeft
%token <cmd> RTFalignRight %token <cmd> RTFalignRight
@ -114,6 +115,7 @@ typedef void * GSRTFctxt;
%token <cmd> RTFsubscript %token <cmd> RTFsubscript
%token <cmd> RTFsuperscript %token <cmd> RTFsuperscript
%token <cmd> RTFtabulator %token <cmd> RTFtabulator
%token <cmd> RTFtabstop
%token <cmd> RTFparagraph %token <cmd> RTFparagraph
%token <cmd> RTFdefaultParagraph %token <cmd> RTFdefaultParagraph
%token <cmd> RTFfcharset %token <cmd> RTFfcharset
@ -242,9 +244,24 @@ rtfStatement: RTFfont { int font;
else else
indent = $1.parameter; indent = $1.parameter;
GSRTFleftIndent(ctxt, indent);} GSRTFleftIndent(ctxt, indent);}
| RTFrightIndent { int indent;
if ($1.isEmpty)
indent = 0;
else
indent = $1.parameter;
GSRTFrightIndent(ctxt, indent);}
| RTFtabstop { int location;
if ($1.isEmpty)
location = 0;
else
location = $1.parameter;
GSRTFtabstop(ctxt, location);}
| RTFalignCenter { GSRTFalignCenter(ctxt); } | RTFalignCenter { GSRTFalignCenter(ctxt); }
| RTFalignLeft { GSRTFalignLeft(ctxt); } | RTFalignLeft { GSRTFalignLeft(ctxt); }
| RTFalignRight { GSRTFalignRight(ctxt); } | RTFalignRight { GSRTFalignRight(ctxt); }
| RTFdefaultParagraph { GSRTFdefaultParagraph(ctxt); }
| RTFstyle { GSRTFstyle(ctxt, $1.parameter); } | RTFstyle { GSRTFstyle(ctxt, $1.parameter); }
| RTFcolorbg { int color; | RTFcolorbg { int color;

View file

@ -185,10 +185,12 @@ LexKeyword RTFcommands[]={
"ql", token(RTFalignLeft), "ql", token(RTFalignLeft),
"qr", token(RTFalignRight), "qr", token(RTFalignRight),
"red", token(RTFred), "red", token(RTFred),
"ri", token(RTFrightIndent),
"rtf", token(RTFstart), "rtf", token(RTFstart),
"s", token(RTFstyle), "s", token(RTFstyle),
"stylesheet", token(RTFstylesheet), "stylesheet", token(RTFstylesheet),
"tab", token(RTFtabulator), "tab", token(RTFtabulator),
"tx", token(RTFtabstop),
"ul", token(RTFunderline), "ul", token(RTFunderline),
"ulnone", token(RTFunderlineStop), "ulnone", token(RTFunderlineStop),
"up", token(RTFsuperscript) "up", token(RTFsuperscript)
@ -339,7 +341,7 @@ int GSRTFlex(YYSTYPE *lvalp, YYLTYPE *llocp, RTFscannerCtxt *lctxt) /* provide v
if (probeCommand(lctxt) == YES) if (probeCommand(lctxt) == YES)
{ {
readCommand(lctxt, lvalp, &token); readCommand(lctxt, lvalp, &token);
if (token == RTFparagraph || token == RTFdefaultParagraph) if (token == RTFparagraph)
{ {
// release is up to the consumer // release is up to the consumer
cv = calloc(1, 2); cv = calloc(1, 2);