mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Simplified parsers (Flex include files).
Moved the VM attribute parser to VirtualMachine Made some optimizations on the parsing git-svn-id: http://svn.opennebula.org/one/trunk@446 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
parent
af1420b862
commit
4c2d9df0a9
@ -558,11 +558,38 @@ public:
|
||||
{
|
||||
vm_template.to_xml(xml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using the VM
|
||||
* template values:
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int parse_template_attribute(const string& attribute,
|
||||
string& parsed);
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using the VM
|
||||
* template values (blocking-free version for cross references):
|
||||
* @param vm_id ID of the VM used to substitute the variables
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @param error_msg, string describing the syntax error
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int parse_template_attribute(int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg)
|
||||
{
|
||||
return parse_attribute(0,vm_id,attribute,parsed,error_msg);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// States
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Returns the VM state (Dispatch Manager)
|
||||
* @return the VM state
|
||||
@ -675,7 +702,7 @@ private:
|
||||
int num,
|
||||
char ** values,
|
||||
char ** names);
|
||||
|
||||
|
||||
// *************************************************************************
|
||||
// Virtual Machine Attributes
|
||||
// *************************************************************************
|
||||
@ -868,7 +895,33 @@ private:
|
||||
return vm_template.insert_attribute(db,attribute);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Attribute Parser
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Mutex to perform just one attribute parse at a time
|
||||
*/
|
||||
static pthread_mutex_t lex_mutex;
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using template
|
||||
* values:
|
||||
* @param vm pointer to VirtualMachine if not 0 the template of that VM
|
||||
* will be used.
|
||||
* @param vm_id ID of the VM used to substitute the variables, used if vm
|
||||
* is 0
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @param error_msg, string describing the syntax error
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int parse_attribute(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg);
|
||||
|
||||
protected:
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -124,20 +124,6 @@ public:
|
||||
return vm->update_previous_history(db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a string and substitute variables (e.g. $NAME) using template
|
||||
* values:
|
||||
* @param vm_id, ID of the VM used to substitute the variables
|
||||
* @param attribute, the string to be parsed
|
||||
* @param parsed, the resulting parsed string
|
||||
* @param error_msg, string describing the syntax error
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int parse_attribute(int vm_id,
|
||||
string &attribute,
|
||||
string &parsed,
|
||||
char ** error_msg);
|
||||
|
||||
/**
|
||||
* Bootstraps the database table(s) associated to the VirtualMachine pool
|
||||
*/
|
||||
@ -147,11 +133,6 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* Mutex to perform just one attribute parse at a time
|
||||
*/
|
||||
static pthread_mutex_t lex_mutex;
|
||||
|
||||
/**
|
||||
* Generate context file to be sourced upon VM booting
|
||||
* @param vm_id, ID of the VM to generate context for
|
||||
|
@ -22,10 +22,6 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "Host.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "host_parser.h"
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Host :: Constructor/Destructor */
|
||||
@ -316,6 +312,8 @@ pthread_mutex_t Host::lex_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef struct yy_buffer_state * YY_BUFFER_STATE;
|
||||
|
||||
int host_requirements_parse(Host * host, bool& result, char ** errmsg);
|
||||
|
||||
int host_rank_parse(Host * host, int& result, char ** errmsg);
|
||||
@ -332,7 +330,7 @@ extern "C"
|
||||
|
||||
int Host::match(const string& requirements, bool& result, char **errmsg)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer;
|
||||
YY_BUFFER_STATE str_buffer = 0;
|
||||
const char * str;
|
||||
int rc;
|
||||
|
||||
@ -373,7 +371,7 @@ error_yy:
|
||||
|
||||
int Host::rank(const string& rank, int& result, char **errmsg)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer;
|
||||
YY_BUFFER_STATE str_buffer = 0;
|
||||
const char * str;
|
||||
int rc;
|
||||
|
||||
|
@ -714,7 +714,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 40 "host_parser.l"
|
||||
#line 39 "host_parser.l"
|
||||
|
||||
/* --- Tokens --- */
|
||||
|
||||
@ -813,26 +813,26 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 43 "host_parser.l"
|
||||
#line 42 "host_parser.l"
|
||||
{ return *host_text;}
|
||||
YY_BREAK
|
||||
/* --- Strings, also quoted form --- */
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 47 "host_parser.l"
|
||||
#line 46 "host_parser.l"
|
||||
{ lvalp->val_str = strdup(host_text);
|
||||
return STRING;}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 50 "host_parser.l"
|
||||
#line 49 "host_parser.l"
|
||||
{ lvalp->val_str = NULL;
|
||||
return STRING;}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
/* rule 4 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 53 "host_parser.l"
|
||||
#line 52 "host_parser.l"
|
||||
{ lvalp->val_str = strdup(host_text+1);
|
||||
lvalp->val_str[host_leng-2] = '\0';
|
||||
return STRING;}
|
||||
@ -840,19 +840,19 @@ YY_RULE_SETUP
|
||||
/* --- Integers --- */
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 58 "host_parser.l"
|
||||
#line 57 "host_parser.l"
|
||||
{ lvalp->val_int = atoi(host_text);
|
||||
return INTEGER;}
|
||||
YY_BREAK
|
||||
/* --- blanks --- */
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 62 "host_parser.l"
|
||||
#line 61 "host_parser.l"
|
||||
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 64 "host_parser.l"
|
||||
#line 63 "host_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 859 "host_parser.c"
|
||||
@ -1824,7 +1824,7 @@ void host_free (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 64 "host_parser.l"
|
||||
#line 63 "host_parser.l"
|
||||
|
||||
|
||||
|
||||
|
@ -1,332 +0,0 @@
|
||||
#ifndef host_HEADER_H
|
||||
#define host_HEADER_H 1
|
||||
#define host_IN_HEADER 1
|
||||
|
||||
#line 6 "host_parser.h"
|
||||
|
||||
#line 8 "host_parser.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* The "const" storage-class-modifier is valid. */
|
||||
#define YY_USE_CONST
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
/* C99 requires __STDC__ to be defined as 1. */
|
||||
#if defined (__STDC__)
|
||||
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* defined (__STDC__) */
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef YY_USE_CONST
|
||||
#define yyconst const
|
||||
#else
|
||||
#define yyconst
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
extern int host_leng;
|
||||
|
||||
extern FILE *host_in, *host_out;
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
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
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
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.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
void host_restart (FILE *input_file );
|
||||
void host__switch_to_buffer (YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE host__create_buffer (FILE *file,int size );
|
||||
void host__delete_buffer (YY_BUFFER_STATE b );
|
||||
void host__flush_buffer (YY_BUFFER_STATE b );
|
||||
void host_push_buffer_state (YY_BUFFER_STATE new_buffer );
|
||||
void host_pop_buffer_state (void );
|
||||
|
||||
YY_BUFFER_STATE host__scan_buffer (char *base,yy_size_t size );
|
||||
YY_BUFFER_STATE host__scan_string (yyconst char *yy_str );
|
||||
YY_BUFFER_STATE host__scan_bytes (yyconst char *bytes,int len );
|
||||
|
||||
void *host_alloc (yy_size_t );
|
||||
void *host_realloc (void *,yy_size_t );
|
||||
void host_free (void * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
extern int host_lineno;
|
||||
|
||||
extern char *host_text;
|
||||
#define yytext_ptr host_text
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int host_lex_destroy (void );
|
||||
|
||||
int host_get_debug (void );
|
||||
|
||||
void host_set_debug (int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE host_get_extra (void );
|
||||
|
||||
void host_set_extra (YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *host_get_in (void );
|
||||
|
||||
void host_set_in (FILE * in_str );
|
||||
|
||||
FILE *host_get_out (void );
|
||||
|
||||
void host_set_out (FILE * out_str );
|
||||
|
||||
int host_get_leng (void );
|
||||
|
||||
char *host_get_text (void );
|
||||
|
||||
int host_get_lineno (void );
|
||||
|
||||
void host_set_lineno (int line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int host_wrap (void );
|
||||
#else
|
||||
extern int host_wrap (void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int host_lex (void);
|
||||
|
||||
#define YY_DECL int host_lex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#line 64 "host_parser.l"
|
||||
|
||||
|
||||
#line 331 "host_parser.h"
|
||||
#undef host_IN_HEADER
|
||||
#endif /* host_HEADER_H */
|
@ -34,7 +34,6 @@
|
||||
%option nounput
|
||||
%option prefix="host_"
|
||||
%option outfile="host_parser.c"
|
||||
%option header-file="host_parser.h"
|
||||
%option yylineno
|
||||
|
||||
%%
|
||||
|
@ -19,15 +19,13 @@
|
||||
|
||||
#include "Template.h"
|
||||
#include "template_syntax.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "template_parser.h"
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
pthread_mutex_t Template::mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
Template::~Template()
|
||||
{
|
||||
@ -42,8 +40,14 @@ Template::~Template()
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
pthread_mutex_t Template::mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef struct yy_buffer_state * YY_BUFFER_STATE;
|
||||
|
||||
extern FILE *template_in, *template_out;
|
||||
|
||||
int template_parse(Template * tmpl, char ** errmsg);
|
||||
|
||||
int template_lex_destroy();
|
||||
@ -94,7 +98,7 @@ error_open:
|
||||
|
||||
int Template::parse(const string &parse_str, char **error_msg)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer;
|
||||
YY_BUFFER_STATE str_buffer = 0;
|
||||
const char * str;
|
||||
int rc;
|
||||
|
||||
|
@ -745,7 +745,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 42 "template_parser.l"
|
||||
#line 41 "template_parser.l"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -847,13 +847,13 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
case 1:
|
||||
/* rule 1 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 47 "template_parser.l"
|
||||
#line 46 "template_parser.l"
|
||||
;
|
||||
YY_BREAK
|
||||
case 2:
|
||||
/* rule 2 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 48 "template_parser.l"
|
||||
#line 47 "template_parser.l"
|
||||
;
|
||||
YY_BREAK
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -861,7 +861,7 @@ YY_RULE_SETUP
|
||||
/* ------------------------------------------------------------------------- */
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 53 "template_parser.l"
|
||||
#line 52 "template_parser.l"
|
||||
{ lvalp->val_str = strdup(template_text); return VARIABLE;}
|
||||
YY_BREAK
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@ -871,31 +871,31 @@ YY_RULE_SETUP
|
||||
/* ------------------------------------------------------------------------ */
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 60 "template_parser.l"
|
||||
#line 59 "template_parser.l"
|
||||
{ BEGIN VALUE; return EQUAL;}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
/* rule 5 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 62 "template_parser.l"
|
||||
#line 61 "template_parser.l"
|
||||
{ return EQUAL_EMPTY;}
|
||||
YY_BREAK
|
||||
case 6:
|
||||
/* rule 6 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 64 "template_parser.l"
|
||||
#line 63 "template_parser.l"
|
||||
{ return COMMA;}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
/* rule 7 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 66 "template_parser.l"
|
||||
#line 65 "template_parser.l"
|
||||
{ return CBRACKET;}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
/* rule 8 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 68 "template_parser.l"
|
||||
#line 67 "template_parser.l"
|
||||
{ BEGIN(INITIAL); return OBRACKET;}
|
||||
YY_BREAK
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@ -906,7 +906,7 @@ YY_RULE_SETUP
|
||||
case 9:
|
||||
/* rule 9 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 75 "template_parser.l"
|
||||
#line 74 "template_parser.l"
|
||||
{ lvalp->val_str = strdup(template_text+1);
|
||||
lvalp->val_str[template_leng-2] = '\0';
|
||||
BEGIN(INITIAL); return STRING; }
|
||||
@ -914,20 +914,20 @@ YY_RULE_SETUP
|
||||
case 10:
|
||||
/* rule 10 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 79 "template_parser.l"
|
||||
#line 78 "template_parser.l"
|
||||
{ lvalp->val_str = strdup(template_text+1);
|
||||
lvalp->val_str[template_leng-2] = '\0';
|
||||
BEGIN(INITIAL); return STRING; }
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 83 "template_parser.l"
|
||||
#line 82 "template_parser.l"
|
||||
{ lvalp->val_str = strdup(template_text);
|
||||
BEGIN(INITIAL); return STRING;}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 85 "template_parser.l"
|
||||
#line 84 "template_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 934 "template_parser.c"
|
||||
@ -1900,7 +1900,7 @@ void template_free (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 85 "template_parser.l"
|
||||
#line 84 "template_parser.l"
|
||||
|
||||
|
||||
|
||||
|
@ -1,333 +0,0 @@
|
||||
#ifndef template_HEADER_H
|
||||
#define template_HEADER_H 1
|
||||
#define template_IN_HEADER 1
|
||||
|
||||
#line 6 "template_parser.h"
|
||||
|
||||
#line 8 "template_parser.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* The "const" storage-class-modifier is valid. */
|
||||
#define YY_USE_CONST
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
/* C99 requires __STDC__ to be defined as 1. */
|
||||
#if defined (__STDC__)
|
||||
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* defined (__STDC__) */
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef YY_USE_CONST
|
||||
#define yyconst const
|
||||
#else
|
||||
#define yyconst
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
extern int template_leng;
|
||||
|
||||
extern FILE *template_in, *template_out;
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
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
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
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.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
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 );
|
||||
|
||||
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 * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
extern int template_lineno;
|
||||
|
||||
extern char *template_text;
|
||||
#define yytext_ptr template_text
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
#define VALUE 1
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int template_lex_destroy (void );
|
||||
|
||||
int template_get_debug (void );
|
||||
|
||||
void template_set_debug (int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE template_get_extra (void );
|
||||
|
||||
void template_set_extra (YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *template_get_in (void );
|
||||
|
||||
void template_set_in (FILE * in_str );
|
||||
|
||||
FILE *template_get_out (void );
|
||||
|
||||
void template_set_out (FILE * out_str );
|
||||
|
||||
int template_get_leng (void );
|
||||
|
||||
char *template_get_text (void );
|
||||
|
||||
int template_get_lineno (void );
|
||||
|
||||
void template_set_lineno (int line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int template_wrap (void );
|
||||
#else
|
||||
extern int template_wrap (void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int template_lex (void);
|
||||
|
||||
#define YY_DECL int template_lex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#line 85 "template_parser.l"
|
||||
|
||||
|
||||
#line 332 "template_parser.h"
|
||||
#undef template_IN_HEADER
|
||||
#endif /* template_HEADER_H */
|
@ -33,7 +33,6 @@
|
||||
%option nounput
|
||||
%option prefix="template_"
|
||||
%option outfile="template_parser.c"
|
||||
%option header-file="template_parser.h"
|
||||
%option yylineno
|
||||
|
||||
%x VALUE
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "Nebula.h"
|
||||
|
||||
|
||||
#include "vm_var_syntax.h"
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Virtual Machine :: Constructor/Destructor */
|
||||
@ -596,7 +597,8 @@ void VirtualMachine::release_network_leases()
|
||||
|
||||
for(int i=0; i<num_nics; i++)
|
||||
{
|
||||
VectorAttribute const * nic = dynamic_cast<VectorAttribute const * >(nics[i]);
|
||||
VectorAttribute const * nic =
|
||||
dynamic_cast<VectorAttribute const * >(nics[i]);
|
||||
|
||||
if ( nic == 0 )
|
||||
{
|
||||
@ -687,6 +689,92 @@ int VirtualMachine::generate_context(string &files)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_template_attribute(const string& attribute,
|
||||
string& parsed)
|
||||
{
|
||||
int rc;
|
||||
char * err = 0;
|
||||
|
||||
rc = parse_attribute(this,-1,attribute,parsed,&err);
|
||||
|
||||
if ( rc != 0 && err != 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Error parsing: " << attribute << ". " << err;
|
||||
log("VM",Log::ERROR,oss);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
pthread_mutex_t VirtualMachine::lex_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef struct yy_buffer_state * YY_BUFFER_STATE;
|
||||
|
||||
int vm_var_parse (VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
|
||||
int vm_var_lex_destroy();
|
||||
|
||||
YY_BUFFER_STATE vm_var__scan_string(const char * str);
|
||||
|
||||
void vm_var__delete_buffer(YY_BUFFER_STATE);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_attribute(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
const string& attribute,
|
||||
string& parsed,
|
||||
char ** error_msg)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer = 0;
|
||||
const char * str;
|
||||
int rc;
|
||||
ostringstream oss_parsed("DEBUG");
|
||||
|
||||
*error_msg = 0;
|
||||
|
||||
pthread_mutex_lock(&lex_mutex);
|
||||
|
||||
str = attribute.c_str();
|
||||
str_buffer = vm_var__scan_string(str);
|
||||
|
||||
if (str_buffer == 0)
|
||||
{
|
||||
goto error_yy;
|
||||
}
|
||||
|
||||
rc = vm_var_parse(vm,vm_id,&oss_parsed,error_msg);
|
||||
|
||||
vm_var__delete_buffer(str_buffer);
|
||||
|
||||
vm_var_lex_destroy();
|
||||
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
|
||||
parsed = oss_parsed.str();
|
||||
|
||||
return rc;
|
||||
|
||||
error_yy:
|
||||
*error_msg=strdup("Error setting scan buffer");
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Virtual Machine :: Misc */
|
||||
/* ************************************************************************** */
|
||||
|
@ -17,11 +17,6 @@
|
||||
|
||||
#include "Nebula.h"
|
||||
#include "VirtualMachinePool.h"
|
||||
#include "vm_var_syntax.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "vm_var_parser.h"
|
||||
}
|
||||
#include <sstream>
|
||||
|
||||
int VirtualMachinePool::allocate (
|
||||
@ -163,7 +158,7 @@ void VirtualMachinePool::generate_context(int vm_id, Attribute * attr)
|
||||
return;
|
||||
}
|
||||
|
||||
rc = parse_attribute(vm_id,*str,parsed,&error_msg);
|
||||
rc = VirtualMachine::parse_template_attribute(vm_id,*str,parsed,&error_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
@ -203,65 +198,4 @@ void VirtualMachinePool::generate_context(int vm_id, Attribute * attr)
|
||||
vm->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
pthread_mutex_t VirtualMachinePool::lex_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int vm_var_parse (VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
|
||||
int vm_var_lex_destroy();
|
||||
|
||||
YY_BUFFER_STATE vm_var__scan_string(const char * str);
|
||||
|
||||
void vm_var__delete_buffer(YY_BUFFER_STATE);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachinePool::parse_attribute(int vm_id,
|
||||
string &attribute,
|
||||
string &parsed,
|
||||
char ** error_msg)
|
||||
{
|
||||
YY_BUFFER_STATE str_buffer;
|
||||
const char * str;
|
||||
int rc;
|
||||
ostringstream oss_parsed;
|
||||
|
||||
*error_msg = 0;
|
||||
|
||||
pthread_mutex_lock(&lex_mutex);
|
||||
|
||||
str = attribute.c_str();
|
||||
str_buffer = vm_var__scan_string(str);
|
||||
|
||||
if (str_buffer == 0)
|
||||
{
|
||||
goto error_yy;
|
||||
}
|
||||
|
||||
rc = vm_var_parse(this,0,vm_id,&oss_parsed,error_msg);
|
||||
|
||||
vm_var__delete_buffer(str_buffer);
|
||||
|
||||
vm_var_lex_destroy();
|
||||
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
|
||||
parsed = oss_parsed.str();
|
||||
|
||||
return rc;
|
||||
|
||||
error_yy:
|
||||
*error_msg=strdup("Error setting scan buffer");
|
||||
pthread_mutex_unlock(&lex_mutex);
|
||||
return -1;
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 40 "vm_var_parser.l"
|
||||
#line 39 "vm_var_parser.l"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -834,65 +834,65 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 50 "vm_var_parser.l"
|
||||
#line 49 "vm_var_parser.l"
|
||||
{ BEGIN VAR;}
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 52 "vm_var_parser.l"
|
||||
#line 51 "vm_var_parser.l"
|
||||
{ return EQUAL;}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 53 "vm_var_parser.l"
|
||||
#line 52 "vm_var_parser.l"
|
||||
{ return COMMA;}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 54 "vm_var_parser.l"
|
||||
#line 53 "vm_var_parser.l"
|
||||
{ return OBRACKET;}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 55 "vm_var_parser.l"
|
||||
#line 54 "vm_var_parser.l"
|
||||
{ return CBRACKET;}
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 57 "vm_var_parser.l"
|
||||
#line 56 "vm_var_parser.l"
|
||||
{ vm_var_text[vm_var_leng-1] = '\0';
|
||||
lvalp->val_int = atoi(vm_var_text);
|
||||
return INTEGER;}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 60 "vm_var_parser.l"
|
||||
#line 59 "vm_var_parser.l"
|
||||
{ lvalp->val_str = strdup(vm_var_text);
|
||||
return STRING;}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
/* rule 8 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 62 "vm_var_parser.l"
|
||||
#line 61 "vm_var_parser.l"
|
||||
{ lvalp->val_str = strdup(vm_var_text+1);
|
||||
lvalp->val_str[vm_var_leng-2] = '\0';
|
||||
return STRING;}
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 66 "vm_var_parser.l"
|
||||
#line 65 "vm_var_parser.l"
|
||||
{ lvalp->val_char = '\0';
|
||||
return EOA;}
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 68 "vm_var_parser.l"
|
||||
#line 67 "vm_var_parser.l"
|
||||
{ lvalp->val_char = *vm_var_text;
|
||||
BEGIN(INITIAL);
|
||||
return EOA;}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(VAR):
|
||||
#line 71 "vm_var_parser.l"
|
||||
#line 70 "vm_var_parser.l"
|
||||
{ lvalp->val_char = '\0';
|
||||
BEGIN(INITIAL);
|
||||
return EOA;}
|
||||
@ -903,12 +903,12 @@ case YY_STATE_EOF(VAR):
|
||||
case 11:
|
||||
/* rule 11 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 79 "vm_var_parser.l"
|
||||
#line 78 "vm_var_parser.l"
|
||||
{ lvalp->val_str = strdup(vm_var_text); return RSTRING;}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 81 "vm_var_parser.l"
|
||||
#line 80 "vm_var_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 915 "vm_var_parser.c"
|
||||
@ -1880,7 +1880,7 @@ void vm_var_free (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 81 "vm_var_parser.l"
|
||||
#line 80 "vm_var_parser.l"
|
||||
|
||||
|
||||
|
||||
|
@ -1,333 +0,0 @@
|
||||
#ifndef vm_var_HEADER_H
|
||||
#define vm_var_HEADER_H 1
|
||||
#define vm_var_IN_HEADER 1
|
||||
|
||||
#line 6 "vm_var_parser.h"
|
||||
|
||||
#line 8 "vm_var_parser.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* The "const" storage-class-modifier is valid. */
|
||||
#define YY_USE_CONST
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
/* C99 requires __STDC__ to be defined as 1. */
|
||||
#if defined (__STDC__)
|
||||
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* defined (__STDC__) */
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef YY_USE_CONST
|
||||
#define yyconst const
|
||||
#else
|
||||
#define yyconst
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
extern int vm_var_leng;
|
||||
|
||||
extern FILE *vm_var_in, *vm_var_out;
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
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
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
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.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
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 );
|
||||
|
||||
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 * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
extern int vm_var_lineno;
|
||||
|
||||
extern char *vm_var_text;
|
||||
#define yytext_ptr vm_var_text
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
#define VAR 1
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int vm_var_lex_destroy (void );
|
||||
|
||||
int vm_var_get_debug (void );
|
||||
|
||||
void vm_var_set_debug (int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE vm_var_get_extra (void );
|
||||
|
||||
void vm_var_set_extra (YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *vm_var_get_in (void );
|
||||
|
||||
void vm_var_set_in (FILE * in_str );
|
||||
|
||||
FILE *vm_var_get_out (void );
|
||||
|
||||
void vm_var_set_out (FILE * out_str );
|
||||
|
||||
int vm_var_get_leng (void );
|
||||
|
||||
char *vm_var_get_text (void );
|
||||
|
||||
int vm_var_get_lineno (void );
|
||||
|
||||
void vm_var_set_lineno (int line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int vm_var_wrap (void );
|
||||
#else
|
||||
extern int vm_var_wrap (void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int vm_var_lex (void);
|
||||
|
||||
#define YY_DECL int vm_var_lex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#line 81 "vm_var_parser.l"
|
||||
|
||||
|
||||
#line 332 "vm_var_parser.h"
|
||||
#undef vm_var_IN_HEADER
|
||||
#endif /* vm_var_HEADER_H */
|
@ -33,7 +33,6 @@
|
||||
%option nounput
|
||||
%option prefix="vm_var_"
|
||||
%option outfile="vm_var_parser.c"
|
||||
%option header-file="vm_var_parser.h"
|
||||
%option yylineno
|
||||
|
||||
%x VAR
|
||||
|
@ -111,6 +111,8 @@
|
||||
|
||||
#include "vm_var_syntax.h"
|
||||
#include "VirtualMachinePool.h"
|
||||
#include "VirtualMachine.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define VM_VAR_TO_UPPER(S) transform (S.begin(),S.end(),S.begin(), \
|
||||
@ -119,38 +121,37 @@
|
||||
extern "C"
|
||||
{
|
||||
void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg,
|
||||
const char * str);
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg,
|
||||
const char * str);
|
||||
|
||||
int vm_var_lex (YYSTYPE *lvalp, YYLTYPE *llocp);
|
||||
|
||||
int vm_var_parse (VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
int vm_var_parse (VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_single(VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name)
|
||||
void insert_single(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name)
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 && vmpool != 0 )
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm = vmpool->get(vm_id,true);
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
@ -171,14 +172,13 @@ void insert_single(VirtualMachinePool * vmpool,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_vector(VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name,
|
||||
const string& vname,
|
||||
const string& vvar,
|
||||
const string& vval)
|
||||
void insert_vector(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name,
|
||||
const string& vname,
|
||||
const string& vvar,
|
||||
const string& vval)
|
||||
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
@ -189,9 +189,11 @@ void insert_vector(VirtualMachinePool * vmpool,
|
||||
int num;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 && vmpool != 0 )
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm = vmpool->get(vm_id,true);
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
@ -261,14 +263,14 @@ error_name:
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 166 "vm_var_syntax.y"
|
||||
#line 167 "vm_var_syntax.y"
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
char val_char;
|
||||
}
|
||||
/* Line 187 of yacc.c. */
|
||||
#line 272 "vm_var_syntax.cc"
|
||||
#line 274 "vm_var_syntax.cc"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
@ -293,7 +295,7 @@ typedef struct YYLTYPE
|
||||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 297 "vm_var_syntax.cc"
|
||||
#line 299 "vm_var_syntax.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -580,7 +582,7 @@ static const yytype_int8 yyrhs[] =
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 189, 189, 190, 193, 198, 213, 231, 254
|
||||
0, 190, 190, 191, 194, 199, 214, 232, 255
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -707,7 +709,7 @@ do \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
yyerror (&yylloc, vmpool, vm, vm_id, parsed, errmsg, YY_("syntax error: cannot back up")); \
|
||||
yyerror (&yylloc, vm, vm_id, parsed, errmsg, YY_("syntax error: cannot back up")); \
|
||||
YYERROR; \
|
||||
} \
|
||||
while (YYID (0))
|
||||
@ -787,7 +789,7 @@ do { \
|
||||
{ \
|
||||
YYFPRINTF (stderr, "%s ", Title); \
|
||||
yy_symbol_print (stderr, \
|
||||
Type, Value, Location, vmpool, vm, vm_id, parsed, errmsg); \
|
||||
Type, Value, Location, vm, vm_id, parsed, errmsg); \
|
||||
YYFPRINTF (stderr, "\n"); \
|
||||
} \
|
||||
} while (YYID (0))
|
||||
@ -801,25 +803,23 @@ do { \
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static void
|
||||
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
#else
|
||||
static void
|
||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, vmpool, vm, vm_id, parsed, errmsg)
|
||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, errmsg)
|
||||
FILE *yyoutput;
|
||||
int yytype;
|
||||
YYSTYPE const * const yyvaluep;
|
||||
YYLTYPE const * const yylocationp;
|
||||
VirtualMachinePool * vmpool;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
#endif
|
||||
{
|
||||
if (!yyvaluep)
|
||||
return;
|
||||
YYUSE (yylocationp);
|
||||
YYUSE (vmpool);
|
||||
YYUSE (vm);
|
||||
YYUSE (vm_id);
|
||||
YYUSE (parsed);
|
||||
@ -845,19 +845,18 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, vmpool, vm, vm_i
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static void
|
||||
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
#else
|
||||
static void
|
||||
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, vmpool, vm, vm_id, parsed, errmsg)
|
||||
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, errmsg)
|
||||
FILE *yyoutput;
|
||||
int yytype;
|
||||
YYSTYPE const * const yyvaluep;
|
||||
YYLTYPE const * const yylocationp;
|
||||
VirtualMachinePool * vmpool;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
#endif
|
||||
{
|
||||
if (yytype < YYNTOKENS)
|
||||
@ -867,7 +866,7 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, vmpool, vm, vm_id, par
|
||||
|
||||
YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||
YYFPRINTF (yyoutput, ": ");
|
||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, vmpool, vm, vm_id, parsed, errmsg);
|
||||
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, errmsg);
|
||||
YYFPRINTF (yyoutput, ")");
|
||||
}
|
||||
|
||||
@ -907,18 +906,17 @@ do { \
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static void
|
||||
yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
#else
|
||||
static void
|
||||
yy_reduce_print (yyvsp, yylsp, yyrule, vmpool, vm, vm_id, parsed, errmsg)
|
||||
yy_reduce_print (yyvsp, yylsp, yyrule, vm, vm_id, parsed, errmsg)
|
||||
YYSTYPE *yyvsp;
|
||||
YYLTYPE *yylsp;
|
||||
int yyrule;
|
||||
VirtualMachinePool * vmpool;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
#endif
|
||||
{
|
||||
int yynrhs = yyr2[yyrule];
|
||||
@ -932,7 +930,7 @@ yy_reduce_print (yyvsp, yylsp, yyrule, vmpool, vm, vm_id, parsed, errmsg)
|
||||
fprintf (stderr, " $%d = ", yyi + 1);
|
||||
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||||
, &(yylsp[(yyi + 1) - (yynrhs)]) , vmpool, vm, vm_id, parsed, errmsg);
|
||||
, &(yylsp[(yyi + 1) - (yynrhs)]) , vm, vm_id, parsed, errmsg);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
}
|
||||
@ -940,7 +938,7 @@ yy_reduce_print (yyvsp, yylsp, yyrule, vmpool, vm, vm_id, parsed, errmsg)
|
||||
# define YY_REDUCE_PRINT(Rule) \
|
||||
do { \
|
||||
if (yydebug) \
|
||||
yy_reduce_print (yyvsp, yylsp, Rule, vmpool, vm, vm_id, parsed, errmsg); \
|
||||
yy_reduce_print (yyvsp, yylsp, Rule, vm, vm_id, parsed, errmsg); \
|
||||
} while (YYID (0))
|
||||
|
||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||
@ -1191,24 +1189,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static void
|
||||
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
#else
|
||||
static void
|
||||
yydestruct (yymsg, yytype, yyvaluep, yylocationp, vmpool, vm, vm_id, parsed, errmsg)
|
||||
yydestruct (yymsg, yytype, yyvaluep, yylocationp, vm, vm_id, parsed, errmsg)
|
||||
const char *yymsg;
|
||||
int yytype;
|
||||
YYSTYPE *yyvaluep;
|
||||
YYLTYPE *yylocationp;
|
||||
VirtualMachinePool * vmpool;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
#endif
|
||||
{
|
||||
YYUSE (yyvaluep);
|
||||
YYUSE (yylocationp);
|
||||
YYUSE (vmpool);
|
||||
YYUSE (vm);
|
||||
YYUSE (vm_id);
|
||||
YYUSE (parsed);
|
||||
@ -1237,7 +1233,7 @@ int yyparse ();
|
||||
#endif
|
||||
#else /* ! YYPARSE_PARAM */
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg);
|
||||
int yyparse (VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg);
|
||||
#else
|
||||
int yyparse ();
|
||||
#endif
|
||||
@ -1266,15 +1262,14 @@ yyparse (YYPARSE_PARAM)
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
int
|
||||
yyparse (VirtualMachinePool * vmpool, VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
yyparse (VirtualMachine * vm, int vm_id, ostringstream * parsed, char ** errmsg)
|
||||
#else
|
||||
int
|
||||
yyparse (vmpool, vm, vm_id, parsed, errmsg)
|
||||
VirtualMachinePool * vmpool;
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
yyparse (vm, vm_id, parsed, errmsg)
|
||||
VirtualMachine * vm;
|
||||
int vm_id;
|
||||
ostringstream * parsed;
|
||||
char ** errmsg;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
@ -1545,7 +1540,7 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 4:
|
||||
#line 194 "vm_var_syntax.y"
|
||||
#line 195 "vm_var_syntax.y"
|
||||
{
|
||||
(*parsed) << (yyvsp[(1) - (1)].val_str);
|
||||
free((yyvsp[(1) - (1)].val_str));
|
||||
@ -1553,13 +1548,13 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
#line 199 "vm_var_syntax.y"
|
||||
#line 200 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (2)].val_str));
|
||||
|
||||
VM_VAR_TO_UPPER(name);
|
||||
|
||||
insert_single(vmpool,vm,vm_id,*parsed,name);
|
||||
insert_single(vm,vm_id,*parsed,name);
|
||||
|
||||
if ( (yyvsp[(2) - (2)].val_char) != '\0' )
|
||||
{
|
||||
@ -1571,7 +1566,7 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 6:
|
||||
#line 214 "vm_var_syntax.y"
|
||||
#line 215 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (5)].val_str));
|
||||
string vname((yyvsp[(3) - (5)].val_str));
|
||||
@ -1579,7 +1574,7 @@ yyreduce:
|
||||
VM_VAR_TO_UPPER(name);
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(vmpool,vm,vm_id,*parsed,name,vname,"","");
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,"","");
|
||||
|
||||
if ( (yyvsp[(5) - (5)].val_char) != '\0' )
|
||||
{
|
||||
@ -1592,7 +1587,7 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 7:
|
||||
#line 232 "vm_var_syntax.y"
|
||||
#line 233 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (9)].val_str));
|
||||
string vname((yyvsp[(3) - (9)].val_str));
|
||||
@ -1603,7 +1598,7 @@ yyreduce:
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
VM_VAR_TO_UPPER(vvar);
|
||||
|
||||
insert_vector(vmpool,vm,vm_id,*parsed,name,vname,vvar,vval);
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,vvar,vval);
|
||||
|
||||
if ( (yyvsp[(9) - (9)].val_char) != '\0' )
|
||||
{
|
||||
@ -1618,14 +1613,14 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 8:
|
||||
#line 255 "vm_var_syntax.y"
|
||||
#line 256 "vm_var_syntax.y"
|
||||
{
|
||||
string name("CONTEXT");
|
||||
string vname((yyvsp[(2) - (3)].val_str));
|
||||
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(vmpool,0,(yyvsp[(1) - (3)].val_int),*parsed,name,vname,"","");
|
||||
insert_vector(0,(yyvsp[(1) - (3)].val_int),*parsed,name,vname,"","");
|
||||
|
||||
if ( (yyvsp[(3) - (3)].val_char) != '\0' )
|
||||
{
|
||||
@ -1638,7 +1633,7 @@ yyreduce:
|
||||
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1642 "vm_var_syntax.cc"
|
||||
#line 1637 "vm_var_syntax.cc"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1674,7 +1669,7 @@ yyerrlab:
|
||||
{
|
||||
++yynerrs;
|
||||
#if ! YYERROR_VERBOSE
|
||||
yyerror (&yylloc, vmpool, vm, vm_id, parsed, errmsg, YY_("syntax error"));
|
||||
yyerror (&yylloc, vm, vm_id, parsed, errmsg, YY_("syntax error"));
|
||||
#else
|
||||
{
|
||||
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
|
||||
@ -1698,11 +1693,11 @@ yyerrlab:
|
||||
if (0 < yysize && yysize <= yymsg_alloc)
|
||||
{
|
||||
(void) yysyntax_error (yymsg, yystate, yychar);
|
||||
yyerror (&yylloc, vmpool, vm, vm_id, parsed, errmsg, yymsg);
|
||||
yyerror (&yylloc, vm, vm_id, parsed, errmsg, yymsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
yyerror (&yylloc, vmpool, vm, vm_id, parsed, errmsg, YY_("syntax error"));
|
||||
yyerror (&yylloc, vm, vm_id, parsed, errmsg, YY_("syntax error"));
|
||||
if (yysize != 0)
|
||||
goto yyexhaustedlab;
|
||||
}
|
||||
@ -1726,7 +1721,7 @@ yyerrlab:
|
||||
else
|
||||
{
|
||||
yydestruct ("Error: discarding",
|
||||
yytoken, &yylval, &yylloc, vmpool, vm, vm_id, parsed, errmsg);
|
||||
yytoken, &yylval, &yylloc, vm, vm_id, parsed, errmsg);
|
||||
yychar = YYEMPTY;
|
||||
}
|
||||
}
|
||||
@ -1783,7 +1778,7 @@ yyerrlab1:
|
||||
|
||||
yyerror_range[0] = *yylsp;
|
||||
yydestruct ("Error: popping",
|
||||
yystos[yystate], yyvsp, yylsp, vmpool, vm, vm_id, parsed, errmsg);
|
||||
yystos[yystate], yyvsp, yylsp, vm, vm_id, parsed, errmsg);
|
||||
YYPOPSTACK (1);
|
||||
yystate = *yyssp;
|
||||
YY_STACK_PRINT (yyss, yyssp);
|
||||
@ -1826,7 +1821,7 @@ yyabortlab:
|
||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||
`-------------------------------------------------*/
|
||||
yyexhaustedlab:
|
||||
yyerror (&yylloc, vmpool, vm, vm_id, parsed, errmsg, YY_("memory exhausted"));
|
||||
yyerror (&yylloc, vm, vm_id, parsed, errmsg, YY_("memory exhausted"));
|
||||
yyresult = 2;
|
||||
/* Fall through. */
|
||||
#endif
|
||||
@ -1834,7 +1829,7 @@ yyexhaustedlab:
|
||||
yyreturn:
|
||||
if (yychar != YYEOF && yychar != YYEMPTY)
|
||||
yydestruct ("Cleanup: discarding lookahead",
|
||||
yytoken, &yylval, &yylloc, vmpool, vm, vm_id, parsed, errmsg);
|
||||
yytoken, &yylval, &yylloc, vm, vm_id, parsed, errmsg);
|
||||
/* Do not reclaim the symbols of the rule which action triggered
|
||||
this YYABORT or YYACCEPT. */
|
||||
YYPOPSTACK (yylen);
|
||||
@ -1842,7 +1837,7 @@ yyreturn:
|
||||
while (yyssp != yyss)
|
||||
{
|
||||
yydestruct ("Cleanup: popping",
|
||||
yystos[*yyssp], yyvsp, yylsp, vmpool, vm, vm_id, parsed, errmsg);
|
||||
yystos[*yyssp], yyvsp, yylsp, vm, vm_id, parsed, errmsg);
|
||||
YYPOPSTACK (1);
|
||||
}
|
||||
#ifndef yyoverflow
|
||||
@ -1858,24 +1853,23 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
#line 271 "vm_var_syntax.y"
|
||||
#line 272 "vm_var_syntax.y"
|
||||
|
||||
|
||||
extern "C" void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** error_msg,
|
||||
const char * str)
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** error_msg,
|
||||
const char * str)
|
||||
{
|
||||
int length;
|
||||
|
||||
length = strlen(str)+ 64;
|
||||
|
||||
*error_msg = (char *) malloc(sizeof(char)*length);
|
||||
string nil = "";
|
||||
|
||||
if (*error_msg != 0)
|
||||
{
|
||||
snprintf(*error_msg,
|
||||
|
@ -64,7 +64,7 @@
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 166 "vm_var_syntax.y"
|
||||
#line 167 "vm_var_syntax.y"
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "vm_var_syntax.h"
|
||||
#include "VirtualMachinePool.h"
|
||||
#include "VirtualMachine.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define VM_VAR_TO_UPPER(S) transform (S.begin(),S.end(),S.begin(), \
|
||||
@ -35,38 +37,37 @@
|
||||
extern "C"
|
||||
{
|
||||
void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg,
|
||||
const char * str);
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg,
|
||||
const char * str);
|
||||
|
||||
int vm_var_lex (YYSTYPE *lvalp, YYLTYPE *llocp);
|
||||
|
||||
int vm_var_parse (VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
int vm_var_parse (VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** errmsg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_single(VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name)
|
||||
void insert_single(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name)
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 && vmpool != 0 )
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm = vmpool->get(vm_id,true);
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
@ -87,14 +88,13 @@ void insert_single(VirtualMachinePool * vmpool,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void insert_vector(VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name,
|
||||
const string& vname,
|
||||
const string& vvar,
|
||||
const string& vval)
|
||||
void insert_vector(VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream& parsed,
|
||||
const string& name,
|
||||
const string& vname,
|
||||
const string& vvar,
|
||||
const string& vval)
|
||||
|
||||
{
|
||||
VirtualMachine * tvm = vm;
|
||||
@ -105,9 +105,11 @@ void insert_vector(VirtualMachinePool * vmpool,
|
||||
int num;
|
||||
string value = "";
|
||||
|
||||
if ( vm == 0 && vmpool != 0 )
|
||||
if ( vm == 0 )
|
||||
{
|
||||
tvm = vmpool->get(vm_id,true);
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
tvm = nd.get_vmpool()->get(vm_id,true);
|
||||
}
|
||||
|
||||
if ( tvm == 0 )
|
||||
@ -157,11 +159,10 @@ error_name:
|
||||
|
||||
%}
|
||||
|
||||
%parse-param {VirtualMachinePool * vmpool}
|
||||
%parse-param {VirtualMachine * vm}
|
||||
%parse-param {int vm_id}
|
||||
%parse-param {ostringstream * parsed}
|
||||
%parse-param {char ** errmsg}
|
||||
%parse-param {VirtualMachine * vm}
|
||||
%parse-param {int vm_id}
|
||||
%parse-param {ostringstream * parsed}
|
||||
%parse-param {char ** errmsg}
|
||||
|
||||
%union {
|
||||
char * val_str;
|
||||
@ -177,12 +178,12 @@ error_name:
|
||||
|
||||
%token EQUAL COMMA OBRACKET CBRACKET
|
||||
|
||||
%token <val_char> EOA
|
||||
%token <val_str> STRING
|
||||
%token <val_str> RSTRING
|
||||
%token <val_int> INTEGER
|
||||
%type <void> vm_variable
|
||||
%type <void> vm_string
|
||||
%token <val_char> EOA
|
||||
%token <val_str> STRING
|
||||
%token <val_str> RSTRING
|
||||
%token <val_int> INTEGER
|
||||
%type <void> vm_variable
|
||||
%type <void> vm_string
|
||||
|
||||
%%
|
||||
|
||||
@ -201,7 +202,7 @@ vm_variable:RSTRING
|
||||
|
||||
VM_VAR_TO_UPPER(name);
|
||||
|
||||
insert_single(vmpool,vm,vm_id,*parsed,name);
|
||||
insert_single(vm,vm_id,*parsed,name);
|
||||
|
||||
if ( $2 != '\0' )
|
||||
{
|
||||
@ -218,7 +219,7 @@ vm_variable:RSTRING
|
||||
VM_VAR_TO_UPPER(name);
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(vmpool,vm,vm_id,*parsed,name,vname,"","");
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,"","");
|
||||
|
||||
if ( $5 != '\0' )
|
||||
{
|
||||
@ -239,7 +240,7 @@ vm_variable:RSTRING
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
VM_VAR_TO_UPPER(vvar);
|
||||
|
||||
insert_vector(vmpool,vm,vm_id,*parsed,name,vname,vvar,vval);
|
||||
insert_vector(vm,vm_id,*parsed,name,vname,vvar,vval);
|
||||
|
||||
if ( $9 != '\0' )
|
||||
{
|
||||
@ -258,7 +259,7 @@ vm_variable:RSTRING
|
||||
|
||||
VM_VAR_TO_UPPER(vname);
|
||||
|
||||
insert_vector(vmpool,0,$1,*parsed,name,vname,"","");
|
||||
insert_vector(0,$1,*parsed,name,vname,"","");
|
||||
|
||||
if ( $3 != '\0' )
|
||||
{
|
||||
@ -271,20 +272,19 @@ vm_variable:RSTRING
|
||||
%%
|
||||
|
||||
extern "C" void vm_var_error(
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachinePool * vmpool,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** error_msg,
|
||||
const char * str)
|
||||
YYLTYPE * llocp,
|
||||
VirtualMachine * vm,
|
||||
int vm_id,
|
||||
ostringstream * parsed,
|
||||
char ** error_msg,
|
||||
const char * str)
|
||||
{
|
||||
int length;
|
||||
|
||||
length = strlen(str)+ 64;
|
||||
|
||||
*error_msg = (char *) malloc(sizeof(char)*length);
|
||||
string nil = "";
|
||||
|
||||
if (*error_msg != 0)
|
||||
{
|
||||
snprintf(*error_msg,
|
||||
|
Loading…
Reference in New Issue
Block a user