diff --git a/include/AclManager.h b/include/AclManager.h index e4e0fe7b1c..5077b7843e 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); @@ -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/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/PoolObjectSQL.h b/include/PoolObjectSQL.h index 78030ad6e7..8e0fb83d65 100644 --- a/include/PoolObjectSQL.h +++ b/include/PoolObjectSQL.h @@ -337,7 +337,7 @@ public: } /** - * Gets an removes a string based attribute (single) + * Gets and removes a string based attribute (single) * @param name of the attribute * @param value of the attribute (a string), will be "" if not defined or * not a single attribute @@ -351,6 +351,21 @@ public: return obj_template->erase(name); } + /** + * Gets and removes a float based attribute (single) + * @param name of the attribute + * @param value of the attribute (a float), will be 0 if not defined or + * not a single attribute + * @return the number of attributes erased + */ + int erase_template_attribute( + const char * name, + float& value) + { + obj_template->get(name,value); + return obj_template->erase(name); + } + /** * Gets an int based attribute (single) * @param name of the attribute 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/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/RequestManagerUser.h b/include/RequestManagerUser.h index be6571ea47..b4ff2648ab 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, @@ -72,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( @@ -124,10 +125,89 @@ public: ~UserSetQuota(){}; int user_action(int user_id, - xmlrpc_c::paramList const& _paramList, + xmlrpc_c::paramList const& _paramList, string& err); }; +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ + +class UserEditGroup : public Request +{ +public: + 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(); + }; + + ~UserEditGroup(){}; + + void request_execute( + 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; + + GroupPool * gpool; + + UserPool * upool; +}; + +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ + +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(): + UserEditGroup("UserDelGroup", + "Deletes the user from a secondary group", + "A:sii"){}; + + ~UserDelGroup(){}; + + int secondary_group_action( + int user_id, + int group_id, + xmlrpc_c::paramList const& _paramList, + string& error_str); +}; + /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ 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/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/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 @@ + + + + + + + diff --git a/share/pkgs/CentOS/opennebula.sudoers b/share/pkgs/CentOS/opennebula.sudoers new file mode 100644 index 0000000000..4b5e6d7b4d --- /dev/null +++ b/share/pkgs/CentOS/opennebula.sudoers @@ -0,0 +1,12 @@ +Defaults !requiretty +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin + +Cmnd_Alias ONE_MISC = /bin/dd, /sbin/mkfs, /bin/sync +Cmnd_Alias ONE_NET = /usr/sbin/brctl, /sbin/ebtables, /sbin/iptables, /sbin/ip, /sbin/vconfig +Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvrename, /sbin/lvs, /sbin/vgdisplay +Cmnd_Alias ONE_ISCSI = /sbin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm +Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl +Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm + +oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN + diff --git a/share/pkgs/Debian/opennebula.sudoers b/share/pkgs/Debian/opennebula.sudoers new file mode 100644 index 0000000000..6646e8a177 --- /dev/null +++ b/share/pkgs/Debian/opennebula.sudoers @@ -0,0 +1,11 @@ +Defaults !requiretty +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin + +Cmnd_Alias ONE_MISC = /bin/dd, /sbin/mkfs, /bin/sync +Cmnd_Alias ONE_NET = /sbin/brctl, /sbin/ebtables, /sbin/iptables, /sbin/ip, /sbin/vconfig +Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvrename, /sbin/lvs, /sbin/vgdisplay +Cmnd_Alias ONE_ISCSI = /usr/bin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm +Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl +Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm + +oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN diff --git a/share/pkgs/Ubuntu/opennebula.sudoers b/share/pkgs/Ubuntu/opennebula.sudoers new file mode 100644 index 0000000000..6646e8a177 --- /dev/null +++ b/share/pkgs/Ubuntu/opennebula.sudoers @@ -0,0 +1,11 @@ +Defaults !requiretty +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin + +Cmnd_Alias ONE_MISC = /bin/dd, /sbin/mkfs, /bin/sync +Cmnd_Alias ONE_NET = /sbin/brctl, /sbin/ebtables, /sbin/iptables, /sbin/ip, /sbin/vconfig +Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvrename, /sbin/lvs, /sbin/vgdisplay +Cmnd_Alias ONE_ISCSI = /usr/bin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm +Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl +Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm + +oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN diff --git a/share/pkgs/openSUSE/opennebula.sudoers b/share/pkgs/openSUSE/opennebula.sudoers new file mode 100644 index 0000000000..61a4d20462 --- /dev/null +++ b/share/pkgs/openSUSE/opennebula.sudoers @@ -0,0 +1,11 @@ +Defaults !requiretty +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin + +Cmnd_Alias ONE_MISC = /usr/bin/dd, /sbin/mkfs, /usr/bin/sync +Cmnd_Alias ONE_NET = /sbin/brctl, /usr/sbin/ebtables, /usr/sbin/iptables, /sbin/ip, /sbin/vconfig +Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvrename, /sbin/lvs, /sbin/vgdisplay +Cmnd_Alias ONE_ISCSI = /sbin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm +Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl +Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm + +oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN diff --git a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network index 92ff47eab3..c10af1acb1 100755 --- a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network @@ -151,6 +151,7 @@ EOT GATEWAY=$(get_gateway) IPV6=$(get_iface_var "IPV6") + [[ -z $IPV6 ]] && IPV6=$(get_iface_var "IP6") GATEWAY6=$(get_iface_var "GATEWAY6") CONTEXT_FORCE_IPV4=$(get_iface_var "CONTEXT_FORCE_IPV4") diff --git a/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network b/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network index 6886d538f7..92f4e7e2ed 100755 --- a/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network @@ -142,6 +142,7 @@ gen_network_configuration() GATEWAY=$(get_gateway) IPV6=$(get_iface_var "IPV6") + [[ -z $IPV6 ]] && IPV6=$(get_iface_var "IP6") GATEWAY6=$(get_iface_var "GATEWAY6") CONTEXT_FORCE_IPV4=$(get_iface_var "CONTEXT_FORCE_IPV4") diff --git a/share/sudoers/sudo_commands.rb b/share/sudoers/sudo_commands.rb new file mode 100644 index 0000000000..dc80f62681 --- /dev/null +++ b/share/sudoers/sudo_commands.rb @@ -0,0 +1,71 @@ +#!/usr/bin/env ruby + +# -------------------------------------------------------------------------- # +# 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 "erb" + +KEYS = [:MISC , :NET , :LVM , :ISCSI , :OVS , :XEN] + +CMDS = { + :MISC => %w(dd mkfs sync), + :NET => %w(brctl ebtables iptables ip vconfig), + :LVM => %w(lvcreate lvremove lvrename lvs vgdisplay), + :ISCSI => %w(iscsiadm tgt-admin tgtadm), + :OVS => %w(ovs-ofctl ovs-vsctl), + :XEN => %w(xentop xl xm) +} + +abs_cmds = {} +not_found_cmds = [] + +KEYS.each do |label| + cmds = CMDS[label] + + _abs_cmds = [] + cmds.each do |cmd| + abs_cmd = `which #{cmd} 2>/dev/null` + + if !abs_cmd.empty? + _abs_cmds << abs_cmd.strip + else + not_found_cmds << cmd + end + end + + abs_cmds["ONE_#{label}"] = _abs_cmds +end + +abs_cmds.reject!{|k,v| v.empty?} + +puts ERB.new(DATA.read,nil, "<>").result(binding) + +if !not_found_cmds.empty? + STDERR.puts "\n---\n\nNot found:" + not_found_cmds.each{|cmd| STDERR.puts("- #{cmd}")} +end + +__END__ +Defaults !requiretty +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin + +<% KEYS.each do |k|; l = "ONE_#{k}"; v = abs_cmds[l] %> +<% if !v.nil? %> +Cmnd_Alias <%= l %> = <%= v.join(", ") %> +<% end %> +<% end %> + +oneadmin ALL=(ALL) NOPASSWD: <%= KEYS.select{|k| !abs_cmds["ONE_#{k}"].nil?}.collect{|k| "ONE_#{k}"}.join(", ") %> diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc index b455da5ee5..39a7976cf8 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 "); @@ -716,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, @@ -764,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/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/cli/one_helper.rb b/src/cli/one_helper.rb index c36c59dfad..be3e96dc01 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -186,6 +186,37 @@ EOT :large => '--vnc', :description => 'Add VNC server to the VM' }, + { + :name => 'vnc_password', + :large => '--vnc-password password', + :format => String, + :description => 'VNC password' + }, + { + :name => 'vnc_listen', + :large => '--vnc-listen ip', + :format => String, + :description => 'VNC IP where to listen for connections. '<< + 'By default is 0.0.0.0 (all interfaces).' + }, + { + :name => 'spice', + :large => '--spice', + :description => 'Add spice server to the VM' + }, + { + :name => 'spice_password', + :large => '--spice-password password', + :format => String, + :description => 'spice password' + }, + { + :name => 'spice_listen', + :large => '--spice-listen ip', + :format => String, + :description => 'spice IP where to listen for connections. '<< + 'By default is 0.0.0.0 (all interfaces).' + }, { :name => 'ssh', :large => '--ssh [file]', @@ -813,7 +844,21 @@ EOT end if options[:vnc] - template<<'GRAPHICS=[ TYPE="vnc", LISTEN="0.0.0.0" ]'<<"\n" + vnc_listen=options[:vnc_listen] || "0.0.0.0" + template<<"GRAPHICS=[ TYPE=\"vnc\", LISTEN=\"#{vnc_listen}\"" + if options[:vnc_password] + template << ", PASSWD=\"#{options[:vnc_password]}\"" + end + template<<' ]'<<"\n" + end + + if options[:spice] + spice_listen=options[:spice_listen] || "0.0.0.0" + template<<"GRAPHICS=[ TYPE=\"spice\", LISTEN=\"#{spice_listen}\"" + if options[:spice_password] + template << ", PASSWD=\"#{options[:spice_password]}\"" + end + template<<' ]'<<"\n" end context=create_context(options) 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']] 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/datastore_mad/remotes/ceph/ceph.conf b/src/datastore_mad/remotes/ceph/ceph.conf index 36d4df0058..729d45c550 100644 --- a/src/datastore_mad/remotes/ceph/ceph.conf +++ b/src/datastore_mad/remotes/ceph/ceph.conf @@ -17,9 +17,6 @@ # Default POOL_NAME POOL_NAME=one -# Default Ceph server host. Storage operations will be performed in this host. -HOST=localhost - # Staging directory # A directory in the Ceph server host where image will be transferred to # temporarily during the create/mkfs processes. This directoy MUST exist, diff --git a/src/datastore_mad/remotes/ceph/clone b/src/datastore_mad/remotes/ceph/clone index a1d6b729f3..112f32cd24 100755 --- a/src/datastore_mad/remotes/ceph/clone +++ b/src/datastore_mad/remotes/ceph/clone @@ -53,11 +53,16 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ unset i BASE_PATH="${XPATH_ELEMENTS[i++]}" -DST_HOST="${XPATH_ELEMENTS[i++]:-$HOST}" +DST_HOST="${XPATH_ELEMENTS[i++]}" POOL_NAME="${XPATH_ELEMENTS[i++]:-$POOL_NAME}" SRC="${XPATH_ELEMENTS[i++]}" SIZE="${XPATH_ELEMENTS[i++]}" +if [ -z "$DST_HOST" ]; then + error_message "Datastore template missing 'HOST' attribute." + exit -1 +fi + SAFE_DIRS="" IMAGE_NAME="one-${ID}" diff --git a/src/datastore_mad/remotes/ceph/cp b/src/datastore_mad/remotes/ceph/cp index 82a295138f..a388c840d6 100755 --- a/src/datastore_mad/remotes/ceph/cp +++ b/src/datastore_mad/remotes/ceph/cp @@ -66,7 +66,7 @@ unset i BASE_PATH="${XPATH_ELEMENTS[i++]}" RESTRICTED_DIRS="${XPATH_ELEMENTS[i++]}" SAFE_DIRS="${XPATH_ELEMENTS[i++]}" -DST_HOST="${XPATH_ELEMENTS[i++]:-$HOST}" +DST_HOST="${XPATH_ELEMENTS[i++]}" POOL_NAME="${XPATH_ELEMENTS[i++]:-$POOL_NAME}" STAGING_DIR="${XPATH_ELEMENTS[i++]:-$STAGING_DIR}" SRC="${XPATH_ELEMENTS[i++]}" @@ -76,6 +76,11 @@ SHA1="${XPATH_ELEMENTS[i++]}" NO_DECOMPRESS="${XPATH_ELEMENTS[i++]}" LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[i++]}" +if [ -z "$DST_HOST" ]; then + error_message "Datastore template missing 'HOST' attribute." + exit -1 +fi + set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" IMAGE_HASH=`generate_image_hash` @@ -115,7 +120,7 @@ REGISTER_CMD=$(cat </dev/null | cut -f1) +set -e -DF_STR=\$(df -m | grep ${BASE_PATH%/} | sed 's/ \+/:/g') +USED_MB=\$($DU -sLm ${BASE_PATH%/} 2>/dev/null | $CUT -f1) -TOTAL_MB=\$(echo \$DF_STR | cut -d':' -f 2) -FREE_MB=\$(echo \$DF_STR | cut -d':' -f 4) +DF_STR=\$($DF -m | grep ${BASE_PATH%/} | $SED 's/ \+/:/g') + +TOTAL_MB=\$(echo \$DF_STR | $CUT -d':' -f 2) +FREE_MB=\$(echo \$DF_STR | $CUT -d':' -f 4) echo "USED_MB=\$USED_MB" echo "TOTAL_MB=\$TOTAL_MB" diff --git a/src/flow/lib/grammar.rb b/src/flow/lib/grammar.rb index 976c3658e2..0abb2e3a5b 100644 --- a/src/flow/lib/grammar.rb +++ b/src/flow/lib/grammar.rb @@ -931,7 +931,7 @@ module ElasticityGrammar val = nil st = "#{att}[--]" else - val = (total / n_nodes).round(2) + val = ((total / n_nodes)*100).round/100.0 st = "#{att}[#{val.to_s}]" end diff --git a/src/host/Host.cc b/src/host/Host.cc index a1cae2765e..e29e069d5a 100644 --- a/src/host/Host.cc +++ b/src/host/Host.cc @@ -231,19 +231,19 @@ int Host::update_info(string &parse_str, if (isEnabled()) { - get_template_attribute("TOTALCPU", fv); + erase_template_attribute("TOTALCPU", fv); host_share.max_cpu = static_cast(fv); - get_template_attribute("TOTALMEMORY", fv); + erase_template_attribute("TOTALMEMORY", fv); host_share.max_mem = static_cast(fv); - get_template_attribute("FREECPU", fv); + erase_template_attribute("FREECPU", fv); host_share.free_cpu = static_cast(fv); - get_template_attribute("FREEMEMORY", fv); + erase_template_attribute("FREEMEMORY", fv); host_share.free_mem = static_cast(fv); - get_template_attribute("USEDCPU", fv); + erase_template_attribute("USEDCPU", fv); host_share.used_cpu = static_cast(fv); - get_template_attribute("USEDMEMORY", fv); + erase_template_attribute("USEDMEMORY", fv); host_share.used_mem = static_cast(fv); } diff --git a/src/im_mad/remotes/xen.d/poll3.sh b/src/im_mad/remotes/xen.d/poll3.sh index 18959738a8..c2f7854e38 100755 --- a/src/im_mad/remotes/xen.d/poll3.sh +++ b/src/im_mad/remotes/xen.d/poll3.sh @@ -16,5 +16,5 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -../../vmm/xen4/poll --xen -t +../../vmm/xen3/poll --xen -t diff --git a/src/image/ImageManagerDriver.cc b/src/image/ImageManagerDriver.cc index 60871d7ce0..ace0c93a17 100644 --- a/src/image/ImageManagerDriver.cc +++ b/src/image/ImageManagerDriver.cc @@ -622,8 +622,6 @@ static void monitor_action(istringstream& is, char* error_msg; int rc = monitor_data.parse(*dsinfo, &error_msg); - delete dsinfo; - if ( rc != 0 ) { oss << "Error parsing datastore information: " << error_msg @@ -631,11 +629,14 @@ static void monitor_action(istringstream& is, NebulaLog::log("ImM", Log::ERROR, oss); + delete dsinfo; free(error_msg); return; } + delete dsinfo; + float total, free, used; string ds_name; diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index b41099a59e..e194ae532d 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -23,6 +23,7 @@ BASH=bash CUT=cut DATE=date DD=dd +DF=df DU=du GREP=grep ISCSIADM=iscsiadm @@ -49,6 +50,8 @@ TAR=tar TGTADM=tgtadm TGTADMIN=tgt-admin TGTSETUPLUN=tgt-setup-lun-one +TR=tr +VGDISPLAY=vgdisplay VMKFSTOOLS=vmkfstools WGET=wget @@ -308,6 +311,8 @@ function mkfs_command { function ssh_exec_and_log { SSH_EXEC_ERR=`$SSH $1 sh -s 2>&1 1>/dev/null </dev/null < "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/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 diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 4c7f39b267..649643234b 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| @@ -227,7 +261,7 @@ module OneDBFsck id_elem = users_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("User #{id} is missing fom Group #{gid} users id list") + log_error("User #{id} is missing from Group #{gid} users id list") end users_new_elem.add_element("ID").text = id.to_s @@ -409,7 +443,7 @@ module OneDBFsck id_elem = hosts_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("Host #{id} is missing fom Cluster #{cluster_id} host id list") + log_error("Host #{id} is missing from Cluster #{cluster_id} host id list") end hosts_new_elem.add_element("ID").text = id.to_s @@ -439,7 +473,7 @@ module OneDBFsck id_elem = ds_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("Datastore #{id} is missing fom Cluster #{cluster_id} datastore id list") + log_error("Datastore #{id} is missing from Cluster #{cluster_id} datastore id list") end ds_new_elem.add_element("ID").text = id.to_s @@ -459,7 +493,7 @@ module OneDBFsck id_elem = vnets_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("VNet #{id} is missing fom Cluster #{cluster_id} vnet id list") + log_error("VNet #{id} is missing from Cluster #{cluster_id} vnet id list") end vnets_new_elem.add_element("ID").text = id.to_s @@ -546,7 +580,7 @@ module OneDBFsck id_elem = images_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("Image #{id} is missing fom Datastore #{ds_id} image id list") + log_error("Image #{id} is missing from Datastore #{ds_id} image id list") end images_new_elem.add_element("ID").text = id.to_s @@ -740,7 +774,7 @@ module OneDBFsck id_elem = vms_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("VM #{id} is missing fom Host #{hid} VM id list") + log_error("VM #{id} is missing from Host #{hid} VM id list") end vms_new_elem.add_element("ID").text = id.to_s @@ -824,7 +858,7 @@ module OneDBFsck id_elem = vms_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("VM #{id} is missing fom Image #{oid} VM id list") + log_error("VM #{id} is missing from Image #{oid} VM id list") end vms_new_elem.add_element("ID").text = id.to_s @@ -857,7 +891,7 @@ module OneDBFsck id_elem = clones_elem.elements.delete("ID[.=#{id}]") if id_elem.nil? - log_error("Image #{id} is missing fom Image #{oid} CLONES id list") + log_error("Image #{id} is missing from Image #{oid} CLONES id list") end clones_new_elem.add_element("ID").text = id.to_s diff --git a/src/onedb/onedb_backend.rb b/src/onedb/onedb_backend.rb index 6c37e7b865..e24bf97396 100644 --- a/src/onedb/onedb_backend.rb +++ b/src/onedb/onedb_backend.rb @@ -28,40 +28,42 @@ class OneDBBacKEnd def read_db_version connect_db - version = "2.0" - timestamp = 0 - comment = "" - - @db.fetch("SELECT version, timestamp, comment FROM db_versioning " + - "WHERE oid=(SELECT MAX(oid) FROM db_versioning)") do |row| - version = row[:version] - timestamp = row[:timestamp] - comment = row[:comment] - end - - return [version, timestamp, comment] - - rescue Exception => e - if e.class == Sequel::DatabaseConnectionError - raise e - elsif !db_exists? - # If the DB doesn't have db_version table, it means it is empty or a 2.x - raise "Database schema does not look to be created by " << - "OpenNebula: table user_pool is missing or empty." - end - begin - # Table image_pool is present only in 2.X DBs - @db.fetch("SELECT * FROM image_pool") { |row| } - rescue - raise "Database schema looks to be created by OpenNebula 1.X." << - "This tool only works with databases created by 2.X versions." + version = "2.0" + timestamp = 0 + comment = "" + + @db.fetch("SELECT version, timestamp, comment FROM db_versioning " + + "WHERE oid=(SELECT MAX(oid) FROM db_versioning)") do |row| + version = row[:version] + timestamp = row[:timestamp] + comment = row[:comment] + end + + return [version, timestamp, comment] + + rescue Exception => e + if e.class == Sequel::DatabaseConnectionError + raise e + elsif !db_exists? + # If the DB doesn't have db_version table, it means it is empty or a 2.x + raise "Database schema does not look to be created by " << + "OpenNebula: table user_pool is missing or empty." + end + + begin + # Table image_pool is present only in 2.X DBs + @db.fetch("SELECT * FROM image_pool") { |row| } + rescue + raise "Database schema looks to be created by OpenNebula 1.X." << + "This tool only works with databases created by 2.X versions." + end + + comment = "Could not read any previous db_versioning data, " << + "assuming it is an OpenNebula 2.0 or 2.2 DB." + + return [version, timestamp, comment] end - - comment = "Could not read any previous db_versioning data, " << - "assuming it is an OpenNebula 2.0 or 2.2 DB." - - return [version, timestamp, comment] end def history @@ -222,10 +224,6 @@ class BackEndSQLite < OneDBBacKEnd def initialize(file) @sqlite_file = file - - if !File.exists?(@sqlite_file) - raise "File #{@sqlite_file} doesn't exist" - end end def bck_file @@ -239,7 +237,7 @@ class BackEndSQLite < OneDBBacKEnd end def restore(bck_file, force=nil) - if !force + if File.exists?(@sqlite_file) && !force raise "File #{@sqlite_file} exists, use -f to overwrite." end @@ -250,6 +248,10 @@ class BackEndSQLite < OneDBBacKEnd private def connect_db + if !File.exists?(@sqlite_file) + raise "File #{@sqlite_file} doesn't exist" + end + begin @db = Sequel.sqlite(@sqlite_file) rescue Exception => e diff --git a/src/ozones/Server/ozones-server.rb b/src/ozones/Server/ozones-server.rb index 9a4798136a..baa72243f4 100755 --- a/src/ozones/Server/ozones-server.rb +++ b/src/ozones/Server/ozones-server.rb @@ -140,7 +140,7 @@ ADMIN_PASS = @auth.password begin OZones::ProxyRules.new("apache", $config[:htaccess]) rescue Exception => e - logger {e.message} + logger.error {e.message} exit -1 end 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/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/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/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..5c60e65f4b 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); @@ -317,6 +317,8 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, int rc; + bool remove_old_group; + string ngname; string uname; @@ -363,7 +365,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 +401,18 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, user->set_group(ngid,ngname); + // 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); user->unlock(); @@ -423,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); 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..8d7496689d 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 @@ -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); 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/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); 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/RequestManagerUser.cc b/src/rm/RequestManagerUser.cc index c026c398c9..331d30f1e0 100644 --- a/src/rm/RequestManagerUser.cc +++ b/src/rm/RequestManagerUser.cc @@ -210,3 +210,186 @@ int UserSetQuota::user_action(int user_id, return rc; } + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +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; + + 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); + + if ( rc != 0 ) + { + user->unlock(); + + error_str = "User is already in this group"; + return -1; + } + + upool->update(user); + + user->unlock(); + + group = gpool->get(group_id, true); + + if( group == 0 ) + { + user = upool->get(user_id,true); + + if ( user != 0 ) + { + user->del_group(group_id); + + upool->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::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); + + 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; + } + + upool->update(user); + + user->unlock(); + + group = gpool->get(group_id, true); + + if( group == 0 ) + { + //Group does not exist, should never occur + error_str = "Cannot remove user from group"; + return -1; + } + + group->del_user(user_id); + + gpool->update(group); + + group->unlock(); + + return 0; +} 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 ae107eb30c..821d7d8a2c 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 fef47d68ae..d89e1568cf 100644 --- a/src/scheduler/src/sched/Scheduler.cc +++ b/src/scheduler/src/sched/Scheduler.cc @@ -450,8 +450,14 @@ void Scheduler::match_schedule() 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/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 8df21114d8..73a4d6a06c 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -208,13 +208,21 @@ function tableCheckboxesListener(dataTable, custom_context){ // Does a partial redraw, so the filter and pagination are kept function updateView(item_list,dataTable){ var selected_row_id = $($('td.markrowselected',dataTable.fnGetNodes())[1]).html(); + if (!selected_row_id) selected_row_id = $($('td.markrowselected',dataTable.fnGetNodes())[0]).html(); var checked_row_ids = new Array(); $.each($(dataTable.fnGetNodes()), function(){ - if($('td.markrowchecked',this).length!=0) - { - checked_row_ids.push($($('td',$(this))[1]).html()); - } + if($('td.markrowchecked',this).length!=0) + { + if (!isNaN($($('td',$(this))[1]).html())) + { + checked_row_ids.push($($('td',$(this))[1]).html()); + } + else + { + checked_row_ids.push($($('td',$(this))[0]).html()); + } + } }); if (dataTable) { @@ -252,6 +260,12 @@ function updateView(item_list,dataTable){ { $.each($(dataTable.fnGetNodes()),function(){ var current_id = $($('td',this)[1]).html(); + + if (isNaN(current_id)) + { + current_id = $($('td',this)[0]).html(); + } + if (current_id) { if(jQuery.inArray(current_id, checked_row_ids)!=-1) diff --git a/src/tm_mad/ceph/clone b/src/tm_mad/ceph/clone index 25a8d96401..995f541744 100755 --- a/src/tm_mad/ceph/clone +++ b/src/tm_mad/ceph/clone @@ -57,6 +57,11 @@ unset i CEPH_HOST="${XPATH_ELEMENTS[i++]}" +if [ -z "$CEPH_HOST" ]; then + error_message "Datastore template missing 'HOST' attribute." + exit -1 +fi + #------------------------------------------------------------------------------- # Compute the destination image name #------------------------------------------------------------------------------- diff --git a/src/tm_mad/common/mkimage b/src/tm_mad/common/mkimage index c61734b18f..a7e151c38f 100755 --- a/src/tm_mad/common/mkimage +++ b/src/tm_mad/common/mkimage @@ -53,8 +53,9 @@ ssh_make_path $DST_HOST $DST_DIR CREATE_IMAGE="$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" MKFS_CMD=`mkfs_command $DST_PATH $FSTYPE $SIZE` - + MKSCRIPT=$(cat <" "" << 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..2e55b6921c 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 ) { @@ -445,6 +451,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; @@ -459,7 +467,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 +489,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 +511,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; @@ -571,6 +582,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; @@ -580,12 +593,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 +612,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 +669,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; @@ -681,6 +698,8 @@ auth_failure: user_id = -1; group_id = -1; + group_ids.clear(); + uname = ""; gname = ""; @@ -694,7 +713,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 +738,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..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.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 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 371 of yacc.c */ -#line 17 "vm_file_var_syntax.y" +#line 17 "vm_file_var_syntax.y" /* yacc.c:339 */ #include #include @@ -145,7 +142,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 +217,21 @@ 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(); + } + else + { + gids.insert(vm->get_gid()); + } + + AuthRequest ar(vm->get_uid(), gids); ar.add_auth(AuthRequest::USE, perm); @@ -237,8 +250,7 @@ int get_image_path(VirtualMachine * vm, /* -------------------------------------------------------------------------- */ -/* Line 371 of yacc.c */ -#line 242 "vm_file_var_syntax.cc" +#line 254 "vm_file_var_syntax.cc" /* yacc.c:339 */ # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -260,7 +272,7 @@ int get_image_path(VirtualMachine * vm, 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. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -268,78 +280,63 @@ int get_image_path(VirtualMachine * vm, 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 387 of yacc.c */ -#line 190 "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 387 of yacc.c */ -#line 303 "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 -#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 340 "vm_file_var_syntax.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -353,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 @@ -377,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 @@ -415,24 +408,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 @@ -451,8 +445,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 @@ -464,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 @@ -481,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 @@ -489,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 @@ -507,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 @@ -534,16 +525,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 @@ -562,7 +553,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -578,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, @@ -621,25 +614,10 @@ 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, 214, 214, 215, 219, 237 + 0, 230, 230, 231, 235, 253 }; #endif @@ -655,8 +633,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, 258, 259, 260, 261, 262, 263, 264, @@ -664,102 +642,90 @@ 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) @@ -776,13 +742,13 @@ do \ else \ { \ yyerror (&yylloc, mc, vm, img_ids, errmsg, 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]. @@ -792,7 +758,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; \ @@ -806,12 +772,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. */ @@ -822,35 +803,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; } @@ -864,75 +837,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, vm, img_ids, errmsg); \ - 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, vm, img_ids, errmsg); \ + 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, 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 { FILE *yyo = yyoutput; YYUSE (yyo); - if (!yyvaluep) - return; 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 YYUSE (yytype); } @@ -942,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, ": "); @@ -975,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++) @@ -995,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. */ @@ -1056,7 +955,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1079,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++) @@ -1103,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; @@ -1142,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: ; } @@ -1197,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 @@ -1317,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); @@ -1341,12 +1206,13 @@ 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); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1356,69 +1222,27 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, img_ids, errmsg) | 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; -#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; @@ -1427,9 +1251,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. */ @@ -1508,26 +1332,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 @@ -1535,23 +1359,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 */ @@ -1561,10 +1385,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)); @@ -1593,7 +1417,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, mc); } if (yychar <= YYEOF) @@ -1658,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 @@ -1673,12 +1497,11 @@ yyreduce: switch (yyn) { case 4: -/* Line 1787 of yacc.c */ -#line 220 "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; @@ -1692,17 +1515,17 @@ yyreduce: YYABORT; } } +#line 1519 "vm_file_var_syntax.cc" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 238 "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; @@ -1717,11 +1540,11 @@ yyreduce: YYABORT; } } +#line 1544 "vm_file_var_syntax.cc" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1725 "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 @@ -1744,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. */ @@ -1759,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. */ @@ -1812,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 @@ -1845,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; @@ -1858,29 +1681,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, vm, img_ids, errmsg); + yystos[yystate], yyvsp, yylsp, mc, vm, img_ids, errmsg); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1936,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 @@ -1954,13 +1777,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 259 "vm_file_var_syntax.y" +#line 275 "vm_file_var_syntax.y" /* yacc.c:1906 */ extern "C" void vm_file_var__error( diff --git a/src/vm/vm_file_var_syntax.h b/src/vm/vm_file_var_syntax.h index ba21e884af..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.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_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED # define YY_VM_FILE_VAR_VM_FILE_VAR_SYNTAX_HH_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -40,53 +40,50 @@ 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 2053 of yacc.c */ -#line 190 "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 2053 of yacc.c */ -#line 75 "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 diff --git a/src/vm/vm_file_var_syntax.y b/src/vm/vm_file_var_syntax.y index 2fc5df034a..59714d590b 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,21 @@ 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(); + } + else + { + gids.insert(vm->get_gid()); + } + + AuthRequest ar(vm->get_uid(), gids); ar.add_auth(AuthRequest::USE, perm); diff --git a/src/vmm_mad/exec/vmm_exec_kvm.conf b/src/vmm_mad/exec/vmm_exec_kvm.conf index 5d26a3442d..a86d3f606a 100644 --- a/src/vmm_mad/exec/vmm_exec_kvm.conf +++ b/src/vmm_mad/exec/vmm_exec_kvm.conf @@ -35,4 +35,4 @@ FEATURES = [ PAE = "no", ACPI = "yes" ] DISK = [ driver = "raw" , cache = "none"] #NIC = [ filter = "clean-traffic", model="virtio" ] -#RAW = "" +#RAW = [ type = "kvm", data = "" ] diff --git a/src/vmm_mad/exec/vmm_exec_xen3.conf b/src/vmm_mad/exec/vmm_exec_xen3.conf index b73d8a24b1..ac65184248 100644 --- a/src/vmm_mad/exec/vmm_exec_xen3.conf +++ b/src/vmm_mad/exec/vmm_exec_xen3.conf @@ -30,4 +30,4 @@ CREDIT = 256 DISK = [ driver = "tap:aio:" ] -#RAW = "data=\"on_crash=destroy\"" +#RAW = [ type = "xen", data = "on_crash=destroy" ] diff --git a/src/vmm_mad/exec/vmm_exec_xen4.conf b/src/vmm_mad/exec/vmm_exec_xen4.conf index d020ce35b6..266eb6db35 100644 --- a/src/vmm_mad/exec/vmm_exec_xen4.conf +++ b/src/vmm_mad/exec/vmm_exec_xen4.conf @@ -30,4 +30,4 @@ CREDIT = 256 DISK = [ driver = "raw:" ] -#RAW = "data=\"on_crash=destroy\"" +#RAW = [ type = "xen", data = "on_crash=destroy" ] diff --git a/src/vmm_mad/remotes/kvm/restore b/src/vmm_mad/remotes/kvm/restore index dc9331695b..bb4373c6da 100755 --- a/src/vmm_mad/remotes/kvm/restore +++ b/src/vmm_mad/remotes/kvm/restore @@ -23,3 +23,5 @@ file=$1 exec_and_log "virsh --connect $LIBVIRT_URI restore $file" \ "Could not restore from $file" + +rm "$file" diff --git a/src/vnm_mad/remotes/OpenNebulaNetwork.rb b/src/vnm_mad/remotes/OpenNebulaNetwork.rb index 7a228edad2..ba8b72c4f1 100644 --- a/src/vnm_mad/remotes/OpenNebulaNetwork.rb +++ b/src/vnm_mad/remotes/OpenNebulaNetwork.rb @@ -30,16 +30,16 @@ CONF = { } COMMANDS = { - :ebtables => "sudo /sbin/ebtables", - :iptables => "sudo /sbin/iptables", - :brctl => "sudo /sbin/brctl", - :ip => "sudo /sbin/ip", - :vconfig => "sudo /sbin/vconfig", + :ebtables => "sudo ebtables", + :iptables => "sudo iptables", + :brctl => "sudo brctl", + :ip => "sudo ip", + :vconfig => "sudo vconfig", :virsh => "virsh -c qemu:///system", - :xm => "sudo /usr/sbin/xm", - :ovs_vsctl=> "sudo /usr/bin/ovs-vsctl", - :ovs_ofctl=> "sudo /usr/bin/ovs-ofctl", - :lsmod => "/sbin/lsmod" + :xm => "sudo xm", + :ovs_vsctl=> "sudo ovs-vsctl", + :ovs_ofctl=> "sudo ovs-ofctl", + :lsmod => "lsmod" } class VM diff --git a/src/xml/expr_arith.cc b/src/xml/expr_arith.cc index 7b6a606c3e..142f25f7c9 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, 105, 106, 107, 108, 109, @@ -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,74 +1367,73 @@ 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" - { float val; oxml->search((yyvsp[(1) - (1)].val_str), val); (yyval.val_float) = val; } +#line 104 "expr_arith.y" /* yacc.c:1646 */ + { float val; oxml->search((yyvsp[0].val_str), val); (yyval.val_float) = val; } +#line 1385 "expr_arith.cc" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 105 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (1)].val_float); } +#line 105 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[0].val_float); } +#line 1391 "expr_arith.cc" /* yacc.c:1646 */ break; case 6: -/* Line 1787 of yacc.c */ -#line 106 "expr_arith.y" - { (yyval.val_float) = static_cast((yyvsp[(1) - (1)].val_int)); } +#line 106 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = static_cast((yyvsp[0].val_int)); } +#line 1397 "expr_arith.cc" /* yacc.c:1646 */ break; case 7: -/* Line 1787 of yacc.c */ -#line 107 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);} +#line 107 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) + (yyvsp[0].val_float);} +#line 1403 "expr_arith.cc" /* yacc.c:1646 */ break; case 8: -/* Line 1787 of yacc.c */ -#line 108 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);} +#line 108 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) - (yyvsp[0].val_float);} +#line 1409 "expr_arith.cc" /* yacc.c:1646 */ break; case 9: -/* Line 1787 of yacc.c */ -#line 109 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);} +#line 109 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) * (yyvsp[0].val_float);} +#line 1415 "expr_arith.cc" /* yacc.c:1646 */ break; case 10: -/* Line 1787 of yacc.c */ -#line 110 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);} +#line 110 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-2].val_float) / (yyvsp[0].val_float);} +#line 1421 "expr_arith.cc" /* yacc.c:1646 */ break; case 11: -/* Line 1787 of yacc.c */ -#line 111 "expr_arith.y" - { (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);} +#line 111 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = - (yyvsp[0].val_float);} +#line 1427 "expr_arith.cc" /* yacc.c:1646 */ break; case 12: -/* Line 1787 of yacc.c */ -#line 112 "expr_arith.y" - { (yyval.val_float) = (yyvsp[(2) - (3)].val_float);} +#line 112 "expr_arith.y" /* yacc.c:1646 */ + { (yyval.val_float) = (yyvsp[-1].val_float);} +#line 1433 "expr_arith.cc" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1632 "expr_arith.cc" +#line 1437 "expr_arith.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1651,7 +1456,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. */ @@ -1666,9 +1471,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. */ @@ -1719,20 +1524,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 @@ -1752,7 +1557,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; @@ -1765,29 +1570,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); @@ -1843,14 +1648,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 @@ -1861,13 +1666,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 115 "expr_arith.y" +#line 115 "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 42893bb61d..592f1667cf 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 @@ -124,8 +121,7 @@ extern "C" } } -/* Line 371 of yacc.c */ -#line 129 "expr_bool.cc" +#line 125 "expr_bool.cc" /* yacc.c:339 */ # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -147,7 +143,7 @@ extern "C" 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 @@ -155,72 +151,57 @@ extern "C" 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 77 "expr_bool.y" +#line 77 "expr_bool.y" /* yacc.c:355 */ char * val_str; int val_int; float val_float; - -/* Line 387 of yacc.c */ -#line 184 "expr_bool.cc" -} YYSTYPE; +#line 177 "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 224 "expr_bool.cc" +#line 205 "expr_bool.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -234,11 +215,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 @@ -258,8 +236,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 @@ -296,24 +273,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 @@ -332,8 +310,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 @@ -345,8 +322,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 @@ -362,7 +339,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 @@ -370,15 +347,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 @@ -388,8 +363,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 @@ -415,16 +390,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 @@ -443,7 +418,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -459,17 +434,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, @@ -502,27 +479,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, 97, 97, 98, 101, 110, 119, 126, 133, 140, @@ -541,8 +498,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, @@ -550,39 +507,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, @@ -590,16 +526,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, @@ -607,12 +558,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, @@ -620,8 +565,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, @@ -629,30 +574,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) @@ -669,13 +614,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]. @@ -685,7 +630,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; \ @@ -699,12 +644,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. */ @@ -715,35 +675,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; } @@ -757,75 +709,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); } @@ -835,27 +749,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, ": "); @@ -868,16 +766,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++) @@ -888,54 +778,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. */ @@ -949,7 +827,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -972,15 +850,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++) @@ -996,16 +867,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; @@ -1035,27 +898,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: ; } @@ -1090,10 +953,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 @@ -1210,23 +1069,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); @@ -1234,12 +1078,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 } @@ -1249,69 +1094,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; @@ -1320,9 +1123,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. */ @@ -1401,26 +1204,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 @@ -1428,23 +1231,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 */ @@ -1454,10 +1257,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)); @@ -1486,7 +1289,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, mc); } if (yychar <= YYEOF) @@ -1551,7 +1354,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 @@ -1566,159 +1369,158 @@ yyreduce: switch (yyn) { case 2: -/* Line 1787 of yacc.c */ -#line 97 "expr_bool.y" - { result=(yyvsp[(1) - (1)].val_int); } +#line 97 "expr_bool.y" /* yacc.c:1646 */ + { result=(yyvsp[0].val_int); } +#line 1375 "expr_bool.cc" /* yacc.c:1646 */ break; case 3: -/* Line 1787 of yacc.c */ -#line 98 "expr_bool.y" +#line 98 "expr_bool.y" /* yacc.c:1646 */ { result=true; } +#line 1381 "expr_bool.cc" /* yacc.c:1646 */ break; case 4: -/* Line 1787 of yacc.c */ -#line 101 "expr_bool.y" +#line 101 "expr_bool.y" /* yacc.c:1646 */ { - int val = (yyvsp[(3) - (3)].val_int); + int val = (yyvsp[0].val_int); int rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); + rc = oxml->search((yyvsp[-2].val_str),val); - (yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_int)); + (yyval.val_int) = (rc == 0 && val == (yyvsp[0].val_int)); } +#line 1394 "expr_bool.cc" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 110 "expr_bool.y" +#line 110 "expr_bool.y" /* yacc.c:1646 */ { - int val = (yyvsp[(4) - (4)].val_int); + int val = (yyvsp[0].val_int); int rc; - rc = oxml->search((yyvsp[(1) - (4)].val_str),val); + rc = oxml->search((yyvsp[-3].val_str),val); - (yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_int)); + (yyval.val_int) = (rc == 0 && val != (yyvsp[0].val_int)); } +#line 1407 "expr_bool.cc" /* yacc.c:1646 */ break; case 6: -/* Line 1787 of yacc.c */ -#line 119 "expr_bool.y" +#line 119 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_int)); + rc = oxml->search((yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val > (yyvsp[0].val_int)); } +#line 1418 "expr_bool.cc" /* yacc.c:1646 */ break; case 7: -/* Line 1787 of yacc.c */ -#line 126 "expr_bool.y" +#line 126 "expr_bool.y" /* yacc.c:1646 */ { int val, rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_int)); + rc = oxml->search((yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val < (yyvsp[0].val_int)); } +#line 1429 "expr_bool.cc" /* yacc.c:1646 */ break; case 8: -/* Line 1787 of yacc.c */ -#line 133 "expr_bool.y" +#line 133 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val == (yyvsp[(3) - (3)].val_float)); + rc = oxml->search((yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val == (yyvsp[0].val_float)); } +#line 1440 "expr_bool.cc" /* yacc.c:1646 */ break; case 9: -/* Line 1787 of yacc.c */ -#line 140 "expr_bool.y" +#line 140 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = oxml->search((yyvsp[(1) - (4)].val_str),val); - (yyval.val_int) = (rc == 0 && val != (yyvsp[(4) - (4)].val_float)); + rc = oxml->search((yyvsp[-3].val_str),val); + (yyval.val_int) = (rc == 0 && val != (yyvsp[0].val_float)); } +#line 1451 "expr_bool.cc" /* yacc.c:1646 */ break; case 10: -/* Line 1787 of yacc.c */ -#line 147 "expr_bool.y" +#line 147 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val > (yyvsp[(3) - (3)].val_float)); + rc = oxml->search((yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val > (yyvsp[0].val_float)); } +#line 1462 "expr_bool.cc" /* yacc.c:1646 */ break; case 11: -/* Line 1787 of yacc.c */ -#line 154 "expr_bool.y" +#line 154 "expr_bool.y" /* yacc.c:1646 */ { float val, rc; - rc = oxml->search((yyvsp[(1) - (3)].val_str),val); - (yyval.val_int) = (rc == 0 && val < (yyvsp[(3) - (3)].val_float));} + rc = oxml->search((yyvsp[-2].val_str),val); + (yyval.val_int) = (rc == 0 && val < (yyvsp[0].val_float));} +#line 1472 "expr_bool.cc" /* yacc.c:1646 */ break; case 12: -/* Line 1787 of yacc.c */ -#line 160 "expr_bool.y" +#line 160 "expr_bool.y" /* yacc.c:1646 */ { string val; int rc; - rc = oxml->search((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 = oxml->search((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 1484 "expr_bool.cc" /* yacc.c:1646 */ break; case 13: -/* Line 1787 of yacc.c */ -#line 168 "expr_bool.y" +#line 168 "expr_bool.y" /* yacc.c:1646 */ { string val; int rc; - rc = oxml->search((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 = oxml->search((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 1496 "expr_bool.cc" /* yacc.c:1646 */ break; case 14: -/* Line 1787 of yacc.c */ -#line 176 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); } +#line 176 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-2].val_int) && (yyvsp[0].val_int); } +#line 1502 "expr_bool.cc" /* yacc.c:1646 */ break; case 15: -/* Line 1787 of yacc.c */ -#line 177 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); } +#line 177 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-2].val_int) || (yyvsp[0].val_int); } +#line 1508 "expr_bool.cc" /* yacc.c:1646 */ break; case 16: -/* Line 1787 of yacc.c */ -#line 178 "expr_bool.y" - { (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); } +#line 178 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = ! (yyvsp[0].val_int); } +#line 1514 "expr_bool.cc" /* yacc.c:1646 */ break; case 17: -/* Line 1787 of yacc.c */ -#line 179 "expr_bool.y" - { (yyval.val_int) = (yyvsp[(2) - (3)].val_int); } +#line 179 "expr_bool.y" /* yacc.c:1646 */ + { (yyval.val_int) = (yyvsp[-1].val_int); } +#line 1520 "expr_bool.cc" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1722 "expr_bool.cc" +#line 1524 "expr_bool.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1741,7 +1543,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. */ @@ -1756,9 +1558,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. */ @@ -1809,20 +1611,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 @@ -1842,7 +1644,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; @@ -1855,29 +1657,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); @@ -1933,14 +1735,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 @@ -1951,13 +1753,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 182 "expr_bool.y" +#line 182 "expr_bool.y" /* yacc.c:1906 */ extern "C" void expr_bool__error( diff --git a/src/xml/expr_bool.h b/src/xml/expr_bool.h index 1dc295e1a8..964a2d577f 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 77 "expr_bool.y" +#line 77 "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