Changeset 5523 for trunk/tools


Ignore:
Timestamp:
Apr 16, 2001, 7:12:53 PM (24 years ago)
Author:
sandervl
Message:

updates

Location:
trunk/tools/wrc
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/wrc/preproc.c

    r5522 r5523  
    297297        {
    298298                /* Search current dir and then -I path */
     299#ifdef __EMX__
    299300                fp = fopen(cpy, "rb");
     301#else
     302                fp = fopen(cpy, "rt");
     303#endif
    300304                if(fp)
    301305                {
     
    317321                strcat(path, "/");
    318322                strcat(path, cpy);
    319                 fp = fopen(path, "rb");
     323#ifdef __EMX__
     324                fp = fopen(cpy, "rb");
     325#else
     326                fp = fopen(cpy, "rt");
     327#endif
    320328                if(fp && (debuglevel & DEBUGLEVEL_PPMSG))
    321329                        printf("Going to include <%s>\n", path);
  • trunk/tools/wrc/utils.c

    r882 r5523  
    88#include "config.h"
    99
     10#include <assert.h>
    1011#include <stdio.h>
    1112#include <stdlib.h>
     
    1516#include <ctype.h>
    1617
     18#include "wine/unicode.h"
    1719#include "wrc.h"
    1820#include "utils.h"
    1921#include "parser.h"
    20 
    21 #define WANT_NEAR_INDICATION
    22 
     22#include "preproc.h"
     23
     24/* #define WANT_NEAR_INDICATION */
     25
     26static const union cptable *current_codepage;
    2327
    2428#ifdef WANT_NEAR_INDICATION
     
    3438#endif
    3539
    36 int yyerror(const char *s, ...)
    37 {
    38         va_list ap;
    39         va_start(ap, s);
    40         fprintf(stderr, "Error %s: %d, %d: ", input_name ? input_name : "stdin", line_number, char_number);
     40static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
     41{
     42        fprintf(stderr, "%s:%d:%d: %s: ", input_name ? input_name : "stdin", line_number, char_number, t);
    4143        vfprintf(stderr, s, ap);
    4244#ifdef WANT_NEAR_INDICATION
    4345        {
    44                 char *cpy = xstrdup(yytext);
    45                 make_print(cpy);
    46                 fprintf(stderr, " near '%s'\n", cpy);
    47                 free(cpy);
    48         }
    49 #else
     46                char *cpy;
     47                if(n)
     48                {
     49                        cpy = xstrdup(n);
     50                        make_print(cpy);
     51                        fprintf(stderr, " near '%s'", cpy);
     52                        free(cpy);
     53                }
     54        }
     55#endif
    5056        fprintf(stderr, "\n");
    51 #endif
     57}
     58
     59
     60int yyerror(const char *s, ...)
     61{
     62        va_list ap;
     63        va_start(ap, s);
     64        generic_msg(s, "Error", yytext, ap);
    5265        va_end(ap);
    5366        exit(1);
     
    5972        va_list ap;
    6073        va_start(ap, s);
    61         fprintf(stderr, "Warning %s: %d, %d: ", input_name ? input_name : "stdin", line_number, char_number);
    62         vfprintf(stderr, s, ap);
    63 #ifdef WANT_NEAR_INDICATION
    64         {
    65                 char *cpy = xstrdup(yytext);
    66                 make_print(cpy);
    67                 fprintf(stderr, " near '%s'\n", cpy);
    68                 free(cpy);
    69         }
    70 #else
    71         fprintf(stderr, "\n");
    72 #endif
     74        generic_msg(s, "Warning", yytext, ap);
    7375        va_end(ap);
    7476        return 0;
    7577}
     78
     79int pperror(const char *s, ...)
     80{
     81        va_list ap;
     82        va_start(ap, s);
     83        generic_msg(s, "Error", pptext, ap);
     84        va_end(ap);
     85        exit(1);
     86        return 1;
     87}
     88
     89int ppwarning(const char *s, ...)
     90{
     91        va_list ap;
     92        va_start(ap, s);
     93        generic_msg(s, "Warning", pptext, ap);
     94        va_end(ap);
     95        return 0;
     96}
     97
    7698
    7799void internal_error(const char *file, int line, const char *s, ...)
     
    151173
    152174    assert(size > 0);
    153     assert(size < 102400);
    154175    res = malloc(size);
    155176    if(res == NULL)
     
    157178        error("Virtual memory exhausted.\n");
    158179    }
     180    /*
     181     * We set it to 0.
     182     * This is *paramount* because we depend on it
     183     * just about everywhere in the rest of the code.
     184     */
    159185    memset(res, 0, size);
    160186    return res;
     
    167193
    168194    assert(size > 0);
    169     assert(size < 102400);
    170195    res = realloc(p, size);
    171196    if(res == NULL)
     
    178203char *xstrdup(const char *str)
    179204{
    180         char *s = (char *)xmalloc(strlen(str)+1);
     205        char *s;
     206
     207        assert(str != NULL);
     208        s = (char *)xmalloc(strlen(str)+1);
    181209        return strcpy(s, str);
    182210}
    183211
    184 int string_compare(const string_t *s1, const string_t *s2)
    185 {
    186         if(s1->type == str_char && s2->type == str_char)
    187         {
    188                 return strcasecmp(s1->str.cstr, s2->str.cstr);
    189         }
     212short *dupcstr2wstr(const char *str)
     213{
     214        int len;
     215        WCHAR *ws;
     216
     217        if (!current_codepage) set_language( LANG_NEUTRAL, SUBLANG_NEUTRAL );
     218        len = cp_mbstowcs( current_codepage, 0, str, strlen(str), NULL, 0 );
     219        ws = xmalloc( sizeof(WCHAR) * (len + 1) );
     220        len = cp_mbstowcs( current_codepage, 0, str, strlen(str), ws, len );
     221        ws[len] = 0;
     222        return ws;
     223}
     224
     225char *dupwstr2cstr(const short *str)
     226{
     227        int len;
     228        char *cs;
     229
     230        if (!current_codepage) set_language( LANG_NEUTRAL, SUBLANG_NEUTRAL );
     231        len = cp_wcstombs( current_codepage, 0, str, strlenW(str), NULL, 0, NULL, NULL );
     232        cs = xmalloc( len + 1 );
     233        len = cp_wcstombs( current_codepage, 0, str, strlenW(str),  cs, len, NULL, NULL );
     234        cs[len] = 0;
     235        return cs;
     236}
     237
     238/*
     239 *****************************************************************************
     240 * Function     : compare_name_id
     241 * Syntax       : int compare_name_id(name_id_t *n1, name_id_t *n2)
     242 * Input        :
     243 * Output       :
     244 * Description  :
     245 * Remarks      :
     246 *****************************************************************************
     247*/
     248int compare_name_id(name_id_t *n1, name_id_t *n2)
     249{
     250        if(n1->type == name_ord && n2->type == name_ord)
     251        {
     252                return n1->name.i_name - n2->name.i_name;
     253        }
     254        else if(n1->type == name_str && n2->type == name_str)
     255        {
     256                if(n1->name.s_name->type == str_char
     257                && n2->name.s_name->type == str_char)
     258                {
     259                        return strcasecmp(n1->name.s_name->str.cstr, n2->name.s_name->str.cstr);
     260                }
     261                else if(n1->name.s_name->type == str_unicode
     262                && n2->name.s_name->type == str_unicode)
     263                {
     264                        return strcmpiW(n1->name.s_name->str.wstr, n2->name.s_name->str.wstr);
     265                }
     266                else
     267                {
     268                        internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type");
     269                }
     270        }
     271        else if(n1->type == name_ord && n2->type == name_str)
     272                return 1;
     273        else if(n1->type == name_str && n2->type == name_ord)
     274                return -1;
    190275        else
    191         {
    192                 internal_error(__FILE__, __LINE__, "Cannot yet compare unicode strings");
    193         }
    194         return 0;
    195 }
    196 
    197 int wstrlen(const short *s)
    198 {
    199         int cnt = 0;
    200         while(*s++)
    201                 cnt++;
    202         return cnt;
    203 }
    204 
    205 short *wstrcpy(short *dst, const short *src)
    206 {
    207         short *d = dst;
    208         while(*src)
    209                 *d++ = *src++;
    210         return dst;
    211 }
    212 
    213 int wstricmp(const short *s1, const short *s2)
    214 {
    215         char *cs1 = dupwstr2cstr(s1);
    216         char *cs2 = dupwstr2cstr(s2);
    217         int retval = strcasecmp(cs1, cs2);
    218         free(cs1);
    219         free(cs2);
    220         warning("Comparing unicode strings without case -> converting to ascii");
    221         return retval;;
    222 }
    223 
    224 short *dupcstr2wstr(const char *str)
    225 {
    226         int len = strlen(str) + 1;
    227         short *ws = (short *)xmalloc(len*2);
    228         short *wptr;
    229 
    230         wptr = ws;
    231         /* FIXME: codepage translation */
    232         while(*str)
    233                 *wptr++ = (short)(*str++ & 0xff);
    234         *wptr = 0;
    235         return ws;
    236 }
    237 
    238 char *dupwstr2cstr(const short *str)
    239 {
    240         int len = wstrlen(str) + 1;
    241         char *cs = (char *)xmalloc(len);
    242         char *cptr;
    243 
    244         cptr = cs;
    245         /* FIXME: codepage translation */
    246         while(*str)
    247                 *cptr++ = (char)*str++;
    248         *cptr = 0;
    249         return cs;
    250 }
    251 
     276                internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)",
     277                                n1->type, n2->type);
     278
     279        return 0; /* Keep the compiler happy */
     280}
     281
     282string_t *convert_string(const string_t *str, enum str_e type)
     283{
     284        string_t *ret = xmalloc(sizeof(*ret));
     285
     286        if((str->type == str_char) && (type == str_unicode))
     287        {
     288                ret->str.wstr = dupcstr2wstr(str->str.cstr);
     289                ret->type     = str_unicode;
     290                ret->size     = strlenW(ret->str.wstr);
     291        }
     292        else if((str->type == str_unicode) && (type == str_char))
     293        {
     294                ret->str.cstr = dupwstr2cstr(str->str.wstr);
     295                ret->type     = str_char;
     296                ret->size     = strlen(ret->str.cstr);
     297        }
     298        else if(str->type == str_unicode)
     299        {
     300                ret->type     = str_unicode;
     301                ret->size     = strlenW(str->str.wstr);
     302                ret->str.wstr = xmalloc(sizeof(WCHAR)*(ret->size+1));
     303                strcpyW(ret->str.wstr, str->str.wstr);
     304        } 
     305        else /* str->type == str_char */
     306        {
     307                ret->type     = str_char;
     308                ret->size     = strlen(str->str.cstr);
     309                ret->str.cstr = xmalloc( ret->size + 1 );
     310                strcpy(ret->str.cstr, str->str.cstr);
     311        }
     312        return ret;
     313}
     314
     315
     316struct lang2cp
     317{
     318    unsigned short lang;
     319    unsigned short sublang;
     320    unsigned int   cp;
     321} lang2cp_t;
     322
     323/* language to codepage conversion table */
     324/* specific sublanguages need only be specified if their codepage */
     325/* differs from the default (SUBLANG_NEUTRAL) */
     326static const struct lang2cp lang2cps[] =
     327{
     328    { LANG_AFRIKAANS,      SUBLANG_NEUTRAL,              1252 },
     329    { LANG_ALBANIAN,       SUBLANG_NEUTRAL,              1250 },
     330    { LANG_ARABIC,         SUBLANG_NEUTRAL,              1256 },
     331    { LANG_BASQUE,         SUBLANG_NEUTRAL,              1252 },
     332    { LANG_BRETON,         SUBLANG_NEUTRAL,              1252 },
     333    { LANG_BULGARIAN,      SUBLANG_NEUTRAL,              1251 },
     334    { LANG_BYELORUSSIAN,   SUBLANG_NEUTRAL,              1251 },
     335    { LANG_CATALAN,        SUBLANG_NEUTRAL,              1252 },
     336    { LANG_CHINESE,        SUBLANG_NEUTRAL,              936  },
     337    { LANG_CORNISH,        SUBLANG_NEUTRAL,              1252 },
     338    { LANG_CZECH,          SUBLANG_NEUTRAL,              1250 },
     339    { LANG_DANISH,         SUBLANG_NEUTRAL,              1252 },
     340    { LANG_DUTCH,          SUBLANG_NEUTRAL,              1252 },
     341    { LANG_ENGLISH,        SUBLANG_NEUTRAL,              1252 },
     342    { LANG_ESPERANTO,      SUBLANG_NEUTRAL,              1252 },
     343    { LANG_ESTONIAN,       SUBLANG_NEUTRAL,              1257 },
     344    { LANG_FAEROESE,       SUBLANG_NEUTRAL,              1252 },
     345    { LANG_FINNISH,        SUBLANG_NEUTRAL,              1252 },
     346    { LANG_FRENCH,         SUBLANG_NEUTRAL,              1252 },
     347    { LANG_GAELIC,         SUBLANG_NEUTRAL,              1252 },
     348    { LANG_GERMAN,         SUBLANG_NEUTRAL,              1252 },
     349    { LANG_GREEK,          SUBLANG_NEUTRAL,              1253 },
     350    { LANG_HEBREW,         SUBLANG_NEUTRAL,              1255 },
     351    { LANG_HUNGARIAN,      SUBLANG_NEUTRAL,              1250 },
     352    { LANG_ICELANDIC,      SUBLANG_NEUTRAL,              1252 },
     353    { LANG_INDONESIAN,     SUBLANG_NEUTRAL,              1252 },
     354    { LANG_ITALIAN,        SUBLANG_NEUTRAL,              1252 },
     355    { LANG_JAPANESE,       SUBLANG_NEUTRAL,              932  },
     356    { LANG_KOREAN,         SUBLANG_NEUTRAL,              949  },
     357    { LANG_LATVIAN,        SUBLANG_NEUTRAL,              1257 },
     358    { LANG_LITHUANIAN,     SUBLANG_NEUTRAL,              1257 },
     359    { LANG_MACEDONIAN,     SUBLANG_NEUTRAL,              1251 },
     360    { LANG_MALAY,          SUBLANG_NEUTRAL,              1252 },
     361    { LANG_NEUTRAL,        SUBLANG_NEUTRAL,              1252 },
     362    { LANG_NORWEGIAN,      SUBLANG_NEUTRAL,              1252 },
     363    { LANG_POLISH,         SUBLANG_NEUTRAL,              1250 },
     364    { LANG_PORTUGUESE,     SUBLANG_NEUTRAL,              1252 },
     365    { LANG_ROMANIAN,       SUBLANG_NEUTRAL,              1250 },
     366    { LANG_RUSSIAN,        SUBLANG_NEUTRAL,              1251 },
     367    { LANG_SERBO_CROATIAN, SUBLANG_NEUTRAL,              1250 },
     368    { LANG_SERBO_CROATIAN, SUBLANG_SERBIAN,              1251 },
     369    { LANG_SLOVAK,         SUBLANG_NEUTRAL,              1250 },
     370    { LANG_SLOVENIAN,      SUBLANG_NEUTRAL,              1250 },
     371    { LANG_SPANISH,        SUBLANG_NEUTRAL,              1252 },
     372    { LANG_SWEDISH,        SUBLANG_NEUTRAL,              1252 },
     373    { LANG_THAI,           SUBLANG_NEUTRAL,              874  },
     374    { LANG_TURKISH,        SUBLANG_NEUTRAL,              1254 },
     375    { LANG_UKRAINIAN,      SUBLANG_NEUTRAL,              1251 },
     376    { LANG_VIETNAMESE,     SUBLANG_NEUTRAL,              1258 },
     377    { LANG_WALON,          SUBLANG_NEUTRAL,              1252 },
     378    { LANG_WELSH,          SUBLANG_NEUTRAL,              1252 }
     379};
     380
     381void set_language( unsigned short lang, unsigned short sublang )
     382{
     383    unsigned int i;
     384    unsigned int cp = 0, defcp = 0;
     385
     386    for (i = 0; i < sizeof(lang2cps)/sizeof(lang2cps[0]); i++)
     387    {
     388        if (lang2cps[i].lang != lang) continue;
     389        if (lang2cps[i].sublang == sublang)
     390        {
     391            cp = lang2cps[i].cp;
     392            break;
     393        }
     394        if (lang2cps[i].sublang == SUBLANG_NEUTRAL) defcp = lang2cps[i].cp;
     395    }
     396
     397    if (!cp) cp = defcp;
     398    if (!cp)
     399        error( "No codepage value for language %04x", MAKELANGID(lang,sublang) );
     400    if (!(current_codepage = cp_get_table( cp )))
     401        error( "Bad codepage %d for language %04x", cp, MAKELANGID(lang,sublang) );
     402}
     403
     404#ifdef __EMX__
     405WCHAR WINAPI toupperW( WCHAR ch )
     406{
     407    extern const WCHAR casemap_upper[];
     408    return ch + casemap_upper[casemap_upper[ch >> 8] + (ch & 0xff)];
     409}
     410
     411WCHAR WINAPI tolowerW( WCHAR ch )
     412{
     413    extern const WCHAR casemap_lower[];
     414    return ch + casemap_lower[casemap_lower[ch >> 8] + (ch & 0xff)];
     415}
     416
     417int strcasecmp( char *p1, char *p2 )
     418{
     419        return stricmp( p1, p2 );
     420}
     421
     422int lstrcmpiA( char *p1, char *p2 )
     423{
     424        return stricmp( p1, p2 );
     425}
     426#endif
  • trunk/tools/wrc/utils.h

    r882 r5523  
    1919char *xstrdup(const char *str);
    2020
    21 int yyerror(const char *s, ...);
    22 int yywarning(const char *s, ...);
    23 void internal_error(const char *file, int line, const char *s, ...);
    24 void error(const char *s, ...);
    25 void warning(const char *s, ...);
    26 void chat(const char *s, ...);
     21int pperror(const char *s, ...) __attribute__((format (printf, 1, 2)));
     22int ppwarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
     23int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
     24int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
     25void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
     26void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
     27void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
     28void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
    2729
    2830char *dup_basename(const char *name, const char *ext);
    29 int string_compare(const string_t *s1, const string_t *s2);
    30 int wstrlen(const short *s);
    31 short *wstrcpy(short *dst, const short *src);
    32 int wstricmp(const short *s1, const short *s2);
    3331char *dupwstr2cstr(const short *str);
    3432short *dupcstr2wstr(const char *str);
     33int compare_name_id(name_id_t *n1, name_id_t *n2);
     34string_t *convert_string(const string_t *str, enum str_e type);
     35void set_language(unsigned short lang, unsigned short sublang);
    3536
    3637#endif
  • trunk/tools/wrc/wrc.c

    r3426 r5523  
    44 * Copyrignt 1998 Bertho A. Stultiens (BS)
    55 *
     6 * 30-Apr-2000 BS       - Integrated a new preprocessor (-E and -N)
    67 * 20-Jun-1998 BS       - Added -L option to prevent case conversion
    78 *                        of embedded filenames.
     
    3738#include <stdio.h>
    3839#include <stdlib.h>
     40#include <unistd.h>
    3941#include <string.h>
    4042#include <assert.h>
    4143#include <ctype.h>
     44#include <signal.h>
    4245
    4346#include "wrc.h"
     
    5154#include "parser.h"
    5255
    53 char usage[] = "Usage: wrc [options...] [infile[.rc|.res]]\n"
     56static char usage[] =
     57        "Usage: wrc [options...] [infile[.rc|.res]]\n"
    5458        "   -a n        Alignment of resource (win16 only, default is 4)\n"
    5559        "   -A          Auto register resources (only with gcc 2.7 and better)\n"
    56         "   -b          Create a C array from a binary .res file\n"
     60        "   -b          Create an assembly array from a binary .res file\n"
     61        "   -B x        Set output byte-order x={n[ative], l[ittle], b[ig]}\n"
     62        "               (win32 only; default is n[ative] which equals "
     63#ifdef WORDS_BIGENDIAN
     64        "big"
     65#else
     66        "little"
     67#endif
     68        "-endian)\n"
    5769        "   -c          Add 'const' prefix to C constants\n"
    5870        "   -C cp       Set the resource's codepage to cp (default is 0)\n"
     
    6072        "   -D id[=val] Define preprocessor identifier id=val\n"
    6173        "   -e          Disable recognition of win32 keywords in 16bit compile\n"
     74        "   -E          Preprocess only\n"
    6275        "   -g          Add symbols to the global c namespace\n"
    6376        "   -h          Also generate a .h file\n"
    6477        "   -H file     Same as -h but written to file\n"
    6578        "   -I path     Set include search dir to path (multiple -I allowed)\n"
    66         "   -l lan      Set default language to lan (default is neutral {0})\n"
     79        "   -l lan      Set default language to lan (default is neutral {0, 0})\n"
    6780        "   -L          Leave case of embedded filenames as is\n"
     81        "   -m          Do not remap numerical resource IDs\n"
    6882        "   -n          Do not generate .s file\n"
     83        "   -N          Do not preprocess input\n"
    6984        "   -o file     Output to file (default is infile.[res|s|h]\n"
    7085        "   -p prefix   Give a prefix for the generated names\n"
     
    8196        "    * 0x02 Dump internal structures\n"
    8297        "    * 0x04 Create a parser trace (yydebug=1)\n"
     98        "    * 0x08 Preprocessor messages\n"
     99        "    * 0x10 Preprocessor lex messages\n"
     100        "    * 0x20 Preprocessor yacc trace\n"
    83101        "The -o option only applies to the final destination file, which is\n"
    84102        "in case of normal compile a .s file. You must use the '-H header.h'\n"
     
    89107
    90108char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
    91                         "Copyright 1998,1999 Bertho A. Stultiens\n"
     109                        "Copyright 1998-2000 Bertho A. Stultiens\n"
    92110                        "          1994 Martin von Loewis\n";
    93111
     
    122140 * debuglevel & DEBUGLEVEL_DUMP         Dump internal structures
    123141 * debuglevel & DEBUGLEVEL_TRACE        Create parser trace
     142 * debuglevel & DEBUGLEVEL_PPMSG        Preprocessor messages
     143 * debuglevel & DEBUGLEVEL_PPLEX        Preprocessor lex trace
     144 * debuglevel & DEBUGLEVEL_PPTRACE      Preprocessor yacc trace
    124145 */
    125146int debuglevel = DEBUGLEVEL_NONE;
     
    198219 */
    199220int leave_case = 0;
     221
     222/*
     223 * The output byte-order of resources (set with -B)
     224 */
     225int byteorder = WRC_BO_NATIVE;
     226
     227/*
     228 * Set when _only_ to run the preprocessor (-E option)
     229 */
     230int preprocess_only = 0;
     231
     232/*
     233 * Set when _not_ to run the preprocessor (-N option)
     234 */
     235int no_preprocess = 0;
     236
     237/*
     238 * Cleared when _not_ to remap resource types (-m option)
     239 */
     240int remap = 1;
    200241
    201242char *output_name;              /* The name given by the -o option */
    202243char *input_name;               /* The name given on the command-line */
    203244char *header_name;              /* The name given by the -H option */
     245char *temp_name;                /* Temporary file for preprocess pipe */
     246
     247int line_number = 1;            /* The current line */
     248int char_number = 1;            /* The current char pos within the line */
    204249
    205250char *cmdline;                  /* The entire commandline */
     251time_t now;                     /* The time of start of wrc */
    206252
    207253resource_t *resource_top;       /* The top of the parsed resources */
    208254
     255#ifdef __EMX__
     256int getopt (int argc, char **argv, const char *optstring);
     257#else
    209258int getopt (int argc, char *const *argv, const char *optstring);
     259#endif
     260
     261static void rm_tempfile(void);
     262static void segvhandler(int sig);
    210263
    211264int main(int argc,char *argv[])
     
    220273        int cmdlen;
    221274
     275        signal(SIGSEGV, segvhandler);
     276
     277        now = time(NULL);
     278
    222279        /* First rebuild the commandline to put in destination */
    223280        /* Could be done through env[], but not all OS-es support it */
     
    234291        }
    235292
    236         while((optc = getopt(argc, argv, "a:AbcC:d:D:eghH:I:l:Lno:p:rstTVw:W")) != EOF)
     293        while((optc = getopt(argc, argv, "a:AbB:cC:d:D:eEghH:I:l:LmnNo:p:rstTVw:W")) != EOF)
    237294        {
    238295                switch(optc)
     
    247304                        binary = 1;
    248305                        break;
     306                case 'B':
     307                        switch(optarg[0])
     308                        {
     309                        case 'n':
     310                        case 'N':
     311                                byteorder = WRC_BO_NATIVE;
     312                                break;
     313                        case 'l':
     314                        case 'L':
     315                                byteorder = WRC_BO_LITTLE;
     316                                break;
     317                        case 'b':
     318                        case 'B':
     319                                byteorder = WRC_BO_BIG;
     320                                break;
     321                        default:
     322                                fprintf(stderr, "Byteordering must be n[ative], l[ittle] or b[ig]\n");
     323                                lose++;
     324                        }
     325                        break;
    249326                case 'c':
    250327                        constant = 1;
     
    261338                case 'e':
    262339                        extensions = 0;
     340                        break;
     341                case 'E':
     342                        preprocess_only = 1;
    263343                        break;
    264344                case 'g':
     
    284364                        leave_case = 1;
    285365                        break;
     366                case 'm':
     367                        remap = 0;
     368                        break;
    286369                case 'n':
    287370                        create_s = 0;
     371                        break;
     372                case 'N':
     373                        no_preprocess = 1;
    288374                        break;
    289375                case 'o':
     
    391477        }
    392478
     479        if(byteorder != WRC_BO_NATIVE)
     480        {
     481                if(binary)
     482                        error("Forced byteordering not supported for binary resources\n");
     483        }
     484
     485        if(preprocess_only)
     486        {
     487                if(constant)
     488                {
     489                        warning("Option -c ignored with preprocess only\n");
     490                        constant = 0;
     491                }
     492
     493                if(create_header)
     494                {
     495                        warning("Option -[h|H] ignored with preprocess only\n");
     496                        create_header = 0;
     497                }
     498
     499                if(indirect)
     500                {
     501                        warning("Option -l ignored with preprocess only\n");
     502                        indirect = 0;
     503                }
     504
     505                if(indirect_only)
     506                {
     507                        error("Option -E and -L cannot be used together\n");
     508                }
     509
     510                if(global)
     511                {
     512                        warning("Option -g ignored with preprocess only\n");
     513                        global = 0;
     514                }
     515
     516                if(create_dir)
     517                {
     518                        warning("Option -s ignored with preprocess only\n");
     519                        create_dir = 0;
     520                }
     521
     522                if(binary)
     523                {
     524                        error("Option -E and -b cannot be used together\n");
     525                }
     526
     527                if(no_preprocess)
     528                {
     529                        error("Option -E and -N cannot be used together\n");
     530                }
     531        }
     532
     533#if !defined(HAVE_WINE_CONSTRUCTOR)
     534        if(auto_register)
     535        {
     536                warning("Autoregister code non-operable (HAVE_WINE_CONSTRUCTOR not defined)");
     537                auto_register = 0;
     538        }
     539#endif
     540
    393541        /* Set alignment power */
    394542        a = alignment;
     
    414562
    415563        yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
     564        yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
     565        ppdebug = debuglevel & DEBUGLEVEL_PPTRACE ? 1 : 0;
     566        pp_flex_debug = debuglevel & DEBUGLEVEL_PPLEX ? 1 : 0;
    416567
    417568        /* Set the default defined stuff */
     569        add_cmdline_define("__WRC__=" WRC_EXP_STRINGIZE(WRC_MAJOR_VERSION));
     570        add_cmdline_define("__WRC_MINOR__=" WRC_EXP_STRINGIZE(WRC_MINOR_VERSION));
     571        add_cmdline_define("__WRC_MICRO__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
     572        add_cmdline_define("__WRC_PATCH__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
     573
    418574        add_cmdline_define("RC_INVOKED=1");
    419         add_cmdline_define("__WRC__=1");
     575
    420576        if(win32)
    421577        {
     
    423579                add_cmdline_define("__FLAT__=1");
    424580        }
     581
     582        add_special_define("__FILE__");
     583        add_special_define("__LINE__");
     584        add_special_define("__DATE__");
     585        add_special_define("__TIME__");
    425586
    426587        /* Check if the user set a language, else set default */
     
    432593        {
    433594                input_name = argv[optind];
    434                 yyin = fopen(input_name, "rb");
    435                 if(!yyin)
    436                 {
    437                         error("Could not open %s\n", input_name);
    438                 }
    439         }
    440         else
    441         {
    442                 yyin = stdin;
    443595        }
    444596
    445597        if(binary && !input_name)
    446598        {
    447                 error("Binary mode requires .res file as input");
    448         }
    449 
    450         if(!output_name)
     599                error("Binary mode requires .res file as input\n");
     600        }
     601
     602        /* Generate appropriate outfile names */
     603        if(!output_name && !preprocess_only)
    451604        {
    452605                output_name = dup_basename(input_name, binary ? ".res" : ".rc");
     
    460613        }
    461614
     615        /* Run the preprocessor on the input */
     616        if(!no_preprocess && !binary)
     617        {
     618                char *real_name;
     619                /*
     620                 * Preprocess the input to a temp-file, or stdout if
     621                 * no output was given.
     622                 */
     623
     624                chat("Starting preprocess");
     625
     626                if(preprocess_only && !output_name)
     627                {
     628                        ppout = stdout;
     629                }
     630                else if(preprocess_only && output_name)
     631                {
     632                        if(!(ppout = fopen(output_name, "wb")))
     633                                error("Could not open %s for writing\n", output_name);
     634                }
     635                else
     636                {
     637                        if(!(temp_name = tmpnam(NULL)))
     638                                error("Could nor generate a temp-name\n");
     639                        temp_name = xstrdup(temp_name);
     640                        if(!(ppout = fopen(temp_name, "wb")))
     641                                error("Could not create a temp-file\n");
     642
     643                        atexit(rm_tempfile);
     644                }
     645
     646                real_name = input_name; /* Because it gets overwritten */
     647
     648                if(!input_name)
     649                        ppin = stdin;
     650                else
     651                {
     652                        if(!(ppin = fopen(input_name, "rb")))
     653                                error("Could not open %s\n", input_name);
     654                }
     655
     656                fprintf(ppout, "# 1 \"%s\" 1\n", input_name ? input_name : "");
     657
     658                ret = ppparse();
     659
     660                input_name = real_name;
     661
     662                if(input_name)
     663                        fclose(ppin);
     664
     665                fclose(ppout);
     666
     667                input_name = temp_name;
     668
     669                if(ret)
     670                        exit(1);        /* Error during preprocess */
     671
     672                if(preprocess_only)
     673                        exit(0);
     674        }
     675
    462676        if(!binary)
    463677        {
    464678                /* Go from .rc to .res or .s */
    465679                chat("Starting parse");
     680
     681                if(!(yyin = fopen(input_name, "rb")))
     682                        error("Could not open %s for input\n", input_name);
     683
    466684                ret = yyparse();
    467685
     
    522740
    523741
    524 
    525 
     742static void rm_tempfile(void)
     743{
     744        if(temp_name)
     745                unlink(temp_name);
     746}
     747
     748static void segvhandler(int sig)
     749{
     750        fprintf(stderr, "\n%s:%d: Oops, segment violation\n", input_name, line_number);
     751        fflush(stdout);
     752        fflush(stderr);
     753        abort();
     754}
     755
  • trunk/tools/wrc/wrc.h

    r3426 r5523  
    1313#endif
    1414
    15 //ifdef __WIN32OS2__
    16 #define strcasecmp stricmp
     15#include <time.h>       /* For time_t */
    1716
    18 #define WRC_VERSION     "1.0.18"
    19 #define WRC_RELEASEDATE "(28-Dec-1999)"
    20 #define WRC_FULLVERSION WRC_VERSION " " WRC_RELEASEDATE
     17#define WRC_MAJOR_VERSION       1
     18#define WRC_MINOR_VERSION       1
     19#define WRC_MICRO_VERSION       9
     20#define WRC_RELEASEDATE         "(31-Dec-2000)"
    2121
    22 /* Only used in heavy debugging sessions */
    23 #define HEAPCHECK()
     22#define WRC_STRINGIZE(a)        #a
     23#define WRC_EXP_STRINGIZE(a)    WRC_STRINGIZE(a)
     24#define WRC_VERSIONIZE(a,b,c)   WRC_STRINGIZE(a) "." WRC_STRINGIZE(b) "." WRC_STRINGIZE(c) 
     25#define WRC_VERSION             WRC_VERSIONIZE(WRC_MAJOR_VERSION, WRC_MINOR_VERSION, WRC_MICRO_VERSION)
     26#define WRC_FULLVERSION         WRC_VERSION " " WRC_RELEASEDATE
     27
     28#ifndef MAX
     29#define MAX(a,b)        ((a) > (b) ? (a) : (b))
     30#endif
    2431
    2532/* From wrc.c */
     
    2936#define DEBUGLEVEL_DUMP         0x0002
    3037#define DEBUGLEVEL_TRACE        0x0004
     38#define DEBUGLEVEL_PPMSG        0x0008
     39#define DEBUGLEVEL_PPLEX        0x0010
     40#define DEBUGLEVEL_PPTRACE      0x0020
    3141
    3242extern int win32;
     
    4757extern int auto_register;
    4858extern int leave_case;
     59extern int byteorder;
     60extern int preprocess_only;
     61extern int no_preprocess;
     62extern int remap;
    4963
    5064extern char *prefix;
     
    5367extern char *header_name;
    5468extern char *cmdline;                   
     69extern time_t now;
     70
     71extern int line_number;
     72extern int char_number;
    5573
    5674extern resource_t *resource_top;
  • trunk/tools/wrc/wrctypes.h

    r3426 r5523  
    4545#define WRC_RT_ANICURSOR        (21)
    4646#define WRC_RT_ANIICON          (22)
     47#define WRC_RT_HTML             (23)
    4748#define WRC_RT_DLGINIT          (240)
    4849#define WRC_RT_TOOLBAR          (241) 
     
    5657#define CT_COMBOBOX     0x85
    5758
     59/* Byteordering defines */
     60#define WRC_BO_NATIVE   0x00
     61#define WRC_BO_LITTLE   0x01
     62#define WRC_BO_BIG      0x02
     63
     64#define WRC_LOBYTE(w)           ((WORD)(w) & 0xff)
     65#define WRC_HIBYTE(w)           (((WORD)(w) >> 8) & 0xff)
     66#define WRC_LOWORD(d)           ((DWORD)(d) & 0xffff)
     67#define WRC_HIWORD(d)           (((DWORD)(d) >> 16) & 0xffff)
     68#define BYTESWAP_WORD(w)        ((WORD)(((WORD)WRC_LOBYTE(w) << 8) + (WORD)WRC_HIBYTE(w)))
     69#define BYTESWAP_DWORD(d)       ((DWORD)(((DWORD)BYTESWAP_WORD(WRC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WRC_HIWORD(d)))))
    5870
    5971/* Binary resource structure */
     
    150162        res_pnp,        /* Not implemented, no layout available */
    151163        res_vxd,        /* Not implemented, no layout available */
    152         res_anicur,     /* Not implemented, no layout available */
    153         res_aniico,     /* Not implemented, no layout available */
     164        res_anicur,
     165        res_aniico,
     166        res_html,       /* Not implemented, no layout available */
    154167
    155168        res_dlginit = WRC_RT_DLGINIT,   /* 240 */
     
    163176/* Raw bytes in a row... */
    164177typedef struct raw_data {
    165         int     size;
    166         char    *data;
     178        unsigned int    size;
     179        char            *data;
     180        lvc_t           lvc;            /* Localized data */
    167181} raw_data_t;
    168182
     
    276290} itemex_opt_t;
    277291
    278 /* RC structures for types read from file or supplied binary */
     292/*
     293 * Font resources
     294 */
    279295typedef struct font {
    280296        DWORD           memopt;
     
    282298} font_t;
    283299
     300typedef struct fontdir {
     301        DWORD           memopt;
     302        raw_data_t      *data;
     303} fontdir_t;
     304
     305/*
     306 * Icon resources
     307 */
     308typedef struct icon_header {
     309        WORD    reserved;       /* Don't know, should be 0 I guess */
     310        WORD    type;           /* Always 1 for icons */
     311        WORD    count;          /* Number of packed icons in resource */
     312} icon_header_t;
     313
    284314typedef struct icon_dir_entry {
    285     BYTE  width;        /* From the SDK doc. */
    286     BYTE  height;
    287     BYTE  nclr;
    288     BYTE  reserved;
    289     WORD  planes;
    290     WORD  bits;
    291     DWORD ressize;
    292     DWORD offset;
     315        BYTE    width;          /* From the SDK doc. */
     316        BYTE    height;
     317        BYTE    nclr;
     318        BYTE    reserved;
     319        WORD    planes;
     320        WORD    bits;
     321        DWORD   ressize;
     322        DWORD   offset;
    293323} icon_dir_entry_t;
    294324
     
    313343} icon_group_t;
    314344
     345/*
     346 * Cursor resources
     347 */
     348typedef struct cursor_header {
     349        WORD    reserved;       /* Don't know, should be 0 I guess */
     350        WORD    type;           /* Always 2 for cursors */
     351        WORD    count;          /* Number of packed cursors in resource */
     352} cursor_header_t;
     353
    315354typedef struct cursor_dir_entry {
    316     BYTE  width;        /* From the SDK doc. */
    317     BYTE  height;
    318     BYTE  nclr;
    319     BYTE  reserved;
    320     WORD  xhot;
    321     WORD  yhot;
    322     DWORD ressize;
    323     DWORD offset;
     355        BYTE    width;          /* From the SDK doc. */
     356        BYTE    height;
     357        BYTE    nclr;
     358        BYTE    reserved;
     359        WORD    xhot;
     360        WORD    yhot;
     361        DWORD   ressize;
     362        DWORD   offset;
    324363} cursor_dir_entry_t;
    325364
     
    346385} cursor_group_t;
    347386
     387/*
     388 * Animated cursors and icons
     389 */
     390typedef struct aniheader {
     391        DWORD   structsize;     /* Header size (36 bytes) */
     392        DWORD   frames;         /* Number of unique icons in this cursor */
     393        DWORD   steps;          /* Number of blits before the animation cycles */
     394        DWORD   cx;             /* reserved, must be 0? */
     395        DWORD   cy;             /* reserved, must be 0? */
     396        DWORD   bitcount;       /* reserved, must be 0? */
     397        DWORD   planes;         /* reserved, must be 0? */
     398        DWORD   rate;           /* Default rate (1/60th of a second) if "rate" not present */
     399        DWORD   flags;          /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
     400} aniheader_t;
     401
     402typedef struct riff_tag {
     403        BYTE    tag[4];
     404        DWORD   size;
     405} riff_tag_t;
     406
     407typedef struct ani_curico {
     408        DWORD           memopt;
     409        raw_data_t      *data;
     410} ani_curico_t;
     411
     412typedef struct ani_any {
     413        enum res_e      type;
     414        union {
     415                ani_curico_t    *ani;
     416                cursor_group_t  *curg;
     417                icon_group_t    *icog;
     418        } u;
     419} ani_any_t;
     420
     421/*
     422 * Bitmaps
     423 */
    348424typedef struct bitmap {
    349425        DWORD           memopt;
     
    353429typedef struct rcdata {
    354430        DWORD           memopt;
    355         lvc_t           lvc;
    356431        raw_data_t      *data;
    357432} rcdata_t;
     
    363438} user_t;
    364439
     440/*
     441 * Messagetables
     442 */
     443typedef struct msgtab_block {
     444        DWORD   idlo;           /* Lowest id in the set */
     445        DWORD   idhi;           /* Highest is in the set */
     446        DWORD   offset;         /* Offset from resource start to first entry */
     447} msgtab_block_t;
     448
     449typedef struct msgtab_entry {
     450        WORD    length;         /* Length of the data in bytes */
     451        WORD    flags;          /* 0 for char, 1 for WCHAR */
     452/*      {char}|{WCHAR} data[...]; */
     453} msgtab_entry_t;
     454
    365455typedef struct messagetable {
     456        DWORD           memopt;
    366457        raw_data_t      *data;
    367458} messagetable_t;
     
    439530        } gotit;
    440531        ver_block_t     *blocks;
     532        lvc_t           lvc;
     533        DWORD           memopt;
    441534} versioninfo_t;
    442535
     
    481574typedef struct dlginit {
    482575        DWORD           memopt;
    483         lvc_t           lvc;
    484576        raw_data_t      *data;
    485577} dlginit_t;
     
    495587        union {
    496588                accelerator_t   *acc;
     589                ani_curico_t    *ani;
    497590                bitmap_t        *bmp;
    498591                cursor_t        *cur;
     
    502595                dlginit_t       *dlgi;
    503596                font_t          *fnt;
     597                fontdir_t       *fnd;
    504598                icon_t          *ico;
    505599                icon_group_t    *icog;
  • trunk/tools/wrc/writeres.c

    r3426 r5523  
    1212#include <string.h>
    1313#include <assert.h>
    14 #include <time.h>
    15 
     14
     15#include "wine/unicode.h"
    1616#include "wrc.h"
    1717#include "writeres.h"
     
    2626#endif
    2727
    28 #define MASM 1
    2928#ifdef MASM
    3029    #define DIRECTIVE_BYTE  "db"
    31     #define DIRECTIVE_WORD "dw"
     30    #define DIRECTIVE_SHORT "dw"
    3231    #define DIRECTIVE_LONG  "dd"
    3332    #define DIRECTIVE_ALIGN "align"
     
    4039    #define COMMENT_LINE    ";"
    4140    #define OR              "or"
    42 char s_file_head_str[] =
    43         ";/* This file is generated with wrc version " WRC_FULLVERSION ". Do not edit! */\n"
    44         ";/* Source : %s */\n"
    45         ";/* Cmdline: %s */\n"
    46         ";/* Date   : %s */\n"
     41
     42static char s_file_head_str[] =
     43        "; This file is generated with wrc version " WRC_FULLVERSION ". Do not edit! */\n"
     44        "; Source : %s */\n"
     45        "; Cmdline: %s */\n"
     46        "; Date   : %s */\n"
    4747        "\n"
    4848        "\t.386p\n"
     
    5252        ;
    5353
    54 char s_file_tail_str[] =
     54static char s_file_tail_str[] =
    5555        "\tend\n"
    56         ";/* <eof> */\n"
     56        "; <eof> */\n"
    5757        "\n"
    5858        ;
     
    6060#else
    6161    #define DIRECTIVE_BYTE  ".byte"
    62     #define DIRECTIVE_WORD  ".word"
     62    #define DIRECTIVE_SHORT ".short"
    6363    #define DIRECTIVE_LONG  ".long"
    6464    #define DIRECTIVE_ALIGN ".align"
     
    7272    #define OR              "|"
    7373
    74 char s_file_head_str[] =
     74static char s_file_head_str[] =
    7575        "/* This file is generated with wrc version " WRC_FULLVERSION ". Do not edit! */\n"
    7676        "/* Source : %s */\n"
     
    8282        ;
    8383
    84 char s_file_tail_str[] =
     84static char s_file_tail_str[] =
    8585        "/* <eof> */\n"
    8686        "\n"
     
    8989#endif
    9090
    91 char s_file_autoreg_str[] =
     91
     92static char s_file_autoreg_str[] =
    9293        "\t.text\n"
    9394        ".LAuto_Register:\n"
     
    104105#else
    105106        "\t.section .ctors,\"aw\"\n"
    106         "\t.long\t.LAuto_Register\n\n"
     107        "\t"DIRECTIVE_LONG"\t.LAuto_Register\n\n"
    107108#endif
    108109        ;
    109110
    110 char h_file_head_str[] =
     111static char h_file_head_str[] =
    111112        "/*\n"
    112113        " * This file is generated with wrc version " WRC_FULLVERSION ". Do not edit!\n"
     
    123124        ;
    124125
    125 char h_file_tail_str[] =
     126static char h_file_tail_str[] =
    126127        "#endif\n"
    127128        "/* <eof> */\n\n"
     
    139140
    140141static int direntries;          /* win32 only: Total number of unique resources */
    141 
    142 time_t now;
    143142
    144143/*
     
    226225*/
    227226#define BYTESPERLINE    8
    228 void write_s_res(FILE *fp, res_t *res)
     227static void write_s_res(FILE *fp, res_t *res)
    229228{
    230229        int idx = res->dataidx;
     
    236235        for(i = 0 ; i < lines; i++)
    237236        {
    238                 fprintf(fp, "\t%s\t", DIRECTIVE_BYTE);
     237                fprintf(fp, "\t"DIRECTIVE_BYTE"\t");
    239238                for(j = 0; j < BYTESPERLINE; j++, idx++)
    240239                {
    241                         fprintf(fp, BYTEFRMT"%s", res->data[idx] & 0xff,
     240                        fprintf(fp, ""BYTEFRMT"%s", res->data[idx] & 0xff,
    242241                                        j == BYTESPERLINE-1 ? "" : ", ");
    243242                }
     
    246245        if(rest)
    247246        {
    248                 fprintf(fp, "\t%s\t", DIRECTIVE_BYTE);
     247                fprintf(fp, "\t"DIRECTIVE_BYTE"\t");
    249248                for(j = 0; j < rest; j++, idx++)
    250249                {
    251                         fprintf(fp, BYTEFRMT"%s", res->data[idx] & 0xff,
     250                        fprintf(fp, ""BYTEFRMT"%s", res->data[idx] & 0xff,
    252251                                        j == rest-1 ? "" : ", ");
    253252                }
     
    255254        }
    256255}
     256#undef BYTESPERLINE
    257257
    258258/*
     
    266266 *****************************************************************************
    267267*/
    268 void write_name_str(FILE *fp, name_id_t *nid)
     268static void write_name_str(FILE *fp, name_id_t *nid)
    269269{
    270270        res_t res;
     
    281281                res.data = (char *)xmalloc(res.size + 1);
    282282                res.data[0] = (char)res.size;
    283                 res.size++;     /* We need to write the lenth byte as well */
     283                res.size++;     /* We need to write the length byte as well */
    284284                strcpy(res.data+1, nid->name.s_name->str.cstr);
    285285                write_s_res(fp, &res);
     
    312312        else  if(win32 && nid->name.s_name->type == str_unicode)
    313313        {
    314                 res.size = wstrlen(nid->name.s_name->str.wstr);
     314                res.size = strlenW(nid->name.s_name->str.wstr);
    315315                if(res.size > 65534)
    316316                        error("Can't write strings larger than 65534 bytes");
     
    320320                res.data = (char *)xmalloc((res.size + 1) * 2);
    321321                ((short *)res.data)[0] = (short)res.size;
    322                 wstrcpy((short *)(res.data+2), nid->name.s_name->str.wstr);
     322                strcpyW((WCHAR *)(res.data+2), nid->name.s_name->str.wstr);
    323323                res.size *= 2; /* Function writes bytes, not shorts... */
    324324                res.size += 2; /* We need to write the length word as well */
     
    331331                                nid->name.s_name->type);
    332332        }
    333 }
    334 
    335 /*
    336  *****************************************************************************
    337  * Function     : compare_name_id
    338  * Syntax       : int compare_name_id(name_id_t *n1, name_id_t *n2)
    339  * Input        :
    340  * Output       :
    341  * Description  :
    342  * Remarks      :
    343  *****************************************************************************
    344 */
    345 int compare_name_id(name_id_t *n1, name_id_t *n2)
    346 {
    347         if(n1->type == name_ord && n2->type == name_ord)
    348         {
    349                 return n1->name.i_name - n2->name.i_name;
    350         }
    351         else if(n1->type == name_str && n2->type == name_str)
    352         {
    353                 if(n1->name.s_name->type == str_char
    354                 && n2->name.s_name->type == str_char)
    355                 {
    356                         return strcasecmp(n1->name.s_name->str.cstr, n2->name.s_name->str.cstr);
    357                 }
    358                 else if(n1->name.s_name->type == str_unicode
    359                 && n2->name.s_name->type == str_unicode)
    360                 {
    361                         return wstricmp(n1->name.s_name->str.wstr, n2->name.s_name->str.wstr);
    362                 }
    363                 else
    364                 {
    365                         internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type");
    366                 }
    367         }
    368         else if(n1->type == name_ord && n2->type == name_str)
    369                 return 1;
    370         else if(n1->type == name_str && n2->type == name_ord)
    371                 return -1;
    372         else
    373                 internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)",
    374                                 n1->type, n2->type);
    375 
    376         return 0; /* Keep the compiler happy */
    377333}
    378334
     
    387343 *****************************************************************************
    388344*/
    389 res_count_t *find_counter(name_id_t *type)
     345static res_count_t *find_counter(name_id_t *type)
    390346{
    391347        int i;
     
    414370#define RCT(v)  (*((resource_t **)(v)))
    415371/* qsort sorting function */
    416 int sort_name_id(const void *e1, const void *e2)
     372static int sort_name_id(const void *e1, const void *e2)
    417373{
    418374        return compare_name_id(RCT(e1)->name, RCT(e2)->name);
    419375}
    420376
    421 int sort_language(const void *e1, const void *e2)
     377static int sort_language(const void *e1, const void *e2)
    422378{
    423379        assert((RCT(e1)->lan) != NULL);
     
    429385#undef RCT
    430386#define RCT(v)  ((res_count_t *)(v))
    431 int sort_type(const void *e1, const void *e2)
     387static int sort_type(const void *e1, const void *e2)
    432388{
    433389        return compare_name_id(&(RCT(e1)->type), &(RCT(e2)->type));
     
    435391#undef RCT
    436392
    437 void count_resources(resource_t *top)
     393static void count_resources(resource_t *top)
    438394{
    439395        resource_t *rsc;
     
    605561 *****************************************************************************
    606562 * Function     : write_pe_segment
    607  * Syntax       : void write_pe_segment(FILE *fp, resource_t *top)
     563 * Syntax       : void write_pe_segment(FILE *fp)
    608564 * Input        :
    609565 * Output       :
     
    612568 *****************************************************************************
    613569*/
    614 void write_pe_segment(FILE *fp, resource_t *top)
     570static void write_pe_segment(FILE *fp)
    615571{
    616572        int i;
    617573
    618         fprintf(fp, "\t%s\t4\n", DIRECTIVE_ALIGN);
     574        fprintf(fp, "\t"DIRECTIVE_ALIGN"\t4\n");
    619575        fprintf(fp, "%s%s:\n", prefix, _PEResTab);
    620         fprintf(fp, "\t%s\t%s%s\n", DIRECTIVE_GLOBAL, prefix, _PEResTab);
     576        fprintf(fp, "\t"DIRECTIVE_GLOBAL"\t%s%s\n", prefix, _PEResTab);
    621577        /* Flags */
    622         fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);
     578        fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n");
    623579        /* Time/Date stamp */
    624         fprintf(fp, "\t%s\t"LONGFRMT"\n", DIRECTIVE_LONG, (long)now);
     580        fprintf(fp, "\t"DIRECTIVE_LONG"\t"LONGFRMT"\n", (long)now);
    625581        /* Version */
    626         fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);       /* FIXME: must version be filled out? */
     582        fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n"); /* FIXME: must version be filled out? */
    627583        /* # of id entries, # of name entries */
    628         fprintf(fp, "\t%s\t%d, %d\n", DIRECTIVE_WORD, n_name_entries, n_id_entries);
     584        fprintf(fp, "\t"DIRECTIVE_SHORT"\t%d, %d\n", n_name_entries, n_id_entries);
    629585
    630586        /* Write the type level of the tree */
     
    638594                /* TypeId */
    639595                if(rcp->type.type == name_ord)
    640                         fprintf(fp, "\t%s\t%d\n", DIRECTIVE_LONG, rcp->type.name.i_name);
     596                        fprintf(fp, "\t"DIRECTIVE_LONG"\t%d\n", rcp->type.name.i_name);
    641597                else
    642598                {
    643599                        char *name = prep_nid_for_label(&(rcp->type));
    644                         fprintf(fp, "\t%s\t(%s_%s_typename - %s%s) %s %s\n",
    645                                 DIRECTIVE_LONG, prefix,
     600                        fprintf(fp, "\t"DIRECTIVE_LONG"\t(%s_%s_typename - %s%s) "OR" "HEXBIT31"\n",
     601                                prefix,
    646602                                name,
    647603                                prefix,
    648                                 _PEResTab, OR, HEXBIT31);
     604                                _PEResTab);
    649605                }
    650606                /* Offset */
    651607                label = prep_nid_for_label(&(rcp->type));
    652                 fprintf(fp, "\t%s\t(%sL%s - %s%s) %s %s\n",
    653                         DIRECTIVE_LONG, LOCAL_PREFIX, label,
     608                fprintf(fp, "\t"DIRECTIVE_LONG"\t("LOCAL_PREFIX"L%s - %s%s) "OR" "HEXBIT31"\n",
     609                        label,
    654610                        prefix,
    655                         _PEResTab, OR, HEXBIT31);
     611                        _PEResTab);
    656612        }
    657613
     
    668624
    669625                typelabel = xstrdup(prep_nid_for_label(&(rcp->type)));
    670                 fprintf(fp, "%sL%s:\n", LOCAL_PREFIX, typelabel);
    671 
    672                 fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);               /* Flags */
    673                 fprintf(fp, "\t%s\t"LONGFRMT"\n", DIRECTIVE_LONG, (long)now);   /* TimeDate */
    674                 fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);       /* FIXME: must version be filled out? */
    675                 fprintf(fp, "\t%s\t%d, %d\n", DIRECTIVE_WORD, rcp->n_name_entries, rcp->n_id_entries);
     626                fprintf(fp, ""LOCAL_PREFIX"L%s:\n", typelabel);
     627
     628                fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n");         /* Flags */
     629                fprintf(fp, "\t"DIRECTIVE_LONG"\t"LONGFRMT"\n", (long)now);     /* TimeDate */
     630                fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n"); /* FIXME: must version be filled out? */
     631                fprintf(fp, "\t"DIRECTIVE_SHORT"\t%d, %d\n", rcp->n_name_entries, rcp->n_id_entries);
    676632                for(j = 0; j < rcp->count32; j++)
    677633                {
     
    679635                        /* NameId */
    680636                        if(rsc->name->type == name_ord)
    681                                 fprintf(fp, "\t%s\t%d\n", DIRECTIVE_LONG, rsc->name->name.i_name);
     637                                fprintf(fp, "\t"DIRECTIVE_LONG"\t%d\n", rsc->name->name.i_name);
    682638                        else
    683639                        {
    684                                 fprintf(fp, "\t%s\t(%s%s_name - %s%s) %s %s\n",
    685                                         DIRECTIVE_LONG, prefix,
     640                                fprintf(fp, "\t"DIRECTIVE_LONG"\t(%s%s_name - %s%s) "OR" "HEXBIT31"\n",
     641                                        prefix,
    686642                                        rsc->c_name,
    687643                                        prefix,
    688                                         _PEResTab, OR, HEXBIT31);
    689                         }
    690                         /* Maybe FIXME: Unescape the tree (ommit 0x80000000) and
     644                                        _PEResTab);
     645                        }
     646                        /* Maybe FIXME: Unescape the tree (ommit "HEXBIT31") and
    691647                         * put the offset to the resource data entry.
    692648                         * ?? Is unescaping worth while ??
     
    694650                        /* Offset */
    695651                        namelabel = prep_nid_for_label(rsc->name);
    696                         fprintf(fp, "\t%s\t(%sL%s_%s - %s%s) %s %s\n",
    697                                 DIRECTIVE_LONG, LOCAL_PREFIX, typelabel,
     652                        fprintf(fp, "\t"DIRECTIVE_LONG"\t("LOCAL_PREFIX"L%s_%s - %s%s) "OR" "HEXBIT31"\n",
     653                                typelabel,
    698654                                namelabel,
    699655                                prefix,
    700                                 _PEResTab, OR, HEXBIT31);
     656                                _PEResTab);
    701657                }
    702658                free(typelabel);
     
    721677
    722678                        namelabel = xstrdup(prep_nid_for_label(r32cp->rsc[0]->name));
    723                         fprintf(fp, "%sL%s_%s:\n", LOCAL_PREFIX, typelabel, namelabel);
    724 
    725                         fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);               /* Flags */
    726                         fprintf(fp, "\t%s\t"LONGFRMT"\n", DIRECTIVE_LONG, (long)now);   /* TimeDate */
    727                         fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);       /* FIXME: must version be filled out? */
    728                         fprintf(fp, "\t%s\t0, %d\n", DIRECTIVE_WORD, r32cp->count);
     679                        fprintf(fp, ""LOCAL_PREFIX"L%s_%s:\n", typelabel, namelabel);
     680
     681                        fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n");         /* Flags */
     682                        fprintf(fp, "\t"DIRECTIVE_LONG"\t"LONGFRMT"\n", (long)now);     /* TimeDate */
     683                        fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n"); /* FIXME: must version be filled out? */
     684                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t0, %d\n", r32cp->count);
    729685
    730686                        for(k = 0; k < r32cp->count; k++)
     
    733689                                assert(rsc->lan != NULL);
    734690                                /* LanguageId */
    735                                 fprintf(fp, "\t%s\t"LONGFRMT"\n", DIRECTIVE_LONG, rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0);
     691                                fprintf(fp, "\t"DIRECTIVE_LONG"\t"LONGFRMT"\n", rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0);
    736692                                /* Offset */
    737                                 fprintf(fp, "\t%s\t%sL%s_%s_%d - %s%s\n",
    738                                         DIRECTIVE_LONG, LOCAL_PREFIX, typelabel,
     693                                fprintf(fp, "\t"DIRECTIVE_LONG"\t"LOCAL_PREFIX"L%s_%s_%d - %s%s\n",
     694                                        typelabel,
    739695                                        namelabel,
    740696                                        rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0,
     
    749705        /* Write the resource table itself */
    750706        fprintf(fp, "%s_ResourceDirectory:\n", prefix);
    751         fprintf(fp, "\t%s\t%s_ResourceDirectory\n", DIRECTIVE_GLOBAL, prefix);
     707        fprintf(fp, "\t"DIRECTIVE_GLOBAL"\t%s_ResourceDirectory\n", prefix);
    752708        direntries = 0;
    753709
     
    775731                                assert(rsc->lan != NULL);
    776732
    777                                 fprintf(fp, "%sL%s_%s_%d:\n",
    778                                         LOCAL_PREFIX, typelabel,
     733                                fprintf(fp, ""LOCAL_PREFIX"L%s_%s_%d:\n",
     734                                        typelabel,
    779735                                        namelabel,
    780736                                        rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0);
    781737
    782738                                /* Data RVA */
    783                                 fprintf(fp, "\t%s\t%s%s_data - %s%s\n",
    784                                         DIRECTIVE_LONG, prefix,
     739                                fprintf(fp, "\t"DIRECTIVE_LONG"\t%s%s_data - %s%s\n",
     740                                        prefix,
    785741                                        rsc->c_name,
    786742                                        prefix,
    787743                                        _PEResTab);
    788744                                /* Size */
    789                                 fprintf(fp, "\t%s\t%d\n",
    790                                         DIRECTIVE_LONG, rsc->binres->size - rsc->binres->dataidx);
     745                                fprintf(fp, "\t"DIRECTIVE_LONG"\t%d\n",
     746                                        rsc->binres->size - rsc->binres->dataidx);
    791747                                /* CodePage */
    792                                 fprintf(fp, "\t%s\t%ld\n", DIRECTIVE_LONG, codepage);
     748                                fprintf(fp, "\t"DIRECTIVE_LONG"\t%ld\n", codepage);
    793749                                /* Reserved */
    794                                 fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);
     750                                fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n");
    795751
    796752                                direntries++;
     
    805761 *****************************************************************************
    806762 * Function     : write_ne_segment
    807  * Syntax       : void write_ne_segment(FILE *fp, resource_t *top)
     763 * Syntax       : void write_ne_segment(FILE *fp)
    808764 * Input        :
    809765 * Output       :
     
    812768 *****************************************************************************
    813769*/
    814 void write_ne_segment(FILE *fp, resource_t *top)
     770static void write_ne_segment(FILE *fp)
    815771{
    816772        int i, j;
    817773
    818         fprintf(fp, "\t%s\t4\n", DIRECTIVE_ALIGN);
     774        fprintf(fp, "\t"DIRECTIVE_ALIGN"\t4\n");
    819775        fprintf(fp, "%s%s:\n", prefix, _NEResTab);
    820         fprintf(fp, "\t%s\t%s%s\n", DIRECTIVE_GLOBAL, prefix, _NEResTab);
     776        fprintf(fp, "\t"DIRECTIVE_GLOBAL"\t%s%s\n", prefix, _NEResTab);
    821777
    822778        /* AlignmentShift */
    823         fprintf(fp, "\t%s\t%d\n", DIRECTIVE_WORD, alignment_pwr);
     779        fprintf(fp, "\t"DIRECTIVE_SHORT"\t%d\n", alignment_pwr);
    824780
    825781        /* TypeInfo */
     
    830786                /* TypeId */
    831787                if(rcp->type.type == name_ord)
    832                         fprintf(fp, "\t%s\t"SHORTFRMT"\n", DIRECTIVE_WORD, rcp->type.name.i_name | 0x8000);
     788                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t"SHORTFRMT"\n", rcp->type.name.i_name | 0x8000);
    833789                else
    834                         fprintf(fp, "\t%s\t%s_%s_typename - %s%s\n",
    835                                 DIRECTIVE_WORD, prefix,
     790                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t%s_%s_typename - %s%s\n",
     791                                prefix,
    836792                                rcp->type.name.s_name->str.cstr,
    837793                                prefix,
    838794                                _NEResTab);
    839795                /* ResourceCount */
    840                 fprintf(fp, "\t%s\t%d\n", DIRECTIVE_WORD, rcp->count);
     796                fprintf(fp, "\t"DIRECTIVE_SHORT"\t%d\n", rcp->count);
    841797                /* Reserved */
    842                 fprintf(fp, "\t%s\t0\n", DIRECTIVE_LONG);
     798                fprintf(fp, "\t"DIRECTIVE_LONG"\t0\n");
    843799                /* NameInfo */
    844800                for(j = 0; j < rcp->count; j++)
     
    853809 */
    854810                        /* Offset */
    855                         fprintf(fp, "\t%s\t(%s%s_data - %s%s) >> %d\n",
    856                                 DIRECTIVE_WORD, prefix,
     811                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t(%s%s_data - %s%s) >> %d\n",
     812                                prefix,
    857813                                rcp->rscarray[j]->c_name,
    858814                                prefix,
     
    860816                                alignment_pwr);
    861817                        /* Length */
    862                         fprintf(fp, "\t%s\t%d\n",
    863                                 DIRECTIVE_WORD, rcp->rscarray[j]->binres->size - rcp->rscarray[j]->binres->dataidx);
     818                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t%d\n",
     819                                (rcp->rscarray[j]->binres->size - rcp->rscarray[j]->binres->dataidx + alignment - 1) >> alignment_pwr);
    864820                        /* Flags */
    865                         fprintf(fp, "\t%s\t"SHORTFRMT"\n", DIRECTIVE_WORD, (WORD)rcp->rscarray[j]->memopt);
     821                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t"SHORTFRMT"\n", (WORD)rcp->rscarray[j]->memopt);
    866822                        /* Id */
    867823                        if(rcp->rscarray[j]->name->type == name_ord)
    868                                 fprintf(fp, "\t%s\t"SHORTFRMT"\n", DIRECTIVE_WORD, rcp->rscarray[j]->name->name.i_name | 0x8000);
     824                                fprintf(fp, "\t"DIRECTIVE_SHORT"\t"SHORTFRMT"\n", rcp->rscarray[j]->name->name.i_name | 0x8000);
    869825                        else
    870                                 fprintf(fp, "\t%s\t%s%s_name - %s%s\n",
    871                                 DIRECTIVE_WORD, prefix,
     826                                fprintf(fp, "\t"DIRECTIVE_SHORT"\t%s%s_name - %s%s\n",
     827                                prefix,
    872828                                rcp->rscarray[j]->c_name,
    873829                                prefix,
    874830                                _NEResTab);
    875831                        /* Handle and Usage */
    876                         fprintf(fp, "\t%s\t0, 0\n", DIRECTIVE_WORD);
     832                        fprintf(fp, "\t"DIRECTIVE_SHORT"\t0, 0\n");
    877833                }
    878834        }
    879835        /* EndTypes */
    880         fprintf(fp, "\t%s\t0\n", DIRECTIVE_WORD);
     836        fprintf(fp, "\t"DIRECTIVE_SHORT"\t0\n");
    881837}
    882838
     
    884840 *****************************************************************************
    885841 * Function     : write_rsc_names
    886  * Syntax       : void write_rsc_names(FILE *fp, resource_t *top)
     842 * Syntax       : void write_rsc_names(FILE *fp)
    887843 * Input        :
    888844 * Output       :
     
    891847 *****************************************************************************
    892848*/
    893 void write_rsc_names(FILE *fp, resource_t *top)
     849static void write_rsc_names(FILE *fp)
    894850{
    895851        int i, j;
     
    935891                        res_count_t *rcp = &rcarray[i];
    936892
     893                        if(rcp->type.type == name_str)
     894                        {
     895                                fprintf(fp, "%s_%s_typename:\n",
     896                                        prefix,
     897                                        rcp->type.name.s_name->str.cstr);
     898                                write_name_str(fp, &(rcp->type));
     899                        }
    937900                        for(j = 0; j < rcp->count; j++)
    938901                        {
    939                                 if(rcp->type.type == name_str)
    940                                 {
    941                                         fprintf(fp, "%s_%s_typename:\n",
    942                                                 prefix,
    943                                                 rcp->type.name.s_name->str.cstr);
    944                                         write_name_str(fp, &(rcp->type));
    945                                 }
    946902                                if(rcp->rscarray[j]->name->type == name_str)
    947903                                {
     
    957913                /* This is to end the NE resource table */
    958914                if(create_dir)
    959                         fprintf(fp, "\t%s\t0\n", DIRECTIVE_BYTE);
     915                        fprintf(fp, "\t"DIRECTIVE_BYTE"\t0\n");
    960916        }
    961917
     
    989945        {
    990946                char *s, *p;
    991                 now = time(NULL);
    992947                s = ctime(&now);
    993948                p = strchr(s, '\n');
     
    1004959        {
    1005960                if(win32)
    1006                         write_pe_segment(fo, top);
     961                        write_pe_segment(fo);
    1007962                else
    1008                         write_ne_segment(fo, top);
     963                        write_ne_segment(fo);
    1009964        }
    1010965
    1011966        /* Dump the names */
    1012         write_rsc_names(fo, top);
     967        write_rsc_names(fo);
    1013968
    1014969        if(create_dir)
    1015                 fprintf(fo, "%sLResTabEnd:\n", LOCAL_PREFIX);
     970                fprintf(fo, LOCAL_PREFIX"LResTabEnd:\n");
    1016971       
    1017972        if(!indirect_only)
     
    1019974                /* Write the resource data */
    1020975#ifdef MASM
    1021                 fprintf(fo, "\n;/* Resource binary data */\n\n");
     976                fprintf(fo, "\n; Resource binary data */\n\n");
    1022977#else
    1023978                fprintf(fo, "\n/* Resource binary data */\n\n");
     
    1028983                                continue;
    1029984
    1030                         fprintf(fo, "\t%s\t%d\n", DIRECTIVE_ALIGN, win32 ? 4 : alignment);
     985                        fprintf(fo, "\t"DIRECTIVE_ALIGN"\t%d\n", win32 ? 4 : alignment);
    1031986                        fprintf(fo, "%s%s_data:\n", prefix, rsc->c_name);
    1032987                        if(global)
    1033                                 fprintf(fo, "\t%s\t%s%s_data\n", DIRECTIVE_GLOBAL, prefix, rsc->c_name);
     988                                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s%s_data\n", prefix, rsc->c_name);
    1034989
    1035990                        write_s_res(fo, rsc->binres);
     
    1041996                {
    1042997                        /* Add a resource descriptor for built-in and elf-dlls */
    1043                         fprintf(fo, "\t%s\t4\n", DIRECTIVE_ALIGN);
     998                        fprintf(fo, "\t"DIRECTIVE_ALIGN"\t4\n");
    1044999                        fprintf(fo, "%s_ResourceDescriptor:\n", prefix);
    1045                         fprintf(fo, "\t%s\t%s_ResourceDescriptor\n", DIRECTIVE_GLOBAL, prefix);
     1000                        fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s_ResourceDescriptor\n", prefix);
    10461001                        fprintf(fo, "%s_ResourceTable:\n", prefix);
    10471002                        if(global)
    1048                                 fprintf(fo, "\t%s\t%s_ResourceTable\n", DIRECTIVE_GLOBAL, prefix);
    1049                         fprintf(fo, "\t%s\t%s%s\n", DIRECTIVE_LONG, prefix, win32 ? _PEResTab : _NEResTab);
     1003                                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s_ResourceTable\n", prefix);
     1004                        fprintf(fo, "\t"DIRECTIVE_LONG"\t%s%s\n", prefix, win32 ? _PEResTab : _NEResTab);
    10501005                        fprintf(fo, "%s_NumberOfResources:\n", prefix);
    10511006                        if(global)
    1052                                 fprintf(fo, "\t%s\t%s_NumberOfResources\n", DIRECTIVE_GLOBAL, prefix);
    1053                         fprintf(fo, "\t%s\t%d\n", DIRECTIVE_LONG, direntries);
     1007                                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s_NumberOfResources\n", prefix);
     1008                        fprintf(fo, "\t"DIRECTIVE_LONG"\t%d\n", direntries);
    10541009                        fprintf(fo, "%s_ResourceSectionSize:\n", prefix);
    10551010                        if(global)
    1056                                 fprintf(fo, "\t%s\t%s_ResourceSectionSize\n", DIRECTIVE_GLOBAL, prefix);
    1057                         fprintf(fo, "\t%s\t%sLResTabEnd - %s%s\n", DIRECTIVE_LONG, LOCAL_PREFIX, prefix, win32 ? _PEResTab : _NEResTab);
     1011                                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s_ResourceSectionSize\n", prefix);
     1012                        fprintf(fo, "\t"DIRECTIVE_LONG"\t"LOCAL_PREFIX"LResTabEnd - %s%s\n", prefix, win32 ? _PEResTab : _NEResTab);
    10581013                        if(win32)
    10591014                        {
    10601015                                fprintf(fo, "%s_ResourcesEntries:\n", prefix);
    10611016                                if(global)
    1062                                         fprintf(fo, "\t%s\t%s_ResourcesEntries\n", DIRECTIVE_GLOBAL, prefix);
    1063                                 fprintf(fo, "\t%s\t%s_ResourceDirectory\n", DIRECTIVE_LONG, prefix);
     1017                                        fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s_ResourcesEntries\n", prefix);
     1018                                fprintf(fo, "\t"DIRECTIVE_LONG"\t%s_ResourceDirectory\n", prefix);
    10641019                        }
    10651020                }
     
    10701025                /* Write the indirection structures */
    10711026                fprintf(fo, "\n/* Resource indirection structures */\n\n");
    1072                 fprintf(fo, "\t%s\t4\n", DIRECTIVE_ALIGN);
     1027                fprintf(fo, "\t"DIRECTIVE_ALIGN"\t4\n");
    10731028                for(rsc = top; rsc; rsc = rsc->next)
    10741029                {
     
    11121067                        fprintf(fo, "%s%s:\n", prefix, rsc->c_name);
    11131068                        if(global)
    1114                                 fprintf(fo, "\t%s\t%s%s\n", DIRECTIVE_GLOBAL, prefix, rsc->c_name);
    1115                         fprintf(fo, "\t%s\t%d, %s%s%s, %d, %s%s%s%s, %s%s_data, %d\n",
    1116                                 DIRECTIVE_LONG,
     1069                                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s%s\n", prefix, rsc->c_name);
     1070                        fprintf(fo, "\t"DIRECTIVE_LONG"\t%d, %s%s%s, %d, %s%s%s%s, %s%s_data, %d\n",
    11171071                                rsc->name->type == name_ord ? rsc->name->name.i_name : 0,
    11181072                                rsc->name->type == name_ord ? "0" : prefix,
     
    11331087                /* Write the indirection table */
    11341088                fprintf(fo, "/* Resource indirection table */\n\n");
    1135                 fprintf(fo, "\t%s\t4\n", DIRECTIVE_ALIGN);
     1089                fprintf(fo, "\t"DIRECTIVE_ALIGN"\t4\n");
    11361090                fprintf(fo, "%s%s:\n", prefix, _ResTable);
    1137                 fprintf(fo, "\t%s\t%s%s\n", DIRECTIVE_GLOBAL, prefix, _ResTable);
     1091                fprintf(fo, "\t"DIRECTIVE_GLOBAL"\t%s%s\n", prefix, _ResTable);
    11381092                for(rsc = top; rsc; rsc = rsc->next)
    11391093                {
    1140                         fprintf(fo, "\t%s\t%s%s\n", DIRECTIVE_LONG, prefix, rsc->c_name);
    1141                 }
    1142                 fprintf(fo, "\t%s\t0\n", DIRECTIVE_LONG);
     1094                        fprintf(fo, "\t"DIRECTIVE_LONG"\t%s%s\n", prefix, rsc->c_name);
     1095                }
     1096                fprintf(fo, "\t"DIRECTIVE_LONG"\t0\n");
    11431097                fprintf(fo, "\n");
    11441098        }
     
    11811135        }
    11821136
    1183         time(&now);
    11841137        fprintf(fo, h_file_head_str, input_name ? input_name : "stdin",
    11851138                cmdline, ctime(&now), (long)now, (long)now);
     
    12361189}
    12371190
    1238 
  • trunk/tools/wrc/y.tab.c

    r4617 r5523  
    11
    22/*  A Bison parser, made from parser.y
    3     by GNU Bison version 1.28  */
     3 by  GNU Bison version 1.25
     4  */
    45
    56#define YYBISON 1  /* Identify Bison output.  */
    67
    7 #define tIF     257
    8 #define tIFDEF  258
    9 #define tIFNDEF 259
    10 #define tELSE   260
    11 #define tELIF   261
    12 #define tENDIF  262
    13 #define tDEFINED        263
    14 #define tNL     264
    15 #define tTYPEDEF        265
    16 #define tEXTERN 266
    17 #define NUMBER  267
    18 #define LNUMBER 268
    19 #define tSTRING 269
    20 #define IDENT   270
    21 #define FILENAME        271
    22 #define RAWDATA 272
    23 #define ACCELERATORS    273
    24 #define tBITMAP 274
    25 #define CURSOR  275
    26 #define DIALOG  276
    27 #define DIALOGEX        277
    28 #define MENU    278
    29 #define MENUEX  279
    30 #define MESSAGETABLE    280
    31 #define RCDATA  281
    32 #define VERSIONINFO     282
    33 #define STRINGTABLE     283
    34 #define FONT    284
    35 #define ICON    285
    36 #define AUTO3STATE      286
    37 #define AUTOCHECKBOX    287
    38 #define AUTORADIOBUTTON 288
    39 #define CHECKBOX        289
    40 #define DEFPUSHBUTTON   290
    41 #define PUSHBUTTON      291
    42 #define RADIOBUTTON     292
    43 #define STATE3  293
    44 #define GROUPBOX        294
    45 #define COMBOBOX        295
    46 #define LISTBOX 296
    47 #define SCROLLBAR       297
    48 #define CONTROL 298
    49 #define EDITTEXT        299
    50 #define RTEXT   300
    51 #define CTEXT   301
    52 #define LTEXT   302
    53 #define BLOCK   303
    54 #define VALUE   304
    55 #define SHIFT   305
    56 #define ALT     306
    57 #define ASCII   307
    58 #define VIRTKEY 308
    59 #define GRAYED  309
    60 #define CHECKED 310
    61 #define INACTIVE        311
    62 #define NOINVERT        312
     8#define tTYPEDEF        258
     9#define tEXTERN 259
     10#define tSTRUCT 260
     11#define tENUM   261
     12#define tCPPCLASS       262
     13#define tINLINE 263
     14#define tSTATIC 264
     15#define tNL     265
     16#define tNUMBER 266
     17#define tLNUMBER        267
     18#define tSTRING 268
     19#define tIDENT  269
     20#define tFILENAME       270
     21#define tRAWDATA        271
     22#define tACCELERATORS   272
     23#define tBITMAP 273
     24#define tCURSOR 274
     25#define tDIALOG 275
     26#define tDIALOGEX       276
     27#define tMENU   277
     28#define tMENUEX 278
     29#define tMESSAGETABLE   279
     30#define tRCDATA 280
     31#define tVERSIONINFO    281
     32#define tSTRINGTABLE    282
     33#define tFONT   283
     34#define tFONTDIR        284
     35#define tICON   285
     36#define tAUTO3STATE     286
     37#define tAUTOCHECKBOX   287
     38#define tAUTORADIOBUTTON        288
     39#define tCHECKBOX       289
     40#define tDEFPUSHBUTTON  290
     41#define tPUSHBUTTON     291
     42#define tRADIOBUTTON    292
     43#define tSTATE3 293
     44#define tGROUPBOX       294
     45#define tCOMBOBOX       295
     46#define tLISTBOX        296
     47#define tSCROLLBAR      297
     48#define tCONTROL        298
     49#define tEDITTEXT       299
     50#define tRTEXT  300
     51#define tCTEXT  301
     52#define tLTEXT  302
     53#define tBLOCK  303
     54#define tVALUE  304
     55#define tSHIFT  305
     56#define tALT    306
     57#define tASCII  307
     58#define tVIRTKEY        308
     59#define tGRAYED 309
     60#define tCHECKED        310
     61#define tINACTIVE       311
     62#define tNOINVERT       312
    6363#define tPURE   313
    64 #define IMPURE  314
    65 #define DISCARDABLE     315
    66 #define LOADONCALL      316
    67 #define PRELOAD 317
     64#define tIMPURE 314
     65#define tDISCARDABLE    315
     66#define tLOADONCALL     316
     67#define tPRELOAD        317
    6868#define tFIXED  318
    69 #define MOVEABLE        319
    70 #define CLASS   320
    71 #define CAPTION 321
    72 #define CHARACTERISTICS 322
    73 #define EXSTYLE 323
    74 #define STYLE   324
    75 #define VERSION 325
    76 #define LANGUAGE        326
    77 #define FILEVERSION     327
    78 #define PRODUCTVERSION  328
    79 #define FILEFLAGSMASK   329
    80 #define FILEOS  330
    81 #define FILETYPE        331
    82 #define FILEFLAGS       332
    83 #define FILESUBTYPE     333
    84 #define MENUBARBREAK    334
    85 #define MENUBREAK       335
    86 #define MENUITEM        336
    87 #define POPUP   337
    88 #define SEPARATOR       338
    89 #define HELP    339
    90 #define TOOLBAR 340
    91 #define BUTTON  341
     69#define tMOVEABLE       319
     70#define tCLASS  320
     71#define tCAPTION        321
     72#define tCHARACTERISTICS        322
     73#define tEXSTYLE        323
     74#define tSTYLE  324
     75#define tVERSION        325
     76#define tLANGUAGE       326
     77#define tFILEVERSION    327
     78#define tPRODUCTVERSION 328
     79#define tFILEFLAGSMASK  329
     80#define tFILEOS 330
     81#define tFILETYPE       331
     82#define tFILEFLAGS      332
     83#define tFILESUBTYPE    333
     84#define tMENUBARBREAK   334
     85#define tMENUBREAK      335
     86#define tMENUITEM       336
     87#define tPOPUP  337
     88#define tSEPARATOR      338
     89#define tHELP   339
     90#define tTOOLBAR        340
     91#define tBUTTON 341
    9292#define tBEGIN  342
    9393#define tEND    343
    94 #define DLGINIT 344
    95 #define LOGOR   345
    96 #define LOGAND  346
    97 #define EQ      347
    98 #define NE      348
    99 #define LTE     349
    100 #define GTE     350
    101 #define NOT     351
     94#define tDLGINIT        344
     95#define tNOT    345
     96#define pUPM    346
    10297
    10398#line 1 "parser.y"
    10499
    105100/*
    106  * Copyright  Martin von Loewis, 1994
    107  * Copyright 1998 Bertho A. Stultiens (BS)
    108  *           1999 Juergen Schmied (JS)
     101 * Copyright 1994       Martin von Loewis
     102 * Copyright 1998-2000  Bertho A. Stultiens (BS)
     103 *           1999       Juergen Schmied (JS)
    109104 *
    110  * 6-Nov-1999 JS        - see CHANGES
     105 * 24-Jul-2000 BS       - Made a fix for broken Berkeley yacc on
     106 *                        non-terminals (see cjunk rule).
     107 * 21-May-2000 BS       - Partial implementation of font resources.
     108 *                      - Corrected language propagation for binary
     109 *                        resources such as bitmaps, isons, cursors,
     110 *                        userres and rcdata. The language is now
     111 *                        correct in .res files.
     112 *                      - Fixed reading the resource name as ident,
     113 *                        so that it may overlap keywords.
     114 * 20-May-2000 BS       - Implemented animated cursors and icons
     115 *                        resource types.
     116 * 30-Apr-2000 BS       - Reintegration into the wine-tree
     117 * 14-Jan-2000 BS       - Redid the usertype resources so that they
     118 *                        are compatible.
     119 * 02-Jan-2000 BS       - Removed the preprocessor from the grammar
     120 *                        expect for the # command (line numbers).
    111121 *
     122 * 06-Nov-1999 JS       - see CHANGES
     123 *
    112124 * 29-Dec-1998 AdH      - Grammar and function extensions.
    113  *                           grammar: TOOLBAR resources, Named ICONs in
     125 *                           grammar: TOOLBAR resources, Named ICONs in 
    114126 *                              DIALOGS
    115  *                           functions: semantic actions for the grammar
     127 *                           functions: semantic actions for the grammar 
    116128 *                              changes, resource files can now be anywhere
    117129 *                              on the include path instead of just in the
     
    211223#include "parser.h"
    212224#include "windef.h"
     225#include "winbase.h"
    213226#include "wingdi.h"
    214227#include "winuser.h"
    215 /* kso Sun 19.11.2000 */
    216 #undef strcasecmp
    217 #define strcasecmp stricmp
    218 
    219 #ifdef __BORLANDC__
    220 #pragma warn -sig
    221 #endif
    222 
    223 int indialog = 0;       /* Signal flex that we're parsing a dialog */
    224 int want_rscname = 0;   /* Set when a resource's name is required */
     228
     229#if defined(YYBYACC)
     230        /* Berkeley yacc (byacc) doesn't seem to know about these */
     231        /* Some *BSD supplied versions do define these though */
     232# ifndef YYEMPTY
     233#  define YYEMPTY       (-1)    /* Empty lookahead value of yychar */
     234# endif
     235# ifndef YYLEX
     236#  define YYLEX         yylex()
     237# endif
     238
     239#elif defined(YYBISON)
     240        /* Bison was used for original development */
     241        /* #define YYEMPTY -2 */
     242        /* #define YYLEX   yylex() */
     243
     244#else   
     245        /* No yacc we know yet */
     246# if !defined(YYEMPTY) || !defined(YYLEX)
     247#  error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX.
     248# elif defined(__GNUC__)        /* gcc defines the #warning directive */
     249#  warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested
     250  /* #else we just take a chance that it works... */
     251# endif
     252#endif
     253
     254int want_nl = 0;        /* Signal flex that we need the next newline */
     255int want_id = 0;        /* Signal flex that we need the next identifier */
    225256stringtable_t *tagstt;  /* Stringtable tag.
    226257                         * It is set while parsing a stringtable to one of
     
    231262                         * stringtables with different lanuages
    232263                         */
     264static int dont_want_id = 0;    /* See language parsing for details */
     265
    233266/* Set to the current options of the currently scanning stringtable */
    234267static int *tagstt_memopt;
     
    236269static version_t *tagstt_version;
    237270
     271static const char riff[4] = "RIFF";     /* RIFF file magic for animated cursor/icon */
     272
    238273/* Prototypes of here defined functions */
    239 void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur);
    240 void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico);
    241 int alloc_cursor_id(language_t *);
    242 int alloc_icon_id(language_t *);
    243 void ins_stt_entry(stt_entry_t *ste);
    244 int check_stt_entry(stringtable_t *tabs, stt_entry_t *ste);
    245 event_t *get_event_head(event_t *p);
    246 control_t *get_control_head(control_t *p);
    247 ver_value_t *get_ver_value_head(ver_value_t *p);
    248 ver_block_t *get_ver_block_head(ver_block_t *p);
    249 resource_t *get_resource_head(resource_t *p);
    250 menuex_item_t *get_itemex_head(menuex_item_t *p);
    251 menu_item_t *get_item_head(menu_item_t *p);
    252 raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str);
    253 raw_data_t *merge_raw_data_int(raw_data_t *r1, int i);
    254 raw_data_t *merge_raw_data_long(raw_data_t *r1, int i);
    255 raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
    256 raw_data_t *str2raw_data(string_t *str);
    257 raw_data_t *int2raw_data(int i);
    258 raw_data_t *long2raw_data(int i);
    259 raw_data_t *load_file(string_t *name);
    260 itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
    261 event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
    262 event_t *add_event(int key, int id, int flags, event_t *prev);
    263 dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg);
    264 dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg);
    265 dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg);
    266 dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg);
    267 dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg);
    268 dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg);
    269 dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg);
    270 dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg);
    271 dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg);
    272 name_id_t *convert_ctlclass(name_id_t *cls);
    273 control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
    274 dialog_t *dialog_version(version_t *v, dialog_t *dlg);
    275 dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
    276 dialog_t *dialog_language(language_t *l, dialog_t *dlg);
    277 dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
    278 dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
    279 dialog_t *dialog_font(font_id_t *f, dialog_t *dlg);
    280 dialog_t *dialog_caption(string_t *s, dialog_t *dlg);
    281 dialog_t *dialog_exstyle(style_t * st, dialog_t *dlg);
    282 dialog_t *dialog_style(style_t * st, dialog_t *dlg);
    283 resource_t *build_stt_resources(stringtable_t *stthead);
    284 stringtable_t *find_stringtable(lvc_t *lvc);
    285 toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec);
    286 toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
    287 
    288 
    289 #line 183 "parser.y"
     274static event_t *get_event_head(event_t *p);
     275static control_t *get_control_head(control_t *p);
     276static ver_value_t *get_ver_value_head(ver_value_t *p);
     277static ver_block_t *get_ver_block_head(ver_block_t *p);
     278static resource_t *get_resource_head(resource_t *p);
     279static menuex_item_t *get_itemex_head(menuex_item_t *p);
     280static menu_item_t *get_item_head(menu_item_t *p);
     281static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str);
     282static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i);
     283static raw_data_t *merge_raw_data_long(raw_data_t *r1, int i);
     284static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
     285static raw_data_t *str2raw_data(string_t *str);
     286static raw_data_t *int2raw_data(int i);
     287static raw_data_t *long2raw_data(int i);
     288static raw_data_t *load_file(string_t *name);
     289static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
     290static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
     291static event_t *add_event(int key, int id, int flags, event_t *prev);
     292static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg);
     293static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg);
     294static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg);
     295static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg);
     296static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg);
     297static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg);
     298static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg);
     299static dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg);
     300static dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg);
     301static name_id_t *convert_ctlclass(name_id_t *cls);
     302static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
     303static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
     304static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
     305static dialog_t *dialog_language(language_t *l, dialog_t *dlg);
     306static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
     307static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
     308static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg);
     309static dialog_t *dialog_caption(string_t *s, dialog_t *dlg);
     310static dialog_t *dialog_exstyle(style_t * st, dialog_t *dlg);
     311static dialog_t *dialog_style(style_t * st, dialog_t *dlg);
     312static resource_t *build_stt_resources(stringtable_t *stthead);
     313static stringtable_t *find_stringtable(lvc_t *lvc);
     314static toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec);
     315static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
     316static string_t *make_filename(string_t *s);
     317static resource_t *build_fontdirs(resource_t *tail);
     318static resource_t *build_fontdir(resource_t **fnt, int nfnt);
     319static int rsrcid_to_token(int lookahead);
     320
     321
     322#line 224 "parser.y"
    290323typedef union{
    291324        string_t        *str;
    292325        int             num;
    293326        int             *iptr;
     327        char            *cptr;
    294328        resource_t      *res;
    295329        accelerator_t   *acc;
    296330        bitmap_t        *bmp;
    297         cursor_t        *cur;
    298         cursor_group_t  *curg;
    299331        dialog_t        *dlg;
    300332        dialogex_t      *dlgex;
    301333        font_t          *fnt;
    302         icon_t          *ico;
    303         icon_group_t    *icog;
     334        fontdir_t       *fnd;
    304335        menu_t          *men;
    305336        menuex_t        *menex;
     
    330361        style_pair_t    *styles;
    331362        style_t         *style;
     363        ani_any_t       *ani;
    332364} YYSTYPE;
    333365#ifndef YYDEBUG
     
    345377
    346378
    347 #define YYFINAL         604
     379#define YYFINAL         577
    348380#define YYFLAG          -32768
    349 #define YYNTBASE        112
    350 
    351 #define YYTRANSLATE(x) ((unsigned)(x) <= 351 ? yytranslate[x] : 191)
     381#define YYNTBASE        103
     382
     383#define YYTRANSLATE(x) ((unsigned)(x) <= 346 ? yytranslate[x] : 186)
    352384
    353385static const char yytranslate[] = {     0,
     
    355387     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    356388     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    357      2,     2,   107,     2,     2,     2,     2,    95,     2,   109,
    358    110,   104,   102,   111,   103,     2,   105,     2,     2,     2,
    359      2,     2,     2,     2,     2,     2,     2,     2,     2,    98,
    360      2,   100,     2,     2,     2,     2,     2,     2,     2,     2,
     389     2,     2,     2,     2,     2,     2,     2,    92,     2,   100,
     390   102,    95,    93,   101,    94,     2,    96,     2,     2,     2,
    361391     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    362392     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    363      2,     2,     2,    94,     2,     2,     2,     2,     2,     2,
    364393     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    365394     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    366      2,     2,     2,    93,     2,   106,     2,     2,     2,     2,
     395     2,     2,     2,    91,     2,     2,     2,     2,     2,     2,
     396     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     397     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     398     2,     2,     2,    90,     2,    97,     2,     2,     2,     2,
    367399     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    368400     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     
    377409     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    378410     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    379      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
    380      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
    381     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
    382     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
    383     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
    384     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
    385     57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
    386     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
    387     77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
    388     87,    88,    89,    90,    91,    92,    96,    97,    99,   101,
    389    108
     411     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     412     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
     413    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
     414    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
     415    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
     416    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
     417    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
     418    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
     419    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
     420    86,    87,    88,    89,    98,    99
    390421};
    391422
    392423#if YYDEBUG != 0
    393424static const short yyprhs[] = {     0,
    394      0,     2,     3,     6,     9,    12,    16,    20,    24,    28,
    395     31,    34,    36,    40,    44,    48,    52,    56,    60,    64,
    396     68,    72,    76,    80,    83,    86,    89,    92,    96,    98,
    397    100,   103,   108,   110,   112,   115,   118,   121,   124,   126,
    398    128,   130,   132,   134,   136,   138,   140,   142,   144,   146,
    399    148,   150,   152,   154,   156,   158,   160,   162,   164,   166,
    400    170,   174,   178,   182,   186,   190,   194,   197,   202,   207,
    401    211,   215,   217,   219,   226,   227,   233,   239,   240,   244,
    402    248,   252,   256,   260,   264,   278,   279,   283,   287,   291,
    403    294,   298,   302,   305,   308,   311,   312,   316,   320,   324,
    404    328,   332,   336,   340,   344,   348,   352,   356,   360,   364,
    405    368,   372,   376,   380,   391,   404,   415,   416,   421,   428,
    406    437,   455,   471,   476,   477,   480,   481,   484,   489,   493,
    407    497,   499,   502,   504,   506,   521,   522,   526,   530,   534,
    408    537,   540,   544,   548,   551,   554,   557,   558,   562,   566,
    409    570,   574,   578,   582,   586,   590,   594,   598,   602,   606,
    410    610,   614,   618,   622,   626,   637,   657,   674,   688,   700,
    411    701,   703,   704,   707,   717,   718,   721,   726,   730,   731,
    412    738,   742,   748,   749,   753,   757,   761,   765,   769,   773,
    413    778,   782,   783,   788,   792,   798,   799,   802,   808,   815,
    414    816,   819,   824,   831,   840,   845,   849,   850,   855,   856,
    415    858,   864,   865,   875,   885,   889,   893,   897,   901,   905,
    416    906,   909,   915,   916,   919,   921,   926,   931,   933,   937,
    417    947,   948,   952,   955,   956,   959,   962,   964,   966,   968,
    418    970,   972,   974,   976,   977,   980,   983,   986,   991,   994,
    419    997,  1001,  1003,  1005,  1007,  1009,  1013,  1017,  1021,  1025,
    420   1026,  1028,  1030,  1034,  1038,  1042,  1046,  1050,  1054,  1057,
    421   1060,  1064,  1066,  1069,  1071
     425     0,     2,     3,     6,     9,    11,    13,    15,    17,    19,
     426    21,    23,    26,    28,    32,    36,    41,    43,    44,    50,
     427    51,    53,    55,    57,    59,    61,    63,    65,    67,    69,
     428    71,    73,    75,    77,    79,    81,    83,    85,    87,    89,
     429    91,    93,    95,    97,   101,   105,   109,   113,   117,   121,
     430   125,   129,   133,   135,   137,   144,   145,   151,   157,   158,
     431   161,   163,   167,   169,   171,   173,   175,   177,   179,   193,
     432   194,   198,   202,   206,   209,   213,   217,   221,   224,   227,
     433   230,   231,   235,   239,   243,   247,   251,   255,   259,   263,
     434   267,   271,   275,   279,   283,   287,   291,   295,   299,   310,
     435   323,   334,   335,   340,   347,   356,   374,   390,   395,   396,
     436   399,   400,   403,   408,   412,   416,   418,   421,   423,   425,
     437   440,   441,   445,   449,   453,   456,   459,   463,   467,   471,
     438   474,   477,   480,   481,   485,   489,   493,   497,   501,   505,
     439   509,   513,   517,   521,   525,   529,   533,   537,   541,   545,
     440   549,   560,   580,   597,   611,   623,   624,   626,   627,   630,
     441   640,   641,   644,   649,   653,   654,   661,   665,   671,   672,
     442   676,   680,   684,   688,   692,   696,   701,   705,   706,   711,
     443   715,   721,   722,   725,   731,   738,   739,   742,   747,   754,
     444   763,   768,   772,   773,   778,   779,   781,   788,   789,   799,
     445   809,   813,   817,   821,   825,   829,   830,   833,   839,   840,
     446   843,   845,   850,   855,   857,   861,   871,   872,   876,   879,
     447   880,   883,   886,   888,   890,   892,   894,   896,   898,   900,
     448   901,   904,   907,   910,   915,   918,   921,   926,   928,   930,
     449   932,   934,   938,   942,   946,   950,   952,   954,   955,   957,
     450   959,   963,   967,   971,   975,   979,   983,   987,   990,   993,
     451   996,  1000,  1002,  1005,  1007
    422452};
    423453
    424 static const short yyrhs[] = {   113,
    425      0,     0,   113,   118,     0,   113,   114,     0,   113,   117,
    426      0,     3,   115,    10,     0,     4,    16,    10,     0,     5,
    427     16,    10,     0,     7,   115,    10,     0,     6,    10,     0,
    428      8,    10,     0,   116,     0,   115,    91,   115,     0,   115,
    429     92,   115,     0,   115,   102,   115,     0,   115,   103,   115,
    430      0,   115,    94,   115,     0,   115,    96,   115,     0,   115,
    431     97,   115,     0,   115,    98,   115,     0,   115,   100,   115,
    432      0,   115,    99,   115,     0,   115,   101,   115,     0,   106,
    433    115,     0,   102,   115,     0,   103,   115,     0,   107,   115,
    434      0,   109,   115,   110,     0,   190,     0,    16,     0,     9,
    435     16,     0,     9,   109,    16,   110,     0,    11,     0,    12,
    436      0,    16,    16,     0,    16,   109,     0,    16,   104,     0,
    437    119,   121,     0,   165,     0,   182,     0,   188,     0,    16,
    438      0,   119,     0,    15,     0,   131,     0,   122,     0,   123,
    439      0,   134,     0,   146,     0,   128,     0,   124,     0,   125,
    440      0,   156,     0,   160,     0,   126,     0,   127,     0,   176,
    441      0,   129,     0,   169,     0,    20,   178,    17,     0,    20,
    442    178,   185,     0,    21,   178,    17,     0,    21,   178,   185,
    443      0,    30,   178,    17,     0,    31,   178,    17,     0,    31,
    444    178,   185,     0,    26,    17,     0,    27,   178,   181,   185,
    445      0,    90,   178,   181,   185,     0,   130,   178,    17,     0,
    446    130,   178,   185,     0,    13,     0,    15,     0,    19,   178,
    447    181,    88,   132,    89,     0,     0,   132,    15,   111,   188,
    448    133,     0,   132,   188,   111,   188,   133,     0,     0,   133,
    449    111,    58,     0,   133,   111,    51,     0,   133,   111,    44,
    450      0,   133,   111,    52,     0,   133,   111,    53,     0,   133,
    451    111,    54,     0,    22,   178,   188,   111,   188,   111,   188,
    452    111,   188,   135,    88,   136,    89,     0,     0,   135,    70,
    453    144,     0,   135,    69,   144,     0,   135,    67,    15,     0,
    454    135,   141,     0,   135,    66,   120,     0,   135,    24,   119,
    455      0,   135,   182,     0,   135,   183,     0,   135,   184,     0,
    456      0,   136,    44,   140,     0,   136,    45,   138,     0,   136,
    457     42,   138,     0,   136,    41,   138,     0,   136,    43,   138,
    458      0,   136,    35,   137,     0,   136,    36,   137,     0,   136,
    459     40,   137,     0,   136,    37,   137,     0,   136,    38,   137,
    460      0,   136,    32,   137,     0,   136,    39,   137,     0,   136,
    461     33,   137,     0,   136,    34,   137,     0,   136,    48,   137,
    462      0,   136,    47,   137,     0,   136,    46,   137,     0,   136,
    463     31,   120,   168,   188,   111,   188,   111,   188,   139,     0,
    464     15,   168,   188,   111,   188,   111,   188,   111,   188,   111,
    465    188,   142,     0,   188,   111,   188,   111,   188,   111,   188,
    466    111,   188,   142,     0,     0,   111,   188,   111,   188,     0,
    467    111,   188,   111,   188,   111,   144,     0,   111,   188,   111,
    468    188,   111,   144,   111,   144,     0,   120,   168,   188,   111,
    469    145,   111,   144,   111,   188,   111,   188,   111,   188,   111,
    470    188,   111,   144,     0,   120,   168,   188,   111,   145,   111,
    471    144,   111,   188,   111,   188,   111,   188,   111,   188,     0,
    472     30,   188,   111,    15,     0,     0,   111,   144,     0,     0,
    473    111,   144,     0,   111,   144,   111,   144,     0,   144,    93,
    474    144,     0,   109,   144,   110,     0,   190,     0,   108,   190,
    475      0,   188,     0,    15,     0,    23,   178,   188,   111,   188,
    476    111,   188,   111,   188,   153,   147,    88,   148,    89,     0,
    477      0,   147,    70,   144,     0,   147,    69,   144,     0,   147,
    478     67,    15,     0,   147,   141,     0,   147,   154,     0,   147,
    479     66,   120,     0,   147,    24,   119,     0,   147,   182,     0,
    480    147,   183,     0,   147,   184,     0,     0,   148,    44,   149,
    481      0,   148,    45,   151,     0,   148,    42,   151,     0,   148,
    482     41,   151,     0,   148,    43,   151,     0,   148,    35,   150,
    483      0,   148,    36,   150,     0,   148,    40,   150,     0,   148,
    484     37,   150,     0,   148,    38,   150,     0,   148,    32,   150,
    485      0,   148,    39,   150,     0,   148,    33,   150,     0,   148,
    486     34,   150,     0,   148,    48,   150,     0,   148,    47,   150,
    487      0,   148,    46,   150,     0,   148,    31,   120,   168,   188,
    488    111,   188,   111,   188,   139,     0,   120,   168,   188,   111,
    489    145,   111,   144,   111,   188,   111,   188,   111,   188,   111,
    490    188,   111,   144,   153,   152,     0,   120,   168,   188,   111,
    491    145,   111,   144,   111,   188,   111,   188,   111,   188,   111,
    492    188,   152,     0,    15,   168,   188,   111,   188,   111,   188,
    493    111,   188,   111,   188,   143,   152,     0,   188,   111,   188,
    494    111,   188,   111,   188,   111,   188,   143,   152,     0,     0,
    495    185,     0,     0,   111,   188,     0,    30,   188,   111,    15,
    496    111,   188,   111,   188,   155,     0,     0,   111,   188,     0,
    497     24,   178,   181,   157,     0,    88,   158,    89,     0,     0,
    498    158,    82,    15,   168,   188,   159,     0,   158,    82,    84,
    499      0,   158,    83,    15,   159,   157,     0,     0,   111,    56,
    500    159,     0,   111,    55,   159,     0,   111,    85,   159,     0,
    501    111,    57,   159,     0,   111,    80,   159,     0,   111,    81,
    502    159,     0,    25,   178,   181,   161,     0,    88,   162,    89,
    503      0,     0,   162,    82,    15,   163,     0,   162,    82,    84,
    504      0,   162,    83,    15,   164,   161,     0,     0,   111,   188,
    505      0,   111,   187,   111,   187,   159,     0,   111,   187,   111,
    506    187,   111,   188,     0,     0,   111,   188,     0,   111,   187,
    507    111,   188,     0,   111,   187,   111,   187,   111,   188,     0,
    508    111,   187,   111,   187,   111,   187,   111,   188,     0,   166,
    509     88,   167,    89,     0,    29,   178,   181,     0,     0,   167,
    510    188,   168,    15,     0,     0,   111,     0,    28,   170,    88,
    511    171,    89,     0,     0,   170,    73,   188,   111,   188,   111,
    512    188,   111,   188,     0,   170,    74,   188,   111,   188,   111,
    513    188,   111,   188,     0,   170,    78,   188,     0,   170,    75,
    514    188,     0,   170,    76,   188,     0,   170,    77,   188,     0,
    515    170,    79,   188,     0,     0,   171,   172,     0,    49,    15,
    516     88,   173,    89,     0,     0,   173,   174,     0,   172,     0,
    517     50,    15,   111,    15,     0,    50,    15,   111,   175,     0,
    518    188,     0,   175,   111,   188,     0,    86,   178,   188,   111,
    519    188,   181,    88,   177,    89,     0,     0,   177,    87,   188,
    520      0,   177,    84,     0,     0,   178,   179,     0,   178,   180,
    521      0,    63,     0,    65,     0,    61,     0,    59,     0,    62,
    522      0,    64,     0,    60,     0,     0,   181,   182,     0,   181,
    523    183,     0,   181,   184,     0,    72,   188,   111,   188,     0,
    524     68,   188,     0,    71,   188,     0,    88,   186,    89,     0,
    525     18,     0,    13,     0,    14,     0,    15,     0,   186,   168,
    526     18,     0,   186,   168,    13,     0,   186,   168,    14,     0,
    527    186,   168,    15,     0,     0,   188,     0,   189,     0,   189,
    528    102,   189,     0,   189,   103,   189,     0,   189,    93,   189,
    529      0,   189,    95,   189,     0,   189,   104,   189,     0,   189,
    530    105,   189,     0,   106,   189,     0,   103,   189,     0,   109,
    531    189,   110,     0,   190,     0,   108,   190,     0,    13,     0,
    532     14,     0
     454static const short yyrhs[] = {   104,
     455     0,     0,   104,   106,     0,   104,   105,     0,     3,     0,
     456     5,     0,     4,     0,     6,     0,     7,     0,     9,     0,
     457     8,     0,    14,    95,     0,    10,     0,   183,   108,   111,
     458     0,    14,   108,   111,     0,    14,   108,    14,   100,     0,
     459   159,     0,     0,    71,   107,   183,   101,   183,     0,     0,
     460   183,     0,    14,     0,   109,     0,    13,     0,   123,     0,
     461   113,     0,   114,     0,   128,     0,   140,     0,   120,     0,
     462   116,     0,   117,     0,   115,     0,   150,     0,   154,     0,
     463   118,     0,   119,     0,   170,     0,   121,     0,   163,     0,
     464    15,     0,    14,     0,    13,     0,    18,   172,   181,     0,
     465    19,   172,   181,     0,    30,   172,   181,     0,    28,   172,
     466   181,     0,    29,   172,   181,     0,    24,   172,   181,     0,
     467    25,   172,   181,     0,    89,   172,   181,     0,   122,   172,
     468   181,     0,    11,     0,    14,     0,    17,   172,   175,    87,
     469   124,    88,     0,     0,   124,    13,   101,   183,   125,     0,
     470   124,   183,   101,   183,   125,     0,     0,   101,   126,     0,
     471   127,     0,   126,   101,   127,     0,    57,     0,    50,     0,
     472    43,     0,    51,     0,    52,     0,    53,     0,    20,   172,
     473   183,   101,   183,   101,   183,   101,   183,   129,    87,   130,
     474    88,     0,     0,   129,    69,   138,     0,   129,    68,   138,
     475     0,   129,    66,    13,     0,   129,   135,     0,   129,    65,
     476   110,     0,   129,     7,   110,     0,   129,    22,   109,     0,
     477   129,   176,     0,   129,   177,     0,   129,   178,     0,     0,
     478   130,    43,   134,     0,   130,    44,   132,     0,   130,    41,
     479   132,     0,   130,    40,   132,     0,   130,    42,   132,     0,
     480   130,    34,   131,     0,   130,    35,   131,     0,   130,    39,
     481   131,     0,   130,    36,   131,     0,   130,    37,   131,     0,
     482   130,    31,   131,     0,   130,    38,   131,     0,   130,    32,
     483   131,     0,   130,    33,   131,     0,   130,    47,   131,     0,
     484   130,    46,   131,     0,   130,    45,   131,     0,   130,    30,
     485   110,   162,   183,   101,   183,   101,   183,   133,     0,    13,
     486   162,   183,   101,   183,   101,   183,   101,   183,   101,   183,
     487   136,     0,   183,   101,   183,   101,   183,   101,   183,   101,
     488   183,   136,     0,     0,   101,   183,   101,   183,     0,   101,
     489   183,   101,   183,   101,   138,     0,   101,   183,   101,   183,
     490   101,   138,   101,   138,     0,   110,   162,   183,   101,   139,
     491   101,   138,   101,   183,   101,   183,   101,   183,   101,   183,
     492   101,   138,     0,   110,   162,   183,   101,   139,   101,   138,
     493   101,   183,   101,   183,   101,   183,   101,   183,     0,    28,
     494   183,   101,    13,     0,     0,   101,   138,     0,     0,   101,
     495   138,     0,   101,   138,   101,   138,     0,   138,    90,   138,
     496     0,   100,   138,   102,     0,   185,     0,    98,   185,     0,
     497   183,     0,    13,     0,    21,   172,   183,   101,   183,   101,
     498   183,   101,   183,   147,   141,    87,   142,    88,     0,     0,
     499   141,    69,   138,     0,   141,    68,   138,     0,   141,    66,
     500    13,     0,   141,   135,     0,   141,   148,     0,   141,    65,
     501   110,     0,   141,     7,   110,     0,   141,    22,   109,     0,
     502   141,   176,     0,   141,   177,     0,   141,   178,     0,     0,
     503   142,    43,   143,     0,   142,    44,   145,     0,   142,    41,
     504   145,     0,   142,    40,   145,     0,   142,    42,   145,     0,
     505   142,    34,   144,     0,   142,    35,   144,     0,   142,    39,
     506   144,     0,   142,    36,   144,     0,   142,    37,   144,     0,
     507   142,    31,   144,     0,   142,    38,   144,     0,   142,    32,
     508   144,     0,   142,    33,   144,     0,   142,    47,   144,     0,
     509   142,    46,   144,     0,   142,    45,   144,     0,   142,    30,
     510   110,   162,   183,   101,   183,   101,   183,   133,     0,   110,
     511   162,   183,   101,   139,   101,   138,   101,   183,   101,   183,
     512   101,   183,   101,   183,   101,   138,   147,   146,     0,   110,
     513   162,   183,   101,   139,   101,   138,   101,   183,   101,   183,
     514   101,   183,   101,   183,   146,     0,    13,   162,   183,   101,
     515   183,   101,   183,   101,   183,   101,   183,   137,   146,     0,
     516   183,   101,   183,   101,   183,   101,   183,   101,   183,   137,
     517   146,     0,     0,   179,     0,     0,   101,   183,     0,    28,
     518   183,   101,    13,   101,   183,   101,   183,   149,     0,     0,
     519   101,   183,     0,    22,   172,   175,   151,     0,    87,   152,
     520    88,     0,     0,   152,    81,    13,   162,   183,   153,     0,
     521   152,    81,    83,     0,   152,    82,    13,   153,   151,     0,
     522     0,   101,    55,   153,     0,   101,    54,   153,     0,   101,
     523    84,   153,     0,   101,    56,   153,     0,   101,    79,   153,
     524     0,   101,    80,   153,     0,    23,   172,   175,   155,     0,
     525    87,   156,    88,     0,     0,   156,    81,    13,   157,     0,
     526   156,    81,    83,     0,   156,    82,    13,   158,   155,     0,
     527     0,   101,   183,     0,   101,   182,   101,   182,   153,     0,
     528   101,   182,   101,   182,   101,   183,     0,     0,   101,   183,
     529     0,   101,   182,   101,   183,     0,   101,   182,   101,   182,
     530   101,   183,     0,   101,   182,   101,   182,   101,   182,   101,
     531   183,     0,   160,    87,   161,    88,     0,    27,   172,   175,
     532     0,     0,   161,   183,   162,    13,     0,     0,   101,     0,
     533    26,   172,   164,    87,   165,    88,     0,     0,   164,    72,
     534   183,   101,   183,   101,   183,   101,   183,     0,   164,    73,
     535   183,   101,   183,   101,   183,   101,   183,     0,   164,    77,
     536   183,     0,   164,    74,   183,     0,   164,    75,   183,     0,
     537   164,    76,   183,     0,   164,    78,   183,     0,     0,   165,
     538   166,     0,    48,    13,    87,   167,    88,     0,     0,   167,
     539   168,     0,   166,     0,    49,    13,   101,    13,     0,    49,
     540    13,   101,   169,     0,   183,     0,   169,   101,   183,     0,
     541    85,   172,   183,   101,   183,   175,    87,   171,    88,     0,
     542     0,   171,    86,   183,     0,   171,    83,     0,     0,   172,
     543   173,     0,   172,   174,     0,    62,     0,    64,     0,    60,
     544     0,    58,     0,    61,     0,    63,     0,    59,     0,     0,
     545   175,   176,     0,   175,   177,     0,   175,   178,     0,    71,
     546   183,   101,   183,     0,    67,   183,     0,    70,   183,     0,
     547   175,    87,   180,    88,     0,    16,     0,    11,     0,    12,
     548     0,    13,     0,   180,   162,    16,     0,   180,   162,    11,
     549     0,   180,   162,    12,     0,   180,   162,    13,     0,   112,
     550     0,   179,     0,     0,   183,     0,   184,     0,   184,    93,
     551   184,     0,   184,    94,   184,     0,   184,    90,   184,     0,
     552   184,    92,   184,     0,   184,    95,   184,     0,   184,    96,
     553   184,     0,   184,    91,   184,     0,    97,   184,     0,    94,
     554   184,     0,    93,   184,     0,   100,   184,   102,     0,   185,
     555     0,    98,   185,     0,    11,     0,    12,     0
    533556};
    534557
     
    537560#if YYDEBUG != 0
    538561static const short yyrline[] = { 0,
    539    310,   330,   331,   356,   357,   362,   363,   364,   365,   366,
    540    367,   370,   371,   372,   373,   374,   375,   376,   377,   378,
    541    379,   380,   381,   382,   383,   384,   385,   386,   390,   391,
    542    392,   393,   397,   398,   399,   400,   401,   406,   421,   429,
    543    442,   450,   461,   462,   472,   473,   474,   488,   489,   495,
    544    496,   497,   511,   512,   518,   519,   520,   521,   522,   526,
    545    527,   531,   532,   537,   541,   542,   550,   558,   571,   584,
    546    585,   604,   616,   626,   650,   651,   652,   655,   656,   657,
    547    658,   659,   660,   661,   666,   701,   702,   703,   704,   705,
    548    706,   707,   708,   709,   710,   713,   714,   715,   716,   717,
    549    718,   719,   720,   721,   722,   724,   725,   726,   727,   728,
    550    729,   730,   731,   733,   743,   762,   777,   780,   785,   792,
    551    803,   817,   832,   837,   838,   842,   843,   844,   848,   849,
    552    850,   851,   855,   860,   868,   913,   914,   915,   916,   917,
    553    918,   919,   920,   921,   922,   923,   926,   927,   928,   929,
    554    930,   931,   932,   933,   934,   935,   937,   938,   939,   940,
    555    941,   942,   943,   944,   946,   956,   981,   997,  1025,  1048,
    556   1049,  1052,  1053,  1057,  1064,  1065,  1069,  1092,  1096,  1097,
    557   1106,  1112,  1131,  1132,  1133,  1134,  1135,  1136,  1137,  1141,
    558   1166,  1170,  1171,  1187,  1193,  1213,  1214,  1218,  1226,  1237,
    559   1238,  1242,  1248,  1256,  1276,  1317,  1328,  1329,  1361,  1362,
    560   1367,  1374,  1375,  1385,  1395,  1402,  1409,  1416,  1423,  1433,
    561   1434,  1443,  1451,  1452,  1461,  1466,  1472,  1481,  1482,  1486,
    562   1512,  1513,  1518,  1527,  1528,  1538,  1553,  1554,  1555,  1556,
    563   1559,  1560,  1561,  1565,  1566,  1574,  1582,  1593,  1597,  1601,
    564   1605,  1609,  1610,  1611,  1612,  1613,  1614,  1615,  1616,  1623,
    565   1624,  1626,  1629,  1630,  1631,  1632,  1633,  1634,  1635,  1636,
    566   1638,  1639,  1640,  1643,  1644
     562   346,   380,   381,   426,   431,   432,   433,   434,   435,   436,
     563   437,   441,   442,   471,   483,   493,   514,   522,   522,   564,
     564   570,   577,   587,   588,   597,   598,   599,   623,   624,   630,
     565   631,   632,   633,   657,   658,   664,   665,   666,   667,   668,
     566   672,   673,   674,   678,   682,   698,   720,   730,   738,   746,
     567   750,   754,   765,   770,   779,   803,   804,   805,   814,   815,
     568   818,   819,   822,   823,   824,   825,   826,   827,   832,   866,
     569   867,   868,   869,   870,   871,   872,   873,   874,   875,   876,
     570   879,   880,   881,   882,   883,   884,   885,   886,   887,   888,
     571   890,   891,   892,   893,   894,   895,   896,   897,   899,   909,
     572   928,   943,   946,   951,   958,   969,   983,   998,  1003,  1004,
     573  1008,  1009,  1010,  1014,  1015,  1016,  1017,  1021,  1026,  1034,
     574  1078,  1079,  1080,  1081,  1082,  1083,  1084,  1085,  1086,  1087,
     575  1088,  1089,  1092,  1093,  1094,  1095,  1096,  1097,  1098,  1099,
     576  1100,  1101,  1103,  1104,  1105,  1106,  1107,  1108,  1109,  1110,
     577  1112,  1122,  1147,  1163,  1191,  1214,  1215,  1218,  1219,  1223,
     578  1230,  1231,  1235,  1258,  1262,  1263,  1272,  1278,  1297,  1298,
     579  1299,  1300,  1301,  1302,  1303,  1307,  1332,  1336,  1337,  1353,
     580  1359,  1379,  1380,  1384,  1392,  1403,  1404,  1408,  1414,  1422,
     581  1442,  1483,  1494,  1495,  1529,  1530,  1535,  1551,  1552,  1562,
     582  1572,  1579,  1586,  1593,  1600,  1610,  1611,  1620,  1628,  1629,
     583  1638,  1643,  1649,  1658,  1659,  1663,  1689,  1690,  1695,  1704,
     584  1705,  1715,  1730,  1731,  1732,  1733,  1736,  1737,  1738,  1742,
     585  1743,  1751,  1759,  1777,  1781,  1785,  1789,  1804,  1805,  1806,
     586  1807,  1808,  1809,  1810,  1811,  1815,  1819,  1826,  1827,  1831,
     587  1834,  1835,  1836,  1837,  1838,  1839,  1840,  1841,  1842,  1843,
     588  1844,  1845,  1846,  1849,  1850
    567589};
    568590#endif
     
    571593#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
    572594
    573 static const char * const yytname[] = {   "$","error","$undefined.","tIF","tIFDEF",
    574 "tIFNDEF","tELSE","tELIF","tENDIF","tDEFINED","tNL","tTYPEDEF","tEXTERN","NUMBER",
    575 "LNUMBER","tSTRING","IDENT","FILENAME","RAWDATA","ACCELERATORS","tBITMAP","CURSOR",
    576 "DIALOG","DIALOGEX","MENU","MENUEX","MESSAGETABLE","RCDATA","VERSIONINFO","STRINGTABLE",
    577 "FONT","ICON","AUTO3STATE","AUTOCHECKBOX","AUTORADIOBUTTON","CHECKBOX","DEFPUSHBUTTON",
    578 "PUSHBUTTON","RADIOBUTTON","STATE3","GROUPBOX","COMBOBOX","LISTBOX","SCROLLBAR",
    579 "CONTROL","EDITTEXT","RTEXT","CTEXT","LTEXT","BLOCK","VALUE","SHIFT","ALT","ASCII",
    580 "VIRTKEY","GRAYED","CHECKED","INACTIVE","NOINVERT","tPURE","IMPURE","DISCARDABLE",
    581 "LOADONCALL","PRELOAD","tFIXED","MOVEABLE","CLASS","CAPTION","CHARACTERISTICS",
    582 "EXSTYLE","STYLE","VERSION","LANGUAGE","FILEVERSION","PRODUCTVERSION","FILEFLAGSMASK",
    583 "FILEOS","FILETYPE","FILEFLAGS","FILESUBTYPE","MENUBARBREAK","MENUBREAK","MENUITEM",
    584 "POPUP","SEPARATOR","HELP","TOOLBAR","BUTTON","tBEGIN","tEND","DLGINIT","LOGOR",
    585 "LOGAND","'|'","'^'","'&'","EQ","NE","'<'","LTE","'>'","GTE","'+'","'-'","'*'",
    586 "'/'","'~'","'!'","NOT","'('","')'","','","resource_file","resources","preprocessor",
    587 "pp_expr","pp_constant","cjunk","resource","nameid","nameid_s","resource_definition",
    588 "bitmap","cursor","font","icon","messagetable","rcdata","dlginit","userres",
    589 "usertype","accelerators","events","acc_opt","dialog","dlg_attributes","ctrls",
     595static const char * const yytname[] = {   "$","error","$undefined.","tTYPEDEF",
     596"tEXTERN","tSTRUCT","tENUM","tCPPCLASS","tINLINE","tSTATIC","tNL","tNUMBER",
     597"tLNUMBER","tSTRING","tIDENT","tFILENAME","tRAWDATA","tACCELERATORS","tBITMAP",
     598"tCURSOR","tDIALOG","tDIALOGEX","tMENU","tMENUEX","tMESSAGETABLE","tRCDATA",
     599"tVERSIONINFO","tSTRINGTABLE","tFONT","tFONTDIR","tICON","tAUTO3STATE","tAUTOCHECKBOX",
     600"tAUTORADIOBUTTON","tCHECKBOX","tDEFPUSHBUTTON","tPUSHBUTTON","tRADIOBUTTON",
     601"tSTATE3","tGROUPBOX","tCOMBOBOX","tLISTBOX","tSCROLLBAR","tCONTROL","tEDITTEXT",
     602"tRTEXT","tCTEXT","tLTEXT","tBLOCK","tVALUE","tSHIFT","tALT","tASCII","tVIRTKEY",
     603"tGRAYED","tCHECKED","tINACTIVE","tNOINVERT","tPURE","tIMPURE","tDISCARDABLE",
     604"tLOADONCALL","tPRELOAD","tFIXED","tMOVEABLE","tCLASS","tCAPTION","tCHARACTERISTICS",
     605"tEXSTYLE","tSTYLE","tVERSION","tLANGUAGE","tFILEVERSION","tPRODUCTVERSION",
     606"tFILEFLAGSMASK","tFILEOS","tFILETYPE","tFILEFLAGS","tFILESUBTYPE","tMENUBARBREAK",
     607"tMENUBREAK","tMENUITEM","tPOPUP","tSEPARATOR","tHELP","tTOOLBAR","tBUTTON",
     608"tBEGIN","tEND","tDLGINIT","'|'","'^'","'&'","'+'","'-'","'*'","'/'","'~'","tNOT",
     609"pUPM","'('","','","')'","resource_file","resources","cjunk","resource","@1",
     610"usrcvt","nameid","nameid_s","resource_definition","filename","bitmap","cursor",
     611"icon","font","fontdir","messagetable","rcdata","dlginit","userres","usertype",
     612"accelerators","events","acc_opt","accs","acc","dialog","dlg_attributes","ctrls",
    590613"lab_ctrl","ctrl_desc","iconinfo","gen_ctrl","opt_font","optional_style","optional_style_pair",
    591614"style","ctlclass","dialogex","dlgex_attribs","exctrls","gen_exctrl","lab_exctrl",
     
    595618"versioninfo","fix_version","ver_blocks","ver_block","ver_values","ver_value",
    596619"ver_words","toolbar","toolbar_items","loadmemopts","lamo","lama","opt_lvc",
    597 "opt_language","opt_characts","opt_version","raw_data","raw_elements","e_expr",
    598 "expr","xpr","any_num", NULL
     620"opt_language","opt_characts","opt_version","raw_data","raw_elements","file_raw",
     621"e_expr","expr","xpr","any_num", NULL
    599622};
    600623#endif
    601624
    602625static const short yyr1[] = {     0,
    603    112,   113,   113,   113,   113,   114,   114,   114,   114,   114,
    604    114,   115,   115,   115,   115,   115,   115,   115,   115,   115,
    605    115,   115,   115,   115,   115,   115,   115,   115,   116,   116,
    606    116,   116,   117,   117,   117,   117,   117,   118,   118,   118,
    607    119,   119,   120,   120,   121,   121,   121,   121,   121,   121,
    608    121,   121,   121,   121,   121,   121,   121,   121,   121,   122,
    609    122,   123,   123,   124,   125,   125,   126,   127,   128,   129,
    610    129,   130,   130,   131,   132,   132,   132,   133,   133,   133,
    611    133,   133,   133,   133,   134,   135,   135,   135,   135,   135,
    612    135,   135,   135,   135,   135,   136,   136,   136,   136,   136,
    613    136,   136,   136,   136,   136,   136,   136,   136,   136,   136,
    614    136,   136,   136,   136,   137,   138,   139,   139,   139,   139,
    615    140,   140,   141,   142,   142,   143,   143,   143,   144,   144,
    616    144,   144,   145,   145,   146,   147,   147,   147,   147,   147,
    617    147,   147,   147,   147,   147,   147,   148,   148,   148,   148,
    618    148,   148,   148,   148,   148,   148,   148,   148,   148,   148,
    619    148,   148,   148,   148,   148,   149,   149,   150,   151,   152,
    620    152,   153,   153,   154,   155,   155,   156,   157,   158,   158,
    621    158,   158,   159,   159,   159,   159,   159,   159,   159,   160,
    622    161,   162,   162,   162,   162,   163,   163,   163,   163,   164,
    623    164,   164,   164,   164,   165,   166,   167,   167,   168,   168,
    624    169,   170,   170,   170,   170,   170,   170,   170,   170,   171,
    625    171,   172,   173,   173,   174,   174,   174,   175,   175,   176,
    626    177,   177,   177,   178,   178,   178,   179,   179,   179,   179,
    627    180,   180,   180,   181,   181,   181,   181,   182,   183,   184,
    628    185,   186,   186,   186,   186,   186,   186,   186,   186,   187,
    629    187,   188,   189,   189,   189,   189,   189,   189,   189,   189,
    630    189,   189,   189,   190,   190
     626   103,   104,   104,   104,   105,   105,   105,   105,   105,   105,
     627   105,   105,   105,   106,   106,   106,   106,   107,   106,   108,
     628   109,   109,   110,   110,   111,   111,   111,   111,   111,   111,
     629   111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
     630   112,   112,   112,   113,   114,   115,   116,   117,   118,   119,
     631   120,   121,   122,   122,   123,   124,   124,   124,   125,   125,
     632   126,   126,   127,   127,   127,   127,   127,   127,   128,   129,
     633   129,   129,   129,   129,   129,   129,   129,   129,   129,   129,
     634   130,   130,   130,   130,   130,   130,   130,   130,   130,   130,
     635   130,   130,   130,   130,   130,   130,   130,   130,   130,   131,
     636   132,   133,   133,   133,   133,   134,   134,   135,   136,   136,
     637   137,   137,   137,   138,   138,   138,   138,   139,   139,   140,
     638   141,   141,   141,   141,   141,   141,   141,   141,   141,   141,
     639   141,   141,   142,   142,   142,   142,   142,   142,   142,   142,
     640   142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
     641   142,   143,   143,   144,   145,   146,   146,   147,   147,   148,
     642   149,   149,   150,   151,   152,   152,   152,   152,   153,   153,
     643   153,   153,   153,   153,   153,   154,   155,   156,   156,   156,
     644   156,   157,   157,   157,   157,   158,   158,   158,   158,   158,
     645   159,   160,   161,   161,   162,   162,   163,   164,   164,   164,
     646   164,   164,   164,   164,   164,   165,   165,   166,   167,   167,
     647   168,   168,   168,   169,   169,   170,   171,   171,   171,   172,
     648   172,   172,   173,   173,   173,   173,   174,   174,   174,   175,
     649   175,   175,   175,   176,   177,   178,   179,   180,   180,   180,
     650   180,   180,   180,   180,   180,   181,   181,   182,   182,   183,
     651   184,   184,   184,   184,   184,   184,   184,   184,   184,   184,
     652   184,   184,   184,   185,   185
    631653};
    632654
    633655static const short yyr2[] = {     0,
    634      1,     0,     2,     2,     2,     3,     3,     3,     3,     2,
    635      2,     1,     3,     3,     3,     3,     3,     3,     3,     3,
    636      3,     3,     3,     2,     2,     2,     2,     3,     1,     1,
    637      2,     4,     1,     1,     2,     2,     2,     2,     1,     1,
     656     1,     0,     2,     2,     1,     1,     1,     1,     1,     1,
     657     1,     2,     1,     3,     3,     4,     1,     0,     5,     0,
    638658     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    639      1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
    640      3,     3,     3,     3,     3,     3,     2,     4,     4,     3,
    641      3,     1,     1,     6,     0,     5,     5,     0,     3,     3,
    642      3,     3,     3,     3,    13,     0,     3,     3,     3,     2,
    643      3,     3,     2,     2,     2,     0,     3,     3,     3,     3,
     659     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     660     1,     1,     1,     3,     3,     3,     3,     3,     3,     3,
     661     3,     3,     1,     1,     6,     0,     5,     5,     0,     2,
     662     1,     3,     1,     1,     1,     1,     1,     1,    13,     0,
     663     3,     3,     3,     2,     3,     3,     3,     2,     2,     2,
     664     0,     3,     3,     3,     3,     3,     3,     3,     3,     3,
     665     3,     3,     3,     3,     3,     3,     3,     3,    10,    12,
     666    10,     0,     4,     6,     8,    17,    15,     4,     0,     2,
     667     0,     2,     4,     3,     3,     1,     2,     1,     1,    14,
     668     0,     3,     3,     3,     2,     2,     3,     3,     3,     2,
     669     2,     2,     0,     3,     3,     3,     3,     3,     3,     3,
    644670     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
    645      3,     3,     3,    10,    12,    10,     0,     4,     6,     8,
    646     17,    15,     4,     0,     2,     0,     2,     4,     3,     3,
    647      1,     2,     1,     1,    14,     0,     3,     3,     3,     2,
    648      2,     3,     3,     2,     2,     2,     0,     3,     3,     3,
    649      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
    650      3,     3,     3,     3,    10,    19,    16,    13,    11,     0,
    651      1,     0,     2,     9,     0,     2,     4,     3,     0,     6,
    652      3,     5,     0,     3,     3,     3,     3,     3,     3,     4,
    653      3,     0,     4,     3,     5,     0,     2,     5,     6,     0,
    654      2,     4,     6,     8,     4,     3,     0,     4,     0,     1,
    655      5,     0,     9,     9,     3,     3,     3,     3,     3,     0,
    656      2,     5,     0,     2,     1,     4,     4,     1,     3,     9,
    657      0,     3,     2,     0,     2,     2,     1,     1,     1,     1,
    658      1,     1,     1,     0,     2,     2,     2,     4,     2,     2,
    659      3,     1,     1,     1,     1,     3,     3,     3,     3,     0,
    660      1,     1,     3,     3,     3,     3,     3,     3,     2,     2,
     671    10,    19,    16,    13,    11,     0,     1,     0,     2,     9,
     672     0,     2,     4,     3,     0,     6,     3,     5,     0,     3,
     673     3,     3,     3,     3,     3,     4,     3,     0,     4,     3,
     674     5,     0,     2,     5,     6,     0,     2,     4,     6,     8,
     675     4,     3,     0,     4,     0,     1,     6,     0,     9,     9,
     676     3,     3,     3,     3,     3,     0,     2,     5,     0,     2,
     677     1,     4,     4,     1,     3,     9,     0,     3,     2,     0,
     678     2,     2,     1,     1,     1,     1,     1,     1,     1,     0,
     679     2,     2,     2,     4,     2,     2,     4,     1,     1,     1,
     680     1,     3,     3,     3,     3,     1,     1,     0,     1,     1,
     681     3,     3,     3,     3,     3,     3,     3,     2,     2,     2,
    661682     3,     1,     2,     1,     1
    662683};
    663684
    664685static const short yydefact[] = {     2,
    665      1,     0,     0,     0,     0,     0,     0,    33,    34,   274,
    666    275,    42,   234,     0,     0,     0,     0,     0,     4,     5,
    667      3,     0,    39,     0,    40,    41,   262,   272,     0,    30,
    668      0,     0,     0,     0,     0,     0,    12,    29,     0,     0,
    669     10,     0,    11,    35,    37,    36,   244,     0,   270,   269,
    670    273,     0,    72,    73,   234,   234,   234,   234,   234,   234,
    671    234,     0,   234,   212,   234,   234,   234,   234,    38,    46,
    672     47,    51,    52,    55,    56,    50,    58,   234,    45,    48,
    673     49,    53,    54,    59,    57,   207,     0,     0,     0,     0,
    674      0,     0,    31,     0,    25,    26,    24,    27,     0,     6,
     686     1,     5,     7,     6,     8,     9,    11,    10,    13,   264,
     687   265,    20,   220,    18,     0,     0,     0,     0,     0,     4,
     688     3,    17,     0,    20,   250,   262,    12,     0,   230,     0,
     689   260,   259,   258,   263,     0,   193,     0,     0,     0,     0,
     690     0,     0,     0,     0,    53,    54,   220,   220,   220,   220,
     691   220,   220,   220,   220,   220,   220,   220,   220,   220,   220,
     692   220,    15,    26,    27,    33,    31,    32,    36,    37,    30,
     693    39,   220,    25,    28,    29,    34,    35,    40,    38,   226,
     694   229,   225,   227,   223,   228,   224,   221,   222,   192,     0,
     695   261,     0,    54,    14,   253,   257,   254,   251,   252,   255,
     696   256,    16,   230,   230,   230,     0,     0,   230,   230,   230,
     697   230,   198,   230,   230,   230,     0,   230,   230,     0,     0,
     698     0,   231,   232,   233,     0,   191,   195,     0,    43,    42,
     699    41,   246,     0,   247,    44,    45,     0,     0,     0,     0,
     700    49,    50,     0,    47,    48,    46,     0,    51,    52,   235,
     701   236,     0,    19,   196,     0,    56,     0,     0,     0,   165,
     702   163,   178,   176,     0,     0,     0,     0,     0,     0,     0,
     703   206,     0,     0,   194,     0,   239,   240,   241,   238,   195,
     704     0,     0,     0,     0,     0,     0,   202,   203,   204,   201,
     705   205,     0,   230,   234,     0,    55,     0,   237,     0,     0,
     706     0,     0,     0,   164,     0,     0,   177,     0,     0,     0,
     707   197,   207,     0,     0,     0,   243,   244,   245,   242,     0,
     708     0,   195,   167,   169,   182,   180,   186,     0,     0,     0,
     709   217,    59,    59,     0,     0,     0,     0,     0,   248,   179,
     710   248,     0,     0,     0,   209,     0,     0,    57,    58,    70,
     711   158,   169,   169,   169,   169,   169,   169,   169,   168,     0,
     712   183,     0,   187,   181,     0,     0,     0,   219,     0,   216,
     713    65,    64,    66,    67,    68,    63,    60,    61,     0,     0,
     714   121,   166,   171,   170,   173,   174,   175,   172,   248,   248,
     715     0,     0,     0,   208,   211,   210,   218,     0,     0,     0,
     716     0,     0,     0,     0,     0,    81,    74,    78,    79,    80,
     717   159,     0,   169,   249,     0,   188,   199,   200,     0,    62,
     718    24,    22,    23,    76,    21,    77,     0,    75,    73,     0,
     719     0,    72,   116,    71,     0,     0,     0,     0,     0,     0,
     720     0,     0,   133,   125,   126,   130,   131,   132,     0,   184,
     721   248,     0,     0,   117,     0,     0,     0,     0,     0,     0,
    675722     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    676      0,     7,     8,     9,   240,   243,   239,   241,   237,   242,
    677    238,   235,   236,   206,     0,   271,   244,     0,     0,     0,
    678      0,   244,   244,    67,   244,     0,     0,     0,     0,   244,
    679      0,     0,   265,   266,   263,   264,   267,   268,     0,    28,
    680     13,    14,    17,    18,    19,    20,    22,    21,    23,    15,
    681     16,     0,     0,   245,   246,   247,   248,     0,    60,     0,
    682     61,    62,    63,     0,     0,     0,     0,     0,     0,     0,
    683      0,     0,     0,     0,     0,   220,    64,    65,    66,     0,
    684      0,    70,    71,   205,   209,    32,   249,   250,    75,   253,
    685    254,   255,   252,   209,     0,     0,   179,   177,   192,   190,
    686     68,     0,     0,   216,   217,   218,   215,   219,     0,     0,
    687     69,   210,     0,     0,   251,     0,     0,     0,     0,     0,
    688      0,     0,     0,   211,   221,   244,   208,     0,    74,     0,
    689    257,   258,   259,   256,     0,     0,     0,     0,   178,     0,
    690      0,   191,     0,     0,     0,     0,     0,     0,     0,     0,
    691    209,   181,   183,   196,   194,   200,     0,     0,   223,   231,
    692     78,    78,     0,     0,     0,     0,     0,   260,   193,   260,
    693      0,     0,     0,     0,     0,    76,    77,    86,   172,   183,
    694    183,   183,   183,   183,   183,   183,   182,     0,   197,     0,
    695    201,   195,     0,     0,     0,   222,   225,   224,   233,     0,
    696    230,     0,     0,     0,   136,   180,   185,   184,   187,   188,
    697    189,   186,   260,   260,   213,   214,     0,   232,    81,    80,
    698     82,    83,    84,    79,     0,     0,     0,     0,     0,     0,
    699     96,    90,    93,    94,    95,   173,     0,   183,   261,     0,
    700    202,     0,    42,    92,     0,    44,    43,    91,    89,     0,
    701      0,    88,   131,    87,     0,     0,     0,     0,     0,     0,
    702      0,   147,   140,   141,   144,   145,   146,     0,   198,   260,
    703    226,   227,   228,     0,   132,     0,     0,     0,     0,     0,
     723     0,     0,     0,     0,    69,   128,   129,     0,   127,   124,
     724   123,   122,     0,   185,     0,   189,   212,   213,   214,   108,
     725   115,   114,   195,   195,    92,    94,    95,    87,    88,    90,
     726    91,    93,    89,    85,     0,    84,    86,   195,    82,    83,
     727    98,    97,    96,     0,     0,     0,     0,     0,     0,     0,
    704728     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    705      0,     0,     0,     0,     0,    85,   143,     0,   142,   139,
    706    138,   137,     0,   199,     0,   203,     0,   123,   130,   129,
    707    209,   209,   107,   109,   110,   102,   103,   105,   106,   108,
    708    104,   100,     0,    99,   101,   209,    97,    98,   113,   112,
    709    111,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     729     0,     0,   120,     0,     0,     0,     0,     0,     0,   108,
     730   195,   195,   144,   146,   147,   139,   140,   142,   143,   145,
     731   141,   137,     0,   136,   138,   195,   134,   135,   150,   149,
     732   148,   190,   215,     0,     0,     0,     0,     0,     0,     0,
    710733     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    711    135,     0,   229,     0,     0,     0,     0,   123,   209,   209,
    712    158,   160,   161,   153,   154,   156,   157,   159,   155,   151,
    713      0,   150,   152,   209,   148,   149,   164,   163,   162,   204,
    714      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    715      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    716      0,   134,     0,   133,     0,     0,     0,     0,     0,     0,
    717      0,     0,     0,   175,     0,     0,     0,     0,   117,     0,
    718      0,     0,     0,   174,     0,     0,     0,     0,     0,   114,
    719      0,     0,     0,   176,   117,     0,     0,     0,     0,     0,
    720    124,     0,   165,     0,     0,     0,     0,     0,     0,   116,
    721      0,     0,   126,     0,   118,   124,   125,     0,     0,     0,
    722    170,     0,     0,   115,     0,   126,   127,   169,   171,     0,
    723    119,     0,   170,     0,     0,     0,     0,   168,   128,     0,
    724    120,   122,     0,     0,   170,   121,     0,   167,   172,   170,
    725    166,     0,     0,     0
     734     0,     0,     0,     0,   119,     0,   118,     0,     0,     0,
     735     0,     0,     0,     0,     0,     0,   161,     0,     0,     0,
     736     0,   102,     0,     0,     0,     0,   160,     0,     0,     0,
     737     0,     0,    99,     0,     0,     0,   162,   102,     0,     0,
     738     0,     0,     0,   109,     0,   151,     0,     0,     0,     0,
     739     0,     0,   101,     0,     0,   111,     0,   103,   109,   110,
     740     0,     0,     0,   156,     0,     0,   100,     0,   111,   112,
     741   155,   157,     0,   104,     0,   156,     0,     0,     0,     0,
     742   154,   113,     0,   105,   107,     0,     0,   156,   106,     0,
     743   153,   158,   156,   152,     0,     0,     0
    726744};
    727745
    728 static const short yydefgoto[] = {   602,
    729      1,    19,    36,    37,    20,    21,   357,   358,    69,    70,
    730     71,    72,    73,    74,    75,    76,    77,    78,    79,   224,
    731    286,    80,   313,   365,   423,   432,   540,   437,   342,   560,
    732    571,   362,   513,    81,   347,   413,   485,   471,   480,   578,
    733    315,   374,   534,    82,   208,   229,   277,    83,   210,   230,
    734    279,   281,    23,    24,   142,   223,    84,   136,   219,   235,
    735    284,   308,   382,    85,   285,    47,   122,   123,   124,   164,
    736    165,   166,   579,   204,   298,    26,    27,    28
     746static const short yydefgoto[] = {   575,
     747     1,    20,    21,    30,    28,   323,   324,    62,   132,    63,
     748    64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
     749   175,   248,   277,   278,    74,   279,   335,   395,   404,   513,
     750   409,   307,   533,   544,   332,   486,    75,   312,   383,   457,
     751   443,   452,   551,   281,   345,   507,    76,   161,   183,   238,
     752    77,   163,   184,   240,   242,    22,    23,    92,   155,    78,
     753   143,   192,   212,   267,   296,   388,    79,   246,    29,    87,
     754    88,   133,   122,   123,   124,   134,   180,   135,   260,   325,
     755    25,    26
    737756};
    738757
    739758static const short yypact[] = {-32768,
    740     39,    10,    -4,     0,    -1,    10,    15,-32768,-32768,-32768,
    741 -32768,   -15,-32768,   197,   197,   197,    82,   197,-32768,-32768,
    742 -32768,   442,-32768,   -68,-32768,-32768,   390,-32768,     6,-32768,
    743     10,    10,    10,    10,    10,   298,-32768,-32768,    31,    56,
    744 -32768,   351,-32768,-32768,-32768,-32768,   611,   -41,    50,-32768,
    745 -32768,   483,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    746 -32768,    55,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
     759     4,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
     760-32768,   -61,-32768,-32768,   233,   233,   233,    49,   233,-32768,
     761-32768,-32768,     1,-32768,   248,-32768,-32768,   391,   651,   233,
     762-32768,-32768,-32768,-32768,   606,-32768,   559,   233,   233,   233,
     763   233,   233,   233,   233,-32768,   -19,-32768,-32768,-32768,-32768,
    747764-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    748 -32768,-32768,-32768,-32768,-32768,-32768,   197,   197,   197,   197,
    749    197,   197,-32768,    58,-32768,-32768,-32768,-32768,   449,-32768,
    750     10,    10,    10,    10,    10,    10,    10,    10,    10,    10,
    751     10,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    752 -32768,-32768,-32768,   349,   197,-32768,   611,   345,   417,   110,
    753    110,   611,   611,-32768,   611,   558,    19,   439,   110,   611,
    754    454,   114,   517,   125,    50,    50,-32768,-32768,   -25,-32768,
    755    690,   700,   556,   706,   706,    85,    85,    85,    85,-32768,
    756 -32768,   197,   197,-32768,-32768,-32768,-32768,   153,-32768,   401,
    757 -32768,-32768,-32768,   -14,     7,   195,   255,   262,   197,   197,
    758    197,   197,   197,   197,   197,-32768,-32768,-32768,-32768,    53,
    759    262,-32768,-32768,-32768,    78,-32768,-32768,-32768,-32768,-32768,
    760 -32768,-32768,-32768,   -13,   197,   197,-32768,-32768,-32768,-32768,
    761 -32768,    88,   123,-32768,-32768,-32768,-32768,-32768,   -22,   197,
    762 -32768,-32768,   135,    73,-32768,   516,   132,   148,    74,    95,
    763    197,   197,   178,-32768,-32768,-32768,-32768,   154,-32768,   157,
    764 -32768,-32768,-32768,-32768,   197,   197,    -9,   254,-32768,    -7,
    765    257,-32768,   173,   184,    22,   276,   197,   197,   214,   220,
    766     78,-32768,   224,   230,-32768,   234,   197,   197,-32768,-32768,
    767 -32768,-32768,   197,   197,   197,   111,   209,   197,-32768,   197,
    768    258,   240,   245,    76,   268,   252,   252,-32768,   267,   224,
    769    224,   224,   224,   224,   224,   224,-32768,   269,   273,   280,
    770    273,-32768,   197,   197,   297,-32768,-32768,-32768,-32768,   197,
    771 -32768,   723,   530,   197,-32768,-32768,-32768,-32768,-32768,-32768,
    772 -32768,-32768,   197,   197,-32768,-32768,   282,-32768,-32768,-32768,
    773 -32768,-32768,-32768,-32768,   193,   197,    77,   364,    35,    35,
    774 -32768,-32768,-32768,-32768,-32768,-32768,   618,   291,-32768,   292,
    775    273,    43,-32768,-32768,   302,-32768,-32768,-32768,-32768,    82,
    776     35,   294,-32768,   294,   676,   193,   197,    77,   420,    35,
    777     35,-32768,-32768,-32768,-32768,-32768,-32768,   201,-32768,   197,
    778 -32768,   328,-32768,   425,-32768,    48,    35,    77,   426,   426,
    779    426,   426,   426,   426,   426,   426,   426,   197,   197,   197,
    780     77,   197,   426,   426,   426,-32768,-32768,   335,-32768,-32768,
    781    294,   294,   694,-32768,   347,   273,   197,-32768,-32768,-32768,
    782     78,    78,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    783 -32768,-32768,   348,-32768,-32768,    78,-32768,-32768,-32768,-32768,
    784 -32768,   459,    77,   469,   469,   469,   469,   469,   469,   469,
    785    469,   469,   197,   197,   197,    77,   197,   469,   469,   469,
    786 -32768,   197,-32768,   197,   197,   197,   197,   376,    78,    78,
    787765-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    788    378,-32768,-32768,    78,-32768,-32768,-32768,-32768,-32768,-32768,
    789    379,   380,   385,   386,   197,   197,   197,   197,   197,   197,
    790    197,   197,   146,   398,   400,   409,   411,   412,   413,   415,
    791    422,-32768,   424,-32768,   197,   197,   197,   197,   146,   197,
    792    197,   197,    35,   427,   428,   433,   444,   445,   447,   453,
    793    455,   101,   197,-32768,   197,   197,   197,    35,   197,-32768,
    794    197,   197,   197,-32768,   447,   456,   458,   149,   466,   468,
    795    470,   472,-32768,   197,   197,   197,   197,   197,    35,-32768,
    796    197,   478,   479,   480,   502,   470,   294,   503,   197,    35,
    797    465,   197,    35,-32768,   197,   479,   151,-32768,-32768,   504,
    798    218,   505,   465,    35,   197,    35,   197,-32768,   294,   506,
    799    294,   527,   197,    35,   -71,   294,    35,-32768,   231,   465,
    800 -32768,   512,   537,-32768
     766-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
     767-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   215,     2,
     768-32768,    62,-32768,-32768,   625,   102,   269,    36,    36,-32768,
     769-32768,-32768,   651,   191,   191,    82,    82,   651,   651,   191,
     770   191,   651,   191,   191,   191,    82,   191,   191,   233,   233,
     771   233,-32768,-32768,-32768,   233,-32768,    16,    12,-32768,-32768,
     772-32768,-32768,   228,-32768,-32768,-32768,    22,    38,   237,   282,
     773-32768,-32768,   376,-32768,-32768,-32768,    48,-32768,-32768,-32768,
     774-32768,    52,-32768,-32768,    87,-32768,   114,   233,   233,-32768,
     775-32768,-32768,-32768,   233,   233,   233,   233,   233,   233,   233,
     776-32768,   233,   233,-32768,   124,-32768,-32768,-32768,-32768,   -29,
     777    60,    72,   -49,    40,    76,    77,-32768,-32768,-32768,-32768,
     778-32768,   -31,-32768,-32768,    80,-32768,   108,-32768,   264,   233,
     779   233,     7,   100,-32768,     9,   198,-32768,   233,   233,   206,
     780-32768,-32768,   360,   233,   233,-32768,-32768,-32768,-32768,   119,
     781   122,    16,-32768,   127,   128,-32768,   131,   140,   146,   171,
     782-32768,   161,   161,   233,   233,   233,   147,   180,   233,-32768,
     783   233,   187,   233,   233,-32768,   173,   342,-32768,-32768,-32768,
     784   182,   127,   127,   127,   127,   127,   127,   127,-32768,   186,
     785   196,   204,   196,-32768,   205,   211,   -21,-32768,   233,-32768,
     786-32768,-32768,-32768,-32768,-32768,-32768,   219,-32768,   289,   233,
     787-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   233,   233,
     788   233,   233,   308,-32768,-32768,-32768,-32768,   342,   172,   225,
     789   233,   172,   315,    14,    14,-32768,-32768,-32768,-32768,-32768,
     790-32768,   375,   231,-32768,   244,   196,-32768,-32768,   270,-32768,
     791-32768,-32768,-32768,-32768,-32768,-32768,   271,-32768,-32768,    49,
     792    14,   239,-32768,   239,   561,   172,   225,   233,   172,   321,
     793    14,    14,-32768,-32768,-32768,-32768,-32768,-32768,    54,-32768,
     794   233,   281,   364,-32768,   -60,    14,   172,   367,   367,   367,
     795   367,   367,   367,   367,   367,   367,   233,   233,   233,   172,
     796   233,   367,   367,   367,-32768,-32768,-32768,   272,-32768,-32768,
     797   239,   239,   579,-32768,   285,   196,-32768,   288,-32768,-32768,
     798-32768,-32768,    16,    16,-32768,-32768,-32768,-32768,-32768,-32768,
     799-32768,-32768,-32768,-32768,   295,-32768,-32768,    16,-32768,-32768,
     800-32768,-32768,-32768,   378,   172,   385,   385,   385,   385,   385,
     801   385,   385,   385,   385,   233,   233,   233,   172,   233,   385,
     802   385,   385,-32768,   233,   233,   233,   233,   233,   233,   299,
     803    16,    16,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
     804-32768,-32768,   300,-32768,-32768,    16,-32768,-32768,-32768,-32768,
     805-32768,-32768,-32768,   303,   305,   306,   317,   233,   233,   233,
     806   233,   233,   233,   233,   233,   290,   322,   328,   331,   338,
     807   358,   363,   365,   377,-32768,   380,-32768,   233,   233,   233,
     808   233,   290,   233,   233,   233,    14,   381,   382,   383,   384,
     809   397,   399,   401,   402,   -39,   233,-32768,   233,   233,   233,
     810    14,   233,-32768,   233,   233,   233,-32768,   399,   403,   405,
     811   -14,   409,   411,   416,   424,-32768,   233,   233,   233,   233,
     812   233,    14,-32768,   233,   430,   431,   433,   434,   416,   239,
     813   435,   233,    14,   390,   233,    14,-32768,   233,   431,   -12,
     814-32768,-32768,   437,    -6,   438,   390,    14,   233,    14,   233,
     815-32768,   239,   439,   239,   441,   233,    14,   -24,   239,    14,
     816-32768,     6,   390,-32768,   422,   465,-32768
    801817};
    802818
    803819static const short yypgoto[] = {-32768,
    804 -32768,-32768,    28,-32768,-32768,-32768,     1,  -248,-32768,-32768,
     820-32768,-32768,-32768,-32768,   455,  -296,  -299,   449,-32768,-32768,
    805821-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    806    308,-32768,-32768,-32768,    33,  -202,    49,-32768,   293,    94,
    807     63,  -333,   142,-32768,-32768,-32768,-32768,   312,   -84,  -223,
    808     68,-32768,-32768,-32768,   391,-32768,    26,-32768,   397,-32768,
    809 -32768,-32768,-32768,-32768,-32768,  -190,-32768,-32768,-32768,   395,
    810 -32768,-32768,-32768,-32768,-32768,   688,-32768,-32768,  -122,     2,
    811   -278,  -274,   107,-32768,  -259,   108,   186,    -2
     822-32768,   310,-32768,   247,-32768,-32768,-32768,   296,   -55,    28,
     823-32768,   238,    10,     3,  -286,    61,-32768,-32768,-32768,-32768,
     824   254,    29,  -504,   -18,-32768,-32768,-32768,   318,-32768,   -65,
     825-32768,   313,-32768,-32768,-32768,-32768,-32768,-32768,  -178,-32768,
     826-32768,-32768,   291,-32768,-32768,-32768,-32768,-32768,   580,-32768,
     827-32768,   -23,  -274,  -258,  -244,  -520,-32768,   577,  -240,    -1,
     828   480,     5
    812829};
    813830
    814831
    815 #define YYLAST          809
    816 
    817 
    818 static const short yytable[] = {    38,
    819     44,    22,    25,    38,   168,   261,   364,   264,    41,   176,
    820    177,    39,   178,   226,    51,    40,   170,   191,    29,    86,
    821    300,    93,    10,    11,    43,    30,   233,   386,    38,    38,
    822     38,    38,    38,    42,   344,   187,   411,   412,   345,   597,
    823    112,     2,     3,     4,     5,     6,     7,    10,    11,     8,
    824      9,    10,    11,   420,    12,    10,    11,   381,    95,    96,
    825     97,    98,    99,   348,   350,   113,   234,    13,   376,   125,
    826    275,   134,   377,   149,   262,   225,   265,   115,   116,   117,
    827    118,   119,   120,   121,   196,    10,    11,   238,    45,    10,
    828     11,   356,   353,    46,    10,    11,   205,   222,    38,    38,
    829     38,    38,    38,    38,    38,    38,    38,    38,    38,   269,
    830     14,    31,    32,   256,    94,    33,    34,   206,    35,   409,
    831    415,    48,    10,    11,   233,   305,    10,    11,   151,   152,
    832    153,   154,   155,   156,   157,   158,   159,   160,   161,   421,
    833    387,    15,   360,   361,    16,    15,    17,    18,    16,   237,
    834     17,    18,   436,    91,    92,   247,   248,   419,    10,    11,
    835    512,   239,   249,   220,   306,   291,   292,   293,   115,   116,
    836    117,   118,   119,   120,   121,    15,   250,   251,    16,    15,
    837     17,    18,    16,   252,    17,    18,   110,   111,   222,   532,
    838    294,   295,   255,   387,   469,   296,   434,   435,   231,   438,
    839     49,    50,   194,    52,   548,    10,    11,   484,   353,    10,
    840     11,   543,    15,    10,    11,    16,    15,    17,    18,    16,
    841    162,    17,    18,   163,    14,   567,    89,    90,    91,    92,
    842    464,   465,   167,   232,   171,   173,   577,   174,   175,   581,
    843    199,   387,   245,   387,   189,   467,   190,   193,    15,   195,
    844    589,    16,   591,    17,    18,   291,   292,   293,   246,   556,
    845    596,   584,   162,   599,   257,   163,    14,   258,   263,   197,
    846    198,   266,   143,   144,   145,   146,   147,   148,   496,   497,
    847    294,   295,   207,   267,   211,   296,   212,   213,   214,   215,
    848    216,   217,   218,   499,   268,    15,   207,   221,    16,    15,
    849     17,    18,    16,    15,    17,    18,    16,   100,    17,    18,
    850    387,   327,   227,   228,   343,   316,   317,   318,   319,   320,
    851    321,   322,   162,   387,   273,   163,    14,   236,   586,   162,
    852    274,   240,   163,    14,   276,   354,   363,   363,   253,   254,
    853    278,   314,   209,   162,   280,   209,   163,    14,   375,   170,
    854    303,   309,   259,   260,   310,   304,   311,   385,   363,   588,
    855    114,   169,   312,   270,   271,   272,   407,   363,   363,   482,
    856    483,   598,   486,   379,   282,   283,   601,   314,   359,   323,
    857    288,   289,   290,  -261,   363,   299,   387,   301,   101,   102,
    858    324,   103,   352,   104,   105,   106,   107,   108,   109,   110,
    859    111,   378,   380,   115,   116,   117,   118,   119,   120,   121,
    860    325,   326,   384,   200,   201,   202,   162,   328,   203,   163,
    861     14,   346,   424,   425,   426,   427,   428,   429,   430,   431,
    862    349,   351,   170,   172,   410,   439,   440,   441,   417,   418,
    863    422,   101,   102,   355,   103,   442,   104,   105,   106,   107,
    864    108,   109,   110,   111,    53,   188,    54,   462,   466,   383,
    865     55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
    866    192,    65,    66,   468,   408,   115,   116,   117,   118,   119,
    867    120,   121,    87,   470,    88,   414,   495,   416,   498,   500,
    868    501,    89,    90,    91,    92,   502,   503,   115,   116,   117,
    869    118,   119,   120,   121,   170,   433,   433,   433,   515,   433,
    870    516,   603,   115,   116,   117,   118,   119,   120,   121,   517,
    871    363,   518,   519,   520,   463,   521,   170,    67,   241,   242,
    872    243,    68,   522,   244,   523,   363,   604,   533,   535,   101,
    873    102,   170,   103,   536,   104,   105,   106,   107,   108,   109,
    874    110,   111,   170,   335,   537,   538,   363,   539,   150,   336,
    875    481,   481,   481,   541,   481,   542,   554,   363,   555,   490,
    876    363,   491,   492,   493,   494,    87,   557,    88,   558,   287,
    877    559,   363,   561,   363,    89,    90,    91,    92,   569,   570,
    878    572,   363,   126,   553,   363,   337,   338,   162,   339,   340,
    879    163,    14,   504,   505,   506,   507,   508,   509,   510,   511,
    880    514,    88,   573,   575,   585,   587,   593,   341,    89,    90,
    881     91,    92,   524,   525,   526,   527,   514,   529,   530,   531,
    882    179,   180,   181,   182,   183,   184,   185,   594,   583,   373,
    883    544,   366,   545,   546,   547,   186,   549,   367,   550,   551,
    884    552,   104,   105,   106,   107,   108,   109,   110,   111,   574,
    885    528,   562,   563,   564,   565,   566,   600,   297,   568,   115,
    886    116,   117,   118,   119,   120,   121,   576,   302,   307,   580,
    887      0,     0,   582,   368,   369,   162,   370,   371,   163,    14,
    888      0,     0,   590,     0,   592,     0,     0,     0,     0,     0,
    889    595,     0,     0,     0,     0,   372,   388,   389,   390,   391,
    890    392,   393,   394,   395,   396,   397,   398,   399,   400,   401,
    891    402,   403,   404,   405,   443,   444,   445,   446,   447,   448,
    892    449,   450,   451,   452,   453,   454,   455,   456,   457,   458,
    893    459,   460,   127,   128,   129,   130,   131,   132,   133,     0,
    894    135,     0,   137,   138,   139,   140,   472,   473,   474,   475,
    895    476,   477,   478,   479,   406,   141,   329,     0,     0,   487,
    896    488,   489,     0,   330,   331,   332,   333,     0,     0,     0,
    897    334,   102,   461,   103,     0,   104,   105,   106,   107,   108,
    898    109,   110,   111,   103,     0,   104,   105,   106,   107,   108,
    899    109,   110,   111,   106,   107,   108,   109,   110,   111
     832#define YYLAST          721
     833
     834
     835static const short yytable[] = {    24,
     836   262,   199,   328,   326,   308,    89,     2,     3,     4,     5,
     837     6,     7,     8,     9,    10,    11,   210,    12,   334,   222,
     838   309,   225,    34,   552,    10,    11,   210,   293,    90,   356,
     839    13,   202,   203,    27,   310,   552,   376,   346,   204,   379,
     840   377,   391,  -230,   236,   355,  -230,  -230,   552,   313,   315,
     841   356,   561,   552,   347,   381,   382,   211,   393,   198,    10,
     842    11,   516,  -230,   571,    10,    11,   294,   348,   574,   392,
     843   408,   154,    10,    11,    14,   356,   570,   356,   119,   128,
     844   102,   120,   121,   356,   139,   140,   529,    36,   557,   223,
     845   127,   226,    10,    11,   559,   356,    15,    16,   156,   174,
     846    17,    18,   125,    19,   137,   138,   280,   253,   254,   255,
     847   385,   330,   224,   331,   147,   441,   154,   150,   151,   152,
     848   205,   206,   158,   153,   176,   177,   178,   207,   456,   179,
     849    43,    44,   256,   257,    10,    11,   195,   258,   159,    80,
     850    81,    82,    83,    84,    85,    86,    15,    16,   172,   126,
     851    17,    18,   173,    19,    15,    16,   181,   182,    17,    18,
     852   200,    19,   185,   186,   187,   188,   189,   190,   191,   213,
     853   193,   194,   201,   197,    15,    16,   208,   209,    17,    18,
     854   214,    19,    10,    11,   321,   322,   282,   283,   284,   285,
     855   286,   287,   288,    40,    41,    42,    43,    44,   220,   221,
     856   253,   254,   255,   129,   130,   131,   228,   229,   215,   505,
     857   227,   196,   232,   233,   436,   437,    15,    16,   230,   234,
     858    17,    18,   235,    19,   521,   256,   257,   237,   239,   439,
     859   258,   241,   250,   251,   252,    10,    11,   261,   322,   263,
     860   243,   265,   266,    10,    11,   540,   244,   350,    80,    81,
     861    82,    83,    84,    85,    86,   268,   550,   245,   269,   554,
     862   270,   247,   469,   470,    15,    16,   160,   297,    17,    18,
     863   562,    19,   564,   162,   216,   217,   218,   472,   311,   219,
     864   569,   119,   280,   572,   120,   121,   289,   314,   316,   317,
     865   318,    10,    11,   387,   119,   299,  -249,   120,   121,   327,
     866    10,    11,   485,   119,   290,   291,   120,   121,   333,   333,
     867   300,   292,   406,   407,   157,   410,   301,    15,    16,   298,
     868   319,    17,    18,   160,    19,    15,    16,   329,   356,    17,
     869    18,   349,    19,   380,   354,   333,   378,    38,    39,    40,
     870    41,    42,    43,    44,   351,   333,   333,   384,   119,   386,
     871   389,   120,   121,   302,   303,   119,   304,   305,   120,   121,
     872   333,    41,    42,    43,    44,   405,   405,   405,   162,   405,
     873   352,   353,   414,    15,    16,   306,   390,    17,    18,   394,
     874    19,   336,    15,    16,   271,   434,    17,    18,   435,    19,
     875   440,   272,   273,   274,   275,   438,   337,   442,   276,   468,
     876   471,    45,   338,   473,    46,   474,   475,    47,    48,    49,
     877    50,    51,    52,    53,    54,    55,    56,   476,    57,    58,
     878    59,   576,   488,   453,   453,   453,   119,   453,   489,   120,
     879   121,   490,   462,   463,   464,   465,   466,   467,   491,   339,
     880   340,   119,   341,   342,   120,   121,   231,   164,   165,   166,
     881   167,   168,   169,   170,   454,   455,  -230,   458,   492,  -230,
     882  -230,   343,   171,   493,   577,   494,   477,   478,   479,   480,
     883   481,   482,   483,   484,   487,    60,  -230,   495,    37,    61,
     884   496,   506,   508,   509,   510,    94,   497,   498,   499,   500,
     885   487,   502,   503,   504,    31,    32,    33,   511,    35,   512,
     886   333,   514,   515,   527,   517,   528,   518,   519,   520,   530,
     887   522,   531,   523,   524,   525,   333,   532,    95,    96,    97,
     888    98,    99,   100,   101,   534,   535,   536,   537,   538,   539,
     889   542,   543,   541,   545,   546,   548,   333,   558,   560,   566,
     890   549,   567,   249,   553,   320,   526,   555,   333,   547,   344,
     891   333,   556,   501,   573,   264,   259,   563,   295,   565,     0,
     892     0,   333,     0,   333,   568,     0,     0,     0,     0,    45,
     893     0,   333,    93,     0,   333,    47,    48,    49,    50,    51,
     894    52,    53,    54,    55,    56,     0,    57,    58,    59,     0,
     895   357,   358,   359,   360,   361,   362,   363,   364,   365,   366,
     896   367,   368,   369,   370,   371,   372,   373,   374,   415,   416,
     897   417,   418,   419,   420,   421,   422,   423,   424,   425,   426,
     898   427,   428,   429,   430,   431,   432,   103,   104,   105,   106,
     899   107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
     900   117,     0,     0,    60,     0,     0,     0,    61,   375,     0,
     901     0,   118,     0,     0,   396,   397,   398,   399,   400,   401,
     902   402,   403,     0,     0,     0,     0,   433,   411,   412,   413,
     903   444,   445,   446,   447,   448,   449,   450,   451,     0,     0,
     904     0,   136,     0,   459,   460,   461,   141,   142,     0,   144,
     905   145,   146,     0,   148,   149,    38,    39,    40,    41,    42,
     906    43,    44,     0,     0,     0,     0,     0,    91,    80,    81,
     907    82,    83,    84,    85,    86,    39,    40,    41,    42,    43,
     908    44
    900909};
    901910
    902 static const short yycheck[] = {     2,
    903     16,     1,     1,     6,   127,    15,   340,    15,    10,   132,
    904    133,    16,   135,   204,    17,    16,    88,   140,     9,    88,
    905    280,    16,    13,    14,    10,    16,    49,   361,    31,    32,
    906     33,    34,    35,     6,   313,    17,   370,   371,   313,   111,
    907     10,     3,     4,     5,     6,     7,     8,    13,    14,    11,
    908     12,    13,    14,   387,    16,    13,    14,    15,    31,    32,
    909     33,    34,    35,   323,   324,    10,    89,    29,   347,   111,
    910    261,    17,   347,    16,    84,    89,    84,    59,    60,    61,
    911     62,    63,    64,    65,   110,    13,    14,    15,   104,    13,
    912     14,    15,    16,   109,    13,    14,   111,   111,   101,   102,
    913    103,   104,   105,   106,   107,   108,   109,   110,   111,    88,
    914     72,   102,   103,   236,   109,   106,   107,   111,   109,   368,
    915    380,    14,    13,    14,    49,    50,    13,    14,   101,   102,
    916    103,   104,   105,   106,   107,   108,   109,   110,   111,   388,
    917     93,   103,   108,   109,   106,   103,   108,   109,   106,    15,
    918    108,   109,   401,   104,   105,    82,    83,   110,    13,    14,
    919     15,    89,    89,   111,    89,    55,    56,    57,    59,    60,
    920     61,    62,    63,    64,    65,   103,    82,    83,   106,   103,
    921    108,   109,   106,    89,   108,   109,   102,   103,   111,   523,
    922     80,    81,    15,    93,   443,    85,   399,   400,   111,   402,
    923     15,    16,    89,    18,   538,    13,    14,   456,    16,    13,
    924     14,   111,   103,    13,    14,   106,   103,   108,   109,   106,
    925     68,   108,   109,    71,    72,   559,   102,   103,   104,   105,
    926    421,   422,   125,   111,   128,   129,   570,   130,   131,   573,
    927     88,    93,   111,    93,   138,   436,   139,   141,   103,   142,
    928    584,   106,   586,   108,   109,    55,    56,    57,   111,   111,
    929    594,   111,    68,   597,   111,    71,    72,   111,    15,   162,
    930    163,    15,    87,    88,    89,    90,    91,    92,   469,   470,
    931     80,    81,    88,   111,   178,    85,   179,   180,   181,   182,
    932    183,   184,   185,   484,   111,   103,    88,   191,   106,   103,
    933    108,   109,   106,   103,   108,   109,   106,    10,   108,   109,
    934     93,    15,   205,   206,   313,   290,   291,   292,   293,   294,
    935    295,   296,    68,    93,   111,    71,    72,   220,   111,    68,
    936    111,   224,    71,    72,   111,   335,   339,   340,   231,   232,
    937    111,   111,    88,    68,   111,    88,    71,    72,   347,    88,
    938    111,    84,   245,   246,    87,   111,    89,   360,   361,   583,
    939     10,    17,   111,    88,   257,   258,   366,   370,   371,   454,
    940    455,   595,   457,   348,   267,   268,   600,   111,    15,   111,
    941    273,   274,   275,   111,   387,   278,    93,   280,    91,    92,
    942    111,    94,   111,    96,    97,    98,    99,   100,   101,   102,
    943    103,   111,   111,    59,    60,    61,    62,    63,    64,    65,
    944    303,   304,   111,    13,    14,    15,    68,   310,    18,    71,
    945     72,   314,   390,   391,   392,   393,   394,   395,   396,   397,
    946    323,   324,    88,    17,    15,   403,   404,   405,   111,    15,
    947     15,    91,    92,   336,    94,   111,    96,    97,    98,    99,
    948    100,   101,   102,   103,    13,    17,    15,   111,   111,   352,
    949     19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
    950     17,    30,    31,    15,   367,    59,    60,    61,    62,    63,
    951     64,    65,    93,    15,    95,   378,   111,   380,   111,   111,
    952    111,   102,   103,   104,   105,   111,   111,    59,    60,    61,
    953     62,    63,    64,    65,    88,   398,   399,   400,   111,   402,
    954    111,     0,    59,    60,    61,    62,    63,    64,    65,   111,
    955    523,   111,   111,   111,   417,   111,    88,    86,    13,    14,
    956     15,    90,   111,    18,   111,   538,     0,   111,   111,    91,
    957     92,    88,    94,   111,    96,    97,    98,    99,   100,   101,
    958    102,   103,    88,    24,   111,   111,   559,   111,   110,    30,
    959    453,   454,   455,   111,   457,   111,   111,   570,   111,   462,
    960    573,   464,   465,   466,   467,    93,   111,    95,   111,   272,
    961    111,   584,   111,   586,   102,   103,   104,   105,   111,   111,
    962    111,   594,   110,   545,   597,    66,    67,    68,    69,    70,
    963     71,    72,   495,   496,   497,   498,   499,   500,   501,   502,
    964    503,    95,   111,   111,   111,   111,   111,    88,   102,   103,
    965    104,   105,   515,   516,   517,   518,   519,   520,   521,   522,
    966     73,    74,    75,    76,    77,    78,    79,   111,   576,   347,
    967    533,    24,   535,   536,   537,    88,   539,    30,   541,   542,
    968    543,    96,    97,    98,    99,   100,   101,   102,   103,   566,
    969    519,   554,   555,   556,   557,   558,   599,   277,   561,    59,
    970     60,    61,    62,    63,    64,    65,   569,   281,   284,   572,
    971     -1,    -1,   575,    66,    67,    68,    69,    70,    71,    72,
    972     -1,    -1,   585,    -1,   587,    -1,    -1,    -1,    -1,    -1,
    973    593,    -1,    -1,    -1,    -1,    88,    31,    32,    33,    34,
    974     35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
    975     45,    46,    47,    48,    31,    32,    33,    34,    35,    36,
    976     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
    977     47,    48,    55,    56,    57,    58,    59,    60,    61,    -1,
    978     63,    -1,    65,    66,    67,    68,   445,   446,   447,   448,
    979    449,   450,   451,   452,    89,    78,    44,    -1,    -1,   458,
    980    459,   460,    -1,    51,    52,    53,    54,    -1,    -1,    -1,
    981     58,    92,    89,    94,    -1,    96,    97,    98,    99,   100,
    982    101,   102,   103,    94,    -1,    96,    97,    98,    99,   100,
    983    101,   102,   103,    98,    99,   100,   101,   102,   103
     911static const short yycheck[] = {     1,
     912   241,   180,   302,   300,   279,    29,     3,     4,     5,     6,
     913     7,     8,     9,    10,    11,    12,    48,    14,   305,    13,
     914   279,    13,    18,   544,    11,    12,    48,    49,    30,    90,
     915    27,    81,    82,    95,   279,   556,   336,   312,    88,   339,
     916   337,   102,    67,   222,   331,    70,    71,   568,   289,   290,
     917    90,   556,   573,   312,   341,   342,    88,   357,    88,    11,
     918    12,   101,    87,   568,    11,    12,    88,   312,   573,   356,
     919   370,   101,    11,    12,    71,    90,   101,    90,    67,   103,
     920   100,    70,    71,    90,   108,   109,   101,    87,   101,    83,
     921    92,    83,    11,    12,   101,    90,    93,    94,    87,    13,
     922    97,    98,   101,   100,   106,   107,   101,    54,    55,    56,
     923   351,    98,    13,   100,   116,   415,   101,   119,   120,   121,
     924    81,    82,   101,   125,    11,    12,    13,    88,   428,    16,
     925    95,    96,    79,    80,    11,    12,    13,    84,   101,    58,
     926    59,    60,    61,    62,    63,    64,    93,    94,   101,    88,
     927    97,    98,   101,   100,    93,    94,   158,   159,    97,    98,
     928   101,   100,   164,   165,   166,   167,   168,   169,   170,   193,
     929   172,   173,   101,   175,    93,    94,   101,   101,    97,    98,
     930   101,   100,    11,    12,    13,    14,   252,   253,   254,   255,
     931   256,   257,   258,    92,    93,    94,    95,    96,   200,   201,
     932    54,    55,    56,    13,    14,    15,   208,   209,   101,   496,
     933    13,    88,   214,   215,   393,   394,    93,    94,    13,   101,
     934    97,    98,   101,   100,   511,    79,    80,   101,   101,   408,
     935    84,   101,   234,   235,   236,    11,    12,   239,    14,   241,
     936   101,   243,   244,    11,    12,   532,   101,   313,    58,    59,
     937    60,    61,    62,    63,    64,    83,   543,    87,    86,   546,
     938    88,   101,   441,   442,    93,    94,    87,   269,    97,    98,
     939   557,   100,   559,    87,    11,    12,    13,   456,   280,    16,
     940   567,    67,   101,   570,    70,    71,   101,   289,   290,   291,
     941   292,    11,    12,    13,    67,     7,   101,    70,    71,   301,
     942    11,    12,    13,    67,   101,   101,    70,    71,   304,   305,
     943    22,   101,   368,   369,    87,   371,    28,    93,    94,   101,
     944    13,    97,    98,    87,   100,    93,    94,    13,    90,    97,
     945    98,   101,   100,    13,   330,   331,   338,    90,    91,    92,
     946    93,    94,    95,    96,   101,   341,   342,   349,    67,   351,
     947   352,    70,    71,    65,    66,    67,    68,    69,    70,    71,
     948   356,    93,    94,    95,    96,   367,   368,   369,    87,   371,
     949   101,   101,   101,    93,    94,    87,    13,    97,    98,    13,
     950   100,     7,    93,    94,    43,   101,    97,    98,   101,   100,
     951    13,    50,    51,    52,    53,   101,    22,    13,    57,   101,
     952   101,    11,    28,   101,    14,   101,   101,    17,    18,    19,
     953    20,    21,    22,    23,    24,    25,    26,   101,    28,    29,
     954    30,     0,   101,   425,   426,   427,    67,   429,   101,    70,
     955    71,   101,   434,   435,   436,   437,   438,   439,   101,    65,
     956    66,    67,    68,    69,    70,    71,    87,    72,    73,    74,
     957    75,    76,    77,    78,   426,   427,    67,   429,   101,    70,
     958    71,    87,    87,   101,     0,   101,   468,   469,   470,   471,
     959   472,   473,   474,   475,   476,    85,    87,   101,    24,    89,
     960   101,   101,   101,   101,   101,    37,   488,   489,   490,   491,
     961   492,   493,   494,   495,    15,    16,    17,   101,    19,   101,
     962   496,   101,   101,   101,   506,   101,   508,   509,   510,   101,
     963   512,   101,   514,   515,   516,   511,   101,    38,    39,    40,
     964    41,    42,    43,    44,   101,   527,   528,   529,   530,   531,
     965   101,   101,   534,   101,   101,   101,   532,   101,   101,   101,
     966   542,   101,   233,   545,   298,   518,   548,   543,   539,   312,
     967   546,   549,   492,   572,   242,   238,   558,   267,   560,    -1,
     968    -1,   557,    -1,   559,   566,    -1,    -1,    -1,    -1,    11,
     969    -1,   567,    14,    -1,   570,    17,    18,    19,    20,    21,
     970    22,    23,    24,    25,    26,    -1,    28,    29,    30,    -1,
     971    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
     972    40,    41,    42,    43,    44,    45,    46,    47,    30,    31,
     973    32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
     974    42,    43,    44,    45,    46,    47,    47,    48,    49,    50,
     975    51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
     976    61,    -1,    -1,    85,    -1,    -1,    -1,    89,    88,    -1,
     977    -1,    72,    -1,    -1,   359,   360,   361,   362,   363,   364,
     978   365,   366,    -1,    -1,    -1,    -1,    88,   372,   373,   374,
     979   417,   418,   419,   420,   421,   422,   423,   424,    -1,    -1,
     980    -1,   105,    -1,   430,   431,   432,   110,   111,    -1,   113,
     981   114,   115,    -1,   117,   118,    90,    91,    92,    93,    94,
     982    95,    96,    -1,    -1,    -1,    -1,    -1,   102,    58,    59,
     983    60,    61,    62,    63,    64,    91,    92,    93,    94,    95,
     984    96
    984985};
    985986/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
    986 #line 3 "/emx/share/bison.simple"
    987 /* This file comes from bison-1.28.  */
     987#line 3 "bison.simple"
    988988
    989989/* Skeleton output parser for bison,
     
    10021002   You should have received a copy of the GNU General Public License
    10031003   along with this program; if not, write to the Free Software
    1004    Foundation, Inc., 59 Temple Place - Suite 330,
    1005    Boston, MA 02111-1307, USA.  */
     1004   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    10061005
    10071006/* As a special exception, when this file is copied by Bison into a
     
    10101009   in version 1.24 of Bison.  */
    10111010
     1011#ifndef alloca
     1012#ifdef __GNUC__
     1013#define alloca __builtin_alloca
     1014#else /* not GNU C.  */
     1015#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
     1016#include <alloca.h>
     1017#else /* not sparc */
     1018#if defined (MSDOS) && !defined (__TURBOC__)
     1019#include <malloc.h>
     1020#else /* not MSDOS, or __TURBOC__ */
     1021#if defined(_AIX)
     1022#include <malloc.h>
     1023 #pragma alloca
     1024#else /* not MSDOS, __TURBOC__, or _AIX */
     1025#ifdef __hpux
     1026#ifdef __cplusplus
     1027extern "C" {
     1028void *alloca (unsigned int);
     1029};
     1030#else /* not __cplusplus */
     1031void *alloca ();
     1032#endif /* not __cplusplus */
     1033#endif /* __hpux */
     1034#endif /* not _AIX */
     1035#endif /* not MSDOS, or __TURBOC__ */
     1036#endif /* not sparc.  */
     1037#endif /* not GNU C.  */
     1038#endif /* alloca not defined.  */
     1039
    10121040/* This is the parser code that is written into each bison parser
    10131041  when the %semantic_parser declaration is not specified in the grammar.
     
    10151043  used when %semantic_parser is specified.  */
    10161044
    1017 #ifndef YYSTACK_USE_ALLOCA
    1018 #ifdef alloca
    1019 #define YYSTACK_USE_ALLOCA
    1020 #else /* alloca not defined */
    1021 #ifdef __GNUC__
    1022 #define YYSTACK_USE_ALLOCA
    1023 #define alloca __builtin_alloca
    1024 #else /* not GNU C.  */
    1025 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
    1026 #define YYSTACK_USE_ALLOCA
    1027 #include <alloca.h>
    1028 #else /* not sparc */
    1029 /* We think this test detects Watcom and Microsoft C.  */
    1030 /* This used to test MSDOS, but that is a bad idea
    1031    since that symbol is in the user namespace.  */
    1032 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
    1033 #if 0 /* No need for malloc.h, which pollutes the namespace;
    1034          instead, just don't use alloca.  */
    1035 #include <malloc.h>
    1036 #endif
    1037 #else /* not MSDOS, or __TURBOC__ */
    1038 #if defined(_AIX)
    1039 /* I don't know what this was needed for, but it pollutes the namespace.
    1040    So I turned it off.   rms, 2 May 1997.  */
    1041 /* #include <malloc.h>  */
    1042  #pragma alloca
    1043 #define YYSTACK_USE_ALLOCA
    1044 #else /* not MSDOS, or __TURBOC__, or _AIX */
    1045 #if 0
    1046 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
    1047                  and on HPUX 10.  Eventually we can turn this on.  */
    1048 #define YYSTACK_USE_ALLOCA
    1049 #define alloca __builtin_alloca
    1050 #endif /* __hpux */
    1051 #endif
    1052 #endif /* not _AIX */
    1053 #endif /* not MSDOS, or __TURBOC__ */
    1054 #endif /* not sparc */
    1055 #endif /* not GNU C */
    1056 #endif /* alloca not defined */
    1057 #endif /* YYSTACK_USE_ALLOCA not defined */
    1058 
    1059 #ifdef YYSTACK_USE_ALLOCA
    1060 #define YYSTACK_ALLOC alloca
    1061 #else
    1062 #define YYSTACK_ALLOC malloc
    1063 #endif
    1064 
    10651045/* Note: there must be only one dollar sign in this file.
    10661046   It is replaced by the list of actions, each action
     
    10711051#define YYEMPTY         -2
    10721052#define YYEOF           0
    1073 #define YYACCEPT        goto yyacceptlab
    1074 #define YYABORT         goto yyabortlab
     1053#define YYACCEPT        return(0)
     1054#define YYABORT         return(1)
    10751055#define YYERROR         goto yyerrlab1
    10761056/* Like YYERROR except do call yyerror.
     
    11541134#endif
    11551135
    1156 
    1157 /* Define __yy_memcpy.  Note that the size argument
    1158    should be passed with type unsigned int, because that is what the non-GCC
    1159    definitions require.  With GCC, __builtin_memcpy takes an arg
    1160    of type size_t, but it can handle unsigned int.  */
     1136/* Prevent warning if -Wstrict-prototypes.  */
     1137#ifdef __GNUC__
     1138int yyparse (void);
     1139#endif
     1140
    11611141
    11621142#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
     
    11711151     char *to;
    11721152     char *from;
    1173      unsigned int count;
     1153     int count;
    11741154{
    11751155  register char *f = from;
     
    11861166   in available built-in functions on various systems.  */
    11871167static void
    1188 __yy_memcpy (char *to, char *from, unsigned int count)
    1189 {
     1168__yy_memcpy (char *to, char *from, int count)
     1169{
     1170  register char *f = from;
    11901171  register char *t = to;
    1191   register char *f = from;
    11921172  register int i = count;
    11931173
     
    12001180
    12011181
    1202 #line 217 "/emx/share/bison.simple"
     1182#line 196 "bison.simple"
    12031183
    12041184/* The user can define YYPARSE_PARAM as the name of an argument to be passed
     
    12211201#endif /* not YYPARSE_PARAM */
    12221202
    1223 /* Prevent warning if -Wstrict-prototypes.  */
    1224 #ifdef __GNUC__
    1225 #ifdef YYPARSE_PARAM
    1226 int yyparse (void *);
    1227 #else
    1228 int yyparse (void);
    1229 #endif
    1230 #endif
    1231 
    12321203int
    12331204yyparse(YYPARSE_PARAM_ARG)
     
    12581229
    12591230  int yystacksize = YYINITDEPTH;
    1260   int yyfree_stacks = 0;
    12611231
    12621232#ifdef YYPURE
     
    13431313        {
    13441314          yyerror("parser stack overflow");
    1345           if (yyfree_stacks)
    1346             {
    1347               free (yyss);
    1348               free (yyvs);
    1349 #ifdef YYLSP_NEEDED
    1350               free (yyls);
    1351 #endif
    1352             }
    13531315          return 2;
    13541316        }
     
    13561318      if (yystacksize > YYMAXDEPTH)
    13571319        yystacksize = YYMAXDEPTH;
    1358 #ifndef YYSTACK_USE_ALLOCA
    1359       yyfree_stacks = 1;
    1360 #endif
    1361       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
    1362       __yy_memcpy ((char *)yyss, (char *)yyss1,
    1363                    size * (unsigned int) sizeof (*yyssp));
    1364       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
    1365       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
    1366                    size * (unsigned int) sizeof (*yyvsp));
     1320      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
     1321      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
     1322      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
     1323      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
    13671324#ifdef YYLSP_NEEDED
    1368       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
    1369       __yy_memcpy ((char *)yyls, (char *)yyls1,
    1370                    size * (unsigned int) sizeof (*yylsp));
     1325      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
     1326      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
    13711327#endif
    13721328#endif /* no yyoverflow */
     
    15291485
    15301486case 1:
    1531 #line 310 "parser.y"
     1487#line 346 "parser.y"
    15321488{
    15331489                resource_t *rsc;
     
    15431499                else
    15441500                        yyvsp[0].res = rsc;
     1501                /* Find the tail again */
     1502                while(yyvsp[0].res && yyvsp[0].res->next)
     1503                        yyvsp[0].res = yyvsp[0].res->next;
     1504                /* Now add any fontdirecory */
     1505                rsc = build_fontdirs(yyvsp[0].res);
     1506                /* 'build_fontdir' returns a head and $1 is a tail */
     1507                if(yyvsp[0].res)
     1508                {
     1509                        yyvsp[0].res->next = rsc;
     1510                        if(rsc)
     1511                                rsc->prev = yyvsp[0].res;
     1512                }
     1513                else
     1514                        yyvsp[0].res = rsc;
    15451515                /* Final statement before were done */
    15461516                resource_top = get_resource_head(yyvsp[0].res);
     
    15481518    break;}
    15491519case 2:
    1550 #line 330 "parser.y"
    1551 { yyval.res = NULL; want_rscname = 1; ;
     1520#line 380 "parser.y"
     1521{ yyval.res = NULL; want_id = 1; ;
    15521522    break;}
    15531523case 3:
    1554 #line 331 "parser.y"
     1524#line 381 "parser.y"
    15551525{
    15561526                if(yyvsp[0].res)
     
    15661536                                yyvsp[-1].res->next = head;
    15671537                        yyval.res = tail;
     1538                        /* Check for duplicate identifiers */
     1539                        while(yyvsp[-1].res && head)
     1540                        {
     1541                                resource_t *rsc = yyvsp[-1].res;
     1542                                while(rsc)
     1543                                {
     1544                                        if(rsc->type == head->type
     1545                                        && rsc->lan->id == head->lan->id
     1546                                        && rsc->lan->sub == head->lan->sub
     1547                                        && !compare_name_id(rsc->name, head->name))
     1548                                        {
     1549                                                yyerror("Duplicate resource name '%s'", get_nameid_str(rsc->name));
     1550                                        }
     1551                                        rsc = rsc->prev;
     1552                                }
     1553                                head = head->next;
     1554                        }
    15681555                }
    15691556                else if(yyvsp[-1].res)
     
    15761563                else
    15771564                        yyval.res = NULL;
    1578                 want_rscname = 1;
     1565
     1566                if(!dont_want_id)       /* See comments in language parsing below */
     1567                        want_id = 1;
     1568                dont_want_id = 0;
    15791569                ;
    15801570    break;}
    15811571case 4:
    1582 #line 356 "parser.y"
    1583 { yyval.res = yyvsp[-1].res; want_rscname = 1; ;
     1572#line 426 "parser.y"
     1573{ yyval.res = yyvsp[-1].res; want_id = 1; ;
    15841574    break;}
    15851575case 5:
    1586 #line 357 "parser.y"
    1587 { yyval.res = yyvsp[-1].res; want_rscname = 1; ;
     1576#line 431 "parser.y"
     1577{ strip_til_semicolon(); ;
    15881578    break;}
    15891579case 6:
    1590 #line 362 "parser.y"
    1591 { pop_start(); push_if(yyvsp[-1].iptr ? *(yyvsp[-1].iptr) : 0, 0, 0); if(yyvsp[-1].iptr) free(yyvsp[-1].iptr);;
     1580#line 432 "parser.y"
     1581{ strip_til_semicolon(); ;
    15921582    break;}
    15931583case 7:
    1594 #line 363 "parser.y"
    1595 { pop_start(); push_if(pp_lookup(yyvsp[-1].str->str.cstr) != NULL, 0, 0); ;
     1584#line 433 "parser.y"
     1585{ strip_til_semicolon(); ;
    15961586    break;}
    15971587case 8:
    1598 #line 364 "parser.y"
    1599 { pop_start(); push_if(pp_lookup(yyvsp[-1].str->str.cstr) == NULL, 0, 0); ;
     1588#line 434 "parser.y"
     1589{ strip_til_semicolon(); ;
    16001590    break;}
    16011591case 9:
    1602 #line 365 "parser.y"
    1603 { pop_start(); push_if(yyvsp[-1].iptr ? *(yyvsp[-1].iptr) : 0, pop_if(), 0); if(yyvsp[-1].iptr) free(yyvsp[-1].iptr); ;
     1592#line 435 "parser.y"
     1593{ strip_til_semicolon(); ;
    16041594    break;}
    16051595case 10:
    1606 #line 366 "parser.y"
    1607 { pop_start(); push_if(1, pop_if(), 0); ;
     1596#line 436 "parser.y"
     1597{ strip_til_semicolon(); ;
    16081598    break;}
    16091599case 11:
    1610 #line 367 "parser.y"
    1611 { pop_if(); ;
     1600#line 437 "parser.y"
     1601{ internal_error(__FILE__, __LINE__, "Don't yet know how to strip inline functions\n"); ;
    16121602    break;}
    16131603case 12:
    1614 #line 370 "parser.y"
    1615 { yyval.iptr = yyvsp[0].iptr; ;
    1616     break;}
    1617 case 13:
    1618 #line 371 "parser.y"
    1619 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr || *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
     1604#line 441 "parser.y"
     1605{ strip_til_semicolon(); ;
    16201606    break;}
    16211607case 14:
    1622 #line 372 "parser.y"
    1623 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr && *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1624     break;}
    1625 case 15:
    1626 #line 373 "parser.y"
    1627 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr  + *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1628     break;}
    1629 case 16:
    1630 #line 374 "parser.y"
    1631 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr  - *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1632     break;}
    1633 case 17:
    1634 #line 375 "parser.y"
    1635 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr  ^ *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1636     break;}
    1637 case 18:
    1638 #line 376 "parser.y"
    1639 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr == *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1640     break;}
    1641 case 19:
    1642 #line 377 "parser.y"
    1643 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr != *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1644     break;}
    1645 case 20:
    1646 #line 378 "parser.y"
    1647 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr  < *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1648     break;}
    1649 case 21:
    1650 #line 379 "parser.y"
    1651 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr  > *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1652     break;}
    1653 case 22:
    1654 #line 380 "parser.y"
    1655 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr <= *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1656     break;}
    1657 case 23:
    1658 #line 381 "parser.y"
    1659 { yyval.iptr = new_int(yyvsp[-2].iptr && yyvsp[0].iptr ? (*yyvsp[-2].iptr >= *yyvsp[0].iptr) : 0); if(yyvsp[-2].iptr) free(yyvsp[-2].iptr); if(yyvsp[0].iptr) free(yyvsp[0].iptr); ;
    1660     break;}
    1661 case 24:
    1662 #line 382 "parser.y"
    1663 { yyval.iptr = yyvsp[0].iptr; if(yyvsp[0].iptr) *yyvsp[0].iptr = ~(*yyvsp[0].iptr); ;
    1664     break;}
    1665 case 25:
    1666 #line 383 "parser.y"
    1667 { yyval.iptr = yyvsp[0].iptr; ;
    1668     break;}
    1669 case 26:
    1670 #line 384 "parser.y"
    1671 { yyval.iptr = yyvsp[0].iptr; if(yyvsp[0].iptr) *yyvsp[0].iptr = -(*yyvsp[0].iptr); ;
    1672     break;}
    1673 case 27:
    1674 #line 385 "parser.y"
    1675 { yyval.iptr = yyvsp[0].iptr; if(yyvsp[0].iptr) *yyvsp[0].iptr = !(*yyvsp[0].iptr); ;
    1676     break;}
    1677 case 28:
    1678 #line 386 "parser.y"
    1679 { yyval.iptr = yyvsp[-1].iptr; ;
    1680     break;}
    1681 case 29:
    1682 #line 390 "parser.y"
    1683 { yyval.iptr = new_int(yyvsp[0].num); ;
    1684     break;}
    1685 case 30:
    1686 #line 391 "parser.y"
    1687 { yyval.iptr = NULL; ;
    1688     break;}
    1689 case 31:
    1690 #line 392 "parser.y"
    1691 { yyval.iptr = new_int(pp_lookup(yyvsp[0].str->str.cstr) != NULL); ;
    1692     break;}
    1693 case 32:
    1694 #line 393 "parser.y"
    1695 { yyval.iptr = new_int(pp_lookup(yyvsp[-1].str->str.cstr) != NULL); ;
    1696     break;}
    1697 case 33:
    1698 #line 397 "parser.y"
    1699 { strip_til_semicolon(); ;
    1700     break;}
    1701 case 34:
    1702 #line 398 "parser.y"
    1703 { strip_extern(); ;
    1704     break;}
    1705 case 35:
    1706 #line 399 "parser.y"
    1707 { strip_til_semicolon(); ;
    1708     break;}
    1709 case 36:
    1710 #line 400 "parser.y"
    1711 { strip_til_parenthesis(); ;
    1712     break;}
    1713 case 37:
    1714 #line 401 "parser.y"
    1715 { strip_til_semicolon(); ;
    1716     break;}
    1717 case 38:
    1718 #line 406 "parser.y"
     1608#line 471 "parser.y"
    17191609{
    17201610                yyval.res = yyvsp[0].res;
    17211611                if(yyval.res)
    17221612                {
    1723                         yyval.res->name = yyvsp[-1].nid;
    1724                         if(yyvsp[-1].nid->type == name_ord)
    1725                         {
    1726                                 chat("Got %s (%d)",get_typename(yyvsp[0].res),yyvsp[-1].nid->name.i_name);
     1613                        if(yyvsp[-2].num > 65535 || yyvsp[-2].num < -32768)
     1614                                yyerror("Resource's ID out of range (%d)", yyvsp[-2].num);
     1615                        yyval.res->name = new_name_id();
     1616                        yyval.res->name->type = name_ord;
     1617                        yyval.res->name->name.i_name = yyvsp[-2].num;
     1618                        chat("Got %s (%d)", get_typename(yyvsp[0].res), yyval.res->name->name.i_name);
    17271619                        }
    1728                         else if(yyvsp[-1].nid->type == name_str)
    1729                         {
    1730                                 chat("Got %s (%s)",get_typename(yyvsp[0].res),yyvsp[-1].nid->name.s_name->str.cstr);
    1731                         }
    1732                 }
    1733                 ;
    1734     break;}
    1735 case 39:
    1736 #line 421 "parser.y"
     1620                        ;
     1621    break;}
     1622case 15:
     1623#line 483 "parser.y"
     1624{
     1625                yyval.res = yyvsp[0].res;
     1626                if(yyval.res)
     1627                {
     1628                        yyval.res->name = new_name_id();
     1629                        yyval.res->name->type = name_str;
     1630                        yyval.res->name->name.s_name = yyvsp[-2].str;
     1631                        chat("Got %s (%s)", get_typename(yyvsp[0].res), yyval.res->name->name.s_name->str.cstr);
     1632                }
     1633                ;
     1634    break;}
     1635case 16:
     1636#line 493 "parser.y"
     1637{ /* cjunk */ strip_til_parenthesis(); yyval.res = NULL; ;
     1638    break;}
     1639case 17:
     1640#line 514 "parser.y"
    17371641{
    17381642                /* Don't do anything, stringtables are converted to
     
    17441648                ;
    17451649    break;}
    1746 case 40:
    1747 #line 429 "parser.y"
    1748 {
     1650case 18:
     1651#line 522 "parser.y"
     1652{want_nl = 1; ;
     1653    break;}
     1654case 19:
     1655#line 522 "parser.y"
     1656{
     1657                /* We *NEED* the newline to delimit the expression.
     1658                 * Otherwise, we would not be able to set the next
     1659                 * want_id anymore because of the token-lookahead.
     1660                 *
     1661                 * However, we can test the lookahead-token for
     1662                 * being "non-expression" type, in which case we
     1663                 * continue. Fortunately, tNL is the only token that
     1664                 * will break expression parsing and is implicitely
     1665                 * void, so we just remove it. This scheme makes it
     1666                 * possible to do some (not all) fancy preprocessor
     1667                 * stuff.
     1668                 * BTW, we also need to make sure that the next
     1669                 * reduction of 'resources' above will *not* set
     1670                 * want_id because we already have a lookahead that
     1671                 * cannot be undone.
     1672                 */
     1673                if(yychar != YYEMPTY && yychar != tNL)
     1674                        dont_want_id = 1;
     1675
     1676                if(yychar == tNL)
     1677                        yychar = YYEMPTY;       /* Could use 'yyclearin', but we already need the*/
     1678                                                /* direct access to yychar in rule 'usrcvt' below. */
     1679                else if(yychar == tIDENT)
     1680                        yywarning("LANGUAGE statement not delimited with newline; next identifier might be wrong");
     1681
     1682                want_nl = 0;    /* We don't want it anymore if we didn't get it */
     1683
    17491684                if(!win32)
    17501685                        yywarning("LANGUAGE not supported in 16-bit mode");
    17511686                if(currentlanguage)
    17521687                        free(currentlanguage);
    1753                 currentlanguage = yyvsp[0].lan;
     1688                currentlanguage = new_language(yyvsp[-2].num, yyvsp[0].num);
    17541689                yyval.res = NULL;
    1755                 ;
    1756     break;}
    1757 case 41:
    1758 #line 442 "parser.y"
     1690                chat("Got LANGUAGE %d,%d (0x%04x)", yyvsp[-2].num, yyvsp[0].num, (yyvsp[0].num<<10) + yyvsp[-2].num);
     1691                ;
     1692    break;}
     1693case 20:
     1694#line 564 "parser.y"
     1695{ yychar = rsrcid_to_token(yychar); ;
     1696    break;}
     1697case 21:
     1698#line 570 "parser.y"
    17591699{
    17601700                if(yyvsp[0].num > 65535 || yyvsp[0].num < -32768)
     
    17631703                yyval.nid->type = name_ord;
    17641704                yyval.nid->name.i_name = yyvsp[0].num;
    1765                 want_rscname = 0;
    1766                 ;
    1767     break;}
    1768 case 42:
    1769 #line 450 "parser.y"
     1705                ;
     1706    break;}
     1707case 22:
     1708#line 577 "parser.y"
    17701709{
    17711710                yyval.nid = new_name_id();
    17721711                yyval.nid->type = name_str;
    17731712                yyval.nid->name.s_name = yyvsp[0].str;
    1774                 want_rscname = 0;
    1775                 ;
    1776     break;}
    1777 case 43:
    1778 #line 461 "parser.y"
     1713                ;
     1714    break;}
     1715case 23:
     1716#line 587 "parser.y"
    17791717{ yyval.nid = yyvsp[0].nid; ;
    17801718    break;}
    1781 case 44:
    1782 #line 462 "parser.y"
     1719case 24:
     1720#line 588 "parser.y"
    17831721{
    17841722                yyval.nid = new_name_id();
    17851723                yyval.nid->type = name_str;
    17861724                yyval.nid->name.s_name = yyvsp[0].str;
    1787                 want_rscname = 0;
    1788                 ;
    1789     break;}
    1790 case 45:
    1791 #line 472 "parser.y"
     1725                ;
     1726    break;}
     1727case 25:
     1728#line 597 "parser.y"
    17921729{ yyval.res = new_resource(res_acc, yyvsp[0].acc, yyvsp[0].acc->memopt, yyvsp[0].acc->lvc.language); ;
    17931730    break;}
    1794 case 46:
    1795 #line 473 "parser.y"
    1796 { yyval.res = new_resource(res_bmp, yyvsp[0].bmp, yyvsp[0].bmp->memopt, dup_language(currentlanguage)); ;
    1797     break;}
    1798 case 47:
    1799 #line 474 "parser.y"
     1731case 26:
     1732#line 598 "parser.y"
     1733{ yyval.res = new_resource(res_bmp, yyvsp[0].bmp, yyvsp[0].bmp->memopt, yyvsp[0].bmp->data->lvc.language); ;
     1734    break;}
     1735case 27:
     1736#line 599 "parser.y"
    18001737{
    18011738                resource_t *rsc;
    1802                 cursor_t *cur;
    1803                 yyval.res = rsc = new_resource(res_curg, yyvsp[0].curg, yyvsp[0].curg->memopt, dup_language(currentlanguage));
    1804                 for(cur = yyvsp[0].curg->cursorlist; cur; cur = cur->next)
    1805                 {
    1806                         rsc->prev = new_resource(res_cur, cur, yyvsp[0].curg->memopt, dup_language(currentlanguage));
    1807                         rsc->prev->next = rsc;
    1808                         rsc = rsc->prev;
    1809                         rsc->name = new_name_id();
    1810                         rsc->name->type = name_ord;
    1811                         rsc->name->name.i_name = cur->id;
    1812                 }
    1813                 ;
    1814     break;}
    1815 case 48:
    1816 #line 488 "parser.y"
     1739                if(yyvsp[0].ani->type == res_anicur)
     1740                {
     1741                        yyval.res = rsc = new_resource(res_anicur, yyvsp[0].ani->u.ani, yyvsp[0].ani->u.ani->memopt, yyvsp[0].ani->u.ani->data->lvc.language);
     1742                }
     1743                else if(yyvsp[0].ani->type == res_curg)
     1744                {
     1745                        cursor_t *cur;
     1746                        yyval.res = rsc = new_resource(res_curg, yyvsp[0].ani->u.curg, yyvsp[0].ani->u.curg->memopt, yyvsp[0].ani->u.curg->lvc.language);
     1747                        for(cur = yyvsp[0].ani->u.curg->cursorlist; cur; cur = cur->next)
     1748                        {
     1749                                rsc->prev = new_resource(res_cur, cur, yyvsp[0].ani->u.curg->memopt, yyvsp[0].ani->u.curg->lvc.language);
     1750                                rsc->prev->next = rsc;
     1751                                rsc = rsc->prev;
     1752                                rsc->name = new_name_id();
     1753                                rsc->name->type = name_ord;
     1754                                rsc->name->name.i_name = cur->id;
     1755                        }
     1756                }
     1757                else
     1758                        internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource", yyvsp[0].ani->type);
     1759                free(yyvsp[0].ani);
     1760                ;
     1761    break;}
     1762case 28:
     1763#line 623 "parser.y"
    18171764{ yyval.res = new_resource(res_dlg, yyvsp[0].dlg, yyvsp[0].dlg->memopt, yyvsp[0].dlg->lvc.language); ;
    18181765    break;}
    1819 case 49:
    1820 #line 489 "parser.y"
     1766case 29:
     1767#line 624 "parser.y"
    18211768{
    18221769                if(win32)
     
    18261773                ;
    18271774    break;}
    1828 case 50:
    1829 #line 495 "parser.y"
    1830 { yyval.res = new_resource(res_dlginit, yyvsp[0].dginit, yyvsp[0].dginit->memopt, yyvsp[0].dginit->lvc.language); ;
    1831     break;}
    1832 case 51:
    1833 #line 496 "parser.y"
    1834 { yyval.res = new_resource(res_fnt, yyvsp[0].fnt, yyvsp[0].fnt->memopt, dup_language(currentlanguage)); ;
    1835     break;}
    1836 case 52:
    1837 #line 497 "parser.y"
     1775case 30:
     1776#line 630 "parser.y"
     1777{ yyval.res = new_resource(res_dlginit, yyvsp[0].dginit, yyvsp[0].dginit->memopt, yyvsp[0].dginit->data->lvc.language); ;
     1778    break;}
     1779case 31:
     1780#line 631 "parser.y"
     1781{ yyval.res = new_resource(res_fnt, yyvsp[0].fnt, yyvsp[0].fnt->memopt, yyvsp[0].fnt->data->lvc.language); ;
     1782    break;}
     1783case 32:
     1784#line 632 "parser.y"
     1785{ yyval.res = new_resource(res_fntdir, yyvsp[0].fnd, yyvsp[0].fnd->memopt, yyvsp[0].fnd->data->lvc.language); ;
     1786    break;}
     1787case 33:
     1788#line 633 "parser.y"
    18381789{
    18391790                resource_t *rsc;
    1840                 icon_t *ico;
    1841                 yyval.res = rsc = new_resource(res_icog, yyvsp[0].icog, yyvsp[0].icog->memopt, dup_language(currentlanguage));
    1842                 for(ico = yyvsp[0].icog->iconlist; ico; ico = ico->next)
    1843                 {
    1844                         rsc->prev = new_resource(res_ico, ico, yyvsp[0].icog->memopt, dup_language(currentlanguage));
    1845                         rsc->prev->next = rsc;
    1846                         rsc = rsc->prev;
    1847                         rsc->name = new_name_id();
    1848                         rsc->name->type = name_ord;
    1849                         rsc->name->name.i_name = ico->id;
    1850                 }
    1851                 ;
    1852     break;}
    1853 case 53:
    1854 #line 511 "parser.y"
     1791                if(yyvsp[0].ani->type == res_aniico)
     1792                {
     1793                        yyval.res = rsc = new_resource(res_aniico, yyvsp[0].ani->u.ani, yyvsp[0].ani->u.ani->memopt, yyvsp[0].ani->u.ani->data->lvc.language);
     1794                }
     1795                else if(yyvsp[0].ani->type == res_icog)
     1796                {
     1797                        icon_t *ico;
     1798                        yyval.res = rsc = new_resource(res_icog, yyvsp[0].ani->u.icog, yyvsp[0].ani->u.icog->memopt, yyvsp[0].ani->u.icog->lvc.language);
     1799                        for(ico = yyvsp[0].ani->u.icog->iconlist; ico; ico = ico->next)
     1800                        {
     1801                                rsc->prev = new_resource(res_ico, ico, yyvsp[0].ani->u.icog->memopt, yyvsp[0].ani->u.icog->lvc.language);
     1802                                rsc->prev->next = rsc;
     1803                                rsc = rsc->prev;
     1804                                rsc->name = new_name_id();
     1805                                rsc->name->type = name_ord;
     1806                                rsc->name->name.i_name = ico->id;
     1807                        }
     1808                }
     1809                else
     1810                        internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource", yyvsp[0].ani->type);
     1811                free(yyvsp[0].ani);
     1812                ;
     1813    break;}
     1814case 34:
     1815#line 657 "parser.y"
    18551816{ yyval.res = new_resource(res_men, yyvsp[0].men, yyvsp[0].men->memopt, yyvsp[0].men->lvc.language); ;
    18561817    break;}
    1857 case 54:
    1858 #line 512 "parser.y"
     1818case 35:
     1819#line 658 "parser.y"
    18591820{
    18601821                if(win32)
     
    18641825                ;
    18651826    break;}
    1866 case 55:
    1867 #line 518 "parser.y"
     1827case 36:
     1828#line 664 "parser.y"
    18681829{ yyval.res = new_resource(res_msg, yyvsp[0].msg, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, dup_language(currentlanguage)); ;
    18691830    break;}
    1870 case 56:
    1871 #line 519 "parser.y"
    1872 { yyval.res = new_resource(res_rdt, yyvsp[0].rdt, yyvsp[0].rdt->memopt, yyvsp[0].rdt->lvc.language); ;
    1873     break;}
    1874 case 57:
    1875 #line 520 "parser.y"
     1831case 37:
     1832#line 665 "parser.y"
     1833{ yyval.res = new_resource(res_rdt, yyvsp[0].rdt, yyvsp[0].rdt->memopt, yyvsp[0].rdt->data->lvc.language); ;
     1834    break;}
     1835case 38:
     1836#line 666 "parser.y"
    18761837{ yyval.res = new_resource(res_toolbar, yyvsp[0].tlbar, yyvsp[0].tlbar->memopt, yyvsp[0].tlbar->lvc.language); ;
    18771838    break;}
    1878 case 58:
    1879 #line 521 "parser.y"
    1880 { yyval.res = new_resource(res_usr, yyvsp[0].usr, yyvsp[0].usr->memopt, dup_language(currentlanguage)); ;
    1881     break;}
    1882 case 59:
    1883 #line 522 "parser.y"
    1884 { yyval.res = new_resource(res_ver, yyvsp[0].veri, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, dup_language(currentlanguage)); ;
    1885     break;}
    1886 case 60:
    1887 #line 526 "parser.y"
    1888 { yyval.bmp = new_bitmap(load_file(yyvsp[0].str), yyvsp[-1].iptr); ;
    1889     break;}
    1890 case 61:
    1891 #line 527 "parser.y"
     1839case 39:
     1840#line 667 "parser.y"
     1841{ yyval.res = new_resource(res_usr, yyvsp[0].usr, yyvsp[0].usr->memopt, yyvsp[0].usr->data->lvc.language); ;
     1842    break;}
     1843case 40:
     1844#line 668 "parser.y"
     1845{ yyval.res = new_resource(res_ver, yyvsp[0].veri, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, yyvsp[0].veri->lvc.language); ;
     1846    break;}
     1847case 41:
     1848#line 672 "parser.y"
     1849{ yyval.str = make_filename(yyvsp[0].str); ;
     1850    break;}
     1851case 42:
     1852#line 673 "parser.y"
     1853{ yyval.str = make_filename(yyvsp[0].str); ;
     1854    break;}
     1855case 43:
     1856#line 674 "parser.y"
     1857{ yyval.str = make_filename(yyvsp[0].str); ;
     1858    break;}
     1859case 44:
     1860#line 678 "parser.y"
    18921861{ yyval.bmp = new_bitmap(yyvsp[0].raw, yyvsp[-1].iptr); ;
    18931862    break;}
    1894 case 62:
    1895 #line 531 "parser.y"
    1896 { yyval.curg = new_cursor_group(load_file(yyvsp[0].str), yyvsp[-1].iptr); ;
    1897     break;}
    1898 case 63:
    1899 #line 532 "parser.y"
    1900 { yyval.curg = new_cursor_group(yyvsp[0].raw, yyvsp[-1].iptr); ;
    1901     break;}
    1902 case 64:
    1903 #line 537 "parser.y"
    1904 { yyval.fnt = new_font(load_file(yyvsp[0].str), yyvsp[-1].iptr); ;
    1905     break;}
    1906 case 65:
    1907 #line 541 "parser.y"
    1908 { yyval.icog = new_icon_group(load_file(yyvsp[0].str), yyvsp[-1].iptr); ;
    1909     break;}
    1910 case 66:
    1911 #line 542 "parser.y"
    1912 { yyval.icog = new_icon_group(yyvsp[0].raw, yyvsp[-1].iptr); ;
    1913     break;}
    1914 case 67:
    1915 #line 550 "parser.y"
     1863case 45:
     1864#line 682 "parser.y"
     1865{
     1866                yyval.ani = new_ani_any();
     1867                if(yyvsp[0].raw->size > 4 && !memcmp(yyvsp[0].raw->data, riff, sizeof(riff)))
     1868                {
     1869                        yyval.ani->type = res_anicur;
     1870                        yyval.ani->u.ani = new_ani_curico(res_anicur, yyvsp[0].raw, yyvsp[-1].iptr);
     1871                }
     1872                else
     1873                {
     1874                        yyval.ani->type = res_curg;
     1875                        yyval.ani->u.curg = new_cursor_group(yyvsp[0].raw, yyvsp[-1].iptr);
     1876                }
     1877        ;
     1878    break;}
     1879case 46:
     1880#line 698 "parser.y"
     1881{
     1882                yyval.ani = new_ani_any();
     1883                if(yyvsp[0].raw->size > 4 && !memcmp(yyvsp[0].raw->data, riff, sizeof(riff)))
     1884                {
     1885                        yyval.ani->type = res_aniico;
     1886                        yyval.ani->u.ani = new_ani_curico(res_aniico, yyvsp[0].raw, yyvsp[-1].iptr);
     1887                }
     1888                else
     1889                {
     1890                        yyval.ani->type = res_icog;
     1891                        yyval.ani->u.icog = new_icon_group(yyvsp[0].raw, yyvsp[-1].iptr);
     1892                }
     1893        ;
     1894    break;}
     1895case 47:
     1896#line 720 "parser.y"
     1897{ yyval.fnt = new_font(yyvsp[0].raw, yyvsp[-1].iptr); ;
     1898    break;}
     1899case 48:
     1900#line 730 "parser.y"
     1901{ yyval.fnd = new_fontdir(yyvsp[0].raw, yyvsp[-1].iptr); ;
     1902    break;}
     1903case 49:
     1904#line 738 "parser.y"
    19161905{
    19171906                if(!win32)
    19181907                        yywarning("MESSAGETABLE not supported in 16-bit mode");
    1919                 yyval.msg = new_messagetable(load_file(yyvsp[0].str));
    1920                 ;
    1921     break;}
    1922 case 68:
    1923 #line 558 "parser.y"
    1924 {
    1925                 yyval.rdt = new_rcdata(yyvsp[0].raw, yyvsp[-2].iptr);
    1926                 if(yyvsp[-1].lvc)
    1927                 {
    1928                         yyval.rdt->lvc = *(yyvsp[-1].lvc);
    1929                         free(yyvsp[-1].lvc);
    1930                 }
    1931                 if(!yyval.rdt->lvc.language)
    1932                         yyval.rdt->lvc.language = dup_language(currentlanguage);
    1933                 ;
    1934     break;}
    1935 case 69:
    1936 #line 571 "parser.y"
    1937 {
    1938                 yyval.dginit = new_dlginit(yyvsp[0].raw, yyvsp[-2].iptr);
    1939                 if(yyvsp[-1].lvc)
    1940                 {
    1941                         yyval.dginit->lvc = *(yyvsp[-1].lvc);
    1942                         free(yyvsp[-1].lvc);
    1943                 }
    1944                 if(!yyval.dginit->lvc.language)
    1945                         yyval.dginit->lvc.language = dup_language(currentlanguage);
    1946                 ;
    1947     break;}
    1948 case 70:
    1949 #line 584 "parser.y"
    1950 { yyval.usr = new_user(yyvsp[-2].nid, load_file(yyvsp[0].str), yyvsp[-1].iptr); ;
    1951     break;}
    1952 case 71:
    1953 #line 585 "parser.y"
    1954 { yyval.usr = new_user(yyvsp[-2].nid, yyvsp[0].raw, yyvsp[-1].iptr); ;
    1955     break;}
    1956 case 72:
    1957 #line 604 "parser.y"
     1908                yyval.msg = new_messagetable(yyvsp[0].raw, yyvsp[-1].iptr);
     1909                ;
     1910    break;}
     1911case 50:
     1912#line 746 "parser.y"
     1913{ yyval.rdt = new_rcdata(yyvsp[0].raw, yyvsp[-1].iptr); ;
     1914    break;}
     1915case 51:
     1916#line 750 "parser.y"
     1917{ yyval.dginit = new_dlginit(yyvsp[0].raw, yyvsp[-1].iptr); ;
     1918    break;}
     1919case 52:
     1920#line 754 "parser.y"
     1921{
     1922                #ifdef WORDS_BIGENDIAN
     1923                        if(pedantic && byteorder != WRC_BO_LITTLE)
     1924                #else
     1925                        if(pedantic && byteorder == WRC_BO_BIG)
     1926                #endif
     1927                                yywarning("Byteordering is not little-endian and type cannot be interpreted");
     1928                        yyval.usr = new_user(yyvsp[-2].nid, yyvsp[0].raw, yyvsp[-1].iptr);
     1929                ;
     1930    break;}
     1931case 53:
     1932#line 765 "parser.y"
    19581933{
    19591934                yyval.nid = new_name_id();
    19601935                yyval.nid->type = name_ord;
    19611936                yyval.nid->name.i_name = yyvsp[0].num;
    1962                 set_yywf();
    1963                 ;
    1964     break;}
    1965 case 73:
    1966 #line 616 "parser.y"
     1937                ;
     1938    break;}
     1939case 54:
     1940#line 770 "parser.y"
    19671941{
    19681942                yyval.nid = new_name_id();
    19691943                yyval.nid->type = name_str;
    19701944                yyval.nid->name.s_name = yyvsp[0].str;
    1971                 set_yywf();
    1972                 ;
    1973     break;}
    1974 case 74:
    1975 #line 626 "parser.y"
     1945                ;
     1946    break;}
     1947case 55:
     1948#line 779 "parser.y"
    19761949{
    19771950                yyval.acc = new_accelerator();
     
    19971970                ;
    19981971    break;}
    1999 case 75:
    2000 #line 650 "parser.y"
     1972case 56:
     1973#line 803 "parser.y"
    20011974{ yyval.event=NULL; ;
    20021975    break;}
    2003 case 76:
    2004 #line 651 "parser.y"
     1976case 57:
     1977#line 804 "parser.y"
    20051978{ yyval.event=add_string_event(yyvsp[-3].str, yyvsp[-1].num, yyvsp[0].num, yyvsp[-4].event); ;
    20061979    break;}
    2007 case 77:
    2008 #line 652 "parser.y"
     1980case 58:
     1981#line 805 "parser.y"
    20091982{ yyval.event=add_event(yyvsp[-3].num, yyvsp[-1].num, yyvsp[0].num, yyvsp[-4].event); ;
    20101983    break;}
    2011 case 78:
    2012 #line 655 "parser.y"
    2013 { yyval.num=0; ;
    2014     break;}
    2015 case 79:
    2016 #line 656 "parser.y"
    2017 { yyval.num=yyvsp[-2].num | WRC_AF_NOINVERT; ;
    2018     break;}
    2019 case 80:
    2020 #line 657 "parser.y"
    2021 { yyval.num=yyvsp[-2].num | WRC_AF_SHIFT; ;
    2022     break;}
    2023 case 81:
    2024 #line 658 "parser.y"
    2025 { yyval.num=yyvsp[-2].num | WRC_AF_CONTROL; ;
    2026     break;}
    2027 case 82:
    2028 #line 659 "parser.y"
    2029 { yyval.num=yyvsp[-2].num | WRC_AF_ALT; ;
    2030     break;}
    2031 case 83:
    2032 #line 660 "parser.y"
    2033 { yyval.num=yyvsp[-2].num | WRC_AF_ASCII; ;
    2034     break;}
    2035 case 84:
    2036 #line 661 "parser.y"
    2037 { yyval.num=yyvsp[-2].num | WRC_AF_VIRTKEY; ;
    2038     break;}
    2039 case 85:
    2040 #line 667 "parser.y"
     1984case 59:
     1985#line 814 "parser.y"
     1986{ yyval.num = 0; ;
     1987    break;}
     1988case 60:
     1989#line 815 "parser.y"
     1990{ yyval.num = yyvsp[0].num; ;
     1991    break;}
     1992case 61:
     1993#line 818 "parser.y"
     1994{ yyval.num = yyvsp[0].num; ;
     1995    break;}
     1996case 62:
     1997#line 819 "parser.y"
     1998{ yyval.num = yyvsp[-2].num | yyvsp[0].num; ;
     1999    break;}
     2000case 63:
     2001#line 822 "parser.y"
     2002{ yyval.num = WRC_AF_NOINVERT; ;
     2003    break;}
     2004case 64:
     2005#line 823 "parser.y"
     2006{ yyval.num = WRC_AF_SHIFT; ;
     2007    break;}
     2008case 65:
     2009#line 824 "parser.y"
     2010{ yyval.num = WRC_AF_CONTROL; ;
     2011    break;}
     2012case 66:
     2013#line 825 "parser.y"
     2014{ yyval.num = WRC_AF_ALT; ;
     2015    break;}
     2016case 67:
     2017#line 826 "parser.y"
     2018{ yyval.num = WRC_AF_ASCII; ;
     2019    break;}
     2020case 68:
     2021#line 827 "parser.y"
     2022{ yyval.num = WRC_AF_VIRTKEY; ;
     2023    break;}
     2024case 69:
     2025#line 833 "parser.y"
    20412026{
    20422027                if(yyvsp[-11].iptr)
     
    20662051                yyval.dlg->style->and_mask = 0;
    20672052
    2068                 indialog = FALSE;
    20692053                if(!yyval.dlg->lvc.language)
    20702054                        yyval.dlg->lvc.language = dup_language(currentlanguage);
    20712055                ;
    20722056    break;}
     2057case 70:
     2058#line 866 "parser.y"
     2059{ yyval.dlg=new_dialog(); ;
     2060    break;}
     2061case 71:
     2062#line 867 "parser.y"
     2063{ yyval.dlg=dialog_style(yyvsp[0].style,yyvsp[-2].dlg); ;
     2064    break;}
     2065case 72:
     2066#line 868 "parser.y"
     2067{ yyval.dlg=dialog_exstyle(yyvsp[0].style,yyvsp[-2].dlg); ;
     2068    break;}
     2069case 73:
     2070#line 869 "parser.y"
     2071{ yyval.dlg=dialog_caption(yyvsp[0].str,yyvsp[-2].dlg); ;
     2072    break;}
     2073case 74:
     2074#line 870 "parser.y"
     2075{ yyval.dlg=dialog_font(yyvsp[0].fntid,yyvsp[-1].dlg); ;
     2076    break;}
     2077case 75:
     2078#line 871 "parser.y"
     2079{ yyval.dlg=dialog_class(yyvsp[0].nid,yyvsp[-2].dlg); ;
     2080    break;}
     2081case 76:
     2082#line 872 "parser.y"
     2083{ yyval.dlg=dialog_class(yyvsp[0].nid,yyvsp[-2].dlg); ;
     2084    break;}
     2085case 77:
     2086#line 873 "parser.y"
     2087{ yyval.dlg=dialog_menu(yyvsp[0].nid,yyvsp[-2].dlg); ;
     2088    break;}
     2089case 78:
     2090#line 874 "parser.y"
     2091{ yyval.dlg=dialog_language(yyvsp[0].lan,yyvsp[-1].dlg); ;
     2092    break;}
     2093case 79:
     2094#line 875 "parser.y"
     2095{ yyval.dlg=dialog_characteristics(yyvsp[0].chars,yyvsp[-1].dlg); ;
     2096    break;}
     2097case 80:
     2098#line 876 "parser.y"
     2099{ yyval.dlg=dialog_version(yyvsp[0].ver,yyvsp[-1].dlg); ;
     2100    break;}
     2101case 81:
     2102#line 879 "parser.y"
     2103{ yyval.ctl = NULL; ;
     2104    break;}
     2105case 82:
     2106#line 880 "parser.y"
     2107{ yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2108    break;}
     2109case 83:
     2110#line 881 "parser.y"
     2111{ yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2112    break;}
     2113case 84:
     2114#line 882 "parser.y"
     2115{ yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2116    break;}
     2117case 85:
     2118#line 883 "parser.y"
     2119{ yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2120    break;}
    20732121case 86:
    2074 #line 701 "parser.y"
    2075 { yyval.dlg=new_dialog(); ;
     2122#line 884 "parser.y"
     2123{ yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    20762124    break;}
    20772125case 87:
    2078 #line 702 "parser.y"
    2079 { yyval.dlg=dialog_style(yyvsp[0].style,yyvsp[-2].dlg); ;
     2126#line 885 "parser.y"
     2127{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    20802128    break;}
    20812129case 88:
    2082 #line 703 "parser.y"
    2083 { yyval.dlg=dialog_exstyle(yyvsp[0].style,yyvsp[-2].dlg); ;
     2130#line 886 "parser.y"
     2131{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    20842132    break;}
    20852133case 89:
    2086 #line 704 "parser.y"
    2087 { yyval.dlg=dialog_caption(yyvsp[0].str,yyvsp[-2].dlg); ;
     2134#line 887 "parser.y"
     2135{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;
    20882136    break;}
    20892137case 90:
    2090 #line 705 "parser.y"
    2091 { yyval.dlg=dialog_font(yyvsp[0].fntid,yyvsp[-1].dlg); ;
     2138#line 888 "parser.y"
     2139{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    20922140    break;}
    20932141case 91:
    2094 #line 706 "parser.y"
    2095 { yyval.dlg=dialog_class(yyvsp[0].nid,yyvsp[-2].dlg); ;
     2142#line 890 "parser.y"
     2143{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    20962144    break;}
    20972145case 92:
    2098 #line 707 "parser.y"
    2099 { yyval.dlg=dialog_menu(yyvsp[0].nid,yyvsp[-2].dlg); ;
     2146#line 891 "parser.y"
     2147{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21002148    break;}
    21012149case 93:
    2102 #line 708 "parser.y"
    2103 { yyval.dlg=dialog_language(yyvsp[0].lan,yyvsp[-1].dlg); ;
     2150#line 892 "parser.y"
     2151{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21042152    break;}
    21052153case 94:
    2106 #line 709 "parser.y"
    2107 { yyval.dlg=dialog_characteristics(yyvsp[0].chars,yyvsp[-1].dlg); ;
     2154#line 893 "parser.y"
     2155{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21082156    break;}
    21092157case 95:
    2110 #line 710 "parser.y"
    2111 { yyval.dlg=dialog_version(yyvsp[0].ver,yyvsp[-1].dlg); ;
     2158#line 894 "parser.y"
     2159{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21122160    break;}
    21132161case 96:
    2114 #line 713 "parser.y"
    2115 { yyval.ctl = NULL; ;
     2162#line 895 "parser.y"
     2163{ yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21162164    break;}
    21172165case 97:
    2118 #line 714 "parser.y"
    2119 { yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2166#line 896 "parser.y"
     2167{ yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21202168    break;}
    21212169case 98:
    2122 #line 715 "parser.y"
    2123 { yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2170#line 897 "parser.y"
     2171{ yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    21242172    break;}
    21252173case 99:
    2126 #line 716 "parser.y"
    2127 { yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2128     break;}
    2129 case 100:
    2130 #line 717 "parser.y"
    2131 { yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2132     break;}
    2133 case 101:
    2134 #line 718 "parser.y"
    2135 { yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2136     break;}
    2137 case 102:
    2138 #line 719 "parser.y"
    2139 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2140     break;}
    2141 case 103:
    2142 #line 720 "parser.y"
    2143 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2144     break;}
    2145 case 104:
    2146 #line 721 "parser.y"
    2147 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;
    2148     break;}
    2149 case 105:
    2150 #line 722 "parser.y"
    2151 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2152     break;}
    2153 case 106:
    2154 #line 724 "parser.y"
    2155 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2156     break;}
    2157 case 107:
    2158 #line 725 "parser.y"
    2159 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2160     break;}
    2161 case 108:
    2162 #line 726 "parser.y"
    2163 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2164     break;}
    2165 case 109:
    2166 #line 727 "parser.y"
    2167 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2168     break;}
    2169 case 110:
    2170 #line 728 "parser.y"
    2171 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2172     break;}
    2173 case 111:
    2174 #line 729 "parser.y"
    2175 { yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2176     break;}
    2177 case 112:
    2178 #line 730 "parser.y"
    2179 { yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2180     break;}
    2181 case 113:
    2182 #line 731 "parser.y"
    2183 { yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2184     break;}
    2185 case 114:
    2186 #line 733 "parser.y"
     2174#line 899 "parser.y"
    21872175{
    21882176                yyvsp[0].ctl->title = yyvsp[-7].nid;
     
    21932181                ;
    21942182    break;}
    2195 case 115:
    2196 #line 743 "parser.y"
     2183case 100:
     2184#line 909 "parser.y"
    21972185{
    21982186                yyval.ctl=new_control();
     
    22122200                ;
    22132201    break;}
    2214 case 116:
    2215 #line 762 "parser.y"
     2202case 101:
     2203#line 928 "parser.y"
    22162204{
    22172205                yyval.ctl = new_control();
     
    22282216                ;
    22292217    break;}
    2230 case 117:
    2231 #line 778 "parser.y"
     2218case 102:
     2219#line 944 "parser.y"
    22322220{ yyval.ctl = new_control(); ;
    22332221    break;}
    2234 case 118:
    2235 #line 780 "parser.y"
     2222case 103:
     2223#line 946 "parser.y"
    22362224{
    22372225                yyval.ctl = new_control();
     
    22402228                ;
    22412229    break;}
    2242 case 119:
    2243 #line 785 "parser.y"
     2230case 104:
     2231#line 951 "parser.y"
    22442232{
    22452233                yyval.ctl = new_control();
     
    22502238                ;
    22512239    break;}
    2252 case 120:
    2253 #line 792 "parser.y"
     2240case 105:
     2241#line 958 "parser.y"
    22542242{
    22552243                yyval.ctl = new_control();
     
    22622250                ;
    22632251    break;}
    2264 case 121:
    2265 #line 803 "parser.y"
     2252case 106:
     2253#line 969 "parser.y"
    22662254{
    22672255                yyval.ctl=new_control();
     
    22792267                ;
    22802268    break;}
    2281 case 122:
    2282 #line 817 "parser.y"
     2269case 107:
     2270#line 983 "parser.y"
    22832271{
    22842272                yyval.ctl=new_control();
     
    22942282                ;
    22952283    break;}
    2296 case 123:
    2297 #line 832 "parser.y"
     2284case 108:
     2285#line 998 "parser.y"
    22982286{ yyval.fntid = new_font_id(yyvsp[-2].num, yyvsp[0].str, 0, 0); ;
    22992287    break;}
    2300 case 124:
    2301 #line 837 "parser.y"
     2288case 109:
     2289#line 1003 "parser.y"
    23022290{ yyval.style = NULL; ;
    23032291    break;}
    2304 case 125:
    2305 #line 838 "parser.y"
     2292case 110:
     2293#line 1004 "parser.y"
    23062294{ yyval.style = yyvsp[0].style; ;
    23072295    break;}
    2308 case 126:
    2309 #line 842 "parser.y"
     2296case 111:
     2297#line 1008 "parser.y"
    23102298{ yyval.styles = NULL; ;
    23112299    break;}
    2312 case 127:
    2313 #line 843 "parser.y"
     2300case 112:
     2301#line 1009 "parser.y"
    23142302{ yyval.styles = new_style_pair(yyvsp[0].style, 0); ;
    23152303    break;}
    2316 case 128:
    2317 #line 844 "parser.y"
     2304case 113:
     2305#line 1010 "parser.y"
    23182306{ yyval.styles = new_style_pair(yyvsp[-2].style, yyvsp[0].style); ;
    23192307    break;}
    2320 case 129:
    2321 #line 848 "parser.y"
     2308case 114:
     2309#line 1014 "parser.y"
    23222310{ yyval.style = new_style(yyvsp[-2].style->or_mask | yyvsp[0].style->or_mask, yyvsp[-2].style->and_mask | yyvsp[0].style->and_mask); free(yyvsp[-2].style); free(yyvsp[0].style);;
    23232311    break;}
    2324 case 130:
    2325 #line 849 "parser.y"
     2312case 115:
     2313#line 1015 "parser.y"
    23262314{ yyval.style = yyvsp[-1].style; ;
    23272315    break;}
    2328 case 131:
    2329 #line 850 "parser.y"
     2316case 116:
     2317#line 1016 "parser.y"
    23302318{ yyval.style = new_style(yyvsp[0].num, 0); ;
    23312319    break;}
    2332 case 132:
    2333 #line 851 "parser.y"
     2320case 117:
     2321#line 1017 "parser.y"
    23342322{ yyval.style = new_style(0, yyvsp[0].num); ;
    23352323    break;}
    2336 case 133:
    2337 #line 855 "parser.y"
     2324case 118:
     2325#line 1021 "parser.y"
    23382326{
    23392327                yyval.nid = new_name_id();
     
    23422330                ;
    23432331    break;}
    2344 case 134:
    2345 #line 860 "parser.y"
     2332case 119:
     2333#line 1026 "parser.y"
    23462334{
    23472335                yyval.nid = new_name_id();
     
    23502338                ;
    23512339    break;}
    2352 case 135:
    2353 #line 869 "parser.y"
     2340case 120:
     2341#line 1035 "parser.y"
    23542342{
    23552343                if(!win32)
     
    23892377                yyval.dlgex->style->and_mask = 0;
    23902378
    2391                 indialog = FALSE;
    23922379                if(!yyval.dlgex->lvc.language)
    23932380                        yyval.dlgex->lvc.language = dup_language(currentlanguage);
    23942381                ;
    23952382    break;}
     2383case 121:
     2384#line 1078 "parser.y"
     2385{ yyval.dlgex=new_dialogex(); ;
     2386    break;}
     2387case 122:
     2388#line 1079 "parser.y"
     2389{ yyval.dlgex=dialogex_style(yyvsp[0].style,yyvsp[-2].dlgex); ;
     2390    break;}
     2391case 123:
     2392#line 1080 "parser.y"
     2393{ yyval.dlgex=dialogex_exstyle(yyvsp[0].style,yyvsp[-2].dlgex); ;
     2394    break;}
     2395case 124:
     2396#line 1081 "parser.y"
     2397{ yyval.dlgex=dialogex_caption(yyvsp[0].str,yyvsp[-2].dlgex); ;
     2398    break;}
     2399case 125:
     2400#line 1082 "parser.y"
     2401{ yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;
     2402    break;}
     2403case 126:
     2404#line 1083 "parser.y"
     2405{ yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;
     2406    break;}
     2407case 127:
     2408#line 1084 "parser.y"
     2409{ yyval.dlgex=dialogex_class(yyvsp[0].nid,yyvsp[-2].dlgex); ;
     2410    break;}
     2411case 128:
     2412#line 1085 "parser.y"
     2413{ yyval.dlgex=dialogex_class(yyvsp[0].nid,yyvsp[-2].dlgex); ;
     2414    break;}
     2415case 129:
     2416#line 1086 "parser.y"
     2417{ yyval.dlgex=dialogex_menu(yyvsp[0].nid,yyvsp[-2].dlgex); ;
     2418    break;}
     2419case 130:
     2420#line 1087 "parser.y"
     2421{ yyval.dlgex=dialogex_language(yyvsp[0].lan,yyvsp[-1].dlgex); ;
     2422    break;}
     2423case 131:
     2424#line 1088 "parser.y"
     2425{ yyval.dlgex=dialogex_characteristics(yyvsp[0].chars,yyvsp[-1].dlgex); ;
     2426    break;}
     2427case 132:
     2428#line 1089 "parser.y"
     2429{ yyval.dlgex=dialogex_version(yyvsp[0].ver,yyvsp[-1].dlgex); ;
     2430    break;}
     2431case 133:
     2432#line 1092 "parser.y"
     2433{ yyval.ctl = NULL; ;
     2434    break;}
     2435case 134:
     2436#line 1093 "parser.y"
     2437{ yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2438    break;}
     2439case 135:
     2440#line 1094 "parser.y"
     2441{ yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2442    break;}
    23962443case 136:
    2397 #line 913 "parser.y"
    2398 { yyval.dlgex=new_dialogex(); ;
     2444#line 1095 "parser.y"
     2445{ yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    23992446    break;}
    24002447case 137:
    2401 #line 914 "parser.y"
    2402 { yyval.dlgex=dialogex_style(yyvsp[0].style,yyvsp[-2].dlgex); ;
     2448#line 1096 "parser.y"
     2449{ yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24032450    break;}
    24042451case 138:
    2405 #line 915 "parser.y"
    2406 { yyval.dlgex=dialogex_exstyle(yyvsp[0].style,yyvsp[-2].dlgex); ;
     2452#line 1097 "parser.y"
     2453{ yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24072454    break;}
    24082455case 139:
    2409 #line 916 "parser.y"
    2410 { yyval.dlgex=dialogex_caption(yyvsp[0].str,yyvsp[-2].dlgex); ;
     2456#line 1098 "parser.y"
     2457{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24112458    break;}
    24122459case 140:
    2413 #line 917 "parser.y"
    2414 { yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;
     2460#line 1099 "parser.y"
     2461{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24152462    break;}
    24162463case 141:
    2417 #line 918 "parser.y"
    2418 { yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;
     2464#line 1100 "parser.y"
     2465{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;
    24192466    break;}
    24202467case 142:
    2421 #line 919 "parser.y"
    2422 { yyval.dlgex=dialogex_class(yyvsp[0].nid,yyvsp[-2].dlgex); ;
     2468#line 1101 "parser.y"
     2469{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24232470    break;}
    24242471case 143:
    2425 #line 920 "parser.y"
    2426 { yyval.dlgex=dialogex_menu(yyvsp[0].nid,yyvsp[-2].dlgex); ;
     2472#line 1103 "parser.y"
     2473{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24272474    break;}
    24282475case 144:
    2429 #line 921 "parser.y"
    2430 { yyval.dlgex=dialogex_language(yyvsp[0].lan,yyvsp[-1].dlgex); ;
     2476#line 1104 "parser.y"
     2477{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24312478    break;}
    24322479case 145:
    2433 #line 922 "parser.y"
    2434 { yyval.dlgex=dialogex_characteristics(yyvsp[0].chars,yyvsp[-1].dlgex); ;
     2480#line 1105 "parser.y"
     2481{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24352482    break;}
    24362483case 146:
    2437 #line 923 "parser.y"
    2438 { yyval.dlgex=dialogex_version(yyvsp[0].ver,yyvsp[-1].dlgex); ;
     2484#line 1106 "parser.y"
     2485{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24392486    break;}
    24402487case 147:
    2441 #line 926 "parser.y"
    2442 { yyval.ctl = NULL; ;
     2488#line 1107 "parser.y"
     2489{ yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24432490    break;}
    24442491case 148:
    2445 #line 927 "parser.y"
    2446 { yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2492#line 1108 "parser.y"
     2493{ yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24472494    break;}
    24482495case 149:
    2449 #line 928 "parser.y"
    2450 { yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2496#line 1109 "parser.y"
     2497{ yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24512498    break;}
    24522499case 150:
    2453 #line 929 "parser.y"
    2454 { yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
     2500#line 1110 "parser.y"
     2501{ yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    24552502    break;}
    24562503case 151:
    2457 #line 930 "parser.y"
    2458 { yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2459     break;}
    2460 case 152:
    2461 #line 931 "parser.y"
    2462 { yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2463     break;}
    2464 case 153:
    2465 #line 932 "parser.y"
    2466 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2467     break;}
    2468 case 154:
    2469 #line 933 "parser.y"
    2470 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2471     break;}
    2472 case 155:
    2473 #line 934 "parser.y"
    2474 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;
    2475     break;}
    2476 case 156:
    2477 #line 935 "parser.y"
    2478 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2479     break;}
    2480 case 157:
    2481 #line 937 "parser.y"
    2482 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2483     break;}
    2484 case 158:
    2485 #line 938 "parser.y"
    2486 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2487     break;}
    2488 case 159:
    2489 #line 939 "parser.y"
    2490 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2491     break;}
    2492 case 160:
    2493 #line 940 "parser.y"
    2494 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2495     break;}
    2496 case 161:
    2497 #line 941 "parser.y"
    2498 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2499     break;}
    2500 case 162:
    2501 #line 942 "parser.y"
    2502 { yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2503     break;}
    2504 case 163:
    2505 #line 943 "parser.y"
    2506 { yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2507     break;}
    2508 case 164:
    2509 #line 944 "parser.y"
    2510 { yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;
    2511     break;}
    2512 case 165:
    2513 #line 946 "parser.y"
     2504#line 1112 "parser.y"
    25142505{
    25152506                yyvsp[0].ctl->title = yyvsp[-7].nid;
     
    25202511                ;
    25212512    break;}
    2522 case 166:
    2523 #line 957 "parser.y"
     2513case 152:
     2514#line 1123 "parser.y"
    25242515{
    25252516                yyval.ctl=new_control();
     
    25472538                ;
    25482539    break;}
    2549 case 167:
    2550 #line 981 "parser.y"
     2540case 153:
     2541#line 1147 "parser.y"
    25512542{
    25522543                yyval.ctl=new_control();
     
    25632554                ;
    25642555    break;}
    2565 case 168:
    2566 #line 997 "parser.y"
     2556case 154:
     2557#line 1163 "parser.y"
    25672558{
    25682559                yyval.ctl=new_control();
     
    25912582                ;
    25922583    break;}
    2593 case 169:
    2594 #line 1025 "parser.y"
     2584case 155:
     2585#line 1191 "parser.y"
    25952586{
    25962587                yyval.ctl = new_control();
     
    26152606                ;
    26162607    break;}
    2617 case 170:
    2618 #line 1048 "parser.y"
     2608case 156:
     2609#line 1214 "parser.y"
    26192610{ yyval.raw = NULL; ;
    26202611    break;}
    2621 case 171:
    2622 #line 1049 "parser.y"
     2612case 157:
     2613#line 1215 "parser.y"
    26232614{ yyval.raw = yyvsp[0].raw; ;
    26242615    break;}
    2625 case 172:
    2626 #line 1052 "parser.y"
     2616case 158:
     2617#line 1218 "parser.y"
    26272618{ yyval.iptr = NULL; ;
    26282619    break;}
    2629 case 173:
    2630 #line 1053 "parser.y"
     2620case 159:
     2621#line 1219 "parser.y"
    26312622{ yyval.iptr = new_int(yyvsp[0].num); ;
    26322623    break;}
    2633 case 174:
    2634 #line 1057 "parser.y"
     2624case 160:
     2625#line 1223 "parser.y"
    26352626{ yyval.fntid = new_font_id(yyvsp[-7].num, yyvsp[-5].str, yyvsp[-3].num, yyvsp[-1].num); ;
    26362627    break;}
    2637 case 175:
    2638 #line 1064 "parser.y"
     2628case 161:
     2629#line 1230 "parser.y"
    26392630{ yyval.fntid = NULL; ;
    26402631    break;}
    2641 case 176:
    2642 #line 1065 "parser.y"
     2632case 162:
     2633#line 1231 "parser.y"
    26432634{ yyval.fntid = NULL; ;
    26442635    break;}
    2645 case 177:
    2646 #line 1069 "parser.y"
     2636case 163:
     2637#line 1235 "parser.y"
    26472638{
    26482639                if(!yyvsp[0].menitm)
     
    26662657                ;
    26672658    break;}
    2668 case 178:
    2669 #line 1092 "parser.y"
     2659case 164:
     2660#line 1258 "parser.y"
    26702661{ yyval.menitm = yyvsp[-1].menitm; ;
    26712662    break;}
    2672 case 179:
    2673 #line 1096 "parser.y"
     2663case 165:
     2664#line 1262 "parser.y"
    26742665{yyval.menitm = NULL;;
    26752666    break;}
    2676 case 180:
    2677 #line 1097 "parser.y"
     2667case 166:
     2668#line 1263 "parser.y"
    26782669{
    26792670                yyval.menitm=new_menu_item();
     
    26862677                ;
    26872678    break;}
    2688 case 181:
    2689 #line 1106 "parser.y"
     2679case 167:
     2680#line 1272 "parser.y"
    26902681{
    26912682                yyval.menitm=new_menu_item();
     
    26952686                ;
    26962687    break;}
    2697 case 182:
    2698 #line 1112 "parser.y"
     2688case 168:
     2689#line 1278 "parser.y"
    26992690{
    27002691                yyval.menitm = new_menu_item();
     
    27062697                ;
    27072698    break;}
    2708 case 183:
    2709 #line 1131 "parser.y"
     2699case 169:
     2700#line 1297 "parser.y"
    27102701{ yyval.num = 0; ;
    27112702    break;}
    2712 case 184:
    2713 #line 1132 "parser.y"
     2703case 170:
     2704#line 1298 "parser.y"
    27142705{ yyval.num = yyvsp[0].num | MF_CHECKED; ;
    27152706    break;}
    2716 case 185:
    2717 #line 1133 "parser.y"
     2707case 171:
     2708#line 1299 "parser.y"
    27182709{ yyval.num = yyvsp[0].num | MF_GRAYED; ;
    27192710    break;}
    2720 case 186:
    2721 #line 1134 "parser.y"
     2711case 172:
     2712#line 1300 "parser.y"
    27222713{ yyval.num = yyvsp[0].num | MF_HELP; ;
    27232714    break;}
    2724 case 187:
    2725 #line 1135 "parser.y"
     2715case 173:
     2716#line 1301 "parser.y"
    27262717{ yyval.num = yyvsp[0].num | MF_DISABLED; ;
    27272718    break;}
    2728 case 188:
    2729 #line 1136 "parser.y"
     2719case 174:
     2720#line 1302 "parser.y"
    27302721{ yyval.num = yyvsp[0].num | MF_MENUBARBREAK; ;
    27312722    break;}
    2732 case 189:
    2733 #line 1137 "parser.y"
     2723case 175:
     2724#line 1303 "parser.y"
    27342725{ yyval.num = yyvsp[0].num | MF_MENUBREAK; ;
    27352726    break;}
    2736 case 190:
    2737 #line 1141 "parser.y"
     2727case 176:
     2728#line 1307 "parser.y"
    27382729{
    27392730                if(!win32)
     
    27592750                ;
    27602751    break;}
    2761 case 191:
    2762 #line 1166 "parser.y"
     2752case 177:
     2753#line 1332 "parser.y"
    27632754{ yyval.menexitm = yyvsp[-1].menexitm; ;
    27642755    break;}
    2765 case 192:
    2766 #line 1170 "parser.y"
     2756case 178:
     2757#line 1336 "parser.y"
    27672758{yyval.menexitm = NULL; ;
    27682759    break;}
    2769 case 193:
    2770 #line 1171 "parser.y"
     2760case 179:
     2761#line 1337 "parser.y"
    27712762{
    27722763                yyval.menexitm = new_menuex_item();
     
    27862777                ;
    27872778    break;}
    2788 case 194:
    2789 #line 1187 "parser.y"
     2779case 180:
     2780#line 1353 "parser.y"
    27902781{
    27912782                yyval.menexitm = new_menuex_item();
     
    27952786                ;
    27962787    break;}
    2797 case 195:
    2798 #line 1193 "parser.y"
     2788case 181:
     2789#line 1359 "parser.y"
    27992790{
    28002791                yyval.menexitm = new_menuex_item();
     
    28152806                ;
    28162807    break;}
    2817 case 196:
    2818 #line 1213 "parser.y"
     2808case 182:
     2809#line 1379 "parser.y"
    28192810{ yyval.exopt = new_itemex_opt(0, 0, 0, 0); ;
    28202811    break;}
    2821 case 197:
    2822 #line 1214 "parser.y"
     2812case 183:
     2813#line 1380 "parser.y"
    28232814{
    28242815                yyval.exopt = new_itemex_opt(yyvsp[0].num, 0, 0, 0);
     
    28262817                ;
    28272818    break;}
    2828 case 198:
    2829 #line 1218 "parser.y"
     2819case 184:
     2820#line 1384 "parser.y"
    28302821{
    28312822                yyval.exopt = new_itemex_opt(yyvsp[-3].iptr ? *(yyvsp[-3].iptr) : 0, yyvsp[-1].iptr ? *(yyvsp[-1].iptr) : 0, yyvsp[0].num, 0);
     
    28372828                ;
    28382829    break;}
    2839 case 199:
    2840 #line 1226 "parser.y"
     2830case 185:
     2831#line 1392 "parser.y"
    28412832{
    28422833                yyval.exopt = new_itemex_opt(yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0);
     
    28482839                ;
    28492840    break;}
    2850 case 200:
    2851 #line 1237 "parser.y"
     2841case 186:
     2842#line 1403 "parser.y"
    28522843{ yyval.exopt = new_itemex_opt(0, 0, 0, 0); ;
    28532844    break;}
    2854 case 201:
    2855 #line 1238 "parser.y"
     2845case 187:
     2846#line 1404 "parser.y"
    28562847{
    28572848                yyval.exopt = new_itemex_opt(yyvsp[0].num, 0, 0, 0);
     
    28592850                ;
    28602851    break;}
    2861 case 202:
    2862 #line 1242 "parser.y"
     2852case 188:
     2853#line 1408 "parser.y"
    28632854{
    28642855                yyval.exopt = new_itemex_opt(yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0, 0);
     
    28682859                ;
    28692860    break;}
    2870 case 203:
    2871 #line 1248 "parser.y"
     2861case 189:
     2862#line 1414 "parser.y"
    28722863{
    28732864                yyval.exopt = new_itemex_opt(yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0);
     
    28792870                ;
    28802871    break;}
    2881 case 204:
    2882 #line 1256 "parser.y"
     2872case 190:
     2873#line 1422 "parser.y"
    28832874{
    28842875                yyval.exopt = new_itemex_opt(yyvsp[-6].iptr ? *(yyvsp[-6].iptr) : 0, yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num);
     
    28922883                ;
    28932884    break;}
    2894 case 205:
    2895 #line 1276 "parser.y"
     2885case 191:
     2886#line 1442 "parser.y"
    28962887{
    28972888                if(!yyvsp[-1].stt)
     
    29332924                ;
    29342925    break;}
    2935 case 206:
    2936 #line 1317 "parser.y"
     2926case 192:
     2927#line 1483 "parser.y"
    29372928{
    29382929                if((tagstt = find_stringtable(yyvsp[0].lvc)) == NULL)
     
    29452936                ;
    29462937    break;}
    2947 case 207:
    2948 #line 1328 "parser.y"
     2938case 193:
     2939#line 1494 "parser.y"
    29492940{ yyval.stt = NULL; ;
    29502941    break;}
    2951 case 208:
    2952 #line 1329 "parser.y"
     2942case 194:
     2943#line 1495 "parser.y"
    29532944{
    29542945                int i;
     
    29742965                tagstt->entries[tagstt->nentries-1].characts = tagstt_characts;
    29752966
     2967                if(pedantic && !yyvsp[0].str->size)
     2968                        yywarning("Zero length strings make no sense");
    29762969                if(!win32 && yyvsp[0].str->size > 254)
    29772970                        yyerror("Stringtable entry more than 254 characters");
     
    29812974                ;
    29822975    break;}
    2983 case 211:
    2984 #line 1367 "parser.y"
     2976case 197:
     2977#line 1535 "parser.y"
    29852978{
    29862979                yyval.veri = yyvsp[-3].veri;
    2987                 yyvsp[-3].veri->blocks = get_ver_block_head(yyvsp[-1].blk);
    2988                 ;
    2989     break;}
    2990 case 212:
    2991 #line 1374 "parser.y"
     2980                if(yyvsp[-4].iptr)
     2981                {
     2982                        yyval.veri->memopt = *(yyvsp[-4].iptr);
     2983                        free(yyvsp[-4].iptr);
     2984                }
     2985                else
     2986                        yyval.veri->memopt = WRC_MO_MOVEABLE | (win32 ? WRC_MO_PURE : 0);
     2987                yyval.veri->blocks = get_ver_block_head(yyvsp[-1].blk);
     2988                /* Set language; there is no version or characteristics */
     2989                yyval.veri->lvc.language = dup_language(currentlanguage);
     2990                ;
     2991    break;}
     2992case 198:
     2993#line 1551 "parser.y"
    29922994{ yyval.veri = new_versioninfo(); ;
    29932995    break;}
    2994 case 213:
    2995 #line 1375 "parser.y"
     2996case 199:
     2997#line 1552 "parser.y"
    29962998{
    29972999                if(yyvsp[-8].veri->gotit.fv)
     
    30053007                ;
    30063008    break;}
    3007 case 214:
    3008 #line 1385 "parser.y"
     3009case 200:
     3010#line 1562 "parser.y"
    30093011{
    30103012                if(yyvsp[-8].veri->gotit.pv)
     
    30183020                ;
    30193021    break;}
    3020 case 215:
    3021 #line 1395 "parser.y"
     3022case 201:
     3023#line 1572 "parser.y"
    30223024{
    30233025                if(yyvsp[-2].veri->gotit.ff)
     
    30283030                ;
    30293031    break;}
    3030 case 216:
    3031 #line 1402 "parser.y"
     3032case 202:
     3033#line 1579 "parser.y"
    30323034{
    30333035                if(yyvsp[-2].veri->gotit.ffm)
     
    30383040                ;
    30393041    break;}
    3040 case 217:
    3041 #line 1409 "parser.y"
     3042case 203:
     3043#line 1586 "parser.y"
    30423044{
    30433045                if(yyvsp[-2].veri->gotit.fo)
     
    30483050                ;
    30493051    break;}
    3050 case 218:
    3051 #line 1416 "parser.y"
     3052case 204:
     3053#line 1593 "parser.y"
    30523054{
    30533055                if(yyvsp[-2].veri->gotit.ft)
     
    30583060                ;
    30593061    break;}
    3060 case 219:
    3061 #line 1423 "parser.y"
     3062case 205:
     3063#line 1600 "parser.y"
    30623064{
    30633065                if(yyvsp[-2].veri->gotit.fst)
     
    30683070                ;
    30693071    break;}
    3070 case 220:
    3071 #line 1433 "parser.y"
     3072case 206:
     3073#line 1610 "parser.y"
    30723074{ yyval.blk = NULL; ;
    30733075    break;}
    3074 case 221:
    3075 #line 1434 "parser.y"
     3076case 207:
     3077#line 1611 "parser.y"
    30763078{
    30773079                yyval.blk = yyvsp[0].blk;
     
    30813083                ;
    30823084    break;}
    3083 case 222:
    3084 #line 1443 "parser.y"
     3085case 208:
     3086#line 1620 "parser.y"
    30853087{
    30863088                yyval.blk = new_ver_block();
     
    30893091                ;
    30903092    break;}
    3091 case 223:
    3092 #line 1451 "parser.y"
     3093case 209:
     3094#line 1628 "parser.y"
    30933095{ yyval.val = NULL; ;
    30943096    break;}
    3095 case 224:
    3096 #line 1452 "parser.y"
     3097case 210:
     3098#line 1629 "parser.y"
    30973099{
    30983100                yyval.val = yyvsp[0].val;
     
    31023104                ;
    31033105    break;}
    3104 case 225:
    3105 #line 1461 "parser.y"
     3106case 211:
     3107#line 1638 "parser.y"
    31063108{
    31073109                yyval.val = new_ver_value();
     
    31103112                ;
    31113113    break;}
    3112 case 226:
    3113 #line 1466 "parser.y"
     3114case 212:
     3115#line 1643 "parser.y"
    31143116{
    31153117                yyval.val = new_ver_value();
     
    31193121                ;
    31203122    break;}
    3121 case 227:
    3122 #line 1472 "parser.y"
     3123case 213:
     3124#line 1649 "parser.y"
    31233125{
    31243126                yyval.val = new_ver_value();
     
    31283130                ;
    31293131    break;}
    3130 case 228:
    3131 #line 1481 "parser.y"
     3132case 214:
     3133#line 1658 "parser.y"
    31323134{ yyval.verw = new_ver_words(yyvsp[0].num); ;
    31333135    break;}
    3134 case 229:
    3135 #line 1482 "parser.y"
     3136case 215:
     3137#line 1659 "parser.y"
    31363138{ yyval.verw = add_ver_words(yyvsp[-2].verw, yyvsp[0].num); ;
    31373139    break;}
    3138 case 230:
    3139 #line 1486 "parser.y"
     3140case 216:
     3141#line 1663 "parser.y"
    31403142{
    31413143                int nitems;
     
    31453147                {
    31463148                        yyval.tlbar->memopt = *(yyvsp[-7].iptr);
    3147                         free(yyvsp[-7].iptr);
     3149                        free(yyvsp[-7].iptr); 
    31483150                }
    31493151                else
     
    31623164                ;
    31633165    break;}
    3164 case 231:
    3165 #line 1512 "parser.y"
     3166case 217:
     3167#line 1689 "parser.y"
    31663168{ yyval.tlbarItems = NULL; ;
    31673169    break;}
    3168 case 232:
    3169 #line 1513 "parser.y"
    3170 {
     3170case 218:
     3171#line 1690 "parser.y"
     3172{         
    31713173                toolbar_item_t *idrec = new_toolbar_item();
    31723174                idrec->id = yyvsp[0].num;
    3173                 yyval.tlbarItems = ins_tlbr_button(yyvsp[-2].tlbarItems, idrec);
    3174                 ;
    3175     break;}
    3176 case 233:
    3177 #line 1518 "parser.y"
    3178 {
     3175                yyval.tlbarItems = ins_tlbr_button(yyvsp[-2].tlbarItems, idrec); 
     3176                ;
     3177    break;}
     3178case 219:
     3179#line 1695 "parser.y"
     3180{         
    31793181                toolbar_item_t *idrec = new_toolbar_item();
    31803182                idrec->id = 0;
    3181                 yyval.tlbarItems = ins_tlbr_button(yyvsp[-1].tlbarItems, idrec);
     3183                yyval.tlbarItems = ins_tlbr_button(yyvsp[-1].tlbarItems, idrec); 
    31823184        ;
    31833185    break;}
    3184 case 234:
    3185 #line 1527 "parser.y"
     3186case 220:
     3187#line 1704 "parser.y"
    31863188{ yyval.iptr = NULL; ;
    31873189    break;}
    3188 case 235:
    3189 #line 1528 "parser.y"
     3190case 221:
     3191#line 1705 "parser.y"
    31903192{
    31913193                if(yyvsp[-1].iptr)
     
    31993201                ;
    32003202    break;}
    3201 case 236:
    3202 #line 1538 "parser.y"
     3203case 222:
     3204#line 1715 "parser.y"
    32033205{
    32043206                if(yyvsp[-1].iptr)
     
    32153217                ;
    32163218    break;}
    3217 case 237:
    3218 #line 1553 "parser.y"
     3219case 223:
     3220#line 1730 "parser.y"
    32193221{ yyval.iptr = new_int(WRC_MO_PRELOAD); ;
    32203222    break;}
    3221 case 238:
    3222 #line 1554 "parser.y"
     3223case 224:
     3224#line 1731 "parser.y"
    32233225{ yyval.iptr = new_int(WRC_MO_MOVEABLE); ;
    32243226    break;}
    3225 case 239:
    3226 #line 1555 "parser.y"
     3227case 225:
     3228#line 1732 "parser.y"
    32273229{ yyval.iptr = new_int(WRC_MO_DISCARDABLE); ;
    32283230    break;}
    3229 case 240:
    3230 #line 1556 "parser.y"
     3231case 226:
     3232#line 1733 "parser.y"
    32313233{ yyval.iptr = new_int(WRC_MO_PURE); ;
    32323234    break;}
    3233 case 241:
    3234 #line 1559 "parser.y"
     3235case 227:
     3236#line 1736 "parser.y"
    32353237{ yyval.iptr = new_int(~WRC_MO_PRELOAD); ;
    32363238    break;}
    3237 case 242:
    3238 #line 1560 "parser.y"
     3239case 228:
     3240#line 1737 "parser.y"
    32393241{ yyval.iptr = new_int(~WRC_MO_MOVEABLE); ;
    32403242    break;}
    3241 case 243:
    3242 #line 1561 "parser.y"
     3243case 229:
     3244#line 1738 "parser.y"
    32433245{ yyval.iptr = new_int(~WRC_MO_PURE); ;
    32443246    break;}
    3245 case 244:
    3246 #line 1565 "parser.y"
     3247case 230:
     3248#line 1742 "parser.y"
    32473249{ yyval.lvc = new_lvc(); ;
    32483250    break;}
    3249 case 245:
    3250 #line 1566 "parser.y"
     3251case 231:
     3252#line 1743 "parser.y"
    32513253{
    32523254                if(!win32)
     
    32583260                ;
    32593261    break;}
    3260 case 246:
    3261 #line 1574 "parser.y"
     3262case 232:
     3263#line 1751 "parser.y"
    32623264{
    32633265                if(!win32)
     
    32693271                ;
    32703272    break;}
    3271 case 247:
    3272 #line 1582 "parser.y"
     3273case 233:
     3274#line 1759 "parser.y"
    32733275{
    32743276                if(!win32)
     
    32803282                ;
    32813283    break;}
     3284case 234:
     3285#line 1777 "parser.y"
     3286{ yyval.lan = new_language(yyvsp[-2].num, yyvsp[0].num); ;
     3287    break;}
     3288case 235:
     3289#line 1781 "parser.y"
     3290{ yyval.chars = new_characts(yyvsp[0].num); ;
     3291    break;}
     3292case 236:
     3293#line 1785 "parser.y"
     3294{ yyval.ver = new_version(yyvsp[0].num); ;
     3295    break;}
     3296case 237:
     3297#line 1789 "parser.y"
     3298{
     3299                if(yyvsp[-3].lvc)
     3300                {
     3301                        yyvsp[-1].raw->lvc = *(yyvsp[-3].lvc);
     3302                        free(yyvsp[-3].lvc);
     3303                }
     3304
     3305                if(!yyvsp[-1].raw->lvc.language)
     3306                        yyvsp[-1].raw->lvc.language = dup_language(currentlanguage);
     3307
     3308                yyval.raw = yyvsp[-1].raw;
     3309                ;
     3310    break;}
     3311case 238:
     3312#line 1804 "parser.y"
     3313{ yyval.raw = yyvsp[0].raw; ;
     3314    break;}
     3315case 239:
     3316#line 1805 "parser.y"
     3317{ yyval.raw = int2raw_data(yyvsp[0].num); ;
     3318    break;}
     3319case 240:
     3320#line 1806 "parser.y"
     3321{ yyval.raw = long2raw_data(yyvsp[0].num); ;
     3322    break;}
     3323case 241:
     3324#line 1807 "parser.y"
     3325{ yyval.raw = str2raw_data(yyvsp[0].str); ;
     3326    break;}
     3327case 242:
     3328#line 1808 "parser.y"
     3329{ yyval.raw = merge_raw_data(yyvsp[-2].raw, yyvsp[0].raw); free(yyvsp[0].raw->data); free(yyvsp[0].raw); ;
     3330    break;}
     3331case 243:
     3332#line 1809 "parser.y"
     3333{ yyval.raw = merge_raw_data_int(yyvsp[-2].raw, yyvsp[0].num); ;
     3334    break;}
     3335case 244:
     3336#line 1810 "parser.y"
     3337{ yyval.raw = merge_raw_data_long(yyvsp[-2].raw, yyvsp[0].num); ;
     3338    break;}
     3339case 245:
     3340#line 1811 "parser.y"
     3341{ yyval.raw = merge_raw_data_str(yyvsp[-2].raw, yyvsp[0].str); ;
     3342    break;}
     3343case 246:
     3344#line 1815 "parser.y"
     3345{
     3346                yyval.raw = load_file(yyvsp[0].str);
     3347                yyval.raw->lvc.language = dup_language(currentlanguage);
     3348                ;
     3349    break;}
     3350case 247:
     3351#line 1819 "parser.y"
     3352{ yyval.raw = yyvsp[0].raw; ;
     3353    break;}
    32823354case 248:
    3283 #line 1593 "parser.y"
    3284 { yyval.lan = new_language(yyvsp[-2].num, yyvsp[0].num); ;
     3355#line 1826 "parser.y"
     3356{ yyval.iptr = 0; ;
    32853357    break;}
    32863358case 249:
    3287 #line 1597 "parser.y"
    3288 { yyval.chars = new_characts(yyvsp[0].num); ;
     3359#line 1827 "parser.y"
     3360{ yyval.iptr = new_int(yyvsp[0].num); ;
    32893361    break;}
    32903362case 250:
    3291 #line 1601 "parser.y"
    3292 { yyval.ver = new_version(yyvsp[0].num); ;
     3363#line 1831 "parser.y"
     3364{ yyval.num = (yyvsp[0].num); ;
    32933365    break;}
    32943366case 251:
    3295 #line 1605 "parser.y"
    3296 { yyval.raw = yyvsp[-1].raw; ;
     3367#line 1834 "parser.y"
     3368{ yyval.num = (yyvsp[-2].num) + (yyvsp[0].num); ;
    32973369    break;}
    32983370case 252:
    3299 #line 1609 "parser.y"
    3300 { yyval.raw = yyvsp[0].raw; ;
     3371#line 1835 "parser.y"
     3372{ yyval.num = (yyvsp[-2].num) - (yyvsp[0].num); ;
    33013373    break;}
    33023374case 253:
    3303 #line 1610 "parser.y"
    3304 { yyval.raw = int2raw_data(yyvsp[0].num); ;
     3375#line 1836 "parser.y"
     3376{ yyval.num = (yyvsp[-2].num) | (yyvsp[0].num); ;
    33053377    break;}
    33063378case 254:
    3307 #line 1611 "parser.y"
    3308 { yyval.raw = long2raw_data(yyvsp[0].num); ;
     3379#line 1837 "parser.y"
     3380{ yyval.num = (yyvsp[-2].num) & (yyvsp[0].num); ;
    33093381    break;}
    33103382case 255:
    3311 #line 1612 "parser.y"
    3312 { yyval.raw = str2raw_data(yyvsp[0].str); ;
     3383#line 1838 "parser.y"
     3384{ yyval.num = (yyvsp[-2].num) * (yyvsp[0].num); ;
    33133385    break;}
    33143386case 256:
    3315 #line 1613 "parser.y"
    3316 { yyval.raw = merge_raw_data(yyvsp[-2].raw, yyvsp[0].raw); free(yyvsp[0].raw->data); free(yyvsp[0].raw); ;
     3387#line 1839 "parser.y"
     3388{ yyval.num = (yyvsp[-2].num) / (yyvsp[0].num); ;
    33173389    break;}
    33183390case 257:
    3319 #line 1614 "parser.y"
    3320 { yyval.raw = merge_raw_data_int(yyvsp[-2].raw, yyvsp[0].num); ;
     3391#line 1840 "parser.y"
     3392{ yyval.num = (yyvsp[-2].num) ^ (yyvsp[0].num); ;
    33213393    break;}
    33223394case 258:
    3323 #line 1615 "parser.y"
    3324 { yyval.raw = merge_raw_data_long(yyvsp[-2].raw, yyvsp[0].num); ;
     3395#line 1841 "parser.y"
     3396{ yyval.num = ~(yyvsp[0].num); ;
    33253397    break;}
    33263398case 259:
    3327 #line 1616 "parser.y"
    3328 { yyval.raw = merge_raw_data_str(yyvsp[-2].raw, yyvsp[0].str); ;
     3399#line 1842 "parser.y"
     3400{ yyval.num = -(yyvsp[0].num); ;
    33293401    break;}
    33303402case 260:
    3331 #line 1623 "parser.y"
    3332 { yyval.iptr = 0; ;
     3403#line 1843 "parser.y"
     3404{ yyval.num = yyvsp[0].num; ;
    33333405    break;}
    33343406case 261:
    3335 #line 1624 "parser.y"
    3336 { yyval.iptr = new_int(yyvsp[0].num); ;
     3407#line 1844 "parser.y"
     3408{ yyval.num = yyvsp[-1].num; ;
    33373409    break;}
    33383410case 262:
    3339 #line 1626 "parser.y"
    3340 { yyval.num = (yyvsp[0].num); ;
     3411#line 1845 "parser.y"
     3412{ yyval.num = yyvsp[0].num; ;
    33413413    break;}
    33423414case 263:
    3343 #line 1629 "parser.y"
    3344 { yyval.num = (yyvsp[-2].num) + (yyvsp[0].num); ;
     3415#line 1846 "parser.y"
     3416{ yyval.num = ~(yyvsp[0].num); ;
    33453417    break;}
    33463418case 264:
    3347 #line 1630 "parser.y"
    3348 { yyval.num = (yyvsp[-2].num) - (yyvsp[0].num); ;
     3419#line 1849 "parser.y"
     3420{ yyval.num = yyvsp[0].num; ;
    33493421    break;}
    33503422case 265:
    3351 #line 1631 "parser.y"
    3352 { yyval.num = (yyvsp[-2].num) | (yyvsp[0].num); ;
    3353     break;}
    3354 case 266:
    3355 #line 1632 "parser.y"
    3356 { yyval.num = (yyvsp[-2].num) & (yyvsp[0].num); ;
    3357     break;}
    3358 case 267:
    3359 #line 1633 "parser.y"
    3360 { yyval.num = (yyvsp[-2].num) * (yyvsp[0].num); ;
    3361     break;}
    3362 case 268:
    3363 #line 1634 "parser.y"
    3364 { yyval.num = (yyvsp[-2].num) / (yyvsp[0].num); ;
    3365     break;}
    3366 case 269:
    3367 #line 1635 "parser.y"
    3368 { yyval.num = ~(yyvsp[0].num); ;
    3369     break;}
    3370 case 270:
    3371 #line 1636 "parser.y"
    3372 { yyval.num = -(yyvsp[0].num); ;
    3373     break;}
    3374 case 271:
    3375 #line 1638 "parser.y"
    3376 { yyval.num = yyvsp[-1].num; ;
    3377     break;}
    3378 case 272:
    3379 #line 1639 "parser.y"
    3380 { yyval.num = yyvsp[0].num; want_rscname = 0; ;
    3381     break;}
    3382 case 273:
    3383 #line 1640 "parser.y"
    3384 { yyval.num = ~(yyvsp[0].num); ;
    3385     break;}
    3386 case 274:
    3387 #line 1643 "parser.y"
     3423#line 1850 "parser.y"
    33883424{ yyval.num = yyvsp[0].num; ;
    33893425    break;}
    3390 case 275:
    3391 #line 1644 "parser.y"
    3392 { yyval.num = yyvsp[0].num; ;
    3393     break;}
    33943426}
    33953427   /* the action file gets copied in in place of this dollarsign */
    3396 #line 543 "/emx/share/bison.simple"
     3428#line 498 "bison.simple"
    33973429
    33983430
     
    35903622  yystate = yyn;
    35913623  goto yynewstate;
    3592 
    3593  yyacceptlab:
    3594   /* YYACCEPT comes here.  */
    3595   if (yyfree_stacks)
    3596     {
    3597       free (yyss);
    3598       free (yyvs);
    3599 #ifdef YYLSP_NEEDED
    3600       free (yyls);
    3601 #endif
    3602     }
    3603   return 0;
    3604 
    3605  yyabortlab:
    3606   /* YYABORT comes here.  */
    3607   if (yyfree_stacks)
    3608     {
    3609       free (yyss);
    3610       free (yyvs);
    3611 #ifdef YYLSP_NEEDED
    3612       free (yyls);
    3613 #endif
    3614     }
    3615   return 1;
    3616 }
    3617 #line 1647 "parser.y"
     3624}
     3625#line 1853 "parser.y"
    36183626
    36193627/* Dialog specific functions */
    3620 dialog_t *dialog_style(style_t * st, dialog_t *dlg)
     3628static dialog_t *dialog_style(style_t * st, dialog_t *dlg)
    36213629{
    36223630        assert(dlg != NULL);
     
    36423650}
    36433651
    3644 dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg)
     3652static dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg)
    36453653{
    36463654        assert(dlg != NULL);
     
    36663674}
    36673675
    3668 dialog_t *dialog_caption(string_t *s, dialog_t *dlg)
     3676static dialog_t *dialog_caption(string_t *s, dialog_t *dlg)
    36693677{
    36703678        assert(dlg != NULL);
     
    36753683}
    36763684
    3677 dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
     3685static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
    36783686{
    36793687        assert(dlg != NULL);
     
    36843692}
    36853693
    3686 dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
     3694static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
    36873695{
    36883696        assert(dlg != NULL);
     
    36933701}
    36943702
    3695 dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg)
     3703static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg)
    36963704{
    36973705        assert(dlg != NULL);
     
    37023710}
    37033711
    3704 dialog_t *dialog_language(language_t *l, dialog_t *dlg)
     3712static dialog_t *dialog_language(language_t *l, dialog_t *dlg)
    37053713{
    37063714        assert(dlg != NULL);
     
    37113719}
    37123720
    3713 dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
     3721static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
    37143722{
    37153723        assert(dlg != NULL);
     
    37203728}
    37213729
    3722 dialog_t *dialog_version(version_t *v, dialog_t *dlg)
     3730static dialog_t *dialog_version(version_t *v, dialog_t *dlg)
    37233731{
    37243732        assert(dlg != NULL);
     
    37303738
    37313739/* Controls specific functions */
    3732 control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev)
     3740static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev)
    37333741{
    37343742        /* Hm... this seems to be jammed in at all time... */
     
    38543862}
    38553863
    3856 name_id_t *convert_ctlclass(name_id_t *cls)
    3857 {
    3858         char *cc;
     3864static name_id_t *convert_ctlclass(name_id_t *cls)
     3865{
     3866        char *cc = NULL;
    38593867        int iclass;
    38603868
     
    38923900
    38933901/* DialogEx specific functions */
    3894 dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg)
     3902static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg)
    38953903{
    38963904        assert(dlg != NULL);
     
    39163924}
    39173925
    3918 dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg)
     3926static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg)
    39193927{
    39203928        assert(dlg != NULL);
     
    39403948}
    39413949
    3942 dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg)
     3950static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg)
    39433951{
    39443952        assert(dlg != NULL);
     
    39493957}
    39503958
    3951 dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg)
     3959static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg)
    39523960{
    39533961        assert(dlg != NULL);
     
    39583966}
    39593967
    3960 dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg)
     3968static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg)
    39613969{
    39623970        assert(dlg != NULL);
     
    39673975}
    39683976
    3969 dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg)
     3977static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg)
    39703978{
    39713979        assert(dlg != NULL);
     
    39763984}
    39773985
    3978 dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg)
     3986static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg)
    39793987{
    39803988        assert(dlg != NULL);
     
    39853993}
    39863994
    3987 dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg)
     3995static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg)
    39883996{
    39893997        assert(dlg != NULL);
     
    39944002}
    39954003
    3996 dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg)
     4004static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg)
    39974005{
    39984006        assert(dlg != NULL);
     
    40044012
    40054013/* Accelerator specific functions */
    4006 event_t *add_event(int key, int id, int flags, event_t *prev)
     4014static event_t *add_event(int key, int id, int flags, event_t *prev)
    40074015{
    40084016        event_t *ev = new_event();
     
    40204028}
    40214029
    4022 event_t *add_string_event(string_t *key, int id, int flags, event_t *prev)
     4030static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev)
    40234031{
    40244032        int keycode = 0;
     
    40284036                yyerror("Key code must be an ascii string");
    40294037
    4030         if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0]) && !isdigit(key->str.cstr[0])))
     4038        if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff)))
    40314039                yyerror("VIRTKEY code is not equal to ascii value");
    40324040
     
    40534061
    40544062/* MenuEx specific functions */
    4055 itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
     4063static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
    40564064{
    40574065        itemex_opt_t *opt = (itemex_opt_t *)xmalloc(sizeof(itemex_opt_t));
     
    40644072
    40654073/* Raw data functions */
    4066 raw_data_t *load_file(string_t *name)
     4074static raw_data_t *load_file(string_t *name)
    40674075{
    40684076        FILE *fp;
     
    40704078        if(name->type != str_char)
    40714079                yyerror("Filename must be ASCII string");
    4072 
    4073         fp = open_include(name->str.cstr, 1);
     4080               
     4081        fp = open_include(name->str.cstr, 1, NULL);
    40744082        if(!fp)
    40754083                yyerror("Cannot open file %s", name->str.cstr);
     
    40814089        fread(rd->data, rd->size, 1, fp);
    40824090        fclose(fp);
    4083         HEAPCHECK();
    40844091        return rd;
    40854092}
    40864093
    4087 raw_data_t *int2raw_data(int i)
     4094static raw_data_t *int2raw_data(int i)
    40884095{
    40894096        raw_data_t *rd;
     
    40954102        rd->size = sizeof(short);
    40964103        rd->data = (char *)xmalloc(rd->size);
    4097         *(short *)(rd->data) = (short)i;
     4104        switch(byteorder)
     4105        {
     4106#ifdef WORDS_BIGENDIAN
     4107        default:
     4108#endif
     4109        case WRC_BO_BIG:
     4110                rd->data[0] = HIBYTE(i);
     4111                rd->data[1] = LOBYTE(i);
     4112                break;
     4113
     4114#ifndef WORDS_BIGENDIAN
     4115        default:
     4116#endif
     4117        case WRC_BO_LITTLE:
     4118                rd->data[1] = HIBYTE(i);
     4119                rd->data[0] = LOBYTE(i);
     4120                break;
     4121        }
    40984122        return rd;
    40994123}
    41004124
    4101 raw_data_t *long2raw_data(int i)
     4125static raw_data_t *long2raw_data(int i)
    41024126{
    41034127        raw_data_t *rd;
     
    41054129        rd->size = sizeof(int);
    41064130        rd->data = (char *)xmalloc(rd->size);
    4107         *(int *)(rd->data) = i;
     4131        switch(byteorder)
     4132        {
     4133#ifdef WORDS_BIGENDIAN
     4134        default:
     4135#endif
     4136        case WRC_BO_BIG:
     4137                rd->data[0] = HIBYTE(HIWORD(i));
     4138                rd->data[1] = LOBYTE(HIWORD(i));
     4139                rd->data[2] = HIBYTE(LOWORD(i));
     4140                rd->data[3] = LOBYTE(LOWORD(i));
     4141                break;
     4142
     4143#ifndef WORDS_BIGENDIAN
     4144        default:
     4145#endif
     4146        case WRC_BO_LITTLE:
     4147                rd->data[3] = HIBYTE(HIWORD(i));
     4148                rd->data[2] = LOBYTE(HIWORD(i));
     4149                rd->data[1] = HIBYTE(LOWORD(i));
     4150                rd->data[0] = LOBYTE(LOWORD(i));
     4151                break;
     4152        }
    41084153        return rd;
    41094154}
    41104155
    4111 raw_data_t *str2raw_data(string_t *str)
     4156static raw_data_t *str2raw_data(string_t *str)
    41124157{
    41134158        raw_data_t *rd;
     
    41154160        rd->size = str->size * (str->type == str_char ? 1 : 2);
    41164161        rd->data = (char *)xmalloc(rd->size);
    4117         memcpy(rd->data, str->str.cstr, rd->size);
     4162        if(str->type == str_char)
     4163                memcpy(rd->data, str->str.cstr, rd->size);
     4164        else if(str->type == str_unicode)
     4165        {
     4166                int i;
     4167                switch(byteorder)
     4168                {
     4169#ifdef WORDS_BIGENDIAN
     4170                default:
     4171#endif
     4172                case WRC_BO_BIG:
     4173                        for(i = 0; i < str->size; i++)
     4174                        {
     4175                                rd->data[2*i + 0] = HIBYTE((WORD)str->str.wstr[i]);
     4176                                rd->data[2*i + 1] = LOBYTE((WORD)str->str.wstr[i]);
     4177                        }
     4178                        break;
     4179#ifndef WORDS_BIGENDIAN
     4180                default:
     4181#endif
     4182                case WRC_BO_LITTLE:
     4183                        for(i = 0; i < str->size; i++)
     4184                        {
     4185                                rd->data[2*i + 1] = HIBYTE((WORD)str->str.wstr[i]);
     4186                                rd->data[2*i + 0] = LOBYTE((WORD)str->str.wstr[i]);
     4187                        }
     4188                        break;
     4189                }
     4190        }
     4191        else
     4192                internal_error(__FILE__, __LINE__, "Invalid stringtype");
    41184193        return rd;
    41194194}
    41204195
    4121 raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2)
     4196static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2)
    41224197{
    41234198        r1->data = xrealloc(r1->data, r1->size + r2->size);
     
    41274202}
    41284203
    4129 raw_data_t *merge_raw_data_int(raw_data_t *r1, int i)
     4204static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i)
    41304205{
    41314206        raw_data_t *t = int2raw_data(i);
     
    41364211}
    41374212
    4138 raw_data_t *merge_raw_data_long(raw_data_t *r1, int i)
     4213static raw_data_t *merge_raw_data_long(raw_data_t *r1, int i)
    41394214{
    41404215        raw_data_t *t = long2raw_data(i);
     
    41454220}
    41464221
    4147 raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str)
     4222static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str)
    41484223{
    41494224        raw_data_t *t = str2raw_data(str);
     
    41554230
    41564231/* Function the go back in a list to get the head */
    4157 menu_item_t *get_item_head(menu_item_t *p)
     4232static menu_item_t *get_item_head(menu_item_t *p)
    41584233{
    41594234        if(!p)
     
    41644239}
    41654240
    4166 menuex_item_t *get_itemex_head(menuex_item_t *p)
     4241static menuex_item_t *get_itemex_head(menuex_item_t *p)
    41674242{
    41684243        if(!p)
     
    41734248}
    41744249
    4175 resource_t *get_resource_head(resource_t *p)
     4250static resource_t *get_resource_head(resource_t *p)
    41764251{
    41774252        if(!p)
     
    41824257}
    41834258
    4184 ver_block_t *get_ver_block_head(ver_block_t *p)
     4259static ver_block_t *get_ver_block_head(ver_block_t *p)
    41854260{
    41864261        if(!p)
     
    41914266}
    41924267
    4193 ver_value_t *get_ver_value_head(ver_value_t *p)
     4268static ver_value_t *get_ver_value_head(ver_value_t *p)
    41944269{
    41954270        if(!p)
     
    42004275}
    42014276
    4202 control_t *get_control_head(control_t *p)
     4277static control_t *get_control_head(control_t *p)
    42034278{
    42044279        if(!p)
     
    42094284}
    42104285
    4211 event_t *get_event_head(event_t *p)
     4286static event_t *get_event_head(event_t *p)
    42124287{
    42134288        if(!p)
     
    42194294
    42204295/* Find a stringtable with given language */
    4221 stringtable_t *find_stringtable(lvc_t *lvc)
     4296static stringtable_t *find_stringtable(lvc_t *lvc)
    42224297{
    42234298        stringtable_t *stt;
     
    42314306        {
    42324307                if(stt->lvc.language->id == lvc->language->id
    4233                 && stt->lvc.language->id == lvc->language->id)
     4308                && stt->lvc.language->sub == lvc->language->sub)
    42344309                {
    42354310                        /* Found a table with the same language */
     
    42554330/* qsort sorting function for string table entries */
    42564331#define STE(p)  ((stt_entry_t *)(p))
    4257 int sort_stt_entry(const void *e1, const void *e2)
     4332static int sort_stt_entry(const void *e1, const void *e2)
    42584333{
    42594334        return STE(e1)->id - STE(e2)->id;
     
    42614336#undef STE
    42624337
    4263 resource_t *build_stt_resources(stringtable_t *stthead)
     4338static resource_t *build_stt_resources(stringtable_t *stthead)
    42644339{
    42654340        stringtable_t *stt;
     
    43594434}
    43604435
    4361 /* Cursor and icon splitter functions */
    4362 typedef struct {
    4363         language_t      lan;
    4364         int             id;
    4365 } id_alloc_t;
    4366 
    4367 static int get_new_id(id_alloc_t **list, int *n, language_t *lan)
    4368 {
    4369         int i;
    4370         assert(lan != NULL);
    4371         assert(list != NULL);
    4372         assert(n != NULL);
    4373 
    4374         if(!*list)
    4375         {
    4376                 *list = (id_alloc_t *)xmalloc(sizeof(id_alloc_t));
    4377                 *n = 1;
    4378                 (*list)[0].lan = *lan;
    4379                 (*list)[0].id = 1;
    4380                 return 1;
    4381         }
    4382 
    4383         for(i = 0; i < *n; i++)
    4384         {
    4385                 if((*list)[i].lan.id == lan->id && (*list)[i].lan.sub == lan->sub)
    4386                         return ++((*list)[i].id);
    4387         }
    4388 
    4389         *list = (id_alloc_t *)xrealloc(*list, sizeof(id_alloc_t) * (*n+1));
    4390         (*list)[*n].lan = *lan;
    4391         (*list)[*n].id = 1;
    4392         *n += 1;
    4393         return 1;
    4394 }
    4395 
    4396 int alloc_icon_id(language_t *lan)
    4397 {
    4398         static id_alloc_t *idlist = NULL;
    4399         static int nid = 0;
    4400 
    4401         return get_new_id(&idlist, &nid, lan);
    4402 }
    4403 
    4404 int alloc_cursor_id(language_t *lan)
    4405 {
    4406         static id_alloc_t *idlist = NULL;
    4407         static int nid = 0;
    4408 
    4409         return get_new_id(&idlist, &nid, lan);
    4410 }
    4411 
    4412 #define BPTR(base)      ((char *)(rd->data + (base)))
    4413 #define WPTR(base)      ((WORD *)(rd->data + (base)))
    4414 #define DPTR(base)      ((DWORD *)(rd->data + (base)))
    4415 void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico)
    4416 {
    4417         int cnt;
    4418         int i;
    4419         icon_dir_entry_t *ide;
    4420         icon_t *ico;
    4421         icon_t *list = NULL;
    4422 
    4423         /* FIXME: Distinguish between normal and animated icons (RIFF format) */
    4424         if(WPTR(0)[1] != 1)
    4425                 yyerror("Icon resource data has invalid type id %d", WPTR(0)[1]);
    4426         cnt = WPTR(0)[2];
    4427         ide = (icon_dir_entry_t *)&(WPTR(0)[3]);
    4428         for(i = 0; i < cnt; i++)
    4429         {
    4430                 ico = new_icon();
    4431                 ico->id = alloc_icon_id(icog->lvc.language);
    4432                 ico->lvc.language = dup_language(icog->lvc.language);
    4433                 if(ide[i].offset > rd->size
    4434                 || ide[i].offset + ide[i].ressize > rd->size)
    4435                         yyerror("Icon resource data corrupt");
    4436                 ico->width = ide[i].width;
    4437                 ico->height = ide[i].height;
    4438                 ico->nclr = ide[i].nclr;
    4439                 ico->planes = ide[i].planes;
    4440                 ico->bits = ide[i].bits;
    4441                 if(!ico->planes)
    4442                 {
    4443                         /* Argh! They did not fill out the resdir structure */
    4444                         ico->planes = ((BITMAPINFOHEADER *)BPTR(ide[i].offset))->biPlanes;
    4445                 }
    4446                 if(!ico->bits)
    4447                 {
    4448                         /* Argh! They did not fill out the resdir structure */
    4449                         ico->bits = ((BITMAPINFOHEADER *)BPTR(ide[i].offset))->biBitCount;
    4450                 }
    4451                 ico->data = new_raw_data();
    4452                 copy_raw_data(ico->data, rd, ide[i].offset, ide[i].ressize);
    4453                 if(!list)
    4454                 {
    4455                         list = ico;
    4456                 }
    4457                 else
    4458                 {
    4459                         ico->next = list;
    4460                         list->prev = ico;
    4461                         list = ico;
    4462                 }
    4463         }
    4464         icog->iconlist = list;
    4465         *nico = cnt;
    4466 }
    4467 
    4468 void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
    4469 {
    4470         int cnt;
    4471         int i;
    4472         cursor_dir_entry_t *cde;
    4473         cursor_t *cur;
    4474         cursor_t *list = NULL;
    4475 
    4476         /* FIXME: Distinguish between normal and animated cursors (RIFF format)*/
    4477         if(WPTR(0)[1] != 2)
    4478                 yyerror("Cursor resource data has invalid type id %d", WPTR(0)[1]);
    4479         cnt = WPTR(0)[2];
    4480         cde = (cursor_dir_entry_t *)&(WPTR(0)[3]);
    4481         for(i = 0; i < cnt; i++)
    4482         {
    4483                 cur = new_cursor();
    4484                 cur->id = alloc_cursor_id(curg->lvc.language);
    4485                 cur->lvc.language = dup_language(curg->lvc.language);
    4486                 if(cde[i].offset > rd->size
    4487                 || cde[i].offset + cde[i].ressize > rd->size)
    4488                         yyerror("Cursor resource data corrupt");
    4489                 cur->width = cde[i].width;
    4490                 cur->height = cde[i].height;
    4491                 cur->nclr = cde[i].nclr;
    4492                 /* The next two are to support color cursors */
    4493                 cur->planes = ((BITMAPINFOHEADER *)BPTR(cde[i].offset))->biPlanes;
    4494                 cur->bits = ((BITMAPINFOHEADER *)BPTR(cde[i].offset))->biBitCount;
    4495                 if(!win32 && (cur->planes != 1 || cur->bits != 1))
    4496                         yywarning("Win16 cursor contains colors");
    4497                 cur->xhot = cde[i].xhot;
    4498                 cur->yhot = cde[i].yhot;
    4499                 cur->data = new_raw_data();
    4500                 copy_raw_data(cur->data, rd, cde[i].offset, cde[i].ressize);
    4501                 if(!list)
    4502                 {
    4503                         list = cur;
    4504                 }
    4505                 else
    4506                 {
    4507                         cur->next = list;
    4508                         list->prev = cur;
    4509                         list = cur;
    4510                 }
    4511         }
    4512         curg->cursorlist = list;
    4513         *ncur = cnt;
    4514 }
    4515 
    4516 #undef  BPTR
    4517 #undef  WPTR
    4518 #undef  DPTR
    4519 
    4520 
    4521 toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec)
     4436
     4437static toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec)
    45224438{
    45234439        idrec->prev = prev;
     
    45284444}
    45294445
    4530 toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems)
     4446static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems)
    45314447{
    45324448        if(!p)
     
    45344450                *nitems = 0;
    45354451                return NULL;
    4536         }
     4452        } 
    45374453
    45384454        *nitems = 1;
     
    45474463}
    45484464
     4465static string_t *make_filename(string_t *str)
     4466{
     4467        char *cptr;
     4468
     4469        if(str->type != str_char)
     4470                yyerror("Cannot handle UNICODE filenames");
     4471
     4472        /* Remove escaped backslash and convert to forward */
     4473        cptr = str->str.cstr;
     4474        for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
     4475        {
     4476                if(cptr[1] == '\\')
     4477                {
     4478                        memmove(cptr, cptr+1, strlen(cptr));
     4479                        str->size--;
     4480                }
     4481                *cptr = '/';
     4482        }
     4483
     4484        /* Convert to lower case. Seems to be reasonable to do */
     4485        for(cptr = str->str.cstr; !leave_case && *cptr; cptr++)
     4486        {
     4487                *cptr = tolower(*cptr);
     4488        }
     4489        return str;
     4490}
     4491
     4492/*
     4493 * Process all resources to extract fonts and build
     4494 * a fontdir resource.
     4495 *
     4496 * Note: MS' resource compiler (build 1472) does not
     4497 * handle font resources with different languages.
     4498 * The fontdir is generated in the last active language
     4499 * and font identifiers must be unique across the entire
     4500 * source.
     4501 * This is not logical considering the localization
     4502 * constraints of all other resource types. MS has,
     4503 * most probably, never testet localized fonts. However,
     4504 * using fontresources is rare, so it might not occur
     4505 * in normal applications.
     4506 * Wine does require better localization because a lot
     4507 * of languages are coded into the same executable.
     4508 * Therefore, I will generate fontdirs for *each*
     4509 * localized set of fonts.
     4510 */
     4511static resource_t *build_fontdir(resource_t **fnt, int nfnt)
     4512{
     4513        static int once = 0;
     4514        if(!once)
     4515        {
     4516                warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)", fnt, nfnt);
     4517                once++;
     4518        }
     4519        return NULL;
     4520}
     4521
     4522static resource_t *build_fontdirs(resource_t *tail)
     4523{
     4524        resource_t *rsc;
     4525        resource_t *lst = NULL;
     4526        resource_t **fnt = NULL;        /* List of all fonts */
     4527        int nfnt = 0;
     4528        resource_t **fnd = NULL;        /* List of all fontdirs */
     4529        int nfnd = 0;
     4530        resource_t **lanfnt = NULL;
     4531        int nlanfnt = 0;
     4532        int i;
     4533        name_id_t nid;
     4534        string_t str;
     4535        int fntleft;
     4536
     4537        nid.type = name_str;
     4538        nid.name.s_name = &str;
     4539        str.type = str_char;
     4540        str.str.cstr = "FONTDIR";
     4541        str.size = 7;
     4542
     4543        /* Extract all fonts and fontdirs */
     4544        for(rsc = tail; rsc; rsc = rsc->prev)
     4545        {
     4546                if(rsc->type == res_fnt)
     4547                {
     4548                        nfnt++;
     4549                        fnt = xrealloc(fnt, nfnt * sizeof(*fnt));
     4550                        fnt[nfnt-1] = rsc;
     4551                }
     4552                else if(rsc->type == res_fntdir)
     4553                {
     4554                        nfnd++;
     4555                        fnd = xrealloc(fnd, nfnd * sizeof(*fnd));
     4556                        fnd[nfnd-1] = rsc;
     4557                }
     4558        }
     4559
     4560        /* Verify the name of the present fontdirs */
     4561        for(i = 0; i < nfnd; i++)
     4562        {
     4563                if(compare_name_id(&nid, fnd[i]->name))
     4564                {
     4565                        warning("User supplied FONTDIR entry has an invalid name '%s', ignored",
     4566                                get_nameid_str(fnd[i]->name));
     4567                        fnd[i] = NULL;
     4568                }
     4569        }
     4570
     4571        /* Sanity check */
     4572        if(nfnt == 0)
     4573        {
     4574                if(nfnd != 0)
     4575                        warning("Found %d FONTDIR entries without any fonts present", nfnd);
     4576                goto clean;
     4577        }
     4578
     4579        /* Copy space */
     4580        lanfnt = xmalloc(nfnt * sizeof(*lanfnt));
     4581
     4582        /* Get all fonts covered by fontdirs */
     4583        for(i = 0; i < nfnd; i++)
     4584        {
     4585                int j;
     4586                WORD cnt;
     4587                int isswapped = 0;
     4588
     4589                if(!fnd[i])
     4590                        continue;
     4591                for(j = 0; j < nfnt; j++)
     4592                {
     4593                        if(!fnt[j])
     4594                                continue;
     4595                        if(fnt[j]->lan->id == fnd[i]->lan->id && fnt[j]->lan->sub == fnd[i]->lan->sub)
     4596                        {
     4597                                lanfnt[nlanfnt] = fnt[j];
     4598                                nlanfnt++;
     4599                                fnt[j] = NULL;
     4600                        }
     4601                }
     4602
     4603                cnt = *(WORD *)fnd[i]->res.fnd->data->data;
     4604                if(nlanfnt == cnt)
     4605                        isswapped = 0;
     4606                else if(nlanfnt == BYTESWAP_WORD(cnt))
     4607                        isswapped = 1;
     4608                else
     4609                        error("FONTDIR for language %d,%d has wrong count (%d, expected %d)",
     4610                                fnd[i]->lan->id, fnd[i]->lan->sub, cnt, nlanfnt);
     4611#ifdef WORDS_BIGENDIAN
     4612                if((byteorder == WRC_BO_LITTLE && !isswapped) || (byteorder != WRC_BO_LITTLE && isswapped))
     4613#else
     4614                if((byteorder == WRC_BO_BIG && !isswapped) || (byteorder != WRC_BO_BIG && isswapped))
     4615#endif
     4616                {
     4617                        internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping");
     4618                }
     4619        }
     4620
     4621        /* We now have fonts left where we need to make a fontdir resource */
     4622        for(i = fntleft = 0; i < nfnt; i++)
     4623        {
     4624                if(fnt[i])
     4625                        fntleft++;
     4626        }
     4627        while(fntleft)
     4628        {
     4629                /* Get fonts of same language in lanfnt[] */
     4630                for(i = nlanfnt = 0; i < nfnt; i++)
     4631                {
     4632                        if(fnt[i])
     4633                        {
     4634                                if(!nlanfnt)
     4635                                {
     4636                        addlanfnt:
     4637                                        lanfnt[nlanfnt] = fnt[i];
     4638                                        nlanfnt++;
     4639                                        fnt[i] = NULL;
     4640                                        fntleft--;
     4641                                }
     4642                                else if(fnt[i]->lan->id == lanfnt[0]->lan->id && fnt[i]->lan->sub == lanfnt[0]->lan->sub)
     4643                                        goto addlanfnt;
     4644                        }
     4645                }
     4646                /* and build a fontdir */
     4647                rsc = build_fontdir(lanfnt, nlanfnt);
     4648                if(rsc)
     4649                {
     4650                        if(lst)
     4651                        {
     4652                                lst->next = rsc;
     4653                                rsc->prev = lst;
     4654                        }
     4655                        lst = rsc;
     4656                }
     4657        }
     4658
     4659        free(lanfnt);
     4660clean:
     4661        if(fnt)
     4662                free(fnt);
     4663        if(fnd)
     4664                free(fnd);
     4665        return lst;
     4666}
     4667
     4668/*
     4669 * This gets invoked to determine whether the next resource
     4670 * is to be of a standard-type (e.g. bitmaps etc.), or should
     4671 * be a user-type resource. This function is required because
     4672 * there is the _possibility_ of a lookahead token in the
     4673 * parser, which is generated from the "expr" state in the
     4674 * "nameid" parsing.
     4675 *
     4676 * The general resource format is:
     4677 * <identifier> <type> <flags> <resourcebody>
     4678 *
     4679 * The <identifier> can either be tIDENT or "expr". The latter
     4680 * will always generate a lookahead, which is the <type> of the
     4681 * resource to parse. Otherwise, we need to get a new token from
     4682 * the scanner to determine the next step.
     4683 *
     4684 * The problem arrises when <type> is numerical. This case should
     4685 * map onto default resource-types and be parsed as such instead
     4686 * of being mapped onto user-type resources.
     4687 *
     4688 * The trick lies in the fact that yacc (bison) doesn't care about
     4689 * intermediate changes of the lookahead while reducing a rule. We
     4690 * simply replace the lookahead with a token that will result in
     4691 * a shift to the appropriate rule for the specific resource-type.
     4692 */
     4693static int rsrcid_to_token(int lookahead)
     4694{
     4695        int token;
     4696        char *type = "?";
     4697
     4698        /* Get a token if we don't have one yet */
     4699        if(lookahead == YYEMPTY)
     4700                lookahead = YYLEX;
     4701
     4702        /* Only numbers are possibly interesting */
     4703        switch(lookahead)
     4704        {
     4705        case tNUMBER:
     4706        case tLNUMBER:
     4707                break;
     4708        default:
     4709                return lookahead;
     4710        }
     4711
     4712        token = lookahead;
     4713
     4714        switch(yylval.num)
     4715        {
     4716        case WRC_RT_CURSOR:
     4717                type = "CURSOR";
     4718                token = tCURSOR;
     4719                break;
     4720        case WRC_RT_ICON:
     4721                type = "ICON";
     4722                token = tICON;
     4723                break;
     4724        case WRC_RT_BITMAP:
     4725                type = "BITMAP";
     4726                token = tBITMAP;
     4727                break;
     4728        case WRC_RT_FONT:
     4729                type = "FONT";
     4730                token = tFONT;
     4731                break;
     4732        case WRC_RT_FONTDIR:
     4733                type = "FONTDIR";
     4734                token = tFONTDIR;
     4735                break;
     4736        case WRC_RT_RCDATA:
     4737                type = "RCDATA";
     4738                token = tRCDATA;
     4739                break;
     4740        case WRC_RT_MESSAGETABLE:
     4741                type = "MESSAGETABLE";
     4742                token = tMESSAGETABLE;
     4743                break;
     4744        case WRC_RT_DLGINIT:
     4745                type = "DLGINIT";
     4746                token = tDLGINIT;
     4747                break;
     4748        case WRC_RT_ACCELERATOR:
     4749                type = "ACCELERATOR";
     4750                token = tACCELERATORS;
     4751                break;
     4752        case WRC_RT_MENU:
     4753                type = "MENU";
     4754                token = tMENU;
     4755                break;
     4756        case WRC_RT_DIALOG:
     4757                type = "DIALOG";
     4758                token = tDIALOG;
     4759                break;
     4760        case WRC_RT_VERSION:
     4761                type = "VERSION";
     4762                token = tVERSIONINFO;
     4763                break;
     4764        case WRC_RT_TOOLBAR:
     4765                type = "TOOLBAR";
     4766                token = tTOOLBAR;
     4767                break;
     4768
     4769        case WRC_RT_STRING:
     4770                type = "STRINGTABLE";
     4771                break;
     4772
     4773        case WRC_RT_ANICURSOR:
     4774        case WRC_RT_ANIICON:
     4775        case WRC_RT_GROUP_CURSOR:
     4776        case WRC_RT_GROUP_ICON:
     4777                yywarning("Usertype uses reserved type-ID %d, which is auto-generated", yylval.num);
     4778                return lookahead;
     4779
     4780        case WRC_RT_DLGINCLUDE:
     4781        case WRC_RT_PLUGPLAY:
     4782        case WRC_RT_VXD:
     4783        case WRC_RT_HTML:
     4784                yywarning("Usertype uses reserved type-ID %d, which is not supported by wrc", yylval.num);
     4785        default:
     4786                return lookahead;
     4787        }
     4788
     4789        if(remap)
     4790                return token;
     4791        else
     4792                yywarning("Usertype uses reserved type-ID %d, which is used by %s", yylval.num, type);
     4793        return lookahead;
     4794}
     4795
  • trunk/tools/wrc/y.tab.h

    r3426 r5523  
    33        int             num;
    44        int             *iptr;
     5        char            *cptr;
    56        resource_t      *res;
    67        accelerator_t   *acc;
    78        bitmap_t        *bmp;
    8         cursor_t        *cur;
    9         cursor_group_t  *curg;
    109        dialog_t        *dlg;
    1110        dialogex_t      *dlgex;
    1211        font_t          *fnt;
    13         icon_t          *ico;
    14         icon_group_t    *icog;
     12        fontdir_t       *fnd;
    1513        menu_t          *men;
    1614        menuex_t        *menex;
     
    4139        style_pair_t    *styles;
    4240        style_t         *style;
     41        ani_any_t       *ani;
    4342} YYSTYPE;
    44 #define tIF     258
    45 #define tIFDEF  259
    46 #define tIFNDEF 260
    47 #define tELSE   261
    48 #define tELIF   262
    49 #define tENDIF  263
    50 #define tDEFINED        264
     43#define tTYPEDEF        258
     44#define tEXTERN 259
     45#define tSTRUCT 260
     46#define tENUM   261
     47#define tCPPCLASS       262
     48#define tINLINE 263
     49#define tSTATIC 264
    5150#define tNL     265
    52 #define tTYPEDEF        266
    53 #define tEXTERN 267
    54 #define NUMBER  268
    55 #define LNUMBER 269
    56 #define tSTRING 270
    57 #define IDENT   271
    58 #define FILENAME        272
    59 #define RAWDATA 273
    60 #define ACCELERATORS    274
    61 #define tBITMAP 275
    62 #define CURSOR  276
    63 #define DIALOG  277
    64 #define DIALOGEX        278
    65 #define MENU    279
    66 #define MENUEX  280
    67 #define MESSAGETABLE    281
    68 #define RCDATA  282
    69 #define VERSIONINFO     283
    70 #define STRINGTABLE     284
    71 #define FONT    285
    72 #define ICON    286
    73 #define AUTO3STATE      287
    74 #define AUTOCHECKBOX    288
    75 #define AUTORADIOBUTTON 289
    76 #define CHECKBOX        290
    77 #define DEFPUSHBUTTON   291
    78 #define PUSHBUTTON      292
    79 #define RADIOBUTTON     293
    80 #define STATE3  294
    81 #define GROUPBOX        295
    82 #define COMBOBOX        296
    83 #define LISTBOX 297
    84 #define SCROLLBAR       298
    85 #define CONTROL 299
    86 #define EDITTEXT        300
    87 #define RTEXT   301
    88 #define CTEXT   302
    89 #define LTEXT   303
    90 #define BLOCK   304
    91 #define VALUE   305
    92 #define SHIFT   306
    93 #define ALT     307
    94 #define ASCII   308
    95 #define VIRTKEY 309
    96 #define GRAYED  310
    97 #define CHECKED 311
    98 #define INACTIVE        312
    99 #define NOINVERT        313
    100 #define tPURE   314
    101 #define IMPURE  315
    102 #define DISCARDABLE     316
    103 #define LOADONCALL      317
    104 #define PRELOAD 318
    105 #define tFIXED  319
    106 #define MOVEABLE        320
    107 #define CLASS   321
    108 #define CAPTION 322
    109 #define CHARACTERISTICS 323
    110 #define EXSTYLE 324
    111 #define STYLE   325
    112 #define VERSION 326
    113 #define LANGUAGE        327
    114 #define FILEVERSION     328
    115 #define PRODUCTVERSION  329
    116 #define FILEFLAGSMASK   330
    117 #define FILEOS  331
    118 #define FILETYPE        332
    119 #define FILEFLAGS       333
    120 #define FILESUBTYPE     334
    121 #define MENUBARBREAK    335
    122 #define MENUBREAK       336
    123 #define MENUITEM        337
    124 #define POPUP   338
    125 #define SEPARATOR       339
    126 #define HELP    340
    127 #define TOOLBAR 341
    128 #define BUTTON  342
    129 #define tBEGIN  343
    130 #define tEND    344
    131 #define DLGINIT 345
    132 #define LOGOR   346
    133 #define LOGAND  347
    134 #define EQ      348
    135 #define NE      349
    136 #define LTE     350
    137 #define GTE     351
    138 #define NOT     352
     51#define tNUMBER 266
     52#define tLNUMBER        267
     53#define tSTRING 268
     54#define tIDENT  269
     55#define tFILENAME       270
     56#define tRAWDATA        271
     57#define tACCELERATORS   272
     58#define tBITMAP 273
     59#define tCURSOR 274
     60#define tDIALOG 275
     61#define tDIALOGEX       276
     62#define tMENU   277
     63#define tMENUEX 278
     64#define tMESSAGETABLE   279
     65#define tRCDATA 280
     66#define tVERSIONINFO    281
     67#define tSTRINGTABLE    282
     68#define tFONT   283
     69#define tFONTDIR        284
     70#define tICON   285
     71#define tAUTO3STATE     286
     72#define tAUTOCHECKBOX   287
     73#define tAUTORADIOBUTTON        288
     74#define tCHECKBOX       289
     75#define tDEFPUSHBUTTON  290
     76#define tPUSHBUTTON     291
     77#define tRADIOBUTTON    292
     78#define tSTATE3 293
     79#define tGROUPBOX       294
     80#define tCOMBOBOX       295
     81#define tLISTBOX        296
     82#define tSCROLLBAR      297
     83#define tCONTROL        298
     84#define tEDITTEXT       299
     85#define tRTEXT  300
     86#define tCTEXT  301
     87#define tLTEXT  302
     88#define tBLOCK  303
     89#define tVALUE  304
     90#define tSHIFT  305
     91#define tALT    306
     92#define tASCII  307
     93#define tVIRTKEY        308
     94#define tGRAYED 309
     95#define tCHECKED        310
     96#define tINACTIVE       311
     97#define tNOINVERT       312
     98#define tPURE   313
     99#define tIMPURE 314
     100#define tDISCARDABLE    315
     101#define tLOADONCALL     316
     102#define tPRELOAD        317
     103#define tFIXED  318
     104#define tMOVEABLE       319
     105#define tCLASS  320
     106#define tCAPTION        321
     107#define tCHARACTERISTICS        322
     108#define tEXSTYLE        323
     109#define tSTYLE  324
     110#define tVERSION        325
     111#define tLANGUAGE       326
     112#define tFILEVERSION    327
     113#define tPRODUCTVERSION 328
     114#define tFILEFLAGSMASK  329
     115#define tFILEOS 330
     116#define tFILETYPE       331
     117#define tFILEFLAGS      332
     118#define tFILESUBTYPE    333
     119#define tMENUBARBREAK   334
     120#define tMENUBREAK      335
     121#define tMENUITEM       336
     122#define tPOPUP  337
     123#define tSEPARATOR      338
     124#define tHELP   339
     125#define tTOOLBAR        340
     126#define tBUTTON 341
     127#define tBEGIN  342
     128#define tEND    343
     129#define tDLGINIT        344
     130#define tNOT    345
     131#define pUPM    346
    139132
    140133
Note: See TracChangeset for help on using the changeset viewer.