Merge branch 'master' into master

This commit is contained in:
Sergii Stoian 2020-01-28 14:46:26 +02:00 committed by GitHub
commit 71056e625a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1812 additions and 1900 deletions

View file

@ -11,6 +11,32 @@
updates window position, set new screen object and saves frame if
autosave name exists.
2020-01-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXib5KeyedUnarchiver.m: Remove NSWindowTemplate5.
* Source/GSXibLoader.m: Clean up code.
* Headers/Additions/GNUstepGUI/GSXibKeyedUnarchiver.h,
* Source/GSXibKeyedUnarchiver.m: Provide method to load both sorts
of XIB files.
* Source/NSArrayController.m: Add horrible hack to get KVB on
array controller to work.
2020-01-22 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXib5KeyedUnarchiver.m,
* Headers/Additions/GNUstepGUI/GSNibLoading.h,
* Source/GSXibLoading.m: Move toolbar ivar from NSWindowTemplate5
to NSWindowTemplate.
2020-01-22 Fred Kiefer <FredKiefer@gmx.de>
* TextConverters/RTF/rtfScanner.m: Add RTFansicpg.
* TextConverters/RTF/rtfGrammar.y: Handle encoding and code pages.
* TextConverters/RTF/rtfGrammar.tab.h,
* TextConverters/RTF/rtfGrammar.tab.m: Regenerated.
* TextConverters/RTF/RTFConsumerFunctions.h,
* TextConverters/RTF/RTFConsumer.m: Add code to handle encoding.
2020-01-20 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSAppearance.h,

View file

@ -143,6 +143,7 @@ typedef struct _GSWindowTemplateFlags
GSWindowTemplateFlags _flags;
NSString *_autosaveName;
Class _baseWindowClass;
NSToolbar *_toolbar;
}
- (id) initWithWindow: (NSWindow *)window
className: (NSString *)windowClass

View file

@ -43,6 +43,9 @@
NSMutableDictionary *decoded;
}
+ (BOOL) checkXib5: (NSData *)data;
+ (NSKeyedUnarchiver *) unarchiverForReadingWithData: (NSData *)data;
- (void) _initCommon;
- (id) decodeObjectForXib: (GSXibElement*)element
forClassName: (NSString*)classname

View file

@ -424,6 +424,11 @@ static BOOL _isInInterfaceBuilder = NO;
_windowStyle |= NSTitledWindowMask;
}
if ([coder containsValueForKey: @"NSToolbar"])
{
_toolbar = [coder decodeObjectForKey: @"NSToolbar"];
}
_baseWindowClass = [NSWindow class];
}
else
@ -455,6 +460,7 @@ static BOOL _isInInterfaceBuilder = NO;
[aCoder encodeRect: rect forKey: @"NSWindowRect"];
[aCoder encodeObject: _title forKey: @"NSWindowTitle"];
[aCoder encodeObject: _autosaveName forKey: @"NSFrameAutosaveName"];
[aCoder encodeObject: _toolbar forKey: @"NSToolbar"];
}
}
@ -514,6 +520,10 @@ static BOOL _isInInterfaceBuilder = NO;
// FIXME: No idea what is going on here
[_realObject setToolbar: (NSToolbar*)_viewClass];
}
if (_toolbar)
{
[_realObject setToolbar: _toolbar];
}
[_realObject setContentMinSize: _minSize];
[_realObject setContentMaxSize: _maxSize];

View file

@ -113,59 +113,6 @@ static NSString *ApplicationClass = nil;
@end
@interface NSWindowTemplate5 : NSWindowTemplate
{
BOOL _visibleAtLaunch;
NSToolbar *_toolbar;
}
@end
@implementation NSWindowTemplate5
- (id) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if (self)
{
_visibleAtLaunch = YES;
if ([coder containsValueForKey: @"visibleAtLaunch"])
_visibleAtLaunch = [coder decodeBoolForKey: @"visibleAtLaunch"];
if ([coder containsValueForKey: @"NSToolbar"])
{
_toolbar = [coder decodeObjectForKey: @"NSToolbar"];
}
}
return self;
}
- (id) nibInstantiate
{
if (_realObject == nil)
{
// Instantiate the real object...
[super nibInstantiate];
if (_toolbar)
{
[(NSWindow *)_realObject setToolbar: _toolbar];
}
// >= XIB 5 - startup visible windows...
if (_visibleAtLaunch)
{
// bring visible windows to front...
[(NSWindow *)_realObject orderFront: self];
}
}
return _realObject;
}
@end
@interface IBActionConnection5 : IBActionConnection
{
NSString *trigger;
@ -369,7 +316,7 @@ static NSArray *XmlBoolDefaultYes = nil;
@"IBOutletConnection5", @"outlet",
@"IBActionConnection5", @"action",
@"NSNibBindingConnector", @"binding",
@"NSWindowTemplate5", @"window",
@"NSWindowTemplate", @"window",
@"NSView", @"tableCellView",
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
nil];
@ -635,12 +582,12 @@ static NSArray *XmlBoolDefaultYes = nil;
// The parent of connections array element is the object ID we need...
GSXibElement *parent = [stack objectAtIndex: [stack count] - 1];
NSString *parentId = [parent attributeForKey: @"id"];
NSString *objKey = [@"IBActionConnection5" isEqualToString: [element attributeForKey: @"class"]] ?
NSString *objKey = [@"action" isEqualToString: [element attributeForKey: @"key"]] ?
@"destination" : @"source";
if (parentId == nil)
{
NSLog(@"Missing parent Id for connection on parent @%", parent);
NSLog(@"Missing parent Id for connection on parent %@", parent);
// Fake an id for parent
parentId = [[NSUUID UUID] UUIDString];
[parent setAttribute: parentId forKey: @"id"];
@ -709,9 +656,14 @@ static NSArray *XmlBoolDefaultYes = nil;
return AUTORELEASE(objectRecord);
}
- (void) addRuntimeAttributesForElement: (GSXibElement*)element forID: (NSString*)idString
- (NSString*) getRefIDFor: (GSXibElement*)element postFix: (NSString*)postfix
{
id orderedObject = [_orderedObjectsDict objectForKey: [element attributeForKey: @"id"]];
return [NSString stringWithFormat: @"%@.%@", [orderedObject attributeForKey: @"id"], postfix];
}
- (void) addRuntimeAttributesForElement: (GSXibElement*)element forID: (NSString*)refID
{
NSString *refID = [NSString stringWithFormat: @"%@.IBAttributePlaceholdersKey", idString];
GSXibElement *objectRecord = (GSXibElement*)[_flattenedProperties elementForKey: refID];
// Mimic the old IBAttributePlaceholders instance...
@ -2955,8 +2907,24 @@ didStartElement: (NSString*)elementName
{
// Create the flattened property data for the runtime attributes in the OLD XIB format...
id runtimeAttributes = [element elementForKey: @"userDefinedRuntimeAttributes"];
id orderedObject = [_orderedObjectsDict objectForKey: [element attributeForKey: @"id"]];
[self addRuntimeAttributesForElement: runtimeAttributes forID: [orderedObject attributeForKey: @"id"]];
NSString *refID = [self getRefIDFor: element postFix: @"%IBAttributePlaceholdersKey"];
[self addRuntimeAttributesForElement: runtimeAttributes forID: refID];
}
else if ([[element attributeForKey: @"key"] isEqualToString: @"window"])
{
NSString *refID = [self getRefIDFor: element postFix: @"NSWindowTemplate.visibleAtLaunch"];
id runtimeAttribute = [[GSXibElement alloc] initWithType: @"string"
andAttributes: nil];
id visibleAtLaunch = [element attributeForKey: @"visibleAtLaunch"];
if (visibleAtLaunch == nil)
{
visibleAtLaunch = @"YES";
}
[runtimeAttribute setValue: visibleAtLaunch];
[_flattenedProperties setElement: runtimeAttribute forKey: refID];
}
return object;

View file

@ -34,12 +34,55 @@
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSXMLDocument.h>
#import "GNUstepGUI/GSXibKeyedUnarchiver.h"
#import "GNUstepGUI/GSXibElement.h"
#import "GNUstepGUI/GSNibLoading.h"
#import "GSXib5KeyedUnarchiver.h"
@implementation GSXibKeyedUnarchiver
+ (BOOL) checkXib5: (NSData *)data
{
#if GNUSTEP_BASE_HAVE_LIBXML
// Ensure we have a XIB 5 version...first see if we can parse the XML...
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData: data
options: 0
error: NULL];
if (document == nil)
{
return NO;
}
else
{
// Test to see if this is an Xcode 5 XIB...
NSArray *documentNodes = [document nodesForXPath: @"/document" error: NULL];
// Need at LEAST ONE document node...we should find something a bit more
// specific to check here...
return [documentNodes count] != 0;
}
#else
// We now default to checking XIB 5 versions
return YES;
#endif
}
+ (NSKeyedUnarchiver *) unarchiverForReadingWithData: (NSData *)data
{
NSKeyedUnarchiver *unarchiver = nil;
if ([self checkXib5: data])
{
unarchiver = [[GSXib5KeyedUnarchiver alloc] initForReadingWithData: data];
}
else
{
unarchiver = [[GSXibKeyedUnarchiver alloc] initForReadingWithData: data];
}
return AUTORELEASE(unarchiver);
}
- (NSData *) _preProcessXib: (NSData *)data
{
NSData *result = data;

View file

@ -35,7 +35,6 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSXMLDocument.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSMenu.h"
@ -44,7 +43,6 @@
#import "GNUstepGUI/GSNibLoading.h"
#import "GNUstepGUI/GSXibLoading.h"
#import "GNUstepGUI/GSXibKeyedUnarchiver.h"
#import "GSXib5KeyedUnarchiver.h"
@interface NSApplication (NibCompatibility)
- (void) _setMainMenu: (NSMenu*)aMenu;
@ -85,14 +83,11 @@
- (void) awake: (NSArray *)rootObjects
withContext: (NSDictionary *)context
{
NSEnumerator *en;
id obj;
NSMutableArray *topLevelObjects = [context objectForKey: NSNibTopLevelObjects];
id owner = [context objectForKey: NSNibOwner];
id first = nil;
id app = nil;
NSCustomObject *object;
NSString *className;
NSEnumerator *en;
id obj;
NSUInteger index = 0;
if ([rootObjects count] == 0)
{
@ -100,42 +95,21 @@
return;
}
// Get the file's owner and NSApplication object references...
object = (NSCustomObject*)[rootObjects objectAtIndex: 1];
if ([[object className] isEqualToString: @"FirstResponder"])
{
first = [object realObject];
}
else
{
NSLog(@"%s:first responder missing\n", __PRETTY_FUNCTION__);
}
object = (NSCustomObject*)[rootObjects objectAtIndex: 2];
className = [object className];
if ([className isEqualToString: @"NSApplication"] ||
[NSClassFromString(className) isSubclassOfClass:[NSApplication class]])
{
app = [object realObject];
}
else
{
NSLog(@"%s:NSApplication missing '%@'\n", __PRETTY_FUNCTION__, className);
}
// Use the owner as first root object
[(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner];
en = [rootObjects objectEnumerator];
while ((obj = [en nextObject]) != nil)
{
index++;
if ([obj respondsToSelector: @selector(nibInstantiate)])
{
obj = [obj nibInstantiate];
}
// IGNORE file's owner, first responder and NSApplication instances...
if ((obj != nil) && (obj != owner) && (obj != first) && (obj != app))
if ((obj != nil) && (index > 3))
{
[topLevelObjects addObject: obj];
// All top level objects must be released by the caller to avoid
@ -166,51 +140,17 @@
}
}
- (BOOL) checkXib5: (NSData *)data
{
#if GNUSTEP_BASE_HAVE_LIBXML
// Ensure we have a XIB 5 version...first see if we can parse the XML...
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData: data
options: 0
error: NULL];
if (document == nil)
{
return NO;
}
else
{
// Test to see if this is an Xcode 5 XIB...
NSArray *documentNodes = [document nodesForXPath: @"/document" error: NULL];
// Need at LEAST ONE document node...we should find something a bit more
// specific to check here...
return [documentNodes count] != 0;
}
#else
// We now default to checking XIB 5 versions
return YES;
#endif
}
- (BOOL) loadModelData: (NSData *)data
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone;
{
BOOL loaded = NO;
NSKeyedUnarchiver *unarchiver = nil;
NS_DURING
{
if (data != nil)
{
if ([self checkXib5: data])
{
unarchiver = [[GSXib5KeyedUnarchiver alloc] initForReadingWithData: data];
}
else
{
unarchiver = [[GSXibKeyedUnarchiver alloc] initForReadingWithData: data];
}
NSKeyedUnarchiver *unarchiver = [GSXibKeyedUnarchiver unarchiverForReadingWithData: data];
if (unarchiver != nil)
{
@ -226,7 +166,6 @@
inContainer: objects
withContext: context];
loaded = YES;
RELEASE(unarchiver);
}
else
{
@ -241,7 +180,6 @@
NS_HANDLER
{
NSLog(@"Exception occurred while loading model: %@",[localException reason]);
// TEST_RELEASE(unarchiver);
}
NS_ENDHANDLER

View file

@ -2,7 +2,7 @@
<abstract>Controller class for arrays</abstract>
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
Copyright <copy>(C) 2006, 2020 Free Software Foundation, Inc.</copy>
Author: Fred Kiefer <fredkiefer@gmx.de>
Date: June 2006
@ -88,7 +88,11 @@
if ([result isKindOfClass: [NSArray class]])
{
return AUTORELEASE([[GSObservableArray alloc]
// FIXME: Using the correct memory management here
// Leads to an issue inside of KVO. For now we leak the
// object until this gets fixed.
//return AUTORELEASE([[GSObservableArray alloc]
return ([[GSObservableArray alloc]
initWithArray: result]);
}
@ -152,7 +156,6 @@
{
if ((self = [super initWithContent: content]) != nil)
{
[self rearrangeObjects];
[self setSelectsInsertedObjects: YES];
}
@ -187,8 +190,7 @@
}
else
{
// FIXME: Should check whether _arranged_objects is mutable
ASSIGN(_arranged_objects, [_arranged_objects arrayByAddingObject: obj]);
DESTROY(_arranged_objects);
}
if ([self selectsInsertedObjects])
{
@ -207,8 +209,7 @@
}
else
{
// FIXME: Should check whether _arranged_objects is mutable
ASSIGN(_arranged_objects, [_arranged_objects arrayByAddingObjectsFromArray: obj]);
DESTROY(_arranged_objects);
}
if ([self selectsInsertedObjects])
{
@ -228,8 +229,7 @@
}
else
{
// FIXME
//[_arranged_objects removeObject: obj];
DESTROY(_arranged_objects);
}
[self didChangeValueForKey: NSContentBinding];
}
@ -245,8 +245,7 @@
}
else
{
// FIXME
//[_arranged_objects removeObjectsInArray: obj];
DESTROY(_arranged_objects);
}
[self didChangeValueForKey: NSContentBinding];
}
@ -385,7 +384,7 @@
- (NSArray*) selectedObjects
{
// We make the selection work on the arranged objects
return [_arranged_objects objectsAtIndexes: _selection_indexes];
return [[self arrangedObjects] objectsAtIndexes: _selection_indexes];
}
- (NSUInteger) selectionIndex
@ -472,14 +471,19 @@
- (id) arrangedObjects
{
if (_arranged_objects == nil)
{
[self rearrangeObjects];
}
return _arranged_objects;
}
- (void) rearrangeObjects
{
[self willChangeValueForKey: @"arrangedObjects"];
DESTROY(_arranged_objects);
_arranged_objects = [[GSObservableArray alloc]
initWithArray: [self arrangeObjects: _content]];
initWithArray: [self arrangeObjects: _content]];
[self didChangeValueForKey: @"arrangedObjects"];
}

View file

@ -288,6 +288,7 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
instruction: (NSString*)instruction;
- (void) appendImage: (NSString*) string;
- (void) reset;
- (void) setEncoding: (NSStringEncoding)anEncoding;
@end
@implementation RTFConsumer
@ -545,6 +546,11 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
RELEASE(attr);
}
- (void) setEncoding: (NSStringEncoding)anEncoding
{
encoding = anEncoding;
}
- (RTFAttribute*) attr
{
return [attrs lastObject];
@ -571,7 +577,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
CREATE_AUTORELEASE_POOL(pool);
RTFscannerCtxt scanner;
StringContext stringCtxt;
char buffer[5];
// We read in the first few characters to find out which
// encoding we have
@ -580,26 +585,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
// Too short to be an RTF
return nil;
}
[rtfData getBytes: buffer range: NSMakeRange(7, 3)];
if (strncmp(buffer, "mac", 3) == 0)
{
encoding = NSMacOSRomanStringEncoding;
}
else if (strncmp(buffer, "pc", 2) == 0)
{
// FIXME: Code page 437 kCFStringEncodingDOSLatinUS
encoding = NSISOLatin1StringEncoding;
}
else if (strncmp(buffer, "pca", 3) == 0)
{
// FIXME: Code page 850 kCFStringEncodingDOSLatin1
encoding = NSISOLatin1StringEncoding;
}
else
{
encoding = NSISOLatin1StringEncoding;
}
// Reset this RFTConsumer, as it might already have been used!
_class = class;
@ -1403,3 +1388,42 @@ void GSRTFaddField (void *ctxt, int start, const char *inst)
[(RTFDConsumer *)ctxt appendField: start instruction: fieldInstruction];
DESTROY(fieldInstruction);
}
void GSRTFencoding(void *ctxt, int encoding)
{
switch (encoding)
{
case 1:
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 2:
[(RTFDConsumer *)ctxt setEncoding: NSMacOSRomanStringEncoding];
break;
case 3:
// FIXME: Code page 437 kCFStringEncodingDOSLatinUS
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 4:
// FIXME: Code page 850 kCFStringEncodingDOSLatin1
[(RTFDConsumer *)ctxt setEncoding: NSISOLatin1StringEncoding];
break;
case 1250:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1250StringEncoding];
break;
case 1251:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1251StringEncoding];
break;
case 1252:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1252StringEncoding];
break;
case 1253:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1253StringEncoding];
break;
case 1254:
[(RTFDConsumer *)ctxt setEncoding: NSWindowsCP1254StringEncoding];
break;
default:
NSLog(@"Setting unknown encoding %d", encoding);
break;
}
}

View file

@ -152,5 +152,8 @@ void GSRTFNeXTHelpMarker(void *ctxt, int num, const char *markername);
void GSRTFaddField (void *ctxt, int start, const char *inst);
/* set encoding */
void GSRTFencoding(void *ctxt, int encoding);
#endif

View file

@ -1,19 +1,20 @@
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 3.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -26,13 +27,16 @@
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.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
# define YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
/* Enabling traces. */
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@ -40,153 +44,140 @@
extern int GSRTFdebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
RTFtext = 258,
RTFstart = 259,
RTFansi = 260,
RTFmac = 261,
RTFpc = 262,
RTFpca = 263,
RTFignore = 264,
RTFinfo = 265,
RTFstylesheet = 266,
RTFfootnote = 267,
RTFheader = 268,
RTFfooter = 269,
RTFpict = 270,
RTFplain = 271,
RTFparagraph = 272,
RTFdefaultParagraph = 273,
RTFrow = 274,
RTFcell = 275,
RTFtabulator = 276,
RTFemdash = 277,
RTFendash = 278,
RTFemspace = 279,
RTFenspace = 280,
RTFbullet = 281,
RTFfield = 282,
RTFfldinst = 283,
RTFfldalt = 284,
RTFfldrslt = 285,
RTFflddirty = 286,
RTFfldedit = 287,
RTFfldlock = 288,
RTFfldpriv = 289,
RTFfttruetype = 290,
RTFlquote = 291,
RTFrquote = 292,
RTFldblquote = 293,
RTFrdblquote = 294,
RTFred = 295,
RTFgreen = 296,
RTFblue = 297,
RTFcolorbg = 298,
RTFcolorfg = 299,
RTFunderlinecolor = 300,
RTFcolortable = 301,
RTFfont = 302,
RTFfontSize = 303,
RTFNeXTGraphic = 304,
RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicHeight = 306,
RTFNeXTHelpLink = 307,
RTFNeXTHelpMarker = 308,
RTFNeXTfilename = 309,
RTFNeXTmarkername = 310,
RTFNeXTlinkFilename = 311,
RTFNeXTlinkMarkername = 312,
RTFpaperWidth = 313,
RTFpaperHeight = 314,
RTFmarginLeft = 315,
RTFmarginRight = 316,
RTFmarginTop = 317,
RTFmarginButtom = 318,
RTFfirstLineIndent = 319,
RTFleftIndent = 320,
RTFrightIndent = 321,
RTFalignCenter = 322,
RTFalignJustified = 323,
RTFalignLeft = 324,
RTFalignRight = 325,
RTFlineSpace = 326,
RTFspaceAbove = 327,
RTFstyle = 328,
RTFbold = 329,
RTFitalic = 330,
RTFunderline = 331,
RTFunderlineDot = 332,
RTFunderlineDash = 333,
RTFunderlineDashDot = 334,
RTFunderlineDashDotDot = 335,
RTFunderlineDouble = 336,
RTFunderlineStop = 337,
RTFunderlineThick = 338,
RTFunderlineThickDot = 339,
RTFunderlineThickDash = 340,
RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDotDot = 342,
RTFunderlineWord = 343,
RTFstrikethrough = 344,
RTFstrikethroughDouble = 345,
RTFunichar = 346,
RTFsubscript = 347,
RTFsuperscript = 348,
RTFtabstop = 349,
RTFfcharset = 350,
RTFfprq = 351,
RTFcpg = 352,
RTFOtherStatement = 353,
RTFfontListStart = 354,
RTFfamilyNil = 355,
RTFfamilyRoman = 356,
RTFfamilySwiss = 357,
RTFfamilyModern = 358,
RTFfamilyScript = 359,
RTFfamilyDecor = 360,
RTFfamilyTech = 361,
RTFfamilyBiDi = 362
};
enum yytokentype
{
RTFtext = 258,
RTFstart = 259,
RTFansi = 260,
RTFmac = 261,
RTFpc = 262,
RTFpca = 263,
RTFignore = 264,
RTFinfo = 265,
RTFstylesheet = 266,
RTFfootnote = 267,
RTFheader = 268,
RTFfooter = 269,
RTFpict = 270,
RTFplain = 271,
RTFparagraph = 272,
RTFdefaultParagraph = 273,
RTFrow = 274,
RTFcell = 275,
RTFtabulator = 276,
RTFemdash = 277,
RTFendash = 278,
RTFemspace = 279,
RTFenspace = 280,
RTFbullet = 281,
RTFfield = 282,
RTFfldinst = 283,
RTFfldalt = 284,
RTFfldrslt = 285,
RTFflddirty = 286,
RTFfldedit = 287,
RTFfldlock = 288,
RTFfldpriv = 289,
RTFfttruetype = 290,
RTFlquote = 291,
RTFrquote = 292,
RTFldblquote = 293,
RTFrdblquote = 294,
RTFred = 295,
RTFgreen = 296,
RTFblue = 297,
RTFcolorbg = 298,
RTFcolorfg = 299,
RTFunderlinecolor = 300,
RTFcolortable = 301,
RTFfont = 302,
RTFfontSize = 303,
RTFNeXTGraphic = 304,
RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicHeight = 306,
RTFNeXTHelpLink = 307,
RTFNeXTHelpMarker = 308,
RTFNeXTfilename = 309,
RTFNeXTmarkername = 310,
RTFNeXTlinkFilename = 311,
RTFNeXTlinkMarkername = 312,
RTFpaperWidth = 313,
RTFpaperHeight = 314,
RTFmarginLeft = 315,
RTFmarginRight = 316,
RTFmarginTop = 317,
RTFmarginButtom = 318,
RTFfirstLineIndent = 319,
RTFleftIndent = 320,
RTFrightIndent = 321,
RTFalignCenter = 322,
RTFalignJustified = 323,
RTFalignLeft = 324,
RTFalignRight = 325,
RTFlineSpace = 326,
RTFspaceAbove = 327,
RTFstyle = 328,
RTFbold = 329,
RTFitalic = 330,
RTFunderline = 331,
RTFunderlineDot = 332,
RTFunderlineDash = 333,
RTFunderlineDashDot = 334,
RTFunderlineDashDotDot = 335,
RTFunderlineDouble = 336,
RTFunderlineStop = 337,
RTFunderlineThick = 338,
RTFunderlineThickDot = 339,
RTFunderlineThickDash = 340,
RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDotDot = 342,
RTFunderlineWord = 343,
RTFstrikethrough = 344,
RTFstrikethroughDouble = 345,
RTFunichar = 346,
RTFsubscript = 347,
RTFsuperscript = 348,
RTFtabstop = 349,
RTFfcharset = 350,
RTFfprq = 351,
RTFcpg = 352,
RTFansicpg = 353,
RTFOtherStatement = 354,
RTFfontListStart = 355,
RTFfamilyNil = 356,
RTFfamilyRoman = 357,
RTFfamilySwiss = 358,
RTFfamilyModern = 359,
RTFfamilyScript = 360,
RTFfamilyDecor = 361,
RTFfamilyTech = 362,
RTFfamilyBiDi = 363
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
union YYSTYPE
{
/* Line 2058 of yacc.c */
#line 85 "rtfGrammar.y"
#line 82 "rtfGrammar.y"
int number;
const char *text;
RTFcmd cmd;
#line 172 "rtfGrammar.tab.h"
/* Line 2058 of yacc.c */
#line 171 "rtfGrammar.tab.h"
} YYSTYPE;
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *YYPARSE_PARAM);
#else
int GSRTFparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *ctxt, void *lctxt);
#else
int GSRTFparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@
*/
/* we request for a reentrant parser */
%pure_parser
%define api.pure
%{
@ -60,10 +60,6 @@
/* this context is passed to the interface functions */
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 YYLEX_PARAM lctxt
/*#undef YYLSP_NEEDED*/
#define CTXT ctxt
@ -81,6 +77,7 @@ int fieldStart = 0;
%parse-param {void *ctxt}
%parse-param {void *lctxt}
%lex-param {void *lctxt}
%union {
int number;
@ -184,6 +181,7 @@ int fieldStart = 0;
%token <cmd> RTFfcharset
%token <cmd> RTFfprq
%token <cmd> RTFcpg
%token <cmd> RTFansicpg
%token <cmd> RTFOtherStatement
%token RTFfontListStart
@ -209,11 +207,11 @@ int fieldStart = 0;
rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfIngredients { GSRTFstop(CTXT); } '}'
;
/* FIXME: This should change the used encoding */
rtfCharset: RTFansi { $$ = 1; }
| RTFmac { $$ = 2; }
| RTFpc { $$ = 3; }
| RTFpca { $$ = 4; }
rtfCharset: RTFansi { GSRTFencoding(CTXT, 1); }
| RTFmac { GSRTFencoding(CTXT, 2); }
| RTFpc { GSRTFencoding(CTXT, $$ = 3); }
| RTFpca { GSRTFencoding(CTXT, 4); }
| rtfCharset RTFansicpg { GSRTFencoding(CTXT, $2.parameter); }
;
rtfIngredients: /* empty */

View file

@ -163,6 +163,7 @@ LexKeyword RTFcommands[] =
{"NeXTHelpLink",token(RTFNeXTHelpLink)},
{"NeXTHelpMarker",token(RTFNeXTHelpMarker)},
{"ansi", token(RTFansi)},
{"ansicpg", token(RTFansicpg)},
{"b", token(RTFbold)},
{"blue", token(RTFblue)},
{"bullet", token(RTFbullet)},