Added some prototypes to function declarations.
[wine] / programs / winhelp / macro.yacc.y
1 %{
2 /*
3  * Help Viewer
4  *
5  * Copyright 1996 Ulrich Schmid
6  */
7
8 #include <stdlib.h>
9 #include "macro.h"
10
11 static int   skip = 0;
12 static LPSTR filename;
13 static LPSTR windowname;
14
15 %}
16 %union
17   {
18     BOOL    bool;
19     LONG    integer;
20     LPSTR   string;
21     BOOL    (*bool_function_void)(VOID);
22     BOOL    (*bool_function_string)(LPCSTR);
23     VOID    (*void_function_void)(VOID);
24     VOID    (*void_function_uint)(LONG);
25     VOID    (*void_function_string)(LPCSTR);
26     VOID    (*void_function_2int_3uint_string)(LONG,LONG,LONG,LONG,LONG,LPCSTR);
27     VOID    (*void_function_2string)(LPCSTR,LPCSTR);
28     VOID    (*void_function_2string_2uint_2string)(LPCSTR,LPCSTR,LONG,LONG,LPCSTR,LPCSTR);
29     VOID    (*void_function_2string_uint)(LPCSTR,LPCSTR,LONG);
30     VOID    (*void_function_2string_uint_string)(LPCSTR,LPCSTR,LONG,LPCSTR);
31     VOID    (*void_function_2string_wparam_lparam_string)(LPCSTR,LPCSTR,WPARAM,LPARAM,LPCSTR);
32     VOID    (*void_function_2uint)(LONG,LONG);
33     VOID    (*void_function_2uint_string)(LONG,LONG,LPCSTR);
34     VOID    (*void_function_3string)(LPCSTR,LPCSTR,LPCSTR);
35     VOID    (*void_function_3string_2uint)(LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
36     VOID    (*void_function_3uint)(LONG,LONG,LONG);
37     VOID    (*void_function_4string)(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
38     VOID    (*void_function_4string_2uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
39     VOID    (*void_function_4string_uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG);
40     VOID    (*void_function_string_uint)(LPCSTR,LONG);
41     VOID    (*void_function_string_uint_2string)(LPCSTR,LONG,LPCSTR,LPCSTR);
42     VOID    (*void_function_string_uint_string)(LPCSTR,LONG,LPCSTR);
43     VOID    (*void_function_string_wparam_lparam)(LPCSTR,WPARAM,LPARAM);
44   }
45 %token                                                  NOT
46 %token                                                  IF_THEN
47 %token                                                  IF_THEN_ELSE
48 %token <string>                                         tSTRING
49 %token <integer>                                        INTEGER
50 %token <bool_function_string>                           BOOL_FUNCTION_STRING
51 %token <bool_function_void>                             BOOL_FUNCTION_VOID
52 %token <void_function_2int_3uint_string>                VOID_FUNCTION_2INT_3UINT_STRING
53 %token <void_function_2string>                          VOID_FUNCTION_2STRING
54 %token <void_function_2string_2uint_2string>            VOID_FUNCTION_2STRING_2UINT_2STRING
55 %token <void_function_2string_uint>                     VOID_FUNCTION_2STRING_UINT
56 %token <void_function_2string_uint_string>              VOID_FUNCTION_2STRING_UINT_STRING
57 %token <void_function_2string_wparam_lparam_string>     VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
58 %token <void_function_2uint>                            VOID_FUNCTION_2UINT
59 %token <void_function_2uint_string>                     VOID_FUNCTION_2UINT_STRING
60 %token <void_function_3string>                          VOID_FUNCTION_3STRING
61 %token <void_function_3string_2uint>                    VOID_FUNCTION_3STRING_2UINT
62 %token <void_function_3uint>                            VOID_FUNCTION_3UINT
63 %token <void_function_4string>                          VOID_FUNCTION_4STRING
64 %token <void_function_4string_2uint>                    VOID_FUNCTION_4STRING_2UINT
65 %token <void_function_4string_uint>                     VOID_FUNCTION_4STRING_UINT
66 %token <void_function_string>                           VOID_FUNCTION_STRING
67 %token <void_function_string_uint>                      VOID_FUNCTION_STRING_UINT
68 %token <void_function_string_uint_2string>              VOID_FUNCTION_STRING_UINT_2STRING
69 %token <void_function_string_uint_string>               VOID_FUNCTION_STRING_UINT_STRING
70 %token <void_function_string_wparam_lparam>             VOID_FUNCTION_STRING_WPARAM_LPARAM
71 %token <void_function_uint>                             VOID_FUNCTION_UINT
72 %token <void_function_void>                             VOID_FUNCTION_VOID
73 %token <void_function_2string>                          VOID_FUNCTION_FILE_WIN
74 %token <void_function_3string>                          VOID_FUNCTION_FILE_WIN_STRING
75 %token <void_function_2string_uint>                     VOID_FUNCTION_FILE_WIN_UINT
76 %type  <bool> bool_macro
77 %%
78
79 macrostring:    macro |
80                 macro macrosep macrostring ;
81
82 macrosep:       ';' |
83                 ':' ;
84
85 macro:          /* Empty */ |
86                 IF_THEN      '(' bool_macro ','  {if (! $3) skip++;}
87                                  macrostring ')' {if (! $3) skip--;} |
88                 IF_THEN_ELSE '(' bool_macro ','  {if (! $3) skip++;}
89                                  macrostring ',' {if (! $3) skip--; else skip++;}
90                                  macrostring ')' {if (  $3) skip--;} |
91                 VOID_FUNCTION_VOID
92                         '(' ')'
93                         {if (! skip) (*$1)();} |
94                 VOID_FUNCTION_STRING
95                         '(' tSTRING ')'
96                         {if (! skip) (*$1)($3);} |
97                 VOID_FUNCTION_2STRING
98                         '(' tSTRING ',' tSTRING ')'
99                         {if (! skip) (*$1)($3, $5);} |
100                 VOID_FUNCTION_2STRING_UINT
101                         '(' tSTRING ',' tSTRING ',' INTEGER ')'
102                         {if (! skip) (*$1)($3, $5, $7);} |
103                 VOID_FUNCTION_2STRING_UINT_STRING
104                         '(' tSTRING ',' tSTRING ',' INTEGER ',' tSTRING ')'
105                         {if (! skip) (*$1)($3, $5, $7, $9);} |
106                 VOID_FUNCTION_2STRING_2UINT_2STRING
107                         '(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ',' tSTRING ')'
108                         {if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
109                 VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
110                         '(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ')'
111                         {if (! skip) (*$1)($3, $5, $7, $9, $11);} |
112                 VOID_FUNCTION_3STRING
113                         '(' tSTRING ',' tSTRING ',' tSTRING ')'
114                         {if (! skip) (*$1)($3, $5, $7);} |
115                 VOID_FUNCTION_3STRING_2UINT
116                         '(' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ')'
117                         {if (! skip) (*$1)($3, $5, $7, $9, $11);} |
118                 VOID_FUNCTION_4STRING
119                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ')'
120                         {if (! skip) (*$1)($3, $5, $7, $9);} |
121                 VOID_FUNCTION_4STRING_UINT
122                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER')'
123                         {if (! skip) (*$1)($3, $5, $7, $9, $11);} |
124                 VOID_FUNCTION_4STRING_2UINT
125                         '(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER')'
126                         {if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
127                 VOID_FUNCTION_STRING_UINT
128                         '(' tSTRING ',' INTEGER ')'
129                         {if (! skip) (*$1)($3, $5);} |
130                 VOID_FUNCTION_STRING_UINT_STRING
131                         '(' tSTRING ',' INTEGER ',' tSTRING ')'
132                         {if (! skip) (*$1)($3, $5, $7);} |
133                 VOID_FUNCTION_STRING_UINT_2STRING
134                         '(' tSTRING ',' INTEGER ',' tSTRING ',' tSTRING ')'
135                         {if (! skip) (*$1)($3, $5, $7, $9);} |
136                 VOID_FUNCTION_STRING_WPARAM_LPARAM
137                         '(' tSTRING ',' INTEGER ',' INTEGER ')'
138                         {if (! skip) (*$1)($3, $5, $7);} |
139                 VOID_FUNCTION_UINT
140                         '(' INTEGER ')'
141                         {if (! skip) (*$1)($3);} |
142                 VOID_FUNCTION_2UINT
143                         '(' INTEGER ',' INTEGER ')'
144                         {if (! skip) (*$1)($3, $5);} |
145                 VOID_FUNCTION_2UINT_STRING
146                         '(' INTEGER ',' INTEGER ',' tSTRING ')'
147                         {if (! skip) (*$1)($3, $5, $7);} |
148                 VOID_FUNCTION_3UINT
149                         '(' INTEGER ',' INTEGER ',' INTEGER ')'
150                         {if (! skip) (*$1)($3, $5, $7);} |
151                 VOID_FUNCTION_2INT_3UINT_STRING
152                         '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' tSTRING ')'
153                         {if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
154                 VOID_FUNCTION_FILE_WIN
155                         '(' file_win ')'
156                         {if (! skip) (*$1)(filename, windowname);} |
157                 VOID_FUNCTION_FILE_WIN_STRING
158                         '(' file_win ',' tSTRING ')'
159                         {if (! skip) (*$1)(filename, windowname, $5);} |
160                 VOID_FUNCTION_FILE_WIN_UINT
161                         '(' file_win ',' INTEGER ')'
162                         {if (! skip) (*$1)(filename, windowname, $5);} ;
163
164 file_win:       tSTRING
165                 {
166                   filename = windowname = $1;
167                   while (*windowname && *windowname != '>') windowname++;
168                   if (*windowname) *windowname++ = 0;
169                 } ;
170
171 bool_macro:     NOT '(' bool_macro ')' {$$ = ! $3;} |
172                 tSTRING {$$ = MACRO_IsMark($1);} |
173                 BOOL_FUNCTION_VOID '(' ')' {$$ = (*$1)();} |
174                 BOOL_FUNCTION_STRING '(' tSTRING ')' {$$ = (*$1)($3);} ;