Author: fireball Date: Sat Dec 1 18:56:03 2007 New Revision: 30932
URL: http://svn.reactos.org/svn/reactos?rev=30932&view=rev Log: - Sync with Wine.
Modified: trunk/reactos/tools/wmc/lang.c trunk/reactos/tools/wmc/lang.h trunk/reactos/tools/wmc/mcl.c trunk/reactos/tools/wmc/mcy.tab.c trunk/reactos/tools/wmc/mcy.tab.h trunk/reactos/tools/wmc/mcy.y trunk/reactos/tools/wmc/utils.c trunk/reactos/tools/wmc/utils.h trunk/reactos/tools/wmc/wmc.c trunk/reactos/tools/wmc/wmc.h trunk/reactos/tools/wmc/wmctypes.h trunk/reactos/tools/wmc/write.c trunk/reactos/tools/wmc/write.h
Modified: trunk/reactos/tools/wmc/lang.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/lang.c?rev=30932&... ============================================================================== --- trunk/reactos/tools/wmc/lang.c (original) +++ trunk/reactos/tools/wmc/lang.c Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdio.h> #include <stdlib.h> @@ -33,7 +33,47 @@ */ static const language_t languages[] = {
- {0x0000, 437, 1252, "Neutral", "Neutral"}, + {0x0000, 437, 1252, "Neutral", NULL}, + {0x0002, 866, 1251, "Bulgarian", NULL}, + {0x0003, 850, 1252, "Catalan", NULL}, + {0x0005, 852, 1250, "Czech", NULL}, + {0x0006, 850, 1252, "Danish", NULL}, + {0x0007, 850, 1252, "German", NULL}, + {0x0008, 737, 1253, "Greek", NULL}, + {0x0009, 437, 1252, "English", NULL}, + {0x000A, 850, 1252, "Spanish - Traditional Sort", NULL}, + {0x000B, 850, 1252, "Finnish", NULL}, + {0x000C, 850, 1252, "French", NULL}, + {0x000E, 852, 1250, "Hungarian", NULL}, + {0x000F, 850, 1252, "Icelandic", NULL}, + {0x0010, 850, 1252, "Italian", NULL}, + {0x0011, 932, 932, "Japanese", NULL}, + {0x0012, 949, 949, "Korean", NULL}, + {0x0013, 850, 1252, "Dutch", NULL}, + {0x0014, 850, 1252, "Norwegian (Bokmål)", NULL}, + {0x0015, 852, 1250, "Polish", NULL}, + {0x0016, 850, 1252, "Portuguese", NULL}, + {0x0018, 852, 1250, "Romanian", NULL}, + {0x0019, 866, 1251, "Russian", NULL}, + {0x001A, 852, 1250, "Serbian", NULL}, + {0x001B, 852, 1250, "Slovak", NULL}, + {0x001C, 852, 1250, "Albanian", NULL}, + {0x001D, 850, 1252, "Swedish", NULL}, + {0x001F, 857, 1254, "Turkish", NULL}, + {0x0021, 850, 1252, "Indonesian", NULL}, + {0x0022, 866, 1251, "Ukrainian", NULL}, + {0x0023, 866, 1251, "Belarusian", NULL}, + {0x0024, 852, 1250, "Slovene", NULL}, + {0x0025, 775, 1257, "Estonian", NULL}, + {0x0026, 775, 1257, "Latvian", NULL}, + {0x0027, 775, 1257, "Lithuanian", NULL}, + {0x002A,1258, 1258, "Vietnamese", NULL}, + {0x002D, 850, 1252, "Basque", NULL}, + {0x002F, 866, 1251, "Macedonian", NULL}, + {0x0036, 850, 1252, "Afrikaans", NULL}, + {0x0038, 852, 1252, "Faroese", NULL}, + {0x003C, 437, 1252, "Irish", NULL}, + {0x003E, 850, 1252, "Malay", NULL}, {0x0402, 866, 1251, "Bulgarian", "Bulgaria"}, {0x0403, 850, 1252, "Catalan", "Spain"}, {0x0405, 852, 1250, "Czech", "Czech Republic"}, @@ -67,11 +107,11 @@ {0x0425, 775, 1257, "Estonian", "Estonia"}, {0x0426, 775, 1257, "Latvian", "Latvia"}, {0x0427, 775, 1257, "Lithuanian", "Lithuania"}, -/* {0x042A, ?, ?, "Vietnamese", "Vietnam"},*/ + {0x042A,1258, 1258, "Vietnamese", "Vietnam"}, {0x042D, 850, 1252, "Basque", "Spain"}, {0x042F, 866, 1251, "Macedonian", "Former Yugoslav Republic of Macedonia"}, {0x0436, 850, 1252, "Afrikaans", "South Africa"}, -/* {0x0438, 852, 1252, "Faroese", "Faroe Islands"}, FIXME: Not sure about codepages */ + {0x0438, 852, 1252, "Faroese", "Faroe Islands"}, {0x043C, 437, 1252, "Irish", "Ireland"}, {0x043E, 850, 1252, "Malay", "Malaysia"}, /* {0x048F, ?, ?, "Esperanto", "<none>"},*/ @@ -84,7 +124,7 @@ {0x0813, 850, 1252, "Dutch", "Belgium"}, {0x0814, 850, 1252, "Norwegian (Nynorsk)", "Norway"}, {0x0816, 850, 1252, "Portuguese", "Portugal"}, -/* {0x081A, ?, ?, "Serbian (latin)", "Yugoslavia"},*/ + {0x081A, 852, 1250, "Serbian (latin)", "Yugoslavia"}, {0x081D, 850, 1252, "Swedish (Finland)", "Finland"}, {0x0C07, 850, 1252, "German", "Austria"}, {0x0C09, 850, 1252, "English", "Australia"}, @@ -135,7 +175,7 @@ languages[i].doscp, languages[i].wincp, languages[i].name, - languages[i].country); + languages[i].country ? languages[i].country : "Neutral"); }
static int langcmp(const void *p1, const void *p2)
Modified: trunk/reactos/tools/wmc/lang.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/lang.h?rev=30932&... ============================================================================== --- trunk/reactos/tools/wmc/lang.h (original) +++ trunk/reactos/tools/wmc/lang.h Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef __WMC_LANG_H
Modified: trunk/reactos/tools/wmc/mcl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/mcl.c?rev=30932&a... ============================================================================== --- trunk/reactos/tools/wmc/mcl.c (original) +++ trunk/reactos/tools/wmc/mcl.c Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include "config.h" @@ -74,25 +74,25 @@ * The 'Codepages' keyword is a wmc extension. */
-static WCHAR ustr_application[] = { 'A', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', 0 }; -static WCHAR ustr_codepages[] = { 'C', 'o', 'd', 'e', 'p', 'a', 'g', 'e', 's', 0 }; -static WCHAR ustr_english[] = { 'E', 'n', 'g', 'l', 'i', 's', 'h', 0 }; -static WCHAR ustr_error[] = { 'E', 'r', 'r', 'o', 'r', 0 }; -static WCHAR ustr_facility[] = { 'F', 'a', 'c', 'i', 'l', 'i', 't', 'y', 0 }; -static WCHAR ustr_facilitynames[] = { 'F', 'a', 'c', 'i', 'l', 'i', 't', 'y', 'N', 'a', 'm', 'e', 's', 0 }; -static WCHAR ustr_informational[] = { 'I', 'n', 'f', 'o', 'r', 'm', 'a', 't', 'i', 'o', 'n', 'a', 'l', 0 }; -static WCHAR ustr_language[] = { 'L', 'a', 'n', 'g', 'u', 'a', 'g', 'e', 0}; -static WCHAR ustr_languagenames[] = { 'L', 'a', 'n', 'g', 'u', 'a', 'g', 'e', 'N', 'a', 'm', 'e', 's', 0}; -static WCHAR ustr_messageid[] = { 'M', 'e', 's', 's', 'a', 'g', 'e', 'I', 'd', 0 }; -static WCHAR ustr_messageidtypedef[] = { 'M', 'e', 's', 's', 'a', 'g', 'e', 'I', 'd', 'T', 'y', 'p', 'e', 'd', 'e', 'f', 0 }; -static WCHAR ustr_outputbase[] = { 'O', 'u', 't', 'p', 'u', 't', 'B', 'a', 's', 'e', 0 }; -static WCHAR ustr_severity[] = { 'S', 'e', 'v', 'e', 'r', 'i', 't', 'y', 0 }; -static WCHAR ustr_severitynames[] = { 'S', 'e', 'v', 'e', 'r', 'i', 't', 'y', 'N', 'a', 'm', 'e', 's', 0 }; -static WCHAR ustr_success[] = { 'S', 'u', 'c', 'c', 'e', 's', 's', 0 }; -static WCHAR ustr_symbolicname[] = { 'S', 'y', 'm', 'b', 'o', 'l', 'i', 'c', 'N', 'a', 'm', 'e', 0 }; -static WCHAR ustr_system[] = { 'S', 'y', 's', 't', 'e', 'm', 0 }; -static WCHAR ustr_warning[] = { 'W', 'a', 'r', 'n', 'i', 'n', 'g', 0 }; -static WCHAR ustr_msg00001[] = { 'm', 's', 'g', '0', '0', '0', '0', '1', 0 }; +static const WCHAR ustr_application[] = { 'A', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', 0 }; +static const WCHAR ustr_codepages[] = { 'C', 'o', 'd', 'e', 'p', 'a', 'g', 'e', 's', 0 }; +static const WCHAR ustr_english[] = { 'E', 'n', 'g', 'l', 'i', 's', 'h', 0 }; +static const WCHAR ustr_error[] = { 'E', 'r', 'r', 'o', 'r', 0 }; +static const WCHAR ustr_facility[] = { 'F', 'a', 'c', 'i', 'l', 'i', 't', 'y', 0 }; +static const WCHAR ustr_facilitynames[] = { 'F', 'a', 'c', 'i', 'l', 'i', 't', 'y', 'N', 'a', 'm', 'e', 's', 0 }; +static const WCHAR ustr_informational[] = { 'I', 'n', 'f', 'o', 'r', 'm', 'a', 't', 'i', 'o', 'n', 'a', 'l', 0 }; +static const WCHAR ustr_language[] = { 'L', 'a', 'n', 'g', 'u', 'a', 'g', 'e', 0}; +static const WCHAR ustr_languagenames[] = { 'L', 'a', 'n', 'g', 'u', 'a', 'g', 'e', 'N', 'a', 'm', 'e', 's', 0}; +static const WCHAR ustr_messageid[] = { 'M', 'e', 's', 's', 'a', 'g', 'e', 'I', 'd', 0 }; +static const WCHAR ustr_messageidtypedef[] = { 'M', 'e', 's', 's', 'a', 'g', 'e', 'I', 'd', 'T', 'y', 'p', 'e', 'd', 'e', 'f', 0 }; +static const WCHAR ustr_outputbase[] = { 'O', 'u', 't', 'p', 'u', 't', 'B', 'a', 's', 'e', 0 }; +static const WCHAR ustr_severity[] = { 'S', 'e', 'v', 'e', 'r', 'i', 't', 'y', 0 }; +static const WCHAR ustr_severitynames[] = { 'S', 'e', 'v', 'e', 'r', 'i', 't', 'y', 'N', 'a', 'm', 'e', 's', 0 }; +static const WCHAR ustr_success[] = { 'S', 'u', 'c', 'c', 'e', 's', 's', 0 }; +static const WCHAR ustr_symbolicname[] = { 'S', 'y', 'm', 'b', 'o', 'l', 'i', 'c', 'N', 'a', 'm', 'e', 0 }; +static const WCHAR ustr_system[] = { 'S', 'y', 's', 't', 'e', 'm', 0 }; +static const WCHAR ustr_warning[] = { 'W', 'a', 'r', 'n', 'i', 'n', 'g', 0 }; +static const WCHAR ustr_msg00001[] = { 'm', 's', 'g', '0', '0', '0', '0', '1', 0 }; /* * This table is to beat any form of "expression building" to check for * correct filename characters. It is also used for ident checks. @@ -156,7 +156,7 @@ codepage = cp; codepage_def = find_codepage(codepage); if(!codepage_def) - xyyerror("Codepage %d not found; cannot process", codepage); + xyyerror("Codepage %d not found; cannot process\n", codepage); }
/* @@ -187,7 +187,7 @@
if(!inputbuffer) { - inputbuffer = xmalloc(INPUTBUFFER_SIZE); + inputbuffer = xmalloc(INPUTBUFFER_SIZE*sizeof(WCHAR)); xlatebuffer = xmalloc(INPUTBUFFER_SIZE); }
@@ -203,7 +203,7 @@ assert(codepage_def != NULL); n = wine_cp_mbstowcs(codepage_def, 0, xlatebuffer, strlen(xlatebuffer)+1, inputbuffer, INPUTBUFFER_SIZE); if(n < 0) - internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)", n); + internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)\n", n); if(n <= 1) goto try_again; /* Should not hapen */ n--; /* Strip added conversion '\0' from input length */ @@ -224,7 +224,7 @@ if(!n && ferror(yyin)) xyyerror(err_fatalread); else - xyyerror("Fatal: file to short to determine byteorder (should never happen)"); + xyyerror("Fatal: file to short to determine byteorder (should never happen)\n"); } if(isisochar(inputbuffer[0]) && isisochar(inputbuffer[1]) && @@ -249,7 +249,7 @@ #endif } else - xyyerror("Fatal: cannot determine file's byteorder"); + xyyerror("Fatal: cannot determine file's byteorder\n"); /* FIXME: * Determine the file-endian with the leader-bytes * "FF FE..."; can't remember the exact sequence. @@ -302,7 +302,7 @@
if(!n) { - yywarning("Re-read line (input was or converted to zilch)"); + mcy_warning("Re-read line (input was or converted to zilch)\n"); goto try_again; /* Should not happen, but could be due to stdin reading and a signal */ }
@@ -458,7 +458,7 @@ while(1) { if(!isisochar(ch)) - xyyerror("Invalid digit"); + xyyerror("Invalid digit\n");
switch(state) { @@ -472,7 +472,7 @@ state = 4; } else - internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state"); + internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state\n"); break; case 1: if(ch == 'x' || ch == 'X') @@ -486,11 +486,11 @@ state = 3; } else if(isalpha(ch) || ch == '_') - xyyerror("Invalid number digit"); + xyyerror("Invalid number digit\n"); else { unget_unichar(ch); - yylval.num = 0; + mcy_lval.num = 0; return tNUMBER; } break; @@ -498,7 +498,7 @@ if(isxdigit(ch)) push_char(ch); else if(isalpha(ch) || ch == '_' || !isxdigit(tos_char_stack())) - xyyerror("Invalid hex digit"); + xyyerror("Invalid hex digit\n"); else { base = 16; @@ -509,7 +509,7 @@ if(ch >= '0' && ch <= '7') push_char(ch); else if(isalnum(ch) || ch == '_') - xyyerror("Invalid octal digit"); + xyyerror("Invalid octal digit\n"); else { base = 8; @@ -520,7 +520,7 @@ if(isdigit(ch)) push_char(ch); else if(isalnum(ch) || ch == '_') - xyyerror("Invalid decimal digit"); + xyyerror("Invalid decimal digit\n"); else { base = 10; @@ -528,14 +528,14 @@ } break; default: - internal_error(__FILE__, __LINE__, "Invalid state in number-scanner"); + internal_error(__FILE__, __LINE__, "Invalid state in number-scanner\n"); } ch = get_unichar(); } finish: unget_unichar(ch); push_char(0); - yylval.num = strtoul(get_char_stack(), NULL, base); + mcy_lval.num = strtoul(get_char_stack(), NULL, base); return tNUMBER; }
@@ -586,7 +586,7 @@ * The scanner * */ -int yylex(void) +int mcy_lex(void) { static const WCHAR ustr_dot1[] = { '.', '\n', 0 }; static const WCHAR ustr_dot2[] = { '.', '\r', '\n', 0 }; @@ -626,7 +626,7 @@ while((ch = get_unichar()) != '\n') { if(ch == EOF) - xyyerror("Unexpected EOF"); + xyyerror("Unexpected EOF\n"); push_unichar(ch); } newline(); @@ -639,7 +639,7 @@ set_codepage(WMC_DEFAULT_CODEPAGE); return tMSGEND; } - yylval.str = xunistrdup(get_unichar_stack()); + mcy_lval.str = xunistrdup(get_unichar_stack()); return tLINE; }
@@ -677,7 +677,7 @@ unget_unichar(ch); push_unichar(0); want_file = 0; - yylval.str = xunistrdup(get_unichar_stack()); + mcy_lval.str = xunistrdup(get_unichar_stack()); return tFILE; }
@@ -693,7 +693,7 @@ push_unichar(0); if(!(tok = lookup_token(get_unichar_stack()))) { - yylval.str = xunistrdup(get_unichar_stack()); + mcy_lval.str = xunistrdup(get_unichar_stack()); return tIDENT; } switch(tok->type) @@ -706,11 +706,11 @@ /* Fall through */ case tok_severity: case tok_facility: - yylval.tok = tok; + mcy_lval.tok = tok; return tTOKEN;
default: - internal_error(__FILE__, __LINE__, "Invalid token type encountered"); + internal_error(__FILE__, __LINE__, "Invalid token type encountered\n"); } }
@@ -738,10 +738,10 @@ newline(); push_unichar(ch); /* Include the newline */ push_unichar(0); - yylval.str = xunistrdup(get_unichar_stack()); + mcy_lval.str = xunistrdup(get_unichar_stack()); return tCOMMENT; default: - xyyerror("Invalid character '%c' (0x%04x)", isisochar(ch) && isprint(ch) ? ch : '.', ch); + xyyerror("Invalid character '%c' (0x%04x)\n", isisochar(ch) && isprint(ch) ? ch : '.', ch); } } }
Modified: trunk/reactos/tools/wmc/mcy.tab.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/mcy.tab.c?rev=309... ============================================================================== --- trunk/reactos/tools/wmc/mcy.tab.c (original) +++ trunk/reactos/tools/wmc/mcy.tab.c Sat Dec 1 18:56:03 2007 @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -36,6 +36,9 @@ /* Identify Bison output. */ #define YYBISON 1
+/* Bison version. */ +#define YYBISON_VERSION "2.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c"
@@ -45,6 +48,14 @@ /* Using locations. */ #define YYLSP_NEEDED 0
+/* Substitute the variable and function names. */ +#define yyparse mcy_parse +#define yylex mcy_lex +#define yyerror mcy_error +#define yylval mcy_lval +#define yychar mcy_char +#define yydebug mcy_debug +#define yynerrs mcy_nerrs
/* Tokens. */ @@ -74,6 +85,7 @@ tTOKEN = 276 }; #endif +/* Tokens. */ #define tSEVNAMES 258 #define tFACNAMES 259 #define tLANNAMES 260 @@ -160,7 +172,7 @@
/* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG 1 +# define YYDEBUG 0 #endif
/* Enabling verbose error messages. */ @@ -171,8 +183,13 @@ # define YYERROR_VERBOSE 0 #endif
+/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 99 "tools/wmc/mcy.y" +#line 98 "tools/wmc/mcy.y" typedef union YYSTYPE { WCHAR *str; unsigned num; @@ -181,8 +198,8 @@ msg_t *msg; lan_cp_t lcp; } YYSTYPE; -/* Line 191 of yacc.c. */ -#line 186 "tools/wmc/mcy.tab.c" +/* Line 196 of yacc.c. */ +#line 203 "mcy.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -193,30 +210,49 @@ /* Copy the second part of user declarations. */
-/* Line 214 of yacc.c. */ -#line 198 "tools/wmc/mcy.tab.c" +/* Line 219 of yacc.c. */ +#line 215 "mcy.tab.c" + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif
#if ! defined (yyoverflow) || YYERROR_VERBOSE - -# ifndef YYFREE -# define YYFREE free -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# endif
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif # endif # endif # endif @@ -224,13 +260,39 @@ # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# endif # else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
@@ -242,7 +304,7 @@ /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; };
@@ -252,7 +314,7 @@ /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do @@ -265,7 +327,7 @@ # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -294,7 +356,7 @@ #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif
/* YYFINAL -- State number of the termination state. */ @@ -315,7 +377,7 @@ #define YYUNDEFTOK 2 #define YYMAXUTOK 276
-#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -354,7 +416,7 @@ #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 7, 10, 12, 14, 16, 18, 24, 30, 34, 37, 43, 49, 53, 56, 62, 68, @@ -411,24 +473,24 @@ };
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = -{ - 0, 124, 124, 131, 132, 135, 136, 137, 138, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 172, - 173, 179, 180, 181, 184, 191, 192, 198, 199, 200, - 203, 210, 211, 214, 215, 216, 222, 223, 224, 227, - 235, 236, 237, 238, 241, 242, 243, 249, 250, 251, - 254, 264, 265, 266, 267, 270, 271, 281, 281, 284, - 289, 292, 293, 294, 295, 298, 299, 300, 301, 304, - 305, 306, 309, 317, 318, 321, 329, 330, 336, 337, - 338, 341, 349, 378, 379, 380, 383, 384, 385, 386, - 392, 393, 396, 399, 402 +static const unsigned short int yyrline[] = +{ + 0, 123, 123, 130, 131, 134, 135, 136, 137, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 171, + 172, 178, 179, 180, 183, 190, 191, 197, 198, 199, + 202, 209, 210, 213, 214, 215, 221, 222, 223, 226, + 234, 235, 236, 237, 240, 241, 242, 248, 249, 250, + 253, 263, 264, 265, 266, 269, 270, 280, 280, 283, + 288, 291, 292, 293, 294, 297, 298, 299, 300, 303, + 304, 305, 308, 316, 317, 320, 328, 329, 335, 336, + 337, 340, 348, 377, 378, 379, 382, 383, 384, 385, + 391, 392, 395, 398, 401 }; #endif
-#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -447,7 +509,7 @@ # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -511,7 +573,7 @@ };
/* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +static const short int yydefgoto[] = { -1, 10, 11, 12, 13, 58, 59, 62, 63, 131, 66, 67, 152, 72, 73, 74, 14, 51, 15, 47, @@ -522,7 +584,7 @@ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -37 -static const short yypact[] = +static const short int yypact[] = { 132, -37, 18, 44, 46, 47, 48, 49, 50, -37, 10, 113, -37, -37, -37, -37, -37, 11, -37, 14, @@ -556,7 +618,7 @@ number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -105 -static const short yytable[] = +static const short int yytable[] = { 64, 133, 68, 135, 83, 149, 147, 45, 88, 93, 30, 84, 33, 46, 148, 35, 103, 84, 98, 16, @@ -620,22 +682,6 @@ 18, 25, 39, 1, 20 };
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -665,25 +711,58 @@ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0)
+ #define YYTERROR 1 #define YYERRCODE 256
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ - + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) -#endif +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif +
/* YYLEX -- calling `yylex' with the right arguments. */
@@ -707,19 +786,13 @@ YYFPRINTF Args; \ } while (0)
-# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ + yysymprint (stderr, \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -731,12 +804,12 @@
#if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -766,13 +839,13 @@ #endif { int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); }
# define YY_REDUCE_PRINT(Rule) \ @@ -786,8 +859,7 @@ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -802,12 +874,8 @@ if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ - -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif
#ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 @@ -830,7 +898,7 @@ const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr;
while (*yys++ != '\0') continue; @@ -855,8 +923,8 @@ const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0') continue; @@ -866,7 +934,55 @@ # endif # endif
-#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case ''': + case ',': + goto do_not_strip_quotes; + + case '\': + if (*++yyp != '\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */
@@ -890,15 +1006,15 @@ (void) yyvaluep;
if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -914,16 +1030,21 @@
#if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype) { @@ -952,10 +1073,10 @@
-/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar;
-/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval;
/* Number of syntax errors so far. */ @@ -981,17 +1102,17 @@ #else int yyparse () - -#endif -#endif -{ - - register int yystate; - register int yyn; + ; +#endif +#endif +{ + + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0;
/* Three stacks and their tools: @@ -1003,14 +1124,14 @@ to reallocate them elsewhere. */
/* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp;
/* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp;
@@ -1067,14 +1188,14 @@ these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp),
@@ -1085,21 +1206,21 @@ } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH;
{ - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs);
@@ -1131,18 +1252,18 @@ yybackup:
/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */
- /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */
yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault;
- /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1157,7 +1278,7 @@ else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); }
/* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1177,8 +1298,8 @@ if (yyn == YYFINAL) YYACCEPT;
- /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1228,457 +1349,457 @@ switch (yyn) { case 2: -#line 124 "tools/wmc/mcy.y" +#line 123 "tools/wmc/mcy.y" { if(!check_languages(nodehead)) - xyyerror("No messages defined"); + xyyerror("No messages defined\n"); lanblockhead = block_messages(nodehead); ;} break;
case 6: +#line 135 "tools/wmc/mcy.y" + { add_node(nd_msg, (yyvsp[0].msg)); ;} + break; + + case 7: #line 136 "tools/wmc/mcy.y" - { add_node(nd_msg, yyvsp[0].msg); ;} - break; - - case 7: + { add_node(nd_comment, (yyvsp[0].str)); ;} + break; + + case 8: #line 137 "tools/wmc/mcy.y" - { add_node(nd_comment, yyvsp[0].str); ;} - break; - - case 8: -#line 138 "tools/wmc/mcy.y" { xyyerror(err_syntax); /* `Catch all' error */ ;} break;
case 10: +#line 141 "tools/wmc/mcy.y" + { xyyerror(err_pclose); ;} + break; + + case 11: #line 142 "tools/wmc/mcy.y" + { xyyerror(err_popen); ;} + break; + + case 12: +#line 143 "tools/wmc/mcy.y" + { xyyerror(err_assign); ;} + break; + + case 14: +#line 145 "tools/wmc/mcy.y" { xyyerror(err_pclose); ;} break;
- case 11: -#line 143 "tools/wmc/mcy.y" + case 15: +#line 146 "tools/wmc/mcy.y" { xyyerror(err_popen); ;} break;
- case 12: -#line 144 "tools/wmc/mcy.y" + case 16: +#line 147 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 14: -#line 146 "tools/wmc/mcy.y" + case 18: +#line 149 "tools/wmc/mcy.y" { xyyerror(err_pclose); ;} break;
- case 15: -#line 147 "tools/wmc/mcy.y" + case 19: +#line 150 "tools/wmc/mcy.y" { xyyerror(err_popen); ;} break;
- case 16: -#line 148 "tools/wmc/mcy.y" + case 20: +#line 151 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 18: -#line 150 "tools/wmc/mcy.y" + case 22: +#line 153 "tools/wmc/mcy.y" { xyyerror(err_pclose); ;} break;
- case 19: -#line 151 "tools/wmc/mcy.y" + case 23: +#line 154 "tools/wmc/mcy.y" { xyyerror(err_popen); ;} break;
- case 20: -#line 152 "tools/wmc/mcy.y" + case 24: +#line 155 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 22: -#line 154 "tools/wmc/mcy.y" - { xyyerror(err_pclose); ;} - break; - - case 23: -#line 155 "tools/wmc/mcy.y" - { xyyerror(err_popen); ;} - break; - - case 24: + case 25: #line 156 "tools/wmc/mcy.y" + { cast = (yyvsp[0].str); ;} + break; + + case 26: +#line 157 "tools/wmc/mcy.y" + { xyyerror(err_number); ;} + break; + + case 27: +#line 158 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 25: -#line 157 "tools/wmc/mcy.y" - { cast = yyvsp[0].str; ;} - break; - - case 26: -#line 158 "tools/wmc/mcy.y" - { xyyerror(err_number); ;} - break; - - case 27: + case 28: #line 159 "tools/wmc/mcy.y" - { xyyerror(err_assign); ;} - break; - - case 28: -#line 160 "tools/wmc/mcy.y" { switch(base) { case 8: case 10: case 16: - base = yyvsp[0].num; + base = (yyvsp[0].num); break; default: - xyyerror("Numberbase must be 8, 10 or 16"); + xyyerror("Numberbase must be 8, 10 or 16\n"); } ;} break;
case 29: +#line 171 "tools/wmc/mcy.y" + { xyyerror(err_number); ;} + break; + + case 30: #line 172 "tools/wmc/mcy.y" + { xyyerror(err_assign); ;} + break; + + case 33: +#line 180 "tools/wmc/mcy.y" + { xyyerror(err_ident); ;} + break; + + case 34: +#line 183 "tools/wmc/mcy.y" + { + (yyvsp[-3].tok)->token = (yyvsp[-1].num); + (yyvsp[-3].tok)->alias = (yyvsp[0].str); + if((yyvsp[-1].num) & (~0x3)) + xyyerror("Severity value out of range (0x%08x > 0x3)\n", (yyvsp[-1].num)); + do_add_token(tok_severity, (yyvsp[-3].tok), "severity"); + ;} + break; + + case 35: +#line 190 "tools/wmc/mcy.y" { xyyerror(err_number); ;} break;
- case 30: -#line 173 "tools/wmc/mcy.y" + case 36: +#line 191 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 33: -#line 181 "tools/wmc/mcy.y" + case 39: +#line 199 "tools/wmc/mcy.y" { xyyerror(err_ident); ;} break;
- case 34: -#line 184 "tools/wmc/mcy.y" + case 40: +#line 202 "tools/wmc/mcy.y" { - yyvsp[-3].tok->token = yyvsp[-1].num; - yyvsp[-3].tok->alias = yyvsp[0].str; - if(yyvsp[-1].num & (~0x3)) - xyyerror("Severity value out of range (0x%08x > 0x3)", yyvsp[-1].num); - do_add_token(tok_severity, yyvsp[-3].tok, "severity"); + (yyvsp[-3].tok)->token = (yyvsp[-1].num); + (yyvsp[-3].tok)->alias = (yyvsp[0].str); + if((yyvsp[-1].num) & (~0xfff)) + xyyerror("Facility value out of range (0x%08x > 0xfff)\n", (yyvsp[-1].num)); + do_add_token(tok_facility, (yyvsp[-3].tok), "facility"); ;} break;
- case 35: -#line 191 "tools/wmc/mcy.y" + case 41: +#line 209 "tools/wmc/mcy.y" { xyyerror(err_number); ;} break;
- case 36: -#line 192 "tools/wmc/mcy.y" + case 42: +#line 210 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 39: -#line 200 "tools/wmc/mcy.y" + case 43: +#line 213 "tools/wmc/mcy.y" + { (yyval.str) = NULL; ;} + break; + + case 44: +#line 214 "tools/wmc/mcy.y" + { (yyval.str) = (yyvsp[0].str); ;} + break; + + case 45: +#line 215 "tools/wmc/mcy.y" { xyyerror(err_ident); ;} break;
- case 40: -#line 203 "tools/wmc/mcy.y" + case 48: +#line 223 "tools/wmc/mcy.y" + { xyyerror(err_ident); ;} + break; + + case 49: +#line 226 "tools/wmc/mcy.y" { - yyvsp[-3].tok->token = yyvsp[-1].num; - yyvsp[-3].tok->alias = yyvsp[0].str; - if(yyvsp[-1].num & (~0xfff)) - xyyerror("Facility value out of range (0x%08x > 0xfff)", yyvsp[-1].num); - do_add_token(tok_facility, yyvsp[-3].tok, "facility"); + (yyvsp[-6].tok)->token = (yyvsp[-4].num); + (yyvsp[-6].tok)->alias = (yyvsp[-1].str); + (yyvsp[-6].tok)->codepage = (yyvsp[0].num); + do_add_token(tok_language, (yyvsp[-6].tok), "language"); + if(!find_language((yyvsp[-4].num)) && !find_cpxlat((yyvsp[-4].num))) + mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override\n", (yyvsp[-4].num), WMC_DEFAULT_CODEPAGE); ;} break;
- case 41: -#line 210 "tools/wmc/mcy.y" + case 50: +#line 234 "tools/wmc/mcy.y" + { xyyerror("Filename expected\n"); ;} + break; + + case 51: +#line 235 "tools/wmc/mcy.y" + { xyyerror(err_colon); ;} + break; + + case 52: +#line 236 "tools/wmc/mcy.y" { xyyerror(err_number); ;} break;
- case 42: -#line 211 "tools/wmc/mcy.y" + case 53: +#line 237 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 43: -#line 214 "tools/wmc/mcy.y" - { yyval.str = NULL; ;} - break; - - case 44: -#line 215 "tools/wmc/mcy.y" - { yyval.str = yyvsp[0].str; ;} - break; - - case 45: -#line 216 "tools/wmc/mcy.y" + case 54: +#line 240 "tools/wmc/mcy.y" + { (yyval.num) = 0; ;} + break; + + case 55: +#line 241 "tools/wmc/mcy.y" + { (yyval.num) = (yyvsp[0].num); ;} + break; + + case 56: +#line 242 "tools/wmc/mcy.y" + { xyyerror("Codepage-number expected\n"); ;} + break; + + case 59: +#line 250 "tools/wmc/mcy.y" { xyyerror(err_ident); ;} break;
- case 48: -#line 224 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - - case 49: -#line 227 "tools/wmc/mcy.y" - { - yyvsp[-6].tok->token = yyvsp[-4].num; - yyvsp[-6].tok->alias = yyvsp[-1].str; - yyvsp[-6].tok->codepage = yyvsp[0].num; - do_add_token(tok_language, yyvsp[-6].tok, "language"); - if(!find_language(yyvsp[-4].num) && !find_cpxlat(yyvsp[-4].num)) - yywarning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", yyvsp[-4].num, WMC_DEFAULT_CODEPAGE); - ;} - break; - - case 50: -#line 235 "tools/wmc/mcy.y" - { xyyerror("Filename expected"); ;} - break; - - case 51: -#line 236 "tools/wmc/mcy.y" - { xyyerror(err_colon); ;} - break; - - case 52: -#line 237 "tools/wmc/mcy.y" - { xyyerror(err_number); ;} - break; - - case 53: -#line 238 "tools/wmc/mcy.y" - { xyyerror(err_assign); ;} - break; - - case 54: -#line 241 "tools/wmc/mcy.y" - { yyval.num = 0; ;} - break; - - case 55: -#line 242 "tools/wmc/mcy.y" - { yyval.num = yyvsp[0].num; ;} - break; - - case 56: -#line 243 "tools/wmc/mcy.y" - { xyyerror("Codepage-number expected"); ;} - break; - - case 59: -#line 251 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - case 60: -#line 254 "tools/wmc/mcy.y" +#line 253 "tools/wmc/mcy.y" { static const char err_nocp[] = "Codepage %d not builtin; cannot convert"; - if(find_cpxlat(yyvsp[-4].num)) - xyyerror("Codepage translation already defined for language 0x%x", yyvsp[-4].num); - if(yyvsp[-2].num && !find_codepage(yyvsp[-2].num)) - xyyerror(err_nocp, yyvsp[-2].num); - if(yyvsp[0].num && !find_codepage(yyvsp[0].num)) - xyyerror(err_nocp, yyvsp[0].num); - add_cpxlat(yyvsp[-4].num, yyvsp[-2].num, yyvsp[0].num); + if(find_cpxlat((yyvsp[-4].num))) + xyyerror("Codepage translation already defined for language 0x%x\n", (yyvsp[-4].num)); + if((yyvsp[-2].num) && !find_codepage((yyvsp[-2].num))) + xyyerror(err_nocp, (yyvsp[-2].num)); + if((yyvsp[0].num) && !find_codepage((yyvsp[0].num))) + xyyerror(err_nocp, (yyvsp[0].num)); + add_cpxlat((yyvsp[-4].num), (yyvsp[-2].num), (yyvsp[0].num)); ;} break;
case 61: +#line 263 "tools/wmc/mcy.y" + { xyyerror(err_number); ;} + break; + + case 62: #line 264 "tools/wmc/mcy.y" + { xyyerror(err_colon); ;} + break; + + case 63: +#line 265 "tools/wmc/mcy.y" { xyyerror(err_number); ;} break;
- case 62: -#line 265 "tools/wmc/mcy.y" - { xyyerror(err_colon); ;} - break; - - case 63: + case 64: #line 266 "tools/wmc/mcy.y" + { xyyerror(err_assign); ;} + break; + + case 65: +#line 269 "tools/wmc/mcy.y" + { (yyval.num) = (yyvsp[0].num); ;} + break; + + case 66: +#line 270 "tools/wmc/mcy.y" + { + if((yyvsp[0].tok)->type != tok_language) + xyyerror("Language name or code expected\n"); + (yyval.num) = (yyvsp[0].tok)->token; + ;} + break; + + case 67: +#line 280 "tools/wmc/mcy.y" + { test_id((yyvsp[-1].num)); ;} + break; + + case 68: +#line 280 "tools/wmc/mcy.y" + { (yyval.msg) = complete_msg((yyvsp[0].msg), (yyvsp[-3].num)); ;} + break; + + case 69: +#line 283 "tools/wmc/mcy.y" + { + if((yyvsp[0].num) & (~0xffff)) + xyyerror("Message ID value out of range (0x%08x > 0xffff)\n", (yyvsp[0].num)); + (yyval.num) = (yyvsp[0].num); + ;} + break; + + case 70: +#line 288 "tools/wmc/mcy.y" + { xyyerror(err_assign); ;} + break; + + case 71: +#line 291 "tools/wmc/mcy.y" + { (yyval.num) = ++last_id; ;} + break; + + case 72: +#line 292 "tools/wmc/mcy.y" + { (yyval.num) = last_id = (yyvsp[0].num); ;} + break; + + case 73: +#line 293 "tools/wmc/mcy.y" + { (yyval.num) = last_id += (yyvsp[0].num); ;} + break; + + case 74: +#line 294 "tools/wmc/mcy.y" { xyyerror(err_number); ;} break;
- case 64: -#line 267 "tools/wmc/mcy.y" + case 75: +#line 297 "tools/wmc/mcy.y" + { have_sev = have_fac = have_sym = 0; ;} + break; + + case 76: +#line 298 "tools/wmc/mcy.y" + { if(have_sev) xyyerror("Severity already defined\n"); have_sev = 1; ;} + break; + + case 77: +#line 299 "tools/wmc/mcy.y" + { if(have_fac) xyyerror("Facility already defined\n"); have_fac = 1; ;} + break; + + case 78: +#line 300 "tools/wmc/mcy.y" + { if(have_sym) xyyerror("Symbolname already defined\n"); have_sym = 1; ;} + break; + + case 79: +#line 303 "tools/wmc/mcy.y" + { last_sym = (yyvsp[0].str); ;} + break; + + case 80: +#line 304 "tools/wmc/mcy.y" + { xyyerror(err_ident); ;} + break; + + case 81: +#line 305 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
- case 65: -#line 270 "tools/wmc/mcy.y" - { yyval.num = yyvsp[0].num; ;} - break; - - case 66: -#line 271 "tools/wmc/mcy.y" + case 82: +#line 308 "tools/wmc/mcy.y" { - if(yyvsp[0].tok->type != tok_language) - xyyerror("Language name or code expected"); - yyval.num = yyvsp[0].tok->token; - ;} - break; - - case 67: -#line 281 "tools/wmc/mcy.y" - { test_id(yyvsp[-1].num); ;} - break; - - case 68: -#line 281 "tools/wmc/mcy.y" - { yyval.msg = complete_msg(yyvsp[0].msg, yyvsp[-3].num); ;} - break; - - case 69: -#line 284 "tools/wmc/mcy.y" - { - if(yyvsp[0].num & (~0xffff)) - xyyerror("Message ID value out of range (0x%08x > 0xffff)", yyvsp[0].num); - yyval.num = yyvsp[0].num; - ;} - break; - - case 70: -#line 289 "tools/wmc/mcy.y" - { xyyerror(err_assign); ;} - break; - - case 71: -#line 292 "tools/wmc/mcy.y" - { yyval.num = ++last_id; ;} - break; - - case 72: -#line 293 "tools/wmc/mcy.y" - { yyval.num = last_id = yyvsp[0].num; ;} - break; - - case 73: -#line 294 "tools/wmc/mcy.y" - { yyval.num = last_id += yyvsp[0].num; ;} - break; - - case 74: -#line 295 "tools/wmc/mcy.y" - { xyyerror(err_number); ;} - break; - - case 75: -#line 298 "tools/wmc/mcy.y" - { have_sev = have_fac = have_sym = 0; ;} - break; - - case 76: -#line 299 "tools/wmc/mcy.y" - { if(have_sev) xyyerror("Severity already defined"); have_sev = 1; ;} - break; - - case 77: -#line 300 "tools/wmc/mcy.y" - { if(have_fac) xyyerror("Facility already defined"); have_fac = 1; ;} - break; - - case 78: -#line 301 "tools/wmc/mcy.y" - { if(have_sym) xyyerror("Symbolname already defined"); have_sym = 1; ;} - break; - - case 79: -#line 304 "tools/wmc/mcy.y" - { last_sym = yyvsp[0].str; ;} - break; - - case 80: -#line 305 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - - case 81: -#line 306 "tools/wmc/mcy.y" - { xyyerror(err_assign); ;} - break; - - case 82: -#line 309 "tools/wmc/mcy.y" - { - token_t *tok = lookup_token(yyvsp[0].tok->name); + token_t *tok = lookup_token((yyvsp[0].tok)->name); if(!tok) - xyyerror("Undefined severityname"); + xyyerror("Undefined severityname\n"); if(tok->type != tok_severity) - xyyerror("Identifier is not of class 'severity'"); + xyyerror("Identifier is not of class 'severity'\n"); last_sev = tok->token; ;} break;
case 83: +#line 316 "tools/wmc/mcy.y" + { xyyerror(err_ident); ;} + break; + + case 84: #line 317 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - - case 84: -#line 318 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
case 85: -#line 321 "tools/wmc/mcy.y" +#line 320 "tools/wmc/mcy.y" { - token_t *tok = lookup_token(yyvsp[0].tok->name); + token_t *tok = lookup_token((yyvsp[0].tok)->name); if(!tok) - xyyerror("Undefined facilityname"); + xyyerror("Undefined facilityname\n"); if(tok->type != tok_facility) - xyyerror("Identifier is not of class 'facility'"); + xyyerror("Identifier is not of class 'facility'\n"); last_fac = tok->token; ;} break;
case 86: +#line 328 "tools/wmc/mcy.y" + { xyyerror(err_ident); ;} + break; + + case 87: #line 329 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - - case 87: -#line 330 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
case 88: +#line 335 "tools/wmc/mcy.y" + { (yyval.msg) = add_lanmsg(NULL, (yyvsp[0].lmp)); ;} + break; + + case 89: #line 336 "tools/wmc/mcy.y" - { yyval.msg = add_lanmsg(NULL, yyvsp[0].lmp); ;} - break; - - case 89: + { (yyval.msg) = add_lanmsg((yyvsp[-1].msg), (yyvsp[0].lmp)); ;} + break; + + case 90: #line 337 "tools/wmc/mcy.y" - { yyval.msg = add_lanmsg(yyvsp[-1].msg, yyvsp[0].lmp); ;} - break; - - case 90: -#line 338 "tools/wmc/mcy.y" - { xyyerror("'Language=...' (start of message text-definition) expected"); ;} + { xyyerror("'Language=...' (start of message text-definition) expected\n"); ;} break;
case 91: -#line 341 "tools/wmc/mcy.y" - { yyval.lmp = new_lanmsg(&yyvsp[-3].lcp, yyvsp[-1].str); ;} +#line 340 "tools/wmc/mcy.y" + { (yyval.lmp) = new_lanmsg(&(yyvsp[-3].lcp), (yyvsp[-1].str)); ;} break;
case 92: -#line 349 "tools/wmc/mcy.y" +#line 348 "tools/wmc/mcy.y" { - token_t *tok = lookup_token(yyvsp[-1].tok->name); + token_t *tok = lookup_token((yyvsp[-1].tok)->name); cp_xlat_t *cpx; if(!tok) - xyyerror("Undefined language"); + xyyerror("Undefined language\n"); if(tok->type != tok_language) - xyyerror("Identifier is not of class 'language'"); + xyyerror("Identifier is not of class 'language'\n"); if((cpx = find_cpxlat(tok->token))) { - set_codepage(yyval.lcp.codepage = cpx->cpin); + set_codepage((yyval.lcp).codepage = cpx->cpin); } else if(!tok->codepage) { @@ -1686,85 +1807,86 @@ if(!lan) { /* Just set default; warning was given while parsing languagenames */ - set_codepage(yyval.lcp.codepage = WMC_DEFAULT_CODEPAGE); + set_codepage((yyval.lcp).codepage = WMC_DEFAULT_CODEPAGE); } else { /* The default seems to be to use the DOS codepage... */ - set_codepage(yyval.lcp.codepage = lan->doscp); + set_codepage((yyval.lcp).codepage = lan->doscp); } } else - set_codepage(yyval.lcp.codepage = tok->codepage); - yyval.lcp.language = tok->token; + set_codepage((yyval.lcp).codepage = tok->codepage); + (yyval.lcp).language = tok->token; ;} break;
case 93: +#line 377 "tools/wmc/mcy.y" + { xyyerror("Missing newline\n"); ;} + break; + + case 94: #line 378 "tools/wmc/mcy.y" - { xyyerror("Missing newline"); ;} - break; - - case 94: + { xyyerror(err_ident); ;} + break; + + case 95: #line 379 "tools/wmc/mcy.y" - { xyyerror(err_ident); ;} - break; - - case 95: -#line 380 "tools/wmc/mcy.y" { xyyerror(err_assign); ;} break;
case 96: +#line 382 "tools/wmc/mcy.y" + { (yyval.str) = (yyvsp[0].str); ;} + break; + + case 97: #line 383 "tools/wmc/mcy.y" - { yyval.str = yyvsp[0].str; ;} - break; - - case 97: + { (yyval.str) = merge((yyvsp[-1].str), (yyvsp[0].str)); ;} + break; + + case 98: #line 384 "tools/wmc/mcy.y" - { yyval.str = merge(yyvsp[-1].str, yyvsp[0].str); ;} - break; - - case 98: + { xyyerror(err_msg); ;} + break; + + case 99: #line 385 "tools/wmc/mcy.y" { xyyerror(err_msg); ;} break;
- case 99: -#line 386 "tools/wmc/mcy.y" - { xyyerror(err_msg); ;} - break; - case 100: +#line 391 "tools/wmc/mcy.y" + { (yyval.tok) = xmalloc(sizeof(token_t)); memset((yyval.tok),0,sizeof(*(yyval.tok))); (yyval.tok)->name = (yyvsp[0].str); ;} + break; + + case 101: #line 392 "tools/wmc/mcy.y" - { yyval.tok = xmalloc(sizeof(token_t)); yyval.tok->name = yyvsp[0].str; ;} - break; - - case 101: -#line 393 "tools/wmc/mcy.y" - { yyval.tok = yyvsp[0].tok; ;} + { (yyval.tok) = (yyvsp[0].tok); ;} break;
case 102: -#line 396 "tools/wmc/mcy.y" +#line 395 "tools/wmc/mcy.y" { want_nl = 1; ;} break;
case 103: -#line 399 "tools/wmc/mcy.y" +#line 398 "tools/wmc/mcy.y" { want_line = 1; ;} break;
case 104: -#line 402 "tools/wmc/mcy.y" +#line 401 "tools/wmc/mcy.y" { want_file = 1; ;} break;
+ default: break; }
-/* Line 1000 of yacc.c. */ -#line 1768 "tools/wmc/mcy.tab.c" +/* Line 1126 of yacc.c. */ +#line 1890 "mcy.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1803,11 +1925,35 @@
if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; + +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ @@ -1816,81 +1962,91 @@ /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("syntax error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + yyerror (YY_("syntax error")); }
if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */
if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } + YYABORT; } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); + yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; - } }
- /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1;
@@ -1900,14 +2056,13 @@ `---------------------------------------------------*/ yyerrorlab:
-#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif - - yyvsp -= yylen; + +yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; @@ -1937,8 +2092,8 @@ if (yyssp == yyss) YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); + + yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1947,10 +2102,11 @@ if (yyn == YYFINAL) YYACCEPT;
- YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval;
+ + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn; goto yynewstate; @@ -1971,16 +2127,25 @@ goto yyreturn;
#ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif
yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -1989,7 +2154,7 @@ }
-#line 405 "tools/wmc/mcy.y" +#line 404 "tools/wmc/mcy.y"
static WCHAR *merge(WCHAR *s1, WCHAR *s2) @@ -2008,12 +2173,12 @@ if(tp) { if(tok->type != type) - yywarning("Type change in token"); + mcy_warning("Type change in token\n"); if(tp != tok) - xyyerror("Overlapping token not the same"); + xyyerror("Overlapping token not the same\n"); /* else its already defined and changed */ if(tok->fixed) - xyyerror("Redefinition of %s", code); + xyyerror("Redefinition of %s\n", code); tok->fixed = 1; } else @@ -2025,13 +2190,13 @@
static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg) { - lanmsg_t *lmp = (lanmsg_t *)xmalloc(sizeof(lanmsg_t)); + lanmsg_t *lmp = xmalloc(sizeof(lanmsg_t)); lmp->lan = lcp->language; lmp->cp = lcp->codepage; lmp->msg = msg; lmp->len = unistrlen(msg) + 1; /* Include termination */ if(lmp->len > 4096) - yywarning("Message exceptionally long; might be a missing termination"); + mcy_warning("Message exceptionally long; might be a missing termination\n"); return lmp; }
@@ -2039,21 +2204,24 @@ { int i; if(!msg) + { msg = xmalloc(sizeof(msg_t)); + memset( msg, 0, sizeof(*msg) ); + } msg->msgs = xrealloc(msg->msgs, (msg->nmsgs+1) * sizeof(*(msg->msgs))); msg->msgs[msg->nmsgs] = lanmsg; msg->nmsgs++; for(i = 0; i < msg->nmsgs-1; i++) { if(msg->msgs[i]->lan == lanmsg->lan) - xyyerror("Message for language 0x%x already defined", lanmsg->lan); + xyyerror("Message for language 0x%x already defined\n", lanmsg->lan); } return msg; }
static int sort_lanmsg(const void *p1, const void *p2) { - return (*(lanmsg_t **)p1)->lan - (*(lanmsg_t **)p2)->lan; + return (*(const lanmsg_t * const *)p1)->lan - (*(const lanmsg_t * const*)p2)->lan; }
static msg_t *complete_msg(msg_t *mp, int id) @@ -2063,7 +2231,7 @@ if(have_sym) mp->sym = last_sym; else - xyyerror("No symbolic name defined for message id %d", id); + xyyerror("No symbolic name defined for message id %d\n", id); mp->sev = last_sev; mp->fac = last_fac; qsort(mp->msgs, mp->nmsgs, sizeof(*(mp->msgs)), sort_lanmsg); @@ -2077,7 +2245,8 @@
static void add_node(node_e type, void *p) { - node_t *ndp = (node_t *)xmalloc(sizeof(node_t)); + node_t *ndp = xmalloc(sizeof(node_t)); + memset( ndp, 0, sizeof(*ndp) ); ndp->type = type; ndp->u.all = p;
@@ -2101,7 +2270,7 @@ if(ndp->type != nd_msg) continue; if(ndp->u.msg->id == id && ndp->u.msg->sev == last_sev && ndp->u.msg->fac == last_fac) - xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined", id, last_fac, last_sev); + xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined\n", id, last_fac, last_sev); } }
@@ -2151,7 +2320,7 @@ return nm; }
-#define MSGRID(x) ((*(msg_t **)(x))->realid) +#define MSGRID(x) ((*(const msg_t * const*)(x))->realid) static int sort_msg(const void *p1, const void *p2) { return MSGRID(p1) > MSGRID(p2) ? 1 : (MSGRID(p1) == MSGRID(p2) ? 0 : -1); @@ -2189,7 +2358,7 @@ for(nl = 0; nl < msgtab[0]->nmsgs; nl++) /* This should be equal for all after check_languages() */ { lbp = xmalloc(sizeof(lan_blk_t)); - + memset( lbp, 0, sizeof(*lbp) ); if(!lblktail) { lblkhead = lblktail = lbp; @@ -2241,7 +2410,7 @@
static int sc_xlat(const void *p1, const void *p2) { - return ((cp_xlat_t *)p1)->lan - ((cp_xlat_t *)p2)->lan; + return ((const cp_xlat_t *)p1)->lan - ((const cp_xlat_t *)p2)->lan; }
static void add_cpxlat(int lan, int cpin, int cpout)
Modified: trunk/reactos/tools/wmc/mcy.tab.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/mcy.tab.h?rev=309... ============================================================================== --- trunk/reactos/tools/wmc/mcy.tab.h (original) +++ trunk/reactos/tools/wmc/mcy.tab.h Sat Dec 1 18:56:03 2007 @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -50,6 +50,7 @@ tTOKEN = 276 }; #endif +/* Tokens. */ #define tSEVNAMES 258 #define tFACNAMES 259 #define tLANNAMES 260 @@ -74,7 +75,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 99 "tools/wmc/mcy.y" +#line 98 "tools/wmc/mcy.y" typedef union YYSTYPE { WCHAR *str; unsigned num; @@ -83,14 +84,14 @@ msg_t *msg; lan_cp_t lcp; } YYSTYPE; -/* Line 1275 of yacc.c. */ -#line 88 "tools/wmc/mcy.tab.h" +/* Line 1447 of yacc.c. */ +#line 89 "tools/wmc/mcy.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif
-extern YYSTYPE yylval; +extern YYSTYPE mcy_lval;
Modified: trunk/reactos/tools/wmc/mcy.y URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/mcy.y?rev=30932&a... ============================================================================== --- trunk/reactos/tools/wmc/mcy.y (original) +++ trunk/reactos/tools/wmc/mcy.y Sat Dec 1 18:56:03 2007 @@ -15,12 +15,12 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * NOTES: * * The basic grammar of the file is yet another example of, humpf, - * design. There is is mix of context-insensitive and -sentitive + * design. There is a mix of context-insensitive and -sensitive * stuff, which makes it rather complicated. * The header definitions are all context-insensitive because they have * delimited arguments, whereas the message headers are (semi-) context- @@ -95,7 +95,6 @@
%}
- %union { WCHAR *str; unsigned num; @@ -123,7 +122,7 @@ %% file : items { if(!check_languages(nodehead)) - xyyerror("No messages defined"); + xyyerror("No messages defined\n"); lanblockhead = block_messages(nodehead); } ; @@ -166,7 +165,7 @@ base = $3; break; default: - xyyerror("Numberbase must be 8, 10 or 16"); + xyyerror("Numberbase must be 8, 10 or 16\n"); } } | tBASE '=' error { xyyerror(err_number); } @@ -185,7 +184,7 @@ $1->token = $3; $1->alias = $4; if($3 & (~0x3)) - xyyerror("Severity value out of range (0x%08x > 0x3)", $3); + xyyerror("Severity value out of range (0x%08x > 0x3)\n", $3); do_add_token(tok_severity, $1, "severity"); } | token '=' error { xyyerror(err_number); } @@ -204,7 +203,7 @@ $1->token = $3; $1->alias = $4; if($3 & (~0xfff)) - xyyerror("Facility value out of range (0x%08x > 0xfff)", $3); + xyyerror("Facility value out of range (0x%08x > 0xfff)\n", $3); do_add_token(tok_facility, $1, "facility"); } | token '=' error { xyyerror(err_number); } @@ -230,9 +229,9 @@ $1->codepage = $7; do_add_token(tok_language, $1, "language"); if(!find_language($3) && !find_cpxlat($3)) - yywarning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $3, WMC_DEFAULT_CODEPAGE); - } - | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); } + mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override\n", $3, WMC_DEFAULT_CODEPAGE); + } + | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected\n"); } | token '=' tNUMBER error { xyyerror(err_colon); } | token '=' error { xyyerror(err_number); } | token error { xyyerror(err_assign); } @@ -240,7 +239,7 @@
optcp : /* Empty */ { $$ = 0; } | ':' tNUMBER { $$ = $2; } - | ':' error { xyyerror("Codepage-number expected"); } + | ':' error { xyyerror("Codepage-number expected\n"); } ;
/*---------------------------------------------------------------------- @@ -254,7 +253,7 @@ cmap : clan '=' tNUMBER ':' tNUMBER { static const char err_nocp[] = "Codepage %d not builtin; cannot convert"; if(find_cpxlat($1)) - xyyerror("Codepage translation already defined for language 0x%x", $1); + xyyerror("Codepage translation already defined for language 0x%x\n", $1); if($3 && !find_codepage($3)) xyyerror(err_nocp, $3); if($5 && !find_codepage($5)) @@ -270,7 +269,7 @@ clan : tNUMBER { $$ = $1; } | tTOKEN { if($1->type != tok_language) - xyyerror("Language name or code expected"); + xyyerror("Language name or code expected\n"); $$ = $1->token; } ; @@ -283,7 +282,7 @@
msgid : tMSGID '=' id { if($3 & (~0xffff)) - xyyerror("Message ID value out of range (0x%08x > 0xffff)", $3); + xyyerror("Message ID value out of range (0x%08x > 0xffff)\n", $3); $$ = $3; } | tMSGID error { xyyerror(err_assign); } @@ -296,9 +295,9 @@ ;
sevfacsym: /* Empty */ { have_sev = have_fac = have_sym = 0; } - | sevfacsym sev { if(have_sev) xyyerror("Severity already defined"); have_sev = 1; } - | sevfacsym fac { if(have_fac) xyyerror("Facility already defined"); have_fac = 1; } - | sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined"); have_sym = 1; } + | sevfacsym sev { if(have_sev) xyyerror("Severity already defined\n"); have_sev = 1; } + | sevfacsym fac { if(have_fac) xyyerror("Facility already defined\n"); have_fac = 1; } + | sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined\n"); have_sym = 1; } ;
sym : tSYMNAME '=' tIDENT { last_sym = $3; } @@ -309,9 +308,9 @@ sev : tSEVERITY '=' token { token_t *tok = lookup_token($3->name); if(!tok) - xyyerror("Undefined severityname"); + xyyerror("Undefined severityname\n"); if(tok->type != tok_severity) - xyyerror("Identifier is not of class 'severity'"); + xyyerror("Identifier is not of class 'severity'\n"); last_sev = tok->token; } | tSEVERITY '=' error { xyyerror(err_ident); } @@ -321,9 +320,9 @@ fac : tFACILITY '=' token { token_t *tok = lookup_token($3->name); if(!tok) - xyyerror("Undefined facilityname"); + xyyerror("Undefined facilityname\n"); if(tok->type != tok_facility) - xyyerror("Identifier is not of class 'facility'"); + xyyerror("Identifier is not of class 'facility'\n"); last_fac = tok->token; } | tFACILITY '=' error { xyyerror(err_ident); } @@ -335,7 +334,7 @@ */ bodies : body { $$ = add_lanmsg(NULL, $1); } | bodies body { $$ = add_lanmsg($1, $2); } - | error { xyyerror("'Language=...' (start of message text-definition) expected"); } + | error { xyyerror("'Language=...' (start of message text-definition) expected\n"); } ;
body : lang setline lines tMSGEND { $$ = new_lanmsg(&$1, $3); } @@ -350,9 +349,9 @@ token_t *tok = lookup_token($4->name); cp_xlat_t *cpx; if(!tok) - xyyerror("Undefined language"); + xyyerror("Undefined language\n"); if(tok->type != tok_language) - xyyerror("Identifier is not of class 'language'"); + xyyerror("Identifier is not of class 'language'\n"); if((cpx = find_cpxlat(tok->token))) { set_codepage($$.codepage = cpx->cpin); @@ -375,7 +374,7 @@ set_codepage($$.codepage = tok->codepage); $$.language = tok->token; } - | tLANGUAGE setnl '=' token error { xyyerror("Missing newline"); } + | tLANGUAGE setnl '=' token error { xyyerror("Missing newline\n"); } | tLANGUAGE setnl '=' error { xyyerror(err_ident); } | tLANGUAGE error { xyyerror(err_assign); } ; @@ -389,7 +388,7 @@ /*---------------------------------------------------------------------- * Helper rules */ -token : tIDENT { $$ = xmalloc(sizeof(token_t)); $$->name = $1; } +token : tIDENT { $$ = xmalloc(sizeof(token_t)); memset($$,0,sizeof(*$$)); $$->name = $1; } | tTOKEN { $$ = $1; } ;
@@ -420,12 +419,12 @@ if(tp) { if(tok->type != type) - yywarning("Type change in token"); + mcy_warning("Type change in token\n"); if(tp != tok) - xyyerror("Overlapping token not the same"); + xyyerror("Overlapping token not the same\n"); /* else its already defined and changed */ if(tok->fixed) - xyyerror("Redefinition of %s", code); + xyyerror("Redefinition of %s\n", code); tok->fixed = 1; } else @@ -437,13 +436,13 @@
static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg) { - lanmsg_t *lmp = (lanmsg_t *)xmalloc(sizeof(lanmsg_t)); + lanmsg_t *lmp = xmalloc(sizeof(lanmsg_t)); lmp->lan = lcp->language; lmp->cp = lcp->codepage; lmp->msg = msg; lmp->len = unistrlen(msg) + 1; /* Include termination */ if(lmp->len > 4096) - yywarning("Message exceptionally long; might be a missing termination"); + mcy_warning("Message exceptionally long; might be a missing termination\n"); return lmp; }
@@ -451,21 +450,24 @@ { int i; if(!msg) + { msg = xmalloc(sizeof(msg_t)); + memset( msg, 0, sizeof(*msg) ); + } msg->msgs = xrealloc(msg->msgs, (msg->nmsgs+1) * sizeof(*(msg->msgs))); msg->msgs[msg->nmsgs] = lanmsg; msg->nmsgs++; for(i = 0; i < msg->nmsgs-1; i++) { if(msg->msgs[i]->lan == lanmsg->lan) - xyyerror("Message for language 0x%x already defined", lanmsg->lan); + xyyerror("Message for language 0x%x already defined\n", lanmsg->lan); } return msg; }
static int sort_lanmsg(const void *p1, const void *p2) { - return (*(lanmsg_t **)p1)->lan - (*(lanmsg_t **)p2)->lan; + return (*(const lanmsg_t * const *)p1)->lan - (*(const lanmsg_t * const*)p2)->lan; }
static msg_t *complete_msg(msg_t *mp, int id) @@ -475,7 +477,7 @@ if(have_sym) mp->sym = last_sym; else - xyyerror("No symbolic name defined for message id %d", id); + xyyerror("No symbolic name defined for message id %d\n", id); mp->sev = last_sev; mp->fac = last_fac; qsort(mp->msgs, mp->nmsgs, sizeof(*(mp->msgs)), sort_lanmsg); @@ -489,7 +491,8 @@
static void add_node(node_e type, void *p) { - node_t *ndp = (node_t *)xmalloc(sizeof(node_t)); + node_t *ndp = xmalloc(sizeof(node_t)); + memset( ndp, 0, sizeof(*ndp) ); ndp->type = type; ndp->u.all = p;
@@ -513,7 +516,7 @@ if(ndp->type != nd_msg) continue; if(ndp->u.msg->id == id && ndp->u.msg->sev == last_sev && ndp->u.msg->fac == last_fac) - xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined", id, last_fac, last_sev); + xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined\n", id, last_fac, last_sev); } }
@@ -563,7 +566,7 @@ return nm; }
-#define MSGRID(x) ((*(msg_t **)(x))->realid) +#define MSGRID(x) ((*(const msg_t * const*)(x))->realid) static int sort_msg(const void *p1, const void *p2) { return MSGRID(p1) > MSGRID(p2) ? 1 : (MSGRID(p1) == MSGRID(p2) ? 0 : -1); @@ -601,7 +604,7 @@ for(nl = 0; nl < msgtab[0]->nmsgs; nl++) /* This should be equal for all after check_languages() */ { lbp = xmalloc(sizeof(lan_blk_t)); - + memset( lbp, 0, sizeof(*lbp) ); if(!lblktail) { lblkhead = lblktail = lbp; @@ -653,7 +656,7 @@
static int sc_xlat(const void *p1, const void *p2) { - return ((cp_xlat_t *)p1)->lan - ((cp_xlat_t *)p2)->lan; + return ((const cp_xlat_t *)p1)->lan - ((const cp_xlat_t *)p2)->lan; }
static void add_cpxlat(int lan, int cpin, int cpout)
Modified: trunk/reactos/tools/wmc/utils.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/utils.c?rev=30932... ============================================================================== --- trunk/reactos/tools/wmc/utils.c (original) +++ trunk/reactos/tools/wmc/utils.c Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include "config.h" @@ -36,9 +36,8 @@
static void generic_msg(const char *s, const char *t, va_list ap) { - fprintf(stderr, "%s %s: %d, %d: ", t, input_name ? input_name : "stdin", line_number, char_number); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); + fprintf(stderr, "%s:%d:%d: %s: ", input_name ? input_name : "stdin", line_number, char_number, t); + vfprintf(stderr, s, ap); }
/* @@ -49,7 +48,7 @@ * The extra routine 'xyyerror' is used to exit after giving a real * message. */ -int yyerror(const char *s, ...) +int mcy_error(const char *s, ...) { #ifndef SUPPRESS_YACC_ERROR_MESSAGE va_list ap; @@ -70,7 +69,7 @@ return 1; }
-int yywarning(const char *s, ...) +int mcy_warning(const char *s, ...) { va_list ap; va_start(ap, s); @@ -85,7 +84,6 @@ va_start(ap, s); fprintf(stderr, "Internal error (please report) %s %d: ", file, line); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(3); } @@ -96,7 +94,6 @@ va_start(ap, s); fprintf(stderr, "Error: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(2); } @@ -107,7 +104,6 @@ va_start(ap, s); fprintf(stderr, "Warning: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); }
@@ -128,7 +124,7 @@ namelen = strlen(name);
/* +4 for later extension and +1 for '\0' */ - base = (char *)xmalloc(namelen +4 +1); + base = xmalloc(namelen +4 +1); strcpy(base, name); if(!strcasecmp(name + namelen-extlen, ext)) { @@ -148,12 +144,7 @@ { error("Virtual memory exhausted.\n"); } - /* - * We set it to 0. - * This is *paramount* because we depend on it - * just about everywhere in the rest of the code. - */ - memset(res, 0, size); + memset(res, 0x55, size); return res; }
@@ -177,7 +168,7 @@ char *s;
assert(str != NULL); - s = (char *)xmalloc(strlen(str)+1); + s = xmalloc(strlen(str)+1); return strcpy(s, str); }
@@ -203,7 +194,7 @@ WCHAR *s;
assert(str != NULL); - s = (WCHAR *)xmalloc((unistrlen(str)+1) * sizeof(WCHAR)); + s = xmalloc((unistrlen(str)+1) * sizeof(WCHAR)); return unistrcpy(s, str); }
@@ -220,7 +211,7 @@ if(!once) { once++; - yywarning(warn); + mcy_warning(warn); } i = *s1++ - *s2++; } @@ -233,7 +224,7 @@ if((*s1 & 0xffff) > 0x7f || (*s2 & 0xffff) > 0x7f) { if(!once) - yywarning(warn); + mcy_warning(warn); return *s1 - *s2; } else
Modified: trunk/reactos/tools/wmc/utils.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/utils.h?rev=30932... ============================================================================== --- trunk/reactos/tools/wmc/utils.h (original) +++ trunk/reactos/tools/wmc/utils.h Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef __WMC_UTILS_H @@ -33,9 +33,9 @@ #define __attribute__(X) #endif
-int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); +int mcy_error(const char *s, ...) __attribute__((format (printf, 1, 2))); int xyyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); -int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2))); +int mcy_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4))); void error(const char *s, ...) __attribute__((format (printf, 1, 2))); void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
Modified: trunk/reactos/tools/wmc/wmc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/wmc.c?rev=30932&a... ============================================================================== --- trunk/reactos/tools/wmc/wmc.c (original) +++ trunk/reactos/tools/wmc/wmc.c Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include "config.h" @@ -31,7 +31,7 @@ #include "lang.h" #include "write.h"
-static char usage[] = +static const char usage[] = "Usage: wmc [options...] [inputfile.mc]\n" " -B x Set output byte-order x={n[ative], l[ittle], b[ig]}\n" " (default is n[ative] which equals " @@ -58,7 +58,7 @@ "bytes read, which should be 0x0000..0x00ff.\n" ;
-static char version_string[] = +static const char version_string[] = "Wine Message Compiler version " PACKAGE_VERSION "\n" "Copyright 2000 Bertho A. Stultiens\n" ; @@ -113,8 +113,21 @@ char *cmdline; /* The entire commandline */ time_t now; /* The time of start of wmc */
+int mcy_debug; + int getopt (int argc, char *const *argv, const char *optstring); static void segvhandler(int sig); + +static void cleanup_files(void) +{ + if (output_name) unlink( output_name ); + if (header_name) unlink( header_name ); +} + +static void exit_on_signal( int sig ) +{ + exit(1); /* this will call the atexit functions */ +}
int main(int argc,char *argv[]) { @@ -126,7 +139,13 @@ int i; int cmdlen;
+ atexit( cleanup_files ); signal(SIGSEGV, segvhandler); + signal( SIGTERM, exit_on_signal ); + signal( SIGINT, exit_on_signal ); +#ifdef SIGHUP + signal( SIGHUP, exit_on_signal ); +#endif
now = time(NULL);
@@ -220,7 +239,7 @@ return 1; }
- yydebug = dodebug; + mcy_debug = dodebug; if(dodebug) { setbuf(stdout, 0); @@ -254,7 +273,7 @@ else yyin = stdin;
- ret = yyparse(); + ret = mcy_parse();
if(input_name) fclose(yyin); @@ -269,7 +288,8 @@ write_rc_file(output_name); if(!rcinline) write_bin_files(); - + output_name = NULL; + header_name = NULL; return 0; }
Modified: trunk/reactos/tools/wmc/wmc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/wmc.h?rev=30932&a... ============================================================================== --- trunk/reactos/tools/wmc/wmc.h (original) +++ trunk/reactos/tools/wmc/wmc.h Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef __WMC_WMC_H @@ -56,15 +56,15 @@ extern int line_number; extern int char_number;
-int yyparse(void); -extern int yydebug; +int mcy_parse(void); +extern int mcy_debug; extern int want_nl; extern int want_line; extern int want_file; extern node_t *nodehead; extern lan_blk_t *lanblockhead;
-int yylex(void); +int mcy_lex(void); FILE *yyin; void set_codepage(int cp);
Modified: trunk/reactos/tools/wmc/wmctypes.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/wmctypes.h?rev=30... ============================================================================== --- trunk/reactos/tools/wmc/wmctypes.h (original) +++ trunk/reactos/tools/wmc/wmctypes.h Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef __WMC_WMCTYPES_H
Modified: trunk/reactos/tools/wmc/write.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/write.c?rev=30932... ============================================================================== --- trunk/reactos/tools/wmc/write.c (original) +++ trunk/reactos/tools/wmc/write.c Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include "config.h" @@ -87,7 +87,7 @@ * for normal character strings and 1 for unicode strings. */
-static char str_header[] = +static const char str_header[] = "/* This file is generated with wmc version " PACKAGE_VERSION ". Do not edit! */\n" "/* Source : %s */\n" "/* Cmdline: %s */\n" @@ -101,11 +101,11 @@ char *cptr; const union cptable *cpdef = find_codepage(cp); if(!cpdef) - internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)", cp); + internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)\n", cp); len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL); cptr = xmalloc(len); if((len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, cptr, len, NULL, NULL)) < 0) - internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", len); + internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", len); return cptr; }
@@ -271,14 +271,14 @@ fprintf(fp, "#define %s\t0x%08xL\n\n", cptr, ndp->u.msg->realid); break; default: - internal_error(__FILE__, __LINE__, "Invalid base for number print"); + internal_error(__FILE__, __LINE__, "Invalid base for number print\n"); } free(cptr); if(cast) free(cast); break; default: - internal_error(__FILE__, __LINE__, "Invalid node type %d", ndp->type); + internal_error(__FILE__, __LINE__, "Invalid node type %d\n", ndp->type); } } fprintf(fp, "\n#endif\n"); @@ -308,7 +308,7 @@ } } if(!cptr) - internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x", lbp->lan); + internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x\n", lbp->lan); fprintf(fp, "1 MESSAGETABLE "%s.bin"\n", cptr); free(cptr); } @@ -390,7 +390,7 @@ mlen = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL); cc = tmp = xmalloc(mlen); if((i = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, tmp, mlen, NULL, NULL)) < 0) - internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", i); + internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i); *cptr++ = ' '; *cptr++ = '"'; for(i = b = 0; i < len; i++, cc++)
Modified: trunk/reactos/tools/wmc/write.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/wmc/write.h?rev=30932... ============================================================================== --- trunk/reactos/tools/wmc/write.h (original) +++ trunk/reactos/tools/wmc/write.h Sat Dec 1 18:56:03 2007 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WMC_WRITE_H #define __WMC_WRITE_H