diff options
Diffstat (limited to '3rdparty')
23 files changed, 1613 insertions, 1568 deletions
diff --git a/3rdparty/libconfig/AUTHORS b/3rdparty/libconfig/AUTHORS index d3d5e104b..5eef0f0ff 100644 --- a/3rdparty/libconfig/AUTHORS +++ b/3rdparty/libconfig/AUTHORS @@ -4,3 +4,4 @@ Mark Lindner - Lead developer & maintainer. Daniel Marjamäki - Enhancements & bugfixes. Andrew Tytula - Windows port. Glenn Herteg - Enhancements, bugfixes, documentation corrections. +Matt Renaud - Enhancements & bugfixes. diff --git a/3rdparty/libconfig/ChangeLog b/3rdparty/libconfig/ChangeLog index 52125e9fb..c24151e09 100644 --- a/3rdparty/libconfig/ChangeLog +++ b/3rdparty/libconfig/ChangeLog @@ -1,3 +1,41 @@ + + ----- version 1.5 ------ + +2015-05-16 Mark Lindner <markl@neuromancer> + + * lib/libconfig.c - Don't fclose() a null pointer. + +2014-09-19 Mark Lindner <markl@neuromancer> + + * lib/libconfig.c, lib/wincompat.h - check if file being opened is a + directory + * lib/libconfig.c, lib/libconfig.h, lib/libconfig.h++, + doc/libconfig.texi - added config_set_options(), + config_get_options(), setOptions(), getOptions(). + +2014-05-25 Mark Lindner <markl@neuromancer> + + * lib/libconfig.c++, lib/libconfig.h++ - added patches from Matt + Renaud (added iterators, removed throws() specifications); added + Setting.lookup(); code cleanup; added patch from Yuri Dyachenko + (made exception constructors public) + * lib/libconfig.c, lib/libconfig.h - renamed + config_setting_lookup_from() to config_setting_lookup() and + documented it; patch from Alexander Klauer (floating point precision + loss) + * doc/libconfig.texi - documented new APIs, bumped version + * lib/scanner.c, lib/scanner.h, lib/scanner.l, libconfig.c - + scanner code cleanup; and regenerated with flex 2.5.39 + * lib/grammar.c, lib/grammar.h, lib/grammar.y - parser code cleanup; + and regenerated with bison 3.0.2 + * README, ChangeLog - version updates + +2014-01-21 Mark Lindner <markl@neuromancer> + + * lib/libconfig.c - bugfix; capture root filename + * tests/Makefile.am - fix for out-of-source builds + * ac_config.h.in, aclocal.m4 - updated to newer autotools + ----- version 1.4.9 ------ 2012-09-28 Mark Lindner <markl@neuromancer> diff --git a/3rdparty/libconfig/README.md b/3rdparty/libconfig/README.md new file mode 100644 index 000000000..43bd17e41 --- /dev/null +++ b/3rdparty/libconfig/README.md @@ -0,0 +1,4 @@ +libconfig +========= + +C/C++ library for processing configuration files diff --git a/3rdparty/libconfig/extra/doc/libconfig.texi b/3rdparty/libconfig/extra/doc/libconfig.texi index 52dca20fc..9441dc2ac 100644 --- a/3rdparty/libconfig/extra/doc/libconfig.texi +++ b/3rdparty/libconfig/extra/doc/libconfig.texi @@ -6,8 +6,8 @@ @setfilename libconfig.info @settitle libconfig -@set edition 1.4.9 -@set update-date 28 September 2012 +@set edition 1.5 +@set update-date 16 May 2015 @set subtitle-text A Library For Processing Structured Configuration Files @set author-text Mark A.@: Lindner @@ -36,7 +36,7 @@ @page @vskip 0pt plus 1filll -Copyright @copyright{} 2005-2012 Mark A Lindner +Copyright @copyright{} 2005-2014 Mark A Lindner Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -512,8 +512,11 @@ more hexadecimal digits (@samp{0} - @samp{9}, @samp{A} - @samp{F}, @section 64-bit Integer Values Long long (64-bit) integers are represented identically to integers, -except that an 'L' character is appended to indicate a 64-bit -value. For example, @samp{0L} indicates a 64-bit integer value 0. +except that an `L' character is appended to indicate a 64-bit +value. For example, @samp{0L} indicates a 64-bit integer value 0. As +of version 1.5 of the library, the trailing `L' is optional; if the +integer value exceeds the range of a 32-bit integer, it will +automatically be interpreted as a 64-bit integer. @node Floating Point Values, Boolean Values, 64-bit Integer Values, Configuration Files @comment node-name, next, previous, up @@ -766,21 +769,60 @@ configuration @var{config}, or @code{NULL} if none is set. @end deftypefun -@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) -@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) +@deftypefun void config_set_options (@w{config_t *@var{config}}, @w{int @var{options}}) +@deftypefunx int config_get_options (@w{config_t *@var{config}}) + +These functions set and get the options for the configuration +@var{config}. The options affect how configurations are read and +written. The following options are defined: + +@table @code -@code{config_set_auto_convert()} enables number auto-conversion for -the configuration @var{config} if @var{flag} is non-zero, and disables -it otherwise. When this feature is enabled, an attempt to retrieve a +@item CONFIG_OPTION_AUTOCONVERT +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a floating point setting's value into an integer (or vice versa), or store an integer to a floating point setting's value (or vice versa) will cause the library to silently perform the necessary conversion (possibly leading to loss of data), rather than reporting failure. By -default this feature is disabled. +default this option is turned off. + +@item CONFIG_OPTION_SEMICOLON_SEPARATORS +This option controls whether a semicolon (`;') is output after each setting +when the configuration is written to a file or stream. (The semicolon +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS +This option controls whether a colon (`:') is output between each +group setting's name and its value when the configuration is written to +a file or stream. If the option is turned off, an equals sign (`=') is +output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned on. + +@item CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS +This option controls whether a colon (`:') is output between each +non-group setting's name and its value when the configuration is written +to a file or stream. If the option is turned off, an equals sign (`=') +is output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned off. + +@item CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE +This option controls whether an open brace (`@{') will be written on its own +line when the configuration is written to a file or stream. If the option is +turned off, the brace will be written at the end of the previous line. +By default this option is turned on. + +@end table + +@end deftypefun + +@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) +@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) -@code{config_get_auto_convert()} returns @code{CONFIG_TRUE} if number -auto-conversion is currently enabled for @var{config}; otherwise it -returns @code{CONFIG_FALSE}. +These functions get and set the @code{CONFIG_OPTION_AUTO_CONVERT} +option. They are obsoleted by the @code{config_set_options()} and +@code{config_get_options()} functions described above. @end deftypefun @@ -839,6 +881,15 @@ setting was not found. @end deftypefun +@deftypefun {config_setting_t *} config_setting_lookup (@w{const config_setting_t * @var{setting}}, @w{const char * @var{path}}) + +This function locates a setting by a path @var{path} relative to +the setting @var{setting}. It returns a pointer to the +@code{config_setting_t} structure on success, or @code{NULL} if the +setting was not found. + +@end deftypefun + @deftypefun int config_setting_get_int (@w{const config_setting_t * @var{setting}}) @deftypefunx {long long} config_setting_get_int64 (@w{const config_setting_t * @var{setting}}) @deftypefunx double config_setting_get_float (@w{const config_setting_t * @var{setting}}) @@ -1146,17 +1197,45 @@ common base exception @code{ConfigException}. A @code{SettingTypeException} is thrown when the type of a setting's value does not match the type requested. +@deftypemethod SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and/or member @var{index} or @var{name}. + +@end deftypemethod + @tindex SettingNotFoundException A @code{SettingNotFoundException} is thrown when a setting is not found. +@deftypemethod SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const char *@var{path}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and member @var{index} or @var{name}, or path @var{path}. + +@end deftypemethod + @tindex SettingNameException A @code{SettingNameException} is thrown when an attempt is made to add a new setting with a non-unique or invalid name. +@deftypemethod SettingNameException {} SettingNameException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +This method constructs a @code{SettingNameExcpetion} object for the given @var{setting} and member name @var{name}. + +@end deftypemethod + @tindex ParseException A @code{ParseException} is thrown when a parse error occurs while reading a configuration from a stream. +@deftypemethod ParseException {} ParseException (@w{const char *@var{file}}, @w{int @var{line}}, @w{const char *@var{error}}) + +This method constructs a @code{ParseException} object with the given filename @var{file}, line number @var{line}, and error message @var{error}. + +@end deftypemethod + @tindex FileIOException A @code{FileIOException} is thrown when an I/O error occurs while reading/writing a configuration from/to a file. @@ -1247,21 +1326,60 @@ configuration, or @code{NULL} if none is set. @end deftypemethod +@deftypemethod Config void setOptions (int @var{options}) +@deftypemethodx Config int getOptions () + +These methods set and get the options for the configuration. The +options affect how configurations are read and written. The following +options are defined: + +@table @code + +@item OptionAutoConvert +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a +floating point setting's value into an integer (or vice versa), or +store an integer to a floating point setting's value (or vice versa) +will cause the library to silently perform the necessary conversion +(possibly leading to loss of data), rather than reporting failure. By +default this option is turned off. + +@item OptionSemicolonSeparators +This option controls whether a semicolon (`;') is output after each setting +when the configuration is written to a file or stream. (The semicolon +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item OptionColonAssignmentForGroups +This option controls whether a colon (`:') is output between each +group setting's name and its value when the configuration is written to +a file or stream. If the option is turned off, an equals sign (`=') is +output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned on. + +@item OptionColonAssignmentForNonGroups +This option controls whether a colon (`:') is output between each +non-group setting's name and its value when the configuration is written +to a file or stream. If the option is turned off, an equals sign (`=') +is output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned off. + +@item OptionOpenBraceOnSeparateLine +This option controls whether an open brace (`@{') will be written on its own +line when the configuration is written to a file or stream. If the option is +turned off, the brace will be written at the end of the previous line. +By default this option is turned on. + +@end table + +@end deftypemethod + @deftypemethod Config void setAutoConvert (bool @var{flag}) @deftypemethodx Config bool getAutoConvert () -@code{setAutoConvert()} enables number auto-conversion for the -configuration if @var{flag} is @code{true}, and disables it -otherwise. When this feature is enabled, an attempt to assign a -floating point setting to an integer (or vice versa), or -assign an integer to a floating point setting (or vice versa) will -cause the library to silently perform the necessary conversion -(possibly leading to loss of data), rather than throwing a -@code{SettingTypeException}. By default this feature is disabled. - -@code{getAutoConvert()} returns @code{true} if number auto-conversion -is currently enabled for the configuration; otherwise it returns -@code{false}. +These methods get and set the @code{OptionAutoConvert} option. They +are obsoleted by the @code{setOptions()} and @code{getOptions()} +methods described above. @end deftypemethod @@ -1542,6 +1660,15 @@ configuration. @end deftypemethod +@deftypemethod Setting {Setting &} lookup (@w{const char * @var{path}}) +@deftypemethodx Setting {Setting &} lookup (@w{const std::string &@var{path}}) + +This function locates a setting by a path @var{path} relative to +this setting. If requested setting is not found, a +@code{SettingNotFoundException} is thrown. + +@end deftypemethod + @deftypemethod Setting bool lookupValue (@w{const char *@var{name}}, @w{bool &@var{value}}) @deftypemethodx Setting bool lookupValue (@w{const std::string &@var{name}}, @w{bool &@var{value}}) @@ -1744,6 +1871,17 @@ These methods test if the setting has a child setting with the given @code{false} otherwise. These methods do not throw exceptions. @end deftypemethod +@page +@deftypemethod Setting iterator begin () +@deftypemethodx Setting iterator end () +@deftypemethodx Setting const_iterator begin () +@deftypemethodx Setting const_iterator end () + +These methods return STL-style iterators that can be used to enumerate +the child settings of a given setting. If the setting is not an array, list, +or group, they throw a @code{SettingTypeException}. + +@end deftypemethod @deftypemethod Setting int getLength () @@ -1878,7 +2016,7 @@ Terminals are defined below as regular expressions: @item @code{hex} @tab @code{0[Xx][0-9A-Fa-f]+} @item @code{hex64} @tab -@code{0[Xx][0-9A-Fa-f]+L(L)?} +@code{0[Xx][0-9A-Fa-f]+(L(L)?)?} @item @code{float} @tab @code{([-+]?([0-9]*)?\.[0-9]*([eE][-+]?[0-9]+)?)|([-+]([0-9]+)(\.[0-9]*)?[eE][-+]?[0-9]+)} @end multitable diff --git a/3rdparty/libconfig/extra/gen/clangwarnings.patch b/3rdparty/libconfig/extra/gen/clangwarnings.patch index 4240f84d2..0270dfc44 100644 --- a/3rdparty/libconfig/extra/gen/clangwarnings.patch +++ b/3rdparty/libconfig/extra/gen/clangwarnings.patch @@ -2,35 +2,35 @@ diff --git a/grammar.c b/grammar.c index 3595578..26444f8 100644 --- a/grammar.c +++ b/grammar.c -@@ -1211,9 +1211,7 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, +@@ -1084,9 +1084,7 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, + YYUSE (scanner); YYUSE (ctx); YYUSE (scan_ctx); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); -+ YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); ++ YY_SYMBOL_PRINT (yymsg != NULL ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); - switch (yytype) - { + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); diff --git a/scanner.c b/scanner.c -index aebd34c..c3a717f 100644 +index 60882db..8b8af33 100644 --- a/scanner.c +++ b/scanner.c -@@ -1500,6 +1500,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) - else - ret_val = EOB_ACT_CONTINUE_SCAN; +@@ -21,6 +21,7 @@ + #include <string.h> + #include <errno.h> + #include <stdlib.h> ++#include <assert.h> + + /* end standard C headers. */ -+#ifndef __clang_analyzer__ -+ // FIXME: Clang's static analyzer complains about leaking the result of libconfig_yyrealloc - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); -@@ -1507,6 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); +@@ -1702,6 +1703,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) + libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } -+#endif // __clang_analyzer__ - yyg->yy_n_chars += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; ++ assert(YY_CURRENT_BUFFER != NULL); // Fixes compiler warning -Wnull-dereference on gcc-6 and -O3 ++ + libconfig_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + libconfig_yy_load_buffer_state(yyscanner ); + } diff --git a/3rdparty/libconfig/extra/gen/grammar.y b/3rdparty/libconfig/extra/gen/grammar.y index 7eab74780..a99b8cf1b 100644 --- a/3rdparty/libconfig/extra/gen/grammar.y +++ b/3rdparty/libconfig/extra/gen/grammar.y @@ -1,8 +1,8 @@ /* -*- mode: C -*- */ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -23,7 +23,7 @@ */ %defines -%output="y.tab.c" +%output "y.tab.c" %pure-parser %lex-param{void *scanner} %parse-param{void *scanner} @@ -54,7 +54,7 @@ extern int libconfig_yyget_lineno(); static const char *err_array_elem_type = "mismatched element type in array"; static const char *err_duplicate_setting = "duplicate setting name"; -#define _delete(P) free((void *)(P)) +#define _delete(P) free(P) #define IN_ARRAY() \ (ctx->parent && (ctx->parent->type == CONFIG_TYPE_ARRAY)) @@ -63,7 +63,7 @@ static const char *err_duplicate_setting = "duplicate setting name"; (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST)) static void capture_parse_pos(void *scanner, struct scan_context *scan_ctx, - config_setting_t *setting) + struct config_setting_t *setting) { setting->line = (unsigned int)libconfig_yyget_lineno(scanner); setting->file = scanctx_current_filename(scan_ctx); @@ -206,8 +206,8 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, - (int)$1); + struct config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, + (int)$1); if(! e) { @@ -226,7 +226,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -248,7 +248,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -270,7 +270,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -292,7 +292,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -314,7 +314,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -332,8 +332,8 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - const char *s = parsectx_take_string(ctx); - config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); + char *s = parsectx_take_string(ctx); + struct config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); _delete(s); if(! e) @@ -348,7 +348,7 @@ simple_value: } else { - const char *s = parsectx_take_string(ctx); + char *s = parsectx_take_string(ctx); config_setting_set_string(ctx->setting, s); _delete(s); } diff --git a/3rdparty/libconfig/extra/gen/scanner.l b/3rdparty/libconfig/extra/gen/scanner.l index 6bcce8116..60ede1ca7 100644 --- a/3rdparty/libconfig/extra/gen/scanner.l +++ b/3rdparty/libconfig/extra/gen/scanner.l @@ -1,8 +1,8 @@ /* -*- mode: C -*- */ /* -------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -23,33 +23,30 @@ */ %option nounistd +%option never-interactive %option reentrant %option noyywrap %option yylineno %option nounput %option bison-bridge -%option never-interactive %option header-file="scanner.h" %option outfile="lex.yy.c" %option extra-type="struct scan_context *" -%top{ -#include "scanctx.h" -} - %{ + #ifdef _MSC_VER #pragma warning (disable: 4996) -/* disable MSVC warning "signed/unsigned mismatch" associated with code generated by flex versions such as 2.5.35. */ -#pragma warning (disable:4018) #endif #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <limits.h> +#include "parsectx.h" +#include "scanctx.h" #include "grammar.h" #include "wincompat.h" -#include "parsectx.h" #define YY_NO_INPUT // Suppress generation of useless input() function @@ -87,18 +84,11 @@ static unsigned long long fromhex(const char *s) #endif /* __MINGW32__ */ } -static int fromihex(const char *s) { - unsigned long l = strtoul(s, NULL, 16); - if (l > INT32_MAX) - l &= INT32_MAX; - return (int)l; -} - %} true [Tt][Rr][Uu][Ee] false [Ff][Aa][Ll][Ss][Ee] -name [A-Za-z0-9\*][-A-Za-z0-9_\*'.]* +name [A-Za-z0-9\*][-A-Za-z0-9_\*.]* integer [-+]?[0-9]+ integer64 [-+]?[0-9]+L(L)? hex 0[Xx][0-9A-Fa-f]+ @@ -183,9 +173,28 @@ include_open ^[ \t]*@include[ \t]+\" {true} { yylval->ival = 1; return(TOK_BOOLEAN); } {false} { yylval->ival = 0; return(TOK_BOOLEAN); } {float} { yylval->fval = atof(yytext); return(TOK_FLOAT); } -{integer} { yylval->ival = atoi(yytext); return(TOK_INTEGER); } +{integer} { + long long llval; + llval = atoll(yytext); + if((llval < INT_MIN) || (llval > INT_MAX)) + { + yylval->llval = llval; + return(TOK_INTEGER64); + } + else + { + yylval->ival = (int)llval; + return(TOK_INTEGER); + } + } {integer64} { yylval->llval = atoll(yytext); return(TOK_INTEGER64); } -{hex} { yylval->ival = fromihex(yytext); return(TOK_HEX); } +{hex} { + unsigned long ulval = strtoul(yytext, NULL, 16); + if (ulval > INT32_MAX) + ulval &= INT32_MAX; + yylval->ival = (int)ulval; + return(TOK_HEX); + } {hex64} { yylval->llval = fromhex(yytext); return(TOK_HEX64); } {name} { yylval->sval = yytext; return(TOK_NAME); } \[ { return(TOK_ARRAY_START); } diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c index eb00552e2..a1b099678 100644 --- a/3rdparty/libconfig/grammar.c +++ b/3rdparty/libconfig/grammar.c @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,23 +58,17 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse libconfig_yyparse #define yylex libconfig_yylex #define yyerror libconfig_yyerror -#define yylval libconfig_yylval -#define yychar libconfig_yychar #define yydebug libconfig_yydebug #define yynerrs libconfig_yynerrs /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 32 "grammar.y" +#line 33 "grammar.y" /* yacc.c:339 */ #include <string.h> #include <stdlib.h> @@ -99,7 +93,7 @@ extern int libconfig_yyget_lineno(); static const char *err_array_elem_type = "mismatched element type in array"; static const char *err_duplicate_setting = "duplicate setting name"; -#define _delete(P) free((void *)(P)) +#define _delete(P) free(P) #define IN_ARRAY() \ (ctx->parent && (ctx->parent->type == CONFIG_TYPE_ARRAY)) @@ -108,7 +102,7 @@ static const char *err_duplicate_setting = "duplicate setting name"; (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST)) static void capture_parse_pos(void *scanner, struct scan_context *scan_ctx, - config_setting_t *setting) + struct config_setting_t *setting) { setting->line = (unsigned int)libconfig_yyget_lineno(scanner); setting->file = scanctx_current_filename(scan_ctx); @@ -126,14 +120,15 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, } +#line 124 "grammar.c" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 132 "grammar.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -143,39 +138,44 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "y.tab.h". */ +#ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +# define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int libconfig_yydebug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_BOOLEAN = 258, - TOK_INTEGER = 259, - TOK_HEX = 260, - TOK_INTEGER64 = 261, - TOK_HEX64 = 262, - TOK_FLOAT = 263, - TOK_STRING = 264, - TOK_NAME = 265, - TOK_EQUALS = 266, - TOK_NEWLINE = 267, - TOK_ARRAY_START = 268, - TOK_ARRAY_END = 269, - TOK_LIST_START = 270, - TOK_LIST_END = 271, - TOK_COMMA = 272, - TOK_GROUP_START = 273, - TOK_GROUP_END = 274, - TOK_SEMICOLON = 275, - TOK_GARBAGE = 276, - TOK_ERROR = 277 - }; + enum yytokentype + { + TOK_BOOLEAN = 258, + TOK_INTEGER = 259, + TOK_HEX = 260, + TOK_INTEGER64 = 261, + TOK_HEX64 = 262, + TOK_FLOAT = 263, + TOK_STRING = 264, + TOK_NAME = 265, + TOK_EQUALS = 266, + TOK_NEWLINE = 267, + TOK_ARRAY_START = 268, + TOK_ARRAY_END = 269, + TOK_LIST_START = 270, + TOK_LIST_END = 271, + TOK_COMMA = 272, + TOK_GROUP_START = 273, + TOK_GROUP_END = 274, + TOK_SEMICOLON = 275, + TOK_GARBAGE = 276, + TOK_ERROR = 277 + }; #endif /* Tokens. */ #define TOK_BOOLEAN 258 @@ -199,37 +199,35 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, #define TOK_GARBAGE 276 #define TOK_ERROR 277 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ -/* Line 293 of yacc.c */ -#line 85 "grammar.y" +union YYSTYPE +{ +#line 86 "grammar.y" /* yacc.c:355 */ int ival; long long llval; double fval; char *sval; +#line 215 "grammar.c" /* yacc.c:355 */ +}; - -/* Line 293 of yacc.c */ -#line 221 "grammar.c" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -/* Copy the second part of user declarations. */ +int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); + +#endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED */ + +/* Copy the second part of user declarations. */ -/* Line 343 of yacc.c */ -#line 233 "grammar.c" +#line 231 "grammar.c" /* yacc.c:358 */ #ifdef short # undef short @@ -243,11 +241,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -267,8 +262,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -282,39 +276,68 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -332,9 +355,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -344,8 +367,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* 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 @@ -361,7 +384,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -369,15 +392,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -387,7 +408,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -412,35 +433,35 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -456,17 +477,19 @@ union yyalloc #define YYNNTS 23 /* YYNRULES -- Number of rules. */ #define YYNRULES 43 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 51 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 277 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -500,44 +523,18 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 6, 8, 11, 12, 14, 15, - 17, 19, 20, 22, 23, 29, 30, 35, 36, 41, - 43, 45, 47, 49, 51, 54, 56, 58, 60, 62, - 64, 66, 68, 70, 74, 77, 78, 80, 82, 86, - 89, 90, 92, 93 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 24, 0, -1, -1, 25, -1, 29, -1, 25, 29, - -1, -1, 25, -1, -1, 20, -1, 17, -1, -1, - 17, -1, -1, 10, 30, 11, 35, 27, -1, -1, - 13, 32, 43, 14, -1, -1, 15, 34, 40, 16, - -1, 37, -1, 31, -1, 33, -1, 44, -1, 9, - -1, 36, 9, -1, 3, -1, 4, -1, 6, -1, - 5, -1, 7, -1, 8, -1, 36, -1, 35, -1, - 38, 17, 35, -1, 38, 28, -1, -1, 39, -1, - 37, -1, 41, 17, 37, -1, 41, 28, -1, -1, - 42, -1, -1, 18, 45, 26, 19, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 100, 100, 102, 106, 107, 110, 112, 115, 117, - 118, 121, 123, 128, 127, 147, 146, 170, 169, 192, - 193, 194, 195, 199, 200, 204, 224, 246, 268, 290, - 312, 330, 358, 359, 363, 366, 368, 372, 373, 377, - 380, 382, 387, 386 + 0, 101, 101, 103, 107, 108, 111, 113, 116, 118, + 119, 122, 124, 129, 128, 148, 147, 171, 170, 193, + 194, 195, 196, 200, 201, 205, 225, 247, 269, 291, + 313, 331, 359, 360, 364, 367, 369, 373, 374, 378, + 381, 383, 388, 387 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -551,13 +548,13 @@ static const char *const yytname[] = "setting_terminator", "comma_optional", "setting", "$@1", "array", "$@2", "list", "$@3", "value", "string", "simple_value", "value_list_sub", "value_list", "value_list_optional", "simple_value_list_sub", - "simple_value_list", "simple_value_list_optional", "group", "$@4", 0 + "simple_value_list", "simple_value_list_optional", "group", "$@4", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -566,50 +563,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 27, 28, 28, 30, 29, 32, 31, 34, 33, 35, - 35, 35, 35, 36, 36, 37, 37, 37, 37, 37, - 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, - 43, 43, 45, 44 -}; +#define YYPACT_NINF -26 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 1, 1, 2, 0, 1, 0, 1, - 1, 0, 1, 0, 5, 0, 4, 0, 4, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 2, 0, 1, 1, 3, 2, - 0, 1, 0, 4 -}; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-26))) -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 13, 0, 3, 4, 0, 1, 5, 0, 25, - 26, 28, 27, 29, 30, 23, 15, 17, 42, 20, - 21, 8, 31, 19, 22, 40, 35, 6, 10, 9, - 14, 24, 37, 11, 41, 0, 32, 11, 36, 0, - 7, 0, 12, 39, 16, 12, 34, 18, 43, 38, - 33 -}; +#define YYTABLE_NINF -1 -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 2, 3, 41, 30, 43, 4, 5, 19, 25, - 20, 26, 21, 22, 23, 37, 38, 39, 33, 34, - 35, 24, 27 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -26 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { 2, -26, 10, 2, -26, 5, -26, -26, 0, -26, @@ -620,7 +585,20 @@ static const yytype_int8 yypact[] = -26 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 13, 0, 3, 4, 0, 1, 5, 0, 25, + 26, 28, 27, 29, 30, 23, 15, 17, 42, 20, + 21, 8, 31, 19, 22, 40, 35, 6, 10, 9, + 14, 24, 37, 11, 41, 0, 32, 11, 36, 0, + 7, 0, 12, 39, 16, 12, 34, 18, 43, 38, + 33 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -26, -26, 6, -26, -26, -2, -3, -26, -26, -26, @@ -628,10 +606,17 @@ static const yytype_int8 yypgoto[] = -26, -26, -26 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 3, 41, 30, 43, 4, 5, 19, 25, + 20, 26, 21, 22, 23, 37, 38, 39, 33, 34, + 35, 24, 27 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 7, 36, 32, 9, 10, 11, 12, 13, 14, 15, @@ -640,12 +625,6 @@ static const yytype_uint8 yytable[] = 45, 48, 47, 40, 0, 46, 0, 7 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-26)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 3, 26, 25, 3, 4, 5, 6, 7, 8, 9, @@ -654,8 +633,8 @@ static const yytype_int8 yycheck[] = 17, 19, 16, 27, -1, 37, -1, 40 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 10, 24, 25, 29, 30, 0, 29, 11, 3, @@ -666,94 +645,61 @@ static const yytype_uint8 yystos[] = 35 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 27, 28, 28, 30, 29, 32, 31, 34, 33, 35, + 35, 35, 35, 36, 36, 37, 37, 37, 37, 37, + 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, + 43, 43, 45, 44 +}; -#define YYRECOVERING() (!!yyerrstatus) + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 1, 1, 2, 0, 1, 0, 1, + 1, 0, 1, 0, 5, 0, 4, 0, 4, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 2, 0, 1, 1, 3, 2, + 0, 1, 0, 4 +}; -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* 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) \ - do \ - if (YYID (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 (YYID (0)) -#endif +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -/* This macro is provided for backward compatibility. */ +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, scanner) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -763,60 +709,49 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, scanner, ctx, scan_ctx); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, scanner, ctx, scan_ctx); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - void *scanner; - struct parse_context *ctx; - struct scan_context *scan_ctx; -#endif { - if (!yyvaluep) - return; + FILE *yyo = yyoutput; + YYUSE (yyo); YYUSE (scanner); YYUSE (ctx); YYUSE (scan_ctx); + if (!yyvaluep) + return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -824,25 +759,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - void *scanner; - struct parse_context *ctx; - struct scan_context *scan_ctx; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx); YYFPRINTF (yyoutput, ")"); @@ -853,16 +774,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -873,52 +786,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) -#else static void -yy_reduce_print (yyvsp, yyrule, scanner, ctx, scan_ctx) - YYSTYPE *yyvsp; - int yyrule; - void *scanner; - struct parse_context *ctx; - struct scan_context *scan_ctx; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , scanner, ctx, scan_ctx); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , scanner, ctx, scan_ctx); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule, scanner, ctx, scan_ctx); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, scanner, ctx, scan_ctx); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -932,7 +835,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -955,15 +858,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -979,16 +875,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1018,27 +906,27 @@ yytnamerr (char *yyres, const char *yystr) 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; - } + 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: ; } @@ -1061,12 +949,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1074,10 +961,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1126,11 +1009,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1150,10 +1035,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1190,87 +1077,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, scanner, ctx, scan_ctx) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - void *scanner; - struct parse_context *ctx; - struct scan_context *scan_ctx; -#endif { YYUSE (yyvaluep); YYUSE (scanner); YYUSE (ctx); YYUSE (scan_ctx); + YY_SYMBOL_PRINT (yymsg != NULL ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); - YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx) -#else -int -yyparse (scanner, ctx, scan_ctx) - void *scanner; - struct parse_context *ctx; - struct scan_context *scan_ctx; -#endif -#endif { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1280,10 +1119,10 @@ YYSTYPE yylval; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1301,7 +1140,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1319,9 +1158,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1330,14 +1168,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1358,23 +1188,23 @@ YYSTYPE yylval; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *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 (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *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 (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1382,22 +1212,22 @@ YYSTYPE yylval; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1406,10 +1236,10 @@ YYSTYPE yylval; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1438,7 +1268,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, scanner); } if (yychar <= YYEOF) @@ -1478,7 +1308,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1501,7 +1333,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1515,11 +1347,9 @@ yyreduce: switch (yyn) { case 13: - -/* Line 1806 of yacc.c */ -#line 128 "grammar.y" +#line 129 "grammar.y" /* yacc.c:1661 */ { - ctx->setting = config_setting_add(ctx->parent, (yyvsp[(1) - (1)].sval), CONFIG_TYPE_NONE); + ctx->setting = config_setting_add(ctx->parent, (yyvsp[0].sval), CONFIG_TYPE_NONE); if(ctx->setting == NULL) { @@ -1531,12 +1361,11 @@ yyreduce: CAPTURE_PARSE_POS(ctx->setting); } } +#line 1367 "grammar.c" /* yacc.c:1661 */ break; case 15: - -/* Line 1806 of yacc.c */ -#line 147 "grammar.y" +#line 148 "grammar.y" /* yacc.c:1661 */ { if(IN_LIST()) { @@ -1550,22 +1379,20 @@ yyreduce: ctx->setting = NULL; } } +#line 1385 "grammar.c" /* yacc.c:1661 */ break; case 16: - -/* Line 1806 of yacc.c */ -#line 162 "grammar.y" +#line 163 "grammar.y" /* yacc.c:1661 */ { if(ctx->parent) ctx->parent = ctx->parent->parent; } +#line 1394 "grammar.c" /* yacc.c:1661 */ break; case 17: - -/* Line 1806 of yacc.c */ -#line 170 "grammar.y" +#line 171 "grammar.y" /* yacc.c:1661 */ { if(IN_LIST()) { @@ -1579,41 +1406,37 @@ yyreduce: ctx->setting = NULL; } } +#line 1412 "grammar.c" /* yacc.c:1661 */ break; case 18: - -/* Line 1806 of yacc.c */ -#line 185 "grammar.y" +#line 186 "grammar.y" /* yacc.c:1661 */ { if(ctx->parent) ctx->parent = ctx->parent->parent; } +#line 1421 "grammar.c" /* yacc.c:1661 */ break; case 23: - -/* Line 1806 of yacc.c */ -#line 199 "grammar.y" - { parsectx_append_string(ctx, (yyvsp[(1) - (1)].sval)); free((yyvsp[(1) - (1)].sval)); } +#line 200 "grammar.y" /* yacc.c:1661 */ + { parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); } +#line 1427 "grammar.c" /* yacc.c:1661 */ break; case 24: - -/* Line 1806 of yacc.c */ -#line 200 "grammar.y" - { parsectx_append_string(ctx, (yyvsp[(2) - (2)].sval)); free((yyvsp[(2) - (2)].sval)); } +#line 201 "grammar.y" /* yacc.c:1661 */ + { parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); } +#line 1433 "grammar.c" /* yacc.c:1661 */ break; case 25: - -/* Line 1806 of yacc.c */ -#line 205 "grammar.y" +#line 206 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, - (int)(yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, + (int)(yyvsp[0].ival)); if(! e) { @@ -1626,18 +1449,17 @@ yyreduce: } } else - config_setting_set_bool(ctx->setting, (int)(yyvsp[(1) - (1)].ival)); + config_setting_set_bool(ctx->setting, (int)(yyvsp[0].ival)); } +#line 1457 "grammar.c" /* yacc.c:1661 */ break; case 26: - -/* Line 1806 of yacc.c */ -#line 225 "grammar.y" +#line 226 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1651,20 +1473,19 @@ yyreduce: } else { - config_setting_set_int(ctx->setting, (yyvsp[(1) - (1)].ival)); + config_setting_set_int(ctx->setting, (yyvsp[0].ival)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT); } } +#line 1483 "grammar.c" /* yacc.c:1661 */ break; case 27: - -/* Line 1806 of yacc.c */ -#line 247 "grammar.y" +#line 248 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1678,20 +1499,19 @@ yyreduce: } else { - config_setting_set_int64(ctx->setting, (yyvsp[(1) - (1)].llval)); + config_setting_set_int64(ctx->setting, (yyvsp[0].llval)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT); } } +#line 1509 "grammar.c" /* yacc.c:1661 */ break; case 28: - -/* Line 1806 of yacc.c */ -#line 269 "grammar.y" +#line 270 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1705,20 +1525,19 @@ yyreduce: } else { - config_setting_set_int(ctx->setting, (yyvsp[(1) - (1)].ival)); + config_setting_set_int(ctx->setting, (yyvsp[0].ival)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX); } } +#line 1535 "grammar.c" /* yacc.c:1661 */ break; case 29: - -/* Line 1806 of yacc.c */ -#line 291 "grammar.y" +#line 292 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1732,20 +1551,19 @@ yyreduce: } else { - config_setting_set_int64(ctx->setting, (yyvsp[(1) - (1)].llval)); + config_setting_set_int64(ctx->setting, (yyvsp[0].llval)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX); } } +#line 1561 "grammar.c" /* yacc.c:1661 */ break; case 30: - -/* Line 1806 of yacc.c */ -#line 313 "grammar.y" +#line 314 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[(1) - (1)].fval)); + struct config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[0].fval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1757,19 +1575,18 @@ yyreduce: } } else - config_setting_set_float(ctx->setting, (yyvsp[(1) - (1)].fval)); + config_setting_set_float(ctx->setting, (yyvsp[0].fval)); } +#line 1583 "grammar.c" /* yacc.c:1661 */ break; case 31: - -/* Line 1806 of yacc.c */ -#line 331 "grammar.y" +#line 332 "grammar.y" /* yacc.c:1661 */ { if(IN_ARRAY() || IN_LIST()) { - const char *s = parsectx_take_string(ctx); - config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); + char *s = parsectx_take_string(ctx); + struct config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); _delete(s); if(! e) @@ -1784,17 +1601,16 @@ yyreduce: } else { - const char *s = parsectx_take_string(ctx); + char *s = parsectx_take_string(ctx); config_setting_set_string(ctx->setting, s); _delete(s); } } +#line 1612 "grammar.c" /* yacc.c:1661 */ break; case 42: - -/* Line 1806 of yacc.c */ -#line 387 "grammar.y" +#line 388 "grammar.y" /* yacc.c:1661 */ { if(IN_LIST()) { @@ -1808,22 +1624,20 @@ yyreduce: ctx->setting = NULL; } } +#line 1630 "grammar.c" /* yacc.c:1661 */ break; case 43: - -/* Line 1806 of yacc.c */ -#line 402 "grammar.y" +#line 403 "grammar.y" /* yacc.c:1661 */ { if(ctx->parent) ctx->parent = ctx->parent->parent; } +#line 1639 "grammar.c" /* yacc.c:1661 */ break; - -/* Line 1806 of yacc.c */ -#line 1829 "grammar.c" +#line 1643 "grammar.c" /* yacc.c:1661 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1845,7 +1659,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1860,9 +1674,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1913,20 +1727,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, scanner, ctx, scan_ctx); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, scanner, ctx, scan_ctx); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -1945,7 +1759,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1958,35 +1772,37 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp, scanner, ctx, scan_ctx); + yystos[yystate], yyvsp, scanner, ctx, scan_ctx); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2010,7 +1826,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2029,14 +1845,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, scanner, ctx, scan_ctx); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, scanner, ctx, scan_ctx); + yystos[*yyssp], yyvsp, scanner, ctx, scan_ctx); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2047,13 +1863,7 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 408 "grammar.y" - +#line 409 "grammar.y" /* yacc.c:1906 */ diff --git a/3rdparty/libconfig/grammar.h b/3rdparty/libconfig/grammar.h index d7fd02cc8..09e7ae0b4 100644 --- a/3rdparty/libconfig/grammar.h +++ b/3rdparty/libconfig/grammar.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -26,38 +26,46 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +# define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int libconfig_yydebug; +#endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_BOOLEAN = 258, - TOK_INTEGER = 259, - TOK_HEX = 260, - TOK_INTEGER64 = 261, - TOK_HEX64 = 262, - TOK_FLOAT = 263, - TOK_STRING = 264, - TOK_NAME = 265, - TOK_EQUALS = 266, - TOK_NEWLINE = 267, - TOK_ARRAY_START = 268, - TOK_ARRAY_END = 269, - TOK_LIST_START = 270, - TOK_LIST_END = 271, - TOK_COMMA = 272, - TOK_GROUP_START = 273, - TOK_GROUP_END = 274, - TOK_SEMICOLON = 275, - TOK_GARBAGE = 276, - TOK_ERROR = 277 - }; + enum yytokentype + { + TOK_BOOLEAN = 258, + TOK_INTEGER = 259, + TOK_HEX = 260, + TOK_INTEGER64 = 261, + TOK_HEX64 = 262, + TOK_FLOAT = 263, + TOK_STRING = 264, + TOK_NAME = 265, + TOK_EQUALS = 266, + TOK_NEWLINE = 267, + TOK_ARRAY_START = 268, + TOK_ARRAY_END = 269, + TOK_LIST_START = 270, + TOK_LIST_END = 271, + TOK_COMMA = 272, + TOK_GROUP_START = 273, + TOK_GROUP_END = 274, + TOK_SEMICOLON = 275, + TOK_GARBAGE = 276, + TOK_ERROR = 277 + }; #endif /* Tokens. */ #define TOK_BOOLEAN 258 @@ -81,31 +89,28 @@ #define TOK_GARBAGE 276 #define TOK_ERROR 277 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ -/* Line 2068 of yacc.c */ -#line 85 "grammar.y" +union YYSTYPE +{ +#line 86 "grammar.y" /* yacc.c:1915 */ int ival; long long llval; double fval; char *sval; +#line 105 "grammar.h" /* yacc.c:1915 */ +}; - -/* Line 2068 of yacc.c */ -#line 103 "grammar.h" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); +#endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED */ diff --git a/3rdparty/libconfig/libconfig-1.4.9 b/3rdparty/libconfig/libconfig-1.4.9 deleted file mode 100644 index e69de29bb..000000000 --- a/3rdparty/libconfig/libconfig-1.4.9 +++ /dev/null diff --git a/3rdparty/libconfig/libconfig-1.5 b/3rdparty/libconfig/libconfig-1.5 new file mode 100644 index 000000000..bf5328dcd --- /dev/null +++ b/3rdparty/libconfig/libconfig-1.5 @@ -0,0 +1,2 @@ +Based on https://github.com/hyperrealm/libconfig/releases/tag/v1.5 +f9f23d7a95608936ea7d839731dbd56f1667b7ed diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index 3d03ede9a..5b6eaac73 100644 --- a/3rdparty/libconfig/libconfig.c +++ b/3rdparty/libconfig/libconfig.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -24,56 +24,56 @@ #include "ac_config.h" #endif -#include "libconfig.h" -#include "grammar.h" -#include "scanner.h" -#include "scanctx.h" -#include "parsectx.h" -#include "wincompat.h" - #include <locale.h> #ifdef HAVE_XLOCALE_H #include <xlocale.h> #endif +#include <ctype.h> +#include <float.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include "libconfig.h" +#include "parsectx.h" +#include "scanctx.h" +#include "wincompat.h" +#include "grammar.h" +#include "scanner.h" #define PATH_TOKENS ":/" #define CHUNK_SIZE 16 -#define FLOAT_PRECISION 10 +#define FLOAT_PRECISION DBL_DIG -#define _new(T) (T *)calloc(sizeof(T), 1) /* zeroed */ -#define _delete(P) free((void *)(P)) +#define _new(T) calloc(1, sizeof(T)) /* zeroed */ +#define _delete(P) free(P) /* ------------------------------------------------------------------------- */ #ifndef LIBCONFIG_STATIC -#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \ + || defined(WIN64) || defined(_WIN64)) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return(TRUE); } -#endif /* WIN32 */ +#endif /* WIN32 || WIN64 */ #endif /* LIBCONFIG_STATIC */ /* ------------------------------------------------------------------------- */ static const char *__io_error = "file I/O error"; -static void __config_list_destroy(config_list_t *list); -static void __config_write_setting(const config_setting_t *setting, - FILE *stream, int depth, - unsigned short tab_width); - -extern int libconfig_yyparse(void *scanner, struct parse_context *ctx, - struct scan_context *scan_ctx); -extern int libconfig_yylex_init_extra(struct scan_context *scan_ctx, - yyscan_t *scanner); +static void __config_list_destroy(struct config_list_t *list); +static void __config_write_setting(const struct config_t *config, + const struct config_setting_t *setting, + FILE *stream, int depth); /* ------------------------------------------------------------------------- */ @@ -106,6 +106,11 @@ static void __config_locale_override(void) /* ------------------------------------------------------------------------- */ +#define __config_has_option(C, O) \ + (((C)->options & (O)) != 0) + +/* ------------------------------------------------------------------------- */ + static void __config_locale_restore(void) { #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \ @@ -169,9 +174,9 @@ static void __config_indent(FILE *stream, int depth, unsigned short w) /* ------------------------------------------------------------------------- */ -static void __config_write_value(const config_value_t *value, int type, - int format, int depth, - unsigned short tab_width, FILE *stream) +static void __config_write_value(const struct config_t *config, + const union config_value_t *value, int type, + int format, int depth, FILE *stream) { char fbuf[64]; @@ -187,7 +192,7 @@ static void __config_write_value(const config_value_t *value, int type, switch(format) { case CONFIG_FORMAT_HEX: - fprintf(stream, "0x%X", value->ival); + fprintf(stream, "0x%X", (unsigned int)(value->ival)); break; case CONFIG_FORMAT_DEFAULT: @@ -202,7 +207,7 @@ static void __config_write_value(const config_value_t *value, int type, switch(format) { case CONFIG_FORMAT_HEX: - fprintf(stream, "0x" INT64_HEX_FMT "L", value->llval); + fprintf(stream, "0x" INT64_HEX_FMT "L", (unsigned long long)(value->llval)); break; case CONFIG_FORMAT_DEFAULT: @@ -286,7 +291,7 @@ static void __config_write_value(const config_value_t *value, int type, if(c >= ' ') fputc(c, stream); else - fprintf(stream, "\\x%02X", c); + fprintf(stream, "\\x%02X", (unsigned int)(c)); } } } @@ -297,20 +302,20 @@ static void __config_write_value(const config_value_t *value, int type, /* list */ case CONFIG_TYPE_LIST: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; fprintf(stream, "( "); if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) { - __config_write_value(&((*s)->value), (*s)->type, - config_setting_get_format(*s), - depth + 1, tab_width, stream); + __config_write_value(config, &((*s)->value), (*s)->type, + config_setting_get_format(*s), depth + 1, + stream); if(len) fputc(',', stream); @@ -326,20 +331,20 @@ static void __config_write_value(const config_value_t *value, int type, /* array */ case CONFIG_TYPE_ARRAY: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; fprintf(stream, "[ "); if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) { - __config_write_value(&((*s)->value), (*s)->type, - config_setting_get_format(*s), - depth + 1, tab_width, stream); + __config_write_value(config, &((*s)->value), (*s)->type, + config_setting_get_format(*s), depth + 1, + stream); if(len) fputc(',', stream); @@ -355,32 +360,32 @@ static void __config_write_value(const config_value_t *value, int type, /* group */ case CONFIG_TYPE_GROUP: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; if(depth > 0) { -#ifdef K_AND_R_STYLE /* Horrendous, but many people like it. */ - fputc(' ', stream); -#else - fputc('\n', stream); + if((config->options & CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE) != 0) + { + fputc('\n', stream); + + if(depth > 1) + __config_indent(stream, depth, config->tab_width); + } - if(depth > 1) - __config_indent(stream, depth, tab_width); -#endif fprintf(stream, "{\n"); } if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) - __config_write_setting(*s, stream, depth + 1, tab_width); + __config_write_setting(config, *s, stream, depth + 1); } if(depth > 1) - __config_indent(stream, depth, tab_width); + __config_indent(stream, depth, config->tab_width); if(depth > 0) fputc('}', stream); @@ -397,13 +402,13 @@ static void __config_write_value(const config_value_t *value, int type, /* ------------------------------------------------------------------------- */ -static void __config_list_add(config_list_t *list, config_setting_t *setting) +static void __config_list_add(struct config_list_t *list, struct config_setting_t *setting) { if((list->length % CHUNK_SIZE) == 0) { - list->elements = (config_setting_t **)realloc( + list->elements = (struct config_setting_t **)realloc( list->elements, - (list->length + CHUNK_SIZE) * sizeof(config_setting_t *)); + (list->length + CHUNK_SIZE) * sizeof(struct config_setting_t *)); } list->elements[list->length] = setting; @@ -412,11 +417,11 @@ static void __config_list_add(config_list_t *list, config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static config_setting_t *__config_list_search(config_list_t *list, +static struct config_setting_t *__config_list_search(struct config_list_t *list, const char *name, unsigned int *idx) { - config_setting_t **found = NULL; + struct config_setting_t **found = NULL; unsigned int i; if(! list) @@ -441,15 +446,15 @@ static config_setting_t *__config_list_search(config_list_t *list, /* ------------------------------------------------------------------------- */ -static config_setting_t *__config_list_remove(config_list_t *list, int idx) +static struct config_setting_t *__config_list_remove(struct config_list_t *list, int idx) { - config_setting_t *removed = *(list->elements + idx); - int offset = (idx * sizeof(config_setting_t *)); + struct config_setting_t *removed = *(list->elements + idx); + int offset = (idx * sizeof(struct config_setting_t *)); int len = list->length - 1 - idx; char *base = (char *)list->elements + offset; - memmove(base, base + sizeof(config_setting_t *), - len * sizeof(config_setting_t *)); + memmove(base, base + sizeof(struct config_setting_t *), + len * sizeof(struct config_setting_t *)); list->length--; @@ -460,7 +465,7 @@ static config_setting_t *__config_list_remove(config_list_t *list, int idx) /* ------------------------------------------------------------------------- */ -static void __config_setting_destroy(config_setting_t *setting) +static void __config_setting_destroy(struct config_setting_t *setting) { if(setting) { @@ -487,9 +492,9 @@ static void __config_setting_destroy(config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static void __config_list_destroy(config_list_t *list) +static void __config_list_destroy(struct config_list_t *list) { - config_setting_t **p; + struct config_setting_t **p; unsigned int i; if(! list) @@ -508,7 +513,7 @@ static void __config_list_destroy(config_list_t *list) /* ------------------------------------------------------------------------- */ -static int __config_vector_checktype(const config_setting_t *vector, int type) +static int __config_vector_checktype(const struct config_setting_t *vector, int type) { /* if the array is empty, then it has no type yet */ @@ -538,9 +543,8 @@ static int __config_validate_name(const char *name) if(*p == '\0') return(CONFIG_FALSE); - if(! isalpha((int)*p) && !isdigit((int)*p) && (*p != '*')) { + if(! isalpha((int)*p) && !isdigit((int)*p) && (*p != '*')) return(CONFIG_FALSE); - } for(++p; *p; ++p) { @@ -553,20 +557,19 @@ static int __config_validate_name(const char *name) /* ------------------------------------------------------------------------- */ -static int __config_read(config_t *config, FILE *stream, const char *filename, +static int __config_read(struct config_t *config, FILE *stream, const char *filename, const char *str) { yyscan_t scanner; struct scan_context scan_ctx; struct parse_context parse_ctx; - /*YY_BUFFER_STATE buffer = NULL;*/ int r; /* Reinitialize the config */ void (*destructor)(void *) = config->destructor; - const char *include_dir = config->include_dir; + char *include_dir = config->include_dir; unsigned short tab_width = config->tab_width; - unsigned short flags = config->flags; + int options = config->options; config->include_dir = NULL; config_destroy(config); @@ -575,7 +578,7 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, config->destructor = destructor; config->include_dir = include_dir; config->tab_width = tab_width; - config->flags = flags; + config->options = options; parsectx_init(&parse_ctx); parse_ctx.config = config; @@ -585,13 +588,14 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, __config_locale_override(); scanctx_init(&scan_ctx, filename); + config->root->file = scanctx_current_filename(&scan_ctx); scan_ctx.config = config; libconfig_yylex_init_extra(&scan_ctx, &scanner); if(stream) libconfig_yyrestart(stream, scanner); else /* read from string */ - /*buffer = */libconfig_yy_scan_string(str, scanner); + (void)libconfig_yy_scan_string(str, scanner); libconfig_yyset_lineno(1, scanner); r = libconfig_yyparse(scanner, &parse_ctx, &scan_ctx); @@ -619,63 +623,91 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, /* ------------------------------------------------------------------------- */ -int config_read(config_t *config, FILE *stream) +int config_read(struct config_t *config, FILE *stream) { return(__config_read(config, stream, NULL, NULL)); } /* ------------------------------------------------------------------------- */ -int config_read_string(config_t *config, const char *str) +int config_read_string(struct config_t *config, const char *str) { return(__config_read(config, NULL, NULL, str)); } /* ------------------------------------------------------------------------- */ -static void __config_write_setting(const config_setting_t *setting, - FILE *stream, int depth, - unsigned short tab_width) +static void __config_write_setting(const struct config_t *config, + const struct config_setting_t *setting, + FILE *stream, int depth) { + char group_assign_char = __config_has_option( + config, CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS) ? ':' : '='; + + char nongroup_assign_char = __config_has_option( + config, CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS) ? ':' : '='; + if(depth > 1) - __config_indent(stream, depth, tab_width); + __config_indent(stream, depth, config->tab_width); + if(setting->name) { fputs(setting->name, stream); - fprintf(stream, " %c ", (setting->type == CONFIG_TYPE_GROUP ? ':' : '=')); + fprintf(stream, " %c ", ((setting->type == CONFIG_TYPE_GROUP) + ? group_assign_char + : nongroup_assign_char)); } - __config_write_value(&(setting->value), setting->type, - config_setting_get_format(setting), - depth, tab_width, stream); + __config_write_value(config, &(setting->value), setting->type, + config_setting_get_format(setting), depth, stream); if(depth > 0) { - fputc(';', stream); + if(__config_has_option(config, CONFIG_OPTION_SEMICOLON_SEPARATORS)) + fputc(';', stream); + fputc('\n', stream); } } /* ------------------------------------------------------------------------- */ -void config_write(const config_t *config, FILE *stream) +void config_write(const struct config_t *config, FILE *stream) { __config_locale_override(); - __config_write_setting(config->root, stream, 0, config->tab_width); + __config_write_setting(config, config->root, stream, 0); __config_locale_restore(); } /* ------------------------------------------------------------------------- */ -int config_read_file(config_t *config, const char *filename) +int config_read_file(struct config_t *config, const char *filename) { - int ret; + int ret, ok = 0; + FILE *stream = fopen(filename, "rt"); - if(! stream) + if(stream != NULL) + { + // On some operating systems, fopen() succeeds on a directory. + int fd = fileno(stream); + struct stat statbuf; + + if(fstat(fd, &statbuf) == 0) + { + // Only proceed if this is not a directory. + if(!S_ISDIR(statbuf.st_mode)) + ok = 1; + } + } + + if(!ok) { + if(stream != NULL) + fclose(stream); + config->error_text = __io_error; config->error_type = CONFIG_ERR_FILE_IO; return(CONFIG_FALSE); @@ -689,28 +721,29 @@ int config_read_file(config_t *config, const char *filename) /* ------------------------------------------------------------------------- */ -int config_write_file(config_t *config, const char *filename) +int config_write_file(struct config_t *config, const char *filename) { - FILE *f = fopen(filename, "wt"); - if(! f) + FILE *stream = fopen(filename, "wt"); + if(stream == NULL) { config->error_text = __io_error; config->error_type = CONFIG_ERR_FILE_IO; + config->error_file = filename; return(CONFIG_FALSE); } - config_write(config, f); - fclose(f); + config_write(config, stream); + fclose(stream); config->error_type = CONFIG_ERR_NONE; return(CONFIG_TRUE); } /* ------------------------------------------------------------------------- */ -void config_destroy(config_t *config) +void config_destroy(struct config_t *config) { unsigned int count = config->num_filenames; - const char **f; + char **f; __config_setting_destroy(config->root); @@ -720,52 +753,69 @@ void config_destroy(config_t *config) _delete(config->filenames); _delete(config->include_dir); - memset((void *)config, 0, sizeof(config_t)); + memset((void *)config, 0, sizeof(struct config_t)); } /* ------------------------------------------------------------------------- */ -void config_init(config_t *config) +void config_init(struct config_t *config) { - memset((void *)config, 0, sizeof(config_t)); + memset((void *)config, 0, sizeof(struct config_t)); - config->root = _new(config_setting_t); + config->root = _new(struct config_setting_t); config->root->type = CONFIG_TYPE_GROUP; config->root->config = config; + config->options = (CONFIG_OPTION_SEMICOLON_SEPARATORS + | CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS + | CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE); config->tab_width = 2; } /* ------------------------------------------------------------------------- */ -void config_set_auto_convert(config_t *config, int flag) +void config_set_auto_convert(struct config_t *config, int flag) { if(flag) - config->flags |= CONFIG_OPTION_AUTOCONVERT; + config->options |= CONFIG_OPTION_AUTOCONVERT; else - config->flags &= ~CONFIG_OPTION_AUTOCONVERT; + config->options &= ~CONFIG_OPTION_AUTOCONVERT; +} + +/* ------------------------------------------------------------------------- */ + +int config_get_auto_convert(const struct config_t *config) +{ + return(__config_has_option(config, CONFIG_OPTION_AUTOCONVERT)); +} + +/* ------------------------------------------------------------------------- */ + +void config_set_options(struct config_t *config, int options) +{ + config->options = options; } /* ------------------------------------------------------------------------- */ -int config_get_auto_convert(const config_t *config) +int config_get_options(const struct config_t *config) { - return((config->flags & CONFIG_OPTION_AUTOCONVERT) != 0); + return(config->options); } /* ------------------------------------------------------------------------- */ -static config_setting_t *config_setting_create(config_setting_t *parent, +static struct config_setting_t *config_setting_create(struct config_setting_t *parent, const char *name, int type) { - config_setting_t *setting; - config_list_t *list; + struct config_setting_t *setting; + struct config_list_t *list; if((parent->type != CONFIG_TYPE_GROUP) && (parent->type != CONFIG_TYPE_ARRAY) && (parent->type != CONFIG_TYPE_LIST)) return(NULL); - setting = _new(config_setting_t); + setting = _new(struct config_setting_t); setting->parent = parent; setting->name = (name == NULL) ? NULL : strdup(name); setting->type = type; @@ -776,7 +826,7 @@ static config_setting_t *config_setting_create(config_setting_t *parent, list = parent->value.list; if(! list) - list = parent->value.list = _new(config_list_t); + list = parent->value.list = _new(struct config_list_t); __config_list_add(list, setting); @@ -785,7 +835,7 @@ static config_setting_t *config_setting_create(config_setting_t *parent, /* ------------------------------------------------------------------------- */ -static int __config_setting_get_int(const config_setting_t *setting, +static int __config_setting_get_int(const struct config_setting_t *setting, int *value) { switch(setting->type) @@ -803,7 +853,7 @@ static int __config_setting_get_int(const config_setting_t *setting, return(CONFIG_TRUE); case CONFIG_TYPE_FLOAT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { *value = (int)(setting->value.fval); return(CONFIG_TRUE); @@ -818,7 +868,7 @@ static int __config_setting_get_int(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_get_int(const config_setting_t *setting) +int config_setting_get_int(const struct config_setting_t *setting) { int value = 0; __config_setting_get_int(setting, &value); @@ -827,7 +877,7 @@ int config_setting_get_int(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static int __config_setting_get_int64(const config_setting_t *setting, +static int __config_setting_get_int64(const struct config_setting_t *setting, long long *value) { switch(setting->type) @@ -841,7 +891,7 @@ static int __config_setting_get_int64(const config_setting_t *setting, return(CONFIG_TRUE); case CONFIG_TYPE_FLOAT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { *value = (long long)(setting->value.fval); return(CONFIG_TRUE); @@ -856,7 +906,7 @@ static int __config_setting_get_int64(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -long long config_setting_get_int64(const config_setting_t *setting) +long long config_setting_get_int64(const struct config_setting_t *setting) { long long value = 0; __config_setting_get_int64(setting, &value); @@ -865,10 +915,10 @@ long long config_setting_get_int64(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -int config_setting_lookup_int(const config_setting_t *setting, +int config_setting_lookup_int(const struct config_setting_t *setting, const char *name, int *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -877,10 +927,10 @@ int config_setting_lookup_int(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_int64(const config_setting_t *setting, +int config_setting_lookup_int64(const struct config_setting_t *setting, const char *name, long long *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -889,7 +939,7 @@ int config_setting_lookup_int64(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -static int __config_setting_get_float(const config_setting_t *setting, +static int __config_setting_get_float(const struct config_setting_t *setting, double *value) { switch(setting->type) @@ -923,7 +973,7 @@ static int __config_setting_get_float(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -double config_setting_get_float(const config_setting_t *setting) +double config_setting_get_float(const struct config_setting_t *setting) { double value = 0.0; __config_setting_get_float(setting, &value); @@ -932,10 +982,10 @@ double config_setting_get_float(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -int config_setting_lookup_float(const config_setting_t *setting, +int config_setting_lookup_float(const struct config_setting_t *setting, const char *name, double *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -944,10 +994,10 @@ int config_setting_lookup_float(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_string(const config_setting_t *setting, +int config_setting_lookup_string(const struct config_setting_t *setting, const char *name, const char **value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -960,10 +1010,10 @@ int config_setting_lookup_string(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_bool(const config_setting_t *setting, +int config_setting_lookup_bool(const struct config_setting_t *setting, const char *name, int *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -976,7 +1026,7 @@ int config_setting_lookup_bool(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_set_int(config_setting_t *setting, int value) +int config_setting_set_int(struct config_setting_t *setting, int value) { switch(setting->type) { @@ -1004,7 +1054,7 @@ int config_setting_set_int(config_setting_t *setting, int value) /* ------------------------------------------------------------------------- */ -int config_setting_set_int64(config_setting_t *setting, long long value) +int config_setting_set_int64(struct config_setting_t *setting, long long value) { switch(setting->type) { @@ -1039,7 +1089,7 @@ int config_setting_set_int64(config_setting_t *setting, long long value) /* ------------------------------------------------------------------------- */ -int config_setting_set_float(config_setting_t *setting, double value) +int config_setting_set_float(struct config_setting_t *setting, double value) { switch(setting->type) { @@ -1052,7 +1102,7 @@ int config_setting_set_float(config_setting_t *setting, double value) return(CONFIG_TRUE); case CONFIG_TYPE_INT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { setting->value.ival = (int)value; return(CONFIG_TRUE); @@ -1061,7 +1111,7 @@ int config_setting_set_float(config_setting_t *setting, double value) return(CONFIG_FALSE); case CONFIG_TYPE_INT64: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { setting->value.llval = (long long)value; return(CONFIG_TRUE); @@ -1076,14 +1126,14 @@ int config_setting_set_float(config_setting_t *setting, double value) /* ------------------------------------------------------------------------- */ -int config_setting_get_bool(const config_setting_t *setting) +int config_setting_get_bool(const struct config_setting_t *setting) { return((setting->type == CONFIG_TYPE_BOOL) ? setting->value.ival : 0); } /* ------------------------------------------------------------------------- */ -int config_setting_set_bool(config_setting_t *setting, int value) +int config_setting_set_bool(struct config_setting_t *setting, int value) { if(setting->type == CONFIG_TYPE_NONE) setting->type = CONFIG_TYPE_BOOL; @@ -1096,14 +1146,14 @@ int config_setting_set_bool(config_setting_t *setting, int value) /* ------------------------------------------------------------------------- */ -const char *config_setting_get_string(const config_setting_t *setting) +const char *config_setting_get_string(const struct config_setting_t *setting) { return((setting->type == CONFIG_TYPE_STRING) ? setting->value.sval : NULL); } /* ------------------------------------------------------------------------- */ -int config_setting_set_string(config_setting_t *setting, const char *value) +int config_setting_set_string(struct config_setting_t *setting, const char *value) { if(setting->type == CONFIG_TYPE_NONE) setting->type = CONFIG_TYPE_STRING; @@ -1119,7 +1169,7 @@ int config_setting_set_string(config_setting_t *setting, const char *value) /* ------------------------------------------------------------------------- */ -int config_setting_set_format(config_setting_t *setting, short format) +int config_setting_set_format(struct config_setting_t *setting, short format) { if(((setting->type != CONFIG_TYPE_INT) && (setting->type != CONFIG_TYPE_INT64)) @@ -1133,7 +1183,7 @@ int config_setting_set_format(config_setting_t *setting, short format) /* ------------------------------------------------------------------------- */ -short config_setting_get_format(const config_setting_t *setting) +short config_setting_get_format(const struct config_setting_t *setting) { return(setting->format != 0 ? setting->format : setting->config->default_format); @@ -1141,11 +1191,11 @@ short config_setting_get_format(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -config_setting_t *config_lookup_from(config_setting_t *setting, - const char *path) +struct config_setting_t *config_setting_lookup(struct config_setting_t *setting, + const char *path) { const char *p = path; - config_setting_t *found; + struct config_setting_t *found; for(;;) { @@ -1174,17 +1224,17 @@ config_setting_t *config_lookup_from(config_setting_t *setting, /* ------------------------------------------------------------------------- */ -config_setting_t *config_lookup(const config_t *config, const char *path) +struct config_setting_t *config_lookup(const struct config_t *config, const char *path) { - return(config_lookup_from(config->root, path)); + return(config_setting_lookup(config->root, path)); } /* ------------------------------------------------------------------------- */ -int config_lookup_string(const config_t *config, const char *path, +int config_lookup_string(const struct config_t *config, const char *path, const char **value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1198,10 +1248,10 @@ int config_lookup_string(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_int(const config_t *config, const char *path, +int config_lookup_int(const struct config_t *config, const char *path, int *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1210,10 +1260,10 @@ int config_lookup_int(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_int64(const config_t *config, const char *path, +int config_lookup_int64(const struct config_t *config, const char *path, long long *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1222,10 +1272,10 @@ int config_lookup_int64(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_float(const config_t *config, const char *path, +int config_lookup_float(const struct config_t *config, const char *path, double *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1234,9 +1284,9 @@ int config_lookup_float(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_bool(const config_t *config, const char *path, int *value) +int config_lookup_bool(const struct config_t *config, const char *path, int *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1249,19 +1299,19 @@ int config_lookup_bool(const config_t *config, const char *path, int *value) /* ------------------------------------------------------------------------- */ -int config_setting_get_int_elem(const config_setting_t *vector, int idx) +int config_setting_get_int_elem(const struct config_setting_t *vector, int idx) { - const config_setting_t *element = config_setting_get_elem(vector, idx); + const struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_int(element) : 0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_int_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_int_elem(struct config_setting_t *vector, int idx, int value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1289,20 +1339,20 @@ config_setting_t *config_setting_set_int_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -long long config_setting_get_int64_elem(const config_setting_t *vector, +long long config_setting_get_int64_elem(const struct config_setting_t *vector, int idx) { - const config_setting_t *element = config_setting_get_elem(vector, idx); + const struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_int64(element) : 0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_int64_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_int64_elem(struct config_setting_t *vector, int idx, long long value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1330,19 +1380,19 @@ config_setting_t *config_setting_set_int64_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -double config_setting_get_float_elem(const config_setting_t *vector, int idx) +double config_setting_get_float_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_float(element) : 0.0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_float_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_float_elem(struct config_setting_t *vector, int idx, double value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1368,9 +1418,9 @@ config_setting_t *config_setting_set_float_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -int config_setting_get_bool_elem(const config_setting_t *vector, int idx) +int config_setting_get_bool_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); if(! element) return(CONFIG_FALSE); @@ -1383,10 +1433,10 @@ int config_setting_get_bool_elem(const config_setting_t *vector, int idx) /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_bool_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_bool_elem(struct config_setting_t *vector, int idx, int value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1412,10 +1462,10 @@ config_setting_t *config_setting_set_bool_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -const char *config_setting_get_string_elem(const config_setting_t *vector, +const char *config_setting_get_string_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); if(! element) return(NULL); @@ -1428,10 +1478,10 @@ const char *config_setting_get_string_elem(const config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_string_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_string_elem(struct config_setting_t *vector, int idx, const char *value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1457,10 +1507,10 @@ config_setting_t *config_setting_set_string_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_get_elem(const config_setting_t *vector, +struct config_setting_t *config_setting_get_elem(const struct config_setting_t *vector, unsigned int idx) { - config_list_t *list = vector->value.list; + struct config_list_t *list = vector->value.list; if(((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST) @@ -1475,7 +1525,7 @@ config_setting_t *config_setting_get_elem(const config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_get_member(const config_setting_t *setting, +struct config_setting_t *config_setting_get_member(const struct config_setting_t *setting, const char *name) { if(setting->type != CONFIG_TYPE_GROUP) @@ -1486,14 +1536,14 @@ config_setting_t *config_setting_get_member(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -void config_set_destructor(config_t *config, void (*destructor)(void *)) +void config_set_destructor(struct config_t *config, void (*destructor)(void *)) { config->destructor = destructor; } /* ------------------------------------------------------------------------- */ -void config_set_include_dir(config_t *config, const char *include_dir) +void config_set_include_dir(struct config_t *config, const char *include_dir) { _delete(config->include_dir); config->include_dir = strdup(include_dir); @@ -1501,7 +1551,7 @@ void config_set_include_dir(config_t *config, const char *include_dir) /* ------------------------------------------------------------------------- */ -int config_setting_length(const config_setting_t *setting) +int config_setting_length(const struct config_setting_t *setting) { if((setting->type != CONFIG_TYPE_GROUP) && (setting->type != CONFIG_TYPE_ARRAY) @@ -1516,14 +1566,14 @@ int config_setting_length(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -void config_setting_set_hook(config_setting_t *setting, void *hook) +void config_setting_set_hook(struct config_setting_t *setting, void *hook) { setting->hook = hook; } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_add(config_setting_t *parent, +struct config_setting_t *config_setting_add(struct config_setting_t *parent, const char *name, int type) { if((type < CONFIG_TYPE_NONE) || (type > CONFIG_TYPE_LIST)) @@ -1558,10 +1608,10 @@ config_setting_t *config_setting_add(config_setting_t *parent, /* ------------------------------------------------------------------------- */ -int config_setting_remove(config_setting_t *parent, const char *name) +int config_setting_remove(struct config_setting_t *parent, const char *name) { unsigned int idx; - config_setting_t *setting; + struct config_setting_t *setting; if(! parent) return(CONFIG_FALSE); @@ -1580,10 +1630,10 @@ int config_setting_remove(config_setting_t *parent, const char *name) /* ------------------------------------------------------------------------- */ -int config_setting_remove_elem(config_setting_t *parent, unsigned int idx) +int config_setting_remove_elem(struct config_setting_t *parent, unsigned int idx) { - config_list_t *list; - config_setting_t *removed = NULL; + struct config_list_t *list; + struct config_setting_t *removed = NULL; if(! parent) return(CONFIG_FALSE); @@ -1606,10 +1656,10 @@ int config_setting_remove_elem(config_setting_t *parent, unsigned int idx) /* ------------------------------------------------------------------------- */ -int config_setting_index(const config_setting_t *setting) +int config_setting_index(const struct config_setting_t *setting) { - config_setting_t **found = NULL; - config_list_t *list; + struct config_setting_t **found = NULL; + struct config_list_t *list; int i; if(! setting->parent) @@ -1627,4 +1677,3 @@ int config_setting_index(const config_setting_t *setting) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/libconfig.h b/3rdparty/libconfig/libconfig.h index cc5c5b79f..69f2e6dbf 100644 --- a/3rdparty/libconfig/libconfig.h +++ b/3rdparty/libconfig/libconfig.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -40,8 +40,8 @@ extern "C" { #endif /* WIN32 */ #define LIBCONFIG_VER_MAJOR 1 -#define LIBCONFIG_VER_MINOR 4 -#define LIBCONFIG_VER_REVISION 9 +#define LIBCONFIG_VER_MINOR 5 +#define LIBCONFIG_VER_REVISION 0 #include <stdio.h> @@ -58,260 +58,267 @@ extern "C" { #define CONFIG_FORMAT_DEFAULT 0 #define CONFIG_FORMAT_HEX 1 -#define CONFIG_OPTION_AUTOCONVERT 0x01 +#define CONFIG_OPTION_AUTOCONVERT 0x01 +#define CONFIG_OPTION_SEMICOLON_SEPARATORS 0x02 +#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS 0x04 +#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS 0x08 +#define CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE 0x10 #define CONFIG_TRUE (1) #define CONFIG_FALSE (0) -typedef union config_value_t +union config_value_t { int ival; long long llval; double fval; char *sval; struct config_list_t *list; -} config_value_t; +}; -typedef struct config_setting_t +struct config_setting_t { char *name; short type; short format; - config_value_t value; + union config_value_t value; struct config_setting_t *parent; struct config_t *config; void *hook; unsigned int line; const char *file; -} config_setting_t; +}; -typedef enum +enum config_error_t { CONFIG_ERR_NONE = 0, CONFIG_ERR_FILE_IO = 1, CONFIG_ERR_PARSE = 2 -} config_error_t; +}; -typedef struct config_list_t +struct config_list_t { unsigned int length; - config_setting_t **elements; -} config_list_t; + struct config_setting_t **elements; +}; -typedef struct config_t +struct config_t { - config_setting_t *root; + struct config_setting_t *root; void (*destructor)(void *); - unsigned short flags; + int options; unsigned short tab_width; short default_format; - const char *include_dir; + char *include_dir; const char *error_text; const char *error_file; int error_line; - config_error_t error_type; - const char **filenames; + enum config_error_t error_type; + char **filenames; unsigned int num_filenames; -} config_t; +}; -extern LIBCONFIG_API int config_read(config_t *config, FILE *stream); -extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream); +extern LIBCONFIG_API int config_read(struct config_t *config, FILE *stream); +extern LIBCONFIG_API void config_write(const struct config_t *config, FILE *stream); -extern LIBCONFIG_API void config_set_default_format(config_t *config, +extern LIBCONFIG_API void config_set_default_format(struct config_t *config, short format); -extern LIBCONFIG_API void config_set_auto_convert(config_t *config, int flag); -extern LIBCONFIG_API int config_get_auto_convert(const config_t *config); +extern LIBCONFIG_API void config_set_options(struct config_t *config, int options); +extern LIBCONFIG_API int config_get_options(const struct config_t *config); -extern LIBCONFIG_API int config_read_string(config_t *config, const char *str); +extern LIBCONFIG_API void config_set_auto_convert(struct config_t *config, int flag); +extern LIBCONFIG_API int config_get_auto_convert(const struct config_t *config); -extern LIBCONFIG_API int config_read_file(config_t *config, +extern LIBCONFIG_API int config_read_string(struct config_t *config, const char *str); + +extern LIBCONFIG_API int config_read_file(struct config_t *config, const char *filename); -extern LIBCONFIG_API int config_write_file(config_t *config, +extern LIBCONFIG_API int config_write_file(struct config_t *config, const char *filename); -extern LIBCONFIG_API void config_set_destructor(config_t *config, +extern LIBCONFIG_API void config_set_destructor(struct config_t *config, void (*destructor)(void *)); -extern LIBCONFIG_API void config_set_include_dir(config_t *config, +extern LIBCONFIG_API void config_set_include_dir(struct config_t *config, const char *include_dir); -extern LIBCONFIG_API void config_init(config_t *config); -extern LIBCONFIG_API void config_destroy(config_t *config); +extern LIBCONFIG_API void config_init(struct config_t *config); +extern LIBCONFIG_API void config_destroy(struct config_t *config); extern LIBCONFIG_API int config_setting_get_int( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API long long config_setting_get_int64( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API double config_setting_get_float( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_get_bool( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API const char *config_setting_get_string( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_lookup_int( - const config_setting_t *setting, const char *name, int *value); + const struct config_setting_t *setting, const char *name, int *value); extern LIBCONFIG_API int config_setting_lookup_int64( - const config_setting_t *setting, const char *name, long long *value); + const struct config_setting_t *setting, const char *name, long long *value); extern LIBCONFIG_API int config_setting_lookup_float( - const config_setting_t *setting, const char *name, double *value); + const struct config_setting_t *setting, const char *name, double *value); extern LIBCONFIG_API int config_setting_lookup_bool( - const config_setting_t *setting, const char *name, int *value); + const struct config_setting_t *setting, const char *name, int *value); extern LIBCONFIG_API int config_setting_lookup_string( - const config_setting_t *setting, const char *name, const char **value); + const struct config_setting_t *setting, const char *name, const char **value); -extern LIBCONFIG_API int config_setting_set_int(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_int(struct config_setting_t *setting, int value); -extern LIBCONFIG_API int config_setting_set_int64(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_int64(struct config_setting_t *setting, long long value); -extern LIBCONFIG_API int config_setting_set_float(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_float(struct config_setting_t *setting, double value); -extern LIBCONFIG_API int config_setting_set_bool(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_bool(struct config_setting_t *setting, int value); -extern LIBCONFIG_API int config_setting_set_string(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_string(struct config_setting_t *setting, const char *value); -extern LIBCONFIG_API int config_setting_set_format(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_format(struct config_setting_t *setting, short format); extern LIBCONFIG_API short config_setting_get_format( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_get_int_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API long long config_setting_get_int64_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API double config_setting_get_float_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API int config_setting_get_bool_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API const char *config_setting_get_string_elem( - const config_setting_t *setting, int idx); - -extern LIBCONFIG_API config_setting_t *config_setting_set_int_elem( - config_setting_t *setting, int idx, int value); -extern LIBCONFIG_API config_setting_t *config_setting_set_int64_elem( - config_setting_t *setting, int idx, long long value); -extern LIBCONFIG_API config_setting_t *config_setting_set_float_elem( - config_setting_t *setting, int idx, double value); -extern LIBCONFIG_API config_setting_t *config_setting_set_bool_elem( - config_setting_t *setting, int idx, int value); -extern LIBCONFIG_API config_setting_t *config_setting_set_string_elem( - config_setting_t *setting, int idx, const char *value); - -#define /* const char * */ config_get_include_dir(/* const config_t * */ C) \ - ((C)->include_dir) - -#define /* int */ config_setting_type(/* const config_setting_t * */ S) \ + const struct config_setting_t *setting, int idx); + +extern LIBCONFIG_API struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); + +#define /* const char * */ config_get_include_dir(/* const struct config_t * */ C) \ + ((const char *)(C)->include_dir) + +#define /* int */ config_setting_type(/* const struct config_setting_t * */ S) \ ((S)->type) -#define /* int */ config_setting_is_group(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_group(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_GROUP) -#define /* int */ config_setting_is_array(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_array(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_ARRAY) -#define /* int */ config_setting_is_list(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_list(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_LIST) #define /* int */ config_setting_is_aggregate( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_GROUP) || ((S)->type == CONFIG_TYPE_LIST) \ || ((S)->type == CONFIG_TYPE_ARRAY)) -#define /* int */ config_setting_is_number(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_number(/* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_INT) \ || ((S)->type == CONFIG_TYPE_INT64) \ || ((S)->type == CONFIG_TYPE_FLOAT)) -#define /* int */ config_setting_is_scalar(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_scalar(/* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_BOOL) || ((S)->type == CONFIG_TYPE_STRING) \ || config_setting_is_number(S)) #define /* const char * */ config_setting_name( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->name) -#define /* config_setting_t * */ config_setting_parent( \ - /* const config_setting_t * */ S) \ +#define /* struct config_setting_t * */ config_setting_parent( \ + /* const struct config_setting_t * */ S) \ ((S)->parent) #define /* int */ config_setting_is_root( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->parent ? CONFIG_FALSE : CONFIG_TRUE) -extern LIBCONFIG_API int config_setting_index(const config_setting_t *setting); +extern LIBCONFIG_API int config_setting_index(const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_length( - const config_setting_t *setting); -extern LIBCONFIG_API config_setting_t *config_setting_get_elem( - const config_setting_t *setting, unsigned int idx); + const struct config_setting_t *setting); +extern LIBCONFIG_API struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); -extern LIBCONFIG_API config_setting_t *config_setting_get_member( - const config_setting_t *setting, const char *name); +extern LIBCONFIG_API struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); -extern LIBCONFIG_API config_setting_t *config_setting_add( - config_setting_t *parent, const char *name, int type); -extern LIBCONFIG_API int config_setting_remove(config_setting_t *parent, +extern LIBCONFIG_API struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern LIBCONFIG_API int config_setting_remove(struct config_setting_t *parent, const char *name); -extern LIBCONFIG_API int config_setting_remove_elem(config_setting_t *parent, +extern LIBCONFIG_API int config_setting_remove_elem(struct config_setting_t *parent, unsigned int idx); -extern LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting, +extern LIBCONFIG_API void config_setting_set_hook(struct config_setting_t *setting, void *hook); #define config_setting_get_hook(S) ((S)->hook) -extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config, +extern LIBCONFIG_API struct config_setting_t *config_lookup(const struct config_t *config, const char *path); -extern LIBCONFIG_API config_setting_t *config_lookup_from( - config_setting_t *setting, const char *path); +extern LIBCONFIG_API struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); -extern LIBCONFIG_API int config_lookup_int(const config_t *config, +extern LIBCONFIG_API int config_lookup_int(const struct config_t *config, const char *path, int *value); -extern LIBCONFIG_API int config_lookup_int64(const config_t *config, +extern LIBCONFIG_API int config_lookup_int64(const struct config_t *config, const char *path, long long *value); -extern LIBCONFIG_API int config_lookup_float(const config_t *config, +extern LIBCONFIG_API int config_lookup_float(const struct config_t *config, const char *path, double *value); -extern LIBCONFIG_API int config_lookup_bool(const config_t *config, +extern LIBCONFIG_API int config_lookup_bool(const struct config_t *config, const char *path, int *value); -extern LIBCONFIG_API int config_lookup_string(const config_t *config, +extern LIBCONFIG_API int config_lookup_string(const struct config_t *config, const char *path, const char **value); -#define /* config_setting_t * */ config_root_setting( \ - /* const config_t * */ C) \ +#define /* struct config_setting_t * */ config_root_setting( \ + /* const struct config_t * */ C) \ ((C)->root) -#define /* void */ config_set_default_format(/* config_t * */ C, \ +#define /* void */ config_set_default_format(/* struct config_t * */ C, \ /* short */ F) \ (C)->default_format = (F) -#define /* short */ config_get_default_format(/* config_t * */ C) \ +#define /* short */ config_get_default_format(/* struct config_t * */ C) \ ((C)->default_format) -#define /* void */ config_set_tab_width(/* config_t * */ C, \ +#define /* void */ config_set_tab_width(/* struct config_t * */ C, \ /* unsigned short */ W) \ (C)->tab_width = ((W) & 0x0F) -#define /* unsigned char */ config_get_tab_width(/* const config_t * */ C) \ +#define /* unsigned char */ config_get_tab_width(/* const struct config_t * */ C) \ ((C)->tab_width) #define /* unsigned short */ config_setting_source_line( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->line) #define /* const char */ config_setting_source_file( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->file) -#define /* const char * */ config_error_text(/* const config_t * */ C) \ +#define /* const char * */ config_error_text(/* const struct config_t * */ C) \ ((C)->error_text) -#define /* const char * */ config_error_file(/* const config_t * */ C) \ +#define /* const char * */ config_error_file(/* const struct config_t * */ C) \ ((C)->error_file) -#define /* int */ config_error_line(/* const config_t * */ C) \ +#define /* int */ config_error_line(/* const struct config_t * */ C) \ ((C)->error_line) -#define /* config_error_t */ config_error_type(/* const config_t * */ C) \ +#define /* enum config_error_t */ config_error_type(/* const struct config_t * */ C) \ ((C)->error_type) #ifdef __cplusplus diff --git a/3rdparty/libconfig/parsectx.h b/3rdparty/libconfig/parsectx.h index 732e5f20d..4d1f261d9 100644 --- a/3rdparty/libconfig/parsectx.h +++ b/3rdparty/libconfig/parsectx.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -28,9 +28,9 @@ struct parse_context { - config_t *config; - config_setting_t *parent; - config_setting_t *setting; + struct config_t *config; + struct config_setting_t *parent; + struct config_setting_t *setting; char *name; strbuf_t string; }; diff --git a/3rdparty/libconfig/scanctx.c b/3rdparty/libconfig/scanctx.c index f2fe8cd80..94ba73edd 100644 --- a/3rdparty/libconfig/scanctx.c +++ b/3rdparty/libconfig/scanctx.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -38,31 +38,27 @@ static const char *err_include_too_deep = "include file nesting too deep"; /* ------------------------------------------------------------------------- */ static const char *__scanctx_add_filename(struct scan_context *ctx, - const char *filename) + char *filename) { -#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this unsigned int count = ctx->num_filenames; - const char **f; + char **f; for(f = ctx->filenames; count > 0; ++f, --count) { if(!strcmp(*f, filename)) { - free((void *)filename); + free(filename); return(*f); /* already in list */ } } if((ctx->num_filenames % CHUNK_SIZE) == 0) { - ctx->filenames = (const char **)realloc( - (void *)ctx->filenames, - (ctx->num_filenames + CHUNK_SIZE) * sizeof(const char *)); + ctx->filenames = realloc(ctx->filenames, (ctx->num_filenames + CHUNK_SIZE) * sizeof(char *)); } ctx->filenames[ctx->num_filenames] = filename; ++ctx->num_filenames; -#endif // __clang_analyzer__ return(filename); } @@ -77,8 +73,8 @@ void scanctx_init(struct scan_context *ctx, const char *top_filename) /* ------------------------------------------------------------------------- */ -const char **scanctx_cleanup(struct scan_context *ctx, - unsigned int *num_filenames) +char **scanctx_cleanup(struct scan_context *ctx, + unsigned int *num_filenames) { int i; @@ -97,7 +93,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer, const char **error) { FILE *fp = NULL; - const char *file; + char *file; char *full_file = NULL; *error = NULL; @@ -119,7 +115,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer, } fp = fopen(full_file ? full_file : file, "rt"); - free((void *)full_file); + free(full_file); if(fp) { @@ -130,7 +126,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer, } else { - free((void *)file); + free(file); *error = err_bad_include; } @@ -170,4 +166,3 @@ const char *scanctx_current_filename(struct scan_context *ctx) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/scanctx.h b/3rdparty/libconfig/scanctx.h index 9bb1f1a0d..a5939ca05 100644 --- a/3rdparty/libconfig/scanctx.h +++ b/3rdparty/libconfig/scanctx.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -33,20 +33,20 @@ struct scan_context { - config_t *config; + struct config_t *config; const char *top_filename; const char *files[MAX_INCLUDE_DEPTH]; void *buffers[MAX_INCLUDE_DEPTH]; FILE *streams[MAX_INCLUDE_DEPTH]; int depth; strbuf_t string; - const char **filenames; + char **filenames; unsigned int num_filenames; }; extern void scanctx_init(struct scan_context *ctx, const char *top_filename); -extern const char **scanctx_cleanup(struct scan_context *ctx, - unsigned int *num_filenames); +extern char **scanctx_cleanup(struct scan_context *ctx, + unsigned int *num_filenames); extern FILE *scanctx_push_include(struct scan_context *ctx, void *prev_buffer, const char **error); diff --git a/3rdparty/libconfig/scanner.c b/3rdparty/libconfig/scanner.c index 96c01fc5f..8ed08f9b8 100644 --- a/3rdparty/libconfig/scanner.c +++ b/3rdparty/libconfig/scanner.c @@ -1,10 +1,6 @@ -#line 2 "scanner.c" -#line 36 "scanner.l" -#include "scanctx.h" - - +#line 1 "scanner.c" -#line 8 "scanner.c" +#line 3 "scanner.c" #define YY_INT_ALIGNED short int @@ -12,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -25,6 +21,7 @@ #include <string.h> #include <errno.h> #include <stdlib.h> +#include <assert.h> /* end standard C headers. */ @@ -92,36 +89,22 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -145,25 +128,29 @@ typedef void* yyscan_t; * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE libconfig_yyrestart(yyin ,yyscanner ) - #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -183,7 +170,7 @@ typedef size_t yy_size_t; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE libconfig_yylex. @@ -219,7 +206,6 @@ typedef size_t yy_size_t; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -234,12 +220,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -296,36 +282,33 @@ struct yy_buffer_state #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void libconfig_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void libconfig_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void libconfig_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void libconfig_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void libconfig_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void libconfig_yypop_buffer_state (yyscan_t yyscanner ); - -static void libconfig_yyensure_buffer_stack (yyscan_t yyscanner ); -static void libconfig_yy_load_buffer_state (yyscan_t yyscanner ); -static void libconfig_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); - +void libconfig_yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void libconfig_yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void libconfig_yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void libconfig_yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void libconfig_yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void libconfig_yypop_buffer_state ( yyscan_t yyscanner ); + +static void libconfig_yyensure_buffer_stack ( yyscan_t yyscanner ); +static void libconfig_yy_load_buffer_state ( yyscan_t yyscanner ); +static void libconfig_yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); #define YY_FLUSH_BUFFER libconfig_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) -YY_BUFFER_STATE libconfig_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *libconfig_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *libconfig_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void libconfig_yyfree (void * ,yyscan_t yyscanner ); +void *libconfig_yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *libconfig_yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void libconfig_yyfree ( void * , yyscan_t yyscanner ); #define yy_new_buffer libconfig_yy_create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ @@ -335,7 +318,6 @@ void libconfig_yyfree (void * ,yyscan_t yyscanner ); } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ @@ -345,33 +327,30 @@ void libconfig_yyfree (void * ,yyscan_t yyscanner ); } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) -#define libconfig_yywrap(yyscanner) 1 +#define libconfig_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; +typedef flex_uint8_t YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); -static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; - #define YY_NUM_RULES 45 #define YY_END_OF_BUFFER 46 /* This struct is not used in this scanner, @@ -381,7 +360,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[123] = +static const flex_int16_t yy_accept[123] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 44, 25, 24, 24, 5, 44, 40, 41, 37, @@ -399,22 +378,22 @@ static yyconst flex_int16_t yy_accept[123] = 19, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 6, 7, 1, 1, 1, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, - 22, 23, 1, 24, 25, 26, 26, 26, 27, 28, - 29, 29, 29, 29, 29, 30, 29, 29, 29, 29, - 29, 31, 32, 33, 34, 29, 29, 35, 29, 29, - 36, 37, 38, 1, 8, 1, 25, 26, 39, 40, - - 41, 42, 29, 29, 43, 29, 29, 44, 29, 45, - 29, 29, 29, 46, 32, 47, 48, 29, 29, 35, - 29, 29, 49, 1, 50, 1, 1, 1, 1, 1, + 1, 2, 1, 6, 7, 1, 1, 1, 1, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, + 21, 22, 1, 23, 24, 25, 25, 25, 26, 27, + 28, 28, 28, 28, 28, 29, 28, 28, 28, 28, + 28, 30, 31, 32, 33, 28, 28, 34, 28, 28, + 35, 36, 37, 1, 38, 1, 24, 25, 39, 40, + + 41, 42, 28, 28, 43, 28, 28, 44, 28, 45, + 28, 28, 28, 46, 31, 47, 48, 28, 28, 34, + 28, 28, 49, 1, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -431,35 +410,35 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[51] = +static const YY_CHAR yy_meta[51] = { 0, - 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, - 3, 1, 1, 3, 3, 1, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 4, 4, 4, 3, 3, - 3, 3, 3, 3, 3, 1, 2, 1, 4, 4, + 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, + 1, 1, 3, 3, 1, 4, 4, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 3, 3, 3, + 3, 3, 3, 3, 1, 2, 1, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 1, 1 } ; -static yyconst flex_int16_t yy_base[134] = +static const flex_int16_t yy_base[134] = { 0, 0, 49, 49, 50, 48, 49, 50, 51, 244, 243, 248, 251, 245, 251, 251, 251, 243, 251, 251, 0, - 47, 251, 41, 55, 62, 210, 251, 251, 238, 218, - 32, 251, 251, 251, 251, 67, 199, 251, 251, 225, - 0, 251, 64, 0, 251, 61, 234, 216, 236, 234, - 251, 0, 66, 87, 95, 106, 251, 233, 98, 200, - 115, 204, 123, 251, 46, 47, 70, 190, 187, 251, + 47, 251, 49, 52, 54, 211, 251, 251, 238, 219, + 28, 251, 251, 251, 251, 71, 199, 251, 251, 226, + 0, 251, 63, 0, 251, 70, 234, 217, 236, 234, + 251, 0, 75, 86, 97, 108, 251, 233, 113, 201, + 115, 205, 139, 251, 49, 48, 75, 190, 187, 251, 0, 251, 0, 251, 251, 251, 251, 251, 0, 251, - 251, 219, 198, 251, 117, 142, 166, 57, 113, 120, - 154, 125, 128, 135, 0, 165, 162, 128, 154, 0, + 251, 225, 202, 251, 117, 124, 191, 101, 128, 131, + 157, 133, 135, 143, 0, 156, 152, 63, 138, 0, - 156, 163, 161, 251, 167, 169, 171, 152, 149, 0, - 126, 251, 174, 0, 0, 119, 117, 85, 119, 94, - 251, 251, 197, 201, 205, 209, 213, 215, 219, 223, - 227, 115, 104 + 145, 171, 159, 251, 173, 175, 177, 140, 81, 0, + 123, 251, 179, 0, 0, 105, 96, 79, 109, 140, + 251, 251, 196, 200, 204, 208, 212, 214, 218, 222, + 226, 78, 75 } ; -static yyconst flex_int16_t yy_def[134] = +static const flex_int16_t yy_def[134] = { 0, 122, 1, 123, 123, 124, 124, 125, 125, 126, 126, 122, 122, 122, 122, 122, 122, 127, 122, 122, 128, @@ -478,34 +457,34 @@ static yyconst flex_int16_t yy_def[134] = 122, 122, 122 } ; -static yyconst flex_int16_t yy_nxt[302] = +static const flex_int16_t yy_nxt[302] = { 0, - 12, 13, 14, 15, 15, 16, 17, 12, 18, 19, - 20, 21, 22, 21, 23, 24, 25, 26, 27, 28, - 29, 27, 12, 12, 20, 20, 20, 30, 20, 20, - 20, 20, 31, 20, 20, 32, 12, 33, 20, 20, + 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, + 21, 22, 21, 23, 24, 25, 26, 27, 28, 29, + 27, 12, 12, 20, 20, 20, 30, 20, 20, 20, + 20, 31, 20, 20, 32, 12, 33, 12, 20, 20, 20, 30, 20, 20, 20, 20, 31, 20, 34, 35, - 36, 39, 39, 42, 42, 45, 45, 55, 55, 40, - 40, 53, 66, 54, 54, 57, 80, 56, 67, 72, - 58, 67, 37, 89, 89, 97, 59, 66, 60, 60, - 98, 56, 55, 55, 43, 43, 46, 46, 61, 97, - 68, 62, 56, 68, 98, 120, 63, 81, 73, 121, - - 74, 85, 61, 54, 54, 75, 56, 112, 76, 77, - 78, 55, 55, 86, 90, 90, 87, 88, 100, 88, - 120, 56, 89, 89, 91, 119, 92, 86, 93, 89, - 89, 94, 94, 101, 101, 56, 90, 90, 91, 96, - 96, 103, 103, 102, 94, 94, 91, 96, 96, 96, - 96, 94, 94, 92, 110, 92, 118, 102, 103, 103, - 91, 96, 96, 96, 96, 105, 117, 106, 110, 116, - 107, 107, 101, 101, 105, 115, 105, 103, 103, 113, - 113, 114, 102, 113, 113, 107, 107, 107, 107, 115, - 113, 113, 111, 109, 108, 104, 102, 38, 38, 38, - - 38, 41, 41, 41, 41, 44, 44, 44, 44, 47, - 47, 47, 47, 50, 50, 50, 50, 52, 52, 71, - 122, 71, 71, 79, 83, 79, 79, 82, 82, 82, - 82, 99, 69, 95, 52, 51, 51, 49, 84, 83, + 36, 39, 39, 42, 42, 45, 45, 66, 40, 40, + 53, 57, 54, 54, 55, 55, 58, 59, 72, 60, + 60, 37, 67, 66, 56, 80, 67, 97, 112, 61, + 98, 100, 62, 43, 43, 46, 46, 63, 110, 56, + 55, 55, 97, 68, 61, 98, 73, 68, 74, 85, + + 56, 54, 54, 110, 75, 81, 115, 76, 77, 78, + 120, 86, 55, 55, 87, 56, 89, 89, 88, 119, + 88, 115, 56, 89, 89, 92, 86, 93, 90, 90, + 94, 94, 101, 101, 92, 118, 92, 56, 91, 103, + 103, 120, 102, 89, 89, 121, 90, 90, 103, 103, + 94, 94, 117, 91, 96, 96, 91, 102, 94, 94, + 101, 101, 96, 96, 96, 96, 116, 105, 114, 106, + 102, 91, 107, 107, 103, 103, 111, 96, 96, 96, + 96, 105, 109, 105, 108, 102, 113, 113, 113, 113, + 107, 107, 107, 107, 113, 113, 38, 38, 38, 38, + + 41, 41, 41, 41, 44, 44, 44, 44, 47, 47, + 47, 47, 50, 50, 50, 50, 52, 52, 71, 104, + 71, 71, 79, 122, 79, 79, 82, 82, 82, 82, + 83, 99, 69, 95, 52, 51, 51, 49, 84, 83, 70, 69, 65, 64, 52, 51, 49, 122, 48, 48, 11, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, @@ -516,34 +495,34 @@ static yyconst flex_int16_t yy_nxt[302] = 122 } ; -static yyconst flex_int16_t yy_chk[302] = +static const flex_int16_t yy_chk[302] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 3, 4, 5, 6, 7, 8, 23, 23, 3, - 4, 21, 31, 21, 21, 24, 46, 23, 36, 43, - 24, 67, 2, 88, 88, 65, 25, 31, 25, 25, - 66, 23, 53, 53, 5, 6, 7, 8, 25, 65, - 36, 25, 53, 67, 66, 120, 25, 46, 43, 120, - - 43, 54, 25, 54, 54, 43, 53, 133, 43, 43, - 43, 55, 55, 54, 59, 59, 54, 56, 132, 56, - 119, 55, 56, 56, 59, 118, 61, 54, 61, 89, - 89, 61, 61, 85, 85, 55, 90, 90, 59, 63, - 63, 92, 92, 85, 93, 93, 90, 63, 63, 63, - 63, 94, 94, 86, 98, 86, 117, 85, 86, 86, - 90, 63, 63, 63, 63, 91, 116, 91, 98, 111, - 91, 91, 101, 101, 102, 109, 102, 103, 103, 102, - 102, 108, 101, 105, 105, 106, 106, 107, 107, 109, - 113, 113, 99, 97, 96, 87, 101, 123, 123, 123, - - 123, 124, 124, 124, 124, 125, 125, 125, 125, 126, - 126, 126, 126, 127, 127, 127, 127, 128, 128, 129, - 83, 129, 129, 130, 82, 130, 130, 131, 131, 131, - 131, 69, 68, 62, 60, 58, 50, 49, 48, 47, + 2, 3, 4, 5, 6, 7, 8, 31, 3, 4, + 21, 24, 21, 21, 23, 23, 24, 25, 43, 25, + 25, 2, 36, 31, 23, 46, 67, 65, 133, 25, + 66, 132, 25, 5, 6, 7, 8, 25, 98, 23, + 53, 53, 65, 36, 25, 66, 43, 67, 43, 54, + + 53, 54, 54, 98, 43, 46, 109, 43, 43, 43, + 119, 54, 55, 55, 54, 53, 88, 88, 56, 118, + 56, 109, 55, 56, 56, 61, 54, 61, 59, 59, + 61, 61, 85, 85, 86, 117, 86, 55, 59, 86, + 86, 120, 85, 89, 89, 120, 90, 90, 92, 92, + 93, 93, 116, 59, 63, 63, 90, 85, 94, 94, + 101, 101, 63, 63, 63, 63, 111, 91, 108, 91, + 101, 90, 91, 91, 103, 103, 99, 63, 63, 63, + 63, 102, 97, 102, 96, 101, 102, 102, 105, 105, + 106, 106, 107, 107, 113, 113, 123, 123, 123, 123, + + 124, 124, 124, 124, 125, 125, 125, 125, 126, 126, + 126, 126, 127, 127, 127, 127, 128, 128, 129, 87, + 129, 129, 130, 83, 130, 130, 131, 131, 131, 131, + 82, 69, 68, 62, 60, 58, 50, 49, 48, 47, 40, 37, 30, 29, 26, 17, 13, 11, 10, 9, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, @@ -555,7 +534,7 @@ static yyconst flex_int16_t yy_chk[302] = } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[46] = +static const flex_int32_t yy_rule_can_match_eol[46] = { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -572,7 +551,8 @@ static yyconst flex_int32_t yy_rule_can_match_eol[46] = /* -*- mode: C -*- */ /* -------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -592,20 +572,20 @@ static yyconst flex_int32_t yy_rule_can_match_eol[46] = ---------------------------------------------------------------------------- */ #define YY_NO_UNISTD_H 1 +#line 37 "scanner.l" -#line 40 "scanner.l" #ifdef _MSC_VER #pragma warning (disable: 4996) -/* disable MSVC warning "signed/unsigned mismatch" associated with code generated by flex versions such as 2.5.35. */ -#pragma warning (disable:4018) #endif #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <limits.h> +#include "parsectx.h" +#include "scanctx.h" #include "grammar.h" #include "wincompat.h" -#include "parsectx.h" #define YY_NO_INPUT // Suppress generation of useless input() function @@ -643,15 +623,9 @@ static unsigned long long fromhex(const char *s) #endif /* __MINGW32__ */ } -static int fromihex(const char *s) { - unsigned long l = strtoul(s, NULL, 16); - if (l > INT32_MAX) - l &= INT32_MAX; - return (int)l; -} - +#line 625 "scanner.c" -#line 655 "scanner.c" +#line 627 "scanner.c" #define INITIAL 0 #define COMMENT 1 @@ -674,8 +648,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -697,7 +671,7 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals (yyscan_t yyscanner ); +static int yy_init_globals ( yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ @@ -705,44 +679,44 @@ static int yy_init_globals (yyscan_t yyscanner ); int libconfig_yylex_init (yyscan_t* scanner); -int libconfig_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int libconfig_yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int libconfig_yylex_destroy (yyscan_t yyscanner ); +int libconfig_yylex_destroy ( yyscan_t yyscanner ); -int libconfig_yyget_debug (yyscan_t yyscanner ); +int libconfig_yyget_debug ( yyscan_t yyscanner ); -void libconfig_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void libconfig_yyset_debug ( int debug_flag , yyscan_t yyscanner ); -YY_EXTRA_TYPE libconfig_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE libconfig_yyget_extra ( yyscan_t yyscanner ); -void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void libconfig_yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -FILE *libconfig_yyget_in (yyscan_t yyscanner ); +FILE *libconfig_yyget_in ( yyscan_t yyscanner ); -void libconfig_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void libconfig_yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *libconfig_yyget_out (yyscan_t yyscanner ); +FILE *libconfig_yyget_out ( yyscan_t yyscanner ); -void libconfig_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void libconfig_yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -yy_size_t libconfig_yyget_leng (yyscan_t yyscanner ); + int libconfig_yyget_leng ( yyscan_t yyscanner ); -char *libconfig_yyget_text (yyscan_t yyscanner ); +char *libconfig_yyget_text ( yyscan_t yyscanner ); -int libconfig_yyget_lineno (yyscan_t yyscanner ); +int libconfig_yyget_lineno ( yyscan_t yyscanner ); -void libconfig_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void libconfig_yyset_lineno ( int _line_number , yyscan_t yyscanner ); -int libconfig_yyget_column (yyscan_t yyscanner ); +int libconfig_yyget_column ( yyscan_t yyscanner ); -void libconfig_yyset_column (int column_no ,yyscan_t yyscanner ); +void libconfig_yyset_column ( int _column_no , yyscan_t yyscanner ); -YYSTYPE * libconfig_yyget_lval (yyscan_t yyscanner ); +YYSTYPE * libconfig_yyget_lval ( yyscan_t yyscanner ); -void libconfig_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); +void libconfig_yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -750,33 +724,41 @@ void libconfig_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int libconfig_yywrap (yyscan_t yyscanner ); +extern "C" int libconfig_yywrap ( yyscan_t yyscanner ); #else -extern int libconfig_yywrap (yyscan_t yyscanner ); +extern int libconfig_yywrap ( yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (yyscan_t yyscanner ); +static int yyinput ( yyscan_t yyscanner ); #else -static int input (yyscan_t yyscanner ); +static int input ( yyscan_t yyscanner ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -784,7 +766,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -795,7 +777,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -808,7 +790,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -850,7 +832,7 @@ static int input (yyscan_t yyscanner ); #define YY_DECL_IS_OURS 1 extern int libconfig_yylex \ - (YYSTYPE * yylval_param ,yyscan_t yyscanner); + (YYSTYPE * yylval_param , yyscan_t yyscanner); #define YY_DECL int libconfig_yylex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) @@ -865,7 +847,7 @@ extern int libconfig_yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -878,9 +860,9 @@ extern int libconfig_yylex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; @@ -912,12 +894,12 @@ YY_DECL } { -#line 112 "scanner.l" +#line 103 "scanner.l" -#line 919 "scanner.c" +#line 899 "scanner.c" - while ( 1 ) /* loops until end-of-file is reached */ + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -934,7 +916,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -944,9 +926,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 123 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 122 ); @@ -960,7 +942,7 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; + int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) @@ -983,69 +965,69 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 114 "scanner.l" +#line 105 "scanner.l" { BEGIN COMMENT; } YY_BREAK case 2: YY_RULE_SETUP -#line 115 "scanner.l" +#line 106 "scanner.l" { BEGIN INITIAL; } YY_BREAK case 3: YY_RULE_SETUP -#line 116 "scanner.l" +#line 107 "scanner.l" { /* ignore */ } YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 117 "scanner.l" +#line 108 "scanner.l" { /* ignore */ } YY_BREAK case 5: YY_RULE_SETUP -#line 119 "scanner.l" +#line 110 "scanner.l" { BEGIN STRING; } YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 120 "scanner.l" +#line 111 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 7: YY_RULE_SETUP -#line 121 "scanner.l" +#line 112 "scanner.l" { scanctx_append_string(yyextra, "\n"); } YY_BREAK case 8: YY_RULE_SETUP -#line 122 "scanner.l" +#line 113 "scanner.l" { scanctx_append_string(yyextra, "\r"); } YY_BREAK case 9: YY_RULE_SETUP -#line 123 "scanner.l" +#line 114 "scanner.l" { scanctx_append_string(yyextra, "\t"); } YY_BREAK case 10: YY_RULE_SETUP -#line 124 "scanner.l" +#line 115 "scanner.l" { scanctx_append_string(yyextra, "\f"); } YY_BREAK case 11: YY_RULE_SETUP -#line 125 "scanner.l" +#line 116 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 12: YY_RULE_SETUP -#line 126 "scanner.l" +#line 117 "scanner.l" { scanctx_append_string(yyextra, "\""); } YY_BREAK case 13: YY_RULE_SETUP -#line 127 "scanner.l" +#line 118 "scanner.l" { char c[2] = { (char)(strtol(yytext + 2, NULL, 16) & 0xFF), 0 }; @@ -1054,12 +1036,12 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 132 "scanner.l" +#line 123 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 15: YY_RULE_SETUP -#line 133 "scanner.l" +#line 124 "scanner.l" { yylval->sval = scanctx_take_string(yyextra); BEGIN INITIAL; @@ -1068,18 +1050,18 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 139 "scanner.l" +#line 130 "scanner.l" { BEGIN SCRIPTBLOCK; } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 140 "scanner.l" +#line 131 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 18: YY_RULE_SETUP -#line 141 "scanner.l" +#line 132 "scanner.l" { yylval->sval = scanctx_take_string(yyextra); BEGIN INITIAL; @@ -1088,28 +1070,28 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 147 "scanner.l" +#line 138 "scanner.l" { BEGIN INCLUDE; } YY_BREAK case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 148 "scanner.l" +#line 139 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 21: YY_RULE_SETUP -#line 149 "scanner.l" +#line 140 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 22: YY_RULE_SETUP -#line 150 "scanner.l" +#line 141 "scanner.l" { scanctx_append_string(yyextra, "\""); } YY_BREAK case 23: YY_RULE_SETUP -#line 151 "scanner.l" +#line 142 "scanner.l" { const char *error; FILE *fp = scanctx_push_include(yyextra, @@ -1118,7 +1100,9 @@ YY_RULE_SETUP if(fp) { yyin = fp; - libconfig_yy_switch_to_buffer(libconfig_yy_create_buffer(yyin,YY_BUF_SIZE,yyscanner),yyscanner); + libconfig_yy_switch_to_buffer( + libconfig_yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner), + yyscanner); } else { @@ -1135,97 +1119,116 @@ YY_RULE_SETUP case 24: /* rule 24 can match eol */ YY_RULE_SETUP -#line 175 "scanner.l" +#line 166 "scanner.l" { /* ignore */ } YY_BREAK case 25: YY_RULE_SETUP -#line 176 "scanner.l" +#line 167 "scanner.l" { /* ignore */ } YY_BREAK case 26: YY_RULE_SETUP -#line 178 "scanner.l" +#line 169 "scanner.l" { return(TOK_EQUALS); } YY_BREAK case 27: YY_RULE_SETUP -#line 179 "scanner.l" +#line 170 "scanner.l" { return(TOK_COMMA); } YY_BREAK case 28: YY_RULE_SETUP -#line 180 "scanner.l" +#line 171 "scanner.l" { return(TOK_GROUP_START); } YY_BREAK case 29: YY_RULE_SETUP -#line 181 "scanner.l" +#line 172 "scanner.l" { return(TOK_GROUP_END); } YY_BREAK case 30: YY_RULE_SETUP -#line 182 "scanner.l" +#line 173 "scanner.l" { yylval->ival = 1; return(TOK_BOOLEAN); } YY_BREAK case 31: YY_RULE_SETUP -#line 183 "scanner.l" +#line 174 "scanner.l" { yylval->ival = 0; return(TOK_BOOLEAN); } YY_BREAK case 32: YY_RULE_SETUP -#line 184 "scanner.l" +#line 175 "scanner.l" { yylval->fval = atof(yytext); return(TOK_FLOAT); } YY_BREAK case 33: YY_RULE_SETUP -#line 185 "scanner.l" -{ yylval->ival = atoi(yytext); return(TOK_INTEGER); } +#line 176 "scanner.l" +{ + long long llval; + llval = atoll(yytext); + if((llval < INT_MIN) || (llval > INT_MAX)) + { + yylval->llval = llval; + return(TOK_INTEGER64); + } + else + { + yylval->ival = (int)llval; + return(TOK_INTEGER); + } + } YY_BREAK case 34: YY_RULE_SETUP -#line 186 "scanner.l" +#line 190 "scanner.l" { yylval->llval = atoll(yytext); return(TOK_INTEGER64); } YY_BREAK case 35: YY_RULE_SETUP -#line 187 "scanner.l" -{ yylval->ival = fromihex(yytext); return(TOK_HEX); } +#line 191 "scanner.l" +{ + unsigned long ulval = strtoul(yytext, NULL, 16); + if (ulval > INT32_MAX) + ulval &= INT32_MAX; + yylval->ival = (int)ulval; + return(TOK_HEX); + } YY_BREAK case 36: YY_RULE_SETUP -#line 188 "scanner.l" +#line 198 "scanner.l" { yylval->llval = fromhex(yytext); return(TOK_HEX64); } YY_BREAK case 37: YY_RULE_SETUP -#line 189 "scanner.l" +#line 199 "scanner.l" { yylval->sval = yytext; return(TOK_NAME); } YY_BREAK case 38: YY_RULE_SETUP -#line 190 "scanner.l" +#line 200 "scanner.l" { return(TOK_ARRAY_START); } YY_BREAK case 39: YY_RULE_SETUP -#line 191 "scanner.l" +#line 201 "scanner.l" { return(TOK_ARRAY_END); } YY_BREAK case 40: YY_RULE_SETUP -#line 192 "scanner.l" +#line 202 "scanner.l" { return(TOK_LIST_START); } YY_BREAK case 41: YY_RULE_SETUP -#line 193 "scanner.l" +#line 203 "scanner.l" { return(TOK_LIST_END); } YY_BREAK case 42: YY_RULE_SETUP -#line 194 "scanner.l" +#line 204 "scanner.l" { return(TOK_SEMICOLON); } YY_BREAK case 43: @@ -1233,12 +1236,12 @@ case 43: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 195 "scanner.l" +#line 205 "scanner.l" { /* ignore */ } YY_BREAK case 44: YY_RULE_SETUP -#line 196 "scanner.l" +#line 206 "scanner.l" { return(TOK_GARBAGE); } YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1246,14 +1249,14 @@ case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(STRING): case YY_STATE_EOF(INCLUDE): case YY_STATE_EOF(SCRIPTBLOCK): -#line 198 "scanner.l" +#line 208 "scanner.l" { YY_BUFFER_STATE buf = (YY_BUFFER_STATE)scanctx_pop_include( yyextra); if(buf) { - libconfig_yy_delete_buffer(YY_CURRENT_BUFFER,yyscanner); - libconfig_yy_switch_to_buffer(buf,yyscanner); + libconfig_yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); + libconfig_yy_switch_to_buffer(buf, yyscanner); } else yyterminate(); @@ -1261,10 +1264,10 @@ case YY_STATE_EOF(SCRIPTBLOCK): YY_BREAK case 45: YY_RULE_SETUP -#line 209 "scanner.l" +#line 219 "scanner.l" ECHO; YY_BREAK -#line 1268 "scanner.c" +#line 1269 "scanner.c" case YY_END_OF_BUFFER: { @@ -1407,9 +1410,9 @@ ECHO; static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1438,7 +1441,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1451,7 +1454,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1465,7 +1468,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1474,11 +1477,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - libconfig_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + libconfig_yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ,yyscanner ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1520,16 +1523,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; -#ifndef __clang_analyzer__ - // FIXME: Clang's static analyzer complains about leaking the result of libconfig_yyrealloc - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) libconfig_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) libconfig_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } -#endif // __clang_analyzer__ yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; @@ -1544,8 +1544,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; @@ -1553,7 +1553,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1563,9 +1563,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 123 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1578,11 +1578,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1592,15 +1592,19 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 123 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 122); (void)yyg; return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1626,7 +1630,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1650,7 +1654,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( libconfig_yywrap(yyscanner ) ) - return EOF; + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1699,6 +1703,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) libconfig_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } + assert(YY_CURRENT_BUFFER != NULL); // Fixes compiler warning -Wnull-dereference on gcc-6 and -O3 + libconfig_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); libconfig_yy_load_buffer_state(yyscanner ); } @@ -1767,7 +1773,7 @@ static void libconfig_yy_load_buffer_state (yyscan_t yyscanner) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) libconfig_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + b->yy_ch_buf = (char *) libconfig_yyalloc((yy_size_t) (b->yy_buf_size + 2) ,yyscanner ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_create_buffer()" ); @@ -1923,7 +1929,7 @@ static void libconfig_yyensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)libconfig_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); @@ -1940,7 +1946,7 @@ static void libconfig_yyensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)libconfig_yyrealloc @@ -1970,16 +1976,16 @@ YY_BUFFER_STATE libconfig_yy_scan_buffer (char * base, yy_size_t size , yyscan base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) libconfig_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -1999,10 +2005,10 @@ YY_BUFFER_STATE libconfig_yy_scan_buffer (char * base, yy_size_t size , yyscan * @note If you want to scan bytes that may contain NUL values, then use * libconfig_yy_scan_bytes() instead. */ -YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE libconfig_yy_scan_string (const char * yystr , yyscan_t yyscanner) { - return libconfig_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return libconfig_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to libconfig_yylex() will @@ -2012,15 +2018,15 @@ YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char * yystr , yyscan_t yyscan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE libconfig_yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) libconfig_yyalloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_scan_bytes()" ); @@ -2046,9 +2052,11 @@ YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yy #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2127,7 +2135,7 @@ FILE *libconfig_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t libconfig_yyget_leng (yyscan_t yyscanner) +int libconfig_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2154,10 +2162,10 @@ void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void libconfig_yyset_lineno (int line_number , yyscan_t yyscanner) +void libconfig_yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2165,14 +2173,14 @@ void libconfig_yyset_lineno (int line_number , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "libconfig_yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void libconfig_yyset_column (int column_no , yyscan_t yyscanner) +void libconfig_yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2180,25 +2188,25 @@ void libconfig_yyset_column (int column_no , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "libconfig_yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see libconfig_yy_switch_to_buffer */ -void libconfig_yyset_in (FILE * in_str , yyscan_t yyscanner) +void libconfig_yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void libconfig_yyset_out (FILE * out_str , yyscan_t yyscanner) +void libconfig_yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int libconfig_yyget_debug (yyscan_t yyscanner) @@ -2207,10 +2215,10 @@ int libconfig_yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void libconfig_yyset_debug (int bdebug , yyscan_t yyscanner) +void libconfig_yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2233,9 +2241,7 @@ void libconfig_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ - int libconfig_yylex_init(yyscan_t* ptr_yy_globals) - { if (ptr_yy_globals == NULL){ errno = EINVAL; @@ -2262,9 +2268,7 @@ int libconfig_yylex_init(yyscan_t* ptr_yy_globals) * The user defined value in the first argument will be available to libconfig_yyalloc in * the yyextra field. */ - int libconfig_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) - { struct yyguts_t dummy_yyguts; @@ -2298,10 +2302,10 @@ static int yy_init_globals (yyscan_t yyscanner) * This function is called from libconfig_yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2314,8 +2318,8 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2359,18 +2363,21 @@ int libconfig_yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2380,11 +2387,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *libconfig_yyalloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } void *libconfig_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2392,14 +2404,16 @@ void *libconfig_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void libconfig_yyfree (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see libconfig_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 209 "scanner.l" +#line 219 "scanner.l" diff --git a/3rdparty/libconfig/scanner.h b/3rdparty/libconfig/scanner.h index f684433ec..c1d295594 100644 --- a/3rdparty/libconfig/scanner.h +++ b/3rdparty/libconfig/scanner.h @@ -2,13 +2,9 @@ #define libconfig_yyHEADER_H 1 #define libconfig_yyIN_HEADER 1 -#line 6 "scanner.h" -#line 36 "scanner.l" -#include "scanctx.h" +#line 5 "scanner.h" - - -#line 12 "scanner.h" +#line 7 "scanner.h" #define YY_INT_ALIGNED short int @@ -16,8 +12,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -96,25 +92,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* An opaque pointer. */ @@ -136,7 +120,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE @@ -161,12 +153,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -200,23 +192,23 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void libconfig_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void libconfig_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void libconfig_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void libconfig_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void libconfig_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void libconfig_yypop_buffer_state (yyscan_t yyscanner ); +void libconfig_yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void libconfig_yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void libconfig_yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void libconfig_yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void libconfig_yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void libconfig_yypop_buffer_state ( yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE libconfig_yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *libconfig_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *libconfig_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void libconfig_yyfree (void * ,yyscan_t yyscanner ); +void *libconfig_yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *libconfig_yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void libconfig_yyfree ( void * , yyscan_t yyscanner ); -#define libconfig_yywrap(yyscanner) 1 +#define libconfig_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -234,44 +226,44 @@ void libconfig_yyfree (void * ,yyscan_t yyscanner ); int libconfig_yylex_init (yyscan_t* scanner); -int libconfig_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int libconfig_yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int libconfig_yylex_destroy (yyscan_t yyscanner ); +int libconfig_yylex_destroy ( yyscan_t yyscanner ); -int libconfig_yyget_debug (yyscan_t yyscanner ); +int libconfig_yyget_debug ( yyscan_t yyscanner ); -void libconfig_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void libconfig_yyset_debug ( int debug_flag , yyscan_t yyscanner ); -YY_EXTRA_TYPE libconfig_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE libconfig_yyget_extra ( yyscan_t yyscanner ); -void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void libconfig_yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -FILE *libconfig_yyget_in (yyscan_t yyscanner ); +FILE *libconfig_yyget_in ( yyscan_t yyscanner ); -void libconfig_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void libconfig_yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *libconfig_yyget_out (yyscan_t yyscanner ); +FILE *libconfig_yyget_out ( yyscan_t yyscanner ); -void libconfig_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void libconfig_yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -yy_size_t libconfig_yyget_leng (yyscan_t yyscanner ); + int libconfig_yyget_leng ( yyscan_t yyscanner ); -char *libconfig_yyget_text (yyscan_t yyscanner ); +char *libconfig_yyget_text ( yyscan_t yyscanner ); -int libconfig_yyget_lineno (yyscan_t yyscanner ); +int libconfig_yyget_lineno ( yyscan_t yyscanner ); -void libconfig_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void libconfig_yyset_lineno ( int _line_number , yyscan_t yyscanner ); -int libconfig_yyget_column (yyscan_t yyscanner ); +int libconfig_yyget_column ( yyscan_t yyscanner ); -void libconfig_yyset_column (int column_no ,yyscan_t yyscanner ); +void libconfig_yyset_column ( int _column_no , yyscan_t yyscanner ); -YYSTYPE * libconfig_yyget_lval (yyscan_t yyscanner ); +YYSTYPE * libconfig_yyget_lval ( yyscan_t yyscanner ); -void libconfig_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); +void libconfig_yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -279,18 +271,18 @@ void libconfig_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int libconfig_yywrap (yyscan_t yyscanner ); +extern "C" int libconfig_yywrap ( yyscan_t yyscanner ); #else -extern int libconfig_yywrap (yyscan_t yyscanner ); +extern int libconfig_yywrap ( yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT @@ -299,7 +291,12 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Number of entries by which start-condition stack grows. */ @@ -314,7 +311,7 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #define YY_DECL_IS_OURS 1 extern int libconfig_yylex \ - (YYSTYPE * yylval_param ,yyscan_t yyscanner); + (YYSTYPE * yylval_param , yyscan_t yyscanner); #define YY_DECL int libconfig_yylex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) @@ -334,8 +331,8 @@ extern int libconfig_yylex \ #undef YY_DECL #endif -#line 209 "scanner.l" +#line 219 "scanner.l" -#line 340 "scanner.h" +#line 336 "scanner.h" #undef libconfig_yyIN_HEADER #endif /* libconfig_yyHEADER_H */ diff --git a/3rdparty/libconfig/strbuf.c b/3rdparty/libconfig/strbuf.c index 1ed17a899..0b5dfe511 100644 --- a/3rdparty/libconfig/strbuf.c +++ b/3rdparty/libconfig/strbuf.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -55,4 +55,3 @@ void strbuf_append(strbuf_t *buf, const char *text) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/strbuf.h b/3rdparty/libconfig/strbuf.h index 8b451e730..948bf4768 100644 --- a/3rdparty/libconfig/strbuf.h +++ b/3rdparty/libconfig/strbuf.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. diff --git a/3rdparty/msinttypes/include/stdint.h b/3rdparty/libconfig/win32/stdint.h index cbb023bf9..71c0776d0 100644 --- a/3rdparty/msinttypes/include/stdint.h +++ b/3rdparty/libconfig/win32/stdint.h @@ -1,32 +1,32 @@ // ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. -// +// // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. -// +// // 3. The name of the author may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +// /////////////////////////////////////////////////////////////////////////////// #ifndef _MSC_VER // [ @@ -42,57 +42,28 @@ #include <limits.h> -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}' +// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}' // or compiler give many errors like this: // error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -#if _MSC_VER < 1300 -extern "C++" { -#else -extern "C" { +#if (_MSC_VER < 1300) && defined(__cplusplus) + extern "C++" { #endif +# include <wchar.h> +#if (_MSC_VER < 1300) && defined(__cplusplus) + } #endif -# include <wchar.h> -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - // 7.18.1 Integer types // 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; // 7.18.1.2 Minimum-width integer types typedef int8_t int_least8_t; @@ -116,11 +87,11 @@ typedef uint64_t uint_fast64_t; // 7.18.1.4 Integer types capable of holding object pointers #ifdef _WIN64 // [ - typedef signed __int64 intptr_t; + typedef __int64 intptr_t; typedef unsigned __int64 uintptr_t; #else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; + typedef int intptr_t; + typedef unsigned int uintptr_t; #endif // _WIN64 ] // 7.18.1.5 Greatest-width integer types @@ -247,5 +218,4 @@ typedef uint64_t uintmax_t; #endif // __STDC_CONSTANT_MACROS ] - #endif // _MSC_STDINT_H_ ] diff --git a/3rdparty/libconfig/wincompat.h b/3rdparty/libconfig/wincompat.h index 418191972..7e30f0e8d 100644 --- a/3rdparty/libconfig/wincompat.h +++ b/3rdparty/libconfig/wincompat.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -32,12 +32,19 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +#define fileno _fileno +#define fstat _fstat +#define stat _stat // struct stat for fstat() #define snprintf _snprintf -#ifndef __MINGW32__ +#if !defined(__MINGW32__) && _MSC_VER < 1800 #define atoll _atoi64 #define strtoull _strtoui64 -#endif /* __MINGW32__ */ +#endif + +#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif #endif diff --git a/3rdparty/mysql/include/my_global.h b/3rdparty/mysql/include/my_global.h index 2417477e2..8e4287c19 100644 --- a/3rdparty/mysql/include/my_global.h +++ b/3rdparty/mysql/include/my_global.h @@ -93,7 +93,7 @@ #define NETWARE_SET_SCREEN_MODE(A) #endif -#include "../common/strlib.h" +#include "common/strlib.h" /* The macros below are borrowed from include/linux/compiler.h in the |