This commit is contained in:
Enrico Fucile 2017-05-30 14:55:43 +01:00
parent f26599924b
commit 192b437aaa
16 changed files with 264 additions and 67 deletions

View File

@ -97,6 +97,7 @@ if ( g is "NIL" ) {
include "metar/missing_field.def"; include "metar/missing_field.def";
include "metar/temperature.def"; include "metar/temperature.def";
include "metar/qnh.def"; include "metar/qnh.def";
include "metar/colour.def"; include "metar/colour.def";
include "metar/recent_weather.def"; include "metar/recent_weather.def";

View File

@ -20,19 +20,25 @@ if (substr(g,0,1) is "-" || substr(g,0,1) is "+" || substr(g,0,2) is "FZ" || g i
rename(g,wrongPresentWeather); rename(g,wrongPresentWeather);
group g : dump; non_alpha na; group g : dump; non_alpha na;
} }
if (! presentWeather1Present && is_in_list(g,"metar/present_weather.list")) { if (! presentWeather1Present ) {
if (is_in_list(g,"metar/present_weather.list")) {
rename(g,presentWeather1); rename(g,presentWeather1);
group g : dump; non_alpha na; group g : dump; non_alpha na;
alias presentWeather1Present=one; alias presentWeather1Present=one;
}
} }
if (!presentWeather2Present && is_in_list(g,"metar/present_weather.list")) { if (! presentWeather2Present ) {
rename(g,presentWeather2); if ( is_in_list(g,"metar/present_weather.list")) {
group g : dump; non_alpha na; rename(g,presentWeather2);
alias presentWeather2Present=one; group g : dump; non_alpha na;
alias presentWeather2Present=one;
}
} }
if (!presentWeather3Present && is_in_list(g,"metar/present_weather.list")) { if (! presentWeather3Present ) {
rename(g,presentWeather3); if (is_in_list(g,"metar/present_weather.list")) {
group g : dump; non_alpha na; rename(g,presentWeather3);
alias presentWeather3Present=one; group g : dump; non_alpha na;
alias presentWeather3Present=one;
}
} }

View File

@ -26,20 +26,26 @@ if (g is "NSW") {
rename(g,wrongPresentWeatherTrend1); rename(g,wrongPresentWeatherTrend1);
group g : dump; non_alpha na; group g : dump; non_alpha na;
} }
if (! presentWeather1PresentTrend1 && is_in_list(g,"metar/present_weather.list")) { if (! presentWeather1PresentTrend1 ) {
rename(g,presentWeather1Trend1); if (is_in_list(g,"metar/present_weather.list")) {
group g : dump; non_alpha na; rename(g,presentWeather1Trend1);
alias presentWeather1PresentTrend1=one; group g : dump; non_alpha na;
} alias presentWeather1PresentTrend1=one;
if (!presentWeather2PresentTrend1 && is_in_list(g,"metar/present_weather.list")) { }
rename(g,presentWeather2Trend1); }
group g : dump; non_alpha na; if (!presentWeather2PresentTrend1) {
alias presentWeather2PresentTrend1=one; if ( is_in_list(g,"metar/present_weather.list")) {
} rename(g,presentWeather2Trend1);
if (!presentWeather3PresentTrend1 && is_in_list(g,"metar/present_weather.list")) { group g : dump; non_alpha na;
rename(g,presentWeather3TrendTrend11); alias presentWeather2PresentTrend1=one;
group g : dump; non_alpha na; }
alias presentWeather3PresentTrend1=one; }
} if (!presentWeather3PresentTrend1 ) {
if ( is_in_list(g,"metar/present_weather.list")) {
rename(g,presentWeather3TrendTrend11);
group g : dump; non_alpha na;
alias presentWeather3PresentTrend1=one;
}
}
} }

View File

@ -5,7 +5,7 @@ if ( ! qfePresent && substr(g,0,3) is "QFE" ) {
group g : dump; non_alpha na; group g : dump; non_alpha na;
alias qfePresent=one; alias qfePresent=one;
} }
if (! qnhPresent && substr(g,0,1) is "Q" ) { if ( ! qnhPresent && substr(g,0,1) is "Q" ) {
rename(g,qnhInHectoPascal); rename(g,qnhInHectoPascal);
if (is_integer(qnhInHectoPascal,1,4)) { if (is_integer(qnhInHectoPascal,1,4)) {
qnh=to_string(qnhInHectoPascal,1,4) : dump; qnh=to_string(qnhInHectoPascal,1,4) : dump;

View File

@ -311,6 +311,7 @@ list( APPEND grib_api_srcs
grib_value.c grib_value.c
grib_errors.c grib_errors.c
grib_expression_class_binop.c grib_expression_class_binop.c
grib_expression_class_logical_and.c
grib_expression_class_is_in_dict.c grib_expression_class_is_in_dict.c
grib_expression_class_true.c grib_expression_class_true.c
grib_expression_class_string_compare.c grib_expression_class_string_compare.c

View File

@ -326,6 +326,7 @@ libeccodes_la_prototypes= \
grib_value.c \ grib_value.c \
grib_errors.c \ grib_errors.c \
grib_expression_class_binop.c \ grib_expression_class_binop.c \
grib_expression_class_logical_and.c \
grib_expression_class_is_in_dict.c \ grib_expression_class_is_in_dict.c \
grib_expression_class_true.c \ grib_expression_class_true.c \
grib_expression_class_string_compare.c \ grib_expression_class_string_compare.c \

View File

@ -1275,6 +1275,9 @@ void grib_check(const char *call, const char *file, int line, int e, const char
/* grib_expression_class_binop.c */ /* grib_expression_class_binop.c */
grib_expression *new_binop_expression(grib_context *c, grib_binop_long_proc long_func, grib_binop_double_proc double_func, grib_expression *left, grib_expression *right); grib_expression *new_binop_expression(grib_context *c, grib_binop_long_proc long_func, grib_binop_double_proc double_func, grib_expression *left, grib_expression *right);
/* grib_expression_class_logical_and.c */
grib_expression *new_logical_and_expression(grib_context *c, grib_expression *left, grib_expression *right);
/* grib_expression_class_is_in_dict.c */ /* grib_expression_class_is_in_dict.c */
grib_expression *new_is_in_dict_expression(grib_context *c, const char *name, const char *list); grib_expression *new_is_in_dict_expression(grib_context *c, const char *name, const char *list);

View File

@ -9,6 +9,7 @@ extern grib_expression_class* grib_expression_class_is_in_dict;
extern grib_expression_class* grib_expression_class_is_in_list; extern grib_expression_class* grib_expression_class_is_in_list;
extern grib_expression_class* grib_expression_class_is_integer; extern grib_expression_class* grib_expression_class_is_integer;
extern grib_expression_class* grib_expression_class_length; extern grib_expression_class* grib_expression_class_length;
extern grib_expression_class* grib_expression_class_logical_and;
extern grib_expression_class* grib_expression_class_long; extern grib_expression_class* grib_expression_class_long;
extern grib_expression_class* grib_expression_class_string; extern grib_expression_class* grib_expression_class_string;
extern grib_expression_class* grib_expression_class_string_compare; extern grib_expression_class* grib_expression_class_string_compare;

View File

@ -233,13 +233,7 @@ grib_expression* new_is_in_dict_expression(grib_context* c,const char* name,cons
static int native_type(grib_expression* g,grib_handle *h) static int native_type(grib_expression* g,grib_handle *h)
{ {
grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g; return GRIB_TYPE_LONG;
int type = 0;
int err;
if((err=grib_get_native_type(h,e->key,&type)) != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"Error in native_type %s : %s", e->key,grib_get_error_message(err));
return type;
} }
static void add_dependency(grib_expression* g, grib_accessor* observer){ static void add_dependency(grib_expression* g, grib_accessor* observer){

View File

@ -140,9 +140,18 @@ static int evaluate_double(grib_expression *g,grib_handle *h,double* result)
static string evaluate_string(grib_expression* g,grib_handle* h,char* buf,size_t* size,int* err) static string evaluate_string(grib_expression* g,grib_handle* h,char* buf,size_t* size,int* err)
{ {
long lresult=0; long lresult=0;
double dresult=0.0;
*err=evaluate_long(g,h,&lresult); switch (grib_expression_native_type(h, g)) {
sprintf(buf,"%ld",lresult); case GRIB_TYPE_LONG:
*err=evaluate_long(g,h,&lresult);
sprintf(buf,"%ld",lresult);
break;
case GRIB_TYPE_DOUBLE:
*err=evaluate_double(g,h,&dresult);
sprintf(buf,"%g",dresult);
break;
}
return buf; return buf;
} }
@ -193,12 +202,6 @@ grib_expression* new_is_integer_expression(grib_context* c,const char *name,int
static int native_type(grib_expression* g,grib_handle *h) static int native_type(grib_expression* g,grib_handle *h)
{ {
grib_expression_is_integer* e = (grib_expression_is_integer*)g; return GRIB_TYPE_LONG;
int type = 0;
int err;
if((err=grib_get_native_type(h,e->name,&type)) != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"Error in native_type %s : %s", e->name,grib_get_error_message(err));
return type;
} }

View File

@ -182,11 +182,5 @@ grib_expression* new_length_expression(grib_context* c,const char *name)
static int native_type(grib_expression* g,grib_handle *h) static int native_type(grib_expression* g,grib_handle *h)
{ {
grib_expression_length* e = (grib_expression_length*)g; return GRIB_TYPE_LONG;
int type = 0;
int err;
if((err=grib_get_native_type(h,e->name,&type)) != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"Error in native_type %s : %s", e->name,grib_get_error_message(err));
return type;
} }

View File

@ -0,0 +1,186 @@
/*
* Copyright 2005-2017 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
START_CLASS_DEF
CLASS = expression
IMPLEMENTS = init_class
IMPLEMENTS = destroy
IMPLEMENTS = native_type
IMPLEMENTS = evaluate_long
IMPLEMENTS = evaluate_double
IMPLEMENTS = print
IMPLEMENTS = add_dependency
MEMBERS = grib_expression *left
MEMBERS = grib_expression *right
END_CLASS_DEF
*/
/* START_CLASS_IMP */
/*
Don't edit anything between START_CLASS_IMP and END_CLASS_IMP
Instead edit values between START_CLASS_DEF and END_CLASS_DEF
or edit "expression.class" and rerun ./make_class.pl
*/
typedef const char* string; /* to keep make_class.pl happy */
static void init_class (grib_expression_class*);
static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*);
static void add_dependency(grib_expression* e, grib_accessor* observer);
static int native_type(grib_expression*,grib_handle*);
static int evaluate_long(grib_expression*,grib_handle*,long*);
static int evaluate_double(grib_expression*,grib_handle*,double*);
typedef struct grib_expression_logical_and{
grib_expression base;
/* Members defined in logical_and */
grib_expression *left;
grib_expression *right;
} grib_expression_logical_and;
static grib_expression_class _grib_expression_class_logical_and = {
0, /* super */
"logical_and", /* name */
sizeof(grib_expression_logical_and),/* size of instance */
0, /* inited */
&init_class, /* init_class */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&native_type,
0,
&evaluate_long,
&evaluate_double,
0,
};
grib_expression_class* grib_expression_class_logical_and = &_grib_expression_class_logical_and;
static void init_class(grib_expression_class* c)
{
}
/* END_CLASS_IMP */
static int evaluate_long(grib_expression *g,grib_handle* h,long* lres)
{
long v1=0;
long v2=0;
double dv1=0;
double dv2=0;
int ret;
grib_expression_logical_and* e = (grib_expression_logical_and*)g;
switch (grib_expression_native_type(h, e->left)) {
case GRIB_TYPE_LONG:
ret = grib_expression_evaluate_long(h,e->left,&v1);
if (ret != GRIB_SUCCESS) return ret;
if (v1 == 0) {
*lres=0;
return ret;
}
break;
case GRIB_TYPE_DOUBLE:
ret = grib_expression_evaluate_double(h,e->left,&dv1);
if (ret != GRIB_SUCCESS) return ret;
if (dv1 == 0) {
*lres=0;
return ret;
}
break;
default :
return GRIB_INVALID_TYPE;
}
switch (grib_expression_native_type(h, e->right)) {
case GRIB_TYPE_LONG:
ret = grib_expression_evaluate_long(h,e->right,&v2);
if (ret != GRIB_SUCCESS) return ret;
*lres = v2 ? 1 : 0;
break;
case GRIB_TYPE_DOUBLE:
ret = grib_expression_evaluate_double(h,e->right,&dv2);
if (ret != GRIB_SUCCESS) return ret;
*lres = dv2 ? 1 : 0;
break;
default :
return GRIB_INVALID_TYPE;
}
return GRIB_SUCCESS;
}
static int evaluate_double(grib_expression *g,grib_handle* h,double* dres)
{
long lres=0;
int ret=0;
ret=evaluate_long(g,h,&lres);
*dres=(double)lres;
return ret;
}
static void print(grib_context* c,grib_expression* g,grib_handle* f)
{
grib_expression_logical_and* e = (grib_expression_logical_and*)g;
printf("(");
grib_expression_print(c,e->left,f);
printf(" && ");
grib_expression_print(c,e->right,f);
printf(")");
}
static void destroy(grib_context* c,grib_expression* g)
{
grib_expression_logical_and* e = (grib_expression_logical_and*)g;
grib_expression_free(c,e->left);
grib_expression_free(c,e->right);
}
static void add_dependency(grib_expression* g, grib_accessor* observer)
{
grib_expression_logical_and* e = (grib_expression_logical_and*)g;
grib_dependency_observe_expression(observer,e->left);
grib_dependency_observe_expression(observer,e->right);
}
grib_expression* new_logical_and_expression(grib_context* c, grib_expression* left,grib_expression* right)
{
grib_expression_logical_and* e = (grib_expression_logical_and*)grib_context_malloc_clear_persistent(c,sizeof(grib_expression_logical_and));
e->base.cclass = grib_expression_class_logical_and;
e->left = left;
e->right = right;
return (grib_expression*)e;
}
static int native_type(grib_expression* g,grib_handle *h)
{
return GRIB_TYPE_LONG;
}

View File

@ -9,6 +9,7 @@
{ "is_in_list", &grib_expression_class_is_in_list, }, { "is_in_list", &grib_expression_class_is_in_list, },
{ "is_integer", &grib_expression_class_is_integer, }, { "is_integer", &grib_expression_class_is_integer, },
{ "length", &grib_expression_class_length, }, { "length", &grib_expression_class_length, },
{ "logical_and", &grib_expression_class_logical_and, },
{ "long", &grib_expression_class_long, }, { "long", &grib_expression_class_long, },
{ "string", &grib_expression_class_string, }, { "string", &grib_expression_class_string, },
{ "string_compare", &grib_expression_class_string_compare, }, { "string_compare", &grib_expression_class_string_compare, },

View File

@ -197,12 +197,12 @@ struct grib_yy_buffer_state
/* Size of input buffer in bytes, not including room for EOB /* Size of input buffer in bytes, not including room for EOB
* characters. * characters.
*/ */
grib_yy_size_t grib_yy_buf_size; int grib_yy_buf_size;
/* Number of characters read into grib_yy_ch_buf, not including EOB /* Number of characters read into grib_yy_ch_buf, not including EOB
* characters. * characters.
*/ */
grib_yy_size_t grib_yy_n_chars; int grib_yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it, /* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to * and can realloc() it to grow it, and should free() it to
@ -272,7 +272,7 @@ static YY_BUFFER_STATE * grib_yy_buffer_stack = 0; /**< Stack as an array. */
/* grib_yy_hold_char holds the character lost when grib_yytext is formed. */ /* grib_yy_hold_char holds the character lost when grib_yytext is formed. */
static char grib_yy_hold_char; static char grib_yy_hold_char;
static grib_yy_size_t grib_yy_n_chars; /* number of characters read into grib_yy_ch_buf */ static int grib_yy_n_chars; /* number of characters read into grib_yy_ch_buf */
grib_yy_size_t grib_yyleng; grib_yy_size_t grib_yyleng;
/* Points to current character in buffer. */ /* Points to current character in buffer. */
@ -356,7 +356,7 @@ static void grib_yy_fatal_error (grib_yyconst char msg[] );
*/ */
#define YY_DO_BEFORE_ACTION \ #define YY_DO_BEFORE_ACTION \
(grib_yytext_ptr) = grib_yy_bp; \ (grib_yytext_ptr) = grib_yy_bp; \
grib_yyleng = (size_t) (grib_yy_cp - grib_yy_bp); \ grib_yyleng = (int) (grib_yy_cp - grib_yy_bp); \
(grib_yy_hold_char) = *grib_yy_cp; \ (grib_yy_hold_char) = *grib_yy_cp; \
*grib_yy_cp = '\0'; \ *grib_yy_cp = '\0'; \
(grib_yy_c_buf_p) = grib_yy_cp; (grib_yy_c_buf_p) = grib_yy_cp;
@ -1320,7 +1320,7 @@ static int input (void );
else \ else \
{ \ { \
errno=0; \ errno=0; \
while ( (result = fread(buf, 1, max_size, grib_yyin))==0 && ferror(grib_yyin)) \ while ( (result = (int) fread(buf, 1, max_size, grib_yyin))==0 && ferror(grib_yyin)) \
{ \ { \
if( errno != EINTR) \ if( errno != EINTR) \
{ \ { \
@ -1449,7 +1449,7 @@ grib_yy_match:
if ( grib_yy_current_state >= 798 ) if ( grib_yy_current_state >= 798 )
grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c];
} }
grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (flex_int16_t) grib_yy_c];
++grib_yy_cp; ++grib_yy_cp;
} }
while ( grib_yy_base[grib_yy_current_state] != 1945 ); while ( grib_yy_base[grib_yy_current_state] != 1945 );
@ -2401,7 +2401,7 @@ static int grib_yy_get_next_buffer (void)
else else
{ {
grib_yy_size_t num_to_read = int num_to_read =
YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size - number_to_move - 1; YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 ) while ( num_to_read <= 0 )
@ -2436,7 +2436,7 @@ static int grib_yy_get_next_buffer (void)
(grib_yy_c_buf_p) = &b->grib_yy_ch_buf[grib_yy_c_buf_p_offset]; (grib_yy_c_buf_p) = &b->grib_yy_ch_buf[grib_yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size - num_to_read = (int) YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size -
number_to_move - 1; number_to_move - 1;
} }
@ -2470,9 +2470,9 @@ static int grib_yy_get_next_buffer (void)
else else
ret_val = EOB_ACT_CONTINUE_SCAN; ret_val = EOB_ACT_CONTINUE_SCAN;
if ((grib_yy_size_t) ((grib_yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size) { if ((int) ((grib_yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */ /* Extend the array by 50%, plus the number we really need. */
grib_yy_size_t new_size = (grib_yy_n_chars) + number_to_move + ((grib_yy_n_chars) >> 1); int new_size = (grib_yy_n_chars) + number_to_move + ((grib_yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf = (char *) grib_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf,new_size ); YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf = (char *) grib_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf ) if ( ! YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in grib_yy_get_next_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in grib_yy_get_next_buffer()" );
@ -2510,7 +2510,7 @@ static int grib_yy_get_next_buffer (void)
if ( grib_yy_current_state >= 798 ) if ( grib_yy_current_state >= 798 )
grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c];
} }
grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (flex_int16_t) grib_yy_c];
} }
return grib_yy_current_state; return grib_yy_current_state;
@ -2538,7 +2538,7 @@ static int grib_yy_get_next_buffer (void)
if ( grib_yy_current_state >= 798 ) if ( grib_yy_current_state >= 798 )
grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c];
} }
grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (flex_int16_t) grib_yy_c];
grib_yy_is_jam = (grib_yy_current_state == 797); grib_yy_is_jam = (grib_yy_current_state == 797);
return grib_yy_is_jam ? 0 : grib_yy_current_state; return grib_yy_is_jam ? 0 : grib_yy_current_state;
@ -2556,7 +2556,7 @@ static int grib_yy_get_next_buffer (void)
if ( grib_yy_cp < YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf + 2 ) if ( grib_yy_cp < YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf + 2 )
{ /* need to shift things up to make room */ { /* need to shift things up to make room */
/* +2 for EOB chars. */ /* +2 for EOB chars. */
register grib_yy_size_t number_to_move = (grib_yy_n_chars) + 2; register int number_to_move = (grib_yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf[ register char *dest = &YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size + 2]; YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size + 2];
register char *source = register char *source =
@ -2568,7 +2568,7 @@ static int grib_yy_get_next_buffer (void)
grib_yy_cp += (int) (dest - source); grib_yy_cp += (int) (dest - source);
grib_yy_bp += (int) (dest - source); grib_yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->grib_yy_n_chars = YY_CURRENT_BUFFER_LVALUE->grib_yy_n_chars =
(grib_yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size; (grib_yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size;
if ( grib_yy_cp < YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf + 2 ) if ( grib_yy_cp < YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" ); YY_FATAL_ERROR( "flex scanner push-back overflow" );
@ -2964,7 +2964,7 @@ YY_BUFFER_STATE grib_yy_scan_buffer (char * base, grib_yy_size_t size )
YY_BUFFER_STATE grib_yy_scan_string (grib_yyconst char * grib_yystr ) YY_BUFFER_STATE grib_yy_scan_string (grib_yyconst char * grib_yystr )
{ {
return grib_yy_scan_bytes(grib_yystr,strlen(grib_yystr) ); return grib_yy_scan_bytes(grib_yystr,(int) strlen(grib_yystr) );
} }
/** Setup the input buffer state to scan the given bytes. The next call to grib_yylex() will /** Setup the input buffer state to scan the given bytes. The next call to grib_yylex() will
@ -2982,7 +2982,7 @@ YY_BUFFER_STATE grib_yy_scan_bytes (grib_yyconst char * grib_yybytes, grib_yy_s
int i; int i;
/* Get memory for full buffer, including space for trailing EOB's. */ /* Get memory for full buffer, including space for trailing EOB's. */
n = _grib_yybytes_len + 2; n = (grib_yy_size_t) _grib_yybytes_len + 2;
buf = (char *) grib_yyalloc(n ); buf = (char *) grib_yyalloc(n );
if ( ! buf ) if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in grib_yy_scan_bytes()" ); YY_FATAL_ERROR( "out of dynamic memory in grib_yy_scan_bytes()" );

View File

@ -3911,7 +3911,7 @@ grib_yyreduce:
case 252: case 252:
/* Line 1792 of yacc.c */ /* Line 1792 of yacc.c */
#line 820 "griby.y" #line 820 "griby.y"
{ (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_and,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } { (grib_yyval.exp) = new_logical_and_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
break; break;
case 254: case 254:

View File

@ -817,7 +817,7 @@ condition : condition GT term { $$ = new_binop_expression(grib_parser_con
| term | term
; ;
conjonction : conjonction AND condition { $$ = new_binop_expression(grib_parser_context,&grib_op_and,NULL,$1,$3); } conjonction : conjonction AND condition { $$ = new_logical_and_expression(grib_parser_context,$1,$3); }
| condition | condition
; ;