From 7bfb930292aa451f09dcc86bbfd4f21378dc2e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 12:39:14 +0200 Subject: [PATCH 01/13] Feature #1742: Add a set of group IDs to Users --- include/AclManager.h | 4 +- include/AuthRequest.h | 7 +- include/Request.h | 2 + include/User.h | 45 ++- include/UserPool.h | 23 +- src/acl/AclManager.cc | 35 ++- src/authm/AuthManager.cc | 4 +- src/rm/Request.cc | 5 +- src/rm/RequestManagerAllocate.cc | 6 +- src/rm/RequestManagerChmod.cc | 2 +- src/rm/RequestManagerChown.cc | 7 +- src/rm/RequestManagerClone.cc | 2 +- src/rm/RequestManagerCluster.cc | 2 +- src/rm/RequestManagerDelete.cc | 2 +- src/rm/RequestManagerImage.cc | 2 +- src/rm/RequestManagerRename.cc | 2 +- src/rm/RequestManagerVMTemplate.cc | 2 +- src/rm/RequestManagerVirtualMachine.cc | 2 +- src/scheduler/src/sched/Scheduler.cc | 8 +- src/um/User.cc | 19 ++ src/um/UserPool.cc | 44 ++- src/vm/vm_file_var_syntax.cc | 387 +++++++++++-------------- src/vm/vm_file_var_syntax.h | 29 +- src/vm/vm_file_var_syntax.y | 14 +- 24 files changed, 358 insertions(+), 297 deletions(-) diff --git a/include/AclManager.h b/include/AclManager.h index e4e0fe7b1c..f234716a37 100644 --- a/include/AclManager.h +++ b/include/AclManager.h @@ -58,13 +58,13 @@ public: * authorizes the operation. * * @param uid The user ID requesting to be authorized - * @param gid Group ID of the user + * @param user_groups Set of group IDs that the user is part of * @param obj_perms The object's permission attributes * @param op The operation to be authorized * @return true if the authorization is granted by any rule */ const bool authorize(int uid, - int gid, + const set& user_groups, const PoolObjectAuth& obj_perms, AuthRequest::Operation op); diff --git a/include/AuthRequest.h b/include/AuthRequest.h index 13e48f24c7..b32bb2784c 100644 --- a/include/AuthRequest.h +++ b/include/AuthRequest.h @@ -18,6 +18,7 @@ #define AUTH_REQUEST_H_ #include +#include #include "ActionManager.h" #include "PoolObjectAuth.h" @@ -36,7 +37,7 @@ using namespace std; class AuthRequest : public SyncRequest { public: - AuthRequest(int _uid, int _gid): uid(_uid),gid(_gid),self_authorize(true){}; + AuthRequest(int _uid, set _gids): uid(_uid),gids(_gids),self_authorize(true){}; ~AuthRequest(){}; @@ -158,9 +159,9 @@ private: int uid; /** - * The user group ID + * The user groups ID set */ - int gid; + set gids; /** * Username to authenticate the user diff --git a/include/Request.h b/include/Request.h index 214f1fc9ec..a98628f509 100644 --- a/include/Request.h +++ b/include/Request.h @@ -73,6 +73,8 @@ protected: string uname; /**< name of the user */ string gname; /**< name of the user's group */ + set group_ids; /**< set of user's group ids */ + string session; /**< Session from ONE XML-RPC API */ int req_id; /**< Request ID for log messages */ diff --git a/include/User.h b/include/User.h index eb4836d739..3605b7f1a5 100644 --- a/include/User.h +++ b/include/User.h @@ -20,6 +20,7 @@ #include "PoolSQL.h" #include "UserTemplate.h" #include "Quotas.h" +#include "ObjectCollection.h" using namespace std; @@ -29,7 +30,7 @@ using namespace std; /** * The User class. */ -class User : public PoolObjectSQL +class User : public PoolObjectSQL, public ObjectCollection { public: @@ -180,6 +181,47 @@ public: */ int get_umask() const; + /** + * Returns a copy of the groups for the user + */ + set get_groups() + { + return get_collection_copy(); + }; + + // ************************************************************************* + // Group IDs set Management + // ************************************************************************* + + /** + * Adds a group ID to the groups set. + * + * @param id The new id + * @return 0 on success, -1 if the ID was already in the set + */ + int add_group(int group_id) + { + return add_collection_id(group_id); + } + + /** + * Deletes a group ID from the groups set. + * + * @param id The id + * @return 0 on success, + * -1 if the ID was not in the set, + * -2 if the group to delete is the main group + */ + int del_group(int group_id) + { + if( group_id == gid ) + { + return -2; + } + + return del_collection_id(group_id); + } + private: // ------------------------------------------------------------------------- // Friends @@ -310,6 +352,7 @@ protected: const string& _auth_driver, bool _enabled): PoolObjectSQL(id,USER,_uname,-1,_gid,"",_gname,table), + ObjectCollection("GROUPS"), quota("/USER/DATASTORE_QUOTA", "/USER/NETWORK_QUOTA", "/USER/IMAGE_QUOTA", diff --git a/include/UserPool.h b/include/UserPool.h index 0dc1b2e058..2bf05779ea 100644 --- a/include/UserPool.h +++ b/include/UserPool.h @@ -124,6 +124,7 @@ public: * @param gid of the user if authN succeeded -1 otherwise * @param uname of the user if authN succeeded "" otherwise * @param gname of the group if authN succeeded "" otherwise + * @param group_ids the user groups if authN succeeded, is empty otherwise * * @return false if authn failed, true otherwise */ @@ -131,7 +132,8 @@ public: int& uid, int& gid, string& uname, - string& gname); + string& gname, + set& group_ids); /** * Returns whether the operations described in a authorization request are * authorized ot not. @@ -217,7 +219,8 @@ private: int& user_id, int& group_id, string& uname, - string& gname); + string& gname, + set& group_ids); /** * Function to authenticate internal users using a server driver @@ -227,18 +230,20 @@ private: int& user_id, int& group_id, string& uname, - string& gname); + string& gname, + set& group_ids); /** * Function to authenticate external (not known) users */ - bool authenticate_external(const string& username, - const string& token, - int& user_id, - int& group_id, - string& uname, - string& gname); + bool authenticate_external(const string& username, + const string& token, + int& user_id, + int& group_id, + string& uname, + string& gname, + set& group_ids); /** * Factory method to produce User objects * @return a pointer to the new User diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc index b455da5ee5..012ef8438a 100644 --- a/src/acl/AclManager.cc +++ b/src/acl/AclManager.cc @@ -132,7 +132,7 @@ AclManager::~AclManager() const bool AclManager::authorize( int uid, - int gid, + const set& user_groups, const PoolObjectAuth& obj_perms, AuthRequest::Operation op) { @@ -280,23 +280,28 @@ const bool AclManager::authorize( } // ---------------------------------------------------------- - // Look for rules that apply to the user's group + // Look for rules that apply to each one of the user's groups // ---------------------------------------------------------- - user_req = AclRule::GROUP_ID | gid; - auth = match_rules_wrapper(user_req, - resource_oid_req, - resource_gid_req, - resource_cid_req, - resource_all_req, - rights_req, - resource_oid_mask, - resource_gid_mask, - resource_cid_mask, - tmp_rules); - if ( auth == true ) + set::iterator g_it; + + for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++) { - return true; + user_req = AclRule::GROUP_ID | *g_it; + auth = match_rules_wrapper(user_req, + resource_oid_req, + resource_gid_req, + resource_cid_req, + resource_all_req, + rights_req, + resource_oid_mask, + resource_gid_mask, + resource_cid_mask, + tmp_rules); + if ( auth == true ) + { + return true; + } } oss.str("No more rules, permission not granted "); diff --git a/src/authm/AuthManager.cc b/src/authm/AuthManager.cc index 4c31b8500a..954cc36785 100644 --- a/src/authm/AuthManager.cc +++ b/src/authm/AuthManager.cc @@ -67,7 +67,7 @@ void AuthRequest::add_auth(Operation op, // Default conditions that grants permission : // User is oneadmin, or is in the oneadmin group - if ( uid == 0 || gid == GroupPool::ONEADMIN_ID ) + if ( uid == 0 || gids.count( GroupPool::ONEADMIN_ID ) == 1 ) { auth = true; } @@ -76,7 +76,7 @@ void AuthRequest::add_auth(Operation op, Nebula& nd = Nebula::instance(); AclManager* aclm = nd.get_aclm(); - auth = aclm->authorize(uid, gid, ob_perms, op); + auth = aclm->authorize(uid, gids, ob_perms, op); } oss << auth; // Store the ACL authorization result in the request diff --git a/src/rm/Request.cc b/src/rm/Request.cc index 231705d4d7..530efcf457 100644 --- a/src/rm/Request.cc +++ b/src/rm/Request.cc @@ -40,7 +40,8 @@ void Request::execute( att.uid, att.gid, att.uname, - att.gname); + att.gname, + att.group_ids); log_method_invoked(att, _paramList); @@ -240,7 +241,7 @@ bool Request::basic_authorization(int oid, perms.obj_type = auth_object; } - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(op, perms); diff --git a/src/rm/RequestManagerAllocate.cc b/src/rm/RequestManagerAllocate.cc index 028fba2644..e14ba8f7e1 100644 --- a/src/rm/RequestManagerAllocate.cc +++ b/src/rm/RequestManagerAllocate.cc @@ -34,7 +34,7 @@ bool RequestManagerAllocate::allocate_authorization( string tmpl_str = ""; - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); if ( tmpl != 0 ) { @@ -73,7 +73,7 @@ bool VirtualMachineAllocate::allocate_authorization( return true; } - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); string t64; string aname; @@ -459,7 +459,7 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params, if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); string tmpl_str; string aname; diff --git a/src/rm/RequestManagerChmod.cc b/src/rm/RequestManagerChmod.cc index 1e2c2de782..4e763b3a21 100644 --- a/src/rm/RequestManagerChmod.cc +++ b/src/rm/RequestManagerChmod.cc @@ -108,7 +108,7 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList, } } - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(op, perms); diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index a542c231dd..3a94979725 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -213,7 +213,7 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); rc = get_info(pool, oid, auth_object, att, operms, oname); @@ -363,7 +363,7 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(auth_op, uperms); // MANAGE USER ar.add_auth(AuthRequest::USE, ngperms); // USE GROUP @@ -399,6 +399,9 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, user->set_group(ngid,ngname); + user->add_group(ngid); + user->del_group(old_gid); + upool->update(user); user->unlock(); diff --git a/src/rm/RequestManagerClone.cc b/src/rm/RequestManagerClone.cc index 02619348fb..ab2b6b357d 100644 --- a/src/rm/RequestManagerClone.cc +++ b/src/rm/RequestManagerClone.cc @@ -79,7 +79,7 @@ void RequestManagerClone::request_execute( { string tmpl_str = ""; - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(auth_op, perms); //USE OBJECT diff --git a/src/rm/RequestManagerCluster.cc b/src/rm/RequestManagerCluster.cc index 876b286915..a73a7ba549 100644 --- a/src/rm/RequestManagerCluster.cc +++ b/src/rm/RequestManagerCluster.cc @@ -70,7 +70,7 @@ void RequestManagerCluster::add_generic( if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); if ( cluster_id != ClusterPool::NONE_CLUSTER_ID ) { diff --git a/src/rm/RequestManagerDelete.cc b/src/rm/RequestManagerDelete.cc index aa1a0e7317..25e794d948 100644 --- a/src/rm/RequestManagerDelete.cc +++ b/src/rm/RequestManagerDelete.cc @@ -47,7 +47,7 @@ bool RequestManagerDelete::delete_authorization( object->unlock(); - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(auth_op, perms); // OBJECT diff --git a/src/rm/RequestManagerImage.cc b/src/rm/RequestManagerImage.cc index da2eed6e04..cb01d37820 100644 --- a/src/rm/RequestManagerImage.cc +++ b/src/rm/RequestManagerImage.cc @@ -357,7 +357,7 @@ void ImageClone::request_execute( if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); string tmpl_str; // ------------------ Check permissions and ACLs ---------------------- diff --git a/src/rm/RequestManagerRename.cc b/src/rm/RequestManagerRename.cc index 0c5ba2bcca..c5c899adcf 100644 --- a/src/rm/RequestManagerRename.cc +++ b/src/rm/RequestManagerRename.cc @@ -53,7 +53,7 @@ void RequestManagerRename::request_execute(xmlrpc_c::paramList const& paramList, if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(auth_op, operms); // MANAGE OBJECT diff --git a/src/rm/RequestManagerVMTemplate.cc b/src/rm/RequestManagerVMTemplate.cc index 5f0952f115..40f85b4e78 100644 --- a/src/rm/RequestManagerVMTemplate.cc +++ b/src/rm/RequestManagerVMTemplate.cc @@ -177,7 +177,7 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList if ( att.uid != 0 ) { - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(auth_op, perms); //USE TEMPLATE diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index d353fd322f..8841b5ea87 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -55,7 +55,7 @@ bool RequestManagerVirtualMachine::vm_authorization( object->unlock(); - AuthRequest ar(att.uid, att.gid); + AuthRequest ar(att.uid, att.group_ids); ar.add_auth(op, vm_perms); diff --git a/src/scheduler/src/sched/Scheduler.cc b/src/scheduler/src/sched/Scheduler.cc index a711899609..b7b95d2be5 100644 --- a/src/scheduler/src/sched/Scheduler.cc +++ b/src/scheduler/src/sched/Scheduler.cc @@ -431,8 +431,14 @@ void Scheduler::match() host_perms.oid = host->get_hid(); host_perms.obj_type = PoolObjectSQL::HOST; + // Even if the owner is in several groups, this request only + // uses the VM group ID + + set gids; + gids.insert(gid); + matched = acls->authorize(uid, - gid, + gids, host_perms, AuthRequest::MANAGE); } diff --git a/src/um/User.cc b/src/um/User.cc index 40fe011183..dd5eb08d8a 100644 --- a/src/um/User.cc +++ b/src/um/User.cc @@ -156,6 +156,9 @@ string& User::to_xml_extended(string& xml, bool extended) const string template_xml; string quota_xml; + string collection_xml; + + ObjectCollection::to_xml(collection_xml); int enabled_int = enabled?1:0; @@ -163,6 +166,7 @@ string& User::to_xml_extended(string& xml, bool extended) const "" "" << oid <<"" << "" << gid <<"" << + collection_xml << "" << gname <<"" << "" << name <<"" << "" << password <<"" << @@ -220,7 +224,22 @@ int User::from_xml(const string& xml) rc += obj_template->from_xml_node(content[0]); ObjectXML::free_nodes(content); + content.clear(); + ObjectXML::get_nodes("/USER/GROUPS", content); + + if (content.empty()) + { + return -1; + } + + // Set of IDs + rc += ObjectCollection::from_xml_node(content[0]); + + ObjectXML::free_nodes(content); + content.clear(); + + // Quotas rc += quota.from_xml(this); if (rc != 0) diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index 7e05d4de5a..457be81795 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -293,6 +293,9 @@ int UserPool::allocate ( // Build a new User object user = new User(-1, gid, uname, gname, upass, auth_driver, enabled); + // Add the primary group to the collection + user->add_collection_id(gid); + // Set a password for the OneGate tokens user->add_template_attribute("TOKEN_PASSWORD", one_util::random_password()); @@ -348,7 +351,8 @@ bool UserPool::authenticate_internal(User * user, int& user_id, int& group_id, string& uname, - string& gname) + string& gname, + set& group_ids) { bool result = false; @@ -367,6 +371,8 @@ bool UserPool::authenticate_internal(User * user, user_id = user->oid; group_id = user->gid; + group_ids = user->get_groups(); + uname = user->name; gname = user->gname; @@ -381,7 +387,7 @@ bool UserPool::authenticate_internal(User * user, return true; } - AuthRequest ar(user_id, group_id); + AuthRequest ar(user_id, group_ids); if ( auth_driver == UserPool::CORE_AUTH ) { @@ -459,7 +465,8 @@ bool UserPool::authenticate_server(User * user, int& user_id, int& group_id, string& uname, - string& gname) + string& gname, + set& group_ids) { bool result = false; @@ -480,7 +487,7 @@ bool UserPool::authenticate_server(User * user, auth_driver = user->auth_driver; - AuthRequest ar(user->oid, user->gid); + AuthRequest ar(user->oid, user->get_groups()); user->unlock(); @@ -502,6 +509,8 @@ bool UserPool::authenticate_server(User * user, user_id = user->oid; group_id = user->gid; + group_ids = user->get_groups(); + uname = user->name; gname = user->gname; @@ -580,12 +589,13 @@ auth_failure: /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -bool UserPool::authenticate_external(const string& username, - const string& token, - int& user_id, - int& group_id, - string& uname, - string& gname) +bool UserPool::authenticate_external(const string& username, + const string& token, + int& user_id, + int& group_id, + string& uname, + string& gname, + set& group_ids) { ostringstream oss; istringstream is; @@ -598,7 +608,9 @@ bool UserPool::authenticate_external(const string& username, Nebula& nd = Nebula::instance(); AuthManager * authm = nd.get_authm(); - AuthRequest ar(-1,-1); + set empty_set; + + AuthRequest ar(-1,empty_set); if (authm == 0) { @@ -653,6 +665,7 @@ bool UserPool::authenticate_external(const string& username, } group_id = GroupPool::USERS_ID; + group_ids.insert( GroupPool::USERS_ID ); uname = mad_name; gname = GroupPool::USERS_NAME; @@ -694,7 +707,8 @@ bool UserPool::authenticate(const string& session, int& user_id, int& group_id, string& uname, - string& gname) + string& gname, + set& group_ids) { User * user = 0; string username; @@ -718,16 +732,16 @@ bool UserPool::authenticate(const string& session, if ( fnmatch(UserPool::SERVER_AUTH, driver.c_str(), 0) == 0 ) { - ar = authenticate_server(user,token,user_id,group_id,uname,gname); + ar = authenticate_server(user,token,user_id,group_id,uname,gname,group_ids); } else { - ar = authenticate_internal(user,token,user_id,group_id,uname,gname); + ar = authenticate_internal(user,token,user_id,group_id,uname,gname,group_ids); } } else { - ar = authenticate_external(username,token,user_id,group_id,uname,gname); + ar = authenticate_external(username,token,user_id,group_id,uname,gname,group_ids); } return ar; diff --git a/src/vm/vm_file_var_syntax.cc b/src/vm/vm_file_var_syntax.cc index b532e52859..d68d775b43 100644 --- a/src/vm/vm_file_var_syntax.cc +++ b/src/vm/vm_file_var_syntax.cc @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7.12-4996" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,6 +58,8 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ #define yyparse vm_file_var__parse @@ -70,7 +72,8 @@ #define yylloc vm_file_var__lloc /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ + +/* Line 268 of yacc.c */ #line 17 "vm_file_var_syntax.y" #include @@ -145,7 +148,9 @@ int get_image_path(VirtualMachine * vm, Nebula& nd = Nebula::instance(); ImagePool * ipool = nd.get_ipool(); + UserPool * upool = nd.get_upool(); Image * img = 0; + User * user = 0; int iid = -1; PoolObjectAuth perm; @@ -218,7 +223,17 @@ int get_image_path(VirtualMachine * vm, img->unlock(); - AuthRequest ar(vm->get_uid(), vm->get_gid()); + set gids; + + user = upool->get(vm->get_uid(), true); + + if (user != 0) + { + gids = user->get_groups(); + user->unlock(); + } + + AuthRequest ar(vm->get_uid(), gids); ar.add_auth(AuthRequest::USE, perm); @@ -237,16 +252,14 @@ int get_image_path(VirtualMachine * vm, /* -------------------------------------------------------------------------- */ -/* Line 371 of yacc.c */ -#line 242 "vm_file_var_syntax.cc" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 258 "vm_file_var_syntax.cc" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -256,18 +269,12 @@ int get_image_path(VirtualMachine * vm, # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "vm_file_var_syntax.hh". */ -#ifndef YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED -# define YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int vm_file_var__debug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -287,19 +294,22 @@ extern int vm_file_var__debug; #endif + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 387 of yacc.c */ -#line 190 "vm_file_var_syntax.y" + +/* Line 293 of yacc.c */ +#line 202 "vm_file_var_syntax.y" char * val_str; int val_int; char val_char; -/* Line 387 of yacc.c */ -#line 303 "vm_file_var_syntax.cc" + +/* Line 293 of yacc.c */ +#line 313 "vm_file_var_syntax.cc" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -320,26 +330,11 @@ typedef struct YYLTYPE #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int vm_file_var__parse (void *YYPARSE_PARAM); -#else -int vm_file_var__parse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int vm_file_var__parse (mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg); -#else -int vm_file_var__parse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED */ - /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 343 "vm_file_var_syntax.cc" + +/* Line 343 of yacc.c */ +#line 338 "vm_file_var_syntax.cc" #ifdef short # undef short @@ -392,33 +387,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif - /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(N) (N) +# define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -454,7 +440,6 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -548,20 +533,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -639,18 +624,18 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 214, 214, 215, 219, 237 + 0, 226, 226, 227, 231, 249 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "EQUAL", "COMMA", "OBRACKET", "CBRACKET", "EOA", "STRING", "VARIABLE", "RSTRING", "INTEGER", "$accept", - "vm_string", "vm_variable", YY_NULL + "vm_string", "vm_variable", 0 }; #endif @@ -716,10 +701,10 @@ static const yytype_uint8 yytable[] = 9, 14, 15, 16, 6, 0, 17 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-8))) +#define yypact_value_is_default(yystate) \ + ((yystate) == (-8)) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = @@ -763,24 +748,23 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (&yylloc, mc, vm, img_ids, errmsg, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) -/* Error token number */ + #define YYTERROR 1 #define YYERRCODE 256 @@ -789,28 +773,27 @@ while (YYID (0)) If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know @@ -818,46 +801,10 @@ while (YYID (0)) #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - -/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - -__attribute__((__unused__)) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static unsigned -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -#else -static unsigned -yy_location_print_ (yyo, yylocp) - FILE *yyo; - YYLTYPE const * const yylocp; -#endif -{ - unsigned res = 0; - int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; - if (0 <= yylocp->first_line) - { - res += fprintf (yyo, "%d", yylocp->first_line); - if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); - } - if (0 <= yylocp->last_line) - { - if (yylocp->first_line < yylocp->last_line) - { - res += fprintf (yyo, "-%d", yylocp->last_line); - if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); - } - else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); - } - return res; - } - -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) - +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -865,6 +812,7 @@ yy_location_print_ (yyo, yylocp) /* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) #else @@ -919,8 +867,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, char ** errmsg; #endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; YYUSE (yylocationp); @@ -934,7 +880,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, # else YYUSE (yyoutput); # endif - YYUSE (yytype); + switch (yytype) + { + default: + break; + } } @@ -1185,11 +1135,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1249,13 +1200,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } } } @@ -1275,12 +1224,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; if (*yymsg_alloc < yysize) { @@ -1346,10 +1293,29 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - YYUSE (yytype); + switch (yytype) + { + + default: + break; + } } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /*----------. @@ -1384,40 +1350,11 @@ yyparse (mc, vm, img_ids, errmsg) /* The lookahead symbol. */ int yychar; - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif -static YYLTYPE yyloc_default -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - = { 1, 1, 1, 1 } -# endif -; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); +YYSTYPE yylval; /* Location data for the lookahead symbol. */ -YYLTYPE yylloc = yyloc_default; - +YYLTYPE yylloc; /* Number of syntax errors so far. */ int yynerrs; @@ -1431,7 +1368,7 @@ YYLTYPE yylloc = yyloc_default; `yyvs': related to semantic values. `yyls': related to locations. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1457,7 +1394,7 @@ YYLTYPE yylloc = yyloc_default; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1476,9 +1413,10 @@ YYLTYPE yylloc = yyloc_default; Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yylsp = yyls = yylsa; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1487,7 +1425,21 @@ YYLTYPE yylloc = yyloc_default; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - yylsp[0] = yylloc; + + /* 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; + yylsp = yyls; + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + goto yysetstate; /*------------------------------------------------------------. @@ -1633,9 +1585,7 @@ yybackup: yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; goto yynewstate; @@ -1673,8 +1623,9 @@ yyreduce: switch (yyn) { case 4: -/* Line 1787 of yacc.c */ -#line 220 "vm_file_var_syntax.y" + +/* Line 1806 of yacc.c */ +#line 232 "vm_file_var_syntax.y" { string file((yyvsp[(1) - (7)].val_str)); string var1((yyvsp[(3) - (7)].val_str)); @@ -1695,8 +1646,9 @@ yyreduce: break; case 5: -/* Line 1787 of yacc.c */ -#line 238 "vm_file_var_syntax.y" + +/* Line 1806 of yacc.c */ +#line 250 "vm_file_var_syntax.y" { string file((yyvsp[(1) - (11)].val_str)); string var1((yyvsp[(3) - (11)].val_str)); @@ -1720,8 +1672,9 @@ yyreduce: break; -/* Line 1787 of yacc.c */ -#line 1725 "vm_file_var_syntax.cc" + +/* Line 1806 of yacc.c */ +#line 1678 "vm_file_var_syntax.cc" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1886,9 +1839,7 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of @@ -1917,7 +1868,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1959,8 +1910,9 @@ yyreturn: } -/* Line 2050 of yacc.c */ -#line 259 "vm_file_var_syntax.y" + +/* Line 2067 of yacc.c */ +#line 271 "vm_file_var_syntax.y" extern "C" void vm_file_var__error( @@ -1988,3 +1940,4 @@ extern "C" void vm_file_var__error( llocp->last_column); } } + diff --git a/src/vm/vm_file_var_syntax.h b/src/vm/vm_file_var_syntax.h index ba21e884af..ec594f7c05 100644 --- a/src/vm/vm_file_var_syntax.h +++ b/src/vm/vm_file_var_syntax.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -30,15 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED -# define YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int vm_file_var__debug; -#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -59,25 +50,30 @@ extern int vm_file_var__debug; #endif + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 2053 of yacc.c */ -#line 190 "vm_file_var_syntax.y" + +/* Line 2068 of yacc.c */ +#line 202 "vm_file_var_syntax.y" char * val_str; int val_int; char val_char; -/* Line 2053 of yacc.c */ -#line 75 "vm_file_var_syntax.hh" + +/* Line 2068 of yacc.c */ +#line 69 "vm_file_var_syntax.hh" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + + #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { @@ -91,4 +87,5 @@ typedef struct YYLTYPE # define YYLTYPE_IS_TRIVIAL 1 #endif -#endif /* !YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED */ + + diff --git a/src/vm/vm_file_var_syntax.y b/src/vm/vm_file_var_syntax.y index 2fc5df034a..acdc81c73c 100644 --- a/src/vm/vm_file_var_syntax.y +++ b/src/vm/vm_file_var_syntax.y @@ -87,7 +87,9 @@ int get_image_path(VirtualMachine * vm, Nebula& nd = Nebula::instance(); ImagePool * ipool = nd.get_ipool(); + UserPool * upool = nd.get_upool(); Image * img = 0; + User * user = 0; int iid = -1; PoolObjectAuth perm; @@ -160,7 +162,17 @@ int get_image_path(VirtualMachine * vm, img->unlock(); - AuthRequest ar(vm->get_uid(), vm->get_gid()); + set gids; + + user = upool->get(vm->get_uid(), true); + + if (user != 0) + { + gids = user->get_groups(); + user->unlock(); + } + + AuthRequest ar(vm->get_uid(), gids); ar.add_auth(AuthRequest::USE, perm); From 1b3a10b958e7a8208d586c6f42028ee2509da91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 13:30:06 +0200 Subject: [PATCH 02/13] Feature #1742: Methods to add and remove secondary groups --- include/RequestManagerUser.h | 42 ++++++++++++ src/cli/oneuser | 26 +++++++- src/oca/ruby/opennebula/user.rb | 21 +++++- src/rm/RequestManager.cc | 4 ++ src/rm/RequestManagerUser.cc | 115 ++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 2 deletions(-) diff --git a/include/RequestManagerUser.h b/include/RequestManagerUser.h index be6571ea47..be4adc2d49 100644 --- a/include/RequestManagerUser.h +++ b/include/RequestManagerUser.h @@ -128,6 +128,48 @@ public: string& err); }; +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ + +class UserAddGroup : public RequestManagerUser +{ +public: + UserAddGroup(): + RequestManagerUser("UserAddGroup", + "Adds the user to a secondary group", + "A:sii") + { + auth_op = AuthRequest::MANAGE; + }; + + ~UserAddGroup(){}; + + int user_action(int user_id, + xmlrpc_c::paramList const& _paramList, + string& err); +}; + +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ + +class UserDelGroup : public RequestManagerUser +{ +public: + UserDelGroup(): + RequestManagerUser("UserDelGroup", + "Deletes the user from a secondary group", + "A:sii") + { + auth_op = AuthRequest::MANAGE; + }; + + ~UserDelGroup(){}; + + int user_action(int user_id, + xmlrpc_c::paramList const& _paramList, + string& err); +}; + /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ diff --git a/src/cli/oneuser b/src/cli/oneuser index 96aa91f0e5..4a5bf032e7 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -380,7 +380,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do end chgrp_desc = <<-EOT.unindent - Changes the User's main group + Changes the User's primary group EOT command :chgrp, chgrp_desc, [:range, :userid_list], :groupid do @@ -389,6 +389,30 @@ cmd=CommandParser::CmdParser.new(ARGV) do end end + addgroup_desc = <<-EOT.unindent + Adds the User to a secondary group + EOT + + command :addgroup, addgroup_desc, [:range, :userid_list], :groupid do + gid = args[1] + + helper.perform_actions(args[0],options,"group added") do |user| + user.addgroup( gid ) + end + end + + delgroup_desc = <<-EOT.unindent + Removes the User from a secondary group + EOT + + command :delgroup, delgroup_desc, [:range, :userid_list], :groupid do + gid = args[1] + + helper.perform_actions(args[0],options,"group deleted") do |user| + user.delgroup( gid ) + end + end + chauth_desc = <<-EOT.unindent Changes the User's auth driver and its password (optional) Examples: diff --git a/src/oca/ruby/opennebula/user.rb b/src/oca/ruby/opennebula/user.rb index 664322f681..4548ae555d 100644 --- a/src/oca/ruby/opennebula/user.rb +++ b/src/oca/ruby/opennebula/user.rb @@ -29,6 +29,8 @@ module OpenNebula :delete => "user.delete", :passwd => "user.passwd", :chgrp => "user.chgrp", + :addgroup => "user.addgroup", + :delgroup => "user.delgroup", :update => "user.update", :chauth => "user.chauth", :quota => "user.quota" @@ -124,7 +126,7 @@ module OpenNebula return rc end - # Changes the main group + # Changes the primary group # gid:: _Integer_ the new group id. Set to -1 to leave the current one # [return] nil in case of success or an Error object def chgrp(gid) @@ -136,6 +138,23 @@ module OpenNebula return rc end + # Adds the User to a secondary group + # @param gid [Integer] the new group id. + # @return [nil, OpenNebula::Error] nil in case of success, Error + # otherwise + def addgroup(gid) + return call(USER_METHODS[:addgroup], @pe_id, gid) + end + + # Removes the User from a secondary group. Fails if the + # group is the main one + # @param gid [Integer] the group id. + # @return [nil, OpenNebula::Error] nil in case of success, Error + # otherwise + def delgroup(gid) + return call(USER_METHODS[:delgroup], @pe_id, gid) + end + # Changes the auth driver and the password of the given User # # @param auth [String] the new auth driver diff --git a/src/rm/RequestManager.cc b/src/rm/RequestManager.cc index 05d9aae885..31dc020d6f 100644 --- a/src/rm/RequestManager.cc +++ b/src/rm/RequestManager.cc @@ -254,6 +254,8 @@ void RequestManager::register_xml_methods() xmlrpc_c::methodPtr user_change_password(new UserChangePassword()); xmlrpc_c::methodPtr user_change_auth(new UserChangeAuth()); xmlrpc_c::methodPtr user_set_quota(new UserSetQuota()); + xmlrpc_c::methodPtr user_add_group(new UserAddGroup()); + xmlrpc_c::methodPtr user_del_group(new UserDelGroup()); // Group Methods xmlrpc_c::methodPtr group_set_quota(new GroupSetQuota()); @@ -489,6 +491,8 @@ void RequestManager::register_xml_methods() RequestManagerRegistry.addMethod("one.user.info", user_info); RequestManagerRegistry.addMethod("one.user.passwd", user_change_password); RequestManagerRegistry.addMethod("one.user.chgrp", user_chown); + RequestManagerRegistry.addMethod("one.user.addgroup", user_add_group); + RequestManagerRegistry.addMethod("one.user.delgroup", user_del_group); RequestManagerRegistry.addMethod("one.user.chauth", user_change_auth); RequestManagerRegistry.addMethod("one.user.quota", user_set_quota); diff --git a/src/rm/RequestManagerUser.cc b/src/rm/RequestManagerUser.cc index c026c398c9..983da4d076 100644 --- a/src/rm/RequestManagerUser.cc +++ b/src/rm/RequestManagerUser.cc @@ -210,3 +210,118 @@ int UserSetQuota::user_action(int user_id, return rc; } + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +int UserAddGroup::user_action( + int user_id, + xmlrpc_c::paramList const& paramList, + string& error_str) +{ + int group_id = xmlrpc_c::value_int(paramList.getInt(2)); + int rc; + + User* user = static_cast(pool->get(user_id,true)); + + rc = user->add_group(group_id); + + if ( rc != 0 ) + { + user->unlock(); + + error_str = "User is already in this group"; + return rc; + } + + pool->update(user); + + user->unlock(); + + Nebula& nd = Nebula::instance(); + GroupPool * gpool = nd.get_gpool(); + Group * group = gpool->get(group_id, true); + + if( group == 0 ) + { + User * user = static_cast(pool->get(user_id,true)); + + if ( user != 0 ) + { + user->del_group(group_id); + + pool->update(user); + + user->unlock(); + } + + error_str = "Group does not exist"; + return -1; + } + + group->add_user(user_id); + + gpool->update(group); + + group->unlock(); + + return 0; +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +int UserDelGroup::user_action( + int user_id, + xmlrpc_c::paramList const& paramList, + string& error_str) +{ + int group_id = xmlrpc_c::value_int(paramList.getInt(2)); + int rc; + + User* user = static_cast(pool->get(user_id,true)); + + rc = user->del_group(group_id); + + if ( rc != 0 ) + { + user->unlock(); + + if ( rc == -1 ) + { + error_str = "User is not part of this group"; + } + else if ( rc == -2 ) + { + error_str = "Cannot remove user from the primary group"; + } + else + { + error_str = "Cannot remove user from group"; + } + return rc; + } + + pool->update(user); + + user->unlock(); + + Nebula& nd = Nebula::instance(); + GroupPool * gpool = nd.get_gpool(); + Group * group = gpool->get(group_id, true); + + if( group == 0 ) + { + //Group does not exists, should never occur + error_str = "Cannot remove user from group"; + return -1; + } + + group->del_user(user_id); + + gpool->update(group); + + group->unlock(); + + return 0; +} From 0bc0f4a3539c5e994ec72f9634a89622bf8150a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 15:36:43 +0200 Subject: [PATCH 03/13] Feature #1742: List resources from secondary groups --- include/AclManager.h | 4 +- include/PoolSQL.h | 20 +++++----- src/acl/AclManager.cc | 28 +++++++++----- src/pool/PoolSQL.cc | 52 ++++++++++++++++---------- src/rm/RequestManagerPoolInfoFilter.cc | 4 +- 5 files changed, 66 insertions(+), 42 deletions(-) diff --git a/include/AclManager.h b/include/AclManager.h index f234716a37..5077b7843e 100644 --- a/include/AclManager.h +++ b/include/AclManager.h @@ -128,7 +128,7 @@ public: * the given user to perform the operation. * * @param uid The user ID - * @param gid Group ID of the user + * @param user_groups Set of group IDs that the user is part of * @param obj_type The object over which the search will be performed * @param op The operation to be searched * @param all True if the user can perform the operation over any object @@ -137,7 +137,7 @@ public: * @param cids Set of object cluster IDs over which the user can operate */ void reverse_search(int uid, - int gid, + const set& user_groups, PoolObjectSQL::ObjectType obj_type, AuthRequest::Operation op, bool& all, diff --git a/include/PoolSQL.h b/include/PoolSQL.h index 6cd6a6d375..8cee89c4fa 100644 --- a/include/PoolSQL.h +++ b/include/PoolSQL.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "SqlDB.h" #include "PoolObjectSQL.h" @@ -180,30 +181,31 @@ public: * Creates a filter for those objects (oids) or objects owned by a given * group that an user can access based on the ACL rules * @param uid the user id - * @param gid the group id + * @param user_groups Set of group IDs that the user is part of * @param auth_object object type * @param all returns if the user can access all objects * @param filter the resulting filter string */ static void acl_filter(int uid, - int gid, + const set& user_groups, PoolObjectSQL::ObjectType auth_object, bool& all, string& filter); + /** * Creates a filter for the objects owned by a given user/group * @param uid the user id - * @param gid the group id + * @param user_groups Set of group IDs that the user is part of * @param filter_flag query type (ALL, MINE, GROUP) * @param all user can access all objects * @param filter the resulting filter string */ - static void usr_filter(int uid, - int gid, - int filter_flag, - bool all, - const string& acl_str, - string& filter); + static void usr_filter(int uid, + const set& user_groups, + int filter_flag, + bool all, + const string& acl_str, + string& filter); /** * Creates a filter for a given set of objects based on their id * @param start_id first id diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc index 012ef8438a..39a7976cf8 100644 --- a/src/acl/AclManager.cc +++ b/src/acl/AclManager.cc @@ -721,7 +721,7 @@ void AclManager::del_resource_matching_rules(long long resource_req, /* -------------------------------------------------------------------------- */ void AclManager::reverse_search(int uid, - int gid, + const set& user_groups, PoolObjectSQL::ObjectType obj_type, AuthRequest::Operation op, bool& all, @@ -769,22 +769,30 @@ void AclManager::reverse_search(int uid, // Look for the rules that match // --------------------------------------------------- - long long user_reqs[] = + vector user_reqs; + vector::iterator reqs_it; + + set::iterator g_it; + + // rules that apply to everyone + user_reqs.push_back(AclRule::ALL_ID); + + // rules that apply to the individual user id + user_reqs.push_back(AclRule::INDIVIDUAL_ID | uid); + + // rules that apply to each one of the user's groups + for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++) { - AclRule::ALL_ID, // rules that apply to everyone - AclRule::INDIVIDUAL_ID | uid, // rules that apply to the individual user id - AclRule::GROUP_ID | gid // rules that apply to the user's groups - }; + user_reqs.push_back(AclRule::GROUP_ID | *g_it); + } all = false; - for ( int i=0; i<3; i++ ) + for (reqs_it = user_reqs.begin(); reqs_it != user_reqs.end(); reqs_it++) { - long long user_req = user_reqs[i]; - lock(); - index = acl_rules.equal_range( user_req ); + index = acl_rules.equal_range( *reqs_it ); for ( it = index.first; it != index.second; it++) { diff --git a/src/pool/PoolSQL.cc b/src/pool/PoolSQL.cc index 2c7de17f37..8b6e1ee890 100644 --- a/src/pool/PoolSQL.cc +++ b/src/pool/PoolSQL.cc @@ -579,14 +579,14 @@ int PoolSQL::search( /* -------------------------------------------------------------------------- */ void PoolSQL::acl_filter(int uid, - int gid, + const set& user_groups, PoolObjectSQL::ObjectType auth_object, bool& all, string& filter) { filter.clear(); - if ( uid == 0 || gid == 0 ) + if ( uid == UserPool::ONEADMIN_ID || user_groups.count( GroupPool::ONEADMIN_ID ) == 1 ) { all = true; return; @@ -603,7 +603,7 @@ void PoolSQL::acl_filter(int uid, vector cids; aclm->reverse_search(uid, - gid, + user_groups, auth_object, AuthRequest::USE, all, @@ -631,32 +631,43 @@ void PoolSQL::acl_filter(int uid, /* -------------------------------------------------------------------------- */ -void PoolSQL::usr_filter(int uid, - int gid, - int filter_flag, - bool all, - const string& acl_str, - string& filter) +void PoolSQL::usr_filter(int uid, + const set& user_groups, + int filter_flag, + bool all, + const string& acl_str, + string& filter) { ostringstream uid_filter; + set::iterator g_it; + if ( filter_flag == RequestManagerPoolInfoFilter::MINE ) { uid_filter << "uid = " << uid; } else if ( filter_flag == RequestManagerPoolInfoFilter::MINE_GROUP ) { - uid_filter << " uid = " << uid - << " OR ( gid = " << gid << " AND group_u = 1 )"; + uid_filter << " uid = " << uid; + + for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++) + { + uid_filter << " OR ( gid = " << *g_it << " AND group_u = 1 )"; + } } else if ( filter_flag == RequestManagerPoolInfoFilter::ALL ) { if (!all) { uid_filter << " uid = " << uid - << " OR ( gid = " << gid << " AND group_u = 1 )" - << " OR other_u = 1" - << acl_str; + << " OR other_u = 1"; + + for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++) + { + uid_filter << " OR ( gid = " << *g_it << " AND group_u = 1 )"; + } + + uid_filter << acl_str; } } else @@ -665,11 +676,14 @@ void PoolSQL::usr_filter(int uid, if ( filter_flag != uid && !all ) { - uid_filter << " AND (" - << " ( gid = " << gid << " AND group_u = 1)" - << " OR other_u = 1" - << acl_str - << ")"; + uid_filter << " AND ( other_u = 1"; + + for (g_it = user_groups.begin(); g_it != user_groups.end(); g_it++) + { + uid_filter << " OR ( gid = " << *g_it << " AND group_u = 1 )"; + } + + uid_filter << acl_str << ")"; } } diff --git a/src/rm/RequestManagerPoolInfoFilter.cc b/src/rm/RequestManagerPoolInfoFilter.cc index 9ad3e0cc6c..0651fe0b6f 100644 --- a/src/rm/RequestManagerPoolInfoFilter.cc +++ b/src/rm/RequestManagerPoolInfoFilter.cc @@ -279,9 +279,9 @@ void RequestManagerPoolInfoFilter::where_filter( ostringstream filter; - PoolSQL::acl_filter(att.uid, att.gid, auth_object, all, acl_str); + PoolSQL::acl_filter(att.uid, att.group_ids, auth_object, all, acl_str); - PoolSQL::usr_filter(att.uid, att.gid, filter_flag, all, acl_str, uid_str); + PoolSQL::usr_filter(att.uid, att.group_ids, filter_flag, all, acl_str, uid_str); PoolSQL::oid_filter(start_id, end_id, oid_str); From b4e63d8a337ff73c1a3506a2de1f181fa2f43570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 17:46:46 +0200 Subject: [PATCH 04/13] Feature #1742: add/del secondary group requires MANAGE GROUP --- include/RequestManagerUser.h | 78 +++++++++++++++++------- src/rm/RequestManagerUser.cc | 114 ++++++++++++++++++++++++++++------- 2 files changed, 148 insertions(+), 44 deletions(-) diff --git a/include/RequestManagerUser.h b/include/RequestManagerUser.h index be4adc2d49..1e04c610d5 100644 --- a/include/RequestManagerUser.h +++ b/include/RequestManagerUser.h @@ -45,8 +45,9 @@ protected: /* -------------------------------------------------------------------- */ - void request_execute(xmlrpc_c::paramList const& _paramList, - RequestAttributes& att); + void request_execute( + xmlrpc_c::paramList const& _paramList, + RequestAttributes& att); virtual int user_action(int user_id, xmlrpc_c::paramList const& _paramList, @@ -131,43 +132,78 @@ public: /* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ -class UserAddGroup : public RequestManagerUser +class UserEditGroup : public Request { public: - UserAddGroup(): - RequestManagerUser("UserAddGroup", - "Adds the user to a secondary group", - "A:sii") + UserEditGroup( + const string& method_name, + const string& help, + const string& params): + Request(method_name,params,help) { + auth_object = PoolObjectSQL::USER; auth_op = AuthRequest::MANAGE; + + Nebula& nd = Nebula::instance(); + gpool = nd.get_gpool(); + upool = nd.get_upool(); }; - ~UserAddGroup(){}; + ~UserEditGroup(){}; - int user_action(int user_id, - xmlrpc_c::paramList const& _paramList, - string& err); + void request_execute( + xmlrpc_c::paramList const& _paramList, + RequestAttributes& att); + + virtual int secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str) = 0; + +protected: + GroupPool * gpool; + UserPool * upool; }; /* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ -class UserDelGroup : public RequestManagerUser +class UserAddGroup : public UserEditGroup +{ +public: + UserAddGroup(): + UserEditGroup("UserAddGroup", + "Adds the user to a secondary group", + "A:sii"){}; + + ~UserAddGroup(){}; + + int secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str); +}; + +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ + +class UserDelGroup : public UserEditGroup { public: UserDelGroup(): - RequestManagerUser("UserDelGroup", - "Deletes the user from a secondary group", - "A:sii") - { - auth_op = AuthRequest::MANAGE; - }; + UserEditGroup("UserDelGroup", + "Deletes the user from a secondary group", + "A:sii"){}; ~UserDelGroup(){}; - int user_action(int user_id, - xmlrpc_c::paramList const& _paramList, - string& err); + int secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str); }; /* -------------------------------------------------------------------------- */ diff --git a/src/rm/RequestManagerUser.cc b/src/rm/RequestManagerUser.cc index 983da4d076..331d30f1e0 100644 --- a/src/rm/RequestManagerUser.cc +++ b/src/rm/RequestManagerUser.cc @@ -214,15 +214,83 @@ int UserSetQuota::user_action(int user_id, /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -int UserAddGroup::user_action( - int user_id, - xmlrpc_c::paramList const& paramList, - string& error_str) +void UserEditGroup:: + request_execute(xmlrpc_c::paramList const& paramList, + RequestAttributes& att) { + int user_id = xmlrpc_c::value_int(paramList.getInt(1)); int group_id = xmlrpc_c::value_int(paramList.getInt(2)); + int rc; - User* user = static_cast(pool->get(user_id,true)); + string error_str; + + string gname; + string uname; + + PoolObjectAuth uperms; + PoolObjectAuth gperms; + + rc = get_info(upool, user_id, PoolObjectSQL::USER, att, uperms, uname); + + if ( rc == -1 ) + { + return; + } + + rc = get_info(gpool, group_id, PoolObjectSQL::GROUP, att, gperms, gname); + + if ( rc == -1 ) + { + return; + } + + if ( att.uid != UserPool::ONEADMIN_ID ) + { + AuthRequest ar(att.uid, att.group_ids); + + ar.add_auth(AuthRequest::MANAGE, uperms); // MANAGE USER + ar.add_auth(AuthRequest::MANAGE, gperms); // MANAGE GROUP + + if (UserPool::authorize(ar) == -1) + { + failure_response(AUTHORIZATION, + authorization_error(ar.message, att), + att); + + return; + } + } + + if ( secondary_group_action(user_id, group_id, paramList, error_str) < 0 ) + { + failure_response(ACTION, request_error(error_str,""), att); + return; + } + + success_response(user_id, att); +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +int UserAddGroup::secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str) +{ + User * user; + Group * group; + + int rc; + + user = upool->get(user_id,true); + + if ( user == 0 ) + { + return -1; + } rc = user->add_group(group_id); @@ -231,26 +299,24 @@ int UserAddGroup::user_action( user->unlock(); error_str = "User is already in this group"; - return rc; + return -1; } - pool->update(user); + upool->update(user); user->unlock(); - Nebula& nd = Nebula::instance(); - GroupPool * gpool = nd.get_gpool(); - Group * group = gpool->get(group_id, true); + group = gpool->get(group_id, true); if( group == 0 ) { - User * user = static_cast(pool->get(user_id,true)); + user = upool->get(user_id,true); if ( user != 0 ) { user->del_group(group_id); - pool->update(user); + upool->update(user); user->unlock(); } @@ -271,15 +337,18 @@ int UserAddGroup::user_action( /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -int UserDelGroup::user_action( - int user_id, - xmlrpc_c::paramList const& paramList, - string& error_str) +int UserDelGroup::secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str) { - int group_id = xmlrpc_c::value_int(paramList.getInt(2)); + User * user; + Group * group; + int rc; - User* user = static_cast(pool->get(user_id,true)); + user = upool->get(user_id,true); rc = user->del_group(group_id); @@ -299,20 +368,19 @@ int UserDelGroup::user_action( { error_str = "Cannot remove user from group"; } + return rc; } - pool->update(user); + upool->update(user); user->unlock(); - Nebula& nd = Nebula::instance(); - GroupPool * gpool = nd.get_gpool(); - Group * group = gpool->get(group_id, true); + group = gpool->get(group_id, true); if( group == 0 ) { - //Group does not exists, should never occur + //Group does not exist, should never occur error_str = "Cannot remove user from group"; return -1; } From d0b28bc90a723cf46d0700d03ec2d90b9ca66adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 18:23:59 +0200 Subject: [PATCH 05/13] Feature #1742: When a user is deleted, it is now removed from the secondary groups --- src/rm/RequestManagerDelete.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rm/RequestManagerDelete.cc b/src/rm/RequestManagerDelete.cc index 25e794d948..8d7496689d 100644 --- a/src/rm/RequestManagerDelete.cc +++ b/src/rm/RequestManagerDelete.cc @@ -227,8 +227,11 @@ int ClusterDelete::drop(int oid, PoolObjectSQL * object, string& error_msg) int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg) { - User * user = static_cast(object); - int group_id = user->get_gid(); + set group_set; + set::iterator it; + + User * user = static_cast(object); + group_set = user->get_groups(); if (oid == 0) { @@ -244,10 +247,17 @@ int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg) if ( rc == 0 ) { - Group * group = gpool->get(group_id, true); + Group * group; - if( group != 0 ) + for ( it = group_set.begin(); it != group_set.end(); it++ ) { + group = gpool->get(*it, true); + + if( group == 0 ) + { + continue; + } + group->del_user(oid); gpool->update(group); From 913a96f7e8350324daa0ce2a3102d885b6ef3ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 23 Aug 2013 18:37:50 +0200 Subject: [PATCH 06/13] Feature #1742: chgrp does not delete the user from the previous group This allows users to use the chgrp to change their own primary group to one of the secondary ones --- src/rm/RequestManagerChown.cc | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index 3a94979725..5c60e65f4b 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -317,6 +317,8 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, int rc; + bool remove_old_group; + string ngname; string uname; @@ -399,8 +401,17 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, user->set_group(ngid,ngname); - user->add_group(ngid); - user->del_group(old_gid); + // The user is removed from the old group only if the new group is not a + // secondary one + + rc = user->add_group(ngid); + + remove_old_group = (rc == 0); + + if (remove_old_group) + { + user->del_group(old_gid); + } upool->update(user); @@ -426,15 +437,18 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, // ------------- Updates old group removing the user --------------------- - group = gpool->get(old_gid, true); - - if( group != 0 ) + if (remove_old_group) { - group->del_user(oid); + group = gpool->get(old_gid, true); - gpool->update(group); + if( group != 0 ) + { + group->del_user(oid); - group->unlock(); + gpool->update(group); + + group->unlock(); + } } success_response(oid, att); From ddad4270ac730a1f8e799f00c81fecceb6b16be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 26 Aug 2013 13:20:47 +0200 Subject: [PATCH 07/13] Feature #1742: Add migrator to 4.3.80 --- install.sh | 1 + share/doc/xsd/user.xsd | 7 +++++ src/onedb/4.2.0_to_4.3.80.rb | 57 ++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/onedb/4.2.0_to_4.3.80.rb diff --git a/install.sh b/install.sh index 141abc4113..4eb1699ef2 100755 --- a/install.sh +++ b/install.sh @@ -1132,6 +1132,7 @@ ONEDB_MIGRATOR_FILES="src/onedb/2.0_to_2.9.80.rb \ src/onedb/4.0.0_to_4.0.1.rb \ src/onedb/4.0.1_to_4.1.80.rb \ src/onedb/4.1.80_to_4.2.0.rb \ + src/onedb/4.2.0_to_4.3.80.rb \ src/onedb/fsck.rb \ src/onedb/onedb.rb \ src/onedb/onedb_backend.rb" diff --git a/share/doc/xsd/user.xsd b/share/doc/xsd/user.xsd index f851f688f0..d2eae5fe4e 100644 --- a/share/doc/xsd/user.xsd +++ b/share/doc/xsd/user.xsd @@ -6,6 +6,13 @@ + + + + + + + diff --git a/src/onedb/4.2.0_to_4.3.80.rb b/src/onedb/4.2.0_to_4.3.80.rb new file mode 100644 index 0000000000..5a566b100d --- /dev/null +++ b/src/onedb/4.2.0_to_4.3.80.rb @@ -0,0 +1,57 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'rexml/document' + +module Migrator + def db_version + "4.3.80" + end + + def one_version + "OpenNebula 4.3.80" + end + + def up + + ######################################################################## + # Feature #1742 + ######################################################################## + + @db.run "ALTER TABLE user_pool RENAME TO old_user_pool;" + @db.run "CREATE TABLE user_pool (oid INTEGER PRIMARY KEY, name VARCHAR(128), body MEDIUMTEXT, uid INTEGER, gid INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER, UNIQUE(name));" + + @db.fetch("SELECT * FROM old_user_pool") do |row| + doc = REXML::Document.new(row[:body]) + + doc.root.add_element("GROUPS").add_element("ID").text = row[:gid].to_s + + @db[:user_pool].insert( + :oid => row[:oid], + :name => row[:name], + :body => doc.root.to_s, + :uid => row[:oid], + :gid => row[:gid], + :owner_u => row[:owner_u], + :group_u => row[:group_u], + :other_u => row[:other_u]) + end + + @db.run "DROP TABLE old_user_pool;" + + return true + end +end From 7b8659a7c4047a056e5a667b971605413d107129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 26 Aug 2013 16:51:02 +0200 Subject: [PATCH 08/13] Feature #1742: Add secondary groups to the CLI --- src/cli/one_helper/oneuser_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/one_helper/oneuser_helper.rb b/src/cli/one_helper/oneuser_helper.rb index 8e7c08c4de..6b10072da1 100644 --- a/src/cli/one_helper/oneuser_helper.rb +++ b/src/cli/one_helper/oneuser_helper.rb @@ -245,13 +245,15 @@ class OneUserHelper < OpenNebulaHelper::OneHelper def format_resource(user, options = {}) system = System.new(@client) - str="%-15s: %-20s" + str="%-16s: %-20s" str_h1="%-80s" CLIHelper.print_header(str_h1 % "USER #{user['ID']} INFORMATION") puts str % ["ID", user.id.to_s] puts str % ["NAME", user.name] puts str % ["GROUP", user['GNAME']] + groups = user.retrieve_elements("GROUPS/ID") + puts str % ["SECONDARY GROUPS", groups.join(',') ] if groups.size > 1 puts str % ["PASSWORD", user['PASSWORD']] puts str % ["AUTH_DRIVER", user['AUTH_DRIVER']] From d5cc5ea07a1d5e73af28b7ef8f10352279813540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 26 Aug 2013 18:17:55 +0200 Subject: [PATCH 09/13] Feature #1742: secondary groups actions in Java OCA --- .../src/org/opennebula/client/user/User.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/oca/java/src/org/opennebula/client/user/User.java b/src/oca/java/src/org/opennebula/client/user/User.java index 29c9fa0ca3..e4e4a34883 100644 --- a/src/oca/java/src/org/opennebula/client/user/User.java +++ b/src/oca/java/src/org/opennebula/client/user/User.java @@ -36,6 +36,8 @@ public class User extends PoolElement{ private static final String CHAUTH = METHOD_PREFIX + "chauth"; private static final String UPDATE = METHOD_PREFIX + "update"; private static final String QUOTA = METHOD_PREFIX + "quota"; + private static final String ADDGROUP = METHOD_PREFIX + "addgroup"; + private static final String DELGROUP = METHOD_PREFIX + "delgroup"; /** * Creates a new User representation. @@ -146,6 +148,33 @@ public class User extends PoolElement{ return client.call(CHGRP, id, gid); } + /** + * Adds the User to a secondary group + * + * @param client XML-RPC Client. + * @param id The user id (uid) of the target user we want to modify. + * @param gid The new group ID. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse addgroup(Client client, int id, int gid) + { + return client.call(ADDGROUP, id, gid); + } + + /** + * Removes the User from a secondary group. Fails if the + * group is the main one + * + * @param client XML-RPC Client. + * @param id The user id (uid) of the target user we want to modify. + * @param gid The group ID. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse delgroup(Client client, int id, int gid) + { + return client.call(DELGROUP, id, gid); + } + /** * Changes the auth driver and the password of the given user * @@ -242,6 +271,29 @@ public class User extends PoolElement{ return chgrp(client, id, gid); } + /** + * Adds the User to a secondary group + * + * @param gid The new group ID. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse addgroup(int gid) + { + return addgroup(client, id, gid); + } + + /** + * Removes the User from a secondary group. Fails if the + * group is the main one + * + * @param gid The group ID. + * @return If an error occurs the error message contains the reason. + */ + public OneResponse delgroup(int gid) + { + return delgroup(client, id, gid); + } + /** * Changes the auth driver and the password of the given user * From 70d7b833f5b5b56566baf24934e70607dadcdc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 26 Aug 2013 19:14:45 +0200 Subject: [PATCH 10/13] Feature #1742: Add secondary groups to fsck --- src/onedb/fsck.rb | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 4c7f39b267..bf5f2e71a3 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -177,9 +177,10 @@ module OneDBFsck gid = doc.root.get_text('GID').to_s.to_i user_gid = gid + user_gids = Set.new if group[gid].nil? - log_error("User #{row[:oid]} is in group #{gid}, but it does not exist") + log_error("User #{row[:oid]} has primary group #{gid}, but it does not exist") user_gid = 1 @@ -191,9 +192,44 @@ module OneDBFsck e.text = "users" end + doc.root.each_element("GROUPS") { |e| + e.elements.delete("ID[.=#{gid}]") + e.add_element("ID").text = user_gid.to_s + } + users_fix[row[:oid]] = {:body => doc.to_s, :gid => user_gid} end + doc.root.each_element("GROUPS/ID") { |e| + user_gids.add e.text.to_i + } + + if !user_gids.include?(user_gid) + log_error("User #{row[:oid]} does not have his primary group #{user_gid} in the list of secondary groups") + + doc.root.each_element("GROUPS") { |e| + e.add_element("ID").text = user_gid.to_s + } + + user_gids.add user_gid.to_i + + users_fix[row[:oid]] = {:body => doc.to_s, :gid => user_gid} + end + + user_gids.each do |secondary_gid| + if group[secondary_gid].nil? + log_error("User #{row[:oid]} has secondary group #{secondary_gid}, but it does not exist") + + doc.root.each_element("GROUPS") { |e| + e.elements.delete("ID[.=#{secondary_gid}]") + } + + users_fix[row[:oid]] = {:body => doc.to_s, :gid => user_gid} + else + group[secondary_gid] << row[:oid] + end + end + if gid != row[:gid] log_error( "User #{row[:oid]} is in group #{gid}, but the DB "<< @@ -201,8 +237,6 @@ module OneDBFsck users_fix[row[:oid]] = {:body => doc.to_s, :gid => user_gid} end - - group[user_gid] << row[:oid] end users_fix.each do |id, user| From 074c17a0023df0422a2ae323b58ffe2cafbab1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 27 Aug 2013 18:27:09 +0200 Subject: [PATCH 11/13] Feature #1742: Update user pool xsd --- share/doc/xsd/user_pool.xsd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/doc/xsd/user_pool.xsd b/share/doc/xsd/user_pool.xsd index dc1b1289a0..c7d72c0594 100644 --- a/share/doc/xsd/user_pool.xsd +++ b/share/doc/xsd/user_pool.xsd @@ -10,6 +10,13 @@ + + + + + + + From 983804df18e103d637f365e8125125cf76f216ea Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 30 Aug 2013 16:50:04 +0200 Subject: [PATCH 12/13] feature #1742: Redo parsers, clear set of group ids in case of failed authN --- include/RequestManagerUser.h | 10 +- src/um/UserPool.cc | 6 + src/vm/vm_file_var_syntax.cc | 1032 +++++++++++++++------------------- src/vm/vm_file_var_syntax.h | 84 +-- src/vm/vm_file_var_syntax.y | 4 + src/xml/expr_arith.cc | 851 +++++++++++----------------- src/xml/expr_arith.h | 53 +- src/xml/expr_bool.cc | 906 ++++++++++++----------------- src/xml/expr_bool.h | 53 +- 9 files changed, 1235 insertions(+), 1764 deletions(-) diff --git a/include/RequestManagerUser.h b/include/RequestManagerUser.h index 1e04c610d5..b4ff2648ab 100644 --- a/include/RequestManagerUser.h +++ b/include/RequestManagerUser.h @@ -73,7 +73,7 @@ public: ~UserChangePassword(){}; int user_action(int user_id, - xmlrpc_c::paramList const& _paramList, + xmlrpc_c::paramList const& _paramList, string& err); void log_xmlrpc_param( @@ -125,7 +125,7 @@ public: ~UserSetQuota(){}; int user_action(int user_id, - xmlrpc_c::paramList const& _paramList, + xmlrpc_c::paramList const& _paramList, string& err); }; @@ -142,7 +142,7 @@ public: Request(method_name,params,help) { auth_object = PoolObjectSQL::USER; - auth_op = AuthRequest::MANAGE; + auth_op = AuthRequest::MANAGE; Nebula& nd = Nebula::instance(); gpool = nd.get_gpool(); @@ -155,14 +155,16 @@ public: xmlrpc_c::paramList const& _paramList, RequestAttributes& att); +protected: + virtual int secondary_group_action( int user_id, int group_id, xmlrpc_c::paramList const& _paramList, string& error_str) = 0; -protected: GroupPool * gpool; + UserPool * upool; }; diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index 457be81795..2e55b6921c 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -451,6 +451,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; @@ -580,6 +582,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; @@ -694,6 +698,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; diff --git a/src/vm/vm_file_var_syntax.cc b/src/vm/vm_file_var_syntax.cc index d68d775b43..dd93d5957c 100644 --- a/src/vm/vm_file_var_syntax.cc +++ b/src/vm/vm_file_var_syntax.cc @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,23 +58,17 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ #define yyparse vm_file_var__parse #define yylex vm_file_var__lex #define yyerror vm_file_var__error -#define yylval vm_file_var__lval -#define yychar vm_file_var__char #define yydebug vm_file_var__debug #define yynerrs vm_file_var__nerrs -#define yylloc vm_file_var__lloc + /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 17 "vm_file_var_syntax.y" +#line 17 "vm_file_var_syntax.y" /* yacc.c:339 */ #include #include @@ -232,6 +226,10 @@ int get_image_path(VirtualMachine * vm, gids = user->get_groups(); user->unlock(); } + else + { + gids.insert(vm->get_gid()); + } AuthRequest ar(vm->get_uid(), gids); @@ -252,14 +250,15 @@ int get_image_path(VirtualMachine * vm, /* -------------------------------------------------------------------------- */ +#line 254 "vm_file_var_syntax.cc" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 258 "vm_file_var_syntax.cc" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -269,72 +268,75 @@ int get_image_path(VirtualMachine * vm, # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "vm_file_var_syntax.hh". */ +#ifndef YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED +# define YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int vm_file_var__debug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EQUAL = 258, - COMMA = 259, - OBRACKET = 260, - CBRACKET = 261, - EOA = 262, - STRING = 263, - VARIABLE = 264, - RSTRING = 265, - INTEGER = 266 - }; + enum yytokentype + { + EQUAL = 258, + COMMA = 259, + OBRACKET = 260, + CBRACKET = 261, + EOA = 262, + STRING = 263, + VARIABLE = 264, + RSTRING = 265, + INTEGER = 266 + }; #endif - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 293 of yacc.c */ -#line 202 "vm_file_var_syntax.y" +#line 206 "vm_file_var_syntax.y" /* yacc.c:355 */ char * val_str; int val_int; char val_char; - - -/* Line 293 of yacc.c */ -#line 313 "vm_file_var_syntax.cc" -} YYSTYPE; +#line 312 "vm_file_var_syntax.cc" /* yacc.c:355 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif + +int vm_file_var__parse (mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg); + +#endif /* !YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED */ + /* Copy the second part of user declarations. */ - -/* Line 343 of yacc.c */ -#line 338 "vm_file_var_syntax.cc" +#line 340 "vm_file_var_syntax.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -348,11 +350,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -372,8 +371,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -387,38 +385,48 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -437,9 +445,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -449,8 +457,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -466,7 +474,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -474,15 +482,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -492,8 +498,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ - && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -519,35 +525,35 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -563,17 +569,19 @@ union yyalloc #define YYNNTS 3 /* YYNRULES -- Number of rules. */ #define YYNRULES 5 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 18 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 266 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -606,42 +614,27 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 8, 16 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 13, 0, -1, 14, -1, 13, 14, -1, 9, 5, - 9, 3, 8, 6, 7, -1, 9, 5, 9, 3, - 8, 4, 9, 3, 8, 6, 7, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 226, 226, 227, 231, 249 + 0, 230, 230, 231, 235, 253 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "EQUAL", "COMMA", "OBRACKET", "CBRACKET", "EOA", "STRING", "VARIABLE", "RSTRING", "INTEGER", "$accept", - "vm_string", "vm_variable", 0 + "vm_string", "vm_variable", YY_NULL }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -649,175 +642,141 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 12, 13, 13, 14, 14 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 2, 7, 11 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 0, 0, 2, 0, 1, 3, 0, 0, 0, - 0, 0, 0, 4, 0, 0, 0, 5 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 2, 3 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ #define YYPACT_NINF -8 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-8))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { -7, -1, 0, -8, -4, -8, -8, 3, 2, -3, -2, 1, 8, -8, 4, 7, 9, -8 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 2, 0, 1, 3, 0, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 5 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -8, -8, 12 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 3 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 5, 10, 1, 11, 4, 7, 8, 12, 13, 1, 9, 14, 15, 16, 6, 0, 17 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-8)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 0, 4, 9, 6, 5, 9, 3, 9, 7, 9, 8, 3, 8, 6, 2, -1, 7 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 9, 13, 14, 5, 0, 14, 9, 3, 8, 4, 6, 9, 7, 3, 8, 6, 7 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 12, 13, 13, 14, 14 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 2, 7, 11 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (&yylloc, mc, vm, img_ids, errmsg, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, &yylloc, mc) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -827,64 +786,90 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, Location, mc, vm, img_ids, errmsg); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +__attribute__((__unused__)) +static unsigned +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + unsigned res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, mc, vm, img_ids, errmsg); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - VirtualMachine * vm; - vector * img_ids; - char ** errmsg; -#endif { - if (!yyvaluep) - return; + FILE *yyo = yyoutput; + YYUSE (yyo); YYUSE (yylocationp); YYUSE (mc); YYUSE (vm); YYUSE (img_ids); YYUSE (errmsg); + if (!yyvaluep) + return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -892,27 +877,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - VirtualMachine * vm; - vector * img_ids; - char ** errmsg; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); @@ -925,16 +894,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errms | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -945,54 +906,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) -#else -static void -yy_reduce_print (yyvsp, yylsp, yyrule, mc, vm, img_ids, errmsg) - YYSTYPE *yyvsp; - YYLTYPE *yylsp; - int yyrule; - mem_collector * mc; - VirtualMachine * vm; - vector * img_ids; - char ** errmsg; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, vm, img_ids, errmsg); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, vm, img_ids, errmsg); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, yylsp, Rule, mc, vm, img_ids, errmsg); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, mc, vm, img_ids, errmsg); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1006,7 +955,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1029,15 +978,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1053,16 +995,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1092,27 +1026,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1135,12 +1069,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1148,10 +1081,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1200,11 +1129,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1224,10 +1155,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1264,23 +1197,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - YYLTYPE *yylocationp; - mem_collector * mc; - VirtualMachine * vm; - vector * img_ids; - char ** errmsg; -#endif { YYUSE (yyvaluep); YYUSE (yylocationp); @@ -1288,73 +1206,42 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) YYUSE (vm); YYUSE (img_ids); YYUSE (errmsg); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (mem_collector * mc, VirtualMachine * vm, vector * img_ids, char ** errmsg) -#else -int -yyparse (mc, vm, img_ids, errmsg) - mem_collector * mc; - VirtualMachine * vm; - vector * img_ids; - char ** errmsg; -#endif -#endif { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Location data for the lookahead symbol. */ -YYLTYPE yylloc; +static YYLTYPE yyloc_default +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +YYLTYPE yylloc = yyloc_default; /* Number of syntax errors so far. */ int yynerrs; @@ -1364,11 +1251,11 @@ YYLTYPE yylloc; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - `yyls': related to locations. + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1394,7 +1281,7 @@ YYLTYPE yylloc; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1413,10 +1300,9 @@ YYLTYPE yylloc; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yyls = yylsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1425,21 +1311,7 @@ YYLTYPE yylloc; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - yylsp = yyls; - -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - /* Initialize the default location before parsing starts. */ - yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 1; -#endif - + yylsp[0] = yylloc; goto yysetstate; /*------------------------------------------------------------. @@ -1460,26 +1332,26 @@ YYLTYPE yylloc; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - YYLTYPE *yyls1 = yyls; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); - yyls = yyls1; - yyss = yyss1; - yyvs = yyvs1; + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1487,23 +1359,23 @@ YYLTYPE yylloc; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1513,10 +1385,10 @@ YYLTYPE yylloc; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1545,7 +1417,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, mc); } if (yychar <= YYEOF) @@ -1585,7 +1457,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; goto yynewstate; @@ -1608,7 +1482,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1623,13 +1497,11 @@ yyreduce: switch (yyn) { case 4: - -/* Line 1806 of yacc.c */ -#line 232 "vm_file_var_syntax.y" +#line 236 "vm_file_var_syntax.y" /* yacc.c:1646 */ { - string file((yyvsp[(1) - (7)].val_str)); - string var1((yyvsp[(3) - (7)].val_str)); - string val1((yyvsp[(5) - (7)].val_str)); + string file((yyvsp[-6].val_str)); + string var1((yyvsp[-4].val_str)); + string val1((yyvsp[-2].val_str)); string result; @@ -1643,18 +1515,17 @@ yyreduce: YYABORT; } } +#line 1519 "vm_file_var_syntax.cc" /* yacc.c:1646 */ break; case 5: - -/* Line 1806 of yacc.c */ -#line 250 "vm_file_var_syntax.y" +#line 254 "vm_file_var_syntax.y" /* yacc.c:1646 */ { - string file((yyvsp[(1) - (11)].val_str)); - string var1((yyvsp[(3) - (11)].val_str)); - string val1((yyvsp[(5) - (11)].val_str)); - string var2((yyvsp[(7) - (11)].val_str)); - string val2((yyvsp[(9) - (11)].val_str)); + string file((yyvsp[-10].val_str)); + string var1((yyvsp[-8].val_str)); + string val1((yyvsp[-6].val_str)); + string var2((yyvsp[-4].val_str)); + string val2((yyvsp[-2].val_str)); string result; @@ -1669,12 +1540,11 @@ yyreduce: YYABORT; } } +#line 1544 "vm_file_var_syntax.cc" /* yacc.c:1646 */ break; - -/* Line 1806 of yacc.c */ -#line 1678 "vm_file_var_syntax.cc" +#line 1548 "vm_file_var_syntax.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1697,7 +1567,7 @@ yyreduce: *++yyvsp = yyval; *++yylsp = yyloc; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1712,9 +1582,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1765,20 +1635,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, mc, vm, img_ids, errmsg); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, mc, vm, img_ids, errmsg); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -1798,7 +1668,7 @@ yyerrorlab: goto yyerrorlab; yyerror_range[1] = yylsp[1-yylen]; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1811,35 +1681,37 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, mc, vm, img_ids, errmsg); + yystos[yystate], yyvsp, yylsp, mc, vm, img_ids, errmsg); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of @@ -1868,7 +1740,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1887,14 +1759,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, mc, vm, img_ids, errmsg); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp, mc, vm, img_ids, errmsg); + yystos[*yyssp], yyvsp, yylsp, mc, vm, img_ids, errmsg); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1905,14 +1777,9 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 271 "vm_file_var_syntax.y" +#line 275 "vm_file_var_syntax.y" /* yacc.c:1906 */ extern "C" void vm_file_var__error( @@ -1940,4 +1807,3 @@ extern "C" void vm_file_var__error( llocp->last_column); } } - diff --git a/src/vm/vm_file_var_syntax.h b/src/vm/vm_file_var_syntax.h index ec594f7c05..b99d9b6e5a 100644 --- a/src/vm/vm_file_var_syntax.h +++ b/src/vm/vm_file_var_syntax.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,66 +26,66 @@ 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 - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EQUAL = 258, - COMMA = 259, - OBRACKET = 260, - CBRACKET = 261, - EOA = 262, - STRING = 263, - VARIABLE = 264, - RSTRING = 265, - INTEGER = 266 - }; +#ifndef YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED +# define YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int vm_file_var__debug; #endif +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + EQUAL = 258, + COMMA = 259, + OBRACKET = 260, + CBRACKET = 261, + EOA = 262, + STRING = 263, + VARIABLE = 264, + RSTRING = 265, + INTEGER = 266 + }; +#endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 2068 of yacc.c */ -#line 202 "vm_file_var_syntax.y" +#line 206 "vm_file_var_syntax.y" /* yacc.c:1909 */ char * val_str; int val_int; char val_char; - - -/* Line 2068 of yacc.c */ -#line 69 "vm_file_var_syntax.hh" -} YYSTYPE; +#line 72 "vm_file_var_syntax.hh" /* yacc.c:1909 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif - - +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif - - +#endif /* !YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED */ diff --git a/src/vm/vm_file_var_syntax.y b/src/vm/vm_file_var_syntax.y index acdc81c73c..59714d590b 100644 --- a/src/vm/vm_file_var_syntax.y +++ b/src/vm/vm_file_var_syntax.y @@ -171,6 +171,10 @@ int get_image_path(VirtualMachine * vm, gids = user->get_groups(); user->unlock(); } + else + { + gids.insert(vm->get_gid()); + } AuthRequest ar(vm->get_uid(), gids); diff --git a/src/xml/expr_arith.cc b/src/xml/expr_arith.cc index 6870d4c135..39930cbf82 100644 --- a/src/xml/expr_arith.cc +++ b/src/xml/expr_arith.cc @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7.12-4996" +#define YYBISON_VERSION "3.0" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -63,15 +63,12 @@ #define yyparse expr_arith__parse #define yylex expr_arith__lex #define yyerror expr_arith__error -#define yylval expr_arith__lval -#define yychar expr_arith__char #define yydebug expr_arith__debug #define yynerrs expr_arith__nerrs -#define yylloc expr_arith__lloc + /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 17 "expr_arith.y" +#line 17 "expr_arith.y" /* yacc.c:339 */ #include #include @@ -125,8 +122,7 @@ extern "C" } -/* Line 371 of yacc.c */ -#line 130 "expr_arith.cc" +#line 126 "expr_arith.cc" /* yacc.c:339 */ # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -148,7 +144,7 @@ extern "C" by #include "expr_arith.hh". */ #ifndef YY_EXPR_ARITH_EXPR_ARITH_HH_INCLUDED # define YY_EXPR_ARITH_EXPR_ARITH_HH_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -156,72 +152,57 @@ extern "C" extern int expr_arith__debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; + enum yytokentype + { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { -/* Line 387 of yacc.c */ -#line 78 "expr_arith.y" +#line 78 "expr_arith.y" /* yacc.c:355 */ char * val_str; int val_int; float val_float; - -/* Line 387 of yacc.c */ -#line 185 "expr_arith.cc" -} YYSTYPE; +#line 178 "expr_arith.cc" /* yacc.c:355 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int expr_arith__parse (void *YYPARSE_PARAM); -#else -int expr_arith__parse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus + int expr_arith__parse (mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg); -#else -int expr_arith__parse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_EXPR_ARITH_EXPR_ARITH_HH_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 225 "expr_arith.cc" +#line 206 "expr_arith.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -235,11 +216,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -259,8 +237,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -297,24 +274,25 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif #if ! defined yyoverflow || YYERROR_VERBOSE @@ -333,8 +311,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -346,8 +323,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -363,7 +340,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -371,15 +348,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -389,8 +364,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ - && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -416,16 +391,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -444,7 +419,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -460,17 +435,19 @@ union yyalloc #define YYNNTS 3 /* YYNRULES -- Number of rules. */ #define YYNRULES 12 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 20 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 260 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -503,24 +480,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 6, 8, 10, 12, 16, 20, - 24, 28, 31 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 13, 0, -1, 14, -1, -1, 8, -1, 9, -1, - 7, -1, 14, 3, 14, -1, 14, 4, 14, -1, - 14, 5, 14, -1, 14, 6, 14, -1, 4, 14, - -1, 10, 14, 11, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 100, 100, 101, 104, 132, 133, 134, 135, 136, @@ -539,8 +499,8 @@ static const char *const yytname[] = #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 43, 45, 42, 47, 258, 259, 260, @@ -548,54 +508,48 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 12, 13, 13, 14, 14, 14, 14, 14, 14, - 14, 14, 14 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 0, 1, 1, 1, 3, 3, 3, - 3, 2, 3 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 3, 0, 6, 4, 5, 0, 0, 2, 11, 0, - 1, 0, 0, 0, 0, 12, 7, 8, 9, 10 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 6, 7 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ #define YYPACT_NINF -5 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-5))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { 11, 11, -5, -5, -5, 11, 5, 19, -4, 3, -5, 11, 11, 11, 11, -5, -4, -4, -5, -5 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 3, 0, 6, 4, 5, 0, 0, 2, 11, 0, + 1, 0, 0, 0, 0, 12, 7, 8, 9, 10 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -5, -5, -1 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 6, 7 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 8, 13, 14, 0, 9, 10, 11, 12, 13, 14, @@ -603,12 +557,6 @@ static const yytype_uint8 yytable[] = 4, 5, 11, 12, 13, 14 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-5))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 1, 5, 6, -1, 5, 0, 3, 4, 5, 6, @@ -616,38 +564,38 @@ static const yytype_int8 yycheck[] = 9, 10, 3, 4, 5, 6 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 4, 7, 8, 9, 10, 13, 14, 14, 14, 0, 3, 4, 5, 6, 11, 14, 14, 14, 14 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 12, 13, 13, 14, 14, 14, 14, 14, 14, + 14, 14, 14 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 1, 1, 1, 3, 3, 3, + 3, 2, 3 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -664,13 +612,13 @@ do \ else \ { \ yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -680,7 +628,7 @@ while (YYID (0)) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (YYID (N)) \ + if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -694,12 +642,27 @@ while (YYID (0)) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (YYID (0)) + while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ @@ -710,35 +673,27 @@ while (YYID (0)) /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ __attribute__((__unused__)) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static unsigned yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -#else -static unsigned -yy_location_print_ (yyo, yylocp) - FILE *yyo; - YYLTYPE const * const yylocp; -#endif { unsigned res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { - res += fprintf (yyo, "%d", yylocp->first_line); + res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { - res += fprintf (yyo, "-%d", yylocp->last_line); + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); + res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); + res += YYFPRINTF (yyo, "-%d", end_col); } return res; } @@ -752,75 +707,37 @@ yy_location_print_ (yyo, yylocp) #endif -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, &yylloc, mc) -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, Location, mc, oxml, result, error_msg); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, mc, oxml, result, error_msg); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - ObjectXML * oxml; - int& result; - char ** error_msg; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); - if (!yyvaluep) - return; YYUSE (yylocationp); YYUSE (mc); YYUSE (oxml); YYUSE (result); YYUSE (error_msg); + if (!yyvaluep) + return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif YYUSE (yytype); } @@ -830,27 +747,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - ObjectXML * oxml; - int& result; - char ** error_msg; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); @@ -863,16 +764,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, erro | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -883,54 +776,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) -#else -static void -yy_reduce_print (yyvsp, yylsp, yyrule, mc, oxml, result, error_msg) - YYSTYPE *yyvsp; - YYLTYPE *yylsp; - int yyrule; - mem_collector * mc; - ObjectXML * oxml; - int& result; - char ** error_msg; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, oxml, result, error_msg); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, oxml, result, error_msg); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, yylsp, Rule, mc, oxml, result, error_msg); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, mc, oxml, result, error_msg); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -944,7 +825,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -967,15 +848,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -991,16 +865,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1030,27 +896,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1085,10 +951,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1205,23 +1067,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - YYLTYPE *yylocationp; - mem_collector * mc; - ObjectXML * oxml; - int& result; - char ** error_msg; -#endif { YYUSE (yyvaluep); YYUSE (yylocationp); @@ -1229,12 +1076,13 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) YYUSE (oxml); YYUSE (result); YYUSE (error_msg); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1244,69 +1092,27 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (mem_collector * mc, ObjectXML * oxml, int& result, char ** error_msg) -#else -int -yyparse (mc, oxml, result, error_msg) - mem_collector * mc; - ObjectXML * oxml; - int& result; - char ** error_msg; -#endif -#endif { /* The lookahead symbol. */ int yychar; -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else +/* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ static YYLTYPE yyloc_default # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - -/* Location data for the lookahead symbol. */ YYLTYPE yylloc = yyloc_default; - /* Number of syntax errors so far. */ int yynerrs; @@ -1315,9 +1121,9 @@ YYLTYPE yylloc = yyloc_default; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - `yyls': related to locations. + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -1396,26 +1202,26 @@ YYLTYPE yylloc = yyloc_default; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - YYLTYPE *yyls1 = yyls; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); - yyls = yyls1; - yyss = yyss1; - yyvs = yyvs1; + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1423,23 +1229,23 @@ YYLTYPE yylloc = yyloc_default; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1449,10 +1255,10 @@ YYLTYPE yylloc = yyloc_default; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1481,7 +1287,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, mc); } if (yychar <= YYEOF) @@ -1546,7 +1352,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1561,36 +1367,35 @@ yyreduce: switch (yyn) { case 2: -/* Line 1787 of yacc.c */ -#line 100 "expr_arith.y" - { result = static_cast((yyvsp[(1) - (1)].val_float));} +#line 100 "expr_arith.y" /* yacc.c:1646 */ + { result = static_cast((yyvsp[0].val_float));} +#line 1373 "expr_arith.cc" /* yacc.c:1646 */ break; case 3: -/* Line 1787 of yacc.c */ -#line 101 "expr_arith.y" +#line 101 "expr_arith.y" /* yacc.c:1646 */ { result = 0; } +#line 1379 "expr_arith.cc" /* yacc.c:1646 */ break; case 4: -/* Line 1787 of yacc.c */ -#line 104 "expr_arith.y" +#line 104 "expr_arith.y" /* yacc.c:1646 */ { float val = 0.0; vector results; - if ((yyvsp[(1) - (1)].val_str)[0] == '/') + if ((yyvsp[0].val_str)[0] == '/') { - results = (*oxml)[(yyvsp[(1) - (1)].val_str)]; + results = (*oxml)[(yyvsp[0].val_str)]; } else { ostringstream xpath_t; - xpath_t << "/HOST/TEMPLATE/" << (yyvsp[(1) - (1)].val_str) - << "|/HOST/HOST_SHARE/" << (yyvsp[(1) - (1)].val_str) - << "|/HOST/" << (yyvsp[(1) - (1)].val_str) - << "|/HOST/CLUSTER_TEMPLATE/" << (yyvsp[(1) - (1)].val_str); + xpath_t << "/HOST/TEMPLATE/" << (yyvsp[0].val_str) + << "|/HOST/HOST_SHARE/" << (yyvsp[0].val_str) + << "|/HOST/" << (yyvsp[0].val_str) + << "|/HOST/CLUSTER_TEMPLATE/" << (yyvsp[0].val_str); results = (*oxml)[xpath_t.str().c_str()]; } @@ -1603,59 +1408,59 @@ yyreduce: (yyval.val_float) = val; } +#line 1412 "expr_arith.cc" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 132 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (1)].val_float); } +#line 132 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[0].val_float); } +#line 1418 "expr_arith.cc" /* yacc.c:1646 */ break; case 6: -/* Line 1787 of yacc.c */ -#line 133 "expr_arith.y" - { (yyval.val_float) = static_cast((yyvsp[(1) - (1)].val_int)); } +#line 133 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = static_cast((yyvsp[0].val_int)); } +#line 1424 "expr_arith.cc" /* yacc.c:1646 */ break; case 7: -/* Line 1787 of yacc.c */ -#line 134 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);} +#line 134 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) + (yyvsp[0].val_float);} +#line 1430 "expr_arith.cc" /* yacc.c:1646 */ break; case 8: -/* Line 1787 of yacc.c */ -#line 135 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);} +#line 135 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) - (yyvsp[0].val_float);} +#line 1436 "expr_arith.cc" /* yacc.c:1646 */ break; case 9: -/* Line 1787 of yacc.c */ -#line 136 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);} +#line 136 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) * (yyvsp[0].val_float);} +#line 1442 "expr_arith.cc" /* yacc.c:1646 */ break; case 10: -/* Line 1787 of yacc.c */ -#line 137 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);} +#line 137 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) / (yyvsp[0].val_float);} +#line 1448 "expr_arith.cc" /* yacc.c:1646 */ break; case 11: -/* Line 1787 of yacc.c */ -#line 138 "expr_arith.y" - { (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);} +#line 138 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = - (yyvsp[0].val_float);} +#line 1454 "expr_arith.cc" /* yacc.c:1646 */ break; case 12: -/* Line 1787 of yacc.c */ -#line 139 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(2) - (3)].val_float);} +#line 139 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-1].val_float);} +#line 1460 "expr_arith.cc" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1659 "expr_arith.cc" +#line 1464 "expr_arith.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1678,7 +1483,7 @@ yyreduce: *++yyvsp = yyval; *++yylsp = yyloc; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1693,9 +1498,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1746,20 +1551,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -1779,7 +1584,7 @@ yyerrorlab: goto yyerrorlab; yyerror_range[1] = yylsp[1-yylen]; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1792,29 +1597,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, mc, oxml, result, error_msg); + yystos[yystate], yyvsp, yylsp, mc, oxml, result, error_msg); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1870,14 +1675,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp, mc, oxml, result, error_msg); + yystos[*yyssp], yyvsp, yylsp, mc, oxml, result, error_msg); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1888,13 +1693,9 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -/* Line 2050 of yacc.c */ -#line 142 "expr_arith.y" +#line 142 "expr_arith.y" /* yacc.c:1906 */ extern "C" void expr_arith__error( diff --git a/src/xml/expr_arith.h b/src/xml/expr_arith.h index 1465fae072..1ad1746ad1 100644 --- a/src/xml/expr_arith.h +++ b/src/xml/expr_arith.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,13 +26,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_EXPR_ARITH_EXPR_ARITH_HH_INCLUDED # define YY_EXPR_ARITH_EXPR_ARITH_HH_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -40,47 +40,44 @@ extern int expr_arith__debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; + enum yytokentype + { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { -/* Line 2053 of yacc.c */ -#line 78 "expr_arith.y" +#line 78 "expr_arith.y" /* yacc.c:1909 */ char * val_str; int val_int; float val_float; - -/* Line 2053 of yacc.c */ -#line 69 "expr_arith.hh" -} YYSTYPE; +#line 66 "expr_arith.hh" /* yacc.c:1909 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif diff --git a/src/xml/expr_bool.cc b/src/xml/expr_bool.cc index f4e943bad7..ec16dc641f 100644 --- a/src/xml/expr_bool.cc +++ b/src/xml/expr_bool.cc @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7.12-4996" +#define YYBISON_VERSION "3.0" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -63,15 +63,12 @@ #define yyparse expr_bool__parse #define yylex expr_bool__lex #define yyerror expr_bool__error -#define yylval expr_bool__lval -#define yychar expr_bool__char #define yydebug expr_bool__debug #define yynerrs expr_bool__nerrs -#define yylloc expr_bool__lloc + /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 17 "expr_bool.y" +#line 17 "expr_bool.y" /* yacc.c:339 */ #include #include @@ -135,8 +132,7 @@ void get_xml_values(ObjectXML * oxml, const char* attr, vector& results) void get_vm_ids(ObjectXML * oxml, set& vm_ids); -/* Line 371 of yacc.c */ -#line 140 "expr_bool.cc" +#line 136 "expr_bool.cc" /* yacc.c:339 */ # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -158,7 +154,7 @@ void get_vm_ids(ObjectXML * oxml, set& vm_ids); by #include "expr_bool.hh". */ #ifndef YY_EXPR_BOOL_EXPR_BOOL_HH_INCLUDED # define YY_EXPR_BOOL_EXPR_BOOL_HH_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -166,72 +162,57 @@ void get_vm_ids(ObjectXML * oxml, set& vm_ids); extern int expr_bool__debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; + enum yytokentype + { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { -/* Line 387 of yacc.c */ -#line 88 "expr_bool.y" +#line 88 "expr_bool.y" /* yacc.c:355 */ char * val_str; int val_int; float val_float; - -/* Line 387 of yacc.c */ -#line 195 "expr_bool.cc" -} YYSTYPE; +#line 188 "expr_bool.cc" /* yacc.c:355 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int expr_bool__parse (void *YYPARSE_PARAM); -#else -int expr_bool__parse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus + int expr_bool__parse (mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg); -#else -int expr_bool__parse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_EXPR_BOOL_EXPR_BOOL_HH_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 235 "expr_bool.cc" +#line 216 "expr_bool.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -245,11 +226,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -269,8 +247,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -307,24 +284,25 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif #if ! defined yyoverflow || YYERROR_VERBOSE @@ -343,8 +321,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -356,8 +333,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -373,7 +350,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -381,15 +358,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -399,8 +374,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ - && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -426,16 +401,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -454,7 +429,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -470,17 +445,19 @@ union yyalloc #define YYNNTS 3 /* YYNRULES -- Number of rules. */ #define YYNRULES 17 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 29 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 260 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -513,27 +490,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 6, 10, 15, 19, 23, 27, - 32, 36, 40, 44, 49, 53, 57, 60 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 15, 0, -1, 16, -1, -1, 7, 9, 6, -1, - 7, 3, 9, 6, -1, 7, 10, 6, -1, 7, - 11, 6, -1, 7, 9, 8, -1, 7, 3, 9, - 8, -1, 7, 10, 8, -1, 7, 11, 8, -1, - 7, 9, 7, -1, 7, 3, 9, 7, -1, 16, - 4, 16, -1, 16, 5, 16, -1, 3, 16, -1, - 12, 16, 13, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 108, 108, 109, 112, 128, 144, 149, 154, 159, @@ -552,8 +509,8 @@ static const char *const yytname[] = #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 33, 38, 124, 258, 259, 260, 61, @@ -561,39 +518,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 14, 15, 15, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 0, 3, 4, 3, 3, 3, 4, - 3, 3, 3, 4, 3, 3, 2, 3 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 3, 0, 0, 0, 0, 2, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 4, 12, 8, 6, - 10, 7, 11, 17, 14, 15, 5, 13, 9 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 4, 5 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ #define YYPACT_NINF -6 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-6))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { -2, -2, 8, -2, 3, 4, -6, -5, 14, 20, @@ -601,16 +537,31 @@ static const yytype_int8 yypact[] = -6, -6, -6, -6, -6, -6, -6, -6, -6 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 3, 0, 0, 0, 0, 2, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 4, 12, 8, 6, + 10, 7, 11, 17, 14, 15, 5, 13, 9 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -6, -6, -1 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 4, 5 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 6, 1, 11, 12, 15, 2, 13, 14, 13, 14, @@ -618,12 +569,6 @@ static const yytype_uint8 yytable[] = 16, 17, 18, 26, 27, 28, 19, 21, 20, 22 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-6))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 1, 3, 3, 0, 9, 7, 4, 5, 4, 5, @@ -631,8 +576,8 @@ static const yytype_int8 yycheck[] = 6, 7, 8, 6, 7, 8, 6, 6, 8, 8 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 7, 12, 15, 16, 16, 3, 9, 10, @@ -640,30 +585,30 @@ static const yytype_uint8 yystos[] = 8, 6, 8, 13, 16, 16, 6, 7, 8 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 14, 15, 15, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 3, 4, 3, 3, 3, 4, + 3, 3, 3, 4, 3, 3, 2, 3 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -680,13 +625,13 @@ do \ else \ { \ yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -696,7 +641,7 @@ while (YYID (0)) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (YYID (N)) \ + if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -710,12 +655,27 @@ while (YYID (0)) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (YYID (0)) + while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ @@ -726,35 +686,27 @@ while (YYID (0)) /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ __attribute__((__unused__)) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static unsigned yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -#else -static unsigned -yy_location_print_ (yyo, yylocp) - FILE *yyo; - YYLTYPE const * const yylocp; -#endif { unsigned res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { - res += fprintf (yyo, "%d", yylocp->first_line); + res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { - res += fprintf (yyo, "-%d", yylocp->last_line); + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); + res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); + res += YYFPRINTF (yyo, "-%d", end_col); } return res; } @@ -768,75 +720,37 @@ yy_location_print_ (yyo, yylocp) #endif -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, &yylloc, mc) -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, Location, mc, oxml, result, error_msg); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, mc, oxml, result, error_msg); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - ObjectXML * oxml; - bool& result; - char ** error_msg; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); - if (!yyvaluep) - return; YYUSE (yylocationp); YYUSE (mc); YYUSE (oxml); YYUSE (result); YYUSE (error_msg); + if (!yyvaluep) + return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif YYUSE (yytype); } @@ -846,27 +760,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - YYLTYPE const * const yylocationp; - mem_collector * mc; - ObjectXML * oxml; - bool& result; - char ** error_msg; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); @@ -879,16 +777,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, mc, oxml, result, erro | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -899,54 +789,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) -#else -static void -yy_reduce_print (yyvsp, yylsp, yyrule, mc, oxml, result, error_msg) - YYSTYPE *yyvsp; - YYLTYPE *yylsp; - int yyrule; - mem_collector * mc; - ObjectXML * oxml; - bool& result; - char ** error_msg; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, oxml, result, error_msg); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , mc, oxml, result, error_msg); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, yylsp, Rule, mc, oxml, result, error_msg); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, mc, oxml, result, error_msg); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -960,7 +838,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -983,15 +861,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1007,16 +878,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1046,27 +909,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1101,10 +964,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1221,23 +1080,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - YYLTYPE *yylocationp; - mem_collector * mc; - ObjectXML * oxml; - bool& result; - char ** error_msg; -#endif { YYUSE (yyvaluep); YYUSE (yylocationp); @@ -1245,12 +1089,13 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) YYUSE (oxml); YYUSE (result); YYUSE (error_msg); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1260,69 +1105,27 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg) | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (mem_collector * mc, ObjectXML * oxml, bool& result, char ** error_msg) -#else -int -yyparse (mc, oxml, result, error_msg) - mem_collector * mc; - ObjectXML * oxml; - bool& result; - char ** error_msg; -#endif -#endif { /* The lookahead symbol. */ int yychar; -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else +/* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ static YYLTYPE yyloc_default # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - -/* Location data for the lookahead symbol. */ YYLTYPE yylloc = yyloc_default; - /* Number of syntax errors so far. */ int yynerrs; @@ -1331,9 +1134,9 @@ YYLTYPE yylloc = yyloc_default; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - `yyls': related to locations. + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -1412,26 +1215,26 @@ YYLTYPE yylloc = yyloc_default; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - YYLTYPE *yyls1 = yyls; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); - yyls = yyls1; - yyss = yyss1; - yyvs = yyvs1; + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1439,23 +1242,23 @@ YYLTYPE yylloc = yyloc_default; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1465,10 +1268,10 @@ YYLTYPE yylloc = yyloc_default; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1497,7 +1300,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, mc); } if (yychar <= YYEOF) @@ -1562,7 +1365,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1577,156 +1380,155 @@ yyreduce: switch (yyn) { case 2: -/* Line 1787 of yacc.c */ -#line 108 "expr_bool.y" - { result=(yyvsp[(1) - (1)].val_int); } +#line 108 "expr_bool.y" /* yacc.c:1646 */ + { result=(yyvsp[0].val_int); } +#line 1386 "expr_bool.cc" /* yacc.c:1646 */ break; case 3: -/* Line 1787 of yacc.c */ -#line 109 "expr_bool.y" +#line 109 "expr_bool.y" /* yacc.c:1646 */ { result=true; } +#line 1392 "expr_bool.cc" /* yacc.c:1646 */ break; case 4: -/* Line 1787 of yacc.c */ -#line 112 "expr_bool.y" +#line 112 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - if ((yyvsp[(1) - (3)].val_str) == string("CURRENT_VMS")) + if ((yyvsp[-2].val_str) == string("CURRENT_VMS")) { set vm_ids; get_vm_ids(oxml, vm_ids); - (yyval.val_int) = vm_ids.count((yyvsp[(3) - (3)].val_int)) > 0; + (yyval.val_int) = vm_ids.count((yyvsp[0].val_int)) > 0; } else { - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_int)); + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val == (yyvsp[0].val_int)); } } +#line 1412 "expr_bool.cc" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 128 "expr_bool.y" +#line 128 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - if ((yyvsp[(1) - (4)].val_str) == string("CURRENT_VMS")) + if ((yyvsp[-3].val_str) == string("CURRENT_VMS")) { set vm_ids; get_vm_ids(oxml, vm_ids); - (yyval.val_int) = vm_ids.count((yyvsp[(4) - (4)].val_int)) == 0; + (yyval.val_int) = vm_ids.count((yyvsp[0].val_int)) == 0; } else { - rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val); - (yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_int)); + rc = get_xml_attribute(oxml,(yyvsp[-3].val_str),val); + (yyval.val_int) = (rc == 0 && val != (yyvsp[0].val_int)); } } +#line 1432 "expr_bool.cc" /* yacc.c:1646 */ break; case 6: -/* Line 1787 of yacc.c */ -#line 144 "expr_bool.y" +#line 144 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_int));} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val > (yyvsp[0].val_int));} +#line 1441 "expr_bool.cc" /* yacc.c:1646 */ break; case 7: -/* Line 1787 of yacc.c */ -#line 149 "expr_bool.y" +#line 149 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_int));} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val < (yyvsp[0].val_int));} +#line 1450 "expr_bool.cc" /* yacc.c:1646 */ break; case 8: -/* Line 1787 of yacc.c */ -#line 154 "expr_bool.y" +#line 154 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_float));} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val == (yyvsp[0].val_float));} +#line 1459 "expr_bool.cc" /* yacc.c:1646 */ break; case 9: -/* Line 1787 of yacc.c */ -#line 159 "expr_bool.y" +#line 159 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val); - (yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_float));} + rc = get_xml_attribute(oxml,(yyvsp[-3].val_str),val); + (yyval.val_int) = (rc == 0 && val != (yyvsp[0].val_float));} +#line 1468 "expr_bool.cc" /* yacc.c:1646 */ break; case 10: -/* Line 1787 of yacc.c */ -#line 164 "expr_bool.y" +#line 164 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_float));} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val > (yyvsp[0].val_float));} +#line 1477 "expr_bool.cc" /* yacc.c:1646 */ break; case 11: -/* Line 1787 of yacc.c */ -#line 169 "expr_bool.y" +#line 169 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_float));} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val < (yyvsp[0].val_float));} +#line 1486 "expr_bool.cc" /* yacc.c:1646 */ break; case 12: -/* Line 1787 of yacc.c */ -#line 174 "expr_bool.y" +#line 174 "expr_bool.y" /* yacc.c:1646 */ { string val; int rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc != 0 || (yyvsp[(3) - (3)].val_str)==0) ? false : fnmatch((yyvsp[(3) - (3)].val_str),val.c_str(),0)==0;} + rc = get_xml_attribute(oxml,(yyvsp[-2].val_str),val); + (yyval.val_int) = (rc != 0 || (yyvsp[0].val_str)==0) ? false : fnmatch((yyvsp[0].val_str),val.c_str(),0)==0;} +#line 1495 "expr_bool.cc" /* yacc.c:1646 */ break; case 13: -/* Line 1787 of yacc.c */ -#line 179 "expr_bool.y" +#line 179 "expr_bool.y" /* yacc.c:1646 */ { string val; int rc; - rc = get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val); - (yyval.val_int) = (rc != 0 || (yyvsp[(4) - (4)].val_str)==0) ? false : fnmatch((yyvsp[(4) - (4)].val_str),val.c_str(),0)!=0;} + rc = get_xml_attribute(oxml,(yyvsp[-3].val_str),val); + (yyval.val_int) = (rc != 0 || (yyvsp[0].val_str)==0) ? false : fnmatch((yyvsp[0].val_str),val.c_str(),0)!=0;} +#line 1504 "expr_bool.cc" /* yacc.c:1646 */ break; case 14: -/* Line 1787 of yacc.c */ -#line 184 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); } +#line 184 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-2].val_int) && (yyvsp[0].val_int); } +#line 1510 "expr_bool.cc" /* yacc.c:1646 */ break; case 15: -/* Line 1787 of yacc.c */ -#line 185 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); } +#line 185 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-2].val_int) || (yyvsp[0].val_int); } +#line 1516 "expr_bool.cc" /* yacc.c:1646 */ break; case 16: -/* Line 1787 of yacc.c */ -#line 186 "expr_bool.y" - { (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); } +#line 186 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = ! (yyvsp[0].val_int); } +#line 1522 "expr_bool.cc" /* yacc.c:1646 */ break; case 17: -/* Line 1787 of yacc.c */ -#line 187 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(2) - (3)].val_int); } +#line 187 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-1].val_int); } +#line 1528 "expr_bool.cc" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1730 "expr_bool.cc" +#line 1532 "expr_bool.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1749,7 +1551,7 @@ yyreduce: *++yyvsp = yyval; *++yylsp = yyloc; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1764,9 +1566,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1817,20 +1619,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -1850,7 +1652,7 @@ yyerrorlab: goto yyerrorlab; yyerror_range[1] = yylsp[1-yylen]; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1863,29 +1665,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, mc, oxml, result, error_msg); + yystos[yystate], yyvsp, yylsp, mc, oxml, result, error_msg); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1941,14 +1743,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, mc, oxml, result, error_msg); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp, mc, oxml, result, error_msg); + yystos[*yyssp], yyvsp, yylsp, mc, oxml, result, error_msg); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1959,13 +1761,9 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -/* Line 2050 of yacc.c */ -#line 190 "expr_bool.y" +#line 190 "expr_bool.y" /* yacc.c:1906 */ extern "C" void expr_bool__error( @@ -2102,4 +1900,4 @@ void get_vm_ids(ObjectXML * oxml, set& vm_ids) vm_ids.insert(id); } } -} \ No newline at end of file +} diff --git a/src/xml/expr_bool.h b/src/xml/expr_bool.h index 9d23f479c4..a18e81d134 100644 --- a/src/xml/expr_bool.h +++ b/src/xml/expr_bool.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,13 +26,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_EXPR_BOOL_EXPR_BOOL_HH_INCLUDED # define YY_EXPR_BOOL_EXPR_BOOL_HH_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -40,47 +40,44 @@ extern int expr_bool__debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - STRING = 259, - FLOAT = 260 - }; + enum yytokentype + { + INTEGER = 258, + STRING = 259, + FLOAT = 260 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { -/* Line 2053 of yacc.c */ -#line 88 "expr_bool.y" +#line 88 "expr_bool.y" /* yacc.c:1909 */ char * val_str; int val_int; float val_float; - -/* Line 2053 of yacc.c */ -#line 69 "expr_bool.hh" -} YYSTYPE; +#line 66 "expr_bool.hh" /* yacc.c:1909 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +}; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif From dcf019f91b929e816b5eba3aa6e8fc93ae4d7605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 2 Sep 2013 15:44:34 +0200 Subject: [PATCH 13/13] Sunstone message missing from translations --- src/sunstone/public/js/plugins/files-tab.js | 2 +- src/sunstone/public/js/plugins/images-tab.js | 2 +- src/sunstone/public/js/plugins/templates-tab.js | 1 + src/sunstone/public/js/plugins/vms-tab.js | 2 +- src/sunstone/public/js/plugins/vnets-tab.js | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index 96d88e5456..f926825033 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -353,7 +353,7 @@ var file_actions = { type: "single", call: OpenNebula.Image.rename, callback: function(request) { - notifyMessage("File renamed correctly"); + notifyMessage(tr("File renamed correctly")); Sunstone.runAction('Image.showinfo',request.request.data[0]); Sunstone.runAction('Image.list'); }, diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 2a50f9fb51..006fee889a 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -522,7 +522,7 @@ var image_actions = { type: "single", call: OpenNebula.Image.rename, callback: function(request) { - notifyMessage("Image renamed correctly"); + notifyMessage(tr("Image renamed correctly")); Sunstone.runAction('Image.showinfo',request.request.data[0]); Sunstone.runAction('Image.list'); }, diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index fe01ebd4e4..da15d5219c 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -381,6 +381,7 @@ var template_actions = { type: "single", call: OpenNebula.Template.rename, callback: function(request) { + notifyMessage(tr("Template renamed correctly")); Sunstone.runAction('Template.showinfo',request.request.data[0]); Sunstone.runAction("Template.show",request.request.data[0]); }, diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index b7c113f977..4c031c1ab4 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -819,7 +819,7 @@ var vm_actions = { type: "single", call: OpenNebula.VM.rename, callback: function(request) { - notifyMessage("VirtualMachine renamed correctly"); + notifyMessage(tr("VirtualMachine renamed correctly")); Sunstone.runAction('VM.showinfo',request.request.data[0]); Sunstone.runAction("VM.list"); }, diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index 44696d188a..8439354b77 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -617,7 +617,7 @@ var vnet_actions = { type: "single", call: OpenNebula.Network.rename, callback: function(request) { - notifyMessage("VirtualNetwork renamed correctly"); + notifyMessage(tr("VirtualNetwork renamed correctly")); Sunstone.runAction('Network.showinfo',request.request.data[0]); Sunstone.runAction("Network.list"); },