Fix build problems introduced by r18788
[reactos.git] / reactos / tools / wrc / parser.y
index 2e2c40c..e113390 100644 (file)
  *                     - Added extra comment about grammar
  */
 #include "config.h"
+#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -251,6 +252,7 @@ static int rsrcid_to_token(int lookahead);
        fontdir_t       *fnd;
        menu_t          *men;
        menuex_t        *menex;
+       html_t          *html;
        rcdata_t        *rdt;
        stringtable_t   *stt;
        stt_entry_t     *stte;
@@ -285,7 +287,7 @@ static int rsrcid_to_token(int lookahead);
 %token <str> tSTRING tIDENT tFILENAME
 %token <raw> tRAWDATA
 %token tACCELERATORS tBITMAP tCURSOR tDIALOG tDIALOGEX tMENU tMENUEX tMESSAGETABLE
-%token tRCDATA tVERSIONINFO tSTRINGTABLE tFONT tFONTDIR tICON
+%token tRCDATA tVERSIONINFO tSTRINGTABLE tFONT tFONTDIR tICON tHTML
 %token tAUTO3STATE tAUTOCHECKBOX tAUTORADIOBUTTON tCHECKBOX tDEFPUSHBUTTON
 %token tPUSHBUTTON tRADIOBUTTON tSTATE3 /* PUSHBOX */
 %token tGROUPBOX tCOMBOBOX tLISTBOX tSCROLLBAR
@@ -323,6 +325,7 @@ static int rsrcid_to_token(int lookahead);
 %type <iptr>   helpid
 %type <dlgex>  dialogex dlgex_attribs
 %type <ctl>    exctrls gen_exctrl lab_exctrl exctrl_desc
+%type <html>   html
 %type <rdt>    rcdata
 %type <raw>    raw_data raw_elements opt_data file_raw
 %type <veri>   versioninfo fix_version
@@ -345,7 +348,7 @@ static int rsrcid_to_token(int lookahead);
 %type <lan>    opt_language
 %type <chars>  opt_characts
 %type <ver>    opt_version
-%type <num>    expr xpr
+%type <num>    expr xpr xpr_no_not
 %type <iptr>   e_expr
 %type <tlbar>  toolbar
 %type <tlbarItems>     toolbar_items
@@ -644,6 +647,7 @@ resource_definition
                        $$ = NULL;
                }
        | messagetable  { $$ = new_resource(res_msg, $1, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, $1->data->lvc.language); }
+       | html          { $$ = new_resource(res_html, $1, $1->memopt, $1->data->lvc.language); }
        | rcdata        { $$ = new_resource(res_rdt, $1, $1->memopt, $1->data->lvc.language); }
        | toolbar       { $$ = new_resource(res_toolbar, $1, $1->memopt, $1->lvc.language); }
        | userres       { $$ = new_resource(res_usr, $1, $1->memopt, $1->data->lvc.language); }
@@ -724,6 +728,10 @@ messagetable
                }
        ;
 
+/* ------------------------------ HTML ------------------------------ */
+html   : tHTML loadmemopts file_raw    { $$ = new_html($3, $2); }
+       ;
+
 /* ------------------------------ RCData ------------------------------ */
 rcdata : tRCDATA loadmemopts file_raw  { $$ = new_rcdata($3, $2); }
        ;
@@ -1002,8 +1010,8 @@ optional_style_pair
 style
        : style '|' style       { $$ = new_style($1->or_mask | $3->or_mask, $1->and_mask | $3->and_mask); free($1); free($3);}
        | '(' style ')'         { $$ = $2; }
-        | xpr                  { $$ = new_style($1, 0); }
-        | tNOT xpr             { $$ = new_style(0, $2); }
+        | xpr_no_not           { $$ = new_style($1, 0); }
+        | tNOT xpr_no_not      { $$ = new_style(0, $2); }
         ;
 
 ctlclass
@@ -1283,12 +1291,12 @@ item_definitions
  */
 item_options
        : /* Empty */                           { $$ = 0; }
-       | ',' tCHECKED          item_options    { $$ = $3 | MF_CHECKED; }
-       | ',' tGRAYED           item_options    { $$ = $3 | MF_GRAYED; }
-       | ',' tHELP             item_options    { $$ = $3 | MF_HELP; }
-       | ',' tINACTIVE         item_options    { $$ = $3 | MF_DISABLED; }
-       | ',' tMENUBARBREAK     item_options    { $$ = $3 | MF_MENUBARBREAK; }
-       | ',' tMENUBREAK        item_options    { $$ = $3 | MF_MENUBREAK; }
+       | opt_comma tCHECKED            item_options    { $$ = $3 | MF_CHECKED; }
+       | opt_comma tGRAYED             item_options    { $$ = $3 | MF_GRAYED; }
+       | opt_comma tHELP               item_options    { $$ = $3 | MF_HELP; }
+       | opt_comma tINACTIVE           item_options    { $$ = $3 | MF_DISABLED; }
+       | opt_comma tMENUBARBREAK       item_options    { $$ = $3 | MF_MENUBARBREAK; }
+       | opt_comma tMENUBREAK  item_options    { $$ = $3 | MF_MENUBREAK; }
        ;
 
 /* ------------------------------ MenuEx ------------------------------ */
@@ -1823,18 +1831,22 @@ e_expr  : /* Empty */   { $$ = 0; }
 expr   : xpr   { $$ = ($1); }
        ;
 
-xpr    : xpr '+' xpr   { $$ = ($1) + ($3); }
-       | xpr '-' xpr   { $$ = ($1) - ($3); }
-       | xpr '|' xpr   { $$ = ($1) | ($3); }
-       | xpr '&' xpr   { $$ = ($1) & ($3); }
-       | xpr '*' xpr   { $$ = ($1) * ($3); }
-       | xpr '/' xpr   { $$ = ($1) / ($3); }
-       | xpr '^' xpr   { $$ = ($1) ^ ($3); }
-       | '~' xpr       { $$ = ~($2); }
-       | '-' xpr %prec pUPM    { $$ = -($2); }
-       | '+' xpr %prec pUPM    { $$ = $2; }
-       | '(' xpr ')'   { $$ = $2; }
-       | any_num       { $$ = $1; }
+xpr_no_not     : xpr '+' xpr   { $$ = ($1) + ($3); }
+               | xpr '-' xpr   { $$ = ($1) - ($3); }
+               | xpr '|' xpr   { $$ = ($1) | ($3); }
+               | xpr '&' xpr   { $$ = ($1) & ($3); }
+               | xpr '*' xpr   { $$ = ($1) * ($3); }
+               | xpr '/' xpr   { $$ = ($1) / ($3); }
+               | xpr '^' xpr   { $$ = ($1) ^ ($3); }
+               | '~' xpr       { $$ = ~($2); }
+               | '-' xpr %prec pUPM    { $$ = -($2); }
+               | '+' xpr %prec pUPM    { $$ = $2; }
+               | '(' xpr ')'   { $$ = $2; }
+               | any_num       { $$ = $1; }
+               ;
+
+
+xpr    : xpr_no_not    { $$ = ($1); }
        | tNOT any_num  { $$ = ~($2); }
        ;
 
@@ -2308,7 +2320,7 @@ static raw_data_t *load_file(string_t *filename, language_t *lang)
        if (codepage <= 0 && filename->type != str_char)
                yyerror("Cannot convert filename to ASCII string");
        name = convert_string( filename, str_char, codepage );
-       if (!(path = wpp_find_include(name->str.cstr, 1)))
+       if (!(path = wpp_find_include(name->str.cstr, input_name, 1)))
                yyerror("Cannot open file %s", name->str.cstr);
        if (!(fp = fopen( path, "rb" )))
                yyerror("Cannot open file %s", name->str.cstr);
@@ -2567,7 +2579,7 @@ static stringtable_t *find_stringtable(lvc_t *lvc)
 }
 
 /* qsort sorting function for string table entries */
-#define STE(p) ((stt_entry_t *)(p))
+#define STE(p) ((const stt_entry_t *)(p))
 static int sort_stt_entry(const void *e1, const void *e2)
 {
        return STE(e1)->id - STE(e2)->id;
@@ -3013,6 +3025,10 @@ static int rsrcid_to_token(int lookahead)
                type = "TOOLBAR";
                token = tTOOLBAR;
                break;
+       case WRC_RT_HTML:
+               type = "HTML";
+               token = tHTML;
+               break;
 
        case WRC_RT_STRING:
                type = "STRINGTABLE";
@@ -3028,7 +3044,6 @@ static int rsrcid_to_token(int lookahead)
        case WRC_RT_DLGINCLUDE:
        case WRC_RT_PLUGPLAY:
        case WRC_RT_VXD:
-       case WRC_RT_HTML:
                yywarning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
        default:
                return lookahead;