From 3c46ff33669290109305e645c6814006cdb79bac Mon Sep 17 00:00:00 2001 From: juanmont Date: Thu, 19 Oct 2017 16:41:42 +0200 Subject: [PATCH 01/16] B #5425: Changed UserPool and HostPool for to work with CachePool --- include/CachePool.h | 82 ++++++++++++++++++++++++++++++++++++++++++++ include/HostPool.h | 14 +++++--- include/User.h | 16 +++++++-- include/UserPool.h | 32 +++++++++++++++-- src/host/HostPool.cc | 54 +---------------------------- src/um/User.cc | 2 +- src/um/UserPool.cc | 23 ++++++++----- 7 files changed, 151 insertions(+), 72 deletions(-) create mode 100644 include/CachePool.h diff --git a/include/CachePool.h b/include/CachePool.h new file mode 100644 index 0000000000..a51e0dac68 --- /dev/null +++ b/include/CachePool.h @@ -0,0 +1,82 @@ +#ifndef CACHE_POOL_H_ +#define CACHE_POOL_H_ + +#include +#include +#include + +#include + +#include + +using namespace std; + +/** + * The Cache Pool class. + */ +template class CachePool +{ +private: + + pthread_mutex_t resource_lock; + + std::map resources; + +public: + CachePool(){ + pthread_mutex_init(&resource_lock,0); + } + + ~CachePool() + { + typename std::map::iterator it; + + for (it=resources.begin(); it != resources.end() ; ++it) + { + delete it->second; + } + }; + + T * get_resource(int oid) + { + T * res; + + pthread_mutex_lock(&resource_lock); + + typename std::map::iterator it = resources.find(oid); + + if ( it == resources.end() ) + { + res = new T; + + resources.insert(std::make_pair(oid, res)); + } + else + { + res = it->second; + } + + pthread_mutex_unlock(&resource_lock); + + return res; + } + + + void delete_resource(int oid) + { + pthread_mutex_lock(&resource_lock); + + typename std::map::iterator it = resources.find(oid); + + if ( it != resources.end() ) + { + delete it->second; + + resources.erase(it); + } + + pthread_mutex_unlock(&resource_lock); + } +}; + +#endif /*CACHE_POOL_H_*/ \ No newline at end of file diff --git a/include/HostPool.h b/include/HostPool.h index 2128274480..31b3ae5046 100644 --- a/include/HostPool.h +++ b/include/HostPool.h @@ -19,6 +19,7 @@ #include "PoolSQL.h" #include "Host.h" +#include "CachePool.h" #include #include @@ -197,6 +198,7 @@ public: int drop(PoolObjectSQL * objsql, string& error_msg) { Host * host = static_cast(objsql); + int oid = host->oid; if ( host->get_share_running_vms() > 0 ) { @@ -208,7 +210,7 @@ public: if ( rc == 0 ) { - delete_host_vm(host->oid); + delete_host_vm(oid); } return rc; @@ -320,11 +322,15 @@ private: pthread_mutex_t host_vm_lock; - map host_vms; + CachePool cache; - HostVM * get_host_vm(int oid); + HostVM * get_host_vm(int oid){ + return cache.get_resource(oid); + } - void delete_host_vm(int oid); + void delete_host_vm(int oid){ + cache.delete_resource(oid); + } /** * Factory method to produce Host objects diff --git a/include/User.h b/include/User.h index d3ae755b3c..1f6892e50c 100644 --- a/include/User.h +++ b/include/User.h @@ -95,7 +95,7 @@ public: { enabled = false; - session.reset(); + session->reset(); login_tokens.reset(); }; @@ -137,7 +137,7 @@ public: int set_auth_driver(const string& _auth_driver, string& error_str) { auth_driver = _auth_driver; - session.reset(); + session->reset(); return 0; }; @@ -224,6 +224,16 @@ public: return groups.contains(_group_id); } + /** + * Sets session token + * + * @param session_token the new session token + */ + void set_session(SessionToken * session_token) + { + session = session_token; + } + // ************************************************************************* // Quotas // ************************************************************************* @@ -286,7 +296,7 @@ private: // ************************************************************************* // Authentication session used to cache authentication calls // ************************************************************************* - SessionToken session; + SessionToken * session; // ************************************************************************* // DataBase implementation (Private) diff --git a/include/UserPool.h b/include/UserPool.h index 8d557646d9..5e10ad620f 100644 --- a/include/UserPool.h +++ b/include/UserPool.h @@ -20,6 +20,8 @@ #include "PoolSQL.h" #include "User.h" #include "GroupPool.h" +#include "CachePool.h" +#include "LoginToken.h" #include #include @@ -80,7 +82,14 @@ public: */ User * get(int oid, bool lock) { - return static_cast(PoolSQL::get(oid,lock)); + User * u = static_cast(PoolSQL::get(oid,lock)); + + if ( u != 0 ) + { + u->set_session(get_session_token(oid)); + } + + return u; }; /** @@ -93,7 +102,14 @@ public: User * get(string name, bool lock) { // The owner is set to -1, because it is not used in the key() method - return static_cast(PoolSQL::get(name,-1,lock)); + User * u = static_cast(PoolSQL::get(name,-1,lock)); + + if ( u != 0 ) + { + u->set_session(get_session_token(u->oid)); + } + + return u; }; /** @@ -221,6 +237,16 @@ private: **/ static time_t _session_expiration_time; + + CachePool cache; + SessionToken * get_session_token(int oid){ + return cache.get_resource(oid); + } + + void delete_session_token(int oid){ + cache.delete_resource(oid); + } + /** * Function to authenticate internal (known) users */ @@ -273,7 +299,7 @@ private: //-------------------------------------------------------------------------- /** - * Callback function to get output in XML format + * Callback function to output in XML format * @param num the number of columns read from the DB * @param names the column names * @param vaues the column values diff --git a/src/host/HostPool.cc b/src/host/HostPool.cc index cba28bbc1f..31b06cb2f9 100644 --- a/src/host/HostPool.cc +++ b/src/host/HostPool.cc @@ -147,15 +147,7 @@ HostPool::HostPool(SqlDB* db, /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -HostPool::~HostPool() -{ - map::iterator it; - - for (it=host_vms.begin(); it != host_vms.end() ; ++it) - { - delete it->second; - } -}; +HostPool::~HostPool(){}; /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -337,47 +329,3 @@ int HostPool::clean_all_monitoring() return rc; } - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -HostPool::HostVM * HostPool::get_host_vm(int oid) -{ - HostVM * hvm; - - pthread_mutex_lock(&host_vm_lock); - - map::iterator it = host_vms.find(oid); - - if ( it == host_vms.end() ) - { - hvm = new HostVM; - - host_vms.insert(make_pair(oid, new HostVM)); - } - else - { - hvm = it->second; - } - - pthread_mutex_unlock(&host_vm_lock); - - return hvm; -} - -void HostPool::delete_host_vm(int oid) -{ - pthread_mutex_lock(&host_vm_lock); - - map::iterator it = host_vms.find(oid); - - if ( it != host_vms.end() ) - { - delete it->second; - - host_vms.erase(it); - } - - pthread_mutex_unlock(&host_vm_lock); -} - diff --git a/src/um/User.cc b/src/um/User.cc index 9b6b1242e7..826bea1636 100644 --- a/src/um/User.cc +++ b/src/um/User.cc @@ -353,7 +353,7 @@ int User::set_password(const string& passwd, string& error_str) password = passwd; } - session.reset(); + session->reset(); login_tokens.reset(); } diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index c9912b42cb..aa497e25f5 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -497,7 +497,17 @@ int UserPool::drop(PoolObjectSQL * objsql, string& error_msg) return -1; } - return PoolSQL::drop(objsql, error_msg); + User * user = static_cast(objsql); + int oid = user->oid; + + int rc = PoolSQL::drop(objsql, error_msg); + + if ( rc == 0 ) + { + delete_session_token(oid); + } + + return rc; } /* -------------------------------------------------------------------------- */ @@ -680,7 +690,7 @@ bool UserPool::authenticate_internal(User * user, return true; } - else if (user->session.is_valid(token)) + else if (user->session->is_valid(token)) { user->unlock(); return true; @@ -744,7 +754,7 @@ bool UserPool::authenticate_internal(User * user, return false; } - user->session.set(token, _session_expiration_time); + user->session->set(token, _session_expiration_time); if ( !driver_managed_groups || new_gid == -1 || new_group_ids == group_ids ) { @@ -937,7 +947,7 @@ bool UserPool::authenticate_server(User * user, uname = user->name; gname = user->gname; - result = user->session.is_valid(second_token); + result = user->session->is_valid(second_token); umask = user->get_umask(); @@ -971,7 +981,7 @@ bool UserPool::authenticate_server(User * user, if (user != 0) { - user->session.set(second_token, _session_expiration_time); + user->session->set(second_token, _session_expiration_time); user->unlock(); } @@ -1341,6 +1351,3 @@ string UserPool::get_token_password(int oid, int bck_oid){ } return token_password; } - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ From bbdbeedaae3792a620826421c3b1100fc3891c0f Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 17 Oct 2017 15:38:00 +0200 Subject: [PATCH 02/16] F #5461: Remove empty vector attributes when merging templates (ATTR=[]) --- src/template/Template.cc | 14 +- src/template/template_parser.c | 815 ++++++++++++++++++++------------ src/template/template_syntax.cc | 93 ++-- src/template/template_syntax.y | 9 + 4 files changed, 600 insertions(+), 331 deletions(-) diff --git a/src/template/Template.cc b/src/template/Template.cc index 1ed50929e9..e9e4f8a25e 100644 --- a/src/template/Template.cc +++ b/src/template/Template.cc @@ -655,7 +655,19 @@ void Template::merge(const Template * from) for (it = from->attributes.begin(); it != from->attributes.end(); ++it) { - set(it->second->clone()); + if ( it->second->type() == Attribute::VECTOR ) + { + VectorAttribute * va = static_cast(it->second); + + if (!va->value().empty()) + { + set(it->second->clone()); + } + } + else //Attribute::SINGLE + { + set(it->second->clone()); + } } } diff --git a/src/template/template_parser.c b/src/template/template_parser.c index 0a30ea9d10..830fff9449 100644 --- a/src/template/template_parser.c +++ b/src/template/template_parser.c @@ -1,6 +1,6 @@ -#line 2 "template_parser.c" +#line 1 "template_parser.c" -#line 4 "template_parser.c" +#line 3 "template_parser.c" #define YY_INT_ALIGNED short int @@ -8,11 +8,17 @@ #define yy_create_buffer template__create_buffer #define yy_delete_buffer template__delete_buffer -#define yy_flex_debug template__flex_debug +#define yy_scan_buffer template__scan_buffer +#define yy_scan_string template__scan_string +#define yy_scan_bytes template__scan_bytes #define yy_init_buffer template__init_buffer #define yy_flush_buffer template__flush_buffer #define yy_load_buffer_state template__load_buffer_state #define yy_switch_to_buffer template__switch_to_buffer +#define yypush_buffer_state template_push_buffer_state +#define yypop_buffer_state template_pop_buffer_state +#define yyensure_buffer_stack template_ensure_buffer_stack +#define yy_flex_debug template__flex_debug #define yyin template_in #define yyleng template_leng #define yylex template_lex @@ -28,11 +34,245 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 1 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define template__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer template__create_buffer +#endif + +#ifdef yy_delete_buffer +#define template__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer template__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define template__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer template__scan_buffer +#endif + +#ifdef yy_scan_string +#define template__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string template__scan_string +#endif + +#ifdef yy_scan_bytes +#define template__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes template__scan_bytes +#endif + +#ifdef yy_init_buffer +#define template__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer template__init_buffer +#endif + +#ifdef yy_flush_buffer +#define template__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer template__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define template__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state template__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define template__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer template__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define template_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state template_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define template_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state template_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define template_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack template_ensure_buffer_stack +#endif + +#ifdef yylex +#define template_lex_ALREADY_DEFINED +#else +#define yylex template_lex +#endif + +#ifdef yyrestart +#define template_restart_ALREADY_DEFINED +#else +#define yyrestart template_restart +#endif + +#ifdef yylex_init +#define template_lex_init_ALREADY_DEFINED +#else +#define yylex_init template_lex_init +#endif + +#ifdef yylex_init_extra +#define template_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra template_lex_init_extra +#endif + +#ifdef yylex_destroy +#define template_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy template_lex_destroy +#endif + +#ifdef yyget_debug +#define template_get_debug_ALREADY_DEFINED +#else +#define yyget_debug template_get_debug +#endif + +#ifdef yyset_debug +#define template_set_debug_ALREADY_DEFINED +#else +#define yyset_debug template_set_debug +#endif + +#ifdef yyget_extra +#define template_get_extra_ALREADY_DEFINED +#else +#define yyget_extra template_get_extra +#endif + +#ifdef yyset_extra +#define template_set_extra_ALREADY_DEFINED +#else +#define yyset_extra template_set_extra +#endif + +#ifdef yyget_in +#define template_get_in_ALREADY_DEFINED +#else +#define yyget_in template_get_in +#endif + +#ifdef yyset_in +#define template_set_in_ALREADY_DEFINED +#else +#define yyset_in template_set_in +#endif + +#ifdef yyget_out +#define template_get_out_ALREADY_DEFINED +#else +#define yyget_out template_get_out +#endif + +#ifdef yyset_out +#define template_set_out_ALREADY_DEFINED +#else +#define yyset_out template_set_out +#endif + +#ifdef yyget_leng +#define template_get_leng_ALREADY_DEFINED +#else +#define yyget_leng template_get_leng +#endif + +#ifdef yyget_text +#define template_get_text_ALREADY_DEFINED +#else +#define yyget_text template_get_text +#endif + +#ifdef yyget_lineno +#define template_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno template_get_lineno +#endif + +#ifdef yyset_lineno +#define template_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno template_set_lineno +#endif + +#ifdef yywrap +#define template_wrap_ALREADY_DEFINED +#else +#define yywrap template_wrap +#endif + +#ifdef yyalloc +#define template_alloc_ALREADY_DEFINED +#else +#define yyalloc template_alloc +#endif + +#ifdef yyrealloc +#define template_realloc_ALREADY_DEFINED +#else +#define yyrealloc template_realloc +#endif + +#ifdef yyfree +#define template_free_ALREADY_DEFINED +#else +#define yyfree template_free +#endif + +#ifdef yytext +#define template_text_ALREADY_DEFINED +#else +#define yytext template_text +#endif + +#ifdef yyleng +#define template_leng_ALREADY_DEFINED +#else +#define yyleng template_leng +#endif + +#ifdef yyin +#define template_in_ALREADY_DEFINED +#else +#define yyin template_in +#endif + +#ifdef yyout +#define template_out_ALREADY_DEFINED +#else +#define yyout template_out +#endif + +#ifdef yy_flex_debug +#define template__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug template__flex_debug +#endif + +#ifdef yylineno +#define template_lineno_ALREADY_DEFINED +#else +#define yylineno template_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -103,10 +343,16 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ +/* begin standard C++ headers. */ + /* TODO: this is always defined, so inline it */ #define yyconst const @@ -119,32 +365,26 @@ typedef unsigned int flex_uint32_t; /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE template_restart(template_in ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -174,50 +414,49 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int template_leng; +extern int yyleng; -extern FILE *template_in, *template_out; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE template_lex. + * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-template_lineno scanner, because yy_act is + * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ - for ( yyl = n; yyl < template_leng; ++yyl )\ - if ( template_text[yyl] == '\n' )\ - --template_lineno;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ }while(0) #define YY_LINENO_REWIND_TO(dst) \ do {\ const char *p;\ for ( p = yy_cp-1; p >= (dst); --p)\ if ( *p == '\n' )\ - --template_lineno;\ + --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up template_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up template_text again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -260,7 +499,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -277,8 +516,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via template_restart()), so that the user can continue scanning by - * just pointing template_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -299,106 +538,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when template_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int template_leng; +int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow template_wrap()'s to do buffer switches - * instead of setting up a fresh template_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void template_restart (FILE *input_file ); -void template__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE template__create_buffer (FILE *file,int size ); -void template__delete_buffer (YY_BUFFER_STATE b ); -void template__flush_buffer (YY_BUFFER_STATE b ); -void template_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void template_pop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void template_ensure_buffer_stack (void ); -static void template__load_buffer_state (void ); -static void template__init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER template__flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE template__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE template__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE template__scan_bytes (yyconst char *bytes,int len ); - -void *template_alloc (yy_size_t ); -void *template_realloc (void *,yy_size_t ); -void template_free (void * ); - -#define yy_new_buffer template__create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - template_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - template__create_buffer(template_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - template_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - template__create_buffer(template_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *template_in = NULL, *template_out = NULL; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int template_lineno; +extern int yylineno; +int yylineno = 1; -int template_lineno = 1; - -extern char *template_text; +extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif -#define yytext_ptr template_text +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yynoreturn yy_fatal_error (yyconst char* msg ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up template_text. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - template_leng = (int) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 12 #define YY_END_OF_BUFFER 13 /* This struct is not used in this scanner, @@ -408,7 +639,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[69] = +static const flex_int16_t yy_accept[69] = { 0, 0, 0, 0, 0, 13, 12, 2, 2, 12, 6, 3, 4, 7, 11, 12, 11, 12, 8, 12, 2, @@ -419,7 +650,7 @@ static yyconst flex_int16_t yy_accept[69] = 9, 9, 9, 9, 9, 9, 9, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -451,13 +682,13 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[13] = +static const YY_CHAR yy_meta[13] = { 0, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_uint16_t yy_base[77] = +static const flex_int16_t yy_base[77] = { 0, 0, 0, 12, 0, 70, 196, 23, 34, 65, 0, 60, 45, 0, 48, 59, 71, 54, 82, 53, 0, @@ -469,7 +700,7 @@ static yyconst flex_uint16_t yy_base[77] = 180, 183, 185, 187, 190, 192 } ; -static yyconst flex_int16_t yy_def[77] = +static const flex_int16_t yy_def[77] = { 0, 68, 1, 68, 3, 68, 68, 68, 68, 69, 70, 68, 68, 71, 68, 72, 68, 72, 72, 72, 7, @@ -481,7 +712,7 @@ static yyconst flex_int16_t yy_def[77] = 68, 68, 68, 68, 68, 68 } ; -static yyconst flex_uint16_t yy_nxt[209] = +static const flex_int16_t yy_nxt[209] = { 0, 6, 7, 8, 6, 9, 10, 11, 12, 6, 6, 6, 13, 14, 15, 6, 16, 17, 17, 14, 17, @@ -508,7 +739,7 @@ static yyconst flex_uint16_t yy_nxt[209] = 68, 68, 68, 68, 68, 68, 68, 68 } ; -static yyconst flex_int16_t yy_chk[209] = +static const flex_int16_t yy_chk[209] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, @@ -536,15 +767,15 @@ static yyconst flex_int16_t yy_chk[209] = } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[13] = +static const flex_int32_t yy_rule_can_match_eol[13] = { 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int template__flex_debug; -int template__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -553,7 +784,7 @@ int template__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *template_text; +char *yytext; #line 1 "template_parser.l" /* -------------------------------------------------------------------------- */ /* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */ @@ -584,11 +815,12 @@ char *template_text; #define YY_DECL int template_lex (YYSTYPE *lvalp, YYLTYPE *llocp, \ mem_collector *mc) -#define YY_USER_ACTION llocp->first_line = template_lineno; \ +#define YY_USER_ACTION llocp->first_line = yylineno; \ llocp->first_column = llocp->last_column; \ - llocp->last_column += template_leng; + llocp->last_column += yyleng; +#line 821 "template_parser.c" -#line 592 "template_parser.c" +#line 823 "template_parser.c" #define INITIAL 0 #define VALUE 1 @@ -605,36 +837,36 @@ char *template_text; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int template_lex_destroy (void ); +int yylex_destroy ( void ); -int template_get_debug (void ); +int yyget_debug ( void ); -void template_set_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE template_get_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void template_set_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *template_get_in (void ); +FILE *yyget_in ( void ); -void template_set_in (FILE * _in_str ); +void yyset_in ( FILE * _in_str ); -FILE *template_get_out (void ); +FILE *yyget_out ( void ); -void template_set_out (FILE * _out_str ); +void yyset_out ( FILE * _out_str ); - int template_get_leng (void ); + int yyget_leng ( void ); -char *template_get_text (void ); +char *yyget_text ( void ); -int template_get_lineno (void ); +int yyget_lineno ( void ); -void template_set_lineno (int _line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -642,9 +874,9 @@ void template_set_lineno (int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int template_wrap (void ); +extern "C" int yywrap ( void ); #else -extern int template_wrap (void ); +extern int yywrap ( void ); #endif #endif @@ -653,19 +885,18 @@ extern int template_wrap (void ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif @@ -685,7 +916,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( template_text, (size_t) template_leng, 1, template_out )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -696,20 +927,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( template_in )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( template_in ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, max_size, template_in))==0 && ferror(template_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -717,7 +948,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(template_in); \ + clearerr(yyin); \ } \ }\ \ @@ -750,12 +981,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int template_lex (void); +extern int yylex (void); -#define YY_DECL int template_lex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after template_text and template_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -789,35 +1020,36 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! template_in ) - template_in = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! template_out ) - template_out = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - template_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - template__create_buffer(template_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - template__load_buffer_state( ); + yy_load_buffer_state( ); } { #line 46 "template_parser.l" +#line 49 "template_parser.l" /* ------------------------------------------------------------------------- */ /* Comments (lines with an starting #), and empty lines */ /* ------------------------------------------------------------------------- */ -#line 815 "template_parser.c" +#line 1046 "template_parser.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of template_text. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -839,9 +1071,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 69 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 196 ); @@ -859,11 +1091,11 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; - for ( yyl = 0; yyl < template_leng; ++yyl ) - if ( template_text[yyl] == '\n' ) - - template_lineno++; + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; ; } @@ -881,13 +1113,13 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 51 "template_parser.l" +#line 52 "template_parser.l" ; YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 52 "template_parser.l" +#line 53 "template_parser.l" ; YY_BREAK /* ------------------------------------------------------------------------- */ @@ -895,8 +1127,8 @@ YY_RULE_SETUP /* ------------------------------------------------------------------------- */ case 3: YY_RULE_SETUP -#line 57 "template_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,template_text); +#line 58 "template_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext); return VARIABLE; } YY_BREAK /* ------------------------------------------------------------------------ */ @@ -906,31 +1138,31 @@ YY_RULE_SETUP /* ------------------------------------------------------------------------ */ case 4: YY_RULE_SETUP -#line 65 "template_parser.l" +#line 66 "template_parser.l" { BEGIN VALUE; return EQUAL;} YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 67 "template_parser.l" +#line 68 "template_parser.l" { return EQUAL_EMPTY;} YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 69 "template_parser.l" +#line 70 "template_parser.l" { return COMMA;} YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 71 "template_parser.l" +#line 72 "template_parser.l" { return CBRACKET;} YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 73 "template_parser.l" +#line 74 "template_parser.l" { BEGIN(INITIAL); return OBRACKET;} YY_BREAK /* ------------------------------------------------------------------------ */ @@ -940,29 +1172,29 @@ YY_RULE_SETUP /* ------------------------------------------------------------------------ */ case 9: YY_RULE_SETUP -#line 81 "template_parser.l" +#line 82 "template_parser.l" { BEGIN(INITIAL); return CCDATA;} YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 83 "template_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,template_text+1); - lvalp->val_str[template_leng-2] = '\0'; +#line 84 "template_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext+1); + lvalp->val_str[yyleng-2] = '\0'; BEGIN(INITIAL); return STRING; } YY_BREAK case 11: YY_RULE_SETUP -#line 87 "template_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,template_text); +#line 88 "template_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext); BEGIN(INITIAL); return STRING;} YY_BREAK case 12: YY_RULE_SETUP -#line 89 "template_parser.l" +#line 90 "template_parser.l" ECHO; YY_BREAK -#line 966 "template_parser.c" +#line 1197 "template_parser.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(VALUE): yyterminate(); @@ -980,15 +1212,15 @@ case YY_STATE_EOF(VALUE): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed template_in at a new source and called - * template_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = template_in; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1041,11 +1273,11 @@ case YY_STATE_EOF(VALUE): { (yy_did_buffer_switch_on_eof) = 0; - if ( template_wrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * template_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1095,7 +1327,7 @@ case YY_STATE_EOF(VALUE): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of template_lex */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1108,7 +1340,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1137,7 +1369,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1173,7 +1405,8 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - template_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ @@ -1205,7 +1438,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - template_restart(template_in ); + yyrestart( yyin ); } else @@ -1219,12 +1452,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) template_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1257,9 +1493,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 69 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1285,9 +1521,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 69 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 68); return yy_is_jam ? 0 : yy_current_state; @@ -1321,7 +1557,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1338,13 +1574,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - template_restart(template_in ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( template_wrap( ) ) + if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -1364,12 +1600,12 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve template_text */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) - - template_lineno++; + + yylineno++; ; return c; @@ -1381,32 +1617,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void template_restart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - template_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - template__create_buffer(template_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - template__init_buffer(YY_CURRENT_BUFFER,input_file ); - template__load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void template__switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * template_pop_buffer_state(); - * template_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - template_ensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1419,21 +1655,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - template__load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (template_wrap()) processing, but the only time this flag - * is looked at is after template_wrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void template__load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - template_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -1443,35 +1679,35 @@ static void template__load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE template__create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) template_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in template__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) template_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in template__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - template__init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with template__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void template__delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -1481,27 +1717,27 @@ static void template__load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - template_free((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - template_free((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a template_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void template__init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - template__flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then template__init_buffer was _probably_ - * called from template_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1518,7 +1754,7 @@ static void template__load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void template__flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -1538,7 +1774,7 @@ static void template__load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - template__load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1547,14 +1783,14 @@ static void template__load_buffer_state (void) * @param new_buffer The new state. * */ -void template_push_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - template_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from template__switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1568,8 +1804,8 @@ void template_push_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from template__switch_to_buffer. */ - template__load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1577,18 +1813,18 @@ void template_push_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void template_pop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - template__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - template__load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1596,9 +1832,9 @@ void template_pop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void template_ensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -1607,14 +1843,14 @@ static void template_ensure_buffer_stack (void) * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)template_alloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in template_ensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1626,12 +1862,12 @@ static void template_ensure_buffer_stack (void) yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)template_realloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in template_ensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1643,9 +1879,9 @@ static void template_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE template__scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -1655,11 +1891,11 @@ YY_BUFFER_STATE template__scan_buffer (char * base, yy_size_t size ) /* They forgot to leave room for the EOB's. */ return NULL; - b = (YY_BUFFER_STATE) template_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in template__scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; @@ -1669,53 +1905,53 @@ YY_BUFFER_STATE template__scan_buffer (char * base, yy_size_t size ) b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - template__switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to template_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * template__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE template__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return template__scan_bytes(yystr,(int) strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to template_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE template__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) _yybytes_len + 2; - buf = (char *) template_alloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in template__scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = template__scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in template__scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -1729,9 +1965,9 @@ YY_BUFFER_STATE template__scan_bytes (yyconst char * yybytes, int _yybytes_len #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1741,14 +1977,14 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up template_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - template_text[template_leng] = (yy_hold_char); \ - (yy_c_buf_p) = template_text + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - template_leng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -1757,89 +1993,89 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int template_get_lineno (void) +int yyget_lineno (void) { - - return template_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE *template_get_in (void) +FILE *yyget_in (void) { - return template_in; + return yyin; } /** Get the output stream. * */ -FILE *template_get_out (void) +FILE *yyget_out (void) { - return template_out; + return yyout; } /** Get the length of the current token. * */ -int template_get_leng (void) +int yyget_leng (void) { - return template_leng; + return yyleng; } /** Get the current token. * */ -char *template_get_text (void) +char *yyget_text (void) { - return template_text; + return yytext; } /** Set the current line number. * @param _line_number line number * */ -void template_set_lineno (int _line_number ) +void yyset_lineno (int _line_number ) { - template_lineno = _line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * - * @see template__switch_to_buffer + * @see yy_switch_to_buffer */ -void template_set_in (FILE * _in_str ) +void yyset_in (FILE * _in_str ) { - template_in = _in_str ; + yyin = _in_str ; } -void template_set_out (FILE * _out_str ) +void yyset_out (FILE * _out_str ) { - template_out = _out_str ; + yyout = _out_str ; } -int template_get_debug (void) +int yyget_debug (void) { - return template__flex_debug; + return yy_flex_debug; } -void template_set_debug (int _bdebug ) +void yyset_debug (int _bdebug ) { - template__flex_debug = _bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from template_lex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - /* We do not touch template_lineno unless the option is enabled. */ - template_lineno = 1; + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; @@ -1850,36 +2086,36 @@ static int yy_init_globals (void) /* Defined in main.c */ #ifdef YY_STDINIT - template_in = stdin; - template_out = stdout; + yyin = stdin; + yyout = stdout; #else - template_in = NULL; - template_out = NULL; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * template_lex_init() + * yylex_init() */ return 0; } -/* template_lex_destroy is for both reentrant and non-reentrant scanners. */ -int template_lex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - template__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - template_pop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - template_free((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * template_lex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -1890,7 +2126,7 @@ int template_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; @@ -1900,7 +2136,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) @@ -1910,12 +2146,12 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *template_alloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { return malloc(size); } -void *template_realloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both @@ -1928,15 +2164,14 @@ void *template_realloc (void * ptr, yy_size_t size ) return realloc(ptr, size); } -void template_free (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see template_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 89 "template_parser.l" - +#line 90 "template_parser.l" int template_wrap() diff --git a/src/template/template_syntax.cc b/src/template/template_syntax.cc index 757b10c671..f138c8dc48 100644 --- a/src/template/template_syntax.cc +++ b/src/template/template_syntax.cc @@ -449,16 +449,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 15 +#define YYLAST 16 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 11 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 5 /* YYNRULES -- Number of rules. */ -#define YYNRULES 11 +#define YYNRULES 12 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 21 +#define YYNSTATES 22 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -505,8 +505,8 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 94, 94, 95, 98, 99, 102, 112, 125, 135, - 141, 154 + 0, 94, 94, 95, 98, 99, 102, 112, 125, 134, + 144, 150, 163 }; #endif @@ -531,10 +531,10 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -9 +#define YYPACT_NINF -6 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-9))) + (!!((Yystate) == (-6))) #define YYTABLE_NINF -1 @@ -545,9 +545,9 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -8, -2, 7, -8, -9, -5, -9, -9, -9, -1, - -9, -9, 8, 2, 1, 3, -9, -9, 9, 5, - -9 + 0, -2, 8, 0, -6, -5, -6, -6, -6, -4, + -6, -6, -6, 9, 3, 2, 4, -6, -6, 10, + 6, -6 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -555,21 +555,21 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 0, 3, 4, 0, 8, 1, 5, 0, - 9, 6, 0, 0, 0, 0, 7, 10, 0, 0, - 11 + 2, 0, 0, 3, 4, 0, 9, 1, 5, 0, + 10, 6, 8, 0, 0, 0, 0, 7, 11, 0, + 0, 12 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -9, -9, -9, 12, -9 + -6, -6, -6, 13, -6 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 2, 3, 4, 13 + -1, 2, 3, 4, 14 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -577,14 +577,14 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 9, 5, 1, 10, 11, 6, 15, 7, 16, 12, - 17, 14, 19, 18, 20, 8 + 9, 5, 12, 10, 11, 6, 13, 16, 7, 17, + 1, 18, 15, 20, 19, 21, 8 }; static const yytype_uint8 yycheck[] = { - 5, 3, 10, 8, 9, 7, 4, 0, 6, 10, - 9, 3, 3, 10, 9, 3 + 5, 3, 6, 8, 9, 7, 10, 4, 0, 6, + 10, 9, 3, 3, 10, 9, 3 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -592,22 +592,22 @@ static const yytype_uint8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 10, 12, 13, 14, 3, 7, 0, 14, 5, - 8, 9, 10, 15, 3, 4, 6, 9, 10, 3, - 9 + 8, 9, 6, 10, 15, 3, 4, 6, 9, 10, + 3, 9 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 11, 12, 12, 13, 13, 14, 14, 14, 14, - 15, 15 + 14, 15, 15 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 0, 1, 1, 2, 3, 5, 2, 3, - 3, 5 + 0, 2, 0, 1, 1, 2, 3, 5, 4, 2, + 3, 3, 5 }; @@ -1421,6 +1421,19 @@ yyreduce: case 8: #line 126 "template_syntax.y" /* yacc.c:1646 */ + { + Attribute * pattr; + string name((yyvsp[-3].val_str)); + + pattr = new VectorAttribute(name); + + tmpl->set(pattr); + } +#line 1433 "template_syntax.cc" /* yacc.c:1646 */ + break; + + case 9: +#line 135 "template_syntax.y" /* yacc.c:1646 */ { Attribute * pattr; string name((yyvsp[-1].val_str)); @@ -1430,19 +1443,19 @@ yyreduce: tmpl->set(pattr); } -#line 1434 "template_syntax.cc" /* yacc.c:1646 */ - break; - - case 9: -#line 136 "template_syntax.y" /* yacc.c:1646 */ - { - YYABORT; - } -#line 1442 "template_syntax.cc" /* yacc.c:1646 */ +#line 1447 "template_syntax.cc" /* yacc.c:1646 */ break; case 10: -#line 142 "template_syntax.y" /* yacc.c:1646 */ +#line 145 "template_syntax.y" /* yacc.c:1646 */ + { + YYABORT; + } +#line 1455 "template_syntax.cc" /* yacc.c:1646 */ + break; + + case 11: +#line 151 "template_syntax.y" /* yacc.c:1646 */ { map* vattr; string name((yyvsp[-2].val_str)); @@ -1455,11 +1468,11 @@ yyreduce: (yyval.val_attr) = static_cast(vattr); } -#line 1459 "template_syntax.cc" /* yacc.c:1646 */ +#line 1472 "template_syntax.cc" /* yacc.c:1646 */ break; - case 11: -#line 155 "template_syntax.y" /* yacc.c:1646 */ + case 12: +#line 164 "template_syntax.y" /* yacc.c:1646 */ { string name((yyvsp[-2].val_str)); string value((yyvsp[0].val_str)); @@ -1472,11 +1485,11 @@ yyreduce: attrmap->insert(make_pair(name,unescape(value))); (yyval.val_attr) = (yyvsp[-4].val_attr); } -#line 1476 "template_syntax.cc" /* yacc.c:1646 */ +#line 1489 "template_syntax.cc" /* yacc.c:1646 */ break; -#line 1480 "template_syntax.cc" /* yacc.c:1646 */ +#line 1493 "template_syntax.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1711,7 +1724,7 @@ yyreturn: #endif return yyresult; } -#line 168 "template_syntax.y" /* yacc.c:1906 */ +#line 177 "template_syntax.y" /* yacc.c:1906 */ string& unescape (string &str) diff --git a/src/template/template_syntax.y b/src/template/template_syntax.y index b9244b5b56..3795f9425e 100644 --- a/src/template/template_syntax.y +++ b/src/template/template_syntax.y @@ -122,6 +122,15 @@ attribute: VARIABLE EQUAL STRING delete amap; } + | VARIABLE EQUAL OBRACKET CBRACKET + { + Attribute * pattr; + string name($1); + + pattr = new VectorAttribute(name); + + tmpl->set(pattr); + } | VARIABLE EQUAL_EMPTY { Attribute * pattr; From 34db8f3b4eff1ca7dd42979ff44672c6a4c0d467 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 17 Oct 2017 16:15:34 +0200 Subject: [PATCH 03/16] B #5460: onedb purge-size check seq number (cherry picked from commit 23fe16454e700c4df1172130139b94bec435d7ed) --- src/onedb/onedb_live.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/onedb/onedb_live.rb b/src/onedb/onedb_live.rb index 13d6ec236f..67c030f206 100644 --- a/src/onedb/onedb_live.rb +++ b/src/onedb/onedb_live.rb @@ -147,7 +147,10 @@ class OneDBLive history_num = 2 - if Array === val_history && val_history.size > history_num + val_history = [val_history].flatten + last_seq = val_history.last['SEQ'].to_i rescue 0 + + if last_seq >= history_num last_history = val_history.last(history_num) old_seq = [] @@ -178,6 +181,8 @@ class OneDBLive # Renumerate sequence numbers old_seq.each_with_index do |seq, index| row = history.find {|r| seq.to_s == r["seq"] } + next if !row + body = Base64.decode64(row['body64']) doc = Nokogiri::XML(body) From 90c0978de2f9433b480d3da8a3648f84cb419b9e Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 17 Oct 2017 17:41:16 +0200 Subject: [PATCH 04/16] Use system path to build jar files --- src/oca/java/build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/oca/java/build.sh b/src/oca/java/build.sh index 1b21a8e7be..9a7adc6b76 100755 --- a/src/oca/java/build.sh +++ b/src/oca/java/build.sh @@ -23,7 +23,7 @@ DOC_DIR="./share/doc" BIN_DIR="./bin" JAR_DIR="./jar" -LIB_DIR="./lib" +LIB_DIR="/usr/share/java" EXA_DIR="./share/examples" OCA_JAR=$JAR_DIR"/org.opennebula.client.jar" @@ -149,7 +149,6 @@ if [ "$DO_PACKAGE" = "yes" ] ; then mkdir $PACK_NAME cp -r share/doc $PACK_NAME cp -r jar $PACK_NAME - cp -r lib $PACK_NAME tar czf $PACK_NAME.tar.gz $PACK_NAME From a94124700ea00d6dcb914cd6f36c105b1b567d83 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 17 Oct 2017 16:30:22 +0200 Subject: [PATCH 05/16] Get rid of deprecated options for yacc --- src/template/template_syntax.y | 6 +- src/vm/vm_file_var_syntax.y | 6 +- src/vm/vm_var_parser.c | 822 ++++++++++++++++++++----------- src/vm/vm_var_syntax.y | 6 +- src/xml/expr_arith.y | 6 +- src/xml/expr_bool.y | 6 +- src/xml/expr_parser.c | 864 +++++++++++++++++++++------------ 7 files changed, 1085 insertions(+), 631 deletions(-) diff --git a/src/template/template_syntax.y b/src/template/template_syntax.y index 3795f9425e..d81c185444 100644 --- a/src/template/template_syntax.y +++ b/src/template/template_syntax.y @@ -78,9 +78,9 @@ extern "C" %defines %locations -%pure_parser -%name-prefix = "template__" -%output = "template_syntax.cc" +%pure-parser +%name-prefix "template__" +%output "template_syntax.cc" %token EQUAL COMMA OBRACKET CBRACKET EQUAL_EMPTY CCDATA %token STRING diff --git a/src/vm/vm_file_var_syntax.y b/src/vm/vm_file_var_syntax.y index a2905336d0..77f4aee5ad 100644 --- a/src/vm/vm_file_var_syntax.y +++ b/src/vm/vm_file_var_syntax.y @@ -215,9 +215,9 @@ int get_image_path(VirtualMachine * vm, %defines %locations -%pure_parser -%name-prefix = "vm_file_var__" -%output = "vm_file_var_syntax.cc" +%pure-parser +%name-prefix "vm_file_var__" +%output "vm_file_var_syntax.cc" %token EQUAL COMMA OBRACKET CBRACKET diff --git a/src/vm/vm_var_parser.c b/src/vm/vm_var_parser.c index 3a0e606bec..75d49df339 100644 --- a/src/vm/vm_var_parser.c +++ b/src/vm/vm_var_parser.c @@ -1,6 +1,6 @@ -#line 2 "vm_var_parser.c" +#line 1 "vm_var_parser.c" -#line 4 "vm_var_parser.c" +#line 3 "vm_var_parser.c" #define YY_INT_ALIGNED short int @@ -8,11 +8,17 @@ #define yy_create_buffer vm_var__create_buffer #define yy_delete_buffer vm_var__delete_buffer -#define yy_flex_debug vm_var__flex_debug +#define yy_scan_buffer vm_var__scan_buffer +#define yy_scan_string vm_var__scan_string +#define yy_scan_bytes vm_var__scan_bytes #define yy_init_buffer vm_var__init_buffer #define yy_flush_buffer vm_var__flush_buffer #define yy_load_buffer_state vm_var__load_buffer_state #define yy_switch_to_buffer vm_var__switch_to_buffer +#define yypush_buffer_state vm_var_push_buffer_state +#define yypop_buffer_state vm_var_pop_buffer_state +#define yyensure_buffer_stack vm_var_ensure_buffer_stack +#define yy_flex_debug vm_var__flex_debug #define yyin vm_var_in #define yyleng vm_var_leng #define yylex vm_var_lex @@ -28,11 +34,245 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 1 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define vm_var__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer vm_var__create_buffer +#endif + +#ifdef yy_delete_buffer +#define vm_var__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer vm_var__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define vm_var__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer vm_var__scan_buffer +#endif + +#ifdef yy_scan_string +#define vm_var__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string vm_var__scan_string +#endif + +#ifdef yy_scan_bytes +#define vm_var__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes vm_var__scan_bytes +#endif + +#ifdef yy_init_buffer +#define vm_var__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer vm_var__init_buffer +#endif + +#ifdef yy_flush_buffer +#define vm_var__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer vm_var__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define vm_var__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state vm_var__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define vm_var__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer vm_var__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define vm_var_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state vm_var_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define vm_var_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state vm_var_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define vm_var_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack vm_var_ensure_buffer_stack +#endif + +#ifdef yylex +#define vm_var_lex_ALREADY_DEFINED +#else +#define yylex vm_var_lex +#endif + +#ifdef yyrestart +#define vm_var_restart_ALREADY_DEFINED +#else +#define yyrestart vm_var_restart +#endif + +#ifdef yylex_init +#define vm_var_lex_init_ALREADY_DEFINED +#else +#define yylex_init vm_var_lex_init +#endif + +#ifdef yylex_init_extra +#define vm_var_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra vm_var_lex_init_extra +#endif + +#ifdef yylex_destroy +#define vm_var_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy vm_var_lex_destroy +#endif + +#ifdef yyget_debug +#define vm_var_get_debug_ALREADY_DEFINED +#else +#define yyget_debug vm_var_get_debug +#endif + +#ifdef yyset_debug +#define vm_var_set_debug_ALREADY_DEFINED +#else +#define yyset_debug vm_var_set_debug +#endif + +#ifdef yyget_extra +#define vm_var_get_extra_ALREADY_DEFINED +#else +#define yyget_extra vm_var_get_extra +#endif + +#ifdef yyset_extra +#define vm_var_set_extra_ALREADY_DEFINED +#else +#define yyset_extra vm_var_set_extra +#endif + +#ifdef yyget_in +#define vm_var_get_in_ALREADY_DEFINED +#else +#define yyget_in vm_var_get_in +#endif + +#ifdef yyset_in +#define vm_var_set_in_ALREADY_DEFINED +#else +#define yyset_in vm_var_set_in +#endif + +#ifdef yyget_out +#define vm_var_get_out_ALREADY_DEFINED +#else +#define yyget_out vm_var_get_out +#endif + +#ifdef yyset_out +#define vm_var_set_out_ALREADY_DEFINED +#else +#define yyset_out vm_var_set_out +#endif + +#ifdef yyget_leng +#define vm_var_get_leng_ALREADY_DEFINED +#else +#define yyget_leng vm_var_get_leng +#endif + +#ifdef yyget_text +#define vm_var_get_text_ALREADY_DEFINED +#else +#define yyget_text vm_var_get_text +#endif + +#ifdef yyget_lineno +#define vm_var_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno vm_var_get_lineno +#endif + +#ifdef yyset_lineno +#define vm_var_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno vm_var_set_lineno +#endif + +#ifdef yywrap +#define vm_var_wrap_ALREADY_DEFINED +#else +#define yywrap vm_var_wrap +#endif + +#ifdef yyalloc +#define vm_var_alloc_ALREADY_DEFINED +#else +#define yyalloc vm_var_alloc +#endif + +#ifdef yyrealloc +#define vm_var_realloc_ALREADY_DEFINED +#else +#define yyrealloc vm_var_realloc +#endif + +#ifdef yyfree +#define vm_var_free_ALREADY_DEFINED +#else +#define yyfree vm_var_free +#endif + +#ifdef yytext +#define vm_var_text_ALREADY_DEFINED +#else +#define yytext vm_var_text +#endif + +#ifdef yyleng +#define vm_var_leng_ALREADY_DEFINED +#else +#define yyleng vm_var_leng +#endif + +#ifdef yyin +#define vm_var_in_ALREADY_DEFINED +#else +#define yyin vm_var_in +#endif + +#ifdef yyout +#define vm_var_out_ALREADY_DEFINED +#else +#define yyout vm_var_out +#endif + +#ifdef yy_flex_debug +#define vm_var__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug vm_var__flex_debug +#endif + +#ifdef yylineno +#define vm_var_lineno_ALREADY_DEFINED +#else +#define yylineno vm_var_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -103,10 +343,16 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ +/* begin standard C++ headers. */ + /* TODO: this is always defined, so inline it */ #define yyconst const @@ -119,32 +365,26 @@ typedef unsigned int flex_uint32_t; /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE vm_var_restart(vm_var_in ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -174,50 +414,49 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int vm_var_leng; +extern int yyleng; -extern FILE *vm_var_in, *vm_var_out; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE vm_var_lex. + * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-vm_var_lineno scanner, because yy_act is + * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ - for ( yyl = n; yyl < vm_var_leng; ++yyl )\ - if ( vm_var_text[yyl] == '\n' )\ - --vm_var_lineno;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ }while(0) #define YY_LINENO_REWIND_TO(dst) \ do {\ const char *p;\ for ( p = yy_cp-1; p >= (dst); --p)\ if ( *p == '\n' )\ - --vm_var_lineno;\ + --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up vm_var_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up vm_var_text again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -260,7 +499,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -277,8 +516,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via vm_var_restart()), so that the user can continue scanning by - * just pointing vm_var_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -299,106 +538,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when vm_var_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int vm_var_leng; +int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow vm_var_wrap()'s to do buffer switches - * instead of setting up a fresh vm_var_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void vm_var_restart (FILE *input_file ); -void vm_var__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE vm_var__create_buffer (FILE *file,int size ); -void vm_var__delete_buffer (YY_BUFFER_STATE b ); -void vm_var__flush_buffer (YY_BUFFER_STATE b ); -void vm_var_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void vm_var_pop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void vm_var_ensure_buffer_stack (void ); -static void vm_var__load_buffer_state (void ); -static void vm_var__init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER vm_var__flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE vm_var__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE vm_var__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE vm_var__scan_bytes (yyconst char *bytes,int len ); - -void *vm_var_alloc (yy_size_t ); -void *vm_var_realloc (void *,yy_size_t ); -void vm_var_free (void * ); - -#define yy_new_buffer vm_var__create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - vm_var_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - vm_var__create_buffer(vm_var_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - vm_var_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - vm_var__create_buffer(vm_var_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *vm_var_in = NULL, *vm_var_out = NULL; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int vm_var_lineno; +extern int yylineno; +int yylineno = 1; -int vm_var_lineno = 1; - -extern char *vm_var_text; +extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif -#define yytext_ptr vm_var_text +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yynoreturn yy_fatal_error (yyconst char* msg ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up vm_var_text. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - vm_var_leng = (int) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 12 #define YY_END_OF_BUFFER 13 /* This struct is not used in this scanner, @@ -408,7 +639,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[34] = +static const flex_int16_t yy_accept[34] = { 0, 0, 0, 0, 0, 0, 0, 13, 11, 1, 10, 10, 12, 9, 3, 6, 2, 4, 5, 12, 8, @@ -416,7 +647,7 @@ static yyconst flex_int16_t yy_accept[34] = 7, 8, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -448,13 +679,13 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[12] = +static const YY_CHAR yy_meta[12] = { 0, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 3 } ; -static yyconst flex_uint16_t yy_base[39] = +static const flex_int16_t yy_base[39] = { 0, 41, 40, 0, 0, 8, 12, 44, 0, 47, 47, 18, 47, 47, 41, 0, 40, 39, 47, 32, 20, @@ -462,7 +693,7 @@ static yyconst flex_uint16_t yy_base[39] = 47, 7, 47, 28, 31, 34, 10, 37 } ; -static yyconst flex_int16_t yy_def[39] = +static const flex_int16_t yy_def[39] = { 0, 34, 34, 33, 3, 35, 35, 33, 36, 33, 33, 33, 33, 33, 33, 37, 33, 33, 33, 38, 33, @@ -470,7 +701,7 @@ static yyconst flex_int16_t yy_def[39] = 33, 33, 0, 33, 33, 33, 33, 33 } ; -static yyconst flex_uint16_t yy_nxt[59] = +static const flex_int16_t yy_nxt[59] = { 0, 10, 11, 12, 10, 13, 14, 15, 16, 17, 18, 15, 19, 27, 32, 20, 19, 31, 29, 20, 22, @@ -480,7 +711,7 @@ static yyconst flex_uint16_t yy_nxt[59] = 33, 33, 33, 33, 33, 33, 33, 33 } ; -static yyconst flex_int16_t yy_chk[59] = +static const flex_int16_t yy_chk[59] = { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 37, 32, 5, 6, 30, 29, 6, 11, @@ -491,15 +722,15 @@ static yyconst flex_int16_t yy_chk[59] = } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[13] = +static const flex_int32_t yy_rule_can_match_eol[13] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int vm_var__flex_debug; -int vm_var__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -508,7 +739,7 @@ int vm_var__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *vm_var_text; +char *yytext; #line 1 "vm_var_parser.l" /* -------------------------------------------------------------------------- */ /* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */ @@ -539,12 +770,12 @@ char *vm_var_text; #define YY_DECL int vm_var_lex (YYSTYPE *lvalp, YYLTYPE *llocp, \ mem_collector *mc) -#define YY_USER_ACTION llocp->first_line = vm_var_lineno; \ +#define YY_USER_ACTION llocp->first_line = yylineno; \ llocp->first_column = llocp->last_column; \ - llocp->last_column += vm_var_leng; + llocp->last_column += yyleng; +#line 776 "vm_var_parser.c" - -#line 548 "vm_var_parser.c" +#line 778 "vm_var_parser.c" #define INITIAL 0 #define VAR 1 @@ -562,36 +793,36 @@ char *vm_var_text; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int vm_var_lex_destroy (void ); +int yylex_destroy ( void ); -int vm_var_get_debug (void ); +int yyget_debug ( void ); -void vm_var_set_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE vm_var_get_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void vm_var_set_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *vm_var_get_in (void ); +FILE *yyget_in ( void ); -void vm_var_set_in (FILE * _in_str ); +void yyset_in ( FILE * _in_str ); -FILE *vm_var_get_out (void ); +FILE *yyget_out ( void ); -void vm_var_set_out (FILE * _out_str ); +void yyset_out ( FILE * _out_str ); - int vm_var_get_leng (void ); + int yyget_leng ( void ); -char *vm_var_get_text (void ); +char *yyget_text ( void ); -int vm_var_get_lineno (void ); +int yyget_lineno ( void ); -void vm_var_set_lineno (int _line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -599,9 +830,9 @@ void vm_var_set_lineno (int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int vm_var_wrap (void ); +extern "C" int yywrap ( void ); #else -extern int vm_var_wrap (void ); +extern int yywrap ( void ); #endif #endif @@ -610,19 +841,18 @@ extern int vm_var_wrap (void ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif @@ -642,7 +872,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( vm_var_text, (size_t) vm_var_leng, 1, vm_var_out )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -653,20 +883,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( vm_var_in )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( vm_var_in ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, max_size, vm_var_in))==0 && ferror(vm_var_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -674,7 +904,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(vm_var_in); \ + clearerr(yyin); \ } \ }\ \ @@ -707,12 +937,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int vm_var_lex (void); +extern int yylex (void); -#define YY_DECL int vm_var_lex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after vm_var_text and vm_var_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -746,25 +976,26 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! vm_var_in ) - vm_var_in = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! vm_var_out ) - vm_var_out = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - vm_var_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - vm_var__create_buffer(vm_var_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - vm_var__load_buffer_state( ); + yy_load_buffer_state( ); } { #line 43 "vm_var_parser.l" +#line 46 "vm_var_parser.l" /* ------------------------------------------------------------------------- */ /* Parse variables in the form: */ /* $VARIABLE */ @@ -773,13 +1004,13 @@ YY_DECL /* $NUM.CONTEXT_VARIABLE */ /* ------------------------------------------------------------------------- */ -#line 777 "vm_var_parser.c" +#line 1007 "vm_var_parser.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of vm_var_text. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -801,9 +1032,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 34 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 47 ); @@ -821,11 +1052,11 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; - for ( yyl = 0; yyl < vm_var_leng; ++yyl ) - if ( vm_var_text[yyl] == '\n' ) - - vm_var_lineno++; + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; ; } @@ -842,69 +1073,69 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 53 "vm_var_parser.l" +#line 54 "vm_var_parser.l" { BEGIN VAR;} YY_BREAK case 2: YY_RULE_SETUP -#line 55 "vm_var_parser.l" +#line 56 "vm_var_parser.l" { BEGIN VALUE; return EQUAL; } YY_BREAK case 3: YY_RULE_SETUP -#line 56 "vm_var_parser.l" +#line 57 "vm_var_parser.l" { return COMMA;} YY_BREAK case 4: YY_RULE_SETUP -#line 57 "vm_var_parser.l" +#line 58 "vm_var_parser.l" { return OBRACKET;} YY_BREAK case 5: YY_RULE_SETUP -#line 58 "vm_var_parser.l" +#line 59 "vm_var_parser.l" { return CBRACKET;} YY_BREAK case 6: YY_RULE_SETUP -#line 60 "vm_var_parser.l" +#line 61 "vm_var_parser.l" { lvalp->val_str = - mem_collector_strdup(mc,vm_var_text); + mem_collector_strdup(mc,yytext); return VARIABLE;} YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 64 "vm_var_parser.l" +#line 65 "vm_var_parser.l" { lvalp->val_str = - mem_collector_strdup(mc,vm_var_text+1); - lvalp->val_str[vm_var_leng-2] = '\0'; + mem_collector_strdup(mc,yytext+1); + lvalp->val_str[yyleng-2] = '\0'; BEGIN(VAR); return STRING;} YY_BREAK case 8: YY_RULE_SETUP -#line 70 "vm_var_parser.l" +#line 71 "vm_var_parser.l" { lvalp->val_str = - mem_collector_strdup(mc,vm_var_text); + mem_collector_strdup(mc,yytext); BEGIN(VAR); return STRING;} YY_BREAK case 9: YY_RULE_SETUP -#line 75 "vm_var_parser.l" +#line 76 "vm_var_parser.l" { lvalp->val_char = '\0'; return EOA;} YY_BREAK case 10: YY_RULE_SETUP -#line 78 "vm_var_parser.l" -{ lvalp->val_char = *vm_var_text; +#line 79 "vm_var_parser.l" +{ lvalp->val_char = *yytext; BEGIN(INITIAL); return EOA;} YY_BREAK case YY_STATE_EOF(VAR): -#line 82 "vm_var_parser.l" +#line 83 "vm_var_parser.l" { lvalp->val_char = '\0'; BEGIN(INITIAL); return EOA;} @@ -915,15 +1146,15 @@ case YY_STATE_EOF(VAR): case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 90 "vm_var_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,vm_var_text); return RSTRING;} +#line 91 "vm_var_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext); return RSTRING;} YY_BREAK case 12: YY_RULE_SETUP -#line 92 "vm_var_parser.l" +#line 93 "vm_var_parser.l" ECHO; YY_BREAK -#line 927 "vm_var_parser.c" +#line 1157 "vm_var_parser.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(VALUE): yyterminate(); @@ -941,15 +1172,15 @@ case YY_STATE_EOF(VALUE): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed vm_var_in at a new source and called - * vm_var_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = vm_var_in; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1002,11 +1233,11 @@ case YY_STATE_EOF(VALUE): { (yy_did_buffer_switch_on_eof) = 0; - if ( vm_var_wrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * vm_var_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1056,7 +1287,7 @@ case YY_STATE_EOF(VALUE): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of vm_var_lex */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1069,7 +1300,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1098,7 +1329,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1134,7 +1365,8 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - vm_var_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ @@ -1166,7 +1398,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - vm_var_restart(vm_var_in ); + yyrestart( yyin ); } else @@ -1180,12 +1412,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) vm_var_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1218,9 +1453,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 34 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1246,9 +1481,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 34 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 33); return yy_is_jam ? 0 : yy_current_state; @@ -1282,7 +1517,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1299,13 +1534,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - vm_var_restart(vm_var_in ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( vm_var_wrap( ) ) + if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -1325,12 +1560,12 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve vm_var_text */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) - - vm_var_lineno++; + + yylineno++; ; return c; @@ -1342,32 +1577,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void vm_var_restart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - vm_var_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - vm_var__create_buffer(vm_var_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - vm_var__init_buffer(YY_CURRENT_BUFFER,input_file ); - vm_var__load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void vm_var__switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * vm_var_pop_buffer_state(); - * vm_var_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - vm_var_ensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1380,21 +1615,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - vm_var__load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (vm_var_wrap()) processing, but the only time this flag - * is looked at is after vm_var_wrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void vm_var__load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - vm_var_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -1404,35 +1639,35 @@ static void vm_var__load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE vm_var__create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) vm_var_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) vm_var_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - vm_var__init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with vm_var__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void vm_var__delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -1442,27 +1677,27 @@ static void vm_var__load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - vm_var_free((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - vm_var_free((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a vm_var_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void vm_var__init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - vm_var__flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then vm_var__init_buffer was _probably_ - * called from vm_var_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1479,7 +1714,7 @@ static void vm_var__load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void vm_var__flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -1499,7 +1734,7 @@ static void vm_var__load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - vm_var__load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1508,14 +1743,14 @@ static void vm_var__load_buffer_state (void) * @param new_buffer The new state. * */ -void vm_var_push_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - vm_var_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from vm_var__switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1529,8 +1764,8 @@ void vm_var_push_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from vm_var__switch_to_buffer. */ - vm_var__load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1538,18 +1773,18 @@ void vm_var_push_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void vm_var_pop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - vm_var__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - vm_var__load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1557,9 +1792,9 @@ void vm_var_pop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void vm_var_ensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -1568,14 +1803,14 @@ static void vm_var_ensure_buffer_stack (void) * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)vm_var_alloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var_ensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1587,12 +1822,12 @@ static void vm_var_ensure_buffer_stack (void) yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)vm_var_realloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var_ensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1604,9 +1839,9 @@ static void vm_var_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE vm_var__scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -1616,11 +1851,11 @@ YY_BUFFER_STATE vm_var__scan_buffer (char * base, yy_size_t size ) /* They forgot to leave room for the EOB's. */ return NULL; - b = (YY_BUFFER_STATE) vm_var_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var__scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; @@ -1630,53 +1865,53 @@ YY_BUFFER_STATE vm_var__scan_buffer (char * base, yy_size_t size ) b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - vm_var__switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to vm_var_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * vm_var__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE vm_var__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return vm_var__scan_bytes(yystr,(int) strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to vm_var_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE vm_var__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) _yybytes_len + 2; - buf = (char *) vm_var_alloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in vm_var__scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = vm_var__scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in vm_var__scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -1690,9 +1925,9 @@ YY_BUFFER_STATE vm_var__scan_bytes (yyconst char * yybytes, int _yybytes_len ) #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1702,14 +1937,14 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up vm_var_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - vm_var_text[vm_var_leng] = (yy_hold_char); \ - (yy_c_buf_p) = vm_var_text + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - vm_var_leng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -1718,89 +1953,89 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int vm_var_get_lineno (void) +int yyget_lineno (void) { - - return vm_var_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE *vm_var_get_in (void) +FILE *yyget_in (void) { - return vm_var_in; + return yyin; } /** Get the output stream. * */ -FILE *vm_var_get_out (void) +FILE *yyget_out (void) { - return vm_var_out; + return yyout; } /** Get the length of the current token. * */ -int vm_var_get_leng (void) +int yyget_leng (void) { - return vm_var_leng; + return yyleng; } /** Get the current token. * */ -char *vm_var_get_text (void) +char *yyget_text (void) { - return vm_var_text; + return yytext; } /** Set the current line number. * @param _line_number line number * */ -void vm_var_set_lineno (int _line_number ) +void yyset_lineno (int _line_number ) { - vm_var_lineno = _line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * - * @see vm_var__switch_to_buffer + * @see yy_switch_to_buffer */ -void vm_var_set_in (FILE * _in_str ) +void yyset_in (FILE * _in_str ) { - vm_var_in = _in_str ; + yyin = _in_str ; } -void vm_var_set_out (FILE * _out_str ) +void yyset_out (FILE * _out_str ) { - vm_var_out = _out_str ; + yyout = _out_str ; } -int vm_var_get_debug (void) +int yyget_debug (void) { - return vm_var__flex_debug; + return yy_flex_debug; } -void vm_var_set_debug (int _bdebug ) +void yyset_debug (int _bdebug ) { - vm_var__flex_debug = _bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from vm_var_lex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - /* We do not touch vm_var_lineno unless the option is enabled. */ - vm_var_lineno = 1; + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; @@ -1811,36 +2046,36 @@ static int yy_init_globals (void) /* Defined in main.c */ #ifdef YY_STDINIT - vm_var_in = stdin; - vm_var_out = stdout; + yyin = stdin; + yyout = stdout; #else - vm_var_in = NULL; - vm_var_out = NULL; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * vm_var_lex_init() + * yylex_init() */ return 0; } -/* vm_var_lex_destroy is for both reentrant and non-reentrant scanners. */ -int vm_var_lex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - vm_var__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - vm_var_pop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - vm_var_free((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * vm_var_lex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -1851,7 +2086,7 @@ int vm_var_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; @@ -1861,7 +2096,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) @@ -1871,12 +2106,12 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *vm_var_alloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { return malloc(size); } -void *vm_var_realloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both @@ -1889,15 +2124,14 @@ void *vm_var_realloc (void * ptr, yy_size_t size ) return realloc(ptr, size); } -void vm_var_free (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see vm_var_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 92 "vm_var_parser.l" - +#line 93 "vm_var_parser.l" int vm_var_wrap() diff --git a/src/vm/vm_var_syntax.y b/src/vm/vm_var_syntax.y index 9261dfde7e..8d1dc9c3b0 100644 --- a/src/vm/vm_var_syntax.y +++ b/src/vm/vm_var_syntax.y @@ -413,9 +413,9 @@ void insert_vector(VirtualMachine * vm, %defines %locations -%pure_parser -%name-prefix = "vm_var__" -%output = "vm_var_syntax.cc" +%pure-parser +%name-prefix "vm_var__" +%output "vm_var_syntax.cc" %token EQUAL COMMA OBRACKET CBRACKET diff --git a/src/xml/expr_arith.y b/src/xml/expr_arith.y index 897d72287f..9210241e3f 100644 --- a/src/xml/expr_arith.y +++ b/src/xml/expr_arith.y @@ -83,9 +83,9 @@ extern "C" %defines %locations -%pure_parser -%name-prefix = "expr_arith__" -%output = "expr_arith.cc" +%pure-parser +%name-prefix "expr_arith__" +%output "expr_arith.cc" %left '+' '-' %left '*' '/' diff --git a/src/xml/expr_bool.y b/src/xml/expr_bool.y index dacb0debc5..653e74cb44 100644 --- a/src/xml/expr_bool.y +++ b/src/xml/expr_bool.y @@ -82,9 +82,9 @@ extern "C" %defines %locations -%pure_parser -%name-prefix = "expr_bool__" -%output = "expr_bool.cc" +%pure-parser +%name-prefix "expr_bool__" +%output "expr_bool.cc" %left '!' '&' '|' %token INTEGER diff --git a/src/xml/expr_parser.c b/src/xml/expr_parser.c index c1dad1c6f4..dfb1744f86 100644 --- a/src/xml/expr_parser.c +++ b/src/xml/expr_parser.c @@ -1,6 +1,6 @@ -#line 2 "expr_parser.c" +#line 1 "expr_parser.c" -#line 4 "expr_parser.c" +#line 3 "expr_parser.c" #define YY_INT_ALIGNED short int @@ -8,11 +8,17 @@ #define yy_create_buffer expr__create_buffer #define yy_delete_buffer expr__delete_buffer -#define yy_flex_debug expr__flex_debug +#define yy_scan_buffer expr__scan_buffer +#define yy_scan_string expr__scan_string +#define yy_scan_bytes expr__scan_bytes #define yy_init_buffer expr__init_buffer #define yy_flush_buffer expr__flush_buffer #define yy_load_buffer_state expr__load_buffer_state #define yy_switch_to_buffer expr__switch_to_buffer +#define yypush_buffer_state expr_push_buffer_state +#define yypop_buffer_state expr_pop_buffer_state +#define yyensure_buffer_stack expr_ensure_buffer_stack +#define yy_flex_debug expr__flex_debug #define yyin expr_in #define yyleng expr_leng #define yylex expr_lex @@ -28,11 +34,245 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define expr__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer expr__create_buffer +#endif + +#ifdef yy_delete_buffer +#define expr__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer expr__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define expr__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer expr__scan_buffer +#endif + +#ifdef yy_scan_string +#define expr__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string expr__scan_string +#endif + +#ifdef yy_scan_bytes +#define expr__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes expr__scan_bytes +#endif + +#ifdef yy_init_buffer +#define expr__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer expr__init_buffer +#endif + +#ifdef yy_flush_buffer +#define expr__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer expr__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define expr__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state expr__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define expr__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer expr__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define expr_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state expr_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define expr_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state expr_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define expr_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack expr_ensure_buffer_stack +#endif + +#ifdef yylex +#define expr_lex_ALREADY_DEFINED +#else +#define yylex expr_lex +#endif + +#ifdef yyrestart +#define expr_restart_ALREADY_DEFINED +#else +#define yyrestart expr_restart +#endif + +#ifdef yylex_init +#define expr_lex_init_ALREADY_DEFINED +#else +#define yylex_init expr_lex_init +#endif + +#ifdef yylex_init_extra +#define expr_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra expr_lex_init_extra +#endif + +#ifdef yylex_destroy +#define expr_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy expr_lex_destroy +#endif + +#ifdef yyget_debug +#define expr_get_debug_ALREADY_DEFINED +#else +#define yyget_debug expr_get_debug +#endif + +#ifdef yyset_debug +#define expr_set_debug_ALREADY_DEFINED +#else +#define yyset_debug expr_set_debug +#endif + +#ifdef yyget_extra +#define expr_get_extra_ALREADY_DEFINED +#else +#define yyget_extra expr_get_extra +#endif + +#ifdef yyset_extra +#define expr_set_extra_ALREADY_DEFINED +#else +#define yyset_extra expr_set_extra +#endif + +#ifdef yyget_in +#define expr_get_in_ALREADY_DEFINED +#else +#define yyget_in expr_get_in +#endif + +#ifdef yyset_in +#define expr_set_in_ALREADY_DEFINED +#else +#define yyset_in expr_set_in +#endif + +#ifdef yyget_out +#define expr_get_out_ALREADY_DEFINED +#else +#define yyget_out expr_get_out +#endif + +#ifdef yyset_out +#define expr_set_out_ALREADY_DEFINED +#else +#define yyset_out expr_set_out +#endif + +#ifdef yyget_leng +#define expr_get_leng_ALREADY_DEFINED +#else +#define yyget_leng expr_get_leng +#endif + +#ifdef yyget_text +#define expr_get_text_ALREADY_DEFINED +#else +#define yyget_text expr_get_text +#endif + +#ifdef yyget_lineno +#define expr_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno expr_get_lineno +#endif + +#ifdef yyset_lineno +#define expr_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno expr_set_lineno +#endif + +#ifdef yywrap +#define expr_wrap_ALREADY_DEFINED +#else +#define yywrap expr_wrap +#endif + +#ifdef yyalloc +#define expr_alloc_ALREADY_DEFINED +#else +#define yyalloc expr_alloc +#endif + +#ifdef yyrealloc +#define expr_realloc_ALREADY_DEFINED +#else +#define yyrealloc expr_realloc +#endif + +#ifdef yyfree +#define expr_free_ALREADY_DEFINED +#else +#define yyfree expr_free +#endif + +#ifdef yytext +#define expr_text_ALREADY_DEFINED +#else +#define yytext expr_text +#endif + +#ifdef yyleng +#define expr_leng_ALREADY_DEFINED +#else +#define yyleng expr_leng +#endif + +#ifdef yyin +#define expr_in_ALREADY_DEFINED +#else +#define yyin expr_in +#endif + +#ifdef yyout +#define expr_out_ALREADY_DEFINED +#else +#define yyout expr_out +#endif + +#ifdef yy_flex_debug +#define expr__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug expr__flex_debug +#endif + +#ifdef yylineno +#define expr_lineno_ALREADY_DEFINED +#else +#define yylineno expr_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -103,60 +343,48 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus +/* begin standard C++ headers. */ -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE expr_restart(expr_in ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -186,50 +414,49 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t expr_leng; +extern int yyleng; -extern FILE *expr_in, *expr_out; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE expr_lex. + * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-expr_lineno scanner, because yy_act is + * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ - for ( yyl = n; yyl < expr_leng; ++yyl )\ - if ( expr_text[yyl] == '\n' )\ - --expr_lineno;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ }while(0) #define YY_LINENO_REWIND_TO(dst) \ do {\ const char *p;\ for ( p = yy_cp-1; p >= (dst); --p)\ if ( *p == '\n' )\ - --expr_lineno;\ + --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up expr_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up expr_text again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -244,12 +471,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -272,7 +499,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -289,8 +516,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via expr_restart()), so that the user can continue scanning by - * just pointing expr_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -300,7 +527,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -311,109 +538,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when expr_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t expr_leng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow expr_wrap()'s to do buffer switches - * instead of setting up a fresh expr_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void expr_restart (FILE *input_file ); -void expr__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE expr__create_buffer (FILE *file,int size ); -void expr__delete_buffer (YY_BUFFER_STATE b ); -void expr__flush_buffer (YY_BUFFER_STATE b ); -void expr_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void expr_pop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void expr_ensure_buffer_stack (void ); -static void expr__load_buffer_state (void ); -static void expr__init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER expr__flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE expr__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE expr__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE expr__scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *expr_alloc (yy_size_t ); -void *expr_realloc (void *,yy_size_t ); -void expr_free (void * ); - -#define yy_new_buffer expr__create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - expr_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - expr__create_buffer(expr_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - expr_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - expr__create_buffer(expr_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *expr_in = (FILE *) 0, *expr_out = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int expr_lineno; +extern int yylineno; +int yylineno = 1; -int expr_lineno = 1; - -extern char *expr_text; +extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif -#define yytext_ptr expr_text +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up expr_text. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - expr_leng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 8 #define YY_END_OF_BUFFER 9 /* This struct is not used in this scanner, @@ -423,13 +639,13 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[20] = +static const flex_int16_t yy_accept[20] = { 0, 7, 7, 9, 8, 7, 1, 8, 1, 5, 2, 7, 0, 3, 5, 0, 2, 4, 6, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -461,26 +677,26 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[10] = +static const YY_CHAR yy_meta[10] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2 } ; -static yyconst flex_uint16_t yy_base[22] = +static const flex_int16_t yy_base[22] = { 0, 0, 0, 22, 23, 19, 23, 16, 12, 4, 0, 16, 13, 23, 0, 9, 0, 23, 8, 23, 11, 12 } ; -static yyconst flex_int16_t yy_def[22] = +static const flex_int16_t yy_def[22] = { 0, 19, 1, 19, 19, 19, 19, 20, 19, 19, 21, 19, 20, 19, 9, 19, 21, 19, 19, 0, 19, 19 } ; -static yyconst flex_uint16_t yy_nxt[33] = +static const flex_int16_t yy_nxt[33] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 4, 15, 14, 12, 12, 16, 18, 18, 17, 11, 14, 13, @@ -488,7 +704,7 @@ static yyconst flex_uint16_t yy_nxt[33] = 19, 19 } ; -static yyconst flex_int16_t yy_chk[33] = +static const flex_int16_t yy_chk[33] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 20, 20, 21, 18, 15, 12, 11, 8, 7, @@ -497,15 +713,15 @@ static yyconst flex_int16_t yy_chk[33] = } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[9] = +static const flex_int32_t yy_rule_can_match_eol[9] = { 0, 0, 0, 0, 1, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int expr__flex_debug; -int expr__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -514,7 +730,7 @@ int expr__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *expr_text; +char *yytext; #line 1 "expr_parser.l" /* -------------------------------------------------------------------------- */ /* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */ @@ -543,10 +759,11 @@ char *expr_text; #define YY_DECL int expr_lex (YYSTYPE *lvalp, YYLTYPE *llocp, mem_collector *mc) -#define YY_USER_ACTION llocp->first_line = expr_lineno; \ +#define YY_USER_ACTION llocp->first_line = yylineno; \ llocp->first_column = llocp->last_column; \ - llocp->last_column += expr_leng; -#line 550 "expr_parser.c" + llocp->last_column += yyleng; +#line 765 "expr_parser.c" +#line 766 "expr_parser.c" #define INITIAL 0 @@ -562,36 +779,36 @@ char *expr_text; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int expr_lex_destroy (void ); +int yylex_destroy ( void ); -int expr_get_debug (void ); +int yyget_debug ( void ); -void expr_set_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE expr_get_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void expr_set_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *expr_get_in (void ); +FILE *yyget_in ( void ); -void expr_set_in (FILE * _in_str ); +void yyset_in ( FILE * _in_str ); -FILE *expr_get_out (void ); +FILE *yyget_out ( void ); -void expr_set_out (FILE * _out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t expr_get_leng (void ); + int yyget_leng ( void ); -char *expr_get_text (void ); +char *yyget_text ( void ); -int expr_get_lineno (void ); +int yyget_lineno ( void ); -void expr_set_lineno (int _line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -599,9 +816,9 @@ void expr_set_lineno (int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int expr_wrap (void ); +extern "C" int yywrap ( void ); #else -extern int expr_wrap (void ); +extern int yywrap ( void ); #endif #endif @@ -610,19 +827,18 @@ extern int expr_wrap (void ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif @@ -642,7 +858,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( expr_text, expr_leng, 1, expr_out )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -653,20 +869,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( expr_in )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( expr_in ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, expr_in))==0 && ferror(expr_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -674,7 +890,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(expr_in); \ + clearerr(yyin); \ } \ }\ \ @@ -707,12 +923,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int expr_lex (void); +extern int yylex (void); -#define YY_DECL int expr_lex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after expr_text and expr_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -746,33 +962,34 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! expr_in ) - expr_in = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! expr_out ) - expr_out = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - expr_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - expr__create_buffer(expr_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - expr__load_buffer_state( ); + yy_load_buffer_state( ); } { #line 39 "expr_parser.l" +#line 41 "expr_parser.l" /* --- Tokens --- */ -#line 770 "expr_parser.c" +#line 986 "expr_parser.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of expr_text. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -794,9 +1011,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 20 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 23 ); @@ -814,11 +1031,11 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; - for ( yyl = 0; yyl < expr_leng; ++yyl ) - if ( expr_text[yyl] == '\n' ) - - expr_lineno++; + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; ; } @@ -835,55 +1052,55 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 42 "expr_parser.l" -{ return *expr_text;} +#line 43 "expr_parser.l" +{ return *yytext;} YY_BREAK /* --- Strings, also quoted form --- */ case 2: YY_RULE_SETUP -#line 46 "expr_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,expr_text); +#line 47 "expr_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext); return STRING;} YY_BREAK case 3: YY_RULE_SETUP -#line 49 "expr_parser.l" +#line 50 "expr_parser.l" { lvalp->val_str = NULL; return STRING;} YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 52 "expr_parser.l" -{ lvalp->val_str = mem_collector_strdup(mc,expr_text+1); - lvalp->val_str[expr_leng-2] = '\0'; +#line 53 "expr_parser.l" +{ lvalp->val_str = mem_collector_strdup(mc,yytext+1); + lvalp->val_str[yyleng-2] = '\0'; return STRING;} YY_BREAK /* --- Numbers --- */ case 5: YY_RULE_SETUP -#line 58 "expr_parser.l" -{ lvalp->val_int = atoi(expr_text); +#line 59 "expr_parser.l" +{ lvalp->val_int = atoi(yytext); return INTEGER;} YY_BREAK case 6: YY_RULE_SETUP -#line 61 "expr_parser.l" -{ lvalp->val_float = atof(expr_text); +#line 62 "expr_parser.l" +{ lvalp->val_float = atof(yytext); return FLOAT;} YY_BREAK /* --- blanks --- */ case 7: YY_RULE_SETUP -#line 66 "expr_parser.l" +#line 67 "expr_parser.l" YY_BREAK case 8: YY_RULE_SETUP -#line 68 "expr_parser.l" +#line 69 "expr_parser.l" ECHO; YY_BREAK -#line 887 "expr_parser.c" +#line 1103 "expr_parser.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -900,15 +1117,15 @@ case YY_STATE_EOF(INITIAL): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed expr_in at a new source and called - * expr_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = expr_in; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -961,11 +1178,11 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( expr_wrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * expr_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1015,7 +1232,7 @@ case YY_STATE_EOF(INITIAL): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of expr_lex */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1028,7 +1245,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1057,7 +1274,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1070,7 +1287,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1084,7 +1301,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1093,11 +1310,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - expr_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1125,7 +1343,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - expr_restart(expr_in ); + yyrestart( yyin ); } else @@ -1139,12 +1357,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) expr_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1177,9 +1398,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 20 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1205,9 +1426,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 20 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 19); return yy_is_jam ? 0 : yy_current_state; @@ -1241,7 +1462,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1258,14 +1479,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - expr_restart(expr_in ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( expr_wrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1284,12 +1505,12 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve expr_text */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) - - expr_lineno++; + + yylineno++; ; return c; @@ -1301,32 +1522,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void expr_restart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - expr_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - expr__create_buffer(expr_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - expr__init_buffer(YY_CURRENT_BUFFER,input_file ); - expr__load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void expr__switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * expr_pop_buffer_state(); - * expr_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - expr_ensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1339,21 +1560,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - expr__load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (expr_wrap()) processing, but the only time this flag - * is looked at is after expr_wrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void expr__load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - expr_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -1363,35 +1584,35 @@ static void expr__load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE expr__create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) expr_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in expr__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) expr_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in expr__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - expr__init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with expr__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void expr__delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -1401,27 +1622,27 @@ static void expr__load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - expr_free((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - expr_free((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a expr_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void expr__init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - expr__flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then expr__init_buffer was _probably_ - * called from expr_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1438,7 +1659,7 @@ static void expr__load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void expr__flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -1458,7 +1679,7 @@ static void expr__load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - expr__load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1467,14 +1688,14 @@ static void expr__load_buffer_state (void) * @param new_buffer The new state. * */ -void expr_push_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - expr_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from expr__switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1488,8 +1709,8 @@ void expr_push_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from expr__switch_to_buffer. */ - expr__load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1497,18 +1718,18 @@ void expr_push_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void expr_pop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - expr__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - expr__load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1516,7 +1737,7 @@ void expr_pop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void expr_ensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -1527,14 +1748,14 @@ static void expr_ensure_buffer_stack (void) * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)expr_alloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in expr_ensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1546,12 +1767,12 @@ static void expr_ensure_buffer_stack (void) yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)expr_realloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in expr_ensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1563,9 +1784,9 @@ static void expr_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE expr__scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -1573,69 +1794,69 @@ YY_BUFFER_STATE expr__scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) expr_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in expr__scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - expr__switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to expr_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * expr__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE expr__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return expr__scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to expr_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE expr__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) expr_alloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in expr__scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = expr__scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in expr__scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -1649,9 +1870,9 @@ YY_BUFFER_STATE expr__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1661,14 +1882,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up expr_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - expr_text[expr_leng] = (yy_hold_char); \ - (yy_c_buf_p) = expr_text + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - expr_leng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -1677,129 +1898,129 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int expr_get_lineno (void) +int yyget_lineno (void) { - - return expr_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE *expr_get_in (void) +FILE *yyget_in (void) { - return expr_in; + return yyin; } /** Get the output stream. * */ -FILE *expr_get_out (void) +FILE *yyget_out (void) { - return expr_out; + return yyout; } /** Get the length of the current token. * */ -yy_size_t expr_get_leng (void) +int yyget_leng (void) { - return expr_leng; + return yyleng; } /** Get the current token. * */ -char *expr_get_text (void) +char *yyget_text (void) { - return expr_text; + return yytext; } /** Set the current line number. * @param _line_number line number * */ -void expr_set_lineno (int _line_number ) +void yyset_lineno (int _line_number ) { - expr_lineno = _line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * - * @see expr__switch_to_buffer + * @see yy_switch_to_buffer */ -void expr_set_in (FILE * _in_str ) +void yyset_in (FILE * _in_str ) { - expr_in = _in_str ; + yyin = _in_str ; } -void expr_set_out (FILE * _out_str ) +void yyset_out (FILE * _out_str ) { - expr_out = _out_str ; + yyout = _out_str ; } -int expr_get_debug (void) +int yyget_debug (void) { - return expr__flex_debug; + return yy_flex_debug; } -void expr_set_debug (int _bdebug ) +void yyset_debug (int _bdebug ) { - expr__flex_debug = _bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from expr_lex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - /* We do not touch expr_lineno unless the option is enabled. */ - expr_lineno = 1; + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - expr_in = stdin; - expr_out = stdout; + yyin = stdin; + yyout = stdout; #else - expr_in = (FILE *) 0; - expr_out = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * expr_lex_init() + * yylex_init() */ return 0; } -/* expr_lex_destroy is for both reentrant and non-reentrant scanners. */ -int expr_lex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - expr__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - expr_pop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - expr_free((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * expr_lex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -1810,7 +2031,7 @@ int expr_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; @@ -1820,7 +2041,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) @@ -1830,12 +2051,12 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *expr_alloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *expr_realloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both @@ -1845,18 +2066,17 @@ void *expr_realloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void expr_free (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see expr_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 68 "expr_parser.l" - +#line 69 "expr_parser.l" int expr_wrap() From 56339a50f30f86ff36108a4d5dd6e17b0bfbe64c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Wed, 18 Oct 2017 17:51:03 +0200 Subject: [PATCH 06/16] B #5465: Do not free VNC ports on STOP and do not reassgin them on resume --- src/lcm/LifeCycleStates.cc | 8 +++++--- src/rm/RequestManagerVirtualMachine.cc | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 58d83b3a17..7dd06df3b2 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -924,15 +924,17 @@ void LifeCycleManager::epilog_success_action(int vid) vm->set_etime(the_time); vm->set_vm_info(); - + VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS"); - if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0)) + //Do not free VNC ports for STOP as it is stored in checkpoint file + if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0) && + state != VirtualMachine::EPILOG_STOP ) { graphics->remove("PORT"); clpool->release_vnc_port(vm->get_cid(), port); } - + vmpool->update_history(vm); vmpool->update(vm); diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 157b06b70d..60ae79e238 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -682,6 +682,11 @@ int set_vnc_port(VirtualMachine *vm, int cluster_id, RequestAttributes& att) { return 0; } + else if (vm->hasPreviousHistory() && + vm->get_previous_action() == History::STOP_ACTION) + { + return 0; + } else if (graphics->vector_value("PORT", port) == 0) { rc = cpool->set_vnc_port(cluster_id, port); From 01d062e76f6d366a954afb87e01fa2636c8f2d48 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 19 Oct 2017 11:04:17 +0200 Subject: [PATCH 07/16] B #5465: Fix history record check while getting VNC port (cherry picked from commit 04b557188fdf1dab72c46e8d94a9e1da94dde0c5) --- src/rm/RequestManagerVirtualMachine.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 60ae79e238..885eb31980 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -682,8 +682,7 @@ int set_vnc_port(VirtualMachine *vm, int cluster_id, RequestAttributes& att) { return 0; } - else if (vm->hasPreviousHistory() && - vm->get_previous_action() == History::STOP_ACTION) + else if (vm->hasHistory() && vm->get_action()==History::STOP_ACTION) { return 0; } From 88ce6c3d0803bf28e5b0041543586c1b11d758c1 Mon Sep 17 00:00:00 2001 From: Anton Todorov Date: Fri, 6 Oct 2017 22:44:34 +0300 Subject: [PATCH 08/16] B #5443 onedb change_body to lookup in all objects --- src/onedb/onedb_live.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onedb/onedb_live.rb b/src/onedb/onedb_live.rb index 67c030f206..360745008e 100644 --- a/src/onedb/onedb_live.rb +++ b/src/onedb/onedb_live.rb @@ -332,7 +332,7 @@ class OneDBLive raise "A value or --delete should specified" end - object.info + object.info_all object.each do |o| if options[:id] From 1fa28d406502aec41b63ceaa825945be71a78fc0 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 12:24:04 +0200 Subject: [PATCH 09/16] B #5480: Can't change vCenter credentials (#535) --- src/sunstone/public/app/tabs/datastores-tab/panels/info.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/datastores-tab/panels/info.js b/src/sunstone/public/app/tabs/datastores-tab/panels/info.js index df58506103..0794c821f1 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/datastores-tab/panels/info.js @@ -113,7 +113,12 @@ define(function(require) { var strippedTemplate = {}; var strippedTemplateVcenter = {}; $.each(this.element.TEMPLATE, function(key, value) { - if (key.match(/^VCENTER_*/)){ + if (!key.match(/^VCENTER_HOST$/) && + !key.match(/^VCENTER_USER$/) && + !key.match(/^VCENTER_PASSWORD$/) && + !key.match(/^VCENTER_DS_IMAGE_DIR$/) && + !key.match(/^VCENTER_DS_VOLATILE_DIR$/) && + key.match(/^VCENTER_*/)){ strippedTemplateVcenter[key] = value; } else { From 4e8318296c6be17215275a772d1e36c0dfbd8128 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 15:42:32 +0200 Subject: [PATCH 10/16] F #5461: Support empty attributes in merges in Sunstone (#534) * F #5461: Support empty attributes in merges in Sunstone * F #5461: Added SCHED_REQUIREMENTS instantiate VM --- .../models/OpenNebulaJSON/TemplateJSON.rb | 7 +++++++ .../templates-tab/form-panels/instantiate.js | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb index 4ab4ddca70..a51c92fc90 100644 --- a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb @@ -107,6 +107,13 @@ module OpenNebulaJSON end template = template_to_str(params['template']) + + ['NIC', 'SCHED_ACTION', 'SCHED_REQUIREMENTS', 'SCHED_DS_REQUIREMENTS'].each { |i| + if params['template'][i] && params['template'][i].empty? + template << "\n#{i} = []" + end + } + super(params['vm_name'], params['hold'], template, persistent) else super(params['vm_name'], params['hold'], "", persistent) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 8716a521c2..09441ef4bc 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -259,16 +259,22 @@ define(function(require) { var vmgroup = VMGroupSection.retrieve($(".vmgroupContext"+ template_id)); if(vmgroup){ $.extend(tmp_json, vmgroup); + } else { + tmp_json.VMGROUP = []; } var sched = WizardFields.retrieveInput($("#SCHED_REQUIREMENTS" + template_id, context)); - if(sched){ + if (sched){ tmp_json.SCHED_REQUIREMENTS = sched; + } else { + tmp_json.SCHED_REQUIREMENTS = []; } var sched_ds = WizardFields.retrieveInput($("#SCHED_DS_REQUIREMENTS" + template_id, context)); - if(sched_ds){ + if (sched_ds){ tmp_json.SCHED_DS_REQUIREMENTS = sched_ds; + } else { + tmp_json.SCHED_DS_REQUIREMENTS = []; } var nics = []; @@ -277,14 +283,12 @@ define(function(require) { $.each(networks, function(){ if (this.TYPE == "NIC"){ pcis.push(this); - }else{ + } else { nics.push(this); } }); - if (nics.length > 0) { - tmp_json.NIC = nics; - } + tmp_json.NIC = nics; // Replace PCIs of type nic only var original_tmpl = that.template_objects[index].VMTEMPLATE; From 95332c32d765b5d8dadb831f60b08cabcfe4f89e Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 15:44:04 +0200 Subject: [PATCH 11/16] Solved bug showback (#530) * Solved bug showback * '===' instead of '==' (cherry picked from commit 2f48f1fab512ad01cba597dbde29db68ad2cf777) --- .../public/app/opennebula/template.js | 11 ++- .../form-panels/instantiate.js | 2 +- .../form-panels/create/wizard-tabs/general.js | 11 ++- .../wizard-tabs/general/capacity-create.js | 74 ++++++++++--------- .../templates-tab/form-panels/instantiate.js | 2 +- 5 files changed, 56 insertions(+), 44 deletions(-) diff --git a/src/sunstone/public/app/opennebula/template.js b/src/sunstone/public/app/opennebula/template.js index 1738afb40b..35cbda7526 100644 --- a/src/sunstone/public/app/opennebula/template.js +++ b/src/sunstone/public/app/opennebula/template.js @@ -103,6 +103,7 @@ define(function(require) { var cpuCost = capacity.CPU_COST; var memoryCost = capacity.MEMORY_COST; + var memoryUnitCost = capacity.MEMORY_UNIT_COST; var diskCost = capacity.DISK_COST; if (cpuCost == undefined){ @@ -122,7 +123,11 @@ define(function(require) { } if (capacity.MEMORY) { - cost += capacity.MEMORY * memoryCost; + if (memoryUnitCost === "GB"){ + cost += (capacity.MEMORY / 1024) * memoryCost; + } else { + cost += capacity.MEMORY * memoryCost; + } } if (diskCost != 0) { @@ -134,9 +139,9 @@ define(function(require) { disks = [template_disk]; } - $.each(disks, function(i,disk){ + $.each(disks, function(i, disk){ if (disk.SIZE) { - cost += diskCost * disk.SIZE; + cost += diskCost * (disk.SIZE / 1024); } if (disk.DISK_SNAPSHOT_TOTAL_SIZE) { diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js index c453016a53..3cf1be6ed6 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js @@ -146,7 +146,7 @@ define(function(require) { total_cost += (cost * role.cardinality); $(".total_cost_div", context).show(); - $(".total_cost_div .cost_value", context).text( (total_cost).toFixed(2) ); + $(".total_cost_div .cost_value", context).text((total_cost).toFixed(4)); } UserInputs.vmTemplateInsert( diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index f7c35dc3f2..649f934de3 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -163,9 +163,14 @@ define(function(require) { totalGB += ivalue.SIZE / 1024; } }); - totalCostDisk = totalGB * that.disk; - CapacityCreate.totalCost(totalCostDisk); - document.getElementById('total_value_disk').textContent = convertCostNumber(totalCostDisk * 24 * 30); + var totalCostDisk = 0; + if (!isNaN(totalGB)){ + totalCostDisk = totalGB * that.disk; + document.getElementById('total_value_disk').textContent = convertCostNumber(totalCostDisk * 24 * 30); + CapacityCreate.totalCost(); + } else { + document.getElementById('total_value_disk').textContent = totalCostDisk; + } $(".total_disk_cost", context).show(); } }); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js index e33d9658e4..5b3ee16d96 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js @@ -70,67 +70,69 @@ define(function(require) { } function convertCostNumber(number){ if(number >= 1000000){ - number = (number/1000000).toFixed(2) - return number.toString()+"M"; + number = (number / 1000000).toFixed(2) + return number.toString() + "M"; } - else if(number >= 1000){ - number = (number/1000).toFixed(2) - return number.toString()+"K"; + else if (number >= 1000){ + number = (number / 1000).toFixed(2) + return number.toString() + "K"; } - else if (number >= 0 && number < 1000) + else if (number >= 0 && number < 1000){ return number.toFixed(2); - else + } + else { return number; + } } - function _totalCost(totalCostDisk=0){ - if(!this.totalCostDisk){ - this.totalCostDisk = 0; - } - var memory = document.getElementById('real_memory_cost').value; - var cpu = document.getElementById('real_cpu_cost').value; - if (totalCostDisk != 0){ - this.totalCostDisk = totalCostDisk; + function _totalCost(){ + var memory = $("#real_memory_cost").val(); + var cpu = $("#real_cpu_cost").val(); + var disk_cost = $("#total_value_disk").text(); + if (disk_cost === "") { + disk_cost = 0; + } else { + disk_cost = parseFloat(disk_cost); } - if(memory === undefined && cpu === undefined){ - document.getElementById('total_cost').textContent = "Total: " + this.totalCostDisk; - } else if(memory === undefined){ - document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(cpu + this.totalCostDisk); - } else if(cpu === undefined){ - document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory + this.totalCostDisk); + if ((memory === undefined || memory === "") && (cpu === undefined || cpu === "")){ + document.getElementById('total_cost').textContent = "Total: " + disk_cost; + } else if(memory === undefined || memory === ""){ + document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(cpu + disk_cost); + } else if(cpu === undefined || cpu === ""){ + document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory + disk_cost); } else { - document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory + cpu + this.totalCostDisk); + document.getElementById('total_cost').textContent = "Total: " + convertCostNumber(memory + cpu + disk_cost); } } function _calculatedRealMemory(){ - var memory_cost = document.getElementById('MEMORY_COST').value; - var type_cost = document.getElementById('MEMORY_UNIT_COST').value; - var memory = document.getElementById('MEMORY').value; - var type = document.getElementById('memory_unit').value; - if(type_cost == "GB") - memory = (memory/1024)*memory_cost*24*30; - else - memory = memory*memory_cost*24*30; - document.getElementById('real_memory_cost').textContent = "Cost: "+ convertCostNumber(memory); + var memory_cost = $("#MEMORY_COST").val(); + var type_cost = $("#MEMORY_UNIT_COST").val(); + var memory = $("#MEMORY").val(); + var type = $("#memory_unit").val(); + if (type_cost == "GB"){ + memory = (memory / 1024) * memory_cost * 24 * 30; + } else { + memory = memory * memory_cost * 24 * 30; + } + document.getElementById('real_memory_cost').textContent = "Cost: " + convertCostNumber(memory); document.getElementById('real_memory_cost').value = memory; document.getElementById('total_value_memory').textContent = memory; _totalCost(); } function _calculatedRealCpu(){ - var cpu_cost = document.getElementById('CPU_COST').value; - var cpu = document.getElementById('CPU').value; - cpu = cpu*cpu_cost*24*30; - document.getElementById('real_cpu_cost').textContent = "Cost: "+ convertCostNumber(cpu); + var cpu_cost = $("#CPU_COST").val(); + var cpu = $("#CPU").val(); + cpu = cpu * cpu_cost * 24 * 30; + document.getElementById('real_cpu_cost').textContent = "Cost: " + convertCostNumber(cpu); document.getElementById('real_cpu_cost').value = cpu; document.getElementById('total_value_cpu').textContent = cpu; _totalCost(); } function _setup(context) { - this.totalCostDisk = 0; context.on("change", "#MEMORY", function() { _calculatedRealMemory(); }); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 09441ef4bc..ef92a74a34 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -515,7 +515,7 @@ define(function(require) { memoryCost = Config.onedConf.DEFAULT_COST.MEMORY_COST; } else { if (memoryUnitCost == "GB"){ - memoryCost = memoryCost / 1024 / 1024; + memoryCost = memoryCost / 1024; } } From 1c7c7eb3e7f636972c462fb52ce5381f178f7b5f Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 15:46:02 +0200 Subject: [PATCH 12/16] B #5471: 'VM.create_dialog: false' isn't disables plus button on dashboard widget (#536) --- src/sunstone/public/app/tabs/dashboard-tab/vms.hbs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/dashboard-tab/vms.hbs b/src/sunstone/public/app/tabs/dashboard-tab/vms.hbs index 894e5b4a6e..ddd0d766c3 100644 --- a/src/sunstone/public/app/tabs/dashboard-tab/vms.hbs +++ b/src/sunstone/public/app/tabs/dashboard-tab/vms.hbs @@ -28,7 +28,9 @@
  • - + {{#isTabActionEnabled "vms-tab" "VM.create_dialog"}} + + {{/isTabActionEnabled}}
  • From 352f044559a2d99c91536acdfc8db564ee4ebfcb Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 15:48:08 +0200 Subject: [PATCH 13/16] B #5478: Changed jQ events (#537) --- .../public/app/tabs/users-tab/panels/info-common.js | 12 ++++++------ src/sunstone/public/app/utils/panel/cluster-tr.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sunstone/public/app/tabs/users-tab/panels/info-common.js b/src/sunstone/public/app/tabs/users-tab/panels/info-common.js index debe463724..95c17ad290 100644 --- a/src/sunstone/public/app/tabs/users-tab/panels/info-common.js +++ b/src/sunstone/public/app/tabs/users-tab/panels/info-common.js @@ -119,8 +119,8 @@ define(function(require) { } }); - context.off("change", "#table_order_select") - context.on("change", "#table_order_select", function() { + context.off("click", "#table_order_select") + context.on("click", "#table_order_select", function() { var sunstone_setting = {TABLE_ORDER : $(this).val()}; Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); }); @@ -137,8 +137,8 @@ define(function(require) { } }); - context.off("change", "#language_select") - context.on("change", "#language_select", function() { + context.off("click", "#language_select") + context.on("click", "#language_select", function() { var sunstone_setting = {LANG : $(this).val()}; Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); }); @@ -160,8 +160,8 @@ define(function(require) { } }); - context.off("change", "#view_select") - context.on("change", "#view_select", function() { + context.off("click", "#view_select") + context.on("click", "#view_select", function() { var sunstone_setting = {DEFAULT_VIEW : $(this).val()}; Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); }); diff --git a/src/sunstone/public/app/utils/panel/cluster-tr.js b/src/sunstone/public/app/utils/panel/cluster-tr.js index de71ded0b3..e1b08c9002 100644 --- a/src/sunstone/public/app/utils/panel/cluster-tr.js +++ b/src/sunstone/public/app/utils/panel/cluster-tr.js @@ -55,8 +55,8 @@ define(function(require) { }); }); - context.off("change", ".value_td_cluster .resource_list_select"); - context.on("change", ".value_td_cluster .resource_list_select", function() { + context.off("click", ".value_td_cluster .resource_list_select"); + context.on("click", ".value_td_cluster .resource_list_select", function() { var newClusterId = $(this).val(); if (newClusterId != "") { Sunstone.runAction(resourceType + ".addtocluster", [resourceId], newClusterId); From 432caf56b473d0016e9f07a1634187c47ba03b15 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 19 Oct 2017 15:49:49 +0200 Subject: [PATCH 14/16] B #5473: Disabled actions can be scheduled (#538) --- .../form-panels/create/wizard-tabs/actions.js | 47 +++++++---------- .../templates-tab/form-panels/instantiate.js | 46 +++++++--------- .../public/app/tabs/vms-tab/panels/actions.js | 52 ++++++++----------- 3 files changed, 63 insertions(+), 82 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/actions.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/actions.js index 8292f9d3b7..061e004c5a 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/actions.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/actions.js @@ -67,39 +67,32 @@ define(function(require) { function _setup(context) { var that = this; - + var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"]; context.off('click', '#add_scheduling_temp_action'); context.on('click', '#add_scheduling_temp_action', function() { $("#add_scheduling_temp_action", context).attr("disabled", "disabled"); - $("#scheduling_temp_actions_table").append('\ + var html = '\ + \ + \ + \ + \ \ - \ - \ - \ \ \ - \ - \ - \ - \ - \ - '); - + \ + \ + \ + \ + \ + '; + $("#scheduling_temp_actions_table").append(html); return false; }); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index ef92a74a34..2c4a929a61 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -123,36 +123,30 @@ define(function(require) { context.off('click', '#add_scheduling_inst_action'); context.on('click', '#add_scheduling_inst_action', function() { + var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"]; $("#add_scheduling_inst_action", context).attr("disabled", "disabled"); - $("#scheduling_inst_actions_table").append('\ + var html = '\ + \ + \ + \ + \ \ - \ - \ - \ \ \ - \ - \ - \ - \ - \ - '); - + \ + \ + \ + \ + \ + '; + $("#scheduling_inst_actions_table").append(html); return false; }); diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/actions.js b/src/sunstone/public/app/tabs/vms-tab/panels/actions.js index 8da2c4d49a..13e3082fd3 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/actions.js @@ -23,6 +23,7 @@ define(function(require) { var Sunstone = require('sunstone'); var Humanize = require('utils/humanize'); var TemplateUtils = require('utils/template-utils'); + var Config = require('sunstone-config'); /* CONSTANTS @@ -83,39 +84,32 @@ define(function(require) { function _setup(context) { var that = this; + var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"]; context.off('click', '#add_scheduling_action'); context.on('click', '#add_scheduling_action', function() { $("#add_scheduling_action", context).attr("disabled", "disabled"); - $("#scheduling_actions_table").append('\ - \ - \ - \ + var html = '\ + \ + \ + \ \ - \ - \ - \ - \ - \ - \ - \ - \ - '); - + \ + \ + \ + \ + \ + \ + \ + \ + '; + $("#scheduling_actions_table").append(html); return false; }); From 55a66ae9837bc6fc9a70784eacaeb9493c56e8ce Mon Sep 17 00:00:00 2001 From: Sergio Semedi Barranco Date: Thu, 19 Oct 2017 16:16:19 +0200 Subject: [PATCH 15/16] B #5458: onevcenter does not allow to import without a valid cluster, sunstone cache invalidation (#532) * B #5458: onevcenter does not allow to import resources without a valid cluster * B #5458: onevcenter does not allow to import nets without a valid cluster * B #5458: sunstone gui cache invalidation (cherry picked from commit a39d1529819a76d8e72bb99de96011a8d8caf1a9) --- src/sunstone/routes/vcenter.rb | 4 ++++ .../remotes/lib/vcenter_driver/importer.rb | 23 ++++++++++++++----- .../remotes/lib/vcenter_driver/vi_helper.rb | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/sunstone/routes/vcenter.rb b/src/sunstone/routes/vcenter.rb index 26c4ed11d2..e19adb305c 100644 --- a/src/sunstone/routes/vcenter.rb +++ b/src/sunstone/routes/vcenter.rb @@ -379,6 +379,8 @@ get '/vcenter/networks' do error 404, error.to_json end + # clean vcenterDriver cache + VCenterDriver::VIHelper.clean_ref_hash("TEMPLATE/VCENTER_CCR_REF") networks = dc_folder.get_unimported_networks(npool,vcenter_client.vim.host,hpool) if networks.nil? @@ -453,6 +455,8 @@ get '/vcenter/datastores' do error 404, error.to_json end + # clean vcenterDriver cache + VCenterDriver::VIHelper.clean_ref_hash("TEMPLATE/VCENTER_CCR_REF") datastores = dc_folder.get_unimported_datastores(dpool, vcenter_client.vim.host, hpool) if datastores.nil? msg = "No datacenter found" diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/importer.rb b/src/vmm_mad/remotes/lib/vcenter_driver/importer.rb index ed20a55088..502ea32a9a 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/importer.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/importer.rb @@ -644,11 +644,16 @@ def self.import_networks(con_ops, options) " - Cluster : \e[96m#{n[:cluster]}\e[39m\n"\ " - Cluster location : #{n[:cluster_location]}\n"\ " - OpenNebula Cluster ID : #{n[:one_cluster_id]}\n" - print_str << " Import this Network (y/[n])? " + + if n[:one_cluster_id] == -1 + print_str << "You need to import the associated vcenter cluster as one host first!" + else + print_str << " Import this Network (y/[n])? " + end STDOUT.print print_str - next if STDIN.gets.strip.downcase != 'y' + next if STDIN.gets.strip.downcase != 'y' || n[:one_cluster_id] == -1 end # we try to retrieve once we know the desired net @@ -845,14 +850,20 @@ def self.import_datastore(con_ops, options) tmps.each{ |d| if !use_defaults - STDOUT.print "\n * Datastore found:\n"\ + datastore_str = "\n * Datastore found:\n"\ " - Name : \e[92m#{d[:simple_name]}\e[39m\n"\ " - Total MB : #{d[:total_mb]}\n"\ " - Free MB : #{d[:free_mb]}\n"\ - " - OpenNebula Cluster IDs: #{d[:cluster].join(',')}\n"\ - " Import this datastore [y/n]? " + " - OpenNebula Cluster IDs: #{d[:cluster].join(',')}\n" + if d[:cluster].empty? + datastore_str << "You need to import the associated vcenter cluster as one host first!" + else + datastore_str << " Import this datastore [y/n]? " + end + STDOUT.print datastore_str + + next if STDIN.gets.strip.downcase != 'y' || d[:cluster].empty? - next if STDIN.gets.strip.downcase != 'y' STDOUT.print "\n NOTE: For each vCenter datastore a SYSTEM and IMAGE datastore\n"\ " will be created in OpenNebula except for a StorageDRS which is \n"\ diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb b/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb index fade1b5dd0..e87aa481fb 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb @@ -75,7 +75,7 @@ class VIHelper if attr.nil? @ref_hash = {} else - @ref_hash[attr] = {} + @ref_hash[attr] = {} unless @ref_hash.nil? end end From b12113e5aac9a8f3a85fa339ebd5a5149d2ed537 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 20 Oct 2017 14:17:55 +0200 Subject: [PATCH 16/16] B #5425: License and minor formatting --- include/CachePool.h | 41 ++++++++++++++++++++++++++++++++--------- include/HostPool.h | 10 +++++----- include/User.h | 13 ++----------- include/UserPool.h | 12 +++++++----- src/host/HostPool.cc | 7 ------- src/um/UserPool.cc | 6 ++---- 6 files changed, 48 insertions(+), 41 deletions(-) diff --git a/include/CachePool.h b/include/CachePool.h index a51e0dac68..c8530b0c13 100644 --- a/include/CachePool.h +++ b/include/CachePool.h @@ -1,3 +1,19 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */ +/* */ +/* 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. */ +/* -------------------------------------------------------------------------- */ + #ifndef CACHE_POOL_H_ #define CACHE_POOL_H_ @@ -12,29 +28,30 @@ using namespace std; /** - * The Cache Pool class. + * The Cache Pool class. This class is used to store volatile pool data. */ template class CachePool { -private: - - pthread_mutex_t resource_lock; - - std::map resources; - public: - CachePool(){ - pthread_mutex_init(&resource_lock,0); + CachePool() + { + pthread_mutex_init(&resource_lock, 0); } ~CachePool() { typename std::map::iterator it; + pthread_mutex_lock(&resource_lock); + for (it=resources.begin(); it != resources.end() ; ++it) { delete it->second; } + + pthread_mutex_unlock(&resource_lock); + + pthread_mutex_destroy(&resource_lock); }; T * get_resource(int oid) @@ -77,6 +94,12 @@ public: pthread_mutex_unlock(&resource_lock); } + +private: + + pthread_mutex_t resource_lock; + + std::map resources; }; #endif /*CACHE_POOL_H_*/ \ No newline at end of file diff --git a/include/HostPool.h b/include/HostPool.h index 31b3ae5046..75d5f6a9c5 100644 --- a/include/HostPool.h +++ b/include/HostPool.h @@ -40,7 +40,7 @@ public: const string& hook_location, const string& remotes_location, time_t expire_time); - ~HostPool(); + ~HostPool(){}; /** * Function to allocate a new Host object @@ -320,15 +320,15 @@ private: set prev_rediscovered_vms; }; - pthread_mutex_t host_vm_lock; - CachePool cache; - HostVM * get_host_vm(int oid){ + HostVM * get_host_vm(int oid) + { return cache.get_resource(oid); } - void delete_host_vm(int oid){ + void delete_host_vm(int oid) + { cache.delete_resource(oid); } diff --git a/include/User.h b/include/User.h index 1f6892e50c..e998077727 100644 --- a/include/User.h +++ b/include/User.h @@ -224,16 +224,6 @@ public: return groups.contains(_group_id); } - /** - * Sets session token - * - * @param session_token the new session token - */ - void set_session(SessionToken * session_token) - { - session = session_token; - } - // ************************************************************************* // Quotas // ************************************************************************* @@ -381,7 +371,8 @@ protected: password(_password), auth_driver(_auth_driver), enabled(_enabled), - groups("GROUPS") + groups("GROUPS"), + session(0) { obj_template = new UserTemplate; }; diff --git a/include/UserPool.h b/include/UserPool.h index 5e10ad620f..363359ec7e 100644 --- a/include/UserPool.h +++ b/include/UserPool.h @@ -86,7 +86,7 @@ public: if ( u != 0 ) { - u->set_session(get_session_token(oid)); + u->session = get_session_token(oid); } return u; @@ -106,7 +106,7 @@ public: if ( u != 0 ) { - u->set_session(get_session_token(u->oid)); + u->session = get_session_token(u->oid); } return u; @@ -237,13 +237,15 @@ private: **/ static time_t _session_expiration_time; - CachePool cache; - SessionToken * get_session_token(int oid){ + + SessionToken * get_session_token(int oid) + { return cache.get_resource(oid); } - void delete_session_token(int oid){ + void delete_session_token(int oid) + { cache.delete_resource(oid); } diff --git a/src/host/HostPool.cc b/src/host/HostPool.cc index 31b06cb2f9..4174fc4b86 100644 --- a/src/host/HostPool.cc +++ b/src/host/HostPool.cc @@ -140,18 +140,11 @@ HostPool::HostPool(SqlDB* db, add_hook(hook); } - - pthread_mutex_init(&host_vm_lock,0); } /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -HostPool::~HostPool(){}; - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - int HostPool::allocate ( int * oid, const string& hostname, diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index aa497e25f5..01c0c89105 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -497,10 +497,8 @@ int UserPool::drop(PoolObjectSQL * objsql, string& error_msg) return -1; } - User * user = static_cast(objsql); - int oid = user->oid; - - int rc = PoolSQL::drop(objsql, error_msg); + int oid = (static_cast(objsql))->oid; + int rc = PoolSQL::drop(objsql, error_msg); if ( rc == 0 ) {