[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] libxlu: Handle += in config files
commit a30910bfd71a64895f0d6ddbb301cf1b5ed6c2f4 Author: Anthony PERARD <anthony.perard@xxxxxxxxxx> AuthorDate: Tue Aug 13 15:48:27 2019 +0100 Commit: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> CommitDate: Fri Sep 20 12:20:02 2019 +0100 libxlu: Handle += in config files Handle += of both strings and lists. If += is used for config options expected to be numbers, then a warning is printed and the config option ignored (because xl ignores config options with errors). This is to be used for development purposes, where modifying config option can be done on the `xl create' command line. One could have a cmdline= in the cfg file, and specify cmdline+= on the `xl create` command line without the need to write the whole cmdline in `xl' command line but simply append to the one in the cfg file. Or add an extra vif or disk by simply having "vif += [ '', ];" in the `xl' cmdline. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxlu_cfg.c | 100 ++++++++++- tools/libxl/libxlu_cfg_i.h | 1 + tools/libxl/libxlu_cfg_l.c | 383 ++++++++++++++++++++++-------------------- tools/libxl/libxlu_cfg_l.h | 50 +++--- tools/libxl/libxlu_cfg_l.l | 1 + tools/libxl/libxlu_cfg_y.c | 191 +++++++++++---------- tools/libxl/libxlu_cfg_y.h | 13 +- tools/libxl/libxlu_cfg_y.y | 4 +- tools/libxl/libxlu_internal.h | 1 + tools/libxl/libxlutil.h | 5 + 10 files changed, 437 insertions(+), 312 deletions(-) diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c index 5838f6885e..72815d25dd 100644 --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -276,6 +276,14 @@ int xlu_cfg_get_long(const XLU_Config *cfg, const char *n, char *ep; e= find_atom(cfg,n,&set,dont_warn); if (e) return e; + if (set->op == XLU_OP_ADDITION) { + if (!dont_warn) + fprintf(cfg->report, + "%s:%d: warning: can't use += with numbers" + " for parameter `%s'\n", + cfg->config_source, set->lineno, n); + return EINVAL; + } errno= 0; l= strtol(set->value->u.string, &ep, 0); e= errno; if (errno) { @@ -450,23 +458,111 @@ void xlu__cfg_list_append(CfgParseContext *ctx, list->u.list.nvalues++; } +static int xlu__cfg_concat_vals(CfgParseContext *ctx, + XLU_ConfigValue *prev, + XLU_ConfigValue *to_add) +{ + int r; + + if (prev->type != to_add->type) { + xlu__cfgl_lexicalerror(ctx, + "can't add [list] to \"string\" or vice versa"); + return EINVAL; + } + + switch (to_add->type) { + case XLU_STRING: { + char *new_string = NULL; + + r = asprintf(&new_string, "%s%s", prev->u.string, + to_add->u.string); + if (r < 0) { + return errno; + } + free(to_add->u.string); + to_add->u.string = new_string; + return 0; + } + case XLU_LIST: { + XLU_ConfigList *const prev_list = &prev->u.list; + XLU_ConfigList *const cur_list = &to_add->u.list; + int nvalues; + + if (prev->u.list.nvalues > INT_MAX - to_add->u.list.nvalues) { + return ERANGE; + } + nvalues = prev->u.list.nvalues + to_add->u.list.nvalues; + + if (nvalues >= cur_list->avalues) { + XLU_ConfigValue **new_vals; + new_vals = realloc(cur_list->values, + nvalues * sizeof(*new_vals)); + if (!new_vals) { + return ENOMEM; + } + cur_list->avalues = nvalues; + cur_list->values = new_vals; + } + + /* make space for `prev' into `to_add' */ + memmove(cur_list->values + prev_list->nvalues, + cur_list->values, + cur_list->nvalues * sizeof(XLU_ConfigValue *)); + /* move values from `prev' to `to_add' as the list in `prev' will + * not be reachable by find(). */ + memcpy(cur_list->values, + prev_list->values, + prev_list->nvalues * sizeof(XLU_ConfigValue *)); + cur_list->nvalues = nvalues; + prev_list->nvalues = 0; + memset(prev_list->values, 0, + prev_list->nvalues * sizeof(XLU_ConfigValue *)); + return 0; + } + default: + abort(); + } + return -1; +} + void xlu__cfg_set_store(CfgParseContext *ctx, char *name, + enum XLU_Operation op, XLU_ConfigValue *val, int lineno) { XLU_ConfigSetting *set; + int r; - if (ctx->err) return; + if (ctx->err) goto out; assert(name); + + if (op == XLU_OP_ADDITION) { + /* If we have += concatenate with previous value with same name */ + XLU_ConfigSetting *prev_set = find(ctx->cfg, name); + if (prev_set) { + r = xlu__cfg_concat_vals(ctx, prev_set->value, val); + if (r) { + ctx->err = r; + goto out; + } + } + } + set = malloc(sizeof(*set)); if (!set) { ctx->err = errno; - return; + goto out; } set->name= name; set->value = val; + set->op = op; set->lineno= lineno; set->next= ctx->cfg->settings; ctx->cfg->settings= set; + return; +out: + assert(ctx->err); + free(name); + xlu__cfg_value_free(val); } char *xlu__cfgl_strdup(CfgParseContext *ctx, const char *src) { diff --git a/tools/libxl/libxlu_cfg_i.h b/tools/libxl/libxlu_cfg_i.h index 1b59b3312f..87b19df311 100644 --- a/tools/libxl/libxlu_cfg_i.h +++ b/tools/libxl/libxlu_cfg_i.h @@ -24,6 +24,7 @@ void xlu__cfg_set_free(XLU_ConfigSetting *set); void xlu__cfg_set_store(CfgParseContext*, char *name, + enum XLU_Operation op, XLU_ConfigValue *val, int lineno); XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx, char *atom, YYLTYPE *loc); diff --git a/tools/libxl/libxlu_cfg_l.c b/tools/libxl/libxlu_cfg_l.c index 099aa8ef18..b82df00b4e 100644 --- a/tools/libxl/libxlu_cfg_l.c +++ b/tools/libxl/libxlu_cfg_l.c @@ -8,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -88,25 +88,13 @@ typedef unsigned int flex_uint32_t; #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 +/* 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. */ @@ -190,7 +178,7 @@ typedef size_t yy_size_t; /* 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 xlu__cfg_yylex. + * existing scanners that call yyless() from OUTSIDE xlu__cfg_yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * 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. @@ -238,12 +226,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 @@ -266,7 +254,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. */ @@ -322,7 +310,7 @@ static void xlu__cfg_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yysc YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -352,7 +340,7 @@ void xlu__cfg_yyfree (void * ,yyscan_t yyscanner ); #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) -#define xlu__cfg_yywrap(yyscanner) 1 +#define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -364,7 +352,7 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. @@ -372,13 +360,13 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ yyg->yytext_ptr -= yyg->yy_more_len; \ - yyleng = (size_t) (yy_cp - yyg->yytext_ptr); \ + yyleng = (int) (yy_cp - yyg->yytext_ptr); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 16 -#define YY_END_OF_BUFFER 17 +#define YY_NUM_RULES 17 +#define YY_END_OF_BUFFER 18 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -386,30 +374,30 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[35] = +static yyconst flex_int16_t yy_accept[37] = { 0, - 0, 0, 14, 14, 17, 13, 3, 9, 13, 13, - 13, 12, 4, 2, 8, 7, 5, 6, 1, 14, - 14, 15, 0, 11, 0, 0, 9, 0, 10, 0, - 2, 1, 14, 0 + 0, 0, 15, 15, 18, 14, 3, 10, 14, 14, + 14, 13, 13, 4, 2, 9, 8, 5, 6, 1, + 15, 15, 16, 0, 12, 0, 0, 10, 0, 11, + 0, 7, 2, 1, 15, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 5, 1, 1, 1, 6, 7, - 7, 1, 7, 8, 7, 9, 1, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 7, 11, 1, - 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 7, 1, 8, 9, 7, 10, 1, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 7, 12, 1, + 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 13, 14, 15, 1, 16, 1, 17, 17, 17, 17, + 14, 15, 16, 1, 17, 1, 18, 18, 18, 18, - 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, - 18, 18, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, + 19, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -426,56 +414,58 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[19] = +static yyconst YY_CHAR yy_meta[20] = { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 4, 4, - 1, 1, 1, 1, 1, 4, 4, 4 + 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, + 4, 1, 1, 1, 1, 1, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[41] = +static yyconst flex_uint16_t yy_base[43] = { 0, - 0, 0, 17, 19, 44, 58, 58, 58, 19, 28, - 18, 58, 58, 17, 58, 58, 58, 58, 0, 0, - 58, 58, 21, 58, 0, 26, 58, 22, 58, 0, - 20, 0, 0, 58, 37, 41, 45, 49, 22, 53 + 0, 0, 18, 20, 53, 59, 59, 59, 20, 42, + 19, 59, 19, 59, 15, 59, 59, 59, 59, 0, + 0, 59, 59, 23, 59, 0, 28, 59, 22, 59, + 0, 59, 18, 0, 0, 59, 38, 42, 46, 50, + 26, 54 } ; -static yyconst flex_int16_t yy_def[41] = +static yyconst flex_int16_t yy_def[43] = { 0, - 34, 1, 35, 35, 34, 34, 34, 34, 36, 37, - 38, 34, 34, 34, 34, 34, 34, 34, 39, 40, - 34, 34, 36, 34, 36, 37, 34, 38, 34, 38, - 34, 39, 40, 0, 34, 34, 34, 34, 34, 34 + 36, 1, 37, 37, 36, 36, 36, 36, 38, 39, + 40, 36, 36, 36, 36, 36, 36, 36, 36, 41, + 42, 36, 36, 38, 36, 38, 39, 36, 40, 36, + 40, 36, 36, 41, 42, 0, 36, 36, 36, 36, + 36, 36 } ; -static yyconst flex_int16_t yy_nxt[77] = +static yyconst flex_uint16_t yy_nxt[79] = { 0, - 6, 7, 8, 9, 10, 11, 12, 13, 12, 14, - 15, 16, 17, 6, 18, 6, 19, 19, 21, 22, - 21, 22, 24, 29, 24, 32, 31, 29, 27, 31, - 27, 30, 25, 31, 25, 30, 31, 20, 20, 20, - 20, 23, 23, 34, 23, 26, 26, 26, 26, 28, - 28, 34, 28, 33, 34, 34, 33, 5, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34 + 6, 7, 8, 9, 10, 11, 12, 13, 14, 12, + 15, 16, 17, 18, 6, 19, 6, 20, 20, 22, + 23, 22, 23, 25, 30, 33, 25, 30, 33, 34, + 28, 32, 33, 31, 26, 33, 31, 26, 21, 21, + 21, 21, 24, 24, 28, 24, 27, 27, 27, 27, + 29, 29, 36, 29, 35, 36, 36, 35, 5, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36 } ; -static yyconst flex_int16_t yy_chk[77] = +static yyconst flex_int16_t yy_chk[79] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 4, 4, 9, 11, 23, 39, 14, 28, 26, 31, - 10, 11, 9, 14, 23, 28, 31, 35, 35, 35, - 35, 36, 36, 5, 36, 37, 37, 37, 37, 38, - 38, 0, 38, 40, 0, 0, 40, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 4, 4, 9, 11, 15, 24, 29, 33, 41, + 27, 13, 15, 11, 9, 33, 29, 24, 37, 37, + 37, 37, 38, 38, 10, 38, 39, 39, 39, 39, + 40, 40, 5, 40, 42, 0, 0, 42, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[17] = +static yyconst flex_int32_t yy_rule_can_match_eol[18] = { 0, -0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, }; +0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, }; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -521,7 +511,7 @@ int xlu__cfg_yyget_column(yyscan_t yyscanner); void xlu__cfg_yyset_column(int column_no, yyscan_t yyscanner); -#line 525 "libxlu_cfg_l.c" +#line 515 "libxlu_cfg_l.c" #define INITIAL 0 #define lexerr 1 @@ -551,8 +541,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -603,23 +593,23 @@ void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *xlu__cfg_yyget_in (yyscan_t yyscanner ); -void xlu__cfg_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void xlu__cfg_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *xlu__cfg_yyget_out (yyscan_t yyscanner ); -void xlu__cfg_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void xlu__cfg_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t xlu__cfg_yyget_leng (yyscan_t yyscanner ); + int xlu__cfg_yyget_leng (yyscan_t yyscanner ); char *xlu__cfg_yyget_text (yyscan_t yyscanner ); int xlu__cfg_yyget_lineno (yyscan_t yyscanner ); -void xlu__cfg_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int xlu__cfg_yyget_column (yyscan_t yyscanner ); -void xlu__cfg_yyset_column (int column_no ,yyscan_t yyscanner ); +void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner ); YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner ); @@ -641,6 +631,10 @@ extern int xlu__cfg_yywrap (yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -674,7 +668,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } 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, @@ -685,7 +679,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -698,7 +692,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -755,7 +749,7 @@ extern int xlu__cfg_yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -765,9 +759,9 @@ extern int xlu__cfg_yylex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; @@ -804,9 +798,9 @@ YY_DECL #line 53 "libxlu_cfg_l.l" -#line 808 "libxlu_cfg_l.c" +#line 802 "libxlu_cfg_l.c" - while ( 1 ) /* loops until end-of-file is reached */ + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yyg->yy_more_len = 0; if ( yyg->yy_more_flag ) @@ -828,7 +822,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -837,13 +831,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 35 ) + if ( yy_current_state >= 37 ) yy_c = yy_meta[(unsigned int) 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] + (flex_int16_t) yy_c]; ++yy_cp; } - while ( yy_current_state != 34 ); + while ( yy_current_state != 36 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -854,10 +848,10 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; + int yyl; for ( yyl = yyg->yy_more_len; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) - + do{ yylineno++; yycolumn=0; }while(0) @@ -914,76 +908,81 @@ YY_RULE_SETUP case 7: YY_RULE_SETUP #line 69 "libxlu_cfg_l.l" -{ GOT('='); } +{ GOT(OP_ADD); } YY_BREAK case 8: YY_RULE_SETUP #line 70 "libxlu_cfg_l.l" -{ GOT(';'); } +{ GOT('='); } YY_BREAK case 9: -/* rule 9 can match eol */ YY_RULE_SETUP -#line 72 "libxlu_cfg_l.l" -{ yylloc->first_line= yylineno-1; return NEWLINE; } +#line 71 "libxlu_cfg_l.l" +{ GOT(';'); } YY_BREAK case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 73 "libxlu_cfg_l.l" +{ yylloc->first_line= yylineno-1; return NEWLINE; } + YY_BREAK +case 11: YY_RULE_SETUP -#line 74 "libxlu_cfg_l.l" +#line 75 "libxlu_cfg_l.l" { yylval->string= xlu__cfgl_dequote(ctx,yytext); GOT(STRING); } YY_BREAK -case 11: +case 12: YY_RULE_SETUP -#line 78 "libxlu_cfg_l.l" +#line 79 "libxlu_cfg_l.l" { yylval->string= xlu__cfgl_dequote(ctx,yytext); GOT(STRING); } YY_BREAK -case 12: +case 13: YY_RULE_SETUP -#line 83 "libxlu_cfg_l.l" +#line 84 "libxlu_cfg_l.l" { ctx->likely_python= 1; BEGIN(lexerr); yymore(); } YY_BREAK -case 13: +case 14: YY_RULE_SETUP -#line 89 "libxlu_cfg_l.l" +#line 90 "libxlu_cfg_l.l" { BEGIN(lexerr); yymore(); } YY_BREAK -case 14: +case 15: YY_RULE_SETUP -#line 94 "libxlu_cfg_l.l" +#line 95 "libxlu_cfg_l.l" { xlu__cfgl_lexicalerror(ctx,"lexical error"); BEGIN(0); } YY_BREAK -case 15: -/* rule 15 can match eol */ +case 16: +/* rule 16 can match eol */ YY_RULE_SETUP -#line 99 "libxlu_cfg_l.l" +#line 100 "libxlu_cfg_l.l" { xlu__cfgl_lexicalerror(ctx,"lexical error"); BEGIN(0); GOT(NEWLINE); } YY_BREAK -case 16: +case 17: YY_RULE_SETUP -#line 104 "libxlu_cfg_l.l" +#line 105 "libxlu_cfg_l.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 987 "libxlu_cfg_l.c" +#line 986 "libxlu_cfg_l.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(lexerr): yyterminate(); @@ -1129,9 +1128,9 @@ case YY_STATE_EOF(lexerr): static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1160,7 +1159,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1187,7 +1186,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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; @@ -1200,7 +1199,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } 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( @@ -1242,9 +1241,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yyg->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 = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xlu__cfg_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1263,15 +1262,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1280,10 +1279,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 35 ) + if ( yy_current_state >= 37 ) yy_c = yy_meta[(unsigned int) 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] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -1296,11 +1295,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1309,16 +1308,20 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 35 ) + if ( yy_current_state >= 37 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 34); + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 36); (void)yyg; return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1344,7 +1347,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1368,7 +1371,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( xlu__cfg_yywrap(yyscanner ) ) - return EOF; + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1391,7 +1394,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yyg->yy_hold_char = *++yyg->yy_c_buf_p; if ( c == '\n' ) - + do{ yylineno++; yycolumn=0; }while(0) @@ -1479,7 +1482,7 @@ static void xlu__cfg_yy_load_buffer_state (yyscan_t yyscanner) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)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. @@ -1631,7 +1634,7 @@ void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner) */ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -1640,15 +1643,15 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" ); - + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; @@ -1657,7 +1660,7 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyrealloc @@ -1677,7 +1680,7 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner) * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { @@ -1687,7 +1690,7 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_ 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) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) @@ -1696,7 +1699,7 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_ b->yy_buf_size = 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; @@ -1719,7 +1722,7 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_ YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return xlu__cfg_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return xlu__cfg_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to xlu__cfg_yylex() will @@ -1729,15 +1732,15 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscann * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { 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; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) xlu__cfg_yyalloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_scan_bytes()" ); @@ -1763,9 +1766,11 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yyb #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1803,7 +1808,7 @@ YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner) int xlu__cfg_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -1816,7 +1821,7 @@ int xlu__cfg_yyget_lineno (yyscan_t yyscanner) int xlu__cfg_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -1844,7 +1849,7 @@ FILE *xlu__cfg_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t xlu__cfg_yyget_leng (yyscan_t yyscanner) +int xlu__cfg_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -1871,10 +1876,10 @@ void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void xlu__cfg_yyset_lineno (int line_number , yyscan_t yyscanner) +void xlu__cfg_yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1882,14 +1887,14 @@ void xlu__cfg_yyset_lineno (int line_number , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "xlu__cfg_yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void xlu__cfg_yyset_column (int column_no , yyscan_t yyscanner) +void xlu__cfg_yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1897,25 +1902,25 @@ void xlu__cfg_yyset_column (int column_no , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "xlu__cfg_yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see xlu__cfg_yy_switch_to_buffer */ -void xlu__cfg_yyset_in (FILE * in_str , yyscan_t yyscanner) +void xlu__cfg_yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void xlu__cfg_yyset_out (FILE * out_str , yyscan_t yyscanner) +void xlu__cfg_yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int xlu__cfg_yyget_debug (yyscan_t yyscanner) @@ -1924,10 +1929,10 @@ int xlu__cfg_yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void xlu__cfg_yyset_debug (int bdebug , yyscan_t yyscanner) +void xlu__cfg_yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2003,20 +2008,20 @@ int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_glo errno = EINVAL; return 1; } - + *ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - + if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } - + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - + xlu__cfg_yyset_extra (yy_user_defined, *ptr_yy_globals); - + return yy_init_globals ( *ptr_yy_globals ); } @@ -2027,10 +2032,10 @@ static int yy_init_globals (yyscan_t yyscanner) * This function is called from xlu__cfg_yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2043,8 +2048,8 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2090,7 +2095,10 @@ int xlu__cfg_yylex_destroy (yyscan_t yyscanner) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2099,7 +2107,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2109,11 +2117,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *xlu__cfg_yyalloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } void *xlu__cfg_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2121,14 +2134,16 @@ void *xlu__cfg_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) * 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 xlu__cfg_yyfree (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see xlu__cfg_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 103 "libxlu_cfg_l.l" +#line 105 "libxlu_cfg_l.l" diff --git a/tools/libxl/libxlu_cfg_l.h b/tools/libxl/libxlu_cfg_l.h index bdf0517369..415c3ce089 100644 --- a/tools/libxl/libxlu_cfg_l.h +++ b/tools/libxl/libxlu_cfg_l.h @@ -12,8 +12,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -92,25 +92,13 @@ typedef unsigned int flex_uint32_t; #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 +/* 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 /* An opaque pointer. */ @@ -165,12 +153,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 @@ -193,7 +181,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. */ @@ -214,13 +202,13 @@ void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); void xlu__cfg_yyfree (void * ,yyscan_t yyscanner ); -#define xlu__cfg_yywrap(yyscanner) 1 +#define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -262,23 +250,23 @@ void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *xlu__cfg_yyget_in (yyscan_t yyscanner ); -void xlu__cfg_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void xlu__cfg_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *xlu__cfg_yyget_out (yyscan_t yyscanner ); -void xlu__cfg_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void xlu__cfg_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t xlu__cfg_yyget_leng (yyscan_t yyscanner ); + int xlu__cfg_yyget_leng (yyscan_t yyscanner ); char *xlu__cfg_yyget_text (yyscan_t yyscanner ); int xlu__cfg_yyget_lineno (yyscan_t yyscanner ); -void xlu__cfg_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int xlu__cfg_yyget_column (yyscan_t yyscanner ); -void xlu__cfg_yyset_column (int column_no ,yyscan_t yyscanner ); +void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner ); YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner ); @@ -354,8 +342,8 @@ extern int xlu__cfg_yylex \ #undef YY_DECL #endif -#line 103 "libxlu_cfg_l.l" +#line 105 "libxlu_cfg_l.l" -#line 360 "libxlu_cfg_l.h" +#line 348 "libxlu_cfg_l.h" #undef xlu__cfg_yyIN_HEADER #endif /* xlu__cfg_yyHEADER_H */ diff --git a/tools/libxl/libxlu_cfg_l.l b/tools/libxl/libxlu_cfg_l.l index e0ea8cfcb3..390d6e2c2b 100644 --- a/tools/libxl/libxlu_cfg_l.l +++ b/tools/libxl/libxlu_cfg_l.l @@ -66,6 +66,7 @@ void xlu__cfg_yyset_column(int column_no, yyscan_t yyscanner); , { GOT(','); } \[ { GOT('['); } \] { GOT(']'); } +\+\= { GOT(OP_ADD); } \= { GOT('='); } \; { GOT(';'); } diff --git a/tools/libxl/libxlu_cfg_y.c b/tools/libxl/libxlu_cfg_y.c index 734e60af3c..751daa3842 100644 --- a/tools/libxl/libxlu_cfg_y.c +++ b/tools/libxl/libxlu_cfg_y.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -112,13 +112,14 @@ extern int xlu__cfg_yydebug; IDENT = 258, STRING = 259, NUMBER = 260, - NEWLINE = 261 + NEWLINE = 261, + OP_ADD = 262 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { #line 25 "libxlu_cfg_y.y" /* yacc.c:355 */ @@ -126,8 +127,10 @@ union YYSTYPE char *string; XLU_ConfigValue *value; -#line 130 "libxlu_cfg_y.c" /* yacc.c:355 */ +#line 131 "libxlu_cfg_y.c" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -154,7 +157,7 @@ int xlu__cfg_yyparse (CfgParseContext *ctx); /* Copy the second part of user declarations. */ -#line 158 "libxlu_cfg_y.c" /* yacc.c:358 */ +#line 161 "libxlu_cfg_y.c" /* yacc.c:358 */ #ifdef short # undef short @@ -398,21 +401,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 25 +#define YYLAST 27 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 12 +#define YYNTOKENS 13 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 11 /* YYNRULES -- Number of rules. */ -#define YYNRULES 22 +#define YYNRULES 23 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 30 +#define YYNSTATES 32 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 261 +#define YYMAXUTOK 262 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -425,12 +428,12 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 11, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, - 2, 7, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 12, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, + 2, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 9, 2, 10, 2, 2, 2, 2, 2, 2, + 2, 10, 2, 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -447,16 +450,16 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6 + 5, 6, 7 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 47, 47, 48, 50, 51, 53, 54, 55, 57, - 59, 60, 62, 63, 65, 66, 68, 69, 70, 72, - 73, 75, 77 + 0, 48, 48, 49, 51, 52, 54, 55, 56, 58, + 59, 61, 62, 64, 65, 67, 68, 70, 71, 72, + 74, 75, 77, 79 }; #endif @@ -466,8 +469,9 @@ static const yytype_uint8 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "IDENT", "STRING", "NUMBER", "NEWLINE", - "'='", "';'", "'['", "']'", "','", "$accept", "file", "stmts", "stmt", - "assignment", "endstmt", "value", "atom", "valuelist", "values", "nlok", YY_NULLPTR + "\"+=\"", "'='", "';'", "'['", "']'", "','", "$accept", "file", "stmts", + "stmt", "assignment", "endstmt", "value", "atom", "valuelist", "values", + "nlok", YY_NULLPTR }; #endif @@ -476,8 +480,8 @@ static const char *const yytname[] = (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, 61, 59, 91, - 93, 44 + 0, 256, 257, 258, 259, 260, 261, 262, 61, 59, + 91, 93, 44 }; # endif @@ -495,9 +499,10 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -18, 4, 0, -18, -1, 6, -18, -18, -18, 3, - -18, -18, 14, -18, -18, -18, -18, -18, -18, 11, - -18, -18, 12, 10, 18, -18, -18, 11, -18, 18 + -18, 5, 1, -18, -3, 14, -18, -18, -18, 3, + -18, -18, 10, 10, -18, -18, -18, -18, -18, -18, + -18, 13, -18, -18, 15, 12, 19, -18, -18, 13, + -18, 19 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -505,23 +510,24 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 4, 0, 0, 1, 0, 0, 10, 11, 5, 3, - 7, 8, 0, 6, 14, 15, 21, 9, 12, 16, - 22, 21, 0, 17, 19, 13, 21, 18, 21, 20 + 4, 0, 0, 1, 0, 0, 11, 12, 5, 3, + 7, 8, 0, 0, 6, 15, 16, 22, 10, 13, + 9, 17, 23, 22, 0, 18, 20, 14, 22, 19, + 22, 21 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -18, -18, -18, -18, -18, 16, -17, -18, -18, -18, - -14 + -18, -18, -18, -18, -18, 18, -13, -18, -18, -18, + -17 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 2, 8, 9, 10, 17, 18, 22, 23, - 19 + -1, 1, 2, 8, 9, 10, 18, 19, 24, 25, + 21 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -529,41 +535,42 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { - -2, 4, 21, 5, 3, 11, 6, 24, 7, 6, - 28, 7, 27, 12, 29, 14, 15, 20, 14, 15, - 16, 26, 25, 16, 20, 13 + 20, -2, 4, 11, 5, 3, 26, 6, 23, 6, + 7, 29, 7, 31, 15, 16, 30, 15, 16, 22, + 17, 12, 13, 17, 28, 22, 27, 14 }; static const yytype_uint8 yycheck[] = { - 0, 1, 19, 3, 0, 6, 6, 21, 8, 6, - 27, 8, 26, 7, 28, 4, 5, 6, 4, 5, - 9, 11, 10, 9, 6, 9 + 13, 0, 1, 6, 3, 0, 23, 6, 21, 6, + 9, 28, 9, 30, 4, 5, 29, 4, 5, 6, + 10, 7, 8, 10, 12, 6, 11, 9 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 13, 14, 0, 1, 3, 6, 8, 15, 16, - 17, 6, 7, 17, 4, 5, 9, 18, 19, 22, - 6, 18, 20, 21, 22, 10, 11, 22, 18, 22 + 0, 14, 15, 0, 1, 3, 6, 9, 16, 17, + 18, 6, 7, 8, 18, 4, 5, 10, 19, 20, + 19, 23, 6, 19, 21, 22, 23, 11, 12, 23, + 19, 23 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 12, 13, 13, 14, 14, 15, 15, 15, 16, - 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, - 21, 22, 22 + 0, 13, 14, 14, 15, 15, 16, 16, 16, 17, + 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, + 22, 22, 23, 23 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 0, 2, 2, 1, 2, 3, - 1, 1, 1, 4, 1, 1, 0, 1, 3, 2, - 5, 0, 2 + 3, 1, 1, 1, 4, 1, 1, 0, 1, 3, + 2, 5, 0, 2 }; @@ -1060,43 +1067,43 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio case 3: /* IDENT */ #line 40 "libxlu_cfg_y.y" /* yacc.c:1257 */ { free(((*yyvaluep).string)); } -#line 1064 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1071 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; case 4: /* STRING */ #line 40 "libxlu_cfg_y.y" /* yacc.c:1257 */ { free(((*yyvaluep).string)); } -#line 1070 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1077 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; case 5: /* NUMBER */ #line 40 "libxlu_cfg_y.y" /* yacc.c:1257 */ { free(((*yyvaluep).string)); } -#line 1076 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1083 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; - case 18: /* value */ -#line 43 "libxlu_cfg_y.y" /* yacc.c:1257 */ + case 19: /* value */ +#line 44 "libxlu_cfg_y.y" /* yacc.c:1257 */ { xlu__cfg_value_free(((*yyvaluep).value)); } -#line 1082 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1089 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; - case 19: /* atom */ + case 20: /* atom */ #line 40 "libxlu_cfg_y.y" /* yacc.c:1257 */ { free(((*yyvaluep).string)); } -#line 1088 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1095 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; - case 20: /* valuelist */ -#line 43 "libxlu_cfg_y.y" /* yacc.c:1257 */ + case 21: /* valuelist */ +#line 44 "libxlu_cfg_y.y" /* yacc.c:1257 */ { xlu__cfg_value_free(((*yyvaluep).value)); } -#line 1094 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1101 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; - case 21: /* values */ -#line 43 "libxlu_cfg_y.y" /* yacc.c:1257 */ + case 22: /* values */ +#line 44 "libxlu_cfg_y.y" /* yacc.c:1257 */ { xlu__cfg_value_free(((*yyvaluep).value)); } -#line 1100 "libxlu_cfg_y.c" /* yacc.c:1257 */ +#line 1107 "libxlu_cfg_y.c" /* yacc.c:1257 */ break; @@ -1388,67 +1395,73 @@ yyreduce: switch (yyn) { case 9: -#line 57 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { xlu__cfg_set_store(ctx,(yyvsp[-2].string),(yyvsp[0].value),(yylsp[0]).first_line); } -#line 1394 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 58 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ASSIGNMENT,(yyvsp[0].value),(yylsp[0]).first_line); } +#line 1401 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; - case 12: -#line 62 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= xlu__cfg_string_mk(ctx,(yyvsp[0].string),&(yylsp[0])); } -#line 1400 "libxlu_cfg_y.c" /* yacc.c:1646 */ + case 10: +#line 59 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ADDITION,(yyvsp[0].value),(yylsp[0]).first_line); } +#line 1407 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 13: -#line 63 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= (yyvsp[-1].value); } -#line 1406 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 64 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { (yyval.value)= xlu__cfg_string_mk(ctx,(yyvsp[0].string),&(yylsp[0])); } +#line 1413 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 14: #line 65 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.string)= (yyvsp[0].string); } -#line 1412 "libxlu_cfg_y.c" /* yacc.c:1646 */ + { (yyval.value)= (yyvsp[-1].value); } +#line 1419 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 15: -#line 66 "libxlu_cfg_y.y" /* yacc.c:1646 */ +#line 67 "libxlu_cfg_y.y" /* yacc.c:1646 */ { (yyval.string)= (yyvsp[0].string); } -#line 1418 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 1425 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 16: #line 68 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= xlu__cfg_list_mk(ctx,NULL,&yylloc); } -#line 1424 "libxlu_cfg_y.c" /* yacc.c:1646 */ + { (yyval.string)= (yyvsp[0].string); } +#line 1431 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 17: -#line 69 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= (yyvsp[0].value); } -#line 1430 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 70 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { (yyval.value)= xlu__cfg_list_mk(ctx,NULL,&yylloc); } +#line 1437 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 18: -#line 70 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= (yyvsp[-2].value); } -#line 1436 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 71 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { (yyval.value)= (yyvsp[0].value); } +#line 1443 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 19: #line 72 "libxlu_cfg_y.y" /* yacc.c:1646 */ - { (yyval.value)= xlu__cfg_list_mk(ctx,(yyvsp[-1].value),&(yylsp[-1])); } -#line 1442 "libxlu_cfg_y.c" /* yacc.c:1646 */ + { (yyval.value)= (yyvsp[-2].value); } +#line 1449 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; case 20: -#line 73 "libxlu_cfg_y.y" /* yacc.c:1646 */ +#line 74 "libxlu_cfg_y.y" /* yacc.c:1646 */ + { (yyval.value)= xlu__cfg_list_mk(ctx,(yyvsp[-1].value),&(yylsp[-1])); } +#line 1455 "libxlu_cfg_y.c" /* yacc.c:1646 */ + break; + + case 21: +#line 75 "libxlu_cfg_y.y" /* yacc.c:1646 */ { xlu__cfg_list_append(ctx,(yyvsp[-4].value),(yyvsp[-1].value)); (yyval.value)= (yyvsp[-4].value); } -#line 1448 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 1461 "libxlu_cfg_y.c" /* yacc.c:1646 */ break; -#line 1452 "libxlu_cfg_y.c" /* yacc.c:1646 */ +#line 1465 "libxlu_cfg_y.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/tools/libxl/libxlu_cfg_y.h b/tools/libxl/libxlu_cfg_y.h index 0211f80b5e..9691bf1350 100644 --- a/tools/libxl/libxlu_cfg_y.h +++ b/tools/libxl/libxlu_cfg_y.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,13 +48,14 @@ extern int xlu__cfg_yydebug; IDENT = 258, STRING = 259, NUMBER = 260, - NEWLINE = 261 + NEWLINE = 261, + OP_ADD = 262 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { #line 25 "libxlu_cfg_y.y" /* yacc.c:1909 */ @@ -62,8 +63,10 @@ union YYSTYPE char *string; XLU_ConfigValue *value; -#line 66 "libxlu_cfg_y.h" /* yacc.c:1909 */ +#line 67 "libxlu_cfg_y.h" /* yacc.c:1909 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/tools/libxl/libxlu_cfg_y.y b/tools/libxl/libxlu_cfg_y.y index a923f7672d..020fc63eb3 100644 --- a/tools/libxl/libxlu_cfg_y.y +++ b/tools/libxl/libxlu_cfg_y.y @@ -38,6 +38,7 @@ %token <string> IDENT STRING NUMBER NEWLINE %type <string> atom %destructor { free($$); } atom IDENT STRING NUMBER +%token OP_ADD "+=" %type <value> value valuelist values %destructor { xlu__cfg_value_free($$); } value valuelist values @@ -54,7 +55,8 @@ stmt: assignment endstmt | endstmt | error NEWLINE -assignment: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); } +assignment: IDENT '=' value { xlu__cfg_set_store(ctx,$1,XLU_OP_ASSIGNMENT,$3,@3.first_line); } + | IDENT "+=" value { xlu__cfg_set_store(ctx,$1,XLU_OP_ADDITION,$3,@3.first_line); } endstmt: NEWLINE | ';' diff --git a/tools/libxl/libxlu_internal.h b/tools/libxl/libxlu_internal.h index 0acdde38f4..1f7559ecd9 100644 --- a/tools/libxl/libxlu_internal.h +++ b/tools/libxl/libxlu_internal.h @@ -53,6 +53,7 @@ typedef struct XLU_ConfigSetting { /* transparent */ struct XLU_ConfigSetting *next; char *name; XLU_ConfigValue *value; + enum XLU_Operation op; int lineno; } XLU_ConfigSetting; diff --git a/tools/libxl/libxlutil.h b/tools/libxl/libxlutil.h index e81b644c01..057cc25cb2 100644 --- a/tools/libxl/libxlutil.h +++ b/tools/libxl/libxlutil.h @@ -25,6 +25,11 @@ enum XLU_ConfigValueType { XLU_LIST, }; +enum XLU_Operation { + XLU_OP_ASSIGNMENT = 0, + XLU_OP_ADDITION, +}; + /* Unless otherwise stated, all functions return an errno value. */ typedef struct XLU_Config XLU_Config; typedef struct XLU_ConfigList XLU_ConfigList; -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |