Anonymous | Login | Signup for a new account | 2024-12-21 15:27 CET |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0001421 | aMule | Feature Request | public | 2008-10-06 00:59 | 2012-02-09 13:02 | ||||||||
Reporter | Wuischke | ||||||||||||
Assigned To | Wuischke | ||||||||||||
Priority | none | Severity | feature | Reproducibility | always | ||||||||
Status | assigned | Resolution | open | ||||||||||
Platform | OS | OS Version | |||||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0001421: aMuleweb - view comments, see other file names in search | ||||||||||||
Description | - | ||||||||||||
Tags | No tags attached. | ||||||||||||
Fixed in Revision | |||||||||||||
Operating System | Any | ||||||||||||
Attached Files | comment+ratings+sourcenames.svn10686.patch [^] (62,432 bytes) 2011-12-06 10:35 [Show Content] [Hide Content]Index: src/webserver/src/php_amule_lib.cpp =================================================================== --- src/webserver/src/php_amule_lib.cpp (revision 10688) +++ src/webserver/src/php_amule_lib.cpp (working copy) @@ -45,6 +45,7 @@ * datastructre * */ +#include <src/PartFile.h> void php_native_shared_file_cmd(PHP_VALUE_NODE *) { @@ -846,6 +847,39 @@ } else if ( strcmp(prop_name, "hash") == 0 ) { result->type = PHP_VAL_STRING; result->str_val = strdup((const char *)unicode2UTF8(obj->sFileHash)); + } else if ( strcmp(prop_name, "sourcenames") == 0 ) { + int i=0; + const SourcenameItemMap &sources = obj->GetSourcenameItemMap(); + SourcenameItemMap::const_iterator end = sources.end(); + cast_value_array(result); + for (SourcenameItemMap::const_iterator it = sources.begin(); it != sources.end(); ++it) { + const SourcenameItem *cur_src = &(it->second); + PHP_VAR_NODE *src_node = array_get_by_int_key(result, i++); + value_value_free(&src_node->value); + src_node->value.type = PHP_VAL_OBJECT; + src_node->value.obj_val.class_name = "AmuleDownloadFileSourceNames"; + src_node->value.obj_val.inst_ptr = (void *)cur_src; + i++; + } + } else if ( strcmp(prop_name, "comments") == 0 ) { + int i=0; + const SimplerFileRatingList &comments= obj->GetFileRatingList(); + SimplerFileRatingList::const_iterator end = comments.end(); + cast_value_array(result); + for (SimplerFileRatingList::const_iterator it = comments.begin(); it != comments.end(); ++it) { + PHP_VAR_NODE *rating_node = array_get_by_int_key(result, i++); + value_value_free(&rating_node->value); + rating_node->value.type = PHP_VAL_OBJECT; + rating_node->value.obj_val.class_name = "AmuleDownloadFileRatings"; + rating_node->value.obj_val.inst_ptr = (void *) reinterpret_cast<wxUIntPtr>(new SSimplerFileRating(*it)); + i++; + } + } else if ( strcmp(prop_name, "average_rating") == 0 ) { + if(obj->bHasComment){ + result->int_val= obj->iUserRating; + }else{ + result->int_val= 0; + } } else if ( strcmp(prop_name, "progress") == 0 ) { result->type = PHP_VAL_STRING; result->str_val = strdup((const char *)unicode2UTF8(obj->m_Image->GetHTML())); @@ -882,6 +916,49 @@ php_report_error(PHP_ERROR, "'DownloadFile' property [%s] is unknown", prop_name); } } +void amule_download_file_sourcenames_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) +{ + if ( !ptr ) { + value_value_free(result); + return; + } + + SourcenameItem *obj = (SourcenameItem *)ptr; + result->type = PHP_VAL_INT; + if ( strcmp(prop_name, "name") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->name)); + } else if ( strcmp(prop_name, "count") == 0 ) { + result->type = PHP_VAL_INT; + result->int_val= obj->count; + } else { + php_report_error(PHP_ERROR, "'DownloadFileSourceNames' property [%s] is unknown", prop_name); + } +} +void amule_download_file_ratings_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) +{ + if ( !ptr ) { + value_value_free(result); + return; + } + SSimplerFileRating *obj = (SSimplerFileRating *)ptr; + result->type = PHP_VAL_INT; + if ( strcmp(prop_name, "username") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->UserName)); + } else if ( strcmp(prop_name, "filename") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->FileName)); + } else if ( strcmp(prop_name, "rating") == 0 ) { + result->type = PHP_VAL_INT; + result->int_val= obj->Rating; + } else if ( strcmp(prop_name, "comment") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->Comment)); + } else { + php_report_error(PHP_ERROR, "'DownloadFileRatings' property [%s] is unknown", prop_name); + } +} void amule_upload_file_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) { @@ -1149,6 +1226,8 @@ } // load object definitions php_add_native_class("AmuleDownloadFile", amule_download_file_prop_get); + php_add_native_class("AmuleDownloadFileRatings", amule_download_file_ratings_prop_get); + php_add_native_class("AmuleDownloadFileSourceNames", amule_download_file_sourcenames_prop_get); php_add_native_class("AmuleUploadFile", amule_upload_file_prop_get); php_add_native_class("AmuleServer", amule_server_prop_get); php_add_native_class("AmuleSharedFile", amule_shared_file_prop_get); Index: src/webserver/src/php_parser.c =================================================================== --- src/webserver/src/php_parser.c (revision 10688) +++ src/webserver/src/php_parser.c (working copy) @@ -1,23 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.4.1. */ + /* Skeleton implementation for Bison's Yacc-like parsers in C - + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + 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 2, or (at your option) - any later version. - + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +28,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. */ @@ -46,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,19 +54,117 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse phpparse -#define yylex phplex -#define yyerror phperror -#define yylval phplval -#define yychar phpchar -#define yydebug phpdebug -#define yynerrs phpnerrs +#define yyparse phpparse +#define yylex phplex +#define yyerror phperror +#define yylval phplval +#define yychar phpchar +#define yydebug phpdebug +#define yynerrs phpnerrs +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "php_parser.y" + +// +// This file is part of the aMule Project. +// +// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) +// Copyright (c) 2005-2011 Froenchenko Leonid ( lfroen@gmail.com / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// 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 2 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, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#include <stdio.h> +#include <string.h> + +#include "php_syntree.h" + +int phplex(); + +// add item to syntree list +PHP_SYN_NODE *add_statement_2_list(PHP_SYN_NODE *list, PHP_SYN_NODE *st) +{ + if ( st && list) { + PHP_SYN_NODE *last = list; + while ( last->next_node ) { + last = last->next_node; + } + last->next_node = st; + return list; + } else if ( st ) { + return st; + } else { + return list; + } +} + +PHP_SYN_NODE *add_branch_2_elseif(PHP_SYN_NODE *list, PHP_SYN_NODE *branch) +{ + if ( list ) { + PHP_SYN_NODE *curr_if = list; + while ( curr_if->node_if.code_else ) { + curr_if = curr_if->node_if.code_else; + } + curr_if->node_if.code_else = branch; + return list; + } else { + return branch; + } +} + + + +/* Line 189 of yacc.c */ +#line 148 "php_parser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -163,209 +261,37 @@ END_SCRIPT = 345 }; #endif -/* Tokens. */ -#define FNUMBER 258 -#define DNUMBER 259 -#define STRING 260 -#define IDENT 261 -#define VARIABLE 262 -#define T_ECHO 263 -#define EXIT 264 -#define IF 265 -#define DO 266 -#define WHILE 267 -#define ENDWHILE 268 -#define FOR 269 -#define ENDFOR 270 -#define FOREACH 271 -#define ENDFOREACH 272 -#define DECLARE 273 -#define ENDDECLARE 274 -#define AS 275 -#define CONST 276 -#define GLOBAL 277 -#define UNSET 278 -#define ISSET 279 -#define EMPTY 280 -#define SWITCH 281 -#define ENDSWITCH 282 -#define CASE 283 -#define DEFAULT 284 -#define BREAK 285 -#define CONTINUE 286 -#define FUNCTION 287 -#define RETURN 288 -#define CLASS 289 -#define INTERFACE 290 -#define EXTENDS 291 -#define IMPLEMENTS 292 -#define OBJECT_OPERATOR 293 -#define HASH_ASSIGN 294 -#define LIST 295 -#define ARRAY 296 -#define CLASS_SCOPE 297 -#define PRINT 298 -#define SR_EQ 299 -#define SL_EQ 300 -#define XOR_EQ 301 -#define OR_EQ 302 -#define AND_EQ 303 -#define MOD_EQ 304 -#define CONCAT_EQ 305 -#define DIV_EQ 306 -#define MUL_EQ 307 -#define MINUS_EQ 308 -#define PLUS_EQ 309 -#define LOG_OR 310 -#define LOG_XOR 311 -#define LOG_AND 312 -#define BOOLEAN_OR 313 -#define BOOLEAN_AND 314 -#define IS_NOIDENTICAL 315 -#define IS_IDENTICAL 316 -#define IS_NOEQUAL 317 -#define IS_EQ 318 -#define IS_GREATER_OR_EQ 319 -#define IS_SMALLER_OR_EQ 320 -#define SR 321 -#define SL 322 -#define INSTANCEOF 323 -#define UNSET_CAST 324 -#define BOOL_CAST 325 -#define OBJECT_CAST 326 -#define ARRAY_CAST 327 -#define STRING_CAST 328 -#define DOUBLE_CAST 329 -#define INT_CAST 330 -#define DEC 331 -#define INC 332 -#define CLONE 333 -#define NEW 334 -#define ELSEIF 335 -#define ELSE 336 -#define ENDIF 337 -#define PUBLIC 338 -#define PROTECTED 339 -#define PRIVATE 340 -#define FINAL 341 -#define ABSTRACT 342 -#define STATIC 343 -#define START_SCRIPT 344 -#define END_SCRIPT 345 - -/* Copy the first part of user declarations. */ -#line 1 "php_parser.y" - -// -// This file is part of the aMule Project. -// -// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) -// Copyright (c) 2005-2011 Froenchenko Leonid ( lfroen@gmail.com / http://www.amule.org ) -// -// Any parts of this program derived from the xMule, lMule or eMule project, -// or contributed by third-party developers are copyrighted by their -// respective authors. -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -// - -#include <stdio.h> -#include <string.h> - -#include "php_syntree.h" - -int phplex(); - -// add item to syntree list -PHP_SYN_NODE *add_statement_2_list(PHP_SYN_NODE *list, PHP_SYN_NODE *st) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE { - if ( st && list) { - PHP_SYN_NODE *last = list; - while ( last->next_node ) { - last = last->next_node; - } - last->next_node = st; - return list; - } else if ( st ) { - return st; - } else { - return list; - } -} -PHP_SYN_NODE *add_branch_2_elseif(PHP_SYN_NODE *list, PHP_SYN_NODE *branch) -{ - if ( list ) { - PHP_SYN_NODE *curr_if = list; - while ( curr_if->node_if.code_else ) { - curr_if = curr_if->node_if.code_else; - } - curr_if->node_if.code_else = branch; - return list; - } else { - return branch; - } -} +/* Line 214 of yacc.c */ +#line 67 "php_parser.y" + PHP_SYN_NODE *syn_node; + PHP_EXP_NODE *exp_node; + char str_val[256]; -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 67 "php_parser.y" -{ - PHP_SYN_NODE *syn_node; - PHP_EXP_NODE *exp_node; - - char str_val[256]; -} -/* Line 193 of yacc.c. */ -#line 357 "php_parser.c" - YYSTYPE; +/* Line 214 of yacc.c */ +#line 283 "php_parser.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 370 "php_parser.c" +/* Line 264 of yacc.c */ +#line 295 "php_parser.c" #ifdef short # undef short @@ -415,7 +341,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -440,14 +366,14 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -528,9 +454,9 @@ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -564,12 +490,12 @@ 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) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -780,7 +706,7 @@ "program_tree", "top_statement_list", "top_statement", "statement", "decl_list", "expr_list", "variable_list", "global_var_list", "global_var", "static_var_list", "static_var", "function_decl_statement", - "@1", "parameter_list", "optional_class_type", "for_statement", + "$@1", "parameter_list", "optional_class_type", "for_statement", "foreach_statement", "for_expr", "elseif_list", "else_statement", "while_statement", "switch_case_list", "case_list", "case_list_item", "case_separator", "const_value", "variable", "deref_variable", @@ -1709,7 +1635,7 @@ we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1820,17 +1746,20 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1864,11 +1793,11 @@ /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2148,10 +2077,8 @@ break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2167,11 +2094,10 @@ #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -2179,9 +2105,9 @@ -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2205,66 +2131,68 @@ #endif #endif { - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize; - YYSIZE_T yystacksize = YYINITDEPTH; - + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -2294,7 +2222,6 @@ 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 @@ -2302,7 +2229,6 @@ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2325,9 +2251,8 @@ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2338,7 +2263,6 @@ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2348,6 +2272,9 @@ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2356,16 +2283,16 @@ yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2397,20 +2324,16 @@ goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2450,111 +2373,155 @@ switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 142 "php_parser.y" { g_syn_tree_top = (yyvsp[(2) - (3)].syn_node); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 146 "php_parser.y" { (yyval.syn_node) = add_statement_2_list((yyvsp[(1) - (2)].syn_node), (yyvsp[(2) - (2)].syn_node)); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 147 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 153 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 8: + +/* Line 1455 of yacc.c */ #line 159 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 9: + +/* Line 1455 of yacc.c */ #line 160 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_EXPR, (yyvsp[(1) - (2)].exp_node)); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 161 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 162 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 163 "php_parser.y" { (yyval.syn_node) = make_ifelse_syn_node((yyvsp[(3) - (7)].exp_node), (yyvsp[(5) - (7)].syn_node), (yyvsp[(6) - (7)].syn_node), (yyvsp[(7) - (7)].syn_node)); ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 164 "php_parser.y" { (yyval.syn_node) = make_while_loop_syn_node((yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].syn_node), 1); ;} break; case 14: + +/* Line 1455 of yacc.c */ #line 165 "php_parser.y" { (yyval.syn_node) = make_while_loop_syn_node((yyvsp[(5) - (7)].exp_node), (yyvsp[(2) - (7)].syn_node), 0); ;} break; case 15: + +/* Line 1455 of yacc.c */ #line 166 "php_parser.y" { (yyval.syn_node) = make_for_syn_node((yyvsp[(3) - (9)].exp_node), (yyvsp[(5) - (9)].exp_node), (yyvsp[(7) - (9)].exp_node), (yyvsp[(9) - (9)].syn_node)); ;} break; case 16: + +/* Line 1455 of yacc.c */ #line 167 "php_parser.y" { (yyval.syn_node) = make_switch_syn_node((yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node)); ;} break; case 17: + +/* Line 1455 of yacc.c */ #line 168 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_CONTINUE, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 169 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_CONTINUE, (yyvsp[(2) - (3)].exp_node)); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 170 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_BREAK, 0); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 171 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_BREAK, (yyvsp[(2) - (3)].exp_node)); ;} break; case 21: + +/* Line 1455 of yacc.c */ #line 172 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_RET, 0); ;} break; case 22: + +/* Line 1455 of yacc.c */ #line 173 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_RET, (yyvsp[(2) - (3)].exp_node)); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 174 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_ECHO, (yyvsp[(2) - (3)].exp_node)); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 175 "php_parser.y" { ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 176 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (7)].exp_node), 0, (yyvsp[(5) - (7)].exp_node), (yyvsp[(7) - (7)].syn_node), 0); @@ -2562,6 +2529,8 @@ break; case 26: + +/* Line 1455 of yacc.c */ #line 179 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (9)].exp_node), (yyvsp[(5) - (9)].exp_node), (yyvsp[(7) - (9)].exp_node), (yyvsp[(9) - (9)].syn_node), 0); @@ -2569,6 +2538,8 @@ break; case 27: + +/* Line 1455 of yacc.c */ #line 182 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (10)].exp_node), (yyvsp[(5) - (10)].exp_node), (yyvsp[(8) - (10)].exp_node), (yyvsp[(10) - (10)].syn_node), 1); @@ -2576,36 +2547,50 @@ break; case 28: + +/* Line 1455 of yacc.c */ #line 185 "php_parser.y" { ;} break; case 29: + +/* Line 1455 of yacc.c */ #line 186 "php_parser.y" { ;} break; case 30: + +/* Line 1455 of yacc.c */ #line 187 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 31: + +/* Line 1455 of yacc.c */ #line 190 "php_parser.y" { ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 191 "php_parser.y" { ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 194 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LIST, 0); (yyval.exp_node)->exp_node = (yyvsp[(1) - (1)].exp_node); ;} break; case 34: + +/* Line 1455 of yacc.c */ #line 195 "php_parser.y" { PHP_EXP_NODE *last = (yyvsp[(1) - (3)].exp_node); @@ -2617,16 +2602,22 @@ break; case 37: + +/* Line 1455 of yacc.c */ #line 211 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 38: + +/* Line 1455 of yacc.c */ #line 212 "php_parser.y" { ;} break; case 39: + +/* Line 1455 of yacc.c */ #line 216 "php_parser.y" { const char *varname = get_scope_var_name(g_current_scope, (yyvsp[(1) - (1)].exp_node)->var_si_node->var); @@ -2644,21 +2635,29 @@ break; case 40: + +/* Line 1455 of yacc.c */ #line 231 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 41: + +/* Line 1455 of yacc.c */ #line 232 "php_parser.y" { ;} break; case 42: + +/* Line 1455 of yacc.c */ #line 235 "php_parser.y" { (yyvsp[(1) - (1)].exp_node)->var_node->flags |= PHP_VARFLAG_STATIC; (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 43: + +/* Line 1455 of yacc.c */ #line 236 "php_parser.y" { (yyvsp[(1) - (3)].exp_node)->var_node->flags |= PHP_VARFLAG_STATIC; (yyval.exp_node) = (yyvsp[(1) - (3)].exp_node); @@ -2667,6 +2666,8 @@ break; case 44: + +/* Line 1455 of yacc.c */ #line 244 "php_parser.y" { switch_push_scope_table(make_scope_table()) @@ -2674,6 +2675,8 @@ break; case 45: + +/* Line 1455 of yacc.c */ #line 246 "php_parser.y" { (yyval.syn_node) = make_func_decl_syn_node((yyvsp[(2) - (9)].str_val), (yyvsp[(5) - (9)].exp_node)); @@ -2687,106 +2690,148 @@ break; case 46: + +/* Line 1455 of yacc.c */ #line 255 "php_parser.y" { ;} break; case 47: + +/* Line 1455 of yacc.c */ #line 259 "php_parser.y" { (yyval.exp_node) = make_func_param(0, (yyvsp[(2) - (2)].exp_node), (yyvsp[(1) - (2)].str_val), 0); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 260 "php_parser.y" { (yyval.exp_node) = make_func_param(0, (yyvsp[(3) - (3)].exp_node), (yyvsp[(1) - (3)].str_val), 1); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 261 "php_parser.y" { (yyval.exp_node) = make_func_param((yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node), (yyvsp[(3) - (4)].str_val), 0); ;} break; case 50: + +/* Line 1455 of yacc.c */ #line 262 "php_parser.y" { (yyval.exp_node) = make_func_param((yyvsp[(1) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node), (yyvsp[(3) - (5)].str_val), 1); ;} break; case 51: + +/* Line 1455 of yacc.c */ #line 263 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 267 "php_parser.y" { (yyval.str_val)[0] = 0; ;} break; case 55: + +/* Line 1455 of yacc.c */ #line 273 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 278 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 59: + +/* Line 1455 of yacc.c */ #line 282 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 60: + +/* Line 1455 of yacc.c */ #line 286 "php_parser.y" { (yyval.syn_node) = add_branch_2_elseif((yyvsp[(1) - (6)].syn_node), make_ifelse_syn_node((yyvsp[(4) - (6)].exp_node), (yyvsp[(6) - (6)].syn_node), 0, 0)); ;} break; case 61: + +/* Line 1455 of yacc.c */ #line 287 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 62: + +/* Line 1455 of yacc.c */ #line 291 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 63: + +/* Line 1455 of yacc.c */ #line 292 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (2)].syn_node); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 296 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 66: + +/* Line 1455 of yacc.c */ #line 300 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 301 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (4)].exp_node); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 302 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (4)].exp_node); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 303 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (5)].exp_node); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 307 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 308 "php_parser.y" { (yyvsp[(2) - (4)].exp_node)->tree_node.syn_right = (yyvsp[(4) - (4)].syn_node); @@ -2804,421 +2849,589 @@ break; case 72: + +/* Line 1455 of yacc.c */ #line 323 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LIST, (yyvsp[(2) - (2)].exp_node), 0); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 324 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LIST, 0, 0); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 335 "php_parser.y" { (yyval.exp_node) = make_known_const((yyvsp[(1) - (1)].str_val)); ;} break; case 81: + +/* Line 1455 of yacc.c */ #line 339 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_CLASS_DEREF, make_const_exp_str((yyvsp[(1) - (3)].str_val), 0), make_const_exp_str((yyvsp[(3) - (3)].str_val), 0)); ;} break; case 82: + +/* Line 1455 of yacc.c */ #line 340 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_OBJECT_DEREF, (yyvsp[(1) - (3)].exp_node), make_const_exp_str((yyvsp[(3) - (3)].str_val), 0)); ;} break; case 84: + +/* Line 1455 of yacc.c */ #line 345 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (3)].exp_node), 0); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 346 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (4)].exp_node), (yyvsp[(3) - (4)].exp_node));;} break; case 86: + +/* Line 1455 of yacc.c */ #line 347 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (4)].exp_node), (yyvsp[(3) - (4)].exp_node));;} break; case 87: + +/* Line 1455 of yacc.c */ #line 348 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_VAR_BY_EXP, (yyvsp[(3) - (4)].exp_node)); ;} break; case 88: + +/* Line 1455 of yacc.c */ #line 352 "php_parser.y" { (yyval.exp_node) = make_func_call_exp((yyvsp[(1) - (4)].str_val), (yyvsp[(3) - (4)].exp_node)); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 353 "php_parser.y" { ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 354 "php_parser.y" { ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 357 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(1) - (1)].exp_node), 0); ;} break; case 92: + +/* Line 1455 of yacc.c */ #line 358 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(2) - (2)].exp_node), 1); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 359 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (3)].exp_node); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(3) - (3)].exp_node), 0); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 360 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (4)].exp_node); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(4) - (4)].exp_node), 1); ;} break; case 95: + +/* Line 1455 of yacc.c */ #line 361 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 366 "php_parser.y" { ;} break; case 98: + +/* Line 1455 of yacc.c */ #line 368 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 369 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 370 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_MAKE_REF, (yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node)); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 375 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 102: + +/* Line 1455 of yacc.c */ #line 376 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 377 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_MUL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 378 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_DIV, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 379 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_CAT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 106: + +/* Line 1455 of yacc.c */ #line 380 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_REM, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 381 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 382 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 383 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 384 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SHL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 385 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SHR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 112: + +/* Line 1455 of yacc.c */ #line 387 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (2)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 113: + +/* Line 1455 of yacc.c */ #line 388 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(2) - (2)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(2) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 114: + +/* Line 1455 of yacc.c */ #line 389 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (2)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 390 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(2) - (2)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(2) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 392 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 393 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 394 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 119: + +/* Line 1455 of yacc.c */ #line 395 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 120: + +/* Line 1455 of yacc.c */ #line 396 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 397 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 398 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 399 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 400 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_CAT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 125: + +/* Line 1455 of yacc.c */ #line 401 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 126: + +/* Line 1455 of yacc.c */ #line 402 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 127: + +/* Line 1455 of yacc.c */ #line 403 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_MUL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 404 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_DIV, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 405 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_REM, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 406 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SHL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 131: + +/* Line 1455 of yacc.c */ #line 407 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SHR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 408 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (2)].exp_node); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 409 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SUB, make_const_exp_dnum(0), (yyvsp[(2) - (2)].exp_node)); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 410 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LOG_NOT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 411 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_NOT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 136: + +/* Line 1455 of yacc.c */ #line 412 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SAME, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 413 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_NOT_SAME, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 414 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 415 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_NEQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 416 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LWR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 141: + +/* Line 1455 of yacc.c */ #line 417 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LWR_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 418 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_GRT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 143: + +/* Line 1455 of yacc.c */ #line 419 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_GRT_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 420 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 145: + +/* Line 1455 of yacc.c */ #line 421 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_MUX, (yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node)); (yyval.exp_node)->exp_node = (yyvsp[(1) - (5)].exp_node); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 422 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_INT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 147: + +/* Line 1455 of yacc.c */ #line 423 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_FLOAT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 424 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_STR, (yyvsp[(2) - (2)].exp_node)); ;} break; case 149: + +/* Line 1455 of yacc.c */ #line 425 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_BOOL, (yyvsp[(2) - (2)].exp_node)); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 428 "php_parser.y" { ;} break; case 151: + +/* Line 1455 of yacc.c */ #line 429 "php_parser.y" { ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 430 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (2)].exp_node); ;} break; case 153: + +/* Line 1455 of yacc.c */ #line 432 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 433 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY, (yyvsp[(3) - (4)].exp_node)); ;} break; case 155: + +/* Line 1455 of yacc.c */ #line 434 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_PRINT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 437 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 157: + +/* Line 1455 of yacc.c */ #line 438 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 439 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 161: + +/* Line 1455 of yacc.c */ #line 447 "php_parser.y" { /*$$ = make_assign_node($1);*/ ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 448 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (4)].exp_node); ;} break; case 163: + +/* Line 1455 of yacc.c */ #line 449 "php_parser.y" { /*$$ = make_assign_node(0);*/ ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 452 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LIST, 0); (yyval.exp_node)->exp_node = (yyvsp[(1) - (1)].exp_node); ;} break; case 165: + +/* Line 1455 of yacc.c */ #line 453 "php_parser.y" { PHP_EXP_NODE *last = (yyvsp[(1) - (3)].exp_node); @@ -3230,28 +3443,37 @@ break; case 166: + +/* Line 1455 of yacc.c */ #line 462 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY_PAIR, (yyvsp[(1) - (1)].exp_node)); ;} break; case 167: + +/* Line 1455 of yacc.c */ #line 463 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_PAIR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 464 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_REF_PAIR, (yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node)); ;} break; case 169: + +/* Line 1455 of yacc.c */ #line 465 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY_REF_PAIR, (yyvsp[(2) - (2)].exp_node)); ;} break; -/* Line 1267 of yacc.c. */ -#line 3256 "php_parser.c" + +/* Line 1455 of yacc.c */ +#line 3477 "php_parser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3262,7 +3484,6 @@ *++yyvsp = yyval; - /* 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. */ @@ -3327,7 +3548,7 @@ if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -3344,7 +3565,7 @@ } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -3401,9 +3622,6 @@ YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -3428,7 +3646,7 @@ yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -3439,7 +3657,7 @@ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered Index: src/webserver/src/WebServer.cpp =================================================================== --- src/webserver/src/WebServer.cpp (revision 10688) +++ src/webserver/src/WebServer.cpp (working copy) @@ -48,6 +48,8 @@ #include "php_syntree.h" #include "php_core_lib.h" +#include <../../PartFile.h> + //------------------------------------------------------------------- typedef uint32_t COLORTYPE; @@ -55,6 +57,21 @@ #undef RGB #endif + + +SSimplerFileRating::SSimplerFileRating(const wxString &u, const wxString &f, sint16 r, const wxString &c) +: +UserName(u), +FileName(f), +Rating(r), +Comment(c) +{ +} + +SSimplerFileRating::~SSimplerFileRating() +{ +} + inline unsigned long RGB(int r, int g, int b) { return ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff); @@ -736,8 +753,77 @@ m_ReqParts[i].end = reqs[2*i+1]; } } + + // Get source names and counts + CECTag *srcnametag = tag->GetTagByName(EC_TAG_PARTFILE_SOURCE_NAMES); + if (srcnametag) { + SourcenameItemMap &map = GetSourcenameItemMap(); + for (CECTag::const_iterator it = srcnametag->begin(); it != srcnametag->end(); it++) { + + uint32 key = it->GetInt(); + int count = it->GetTagByNameSafe(EC_TAG_PARTFILE_SOURCE_NAMES_COUNTS)->GetInt(); + if (count == 0) { + map.erase(key); + } else { + SourcenameItem &item = map[key]; + item.count = count; + const CECTag *nametag = it->GetTagByName(EC_TAG_PARTFILE_SOURCE_NAMES); + if (nametag) { + item.name = nametag->GetStringData(); + } + } + } + } + + // Get comments + CECTag *commenttag = tag->GetTagByName(EC_TAG_PARTFILE_COMMENTS); + if (commenttag) { + ClearFileRatingList(); + for (CECTag::const_iterator it = commenttag->begin(); it != commenttag->end(); ) { + wxString u = (it++)->GetStringData(); + wxString f = (it++)->GetStringData(); + int r = (it++)->GetInt(); + wxString c = (it++)->GetStringData(); + AddFileRatingList(u, f, r, c); + } + UpdateFileRatingCommentAvail(); + } } +void DownloadFile::UpdateFileRatingCommentAvail() +{ + bool prevComment = bHasComment ; + int prevRating = iUserRating; + + bHasComment = false; + iUserRating = 0; + int ratingCount = 0; + + SimplerFileRatingList::iterator it = m_FileRatingList.begin(); + for (; it != m_FileRatingList.end(); ++it) { + SSimplerFileRating& cur_rat = *it; + + if (!cur_rat.Comment.IsEmpty()) { + bHasComment = true; + } + + uint8 rating = cur_rat.Rating; + if (rating) { + wxASSERT(rating <= 5); + + ratingCount++; + iUserRating += rating; + } + } + + if (ratingCount) { + iUserRating /= ratingCount; + wxASSERT(iUserRating > 0 && iUserRating <= 5); + } +} + + + DownloadFileInfo *DownloadFile::GetContainerInstance() { return DownloadFileInfo::m_This; @@ -779,8 +865,8 @@ bool DownloadFileInfo::ReQuery() { - DoRequery(EC_OP_GET_DLOAD_QUEUE, EC_TAG_PARTFILE); - + DoRequery(EC_OP_GET_DLOAD_QUEUE, EC_TAG_PARTFILE); + return true; } @@ -1067,7 +1153,10 @@ for(int i = 1; i <= colored_gaps_size;i++) { uint32 start = colored_gaps[i].start / factor; uint32 end = colored_gaps[i].end / factor; - for(uint32 j = start; j < end; j++) { + if(end > m_width){ + end=m_width; + } + for(uint32 j = start; j < end ; j++) { m_ColorLine[j] = colored_gaps[i].color; } } @@ -1075,7 +1164,10 @@ for(uint32 i = 0; i < m_file->m_ReqParts.size(); i++) { uint32 start = m_file->m_ReqParts[i].start / factor; uint32 end = m_file->m_ReqParts[i].end / factor; - for(uint32 j = start; j < end; j++) { + if(end > m_width){ + end=m_width; + } + for(uint32 j = start; j < end ; j++) { m_ColorLine[j] = RGB(255, 208, 0); } } Index: src/webserver/src/php_parser.h =================================================================== --- src/webserver/src/php_parser.h (revision 10688) +++ src/webserver/src/php_parser.h (working copy) @@ -1,23 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (c) 1984-2008 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 2, or (at your option) - any later version. - + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,10 +28,11 @@ 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. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -128,115 +129,31 @@ END_SCRIPT = 345 }; #endif -/* Tokens. */ -#define FNUMBER 258 -#define DNUMBER 259 -#define STRING 260 -#define IDENT 261 -#define VARIABLE 262 -#define T_ECHO 263 -#define EXIT 264 -#define IF 265 -#define DO 266 -#define WHILE 267 -#define ENDWHILE 268 -#define FOR 269 -#define ENDFOR 270 -#define FOREACH 271 -#define ENDFOREACH 272 -#define DECLARE 273 -#define ENDDECLARE 274 -#define AS 275 -#define CONST 276 -#define GLOBAL 277 -#define UNSET 278 -#define ISSET 279 -#define EMPTY 280 -#define SWITCH 281 -#define ENDSWITCH 282 -#define CASE 283 -#define DEFAULT 284 -#define BREAK 285 -#define CONTINUE 286 -#define FUNCTION 287 -#define RETURN 288 -#define CLASS 289 -#define INTERFACE 290 -#define EXTENDS 291 -#define IMPLEMENTS 292 -#define OBJECT_OPERATOR 293 -#define HASH_ASSIGN 294 -#define LIST 295 -#define ARRAY 296 -#define CLASS_SCOPE 297 -#define PRINT 298 -#define SR_EQ 299 -#define SL_EQ 300 -#define XOR_EQ 301 -#define OR_EQ 302 -#define AND_EQ 303 -#define MOD_EQ 304 -#define CONCAT_EQ 305 -#define DIV_EQ 306 -#define MUL_EQ 307 -#define MINUS_EQ 308 -#define PLUS_EQ 309 -#define LOG_OR 310 -#define LOG_XOR 311 -#define LOG_AND 312 -#define BOOLEAN_OR 313 -#define BOOLEAN_AND 314 -#define IS_NOIDENTICAL 315 -#define IS_IDENTICAL 316 -#define IS_NOEQUAL 317 -#define IS_EQ 318 -#define IS_GREATER_OR_EQ 319 -#define IS_SMALLER_OR_EQ 320 -#define SR 321 -#define SL 322 -#define INSTANCEOF 323 -#define UNSET_CAST 324 -#define BOOL_CAST 325 -#define OBJECT_CAST 326 -#define ARRAY_CAST 327 -#define STRING_CAST 328 -#define DOUBLE_CAST 329 -#define INT_CAST 330 -#define DEC 331 -#define INC 332 -#define CLONE 333 -#define NEW 334 -#define ELSEIF 335 -#define ELSE 336 -#define ENDIF 337 -#define PUBLIC 338 -#define PROTECTED 339 -#define PRIVATE 340 -#define FINAL 341 -#define ABSTRACT 342 -#define STATIC 343 -#define START_SCRIPT 344 -#define END_SCRIPT 345 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 67 "php_parser.y" { + +/* Line 1676 of yacc.c */ +#line 67 "php_parser.y" + PHP_SYN_NODE *syn_node; PHP_EXP_NODE *exp_node; char str_val[256]; -} -/* Line 1529 of yacc.c. */ -#line 236 "php_parser.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "php_parser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE phplval; + Index: src/webserver/src/WebServer.h =================================================================== --- src/webserver/src/WebServer.h (revision 10688) +++ src/webserver/src/WebServer.h (working copy) @@ -43,6 +43,8 @@ #include <wx/datetime.h> // For DownloadFile::wxtLastSeenComplete +#include <../../PartFile.h> + #ifdef _MSC_VER #define strncasecmp _strnicmp #define snprintf sprintf_s @@ -71,7 +73,30 @@ static wxString Decode(const wxString& url); }; + +class SSimplerFileRating //redefinition of SFileRating to not use the CUPDownClient's constructor +{ +public: + wxString UserName; + wxString FileName; + sint16 Rating; + wxString Comment; +public: + SSimplerFileRating(const wxString &u, const wxString &f, sint16 r, const wxString &c); + ~SSimplerFileRating(); +}; + +typedef std::list<SSimplerFileRating> SimplerFileRatingList; + class DownloadFile : public CECID { + private: + SourcenameItemMap m_SourcenameItemMap; + SimplerFileRatingList m_FileRatingList; + + void ClearFileRatingList() { m_FileRatingList.clear(); } + void AddFileRatingList(const wxString & u, const wxString & f, sint16 r, const wxString & c) { + m_FileRatingList.push_back(SSimplerFileRating(u, f, r, c)); } + public: wxString sFileName; uint8 nFileStatus; @@ -90,7 +115,14 @@ wxString sED2kLink; uint8 nCat; wxDateTime wxtLastSeenComplete; - + + bool bHasComment; + int iUserRating; + void UpdateFileRatingCommentAvail(); + const SimplerFileRatingList &GetFileRatingList() { return m_FileRatingList; } + + SourcenameItemMap &GetSourcenameItemMap() { return m_SourcenameItemMap; } + CMD4Hash nHash; CProgressImage *m_Image; default.tar.gz [^] (557,383 bytes) 2011-12-06 10:37 comment+ratings+sourcenames.svn10745.patch [^] (70,317 bytes) 2012-02-09 13:00 [Show Content] [Hide Content] Index: src/php_amule_lib.cpp =================================================================== --- src/php_amule_lib.cpp (revision 10745) +++ src/php_amule_lib.cpp (working copy) @@ -45,6 +45,7 @@ * datastructre * */ +#include <src/PartFile.h> void php_native_shared_file_cmd(PHP_VALUE_NODE *) { @@ -64,7 +65,7 @@ si = get_scope_item(g_current_scope, "__param_2"); PHP_VAR_NODE *opt_param = si ? si->var : 0; - if ( !strcmp(cmd_name, "prio") && !opt_param ) { + if ( (!strcmp(cmd_name, "prio") ) && !opt_param ) { php_report_error(PHP_ERROR, "Command 'prio' need 3-rd argument"); return; } @@ -846,6 +847,35 @@ } else if ( strcmp(prop_name, "hash") == 0 ) { result->type = PHP_VAL_STRING; result->str_val = strdup((const char *)unicode2UTF8(obj->sFileHash)); + } else if ( strcmp(prop_name, "sourcenames") == 0 ) { + int i=0; + const SourcenameItemMap &sources = obj->GetSourcenameItemMap(); + SourcenameItemMap::const_iterator end = sources.end(); + cast_value_array(result); + for (SourcenameItemMap::const_iterator it = sources.begin(); it != sources.end(); ++it) { + const SourcenameItem *cur_src = &(it->second); + PHP_VAR_NODE *src_node = array_get_by_int_key(result, i++); + value_value_free(&src_node->value); + src_node->value.type = PHP_VAL_OBJECT; + src_node->value.obj_val.class_name = "AmuleDownloadFileSourceNames"; + src_node->value.obj_val.inst_ptr = (void *)cur_src; + i++; + } + } else if ( strcmp(prop_name, "comments") == 0 ) { + int i=0; + const SimplerFileRatingList &comments= obj->GetFileRatingList(); + SimplerFileRatingList::const_iterator end = comments.end(); + cast_value_array(result); + for (SimplerFileRatingList::const_iterator it = comments.begin(); it != comments.end(); ++it) { + PHP_VAR_NODE *rating_node = array_get_by_int_key(result, i++); + value_value_free(&rating_node->value); + rating_node->value.type = PHP_VAL_OBJECT; + rating_node->value.obj_val.class_name = "AmuleDownloadFileRatings"; + rating_node->value.obj_val.inst_ptr = (void *) reinterpret_cast<wxUIntPtr>(new SSimplerFileRating(*it)); + i++; + } + } else if ( strcmp(prop_name, "average_rating") == 0 ) { + result->int_val= obj->iUserRating; } else if ( strcmp(prop_name, "progress") == 0 ) { result->type = PHP_VAL_STRING; result->str_val = strdup((const char *)unicode2UTF8(obj->m_Image->GetHTML())); @@ -882,6 +912,49 @@ php_report_error(PHP_ERROR, "'DownloadFile' property [%s] is unknown", prop_name); } } +void amule_download_file_sourcenames_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) +{ + if ( !ptr ) { + value_value_free(result); + return; + } + + SourcenameItem *obj = (SourcenameItem *)ptr; + result->type = PHP_VAL_INT; + if ( strcmp(prop_name, "name") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->name)); + } else if ( strcmp(prop_name, "count") == 0 ) { + result->type = PHP_VAL_INT; + result->int_val= obj->count; + } else { + php_report_error(PHP_ERROR, "'DownloadFileSourceNames' property [%s] is unknown", prop_name); + } +} +void amule_download_file_ratings_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) +{ + if ( !ptr ) { + value_value_free(result); + return; + } + SSimplerFileRating *obj = (SSimplerFileRating *)ptr; + result->type = PHP_VAL_INT; + if ( strcmp(prop_name, "username") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->UserName)); + } else if ( strcmp(prop_name, "filename") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->FileName)); + } else if ( strcmp(prop_name, "rating") == 0 ) { + result->type = PHP_VAL_INT; + result->int_val= obj->Rating; + } else if ( strcmp(prop_name, "comment") == 0 ) { + result->type = PHP_VAL_STRING; + result->str_val = strdup((const char *)unicode2UTF8(obj->Comment)); + } else { + php_report_error(PHP_ERROR, "'DownloadFileRatings' property [%s] is unknown", prop_name); + } +} void amule_upload_file_prop_get(void *ptr, char *prop_name, PHP_VALUE_NODE *result) { @@ -1149,6 +1222,8 @@ } // load object definitions php_add_native_class("AmuleDownloadFile", amule_download_file_prop_get); + php_add_native_class("AmuleDownloadFileRatings", amule_download_file_ratings_prop_get); + php_add_native_class("AmuleDownloadFileSourceNames", amule_download_file_sourcenames_prop_get); php_add_native_class("AmuleUploadFile", amule_upload_file_prop_get); php_add_native_class("AmuleServer", amule_server_prop_get); php_add_native_class("AmuleSharedFile", amule_shared_file_prop_get); Index: src/php_lexer.c =================================================================== --- src/php_lexer.c (revision 10745) +++ src/php_lexer.c (working copy) @@ -6,10 +6,29 @@ /* A lexical scanner generated by flex */ +#define yy_create_buffer php_create_buffer +#define yy_delete_buffer php_delete_buffer +#define yy_flex_debug php_flex_debug +#define yy_init_buffer php_init_buffer +#define yy_flush_buffer php_flush_buffer +#define yy_load_buffer_state php_load_buffer_state +#define yy_switch_to_buffer php_switch_to_buffer +#define yyin phpin +#define yyleng phpleng +#define yylex phplex +#define yylineno phplineno +#define yyout phpout +#define yyrestart phprestart +#define yytext phptext +#define yywrap phpwrap +#define yyalloc phpalloc +#define yyrealloc phprealloc +#define yyfree phpfree + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -31,7 +50,7 @@ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -54,7 +73,6 @@ typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +103,8 @@ #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -94,11 +114,12 @@ #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -140,7 +161,15 @@ /* 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. @@ -191,14 +220,9 @@ #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -713,7 +737,7 @@ -#line 717 "php_lexer.c" +#line 741 "php_lexer.c" #define INITIAL 0 #define BLOCK_COMMENT 1 @@ -734,6 +758,35 @@ static int yy_init_globals (void ); +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int phplex_destroy (void ); + +int phpget_debug (void ); + +void phpset_debug (int debug_flag ); + +YY_EXTRA_TYPE phpget_extra (void ); + +void phpset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *phpget_in (void ); + +void phpset_in (FILE * in_str ); + +FILE *phpget_out (void ); + +void phpset_out (FILE * out_str ); + +int phpget_leng (void ); + +char *phpget_text (void ); + +int phpget_lineno (void ); + +void phpset_lineno (int line_number ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -778,7 +831,12 @@ /* 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. */ @@ -786,7 +844,7 @@ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( phptext, phpleng, 1, phpout ) +#define ECHO do { if (fwrite( phptext, phpleng, 1, phpout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -882,7 +940,7 @@ #line 73 "php_lexer.l" -#line 886 "php_lexer.c" +#line 944 "php_lexer.c" if ( !(yy_init) ) { @@ -1441,7 +1499,7 @@ #line 251 "php_lexer.l" ECHO; YY_BREAK -#line 1445 "php_lexer.c" +#line 1503 "php_lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BLOCK_COMMENT): case YY_STATE_EOF(LINE_COMMENT): @@ -1675,7 +1733,7 @@ /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -1699,6 +1757,14 @@ else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) ((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 = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) phprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; @@ -1854,7 +1920,7 @@ case EOB_ACT_END_OF_FILE: { if ( phpwrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2123,7 +2189,9 @@ (yy_buffer_stack) = (struct yy_buffer_state**)phpalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); - + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in phpensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; @@ -2141,6 +2209,8 @@ ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in phpensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2185,7 +2255,7 @@ /** Setup the input buffer state to scan a string. The next call to phplex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use @@ -2199,8 +2269,8 @@ /** Setup the input buffer state to scan the given bytes. The next call to phplex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2250,8 +2320,7 @@ (yy_start_stack) = (int *) phprealloc((void *) (yy_start_stack),new_size ); if ( ! (yy_start_stack) ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; Index: src/php_parser.c =================================================================== --- src/php_parser.c (revision 10745) +++ src/php_parser.c (working copy) @@ -1,23 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.4.1. */ + /* Skeleton implementation for Bison's Yacc-like parsers in C - + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + 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 2, or (at your option) - any later version. - + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +28,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. */ @@ -46,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,19 +54,117 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse phpparse -#define yylex phplex -#define yyerror phperror -#define yylval phplval -#define yychar phpchar -#define yydebug phpdebug -#define yynerrs phpnerrs +#define yyparse phpparse +#define yylex phplex +#define yyerror phperror +#define yylval phplval +#define yychar phpchar +#define yydebug phpdebug +#define yynerrs phpnerrs +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "php_parser.y" + +// +// This file is part of the aMule Project. +// +// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) +// Copyright (c) 2005-2011 Froenchenko Leonid ( lfroen@gmail.com / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// 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 2 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, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#include <stdio.h> +#include <string.h> + +#include "php_syntree.h" + +int phplex(); + +// add item to syntree list +PHP_SYN_NODE *add_statement_2_list(PHP_SYN_NODE *list, PHP_SYN_NODE *st) +{ + if ( st && list) { + PHP_SYN_NODE *last = list; + while ( last->next_node ) { + last = last->next_node; + } + last->next_node = st; + return list; + } else if ( st ) { + return st; + } else { + return list; + } +} + +PHP_SYN_NODE *add_branch_2_elseif(PHP_SYN_NODE *list, PHP_SYN_NODE *branch) +{ + if ( list ) { + PHP_SYN_NODE *curr_if = list; + while ( curr_if->node_if.code_else ) { + curr_if = curr_if->node_if.code_else; + } + curr_if->node_if.code_else = branch; + return list; + } else { + return branch; + } +} + + + +/* Line 189 of yacc.c */ +#line 148 "php_parser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -163,209 +261,37 @@ END_SCRIPT = 345 }; #endif -/* Tokens. */ -#define FNUMBER 258 -#define DNUMBER 259 -#define STRING 260 -#define IDENT 261 -#define VARIABLE 262 -#define T_ECHO 263 -#define EXIT 264 -#define IF 265 -#define DO 266 -#define WHILE 267 -#define ENDWHILE 268 -#define FOR 269 -#define ENDFOR 270 -#define FOREACH 271 -#define ENDFOREACH 272 -#define DECLARE 273 -#define ENDDECLARE 274 -#define AS 275 -#define CONST 276 -#define GLOBAL 277 -#define UNSET 278 -#define ISSET 279 -#define EMPTY 280 -#define SWITCH 281 -#define ENDSWITCH 282 -#define CASE 283 -#define DEFAULT 284 -#define BREAK 285 -#define CONTINUE 286 -#define FUNCTION 287 -#define RETURN 288 -#define CLASS 289 -#define INTERFACE 290 -#define EXTENDS 291 -#define IMPLEMENTS 292 -#define OBJECT_OPERATOR 293 -#define HASH_ASSIGN 294 -#define LIST 295 -#define ARRAY 296 -#define CLASS_SCOPE 297 -#define PRINT 298 -#define SR_EQ 299 -#define SL_EQ 300 -#define XOR_EQ 301 -#define OR_EQ 302 -#define AND_EQ 303 -#define MOD_EQ 304 -#define CONCAT_EQ 305 -#define DIV_EQ 306 -#define MUL_EQ 307 -#define MINUS_EQ 308 -#define PLUS_EQ 309 -#define LOG_OR 310 -#define LOG_XOR 311 -#define LOG_AND 312 -#define BOOLEAN_OR 313 -#define BOOLEAN_AND 314 -#define IS_NOIDENTICAL 315 -#define IS_IDENTICAL 316 -#define IS_NOEQUAL 317 -#define IS_EQ 318 -#define IS_GREATER_OR_EQ 319 -#define IS_SMALLER_OR_EQ 320 -#define SR 321 -#define SL 322 -#define INSTANCEOF 323 -#define UNSET_CAST 324 -#define BOOL_CAST 325 -#define OBJECT_CAST 326 -#define ARRAY_CAST 327 -#define STRING_CAST 328 -#define DOUBLE_CAST 329 -#define INT_CAST 330 -#define DEC 331 -#define INC 332 -#define CLONE 333 -#define NEW 334 -#define ELSEIF 335 -#define ELSE 336 -#define ENDIF 337 -#define PUBLIC 338 -#define PROTECTED 339 -#define PRIVATE 340 -#define FINAL 341 -#define ABSTRACT 342 -#define STATIC 343 -#define START_SCRIPT 344 -#define END_SCRIPT 345 - -/* Copy the first part of user declarations. */ -#line 1 "php_parser.y" - -// -// This file is part of the aMule Project. -// -// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) -// Copyright (c) 2005-2011 Froenchenko Leonid ( lfroen@gmail.com / http://www.amule.org ) -// -// Any parts of this program derived from the xMule, lMule or eMule project, -// or contributed by third-party developers are copyrighted by their -// respective authors. -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -// - -#include <stdio.h> -#include <string.h> - -#include "php_syntree.h" - -int phplex(); - -// add item to syntree list -PHP_SYN_NODE *add_statement_2_list(PHP_SYN_NODE *list, PHP_SYN_NODE *st) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE { - if ( st && list) { - PHP_SYN_NODE *last = list; - while ( last->next_node ) { - last = last->next_node; - } - last->next_node = st; - return list; - } else if ( st ) { - return st; - } else { - return list; - } -} -PHP_SYN_NODE *add_branch_2_elseif(PHP_SYN_NODE *list, PHP_SYN_NODE *branch) -{ - if ( list ) { - PHP_SYN_NODE *curr_if = list; - while ( curr_if->node_if.code_else ) { - curr_if = curr_if->node_if.code_else; - } - curr_if->node_if.code_else = branch; - return list; - } else { - return branch; - } -} +/* Line 214 of yacc.c */ +#line 67 "php_parser.y" + PHP_SYN_NODE *syn_node; + PHP_EXP_NODE *exp_node; + char str_val[256]; -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 67 "php_parser.y" -{ - PHP_SYN_NODE *syn_node; - PHP_EXP_NODE *exp_node; - - char str_val[256]; -} -/* Line 193 of yacc.c. */ -#line 357 "php_parser.c" - YYSTYPE; +/* Line 214 of yacc.c */ +#line 283 "php_parser.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 370 "php_parser.c" +/* Line 264 of yacc.c */ +#line 295 "php_parser.c" #ifdef short # undef short @@ -415,7 +341,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -440,14 +366,14 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -528,9 +454,9 @@ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -564,12 +490,12 @@ 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) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -780,7 +706,7 @@ "program_tree", "top_statement_list", "top_statement", "statement", "decl_list", "expr_list", "variable_list", "global_var_list", "global_var", "static_var_list", "static_var", "function_decl_statement", - "@1", "parameter_list", "optional_class_type", "for_statement", + "$@1", "parameter_list", "optional_class_type", "for_statement", "foreach_statement", "for_expr", "elseif_list", "else_statement", "while_statement", "switch_case_list", "case_list", "case_list_item", "case_separator", "const_value", "variable", "deref_variable", @@ -1709,7 +1635,7 @@ we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1820,17 +1746,20 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1864,11 +1793,11 @@ /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2148,10 +2077,8 @@ break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2167,11 +2094,10 @@ #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -2179,9 +2105,9 @@ -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2205,66 +2131,68 @@ #endif #endif { - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize; - YYSIZE_T yystacksize = YYINITDEPTH; - + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -2294,7 +2222,6 @@ 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 @@ -2302,7 +2229,6 @@ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2325,9 +2251,8 @@ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2338,7 +2263,6 @@ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2348,6 +2272,9 @@ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2356,16 +2283,16 @@ yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2397,20 +2324,16 @@ goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2450,111 +2373,155 @@ switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 142 "php_parser.y" { g_syn_tree_top = (yyvsp[(2) - (3)].syn_node); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 146 "php_parser.y" { (yyval.syn_node) = add_statement_2_list((yyvsp[(1) - (2)].syn_node), (yyvsp[(2) - (2)].syn_node)); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 147 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 153 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 8: + +/* Line 1455 of yacc.c */ #line 159 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 9: + +/* Line 1455 of yacc.c */ #line 160 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_EXPR, (yyvsp[(1) - (2)].exp_node)); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 161 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 162 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (3)].syn_node); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 163 "php_parser.y" { (yyval.syn_node) = make_ifelse_syn_node((yyvsp[(3) - (7)].exp_node), (yyvsp[(5) - (7)].syn_node), (yyvsp[(6) - (7)].syn_node), (yyvsp[(7) - (7)].syn_node)); ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 164 "php_parser.y" { (yyval.syn_node) = make_while_loop_syn_node((yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].syn_node), 1); ;} break; case 14: + +/* Line 1455 of yacc.c */ #line 165 "php_parser.y" { (yyval.syn_node) = make_while_loop_syn_node((yyvsp[(5) - (7)].exp_node), (yyvsp[(2) - (7)].syn_node), 0); ;} break; case 15: + +/* Line 1455 of yacc.c */ #line 166 "php_parser.y" { (yyval.syn_node) = make_for_syn_node((yyvsp[(3) - (9)].exp_node), (yyvsp[(5) - (9)].exp_node), (yyvsp[(7) - (9)].exp_node), (yyvsp[(9) - (9)].syn_node)); ;} break; case 16: + +/* Line 1455 of yacc.c */ #line 167 "php_parser.y" { (yyval.syn_node) = make_switch_syn_node((yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node)); ;} break; case 17: + +/* Line 1455 of yacc.c */ #line 168 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_CONTINUE, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 169 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_CONTINUE, (yyvsp[(2) - (3)].exp_node)); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 170 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_BREAK, 0); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 171 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_BREAK, (yyvsp[(2) - (3)].exp_node)); ;} break; case 21: + +/* Line 1455 of yacc.c */ #line 172 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_RET, 0); ;} break; case 22: + +/* Line 1455 of yacc.c */ #line 173 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_RET, (yyvsp[(2) - (3)].exp_node)); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 174 "php_parser.y" { (yyval.syn_node) = make_expr_syn_node(PHP_ST_ECHO, (yyvsp[(2) - (3)].exp_node)); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 175 "php_parser.y" { ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 176 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (7)].exp_node), 0, (yyvsp[(5) - (7)].exp_node), (yyvsp[(7) - (7)].syn_node), 0); @@ -2562,6 +2529,8 @@ break; case 26: + +/* Line 1455 of yacc.c */ #line 179 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (9)].exp_node), (yyvsp[(5) - (9)].exp_node), (yyvsp[(7) - (9)].exp_node), (yyvsp[(9) - (9)].syn_node), 0); @@ -2569,6 +2538,8 @@ break; case 27: + +/* Line 1455 of yacc.c */ #line 182 "php_parser.y" { (yyval.syn_node) = make_foreach_loop_syn_node((yyvsp[(3) - (10)].exp_node), (yyvsp[(5) - (10)].exp_node), (yyvsp[(8) - (10)].exp_node), (yyvsp[(10) - (10)].syn_node), 1); @@ -2576,36 +2547,50 @@ break; case 28: + +/* Line 1455 of yacc.c */ #line 185 "php_parser.y" { ;} break; case 29: + +/* Line 1455 of yacc.c */ #line 186 "php_parser.y" { ;} break; case 30: + +/* Line 1455 of yacc.c */ #line 187 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 31: + +/* Line 1455 of yacc.c */ #line 190 "php_parser.y" { ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 191 "php_parser.y" { ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 194 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LIST, 0); (yyval.exp_node)->exp_node = (yyvsp[(1) - (1)].exp_node); ;} break; case 34: + +/* Line 1455 of yacc.c */ #line 195 "php_parser.y" { PHP_EXP_NODE *last = (yyvsp[(1) - (3)].exp_node); @@ -2617,16 +2602,22 @@ break; case 37: + +/* Line 1455 of yacc.c */ #line 211 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 38: + +/* Line 1455 of yacc.c */ #line 212 "php_parser.y" { ;} break; case 39: + +/* Line 1455 of yacc.c */ #line 216 "php_parser.y" { const char *varname = get_scope_var_name(g_current_scope, (yyvsp[(1) - (1)].exp_node)->var_si_node->var); @@ -2644,21 +2635,29 @@ break; case 40: + +/* Line 1455 of yacc.c */ #line 231 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 41: + +/* Line 1455 of yacc.c */ #line 232 "php_parser.y" { ;} break; case 42: + +/* Line 1455 of yacc.c */ #line 235 "php_parser.y" { (yyvsp[(1) - (1)].exp_node)->var_node->flags |= PHP_VARFLAG_STATIC; (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 43: + +/* Line 1455 of yacc.c */ #line 236 "php_parser.y" { (yyvsp[(1) - (3)].exp_node)->var_node->flags |= PHP_VARFLAG_STATIC; (yyval.exp_node) = (yyvsp[(1) - (3)].exp_node); @@ -2667,6 +2666,8 @@ break; case 44: + +/* Line 1455 of yacc.c */ #line 244 "php_parser.y" { switch_push_scope_table(make_scope_table()) @@ -2674,6 +2675,8 @@ break; case 45: + +/* Line 1455 of yacc.c */ #line 246 "php_parser.y" { (yyval.syn_node) = make_func_decl_syn_node((yyvsp[(2) - (9)].str_val), (yyvsp[(5) - (9)].exp_node)); @@ -2687,106 +2690,148 @@ break; case 46: + +/* Line 1455 of yacc.c */ #line 255 "php_parser.y" { ;} break; case 47: + +/* Line 1455 of yacc.c */ #line 259 "php_parser.y" { (yyval.exp_node) = make_func_param(0, (yyvsp[(2) - (2)].exp_node), (yyvsp[(1) - (2)].str_val), 0); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 260 "php_parser.y" { (yyval.exp_node) = make_func_param(0, (yyvsp[(3) - (3)].exp_node), (yyvsp[(1) - (3)].str_val), 1); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 261 "php_parser.y" { (yyval.exp_node) = make_func_param((yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node), (yyvsp[(3) - (4)].str_val), 0); ;} break; case 50: + +/* Line 1455 of yacc.c */ #line 262 "php_parser.y" { (yyval.exp_node) = make_func_param((yyvsp[(1) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node), (yyvsp[(3) - (5)].str_val), 1); ;} break; case 51: + +/* Line 1455 of yacc.c */ #line 263 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 267 "php_parser.y" { (yyval.str_val)[0] = 0; ;} break; case 55: + +/* Line 1455 of yacc.c */ #line 273 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 278 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 59: + +/* Line 1455 of yacc.c */ #line 282 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 60: + +/* Line 1455 of yacc.c */ #line 286 "php_parser.y" { (yyval.syn_node) = add_branch_2_elseif((yyvsp[(1) - (6)].syn_node), make_ifelse_syn_node((yyvsp[(4) - (6)].exp_node), (yyvsp[(6) - (6)].syn_node), 0, 0)); ;} break; case 61: + +/* Line 1455 of yacc.c */ #line 287 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 62: + +/* Line 1455 of yacc.c */ #line 291 "php_parser.y" { (yyval.syn_node) = 0; ;} break; case 63: + +/* Line 1455 of yacc.c */ #line 292 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (2)].syn_node); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 296 "php_parser.y" { (yyval.syn_node) = (yyvsp[(2) - (4)].syn_node); ;} break; case 66: + +/* Line 1455 of yacc.c */ #line 300 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 301 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (4)].exp_node); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 302 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (4)].exp_node); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 303 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (5)].exp_node); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 307 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 308 "php_parser.y" { (yyvsp[(2) - (4)].exp_node)->tree_node.syn_right = (yyvsp[(4) - (4)].syn_node); @@ -2804,421 +2849,589 @@ break; case 72: + +/* Line 1455 of yacc.c */ #line 323 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LIST, (yyvsp[(2) - (2)].exp_node), 0); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 324 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LIST, 0, 0); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 335 "php_parser.y" { (yyval.exp_node) = make_known_const((yyvsp[(1) - (1)].str_val)); ;} break; case 81: + +/* Line 1455 of yacc.c */ #line 339 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_CLASS_DEREF, make_const_exp_str((yyvsp[(1) - (3)].str_val), 0), make_const_exp_str((yyvsp[(3) - (3)].str_val), 0)); ;} break; case 82: + +/* Line 1455 of yacc.c */ #line 340 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_OBJECT_DEREF, (yyvsp[(1) - (3)].exp_node), make_const_exp_str((yyvsp[(3) - (3)].str_val), 0)); ;} break; case 84: + +/* Line 1455 of yacc.c */ #line 345 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (3)].exp_node), 0); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 346 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (4)].exp_node), (yyvsp[(3) - (4)].exp_node));;} break; case 86: + +/* Line 1455 of yacc.c */ #line 347 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_BY_KEY, (yyvsp[(1) - (4)].exp_node), (yyvsp[(3) - (4)].exp_node));;} break; case 87: + +/* Line 1455 of yacc.c */ #line 348 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_VAR_BY_EXP, (yyvsp[(3) - (4)].exp_node)); ;} break; case 88: + +/* Line 1455 of yacc.c */ #line 352 "php_parser.y" { (yyval.exp_node) = make_func_call_exp((yyvsp[(1) - (4)].str_val), (yyvsp[(3) - (4)].exp_node)); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 353 "php_parser.y" { ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 354 "php_parser.y" { ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 357 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(1) - (1)].exp_node), 0); ;} break; case 92: + +/* Line 1455 of yacc.c */ #line 358 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(2) - (2)].exp_node), 1); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 359 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (3)].exp_node); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(3) - (3)].exp_node), 0); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 360 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (4)].exp_node); func_call_add_expr((yyval.exp_node)->var_node, (yyvsp[(4) - (4)].exp_node), 1); ;} break; case 95: + +/* Line 1455 of yacc.c */ #line 361 "php_parser.y" { (yyval.exp_node) = make_func_call_param_list(); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 366 "php_parser.y" { ;} break; case 98: + +/* Line 1455 of yacc.c */ #line 368 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 369 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 370 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_MAKE_REF, (yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node)); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 375 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 102: + +/* Line 1455 of yacc.c */ #line 376 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 377 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_MUL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 378 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_DIV, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 379 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_CAT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 106: + +/* Line 1455 of yacc.c */ #line 380 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_REM, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 381 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 382 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 383 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 384 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SHL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 385 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (3)].exp_node), make_exp_2(PHP_OP_SHR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node))); ;} break; case 112: + +/* Line 1455 of yacc.c */ #line 387 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (2)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 113: + +/* Line 1455 of yacc.c */ #line 388 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(2) - (2)].exp_node), make_exp_2(PHP_OP_ADD, (yyvsp[(2) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 114: + +/* Line 1455 of yacc.c */ #line 389 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(1) - (2)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 390 "php_parser.y" { (yyval.exp_node) = make_exp_2_self(PHP_OP_ASS, (yyvsp[(2) - (2)].exp_node), make_exp_2(PHP_OP_SUB, (yyvsp[(2) - (2)].exp_node), make_const_exp_dnum(1))); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 392 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 393 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 394 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 119: + +/* Line 1455 of yacc.c */ #line 395 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 120: + +/* Line 1455 of yacc.c */ #line 396 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LOG_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 397 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_OR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 398 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_AND, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 399 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_XOR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 400 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_CAT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 125: + +/* Line 1455 of yacc.c */ #line 401 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ADD, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 126: + +/* Line 1455 of yacc.c */ #line 402 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SUB, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 127: + +/* Line 1455 of yacc.c */ #line 403 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_MUL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 404 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_DIV, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 405 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_REM, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 406 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SHL, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 131: + +/* Line 1455 of yacc.c */ #line 407 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SHR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 408 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (2)].exp_node); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 409 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SUB, make_const_exp_dnum(0), (yyvsp[(2) - (2)].exp_node)); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 410 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LOG_NOT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 411 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_NOT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 136: + +/* Line 1455 of yacc.c */ #line 412 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_SAME, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 413 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_NOT_SAME, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 414 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 415 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_NEQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 416 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LWR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 141: + +/* Line 1455 of yacc.c */ #line 417 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_LWR_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 418 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_GRT, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 143: + +/* Line 1455 of yacc.c */ #line 419 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_GRT_EQ, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 420 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 145: + +/* Line 1455 of yacc.c */ #line 421 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_MUX, (yyvsp[(3) - (5)].exp_node), (yyvsp[(5) - (5)].exp_node)); (yyval.exp_node)->exp_node = (yyvsp[(1) - (5)].exp_node); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 422 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_INT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 147: + +/* Line 1455 of yacc.c */ #line 423 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_FLOAT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 424 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_STR, (yyvsp[(2) - (2)].exp_node)); ;} break; case 149: + +/* Line 1455 of yacc.c */ #line 425 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_CAST_BOOL, (yyvsp[(2) - (2)].exp_node)); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 428 "php_parser.y" { ;} break; case 151: + +/* Line 1455 of yacc.c */ #line 429 "php_parser.y" { ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 430 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (2)].exp_node); ;} break; case 153: + +/* Line 1455 of yacc.c */ #line 432 "php_parser.y" { (yyval.exp_node) = (yyvsp[(1) - (1)].exp_node); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 433 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY, (yyvsp[(3) - (4)].exp_node)); ;} break; case 155: + +/* Line 1455 of yacc.c */ #line 434 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_PRINT, (yyvsp[(2) - (2)].exp_node)); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 437 "php_parser.y" { (yyval.exp_node) = (yyvsp[(2) - (3)].exp_node); ;} break; case 157: + +/* Line 1455 of yacc.c */ #line 438 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 439 "php_parser.y" { (yyval.exp_node) = 0; ;} break; case 161: + +/* Line 1455 of yacc.c */ #line 447 "php_parser.y" { /*$$ = make_assign_node($1);*/ ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 448 "php_parser.y" { (yyval.exp_node) = (yyvsp[(3) - (4)].exp_node); ;} break; case 163: + +/* Line 1455 of yacc.c */ #line 449 "php_parser.y" { /*$$ = make_assign_node(0);*/ ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 452 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_LIST, 0); (yyval.exp_node)->exp_node = (yyvsp[(1) - (1)].exp_node); ;} break; case 165: + +/* Line 1455 of yacc.c */ #line 453 "php_parser.y" { PHP_EXP_NODE *last = (yyvsp[(1) - (3)].exp_node); @@ -3230,28 +3443,37 @@ break; case 166: + +/* Line 1455 of yacc.c */ #line 462 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY_PAIR, (yyvsp[(1) - (1)].exp_node)); ;} break; case 167: + +/* Line 1455 of yacc.c */ #line 463 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_PAIR, (yyvsp[(1) - (3)].exp_node), (yyvsp[(3) - (3)].exp_node)); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 464 "php_parser.y" { (yyval.exp_node) = make_exp_2(PHP_OP_ARRAY_REF_PAIR, (yyvsp[(1) - (4)].exp_node), (yyvsp[(4) - (4)].exp_node)); ;} break; case 169: + +/* Line 1455 of yacc.c */ #line 465 "php_parser.y" { (yyval.exp_node) = make_exp_1(PHP_OP_ARRAY_REF_PAIR, (yyvsp[(2) - (2)].exp_node)); ;} break; -/* Line 1267 of yacc.c. */ -#line 3256 "php_parser.c" + +/* Line 1455 of yacc.c */ +#line 3477 "php_parser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3262,7 +3484,6 @@ *++yyvsp = yyval; - /* 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. */ @@ -3327,7 +3548,7 @@ if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -3344,7 +3565,7 @@ } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -3401,9 +3622,6 @@ YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -3428,7 +3646,7 @@ yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -3439,7 +3657,7 @@ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered Index: src/php_parser.h =================================================================== --- src/php_parser.h (revision 10745) +++ src/php_parser.h (working copy) @@ -1,23 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (c) 1984-2008 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 2, or (at your option) - any later version. - + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,10 +28,11 @@ 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. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -128,115 +129,31 @@ END_SCRIPT = 345 }; #endif -/* Tokens. */ -#define FNUMBER 258 -#define DNUMBER 259 -#define STRING 260 -#define IDENT 261 -#define VARIABLE 262 -#define T_ECHO 263 -#define EXIT 264 -#define IF 265 -#define DO 266 -#define WHILE 267 -#define ENDWHILE 268 -#define FOR 269 -#define ENDFOR 270 -#define FOREACH 271 -#define ENDFOREACH 272 -#define DECLARE 273 -#define ENDDECLARE 274 -#define AS 275 -#define CONST 276 -#define GLOBAL 277 -#define UNSET 278 -#define ISSET 279 -#define EMPTY 280 -#define SWITCH 281 -#define ENDSWITCH 282 -#define CASE 283 -#define DEFAULT 284 -#define BREAK 285 -#define CONTINUE 286 -#define FUNCTION 287 -#define RETURN 288 -#define CLASS 289 -#define INTERFACE 290 -#define EXTENDS 291 -#define IMPLEMENTS 292 -#define OBJECT_OPERATOR 293 -#define HASH_ASSIGN 294 -#define LIST 295 -#define ARRAY 296 -#define CLASS_SCOPE 297 -#define PRINT 298 -#define SR_EQ 299 -#define SL_EQ 300 -#define XOR_EQ 301 -#define OR_EQ 302 -#define AND_EQ 303 -#define MOD_EQ 304 -#define CONCAT_EQ 305 -#define DIV_EQ 306 -#define MUL_EQ 307 -#define MINUS_EQ 308 -#define PLUS_EQ 309 -#define LOG_OR 310 -#define LOG_XOR 311 -#define LOG_AND 312 -#define BOOLEAN_OR 313 -#define BOOLEAN_AND 314 -#define IS_NOIDENTICAL 315 -#define IS_IDENTICAL 316 -#define IS_NOEQUAL 317 -#define IS_EQ 318 -#define IS_GREATER_OR_EQ 319 -#define IS_SMALLER_OR_EQ 320 -#define SR 321 -#define SL 322 -#define INSTANCEOF 323 -#define UNSET_CAST 324 -#define BOOL_CAST 325 -#define OBJECT_CAST 326 -#define ARRAY_CAST 327 -#define STRING_CAST 328 -#define DOUBLE_CAST 329 -#define INT_CAST 330 -#define DEC 331 -#define INC 332 -#define CLONE 333 -#define NEW 334 -#define ELSEIF 335 -#define ELSE 336 -#define ENDIF 337 -#define PUBLIC 338 -#define PROTECTED 339 -#define PRIVATE 340 -#define FINAL 341 -#define ABSTRACT 342 -#define STATIC 343 -#define START_SCRIPT 344 -#define END_SCRIPT 345 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 67 "php_parser.y" { + +/* Line 1676 of yacc.c */ +#line 67 "php_parser.y" + PHP_SYN_NODE *syn_node; PHP_EXP_NODE *exp_node; char str_val[256]; -} -/* Line 1529 of yacc.c. */ -#line 236 "php_parser.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "php_parser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE phplval; + Index: src/WebServer.cpp =================================================================== --- src/WebServer.cpp (revision 10745) +++ src/WebServer.cpp (working copy) @@ -48,6 +48,8 @@ #include "php_syntree.h" #include "php_core_lib.h" +#include <../../PartFile.h> + //------------------------------------------------------------------- typedef uint32_t COLORTYPE; @@ -55,6 +57,21 @@ #undef RGB #endif + + +SSimplerFileRating::SSimplerFileRating(const wxString &u, const wxString &f, sint16 r, const wxString &c) +: +UserName(u), +FileName(f), +Rating(r), +Comment(c) +{ +} + +SSimplerFileRating::~SSimplerFileRating() +{ +} + inline unsigned long RGB(int r, int g, int b) { return ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff); @@ -736,8 +753,77 @@ m_ReqParts[i].end = reqs[2*i+1]; } } + + // Get source names and counts + CECTag *srcnametag = tag->GetTagByName(EC_TAG_PARTFILE_SOURCE_NAMES); + if (srcnametag) { + SourcenameItemMap &map = GetSourcenameItemMap(); + for (CECTag::const_iterator it = srcnametag->begin(); it != srcnametag->end(); it++) { + + uint32 key = it->GetInt(); + int count = it->GetTagByNameSafe(EC_TAG_PARTFILE_SOURCE_NAMES_COUNTS)->GetInt(); + if (count == 0) { + map.erase(key); + } else { + SourcenameItem &item = map[key]; + item.count = count; + const CECTag *nametag = it->GetTagByName(EC_TAG_PARTFILE_SOURCE_NAMES); + if (nametag) { + item.name = nametag->GetStringData(); + } + } + } + } + + // Get comments + CECTag *commenttag = tag->GetTagByName(EC_TAG_PARTFILE_COMMENTS); + if (commenttag) { + ClearFileRatingList(); + for (CECTag::const_iterator it = commenttag->begin(); it != commenttag->end(); ) { + wxString u = (it++)->GetStringData(); + wxString f = (it++)->GetStringData(); + int r = (it++)->GetInt(); + wxString c = (it++)->GetStringData(); + AddFileRatingList(u, f, r, c); + } + UpdateFileRatingCommentAvail(); + } } +void DownloadFile::UpdateFileRatingCommentAvail() +{ + bool prevComment = bHasComment ; + int prevRating = iUserRating; + + bHasComment = false; + iUserRating = 0; + int ratingCount = 0; + + SimplerFileRatingList::iterator it = m_FileRatingList.begin(); + for (; it != m_FileRatingList.end(); ++it) { + SSimplerFileRating& cur_rat = *it; + + if (!cur_rat.Comment.IsEmpty()) { + bHasComment = true; + } + + uint8 rating = cur_rat.Rating; + if (rating) { + wxASSERT(rating <= 5); + + ratingCount++; + iUserRating += rating; + } + } + + if (ratingCount) { + iUserRating /= ratingCount; + wxASSERT(iUserRating > 0 && iUserRating <= 5); + } +} + + + DownloadFileInfo *DownloadFile::GetContainerInstance() { return DownloadFileInfo::m_This; @@ -779,8 +865,8 @@ bool DownloadFileInfo::ReQuery() { - DoRequery(EC_OP_GET_DLOAD_QUEUE, EC_TAG_PARTFILE); - + DoRequery(EC_OP_GET_DLOAD_QUEUE, EC_TAG_PARTFILE); + return true; } @@ -1067,7 +1153,10 @@ for(int i = 1; i <= colored_gaps_size;i++) { uint32 start = colored_gaps[i].start / factor; uint32 end = colored_gaps[i].end / factor; - for(uint32 j = start; j < end; j++) { + if(end > m_width){ + end=m_width; + } + for(uint32 j = start; j < end ; j++) { m_ColorLine[j] = colored_gaps[i].color; } } @@ -1075,7 +1164,10 @@ for(uint32 i = 0; i < m_file->m_ReqParts.size(); i++) { uint32 start = m_file->m_ReqParts[i].start / factor; uint32 end = m_file->m_ReqParts[i].end / factor; - for(uint32 j = start; j < end; j++) { + if(end > m_width){ + end=m_width; + } + for(uint32 j = start; j < end ; j++) { m_ColorLine[j] = RGB(255, 208, 0); } } Index: src/WebServer.h =================================================================== --- src/WebServer.h (revision 10745) +++ src/WebServer.h (working copy) @@ -43,6 +43,8 @@ #include <wx/datetime.h> // For DownloadFile::wxtLastSeenComplete +#include <../../PartFile.h> + #ifdef _MSC_VER #define strncasecmp _strnicmp #define snprintf sprintf_s @@ -71,7 +73,30 @@ static wxString Decode(const wxString& url); }; + +class SSimplerFileRating //redefinition of SFileRating to not use the CUPDownClient's constructor +{ +public: + wxString UserName; + wxString FileName; + sint16 Rating; + wxString Comment; +public: + SSimplerFileRating(const wxString &u, const wxString &f, sint16 r, const wxString &c); + ~SSimplerFileRating(); +}; + +typedef std::list<SSimplerFileRating> SimplerFileRatingList; + class DownloadFile : public CECID { + private: + SourcenameItemMap m_SourcenameItemMap; + SimplerFileRatingList m_FileRatingList; + + void ClearFileRatingList() { m_FileRatingList.clear(); } + void AddFileRatingList(const wxString & u, const wxString & f, sint16 r, const wxString & c) { + m_FileRatingList.push_back(SSimplerFileRating(u, f, r, c)); } + public: wxString sFileName; uint8 nFileStatus; @@ -90,7 +115,14 @@ wxString sED2kLink; uint8 nCat; wxDateTime wxtLastSeenComplete; - + + bool bHasComment; + int iUserRating; + void UpdateFileRatingCommentAvail(); + const SimplerFileRatingList &GetFileRatingList() { return m_FileRatingList; } + + SourcenameItemMap &GetSourcenameItemMap() { return m_SourcenameItemMap; } + CMD4Hash nHash; CProgressImage *m_Image; default.svn10745.tar.gz [^] (289,271 bytes) 2012-02-09 13:02 | ||||||||||||
Notes | |
(0003592) DeMonHell (reporter) 2011-12-06 10:56 |
i've attached a webserver patch to see those fields at least from the Download Queue. The fields added to the amuleweb-php's amule_load_vars("downloads") are: - sourcenames: an array field that include sourcename objects. A sourcename object include these fields: --> name : the filename --> count: number of known sources that have that filename as name. NOTE: these fields are correctly filled only for new files added to the download queue until webserver restart. - comments: an array field that include comment objects. A comment object include these fields: --> username: user name that reported the comment --> filename: file name on which the user reported the comment --> rating: his vote on this file in a 1 (fake) to 5 (excellent) scale. --> comment default.tar.gz is a demo webskin that use those new fields. |
Issue History | |||
Date Modified | Username | Field | Change |
2008-10-06 00:59 | Wuischke | New Issue | |
2008-10-06 00:59 | Wuischke | Operating System | => Any |
2008-10-06 01:00 | Wuischke | Status | new => assigned |
2008-10-06 01:00 | Wuischke | Assigned To | => Wuischke |
2011-12-06 10:35 | DeMonHell | File Added: comment+ratings+sourcenames.svn10686.patch | |
2011-12-06 10:37 | DeMonHell | File Added: default.tar.gz | |
2011-12-06 10:56 | DeMonHell | Note Added: 0003592 | |
2012-02-09 13:00 | DeMonHell | File Added: comment+ratings+sourcenames.svn10745.patch | |
2012-02-09 13:02 | DeMonHell | File Added: default.svn10745.tar.gz |
Copyright © 2000 - 2024 MantisBT Team |