Handle generic column width changes.
[wine] / programs / winhelp / macro.yacc.y
1 %{
2 /*
3  * Help Viewer
4  *
5  * Copyright 1996 Ulrich Schmid
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include <stdlib.h>
23 #include "macro.h"
24
25 static int   skip = 0;
26 static LPSTR filename;
27 static LPSTR windowname;
28
29 %}
30 %union
31   {
32     BOOL    bool;
33     LONG    integer;
34     LPSTR   string;
35     BOOL    (*bool_function_void)(VOID);
36     BOOL    (*bool_function_string)(LPCSTR);
37     VOID    (*void_function_void)(VOID);
38     VOID    (*void_function_uint)(LONG);
39     VOID    (*void_function_string)(LPCSTR);
40     VOID    (*void_function_2int_3uint_string)(LONG,LONG,LONG,LONG,LONG,LPCSTR);
41     VOID    (*void_function_2string)(LPCSTR,LPCSTR);
42     VOID    (*void_function_2string_2uint_2string)(LPCSTR,LPCSTR,LONG,LONG,LPCSTR,LPCSTR);
43     VOID    (*void_function_2string_uint)(LPCSTR,LPCSTR,LONG);
44     VOID    (*void_function_2string_uint_string)(LPCSTR,LPCSTR,LONG,LPCSTR);
45     VOID    (*void_function_2string_wparam_lparam_string)(LPCSTR,LPCSTR,WPARAM,LPARAM,LPCSTR);
46     VOID    (*void_function_2uint)(LONG,LONG);
47     VOID    (*void_function_2uint_string)(LONG,LONG,LPCSTR);
48     VOID    (*void_function_3string)(LPCSTR,LPCSTR,LPCSTR);
49     VOID    (*void_function_3string_2uint)(LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
50     VOID    (*void_function_3uint)(LONG,LONG,LONG);
51     VOID    (*void_function_4string)(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
52     VOID    (*void_function_4string_2uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
53     VOID    (*void_function_4string_uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG);
54     VOID    (*void_function_string_uint)(LPCSTR,LONG);
55     VOID    (*void_function_string_uint_2string)(LPCSTR,LONG,LPCSTR,LPCSTR);
56     VOID    (*void_function_string_uint_string)(LPCSTR,LONG,LPCSTR);
57     VOID    (*void_function_string_wparam_lparam)(LPCSTR,WPARAM,LPARAM);
58   }
59 %token                                                  NOT
60 %token                                                  IF_THEN
61 %token                                                  IF_THEN_ELSE
62 %token <string>                                         tSTRING
63 %token <integer>                                        INTEGER
64 %token <bool_function_string>                           BOOL_FUNCTION_STRING
65 %token <bool_function_void>                             BOOL_FUNCTION_VOID
66 %token <void_function_2int_3uint_string>                VOID_FUNCTION_2INT_3UINT_STRING
67 %token <void_function_2string>                          VOID_FUNCTION_2STRING
68 %token <void_function_2string_2uint_2string>            VOID_FUNCTION_2STRING_2UINT_2STRING
69 %token <void_function_2string_uint>                     VOID_FUNCTION_2STRING_UINT
70 %token <void_function_2string_uint_string>              VOID_FUNCTION_2STRING_UINT_STRING
71 %token <void_function_2string_wparam_lparam_string>     VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
72 %token <void_function_2uint>                            VOID_FUNCTION_2UINT
73 %token <void_function_2uint_string>                     VOID_FUNCTION_2UINT_STRING
74 %token <void_function_3string>                          VOID_FUNCTION_3STRING
75 %token <void_function_3string_2uint>                    VOID_FUNCTION_3STRING_2UINT
76 %token <void_function_3uint>                            VOID_FUNCTION_3UINT
77 %token <void_function_4string>                          VOID_FUNCTION_4STRING
78 %token <void_function_4string_2uint>                    VOID_FUNCTION_4STRING_2UINT
79 %token <void_function_4string_uint>                     VOID_FUNCTION_4STRING_UINT
80 %token <void_function_string>                           VOID_FUNCTION_STRING
81 %token <void_function_string_uint>                      VOID_FUNCTION_STRING_UINT
82 %token <void_function_string_uint_2string>              VOID_FUNCTION_STRING_UINT_2STRING
83 %token <void_function_string_uint_string>               VOID_FUNCTION_STRING_UINT_STRING
84 %token <void_function_string_wparam_lparam>             VOID_FUNCTION_STRING_WPARAM_LPARAM
85 %token <void_function_uint>                             VOID_FUNCTION_UINT
86 %token <void_function_void>                             VOID_FUNCTION_VOID
87 %token <void_function_2string>                          VOID_FUNCTION_FILE_WIN
88 %token <void_function_3string>                          VOID_FUNCTION_FILE_WIN_STRING
89 %token <void_function_2string_uint>                     VOID_FUNCTION_FILE_WIN_UINT
90 %type  <bool> bool_macro
91 %%
92
93 macrostring:    macro |
94                 macro macrosep macrostring ;
95
96 macrosep:       ';' |
97                 ':' ;
98
99 macro:          /* Empty */ |
100                 IF_THEN      '(' bool_macro ','  {if (!$3) skip++;}
101                                  macrostring ')' {if (!$3) skip--;} |
102                 IF_THEN_ELSE '(' bool_macro ','  {if (!$3) skip++;}
103                                  macrostring ',' {if (!$3) skip--; else skip++;}
104                                  macrostring ')' {if ( $3) skip--;} |
105                 VOID_FUNCTION_VOID
106                         '(' ')'
107                         {if (!skip) (*$1)();} |
108                 VOID_FUNCTION_STRING
109                         '(' tSTRING ')'
110                         {if (!skip) (*$1)($3);} |
111                 VOID_FUNCTION_2STRING
112                         '(' tSTRING ',' tSTRING ')'
113                         {if (!skip) (*$1)($3, $5);} |
114                 VOID_FUNCTION_2STRING_UINT
115                         '(' tSTRING ',' tSTRING ',' INTEGER ')'
116                         {if (!skip) (*$1)($3, $5, $7);} |
117                 VOID_FUNCTION_2STRING_UINT_STRING
118                         '(' tSTRING ',' tSTRING ',' INTEGER ',' tSTRING ')'
119                         {if (!skip) (*$1)($3, $5, $7, $9);} |
120                 VOID_FUNCTION_2STRING_2UINT_2STRING
121                         '(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ',' tSTRING ')'
122                         {if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
123                 VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
124                         '(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ')'
125                         {if (!skip) (*$1)($3, $5, $7, $9, $11);} |
126                 VOID_FUNCTION_3STRING
127                         '(' tSTRING ',' tSTRING ',' tSTRING ')'
128                         {if (!skip) (*$1)($3, $5, $7);} |
129                 VOID_FUNCTION_3STRING_2UINT
130                         '(' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ')'
131                         {if (!skip) (*$1)($3, $5, $7, $9, $11);} |
132                 VOID_FUNCTION_4STRING
133                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ')'
134                         {if (!skip) (*$1)($3, $5, $7, $9);} |
135                 VOID_FUNCTION_4STRING_UINT
136                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER')'
137                         {if (!skip) (*$1)($3, $5, $7, $9, $11);} |
138                 VOID_FUNCTION_4STRING_2UINT
139                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER')'
140                         {if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
141                 VOID_FUNCTION_STRING_UINT
142                         '(' tSTRING ',' INTEGER ')'
143                         {if (!skip) (*$1)($3, $5);} |
144                 VOID_FUNCTION_STRING_UINT_STRING
145                         '(' tSTRING ',' INTEGER ',' tSTRING ')'
146                         {if (!skip) (*$1)($3, $5, $7);} |
147                 VOID_FUNCTION_STRING_UINT_2STRING
148                         '(' tSTRING ',' INTEGER ',' tSTRING ',' tSTRING ')'
149                         {if (!skip) (*$1)($3, $5, $7, $9);} |
150                 VOID_FUNCTION_STRING_WPARAM_LPARAM
151                         '(' tSTRING ',' INTEGER ',' INTEGER ')'
152                         {if (!skip) (*$1)($3, $5, $7);} |
153                 VOID_FUNCTION_UINT
154                         '(' INTEGER ')'
155                         {if (!skip) (*$1)($3);} |
156                 VOID_FUNCTION_2UINT
157                         '(' INTEGER ',' INTEGER ')'
158                         {if (!skip) (*$1)($3, $5);} |
159                 VOID_FUNCTION_2UINT_STRING
160                         '(' INTEGER ',' INTEGER ',' tSTRING ')'
161                         {if (!skip) (*$1)($3, $5, $7);} |
162                 VOID_FUNCTION_3UINT
163                         '(' INTEGER ',' INTEGER ',' INTEGER ')'
164                         {if (!skip) (*$1)($3, $5, $7);} |
165                 VOID_FUNCTION_2INT_3UINT_STRING
166                         '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' tSTRING ')'
167                         {if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
168                 VOID_FUNCTION_FILE_WIN
169                         '(' file_win ')'
170                         {if (!skip) (*$1)(filename, windowname);} |
171                 VOID_FUNCTION_FILE_WIN_STRING
172                         '(' file_win ',' tSTRING ')'
173                         {if (!skip) (*$1)(filename, windowname, $5);} |
174                 VOID_FUNCTION_FILE_WIN_UINT
175                         '(' file_win ',' INTEGER ')'
176                         {if (!skip) (*$1)(filename, windowname, $5);} ;
177
178 file_win:       tSTRING
179                 {
180                   filename = windowname = $1;
181                   while (*windowname && *windowname != '>') windowname++;
182                   if (*windowname) *windowname++ = 0;
183                 } ;
184
185 bool_macro:     NOT '(' bool_macro ')' {$$ = ! $3;} |
186                 tSTRING {$$ = MACRO_IsMark($1);} |
187                 BOOL_FUNCTION_VOID '(' ')' {$$ = (*$1)();} |
188                 BOOL_FUNCTION_STRING '(' tSTRING ')' {$$ = (*$1)($3);} ;