fixed writing rtfd documents

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22907 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicolas Roard 2006-05-11 23:47:20 +00:00
parent 4306661eda
commit 12989e49e5
4 changed files with 76 additions and 56 deletions

View file

@ -1,3 +1,10 @@
2006-05-12 Nicolas Roard <nicolas@roard.com>
* TextConverters/RTF/RTFProducer.m: fixed the saving of the embedded
files by using -lastPathComponent
* TextConverters/RTF/rtfGrammer.tab.c:
* TextConverters/RTF/rtfGrammer.y: modified the parser to be more
flexible (and thus it can now read rtfd produced by gnustep)
2006-05-11 Nicolas Roard <nicolas@roard.com>
* TextConverters/RTF: added support for reading RTFD documents

View file

@ -101,6 +101,7 @@
filename = [fileWrapper filename] ? [fileWrapper filename]
: [fileWrapper preferredFilename];
filename = [filename lastPathComponent];
[fileDict setObject: fileWrapper forKey: filename];
}
@ -952,7 +953,7 @@
cellSize = [[attachment attachmentCell] cellSize];
[result appendString: @"{{\\NeXTGraphic "];
[result appendString: attachmentFilename];
[result appendString: [attachmentFilename lastPathComponent]];
[result appendFormat: @" \\width%d \\height%d}",
(short)points2twips(cellSize.width),
(short)points2twips(cellSize.height)];

View file

@ -399,7 +399,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 4
#define YYLAST 734
#define YYLAST 799
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 80
@ -493,7 +493,7 @@ static const yysigned_char yyrhs[] =
18, -1, 57, -1, 34, -1, 35, -1, 63, -1,
64, -1, 58, -1, 59, -1, 60, -1, 61, -1,
62, -1, 16, -1, 17, -1, 19, -1, 69, -1,
78, 78, 39, 3, 40, 41, 79, 3, 79, -1,
78, 78, 39, 3, 40, 41, 79, 85, 79, -1,
78, 70, 98, 79, -1, -1, 98, 99, -1, 98,
78, 99, 79, -1, 98, 78, 99, 86, 3, 79,
-1, 37, 101, 100, 3, -1, -1, 100, 66, -1,
@ -613,7 +613,7 @@ static const unsigned char yydefact[] =
0, 0, 0, 0, 0, 0, 0, 0, 80, 81,
82, 83, 84, 85, 86, 75, 0, 0, 21, 23,
25, 27, 29, 31, 33, 0, 0, 0, 72, 0,
0, 90, 74, 76, 77, 78, 79, 0, 0, 73,
0, 90, 74, 76, 77, 78, 79, 0, 10, 73,
0, 68
};
@ -627,31 +627,31 @@ static const yysigned_char yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -88
#define YYPACT_NINF -79
static const short yypact[] =
{
-77, -88, 7, 28, -88, -2, -88, -88, -88, -88,
-88, -88, 135, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -1, -41,
-88, -88, -88, -88, -88, -40, -88, -88, -11, -88,
31, 56, 59, 60, 61, 80, 81, -88, -88, 62,
64, 72, 200, -88, -88, -88, -88, -88, -88, -88,
-88, 44, -88, -88, -51, 58, -88, -88, 57, -88,
265, 330, 395, 460, 525, 590, 655, 65, -88, -88,
-88, -88, -88, -88, -88, -88, -48, 68, -88, -88,
-88, -88, -88, -88, -88, 96, 24, 70, -88, 97,
27, -88, -88, -88, -88, -88, -88, 32, 100, -88,
66, -88
-77, -79, 6, 3, -79, 89, -79, -79, -79, -79,
-79, -79, 135, -79, -79, -79, -79, -79, -79, -79,
-79, -79, -79, -79, -79, -79, -79, -79, -79, -79,
-79, -79, -79, -79, -79, -79, -79, -79, -79, -79,
-79, -79, -79, -79, -79, -79, -79, -79, -1, -53,
-79, -79, -79, -79, -79, -50, -79, -79, -9, -79,
22, 29, 21, 28, 53, 56, 52, -79, -79, 62,
64, 69, 200, -79, -79, -79, -79, -79, -79, -79,
-79, 43, -79, -79, 88, 39, -79, -79, 58, -79,
265, 330, 395, 460, 525, 590, 655, 66, -79, -79,
-79, -79, -79, -79, -79, -79, -75, 59, -79, -79,
-79, -79, -79, -79, -79, 100, 24, 70, -79, 103,
30, -79, -79, -79, -79, -79, -79, 31, -79, -79,
720, -79
};
/* YYPGOTO[NTERM-NUM]. */
static const yysigned_char yypgoto[] =
{
-88, -88, -88, -88, -88, 85, -87, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, 25,
-88, -88, -88, -88, -88
-79, -79, -79, -79, -79, -54, -78, -79, -79, -79,
-79, -79, -79, -79, -79, -79, -79, -79, -79, 26,
-79, -79, -79, -79, -79
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@ -661,23 +661,23 @@ static const yysigned_char yypgoto[] =
#define YYTABLE_NINF -33
static const short yytable[] =
{
55, 1, -18, 6, 7, 8, 9, 4, -20, -22,
-24, -26, -28, -30, -32, -18, -18, -18, -18, 119,
98, 99, 100, 101, 102, 103, 104, 122, 71, 126,
117, 118, 5, -18, -18, 56, -18, -18, 67, 68,
73, -18, -18, -18, -18, -18, -18, -18, -18, -18,
55, 1, -18, 117, 118, 72, 4, 5, -20, -22,
-24, -26, -28, -30, -32, -18, -18, -18, -18, 90,
91, 92, 93, 94, 95, 96, 67, 122, 119, 68,
71, 73, 75, -18, -18, 56, -18, -18, 126, 74,
76, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -18, -18, -18, -18, 80, 74, 10, -18, 57,
75, 55, 76, -18, 77, 88, 97, 58, -18, -20,
-18, -18, -18, -18, -18, 80, 77, 79, -18, 57,
78, 55, 88, -18, 130, 97, 84, 58, -18, -20,
-22, -24, -26, -28, -30, -32, -18, -18, -18, -18,
123, 124, 125, 81, 78, 84, 79, 107, 115, 121,
127, 84, 117, 130, -18, -18, 128, -18, -18, 120,
106, 129, -18, -18, -18, -18, -18, -18, -18, -18,
123, 124, 125, 81, 6, 7, 8, 9, 107, 115,
120, 84, 117, 121, -18, -18, 127, -18, -18, 128,
129, 106, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -18, -18, -18, -18, -18, 13, 0, 14, -18,
0, 82, 85, 86, 72, 131, 0, 0, -18, -18,
0, 15, 16, 17, 18, 0, 0, 0, 90, 91,
92, 93, 94, 95, 96, 0, 0, 0, 0, 19,
0, 82, 85, 86, 0, 0, 0, 0, -18, -18,
0, 15, 16, 17, 18, 0, 0, 0, 10, 98,
99, 100, 101, 102, 103, 104, 0, 0, 0, 19,
20, 0, 21, 22, 0, 0, 0, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
@ -733,29 +733,35 @@ static const short yytable[] =
20, 0, 21, 22, 0, 0, 0, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 0, 0, 0, 47, 0, 0, 0, 0, 0,
0, 0, 0, 48, 114
46, 13, 0, 14, 47, 0, 0, 0, 0, 0,
0, 0, 0, 48, 114, 0, 15, 16, 17, 18,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 19, 20, 0, 21, 22, 0,
0, 0, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 0, 0, 0, 47,
0, 0, 0, 0, 0, 0, 0, 0, 48, 131
};
static const yysigned_char yycheck[] =
static const short yycheck[] =
{
1, 78, 3, 5, 6, 7, 8, 0, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 106,
71, 72, 73, 74, 75, 76, 77, 3, 39, 116,
78, 79, 4, 34, 35, 36, 37, 38, 79, 79,
9, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1, 78, 3, 78, 79, 59, 0, 4, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 73,
74, 75, 76, 77, 78, 79, 79, 3, 106, 79,
39, 9, 11, 34, 35, 36, 37, 38, 116, 10,
12, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 3, 10, 69, 69, 70,
11, 1, 12, 3, 13, 3, 32, 78, 79, 9,
61, 62, 63, 64, 65, 3, 13, 15, 69, 70,
14, 1, 3, 3, 128, 32, 37, 78, 79, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
66, 67, 68, 31, 14, 37, 15, 40, 33, 3,
3, 37, 78, 3, 34, 35, 79, 37, 38, 41,
85, 79, 42, 43, 44, 45, 46, 47, 48, 49,
66, 67, 68, 31, 5, 6, 7, 8, 40, 33,
41, 37, 78, 3, 34, 35, 3, 37, 38, 79,
79, 85, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 1, -1, 3, 69,
-1, 79, 78, 79, 59, 79, -1, -1, 78, 79,
-1, 16, 17, 18, 19, -1, -1, -1, 73, 74,
75, 76, 77, 78, 79, -1, -1, -1, -1, 34,
-1, 79, 78, 79, -1, -1, -1, -1, 78, 79,
-1, 16, 17, 18, 19, -1, -1, -1, 69, 71,
72, 73, 74, 75, 76, 77, -1, -1, -1, 34,
35, -1, 37, 38, -1, -1, -1, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
@ -811,8 +817,14 @@ static const yysigned_char yycheck[] =
35, -1, 37, 38, -1, -1, -1, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, -1, -1, -1, 69, -1, -1, -1, -1, -1,
-1, -1, -1, 78, 79
65, 1, -1, 3, 69, -1, -1, -1, -1, -1,
-1, -1, -1, 78, 79, -1, 16, 17, 18, 19,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 34, 35, -1, 37, 38, -1,
-1, -1, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, -1, -1, -1, 69,
-1, -1, -1, -1, -1, -1, -1, -1, 78, 79
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@ -832,7 +844,7 @@ static const unsigned char yystos[] =
73, 74, 75, 76, 77, 101, 99, 40, 79, 79,
79, 79, 79, 79, 79, 33, 100, 78, 79, 86,
41, 3, 3, 66, 67, 68, 86, 3, 79, 79,
3, 79
85, 79
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@ -1865,7 +1877,7 @@ yyreduce:
}
/* Line 1016 of /usr/local/share/bison/yacc.c. */
#line 1869 "rtfGrammer.tab.c"
#line 1881 "rtfGrammer.tab.c"
yyvsp -= yylen;
yyssp -= yylen;

View file

@ -364,7 +364,7 @@ rtfStatement: RTFfont { int font;
NeXTGraphic (images)
*/
rtfNeXTGraphic: '{' '{' RTFNeXTGraphic RTFtext RTFNeXTGraphicWidth RTFNeXTGraphicHeight '}' RTFtext '}'
rtfNeXTGraphic: '{' '{' RTFNeXTGraphic RTFtext RTFNeXTGraphicWidth RTFNeXTGraphicHeight '}' rtfIngredients '}'
{
GSRTFNeXTGraphic (CTXT, $4, $5.parameter, $6.parameter);
};