configuration for replying and forwarding
[claws.git] / src / quote_fmt.tab.c
1
2 /*  A Bison parser, made from quote_fmt.y
3     by GNU Bison version 1.28  */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define yyparse quote_fmtparse
8 #define yylex quote_fmtlex
9 #define yyerror quote_fmterror
10 #define yylval quote_fmtlval
11 #define yychar quote_fmtchar
12 #define yydebug quote_fmtdebug
13 #define yynerrs quote_fmtnerrs
14 #define SHOW_NEWSGROUPS 257
15 #define SHOW_DATE       258
16 #define SHOW_FROM       259
17 #define SHOW_FULLNAME   260
18 #define SHOW_FIRST_NAME 261
19 #define SHOW_SENDER_INITIAL     262
20 #define SHOW_SUBJECT    263
21 #define SHOW_TO 264
22 #define SHOW_MESSAGEID  265
23 #define SHOW_PERCENT    266
24 #define SHOW_CC 267
25 #define SHOW_REFERENCES 268
26 #define SHOW_MESSAGE    269
27 #define SHOW_QUOTED_MESSAGE     270
28 #define SHOW_BACKSLASH  271
29 #define SHOW_TAB        272
30 #define SHOW_EOL        273
31 #define SHOW_QUESTION_MARK      274
32 #define SHOW_OPARENT    275
33 #define SHOW_CPARENT    276
34 #define QUERY_DATE      277
35 #define QUERY_FROM      278
36 #define QUERY_FULLNAME  279
37 #define QUERY_SUBJECT   280
38 #define QUERY_TO        281
39 #define QUERY_NEWSGROUPS        282
40 #define QUERY_MESSAGEID 283
41 #define QUERY_CC        284
42 #define QUERY_REFERENCES        285
43 #define OPARENT 286
44 #define CPARENT 287
45 #define CHARACTER       288
46
47 #line 1 "quote_fmt.y"
48
49 #include <ctype.h>
50 #include <gtk/gtk.h>
51 #include <glib.h>
52
53 #include "procmsg.h"
54 #include "procmime.h"
55 #include "utils.h"
56 #include "defs.h"
57 #include "intl.h"
58
59 #include "quote_fmt.tab.h"
60
61 #include "lex.quote_fmt.c"
62
63 /* decl */
64 /*
65 flex quote_fmt.l
66 bison -p quote_fmt quote_fmt.y
67 */
68
69 static MsgInfo * msginfo = NULL;
70 static gboolean * visible = NULL;
71 static gint maxsize = 0;
72 static gint stacksize = 0;
73
74 static gchar * buffer = NULL;
75 static gint bufmax = 0;
76 static gint bufsize = 0;
77 static gchar * quote_str = NULL;
78 static gint error = 0;
79
80 static void add_visibility(gboolean val)
81 {
82         stacksize ++;
83         if (maxsize < stacksize) {
84                 maxsize += 128;
85                 visible = g_realloc(visible, maxsize * sizeof(gboolean));
86                 if (visible == NULL)
87                         maxsize = 0;
88         }
89
90         visible[stacksize - 1] = val;
91 }
92
93 static void remove_visibility()
94 {
95         stacksize --;
96 }
97
98
99 static void add_buffer(gchar * s)
100 {
101         gint len = strlen(s);
102         
103         if (bufsize + len + 1 > bufmax) {
104                 if (bufmax == 0)
105                         bufmax = 128;
106                 while (bufsize + len + 1 > bufmax)
107                         bufmax *= 2;
108                 buffer = g_realloc(buffer, bufmax);
109         }
110         strcpy(buffer + bufsize, s);
111         bufsize += len;
112 }
113
114 static void flush_buffer()
115 {
116         if (buffer != NULL)
117                 *buffer = 0;
118         bufsize = 0;
119 }
120
121 gchar * quote_fmt_get_buffer()
122 {
123         if (error != 0)
124                 return NULL;
125         else
126                 return buffer;
127 }
128
129 #define INSERT(buf) \
130         if (stacksize != 0 && visible[stacksize - 1]) \
131                 add_buffer(buf)
132
133 void quote_fmt_init(MsgInfo * info, gchar * my_quote_str)
134 {
135         quote_str = my_quote_str;
136         msginfo = info;
137         stacksize = 0;
138         add_visibility(TRUE);
139         if (buffer != NULL)
140                 *buffer = 0;
141         bufsize = 0;
142         error = 0;
143 }
144
145 void quote_fmterror(char * str)
146 {
147         g_warning(_("Error %s\n"), str);
148         error = 1;
149 }
150
151 int quote_fmtwrap(void)
152 {
153         return 1;
154 }
155
156 static int isseparator(char ch)
157 {
158         return isspace(ch) || ch == '.' || ch == '-';
159 }
160
161 #line 115 "quote_fmt.y"
162 typedef union {
163         char * str;
164 } YYSTYPE;
165 #include <stdio.h>
166
167 #ifndef __cplusplus
168 #ifndef __STDC__
169 #define const
170 #endif
171 #endif
172
173
174
175 #define YYFINAL         75
176 #define YYFLAG          -32768
177 #define YYNTBASE        35
178
179 #define YYTRANSLATE(x) ((unsigned)(x) <= 288 ? yytranslate[x] : 50)
180
181 static const char yytranslate[] = {     0,
182      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
183      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
184      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
185      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
186      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
187      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
188      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
189      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
190      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
191      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
192      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
193      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
194      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
195      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
196      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
197      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
198      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
199      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
200      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
201      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
202      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
203      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
204      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
205      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
206      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
207      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
208      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
209     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
210     27,    28,    29,    30,    31,    32,    33,    34
211 };
212
213 #if YYDEBUG != 0
214 static const short yyprhs[] = {     0,
215      0,     2,     5,     7,     9,    11,    13,    15,    17,    19,
216     21,    23,    25,    27,    29,    31,    33,    35,    37,    39,
217     41,    43,    45,    47,    49,    51,    53,    55,    56,    62,
218     63,    69,    70,    76,    77,    83,    84,    90,    91,    97,
219     98,   104,   105,   111,   112
220 };
221
222 static const short yyrhs[] = {    36,
223      0,    37,    36,     0,    37,     0,    39,     0,    38,     0,
224     40,     0,    34,     0,     3,     0,     4,     0,     5,     0,
225      6,     0,     7,     0,     8,     0,     9,     0,    10,     0,
226     11,     0,    12,     0,    13,     0,    14,     0,    15,     0,
227     16,     0,    17,     0,    18,     0,    19,     0,    20,     0,
228     21,     0,    22,     0,     0,    23,    41,    32,    35,    33,
229      0,     0,    24,    42,    32,    35,    33,     0,     0,    25,
230     43,    32,    35,    33,     0,     0,    26,    44,    32,    35,
231     33,     0,     0,    27,    45,    32,    35,    33,     0,     0,
232     28,    46,    32,    35,    33,     0,     0,    29,    47,    32,
233     35,    33,     0,     0,    30,    48,    32,    35,    33,     0,
234      0,    31,    49,    32,    35,    33,     0
235 };
236
237 #endif
238
239 #if YYDEBUG != 0
240 static const short yyrline[] = { 0,
241    137,   140,   142,   144,   146,   150,   153,   159,   165,   170,
242    175,   180,   196,   224,   229,   234,   239,   243,   248,   253,
243    265,   279,   283,   287,   291,   295,   299,   304,   309,   313,
244    317,   321,   325,   329,   333,   337,   341,   345,   349,   353,
245    357,   361,   365,   369,   373
246 };
247 #endif
248
249
250 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
251
252 static const char * const yytname[] = {   "$","error","$undefined.","SHOW_NEWSGROUPS",
253 "SHOW_DATE","SHOW_FROM","SHOW_FULLNAME","SHOW_FIRST_NAME","SHOW_SENDER_INITIAL",
254 "SHOW_SUBJECT","SHOW_TO","SHOW_MESSAGEID","SHOW_PERCENT","SHOW_CC","SHOW_REFERENCES",
255 "SHOW_MESSAGE","SHOW_QUOTED_MESSAGE","SHOW_BACKSLASH","SHOW_TAB","SHOW_EOL",
256 "SHOW_QUESTION_MARK","SHOW_OPARENT","SHOW_CPARENT","QUERY_DATE","QUERY_FROM",
257 "QUERY_FULLNAME","QUERY_SUBJECT","QUERY_TO","QUERY_NEWSGROUPS","QUERY_MESSAGEID",
258 "QUERY_CC","QUERY_REFERENCES","OPARENT","CPARENT","CHARACTER","quote_fmt","character_or_special_or_query_list",
259 "character_or_special_or_query","character","special","query","@1","@2","@3",
260 "@4","@5","@6","@7","@8","@9", NULL
261 };
262 #endif
263
264 static const short yyr1[] = {     0,
265     35,    36,    36,    37,    37,    37,    38,    39,    39,    39,
266     39,    39,    39,    39,    39,    39,    39,    39,    39,    39,
267     39,    39,    39,    39,    39,    39,    39,    41,    40,    42,
268     40,    43,    40,    44,    40,    45,    40,    46,    40,    47,
269     40,    48,    40,    49,    40
270 };
271
272 static const short yyr2[] = {     0,
273      1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
274      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
275      1,     1,     1,     1,     1,     1,     1,     0,     5,     0,
276      5,     0,     5,     0,     5,     0,     5,     0,     5,     0,
277      5,     0,     5,     0,     5
278 };
279
280 static const short yydefact[] = {     0,
281      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
282     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
283     28,    30,    32,    34,    36,    38,    40,    42,    44,     7,
284      1,     3,     5,     4,     6,     0,     0,     0,     0,     0,
285      0,     0,     0,     0,     2,     0,     0,     0,     0,     0,
286      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
287      0,     0,     0,    29,    31,    33,    35,    37,    39,    41,
288     43,    45,     0,     0,     0
289 };
290
291 static const short yydefgoto[] = {    55,
292     31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
293     41,    42,    43,    44
294 };
295
296 static const short yypact[] = {    -2,
297 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
298 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
299 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
300 -32768,    -2,-32768,-32768,-32768,    -1,     1,     2,     3,     4,
301      5,     6,     7,     8,-32768,    -2,    -2,    -2,    -2,    -2,
302     -2,    -2,    -2,    -2,    -3,     9,    10,    11,    12,    13,
303     22,    23,    24,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
304 -32768,-32768,    41,    58,-32768
305 };
306
307 static const short yypgoto[] = {     0,
308     27,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
309 -32768,-32768,-32768,-32768
310 };
311
312
313 #define YYLAST          59
314
315
316 static const short yytable[] = {    73,
317      1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
318     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
319     21,    22,    23,    24,    25,    26,    27,    28,    29,    64,
320     46,    30,    47,    48,    49,    50,    51,    52,    53,    54,
321     74,    65,    66,    67,    68,    69,    56,    57,    58,    59,
322     60,    61,    62,    63,    70,    71,    72,    75,    45
323 };
324
325 static const short yycheck[] = {     0,
326      3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
327     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
328     23,    24,    25,    26,    27,    28,    29,    30,    31,    33,
329     32,    34,    32,    32,    32,    32,    32,    32,    32,    32,
330      0,    33,    33,    33,    33,    33,    47,    48,    49,    50,
331     51,    52,    53,    54,    33,    33,    33,     0,    32
332 };
333 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
334 #line 3 "/usr/share/bison/bison.simple"
335 /* This file comes from bison-1.28.  */
336
337 /* Skeleton output parser for bison,
338    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
339
340    This program is free software; you can redistribute it and/or modify
341    it under the terms of the GNU General Public License as published by
342    the Free Software Foundation; either version 2, or (at your option)
343    any later version.
344
345    This program is distributed in the hope that it will be useful,
346    but WITHOUT ANY WARRANTY; without even the implied warranty of
347    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
348    GNU General Public License for more details.
349
350    You should have received a copy of the GNU General Public License
351    along with this program; if not, write to the Free Software
352    Foundation, Inc., 59 Temple Place - Suite 330,
353    Boston, MA 02111-1307, USA.  */
354
355 /* As a special exception, when this file is copied by Bison into a
356    Bison output file, you may use that output file without restriction.
357    This special exception was added by the Free Software Foundation
358    in version 1.24 of Bison.  */
359
360 /* This is the parser code that is written into each bison parser
361   when the %semantic_parser declaration is not specified in the grammar.
362   It was written by Richard Stallman by simplifying the hairy parser
363   used when %semantic_parser is specified.  */
364
365 #ifndef YYSTACK_USE_ALLOCA
366 #ifdef alloca
367 #define YYSTACK_USE_ALLOCA
368 #else /* alloca not defined */
369 #ifdef __GNUC__
370 #define YYSTACK_USE_ALLOCA
371 #define alloca __builtin_alloca
372 #else /* not GNU C.  */
373 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
374 #define YYSTACK_USE_ALLOCA
375 #include <alloca.h>
376 #else /* not sparc */
377 /* We think this test detects Watcom and Microsoft C.  */
378 /* This used to test MSDOS, but that is a bad idea
379    since that symbol is in the user namespace.  */
380 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
381 #if 0 /* No need for malloc.h, which pollutes the namespace;
382          instead, just don't use alloca.  */
383 #include <malloc.h>
384 #endif
385 #else /* not MSDOS, or __TURBOC__ */
386 #if defined(_AIX)
387 /* I don't know what this was needed for, but it pollutes the namespace.
388    So I turned it off.   rms, 2 May 1997.  */
389 /* #include <malloc.h>  */
390  #pragma alloca
391 #define YYSTACK_USE_ALLOCA
392 #else /* not MSDOS, or __TURBOC__, or _AIX */
393 #if 0
394 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
395                  and on HPUX 10.  Eventually we can turn this on.  */
396 #define YYSTACK_USE_ALLOCA
397 #define alloca __builtin_alloca
398 #endif /* __hpux */
399 #endif
400 #endif /* not _AIX */
401 #endif /* not MSDOS, or __TURBOC__ */
402 #endif /* not sparc */
403 #endif /* not GNU C */
404 #endif /* alloca not defined */
405 #endif /* YYSTACK_USE_ALLOCA not defined */
406
407 #ifdef YYSTACK_USE_ALLOCA
408 #define YYSTACK_ALLOC alloca
409 #else
410 #define YYSTACK_ALLOC malloc
411 #endif
412
413 /* Note: there must be only one dollar sign in this file.
414    It is replaced by the list of actions, each action
415    as one case of the switch.  */
416
417 #define yyerrok         (yyerrstatus = 0)
418 #define yyclearin       (yychar = YYEMPTY)
419 #define YYEMPTY         -2
420 #define YYEOF           0
421 #define YYACCEPT        goto yyacceptlab
422 #define YYABORT         goto yyabortlab
423 #define YYERROR         goto yyerrlab1
424 /* Like YYERROR except do call yyerror.
425    This remains here temporarily to ease the
426    transition to the new meaning of YYERROR, for GCC.
427    Once GCC version 2 has supplanted version 1, this can go.  */
428 #define YYFAIL          goto yyerrlab
429 #define YYRECOVERING()  (!!yyerrstatus)
430 #define YYBACKUP(token, value) \
431 do                                                              \
432   if (yychar == YYEMPTY && yylen == 1)                          \
433     { yychar = (token), yylval = (value);                       \
434       yychar1 = YYTRANSLATE (yychar);                           \
435       YYPOPSTACK;                                               \
436       goto yybackup;                                            \
437     }                                                           \
438   else                                                          \
439     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
440 while (0)
441
442 #define YYTERROR        1
443 #define YYERRCODE       256
444
445 #ifndef YYPURE
446 #define YYLEX           yylex()
447 #endif
448
449 #ifdef YYPURE
450 #ifdef YYLSP_NEEDED
451 #ifdef YYLEX_PARAM
452 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
453 #else
454 #define YYLEX           yylex(&yylval, &yylloc)
455 #endif
456 #else /* not YYLSP_NEEDED */
457 #ifdef YYLEX_PARAM
458 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
459 #else
460 #define YYLEX           yylex(&yylval)
461 #endif
462 #endif /* not YYLSP_NEEDED */
463 #endif
464
465 /* If nonreentrant, generate the variables here */
466
467 #ifndef YYPURE
468
469 int     yychar;                 /*  the lookahead symbol                */
470 YYSTYPE yylval;                 /*  the semantic value of the           */
471                                 /*  lookahead symbol                    */
472
473 #ifdef YYLSP_NEEDED
474 YYLTYPE yylloc;                 /*  location data for the lookahead     */
475                                 /*  symbol                              */
476 #endif
477
478 int yynerrs;                    /*  number of parse errors so far       */
479 #endif  /* not YYPURE */
480
481 #if YYDEBUG != 0
482 int yydebug;                    /*  nonzero means print parse trace     */
483 /* Since this is uninitialized, it does not stop multiple parsers
484    from coexisting.  */
485 #endif
486
487 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
488
489 #ifndef YYINITDEPTH
490 #define YYINITDEPTH 200
491 #endif
492
493 /*  YYMAXDEPTH is the maximum size the stacks can grow to
494     (effective only if the built-in stack extension method is used).  */
495
496 #if YYMAXDEPTH == 0
497 #undef YYMAXDEPTH
498 #endif
499
500 #ifndef YYMAXDEPTH
501 #define YYMAXDEPTH 10000
502 #endif
503 \f
504 /* Define __yy_memcpy.  Note that the size argument
505    should be passed with type unsigned int, because that is what the non-GCC
506    definitions require.  With GCC, __builtin_memcpy takes an arg
507    of type size_t, but it can handle unsigned int.  */
508
509 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
510 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
511 #else                           /* not GNU C or C++ */
512 #ifndef __cplusplus
513
514 /* This is the most reliable way to avoid incompatibilities
515    in available built-in functions on various systems.  */
516 static void
517 __yy_memcpy (to, from, count)
518      char *to;
519      char *from;
520      unsigned int count;
521 {
522   register char *f = from;
523   register char *t = to;
524   register int i = count;
525
526   while (i-- > 0)
527     *t++ = *f++;
528 }
529
530 #else /* __cplusplus */
531
532 /* This is the most reliable way to avoid incompatibilities
533    in available built-in functions on various systems.  */
534 static void
535 __yy_memcpy (char *to, char *from, unsigned int count)
536 {
537   register char *t = to;
538   register char *f = from;
539   register int i = count;
540
541   while (i-- > 0)
542     *t++ = *f++;
543 }
544
545 #endif
546 #endif
547 \f
548 #line 217 "/usr/share/bison/bison.simple"
549
550 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
551    into yyparse.  The argument should have type void *.
552    It should actually point to an object.
553    Grammar actions can access the variable by casting it
554    to the proper pointer type.  */
555
556 #ifdef YYPARSE_PARAM
557 #ifdef __cplusplus
558 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
559 #define YYPARSE_PARAM_DECL
560 #else /* not __cplusplus */
561 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
562 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
563 #endif /* not __cplusplus */
564 #else /* not YYPARSE_PARAM */
565 #define YYPARSE_PARAM_ARG
566 #define YYPARSE_PARAM_DECL
567 #endif /* not YYPARSE_PARAM */
568
569 /* Prevent warning if -Wstrict-prototypes.  */
570 #ifdef __GNUC__
571 #ifdef YYPARSE_PARAM
572 int yyparse (void *);
573 #else
574 int yyparse (void);
575 #endif
576 #endif
577
578 int
579 yyparse(YYPARSE_PARAM_ARG)
580      YYPARSE_PARAM_DECL
581 {
582   register int yystate;
583   register int yyn;
584   register short *yyssp;
585   register YYSTYPE *yyvsp;
586   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
587   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
588
589   short yyssa[YYINITDEPTH];     /*  the state stack                     */
590   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
591
592   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
593   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
594
595 #ifdef YYLSP_NEEDED
596   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
597   YYLTYPE *yyls = yylsa;
598   YYLTYPE *yylsp;
599
600 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
601 #else
602 #define YYPOPSTACK   (yyvsp--, yyssp--)
603 #endif
604
605   int yystacksize = YYINITDEPTH;
606   int yyfree_stacks = 0;
607
608 #ifdef YYPURE
609   int yychar;
610   YYSTYPE yylval;
611   int yynerrs;
612 #ifdef YYLSP_NEEDED
613   YYLTYPE yylloc;
614 #endif
615 #endif
616
617   YYSTYPE yyval;                /*  the variable used to return         */
618                                 /*  semantic values from the action     */
619                                 /*  routines                            */
620
621   int yylen;
622
623 #if YYDEBUG != 0
624   if (yydebug)
625     fprintf(stderr, "Starting parse\n");
626 #endif
627
628   yystate = 0;
629   yyerrstatus = 0;
630   yynerrs = 0;
631   yychar = YYEMPTY;             /* Cause a token to be read.  */
632
633   /* Initialize stack pointers.
634      Waste one element of value and location stack
635      so that they stay on the same level as the state stack.
636      The wasted elements are never initialized.  */
637
638   yyssp = yyss - 1;
639   yyvsp = yyvs;
640 #ifdef YYLSP_NEEDED
641   yylsp = yyls;
642 #endif
643
644 /* Push a new state, which is found in  yystate  .  */
645 /* In all cases, when you get here, the value and location stacks
646    have just been pushed. so pushing a state here evens the stacks.  */
647 yynewstate:
648
649   *++yyssp = yystate;
650
651   if (yyssp >= yyss + yystacksize - 1)
652     {
653       /* Give user a chance to reallocate the stack */
654       /* Use copies of these so that the &'s don't force the real ones into memory. */
655       YYSTYPE *yyvs1 = yyvs;
656       short *yyss1 = yyss;
657 #ifdef YYLSP_NEEDED
658       YYLTYPE *yyls1 = yyls;
659 #endif
660
661       /* Get the current used size of the three stacks, in elements.  */
662       int size = yyssp - yyss + 1;
663
664 #ifdef yyoverflow
665       /* Each stack pointer address is followed by the size of
666          the data in use in that stack, in bytes.  */
667 #ifdef YYLSP_NEEDED
668       /* This used to be a conditional around just the two extra args,
669          but that might be undefined if yyoverflow is a macro.  */
670       yyoverflow("parser stack overflow",
671                  &yyss1, size * sizeof (*yyssp),
672                  &yyvs1, size * sizeof (*yyvsp),
673                  &yyls1, size * sizeof (*yylsp),
674                  &yystacksize);
675 #else
676       yyoverflow("parser stack overflow",
677                  &yyss1, size * sizeof (*yyssp),
678                  &yyvs1, size * sizeof (*yyvsp),
679                  &yystacksize);
680 #endif
681
682       yyss = yyss1; yyvs = yyvs1;
683 #ifdef YYLSP_NEEDED
684       yyls = yyls1;
685 #endif
686 #else /* no yyoverflow */
687       /* Extend the stack our own way.  */
688       if (yystacksize >= YYMAXDEPTH)
689         {
690           yyerror("parser stack overflow");
691           if (yyfree_stacks)
692             {
693               free (yyss);
694               free (yyvs);
695 #ifdef YYLSP_NEEDED
696               free (yyls);
697 #endif
698             }
699           return 2;
700         }
701       yystacksize *= 2;
702       if (yystacksize > YYMAXDEPTH)
703         yystacksize = YYMAXDEPTH;
704 #ifndef YYSTACK_USE_ALLOCA
705       yyfree_stacks = 1;
706 #endif
707       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
708       __yy_memcpy ((char *)yyss, (char *)yyss1,
709                    size * (unsigned int) sizeof (*yyssp));
710       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
711       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
712                    size * (unsigned int) sizeof (*yyvsp));
713 #ifdef YYLSP_NEEDED
714       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
715       __yy_memcpy ((char *)yyls, (char *)yyls1,
716                    size * (unsigned int) sizeof (*yylsp));
717 #endif
718 #endif /* no yyoverflow */
719
720       yyssp = yyss + size - 1;
721       yyvsp = yyvs + size - 1;
722 #ifdef YYLSP_NEEDED
723       yylsp = yyls + size - 1;
724 #endif
725
726 #if YYDEBUG != 0
727       if (yydebug)
728         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
729 #endif
730
731       if (yyssp >= yyss + yystacksize - 1)
732         YYABORT;
733     }
734
735 #if YYDEBUG != 0
736   if (yydebug)
737     fprintf(stderr, "Entering state %d\n", yystate);
738 #endif
739
740   goto yybackup;
741  yybackup:
742
743 /* Do appropriate processing given the current state.  */
744 /* Read a lookahead token if we need one and don't already have one.  */
745 /* yyresume: */
746
747   /* First try to decide what to do without reference to lookahead token.  */
748
749   yyn = yypact[yystate];
750   if (yyn == YYFLAG)
751     goto yydefault;
752
753   /* Not known => get a lookahead token if don't already have one.  */
754
755   /* yychar is either YYEMPTY or YYEOF
756      or a valid token in external form.  */
757
758   if (yychar == YYEMPTY)
759     {
760 #if YYDEBUG != 0
761       if (yydebug)
762         fprintf(stderr, "Reading a token: ");
763 #endif
764       yychar = YYLEX;
765     }
766
767   /* Convert token to internal form (in yychar1) for indexing tables with */
768
769   if (yychar <= 0)              /* This means end of input. */
770     {
771       yychar1 = 0;
772       yychar = YYEOF;           /* Don't call YYLEX any more */
773
774 #if YYDEBUG != 0
775       if (yydebug)
776         fprintf(stderr, "Now at end of input.\n");
777 #endif
778     }
779   else
780     {
781       yychar1 = YYTRANSLATE(yychar);
782
783 #if YYDEBUG != 0
784       if (yydebug)
785         {
786           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
787           /* Give the individual parser a way to print the precise meaning
788              of a token, for further debugging info.  */
789 #ifdef YYPRINT
790           YYPRINT (stderr, yychar, yylval);
791 #endif
792           fprintf (stderr, ")\n");
793         }
794 #endif
795     }
796
797   yyn += yychar1;
798   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
799     goto yydefault;
800
801   yyn = yytable[yyn];
802
803   /* yyn is what to do for this token type in this state.
804      Negative => reduce, -yyn is rule number.
805      Positive => shift, yyn is new state.
806        New state is final state => don't bother to shift,
807        just return success.
808      0, or most negative number => error.  */
809
810   if (yyn < 0)
811     {
812       if (yyn == YYFLAG)
813         goto yyerrlab;
814       yyn = -yyn;
815       goto yyreduce;
816     }
817   else if (yyn == 0)
818     goto yyerrlab;
819
820   if (yyn == YYFINAL)
821     YYACCEPT;
822
823   /* Shift the lookahead token.  */
824
825 #if YYDEBUG != 0
826   if (yydebug)
827     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
828 #endif
829
830   /* Discard the token being shifted unless it is eof.  */
831   if (yychar != YYEOF)
832     yychar = YYEMPTY;
833
834   *++yyvsp = yylval;
835 #ifdef YYLSP_NEEDED
836   *++yylsp = yylloc;
837 #endif
838
839   /* count tokens shifted since error; after three, turn off error status.  */
840   if (yyerrstatus) yyerrstatus--;
841
842   yystate = yyn;
843   goto yynewstate;
844
845 /* Do the default action for the current state.  */
846 yydefault:
847
848   yyn = yydefact[yystate];
849   if (yyn == 0)
850     goto yyerrlab;
851
852 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
853 yyreduce:
854   yylen = yyr2[yyn];
855   if (yylen > 0)
856     yyval = yyvsp[1-yylen]; /* implement default value of the action */
857
858 #if YYDEBUG != 0
859   if (yydebug)
860     {
861       int i;
862
863       fprintf (stderr, "Reducing via rule %d (line %d), ",
864                yyn, yyrline[yyn]);
865
866       /* Print the symbols being reduced, and their result.  */
867       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
868         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
869       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
870     }
871 #endif
872
873
874   switch (yyn) {
875
876 case 5:
877 #line 147 "quote_fmt.y"
878 {
879                 INSERT(yyvsp[0].str);           
880         ;
881     break;}
882 case 7:
883 #line 155 "quote_fmt.y"
884 {
885                 yyval.str = yytext;
886         ;
887     break;}
888 case 8:
889 #line 161 "quote_fmt.y"
890 {
891                 if (msginfo->newsgroups)
892                         INSERT(msginfo->newsgroups);
893         ;
894     break;}
895 case 9:
896 #line 166 "quote_fmt.y"
897 {
898                 if (msginfo->date)
899                         INSERT(msginfo->date);
900         ;
901     break;}
902 case 10:
903 #line 171 "quote_fmt.y"
904 {
905                 if (msginfo->from)
906                         INSERT(msginfo->from);
907         ;
908     break;}
909 case 11:
910 #line 176 "quote_fmt.y"
911 {
912                 if (msginfo->fromname)
913                         INSERT(msginfo->fromname);
914         ;
915     break;}
916 case 12:
917 #line 181 "quote_fmt.y"
918 {
919                 if (msginfo->fromname) {
920                         gchar * p;
921                         gchar * str;
922
923                         str = alloca(strlen(msginfo->fromname) + 1);
924                         if (str != NULL) {
925                                 strcpy(str, msginfo->fromname);
926                                 p = str;
927                                 while (*p && !isspace(*p)) p++;
928                                 *p = '\0';
929                                 INSERT(str);
930                         }
931                 }
932         ;
933     break;}
934 case 13:
935 #line 197 "quote_fmt.y"
936 {
937 #define MAX_SENDER_INITIAL 20
938                 if (msginfo->fromname) {
939                         gchar tmp[MAX_SENDER_INITIAL];
940                         gchar * p;      
941                         gchar * cur;
942                         gint len = 0;
943
944                         p = msginfo->fromname;
945                         cur = tmp;
946                         while (*p) {
947                                 if (*p && isalnum(*p)) {
948                                         *cur = toupper(*p);
949                                                 cur ++;
950                                         len ++;
951                                         if (len >= MAX_SENDER_INITIAL - 1)
952                                                 break;
953                                 }
954                                 else
955                                         break;
956                                 while (*p && !isseparator(*p)) p++;
957                                 while (*p && isseparator(*p)) p++;
958                         }
959                         *cur = '\0';
960                         INSERT(tmp);
961                 }
962         ;
963     break;}
964 case 14:
965 #line 225 "quote_fmt.y"
966 {
967                 if (msginfo->subject)
968                         INSERT(msginfo->subject);
969         ;
970     break;}
971 case 15:
972 #line 230 "quote_fmt.y"
973 {
974                 if (msginfo->to)
975                         INSERT(msginfo->to);
976         ;
977     break;}
978 case 16:
979 #line 235 "quote_fmt.y"
980 {
981                 if (msginfo->msgid)
982                         INSERT(msginfo->msgid);
983         ;
984     break;}
985 case 17:
986 #line 240 "quote_fmt.y"
987 {
988                 INSERT("%");
989         ;
990     break;}
991 case 18:
992 #line 244 "quote_fmt.y"
993 {
994                 if (msginfo->cc)
995                         INSERT(msginfo->cc);
996         ;
997     break;}
998 case 19:
999 #line 249 "quote_fmt.y"
1000 {
1001                 if (msginfo->references)
1002                         INSERT(msginfo->references);
1003         ;
1004     break;}
1005 case 20:
1006 #line 254 "quote_fmt.y"
1007 {
1008                 gchar buf[BUFFSIZE];
1009                 FILE * fp;
1010
1011                 if ((fp = procmime_get_text_part(msginfo)) == NULL)
1012                         g_warning(_("Can't get text part\n"));
1013                 while (fgets(buf, sizeof(buf), fp) != NULL) {
1014                         INSERT(buf);
1015                 }
1016                 fclose(fp);
1017         ;
1018     break;}
1019 case 21:
1020 #line 266 "quote_fmt.y"
1021 {
1022                 gchar buf[BUFFSIZE];
1023                 FILE * fp;
1024
1025                 if ((fp = procmime_get_text_part(msginfo)) == NULL)
1026                         g_warning(_("Can't get text part\n"));
1027                 while (fgets(buf, sizeof(buf), fp) != NULL) {
1028                         if (quote_str)
1029                                 INSERT(quote_str);
1030                         INSERT(buf);
1031                 }
1032                 fclose(fp);
1033         ;
1034     break;}
1035 case 22:
1036 #line 280 "quote_fmt.y"
1037 {
1038                 INSERT("\\");
1039         ;
1040     break;}
1041 case 23:
1042 #line 284 "quote_fmt.y"
1043 {
1044                 INSERT("\t");
1045         ;
1046     break;}
1047 case 24:
1048 #line 288 "quote_fmt.y"
1049 {
1050                 INSERT("\n");
1051         ;
1052     break;}
1053 case 25:
1054 #line 292 "quote_fmt.y"
1055 {
1056                 INSERT("?");
1057         ;
1058     break;}
1059 case 26:
1060 #line 296 "quote_fmt.y"
1061 {
1062                 INSERT("(");
1063         ;
1064     break;}
1065 case 27:
1066 #line 300 "quote_fmt.y"
1067 {
1068                 INSERT(")");
1069         ;
1070     break;}
1071 case 28:
1072 #line 306 "quote_fmt.y"
1073 {
1074                 add_visibility(msginfo->date != NULL);
1075         ;
1076     break;}
1077 case 29:
1078 #line 310 "quote_fmt.y"
1079 {
1080                 remove_visibility();
1081         ;
1082     break;}
1083 case 30:
1084 #line 314 "quote_fmt.y"
1085 {
1086                 add_visibility(msginfo->from != NULL);
1087         ;
1088     break;}
1089 case 31:
1090 #line 318 "quote_fmt.y"
1091 {
1092                 remove_visibility();
1093         ;
1094     break;}
1095 case 32:
1096 #line 322 "quote_fmt.y"
1097 {
1098                 add_visibility(msginfo->fromname != NULL);
1099         ;
1100     break;}
1101 case 33:
1102 #line 326 "quote_fmt.y"
1103 {
1104                 remove_visibility();
1105         ;
1106     break;}
1107 case 34:
1108 #line 330 "quote_fmt.y"
1109 {
1110                 add_visibility(msginfo->subject != NULL);
1111         ;
1112     break;}
1113 case 35:
1114 #line 334 "quote_fmt.y"
1115 {
1116                 remove_visibility();
1117         ;
1118     break;}
1119 case 36:
1120 #line 338 "quote_fmt.y"
1121 {
1122                 add_visibility(msginfo->to != NULL);
1123         ;
1124     break;}
1125 case 37:
1126 #line 342 "quote_fmt.y"
1127 {
1128                 remove_visibility();
1129         ;
1130     break;}
1131 case 38:
1132 #line 346 "quote_fmt.y"
1133 {
1134                 add_visibility(msginfo->newsgroups != NULL);
1135         ;
1136     break;}
1137 case 39:
1138 #line 350 "quote_fmt.y"
1139 {
1140                 remove_visibility();
1141         ;
1142     break;}
1143 case 40:
1144 #line 354 "quote_fmt.y"
1145 {
1146                 add_visibility(msginfo->msgid != NULL);
1147         ;
1148     break;}
1149 case 41:
1150 #line 358 "quote_fmt.y"
1151 {
1152                 remove_visibility();
1153         ;
1154     break;}
1155 case 42:
1156 #line 362 "quote_fmt.y"
1157 {
1158                 add_visibility(msginfo->cc != NULL);
1159         ;
1160     break;}
1161 case 43:
1162 #line 366 "quote_fmt.y"
1163 {
1164                 remove_visibility();
1165         ;
1166     break;}
1167 case 44:
1168 #line 370 "quote_fmt.y"
1169 {
1170                 add_visibility(msginfo->references != NULL);
1171         ;
1172     break;}
1173 case 45:
1174 #line 374 "quote_fmt.y"
1175 {
1176                 remove_visibility();
1177         ;
1178     break;}
1179 }
1180    /* the action file gets copied in in place of this dollarsign */
1181 #line 543 "/usr/share/bison/bison.simple"
1182 \f
1183   yyvsp -= yylen;
1184   yyssp -= yylen;
1185 #ifdef YYLSP_NEEDED
1186   yylsp -= yylen;
1187 #endif
1188
1189 #if YYDEBUG != 0
1190   if (yydebug)
1191     {
1192       short *ssp1 = yyss - 1;
1193       fprintf (stderr, "state stack now");
1194       while (ssp1 != yyssp)
1195         fprintf (stderr, " %d", *++ssp1);
1196       fprintf (stderr, "\n");
1197     }
1198 #endif
1199
1200   *++yyvsp = yyval;
1201
1202 #ifdef YYLSP_NEEDED
1203   yylsp++;
1204   if (yylen == 0)
1205     {
1206       yylsp->first_line = yylloc.first_line;
1207       yylsp->first_column = yylloc.first_column;
1208       yylsp->last_line = (yylsp-1)->last_line;
1209       yylsp->last_column = (yylsp-1)->last_column;
1210       yylsp->text = 0;
1211     }
1212   else
1213     {
1214       yylsp->last_line = (yylsp+yylen-1)->last_line;
1215       yylsp->last_column = (yylsp+yylen-1)->last_column;
1216     }
1217 #endif
1218
1219   /* Now "shift" the result of the reduction.
1220      Determine what state that goes to,
1221      based on the state we popped back to
1222      and the rule number reduced by.  */
1223
1224   yyn = yyr1[yyn];
1225
1226   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1227   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1228     yystate = yytable[yystate];
1229   else
1230     yystate = yydefgoto[yyn - YYNTBASE];
1231
1232   goto yynewstate;
1233
1234 yyerrlab:   /* here on detecting error */
1235
1236   if (! yyerrstatus)
1237     /* If not already recovering from an error, report this error.  */
1238     {
1239       ++yynerrs;
1240
1241 #ifdef YYERROR_VERBOSE
1242       yyn = yypact[yystate];
1243
1244       if (yyn > YYFLAG && yyn < YYLAST)
1245         {
1246           int size = 0;
1247           char *msg;
1248           int x, count;
1249
1250           count = 0;
1251           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1252           for (x = (yyn < 0 ? -yyn : 0);
1253                x < (sizeof(yytname) / sizeof(char *)); x++)
1254             if (yycheck[x + yyn] == x)
1255               size += strlen(yytname[x]) + 15, count++;
1256           msg = (char *) malloc(size + 15);
1257           if (msg != 0)
1258             {
1259               strcpy(msg, "parse error");
1260
1261               if (count < 5)
1262                 {
1263                   count = 0;
1264                   for (x = (yyn < 0 ? -yyn : 0);
1265                        x < (sizeof(yytname) / sizeof(char *)); x++)
1266                     if (yycheck[x + yyn] == x)
1267                       {
1268                         strcat(msg, count == 0 ? ", expecting `" : " or `");
1269                         strcat(msg, yytname[x]);
1270                         strcat(msg, "'");
1271                         count++;
1272                       }
1273                 }
1274               yyerror(msg);
1275               free(msg);
1276             }
1277           else
1278             yyerror ("parse error; also virtual memory exceeded");
1279         }
1280       else
1281 #endif /* YYERROR_VERBOSE */
1282         yyerror("parse error");
1283     }
1284
1285   goto yyerrlab1;
1286 yyerrlab1:   /* here on error raised explicitly by an action */
1287
1288   if (yyerrstatus == 3)
1289     {
1290       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1291
1292       /* return failure if at end of input */
1293       if (yychar == YYEOF)
1294         YYABORT;
1295
1296 #if YYDEBUG != 0
1297       if (yydebug)
1298         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1299 #endif
1300
1301       yychar = YYEMPTY;
1302     }
1303
1304   /* Else will try to reuse lookahead token
1305      after shifting the error token.  */
1306
1307   yyerrstatus = 3;              /* Each real token shifted decrements this */
1308
1309   goto yyerrhandle;
1310
1311 yyerrdefault:  /* current state does not do anything special for the error token. */
1312
1313 #if 0
1314   /* This is wrong; only states that explicitly want error tokens
1315      should shift them.  */
1316   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1317   if (yyn) goto yydefault;
1318 #endif
1319
1320 yyerrpop:   /* pop the current state because it cannot handle the error token */
1321
1322   if (yyssp == yyss) YYABORT;
1323   yyvsp--;
1324   yystate = *--yyssp;
1325 #ifdef YYLSP_NEEDED
1326   yylsp--;
1327 #endif
1328
1329 #if YYDEBUG != 0
1330   if (yydebug)
1331     {
1332       short *ssp1 = yyss - 1;
1333       fprintf (stderr, "Error: state stack now");
1334       while (ssp1 != yyssp)
1335         fprintf (stderr, " %d", *++ssp1);
1336       fprintf (stderr, "\n");
1337     }
1338 #endif
1339
1340 yyerrhandle:
1341
1342   yyn = yypact[yystate];
1343   if (yyn == YYFLAG)
1344     goto yyerrdefault;
1345
1346   yyn += YYTERROR;
1347   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1348     goto yyerrdefault;
1349
1350   yyn = yytable[yyn];
1351   if (yyn < 0)
1352     {
1353       if (yyn == YYFLAG)
1354         goto yyerrpop;
1355       yyn = -yyn;
1356       goto yyreduce;
1357     }
1358   else if (yyn == 0)
1359     goto yyerrpop;
1360
1361   if (yyn == YYFINAL)
1362     YYACCEPT;
1363
1364 #if YYDEBUG != 0
1365   if (yydebug)
1366     fprintf(stderr, "Shifting error token, ");
1367 #endif
1368
1369   *++yyvsp = yylval;
1370 #ifdef YYLSP_NEEDED
1371   *++yylsp = yylloc;
1372 #endif
1373
1374   yystate = yyn;
1375   goto yynewstate;
1376
1377  yyacceptlab:
1378   /* YYACCEPT comes here.  */
1379   if (yyfree_stacks)
1380     {
1381       free (yyss);
1382       free (yyvs);
1383 #ifdef YYLSP_NEEDED
1384       free (yyls);
1385 #endif
1386     }
1387   return 0;
1388
1389  yyabortlab:
1390   /* YYABORT comes here.  */
1391   if (yyfree_stacks)
1392     {
1393       free (yyss);
1394       free (yyvs);
1395 #ifdef YYLSP_NEEDED
1396       free (yyls);
1397 #endif
1398     }
1399   return 1;
1400 }
1401 #line 377 "quote_fmt.y"