aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Examples/Physics_applications/plasma_mirror/inputs.2d4
-rw-r--r--Regression/WarpX-tests.ini10
-rw-r--r--Source/Parser/wp_parser.l10
-rw-r--r--Source/Parser/wp_parser.lex.c673
-rw-r--r--Source/Parser/wp_parser.lex.h243
-rw-r--r--Source/Parser/wp_parser.tab.c454
-rw-r--r--Source/Parser/wp_parser.tab.h22
-rw-r--r--Source/Parser/wp_parser.y17
-rw-r--r--Source/Parser/wp_parser_y.c31
-rw-r--r--Source/Parser/wp_parser_y.h6
-rw-r--r--Source/Particles/Deposition/CurrentDeposition.H233
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp50
-rw-r--r--Source/WarpX.cpp4
13 files changed, 1149 insertions, 608 deletions
diff --git a/Examples/Physics_applications/plasma_mirror/inputs.2d b/Examples/Physics_applications/plasma_mirror/inputs.2d
index dc0a48ebf..48d471430 100644
--- a/Examples/Physics_applications/plasma_mirror/inputs.2d
+++ b/Examples/Physics_applications/plasma_mirror/inputs.2d
@@ -48,7 +48,7 @@ electrons.uz_th = .01
electrons.zmin = 19.520e-6
electrons.zmax = 25.47931e-6
electrons.profile = parse_density_function
-electrons.density_function(x,y,z) = "(z<zp)*nc*exp((z-zc)/lgrad)+(z>zp)*(z<zp2)*2.*nc+(z>zp2)*nc*exp(-(z-zc2)/lgrad)"
+electrons.density_function(x,y,z) = "(z<zp)*nc*exp((z-zc)/lgrad)+(z>=zp)*(z<=zp2)*2.*nc+(z>zp2)*nc*exp(-(z-zc2)/lgrad)"
ions.charge = q_e
ions.mass = m_p
@@ -60,7 +60,7 @@ ions.uz_th = 0.
ions.zmin = 19.520e-6
ions.zmax = 25.47931e-6
ions.profile = parse_density_function
-ions.density_function(x,y,z) = "(z<zp)*nc*exp((z-zc)/lgrad)+(z>zp)*(z<zp2)*2.*nc+(z>zp2)*nc*exp(-(z-zc2)/lgrad)"
+ions.density_function(x,y,z) = "(z<zp)*nc*exp((z-zc)/lgrad)+(z>=zp)*(z<=zp2)*2.*nc+(z>zp2)*nc*exp(-(z-zc2)/lgrad)"
#################################
############# LASER #############
diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini
index a10b79504..cfad800a4 100644
--- a/Regression/WarpX-tests.ini
+++ b/Regression/WarpX-tests.ini
@@ -232,13 +232,13 @@ dim = 3
addToCompileString = USE_PSATD=TRUE
restartTest = 0
useMPI = 1
-numprocs = 4
+numprocs = 2
useOMP = 1
numthreads = 1
compileTest = 0
doVis = 0
compareParticles = 1
-runtime_params = psatd.fftw_plan_measure=0 psatd.hybrid_mpi_decomposition=1
+runtime_params = psatd.fftw_plan_measure=0
particleTypes = electrons positrons
analysisRoutine = Examples/Tests/Langmuir/langmuir_multi_analysis.py
analysisOutputImage = langmuir_multi_analysis.png
@@ -250,7 +250,7 @@ dim = 3
addToCompileString = USE_PSATD=TRUE
restartTest = 0
useMPI = 1
-numprocs = 4
+numprocs = 2
useOMP = 1
numthreads = 1
compileTest = 0
@@ -286,13 +286,13 @@ dim = 2
addToCompileString = USE_PSATD=TRUE
restartTest = 0
useMPI = 1
-numprocs = 4
+numprocs = 2
useOMP = 1
numthreads = 1
compileTest = 0
doVis = 0
compareParticles = 1
-runtime_params = psatd.fftw_plan_measure=0 psatd.hybrid_mpi_decomposition=1
+runtime_params = psatd.fftw_plan_measure=0
particleTypes = electrons positrons
analysisRoutine = Examples/Tests/Langmuir/langmuir_multi_2d_analysis.py
analysisOutputImage = langmuir_multi_2d_analysis.png
diff --git a/Source/Parser/wp_parser.l b/Source/Parser/wp_parser.l
index 9c54ab06c..8e70203cb 100644
--- a/Source/Parser/wp_parser.l
+++ b/Source/Parser/wp_parser.l
@@ -44,6 +44,12 @@ EXP ([Ee][-+]?[0-9]+)
"fabs" { yylval.f1 = WP_ABS; return F1; }
"**" { yylval.f2 = WP_POW; return POW;}
"^" { yylval.f2 = WP_POW; return POW;}
+">=" { yylval.f2 = WP_GEQ; return GEQ;}
+"<=" { yylval.f2 = WP_LEQ; return LEQ;}
+"==" { yylval.f2 = WP_EQ; return EQ;}
+"!=" { yylval.f2 = WP_NEQ; return NEQ;}
+"and" { yylval.f2 = WP_AND; return AND;}
+"or" { yylval.f2 = WP_OR; return OR;}
"pow" { yylval.f2 = WP_POW; return F2; }
"heaviside" { yylval.f2 = WP_HEAVISIDE; return F2; }
"min" { yylval.f2 = WP_MIN; return F2; }
@@ -57,8 +63,8 @@ EXP ([Ee][-+]?[0-9]+)
"."?[0-9]+{EXP}? { yylval.d = atof(yytext); return NUMBER; }
/* Special characters */
-"//".*
-[ \t] /* ignore white space */
+"//".*
+[ \t] /* ignore white space */
\\\n /* ignore line continuation */
"\n" { return EOL; }
diff --git a/Source/Parser/wp_parser.lex.c b/Source/Parser/wp_parser.lex.c
index d47d2b247..0a9c58ee9 100644
--- a/Source/Parser/wp_parser.lex.c
+++ b/Source/Parser/wp_parser.lex.c
@@ -9,7 +9,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
+#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -84,60 +84,48 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#ifndef SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
+/* begin standard C++ headers. */
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
+/* TODO: this is always defined, so inline it */
#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
#else
-#define yyconst
+#define yynoreturn
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
+/* Promotes a possibly negative, possibly signed char to an
+ * integer in range [0..255] for use as an array index.
*/
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN (yy_start) = 1 + 2 *
-
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START
-
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart(yyin )
-
+#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
@@ -167,14 +155,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
typedef size_t yy_size_t;
#endif
-extern yy_size_t yyleng;
+extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
-
+
#define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr)
@@ -191,7 +179,6 @@ extern FILE *yyin, *yyout;
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
-
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -206,7 +193,7 @@ 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.
@@ -234,7 +221,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.
*/
@@ -262,7 +249,7 @@ struct yy_buffer_state
/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
@@ -273,7 +260,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
-
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
@@ -282,10 +268,10 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
-yy_size_t yyleng;
+int yyleng;
/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
+static char *yy_c_buf_p = NULL;
static int yy_init = 0; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
@@ -294,65 +280,59 @@ static int yy_start = 0; /* start state number */
*/
static int yy_did_buffer_switch_on_eof;
-void yyrestart (FILE *input_file );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
-void yy_delete_buffer (YY_BUFFER_STATE b );
-void yy_flush_buffer (YY_BUFFER_STATE b );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
-void yypop_buffer_state (void );
-
-static void yyensure_buffer_stack (void );
-static void yy_load_buffer_state (void );
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+void yyrestart ( FILE *input_file );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
+void yy_delete_buffer ( YY_BUFFER_STATE b );
+void yy_flush_buffer ( YY_BUFFER_STATE b );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state ( void );
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+static void yyensure_buffer_stack ( void );
+static void yy_load_buffer_state ( void );
+static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
-void *yyalloc (yy_size_t );
-void *yyrealloc (void *,yy_size_t );
-void yyfree (void * );
+void *yyalloc ( yy_size_t );
+void *yyrealloc ( void *, yy_size_t );
+void yyfree ( void * );
#define yy_new_buffer yy_create_buffer
-
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
-
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
-
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
#define yywrap() (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
+typedef flex_uint8_t YY_CHAR;
-typedef unsigned char YY_CHAR;
-
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+FILE *yyin = NULL, *yyout = NULL;
typedef int yy_state_type;
extern int yylineno;
-
int yylineno = 1;
extern char *yytext;
@@ -361,26 +341,22 @@ extern char *yytext;
#endif
#define yytext_ptr yytext
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
-static int yy_get_next_buffer (void );
-#if defined(__GNUC__) && __GNUC__ >= 3
-__attribute__((__noreturn__))
-#endif
-static void yy_fatal_error (yyconst char msg[] );
+static yy_state_type yy_get_previous_state ( void );
+static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
+static int yy_get_next_buffer ( void );
+static void yynoreturn yy_fatal_error ( const char* msg );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
+ yyleng = (int) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-
-#define YY_NUM_RULES 41
-#define YY_END_OF_BUFFER 42
+#define YY_NUM_RULES 47
+#define YY_END_OF_BUFFER 48
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -388,37 +364,38 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[95] =
+static const flex_int16_t yy_accept[104] =
{ 0,
- 0, 0, 42, 40, 37, 39, 10, 11, 3, 1,
- 7, 2, 40, 4, 35, 8, 5, 9, 33, 40,
- 28, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 6, 27, 35, 36, 34, 35, 0, 33, 38,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 36, 34, 0, 0, 35,
- 25, 33, 33, 33, 17, 13, 33, 33, 14, 32,
- 31, 29, 16, 33, 18, 0, 34, 20, 19, 21,
- 23, 26, 33, 33, 22, 12, 24, 33, 15, 33,
- 33, 33, 30, 0
-
+ 0, 0, 48, 46, 43, 45, 46, 10, 11, 3,
+ 1, 7, 2, 46, 4, 41, 8, 5, 9, 39,
+ 46, 28, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 6, 32, 27, 41, 42, 40, 41,
+ 0, 30, 31, 29, 39, 44, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 34, 39,
+ 39, 39, 39, 42, 40, 0, 0, 41, 25, 39,
+ 33, 39, 39, 17, 13, 39, 39, 14, 38, 37,
+ 35, 16, 39, 18, 0, 40, 20, 19, 21, 23,
+ 26, 39, 39, 22, 12, 24, 39, 15, 39, 39,
+
+ 39, 36, 0
} ;
-static yyconst YY_CHAR yy_ec[256] =
+static const YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 1, 1, 15,
- 16, 17, 1, 1, 18, 18, 18, 18, 19, 18,
- 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
- 1, 20, 1, 21, 18, 1, 22, 23, 24, 25,
-
- 26, 27, 28, 29, 30, 18, 18, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 18, 40, 41, 42,
- 18, 18, 1, 43, 1, 1, 1, 1, 1, 1,
+ 1, 2, 4, 1, 1, 1, 1, 1, 1, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 15, 15, 15, 15, 15, 15, 15, 1, 1, 16,
+ 17, 18, 1, 1, 19, 19, 19, 19, 20, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 1, 21, 1, 22, 19, 1, 23, 24, 25, 26,
+
+ 27, 28, 29, 30, 31, 19, 19, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 19, 41, 42, 43,
+ 19, 19, 1, 44, 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,
@@ -435,95 +412,99 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst YY_CHAR yy_meta[44] =
+static const YY_CHAR yy_meta[45] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 3, 3, 3, 1, 1, 1, 3, 3, 1,
- 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 1, 1, 3, 3, 3, 1, 1, 1, 3, 3,
+ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 1
+ 3, 3, 3, 1
} ;
-static yyconst flex_uint16_t yy_base[97] =
+static const flex_int16_t yy_base[106] =
{ 0,
- 0, 0, 148, 149, 149, 149, 149, 149, 141, 149,
- 149, 149, 32, 135, 37, 149, 149, 149, 0, 142,
- 149, 29, 110, 101, 120, 115, 106, 32, 105, 25,
- 116, 149, 149, 45, 0, 60, 68, 76, 0, 149,
- 99, 102, 105, 112, 95, 97, 108, 108, 101, 86,
- 94, 85, 92, 87, 90, 0, 79, 88, 63, 94,
- 0, 84, 88, 87, 90, 0, 80, 76, 91, 0,
- 0, 0, 74, 60, 67, 97, 100, 0, 0, 0,
- 0, 0, 54, 58, 0, 0, 0, 31, 0, 36,
- 40, 34, 0, 149, 45, 114
-
+ 0, 0, 156, 157, 157, 157, 138, 157, 157, 147,
+ 157, 157, 157, 32, 141, 37, 135, 134, 133, 0,
+ 146, 157, 29, 113, 104, 123, 118, 109, 35, 105,
+ 107, 18, 118, 157, 157, 157, 47, 0, 57, 65,
+ 73, 157, 157, 157, 0, 157, 101, 104, 112, 106,
+ 113, 96, 98, 109, 109, 102, 87, 95, 0, 86,
+ 93, 88, 91, 0, 76, 85, 91, 94, 0, 85,
+ 0, 89, 88, 91, 0, 81, 78, 103, 0, 0,
+ 0, 72, 61, 67, 97, 100, 0, 0, 0, 0,
+ 0, 63, 69, 0, 0, 0, 36, 0, 42, 39,
+
+ 32, 0, 157, 53, 115
} ;
-static yyconst flex_int16_t yy_def[97] =
+static const flex_int16_t yy_def[106] =
{ 0,
- 94, 1, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 95, 94,
- 94, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 94, 94, 94, 96, 94, 94, 94, 95, 94,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 96, 94, 94, 94, 94,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 94, 94, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 0, 94, 94
-
+ 103, 1, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 104,
+ 103, 103, 104, 104, 104, 104, 104, 104, 104, 104,
+ 104, 104, 104, 103, 103, 103, 103, 105, 103, 103,
+ 103, 103, 103, 103, 104, 103, 104, 104, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+ 104, 104, 104, 105, 103, 103, 103, 103, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+ 104, 104, 104, 104, 103, 103, 104, 104, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+
+ 104, 104, 0, 103, 103
} ;
-static yyconst flex_uint16_t yy_nxt[193] =
+static const flex_int16_t yy_nxt[202] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 15, 15, 16, 17, 18, 19, 19, 20,
- 21, 22, 19, 23, 19, 24, 25, 19, 26, 19,
- 27, 28, 19, 19, 29, 19, 19, 30, 31, 19,
- 19, 19, 32, 34, 34, 34, 36, 39, 37, 37,
- 37, 41, 42, 50, 53, 38, 34, 34, 34, 93,
- 54, 51, 38, 38, 92, 91, 43, 44, 90, 89,
- 38, 57, 57, 57, 60, 60, 60, 36, 58, 37,
- 37, 37, 59, 88, 59, 58, 38, 60, 60, 60,
- 57, 57, 57, 38, 76, 87, 76, 58, 86, 77,
-
- 77, 77, 85, 84, 58, 60, 60, 60, 77, 77,
- 77, 77, 77, 77, 56, 83, 56, 82, 81, 80,
- 79, 78, 75, 74, 73, 72, 71, 70, 69, 68,
- 67, 66, 65, 64, 63, 62, 61, 55, 52, 49,
- 48, 47, 46, 45, 40, 35, 33, 94, 3, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-
+ 14, 15, 16, 16, 16, 17, 18, 19, 20, 20,
+ 21, 22, 23, 20, 24, 20, 25, 26, 20, 27,
+ 20, 28, 29, 20, 30, 31, 20, 20, 32, 33,
+ 20, 20, 20, 34, 37, 37, 37, 39, 61, 40,
+ 40, 40, 47, 48, 62, 45, 41, 57, 102, 37,
+ 37, 37, 49, 41, 101, 58, 41, 50, 51, 65,
+ 65, 65, 100, 41, 99, 39, 66, 40, 40, 40,
+ 67, 98, 67, 66, 41, 68, 68, 68, 65, 65,
+ 65, 41, 85, 97, 85, 66, 96, 86, 86, 86,
+
+ 95, 94, 66, 68, 68, 68, 68, 68, 68, 86,
+ 86, 86, 86, 86, 86, 64, 93, 64, 92, 91,
+ 90, 89, 88, 87, 84, 83, 82, 81, 80, 79,
+ 78, 77, 76, 75, 74, 73, 72, 71, 70, 69,
+ 63, 60, 59, 56, 55, 54, 53, 52, 46, 44,
+ 43, 42, 38, 36, 35, 103, 3, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+
+ 103
} ;
-static yyconst flex_int16_t yy_chk[193] =
+static const flex_int16_t yy_chk[202] =
{ 0,
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, 1, 1,
- 1, 1, 1, 13, 13, 13, 15, 95, 15, 15,
- 15, 22, 22, 28, 30, 15, 34, 34, 34, 92,
- 30, 28, 15, 34, 91, 90, 22, 22, 88, 84,
- 34, 36, 36, 36, 59, 59, 59, 37, 36, 37,
- 37, 37, 38, 83, 38, 36, 37, 38, 38, 38,
- 57, 57, 57, 37, 58, 75, 58, 57, 74, 58,
-
- 58, 58, 73, 69, 57, 60, 60, 60, 76, 76,
- 76, 77, 77, 77, 96, 68, 96, 67, 65, 64,
- 63, 62, 55, 54, 53, 52, 51, 50, 49, 48,
- 47, 46, 45, 44, 43, 42, 41, 31, 29, 27,
- 26, 25, 24, 23, 20, 14, 9, 3, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-
+ 1, 1, 1, 1, 14, 14, 14, 16, 32, 16,
+ 16, 16, 23, 23, 32, 104, 16, 29, 101, 37,
+ 37, 37, 23, 16, 100, 29, 37, 23, 23, 39,
+ 39, 39, 99, 37, 97, 40, 39, 40, 40, 40,
+ 41, 93, 41, 39, 40, 41, 41, 41, 65, 65,
+ 65, 40, 66, 92, 66, 65, 84, 66, 66, 66,
+
+ 83, 82, 65, 67, 67, 67, 68, 68, 68, 85,
+ 85, 85, 86, 86, 86, 105, 78, 105, 77, 76,
+ 74, 73, 72, 70, 63, 62, 61, 60, 58, 57,
+ 56, 55, 54, 53, 52, 51, 50, 49, 48, 47,
+ 33, 31, 30, 28, 27, 26, 25, 24, 21, 19,
+ 18, 17, 15, 10, 7, 3, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+
+ 103
} ;
static yy_state_type yy_last_accepting_state;
@@ -544,10 +525,12 @@ char *yytext;
#line 3 "wp_parser.l"
#include "wp_parser_y.h"
#include "wp_parser.tab.h"
-/* Tokens NUMBER, SYMBOL, F1, POW, F2, etc. are defined in wp_parser.y. */
-/* Types WP_SQRT, WP_SQRT, etc. are defined in wp_parser_y.h. */
-/* Used leater to define NUMBER */
-#line 551 "wp_parser.lex.c"
+#line 529 "wp_parser.lex.c"
+#line 8 "wp_parser.l"
+ /* Tokens NUMBER, SYMBOL, F1, POW, F2, etc. are defined in wp_parser.y. */
+ /* Types WP_SQRT, WP_SQRT, etc. are defined in wp_parser_y.h. */
+ /* Used leater to define NUMBER */
+#line 534 "wp_parser.lex.c"
#define INITIAL 0
@@ -563,36 +546,36 @@ char *yytext;
#define YY_EXTRA_TYPE void *
#endif
-static int yy_init_globals (void );
+static int yy_init_globals ( void );
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-int yylex_destroy (void );
+int yylex_destroy ( void );
-int yyget_debug (void );
+int yyget_debug ( void );
-void yyset_debug (int debug_flag );
+void yyset_debug ( int debug_flag );
-YY_EXTRA_TYPE yyget_extra (void );
+YY_EXTRA_TYPE yyget_extra ( void );
-void yyset_extra (YY_EXTRA_TYPE user_defined );
+void yyset_extra ( YY_EXTRA_TYPE user_defined );
-FILE *yyget_in (void );
+FILE *yyget_in ( void );
-void yyset_in (FILE * _in_str );
+void yyset_in ( FILE * _in_str );
-FILE *yyget_out (void );
+FILE *yyget_out ( void );
-void yyset_out (FILE * _out_str );
+void yyset_out ( FILE * _out_str );
-yy_size_t yyget_leng (void );
+ int yyget_leng ( void );
-char *yyget_text (void );
+char *yyget_text ( void );
-int yyget_lineno (void );
+int yyget_lineno ( void );
-void yyset_lineno (int _line_number );
+void yyset_lineno ( int _line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -600,32 +583,31 @@ void yyset_lineno (int _line_number );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap (void );
+extern "C" int yywrap ( void );
#else
-extern int yywrap (void );
+extern int yywrap ( void );
#endif
#endif
#ifndef YY_NO_UNPUT
- static void yyunput (int c,char *buf_ptr );
+ static void yyunput ( int c, char *buf_ptr );
#endif
#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy ( char *, const char *, int );
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen ( const char * );
#endif
#ifndef YY_NO_INPUT
-
#ifdef __cplusplus
-static int yyinput (void );
+static int yyinput ( void );
#else
-static int input (void );
+static int input ( void );
#endif
#endif
@@ -645,7 +627,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( 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,
@@ -656,7 +638,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -669,7 +651,7 @@ static int input (void );
else \
{ \
errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
@@ -758,17 +740,17 @@ YY_DECL
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE );
+ yy_create_buffer( yyin, YY_BUF_SIZE );
}
- yy_load_buffer_state( );
+ yy_load_buffer_state( );
}
{
-#line 13 "wp_parser.l"
+#line 14 "wp_parser.l"
-#line 772 "wp_parser.lex.c"
+#line 754 "wp_parser.lex.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -795,13 +777,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 >= 95 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ if ( yy_current_state >= 104 )
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 149 );
+ while ( yy_base[yy_current_state] != 157 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -826,186 +808,216 @@ do_action: /* This label is used only to access EOF actions. */
goto yy_find_action;
case 1:
-#line 16 "wp_parser.l"
-case 2:
#line 17 "wp_parser.l"
-case 3:
+case 2:
#line 18 "wp_parser.l"
-case 4:
+case 3:
#line 19 "wp_parser.l"
-case 5:
+case 4:
#line 20 "wp_parser.l"
-case 6:
+case 5:
#line 21 "wp_parser.l"
-case 7:
+case 6:
#line 22 "wp_parser.l"
-case 8:
+case 7:
#line 23 "wp_parser.l"
-case 9:
+case 8:
#line 24 "wp_parser.l"
-case 10:
+case 9:
#line 25 "wp_parser.l"
+case 10:
+#line 26 "wp_parser.l"
case 11:
YY_RULE_SETUP
-#line 25 "wp_parser.l"
+#line 26 "wp_parser.l"
{ return yytext[0]; } /* simply pass through */
YY_BREAK
/* yylval is union type defined in wp_parser.tab.h that is generated
* by bison with wp_parser.y */
case 12:
YY_RULE_SETUP
-#line 30 "wp_parser.l"
+#line 31 "wp_parser.l"
{ yylval.f1 = WP_SQRT; return F1; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 31 "wp_parser.l"
+#line 32 "wp_parser.l"
{ yylval.f1 = WP_EXP; return F1; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 32 "wp_parser.l"
+#line 33 "wp_parser.l"
{ yylval.f1 = WP_LOG; return F1; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 33 "wp_parser.l"
+#line 34 "wp_parser.l"
{ yylval.f1 = WP_LOG10; return F1; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 34 "wp_parser.l"
+#line 35 "wp_parser.l"
{ yylval.f1 = WP_SIN; return F1; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 35 "wp_parser.l"
+#line 36 "wp_parser.l"
{ yylval.f1 = WP_COS; return F1; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 36 "wp_parser.l"
+#line 37 "wp_parser.l"
{ yylval.f1 = WP_TAN; return F1; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 37 "wp_parser.l"
+#line 38 "wp_parser.l"
{ yylval.f1 = WP_ASIN; return F1; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 38 "wp_parser.l"
+#line 39 "wp_parser.l"
{ yylval.f1 = WP_ACOS; return F1; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 39 "wp_parser.l"
+#line 40 "wp_parser.l"
{ yylval.f1 = WP_ATAN; return F1; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 40 "wp_parser.l"
+#line 41 "wp_parser.l"
{ yylval.f1 = WP_SINH; return F1; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 41 "wp_parser.l"
+#line 42 "wp_parser.l"
{ yylval.f1 = WP_COSH; return F1; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 42 "wp_parser.l"
+#line 43 "wp_parser.l"
{ yylval.f1 = WP_TANH; return F1; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 43 "wp_parser.l"
+#line 44 "wp_parser.l"
{ yylval.f1 = WP_ABS; return F1; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 44 "wp_parser.l"
+#line 45 "wp_parser.l"
{ yylval.f1 = WP_ABS; return F1; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 45 "wp_parser.l"
+#line 46 "wp_parser.l"
{ yylval.f2 = WP_POW; return POW;}
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 46 "wp_parser.l"
+#line 47 "wp_parser.l"
{ yylval.f2 = WP_POW; return POW;}
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 47 "wp_parser.l"
-{ yylval.f2 = WP_POW; return F2; }
+#line 48 "wp_parser.l"
+{ yylval.f2 = WP_GEQ; return GEQ;}
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 48 "wp_parser.l"
-{ yylval.f2 = WP_HEAVISIDE; return F2; }
+#line 49 "wp_parser.l"
+{ yylval.f2 = WP_LEQ; return LEQ;}
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 49 "wp_parser.l"
-{ yylval.f2 = WP_MIN; return F2; }
+#line 50 "wp_parser.l"
+{ yylval.f2 = WP_EQ; return EQ;}
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 50 "wp_parser.l"
-{ yylval.f2 = WP_MAX; return F2; }
+#line 51 "wp_parser.l"
+{ yylval.f2 = WP_NEQ; return NEQ;}
YY_BREAK
-/* We use SYMBOL to hold variables and constants */
case 33:
YY_RULE_SETUP
-#line 53 "wp_parser.l"
-{ yylval.s = wp_makesymbol(yytext); return SYMBOL; }
+#line 52 "wp_parser.l"
+{ yylval.f2 = WP_AND; return AND;}
YY_BREAK
-/* Number */
case 34:
-#line 57 "wp_parser.l"
+YY_RULE_SETUP
+#line 53 "wp_parser.l"
+{ yylval.f2 = WP_OR; return OR;}
+ YY_BREAK
case 35:
YY_RULE_SETUP
+#line 54 "wp_parser.l"
+{ yylval.f2 = WP_POW; return F2; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 55 "wp_parser.l"
+{ yylval.f2 = WP_HEAVISIDE; return F2; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 56 "wp_parser.l"
+{ yylval.f2 = WP_MIN; return F2; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
#line 57 "wp_parser.l"
+{ yylval.f2 = WP_MAX; return F2; }
+ YY_BREAK
+/* We use SYMBOL to hold variables and constants */
+case 39:
+YY_RULE_SETUP
+#line 60 "wp_parser.l"
+{ yylval.s = wp_makesymbol(yytext); return SYMBOL; }
+ YY_BREAK
+/* Number */
+case 40:
+#line 64 "wp_parser.l"
+case 41:
+YY_RULE_SETUP
+#line 64 "wp_parser.l"
{ yylval.d = atof(yytext); return NUMBER; }
YY_BREAK
/* Special characters */
-case 36:
+case 42:
YY_RULE_SETUP
-#line 60 "wp_parser.l"
+#line 67 "wp_parser.l"
YY_BREAK
-case 37:
+case 43:
YY_RULE_SETUP
-#line 61 "wp_parser.l"
-/* ignore white space */
+#line 68 "wp_parser.l"
+/* ignore white space */
YY_BREAK
-case 38:
-/* rule 38 can match eol */
+case 44:
+/* rule 44 can match eol */
YY_RULE_SETUP
-#line 62 "wp_parser.l"
+#line 69 "wp_parser.l"
/* ignore line continuation */
YY_BREAK
-case 39:
-/* rule 39 can match eol */
+case 45:
+/* rule 45 can match eol */
YY_RULE_SETUP
-#line 63 "wp_parser.l"
+#line 70 "wp_parser.l"
{ return EOL; }
YY_BREAK
/* everything else */
-case 40:
+case 46:
YY_RULE_SETUP
-#line 66 "wp_parser.l"
+#line 73 "wp_parser.l"
{ yyerror("Unknow character %c\n", *yytext); }
YY_BREAK
-case 41:
+case 47:
YY_RULE_SETUP
-#line 68 "wp_parser.l"
+#line 75 "wp_parser.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1009 "wp_parser.lex.c"
+#line 1021 "wp_parser.lex.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1083,7 +1095,7 @@ case YY_STATE_EOF(INITIAL):
{
(yy_did_buffer_switch_on_eof) = 0;
- if ( yywrap( ) )
+ if ( yywrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
@@ -1150,7 +1162,7 @@ static int yy_get_next_buffer (void)
{
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = (yytext_ptr);
- yy_size_t number_to_move, i;
+ int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -1179,7 +1191,7 @@ static int yy_get_next_buffer (void)
/* Try to read more data. */
/* First move last chars to start of buffer. */
- number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@@ -1192,7 +1204,7 @@ static int yy_get_next_buffer (void)
else
{
- yy_size_t num_to_read =
+ int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
@@ -1206,7 +1218,7 @@ static int yy_get_next_buffer (void)
if ( b->yy_is_our_buffer )
{
- yy_size_t new_size = b->yy_buf_size * 2;
+ int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
@@ -1215,11 +1227,12 @@ static int yy_get_next_buffer (void)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
- yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ yyrealloc( (void *) b->yy_ch_buf,
+ (yy_size_t) (b->yy_buf_size + 2) );
}
else
/* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
+ b->yy_ch_buf = NULL;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
@@ -1247,7 +1260,7 @@ static int yy_get_next_buffer (void)
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
- yyrestart(yyin );
+ yyrestart( yyin );
}
else
@@ -1261,12 +1274,15 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
}
(yy_n_chars) += number_to_move;
@@ -1298,10 +1314,10 @@ static int yy_get_next_buffer (void)
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 >= 95 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ if ( yy_current_state >= 104 )
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
}
return yy_current_state;
@@ -1326,11 +1342,11 @@ static int yy_get_next_buffer (void)
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 >= 95 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ if ( yy_current_state >= 104 )
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 94);
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ yy_is_jam = (yy_current_state == 103);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1349,7 +1365,7 @@ static int yy_get_next_buffer (void)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
- yy_size_t number_to_move = (yy_n_chars) + 2;
+ int number_to_move = (yy_n_chars) + 2;
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
char *source =
@@ -1361,7 +1377,7 @@ static int yy_get_next_buffer (void)
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+ (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
@@ -1400,7 +1416,7 @@ static int yy_get_next_buffer (void)
else
{ /* need more input */
- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+ int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
@@ -1417,14 +1433,14 @@ static int yy_get_next_buffer (void)
*/
/* Reset buffer status. */
- yyrestart(yyin );
+ yyrestart( yyin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
- if ( yywrap( ) )
- return EOF;
+ if ( yywrap( ) )
+ return 0;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@@ -1461,11 +1477,11 @@ static int yy_get_next_buffer (void)
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE );
+ yy_create_buffer( yyin, YY_BUF_SIZE );
}
- yy_init_buffer(YY_CURRENT_BUFFER,input_file );
- yy_load_buffer_state( );
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+ yy_load_buffer_state( );
}
/** Switch to a different input buffer.
@@ -1493,7 +1509,7 @@ static int yy_get_next_buffer (void)
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( );
+ yy_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
@@ -1521,22 +1537,22 @@ static void yy_load_buffer_state (void)
{
YY_BUFFER_STATE b;
- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
- b->yy_buf_size = (yy_size_t)size;
+ b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
- b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
- yy_init_buffer(b,file );
+ yy_init_buffer( b, file );
return b;
}
@@ -1555,9 +1571,9 @@ static void yy_load_buffer_state (void)
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
- yyfree((void *) b->yy_ch_buf );
+ yyfree( (void *) b->yy_ch_buf );
- yyfree((void *) b );
+ yyfree( (void *) b );
}
/* Initializes or reinitializes a buffer.
@@ -1569,7 +1585,7 @@ static void yy_load_buffer_state (void)
{
int oerrno = errno;
- yy_flush_buffer(b );
+ yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
@@ -1612,7 +1628,7 @@ static void yy_load_buffer_state (void)
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( );
+ yy_load_buffer_state( );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -1643,7 +1659,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( );
+ yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
@@ -1662,7 +1678,7 @@ void yypop_buffer_state (void)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( );
+ yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
@@ -1680,15 +1696,15 @@ static void yyensure_buffer_stack (void)
* 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; /* After all that talk, this was set to 1 anyways... */
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
@@ -1717,7 +1733,7 @@ static void yyensure_buffer_stack (void)
* @param base the character buffer
* @param size the size in bytes of the character buffer
*
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
@@ -1727,23 +1743,23 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
- return 0;
+ return NULL;
- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
+ b->yy_input_file = NULL;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
- yy_switch_to_buffer(b );
+ yy_switch_to_buffer( b );
return b;
}
@@ -1756,10 +1772,10 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+YY_BUFFER_STATE yy_scan_string (const char * yystr )
{
- return yy_scan_bytes(yystr,strlen(yystr) );
+ return yy_scan_bytes( yystr, (int) strlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -1769,16 +1785,16 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
*
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
+YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
- yy_size_t i;
+ int i;
/* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) yyalloc(n );
+ n = (yy_size_t) (_yybytes_len + 2);
+ buf = (char *) yyalloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
@@ -1787,7 +1803,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
- b = yy_scan_buffer(buf,n );
+ b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
@@ -1803,9 +1819,9 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
#define YY_EXIT_FAILURE 2
#endif
-static void yy_fatal_error (yyconst char* msg )
+static void yynoreturn yy_fatal_error (const char* msg )
{
- (void) fprintf( stderr, "%s\n", msg );
+ fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@@ -1833,7 +1849,7 @@ static void yy_fatal_error (yyconst char* msg )
*/
int yyget_lineno (void)
{
-
+
return yylineno;
}
@@ -1856,7 +1872,7 @@ FILE *yyget_out (void)
/** Get the length of the current token.
*
*/
-yy_size_t yyget_leng (void)
+int yyget_leng (void)
{
return yyleng;
}
@@ -1912,10 +1928,10 @@ static int yy_init_globals (void)
* This function is called from yylex_destroy(), so don't allocate here.
*/
- (yy_buffer_stack) = 0;
+ (yy_buffer_stack) = NULL;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
- (yy_c_buf_p) = (char *) 0;
+ (yy_c_buf_p) = NULL;
(yy_init) = 0;
(yy_start) = 0;
@@ -1924,8 +1940,8 @@ static int yy_init_globals (void)
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
@@ -1940,7 +1956,7 @@ int yylex_destroy (void)
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
- yy_delete_buffer(YY_CURRENT_BUFFER );
+ yy_delete_buffer( YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
yypop_buffer_state();
}
@@ -1961,7 +1977,7 @@ int yylex_destroy (void)
*/
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+static void yy_flex_strncpy (char* s1, const char * s2, int n )
{
int i;
@@ -1971,7 +1987,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
+static int yy_flex_strlen (const char * s )
{
int n;
for ( n = 0; s[n]; ++n )
@@ -1983,7 +1999,7 @@ static int yy_flex_strlen (yyconst char * s )
void *yyalloc (yy_size_t size )
{
- return (void *) malloc( size );
+ return malloc(size);
}
void *yyrealloc (void * ptr, yy_size_t size )
@@ -1996,7 +2012,7 @@ void *yyrealloc (void * ptr, yy_size_t size )
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
- return (void *) realloc( (char *) ptr, size );
+ return realloc(ptr, size);
}
void yyfree (void * ptr )
@@ -2006,7 +2022,6 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 68 "wp_parser.l"
-
+#line 75 "wp_parser.l"
diff --git a/Source/Parser/wp_parser.lex.h b/Source/Parser/wp_parser.lex.h
index 13e286b05..4fd613978 100644
--- a/Source/Parser/wp_parser.lex.h
+++ b/Source/Parser/wp_parser.lex.h
@@ -13,7 +13,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
+#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -88,29 +88,23 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#ifndef SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
-#ifdef __cplusplus
-
-/* 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 */
+/* begin standard C++ headers. */
-#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
/* Size of default input buffer. */
@@ -136,7 +130,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
typedef size_t yy_size_t;
#endif
-extern yy_size_t yyleng;
+extern int yyleng;
extern FILE *yyin, *yyout;
@@ -152,7 +146,7 @@ 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.
@@ -180,7 +174,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.
*/
@@ -191,21 +185,21 @@ struct yy_buffer_state
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-void yyrestart (FILE *input_file );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
-void yy_delete_buffer (YY_BUFFER_STATE b );
-void yy_flush_buffer (YY_BUFFER_STATE b );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
-void yypop_buffer_state (void );
+void yyrestart ( FILE *input_file );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
+void yy_delete_buffer ( YY_BUFFER_STATE b );
+void yy_flush_buffer ( YY_BUFFER_STATE b );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state ( void );
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
-void *yyalloc (yy_size_t );
-void *yyrealloc (void *,yy_size_t );
-void yyfree (void * );
+void *yyalloc ( yy_size_t );
+void *yyrealloc ( void *, yy_size_t );
+void yyfree ( void * );
/* Begin user sect3 */
@@ -240,31 +234,31 @@ extern char *yytext;
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-int yylex_destroy (void );
+int yylex_destroy ( void );
-int yyget_debug (void );
+int yyget_debug ( void );
-void yyset_debug (int debug_flag );
+void yyset_debug ( int debug_flag );
-YY_EXTRA_TYPE yyget_extra (void );
+YY_EXTRA_TYPE yyget_extra ( void );
-void yyset_extra (YY_EXTRA_TYPE user_defined );
+void yyset_extra ( YY_EXTRA_TYPE user_defined );
-FILE *yyget_in (void );
+FILE *yyget_in ( void );
-void yyset_in (FILE * _in_str );
+void yyset_in ( FILE * _in_str );
-FILE *yyget_out (void );
+FILE *yyget_out ( void );
-void yyset_out (FILE * _out_str );
+void yyset_out ( FILE * _out_str );
-yy_size_t yyget_leng (void );
+ int yyget_leng ( void );
-char *yyget_text (void );
+char *yyget_text ( void );
-int yyget_lineno (void );
+int yyget_lineno ( void );
-void yyset_lineno (int _line_number );
+void yyset_lineno ( int _line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -272,18 +266,18 @@ void yyset_lineno (int _line_number );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap (void );
+extern "C" int yywrap ( void );
#else
-extern int yywrap (void );
+extern int yywrap ( void );
#endif
#endif
#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy ( char *, const char *, int );
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen ( const char * );
#endif
#ifndef YY_NO_INPUT
@@ -330,9 +324,154 @@ extern int yylex (void);
#undef YY_DECL
#endif
-#line 68 "wp_parser.l"
+#ifndef yy_create_buffer_ALREADY_DEFINED
+#undef yy_create_buffer
+#endif
+#ifndef yy_delete_buffer_ALREADY_DEFINED
+#undef yy_delete_buffer
+#endif
+#ifndef yy_scan_buffer_ALREADY_DEFINED
+#undef yy_scan_buffer
+#endif
+#ifndef yy_scan_string_ALREADY_DEFINED
+#undef yy_scan_string
+#endif
+#ifndef yy_scan_bytes_ALREADY_DEFINED
+#undef yy_scan_bytes
+#endif
+#ifndef yy_init_buffer_ALREADY_DEFINED
+#undef yy_init_buffer
+#endif
+#ifndef yy_flush_buffer_ALREADY_DEFINED
+#undef yy_flush_buffer
+#endif
+#ifndef yy_load_buffer_state_ALREADY_DEFINED
+#undef yy_load_buffer_state
+#endif
+#ifndef yy_switch_to_buffer_ALREADY_DEFINED
+#undef yy_switch_to_buffer
+#endif
+#ifndef yypush_buffer_state_ALREADY_DEFINED
+#undef yypush_buffer_state
+#endif
+#ifndef yypop_buffer_state_ALREADY_DEFINED
+#undef yypop_buffer_state
+#endif
+#ifndef yyensure_buffer_stack_ALREADY_DEFINED
+#undef yyensure_buffer_stack
+#endif
+#ifndef yylex_ALREADY_DEFINED
+#undef yylex
+#endif
+#ifndef yyrestart_ALREADY_DEFINED
+#undef yyrestart
+#endif
+#ifndef yylex_init_ALREADY_DEFINED
+#undef yylex_init
+#endif
+#ifndef yylex_init_extra_ALREADY_DEFINED
+#undef yylex_init_extra
+#endif
+#ifndef yylex_destroy_ALREADY_DEFINED
+#undef yylex_destroy
+#endif
+#ifndef yyget_debug_ALREADY_DEFINED
+#undef yyget_debug
+#endif
+#ifndef yyset_debug_ALREADY_DEFINED
+#undef yyset_debug
+#endif
+#ifndef yyget_extra_ALREADY_DEFINED
+#undef yyget_extra
+#endif
+#ifndef yyset_extra_ALREADY_DEFINED
+#undef yyset_extra
+#endif
+#ifndef yyget_in_ALREADY_DEFINED
+#undef yyget_in
+#endif
+#ifndef yyset_in_ALREADY_DEFINED
+#undef yyset_in
+#endif
+#ifndef yyget_out_ALREADY_DEFINED
+#undef yyget_out
+#endif
+#ifndef yyset_out_ALREADY_DEFINED
+#undef yyset_out
+#endif
+#ifndef yyget_leng_ALREADY_DEFINED
+#undef yyget_leng
+#endif
+#ifndef yyget_text_ALREADY_DEFINED
+#undef yyget_text
+#endif
+#ifndef yyget_lineno_ALREADY_DEFINED
+#undef yyget_lineno
+#endif
+#ifndef yyset_lineno_ALREADY_DEFINED
+#undef yyset_lineno
+#endif
+#ifndef yyget_column_ALREADY_DEFINED
+#undef yyget_column
+#endif
+#ifndef yyset_column_ALREADY_DEFINED
+#undef yyset_column
+#endif
+#ifndef yywrap_ALREADY_DEFINED
+#undef yywrap
+#endif
+#ifndef yyget_lval_ALREADY_DEFINED
+#undef yyget_lval
+#endif
+#ifndef yyset_lval_ALREADY_DEFINED
+#undef yyset_lval
+#endif
+#ifndef yyget_lloc_ALREADY_DEFINED
+#undef yyget_lloc
+#endif
+#ifndef yyset_lloc_ALREADY_DEFINED
+#undef yyset_lloc
+#endif
+#ifndef yyalloc_ALREADY_DEFINED
+#undef yyalloc
+#endif
+#ifndef yyrealloc_ALREADY_DEFINED
+#undef yyrealloc
+#endif
+#ifndef yyfree_ALREADY_DEFINED
+#undef yyfree
+#endif
+#ifndef yytext_ALREADY_DEFINED
+#undef yytext
+#endif
+#ifndef yyleng_ALREADY_DEFINED
+#undef yyleng
+#endif
+#ifndef yyin_ALREADY_DEFINED
+#undef yyin
+#endif
+#ifndef yyout_ALREADY_DEFINED
+#undef yyout
+#endif
+#ifndef yy_flex_debug_ALREADY_DEFINED
+#undef yy_flex_debug
+#endif
+#ifndef yylineno_ALREADY_DEFINED
+#undef yylineno
+#endif
+#ifndef yytables_fload_ALREADY_DEFINED
+#undef yytables_fload
+#endif
+#ifndef yytables_destroy_ALREADY_DEFINED
+#undef yytables_destroy
+#endif
+#ifndef yyTABLES_NAME_ALREADY_DEFINED
+#undef yyTABLES_NAME
+#endif
+
+#line 75 "wp_parser.l"
-#line 337 "wp_parser.lex.h"
+#line 476 "wp_parser.lex.h"
#undef yyIN_HEADER
#endif /* yyHEADER_H */
diff --git a/Source/Parser/wp_parser.tab.c b/Source/Parser/wp_parser.tab.c
index c0cf2fad8..3981894a5 100644
--- a/Source/Parser/wp_parser.tab.c
+++ b/Source/Parser/wp_parser.tab.c
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 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
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -61,8 +65,8 @@
-/* Copy the first part of user declarations. */
-#line 2 "wp_parser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 2 "wp_parser.y" /* yacc.c:337 */
#include <stdio.h>
#include <stdlib.h>
@@ -70,13 +74,16 @@
#include "wp_parser_y.h"
int yylex (void);
-#line 74 "wp_parser.tab.c" /* yacc.c:339 */
-
+#line 78 "wp_parser.tab.c" /* yacc.c:337 */
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -112,8 +119,14 @@ extern int yydebug;
F2 = 262,
EOL = 263,
POW = 264,
- NEG = 265,
- UPLUS = 266
+ GEQ = 265,
+ LEQ = 266,
+ EQ = 267,
+ NEQ = 268,
+ AND = 269,
+ OR = 270,
+ NEG = 271,
+ UPLUS = 272
};
#endif
@@ -122,7 +135,7 @@ extern int yydebug;
union YYSTYPE
{
-#line 19 "wp_parser.y" /* yacc.c:355 */
+#line 19 "wp_parser.y" /* yacc.c:352 */
struct wp_node* n;
double d;
@@ -130,7 +143,7 @@ union YYSTYPE
enum wp_f1_t f1;
enum wp_f2_t f2;
-#line 134 "wp_parser.tab.c" /* yacc.c:355 */
+#line 147 "wp_parser.tab.c" /* yacc.c:352 */
};
typedef union YYSTYPE YYSTYPE;
@@ -145,9 +158,7 @@ int yyparse (void);
#endif /* !YY_YY_WP_PARSER_TAB_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 151 "wp_parser.tab.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -168,13 +179,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -186,7 +197,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -222,15 +233,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -238,7 +240,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -389,36 +391,36 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 96
+#define YYLAST 180
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 23
+#define YYNTOKENS 29
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 3
/* YYNRULES -- Number of rules. */
-#define YYNRULES 17
+#define YYNRULES 23
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 38
+#define YYNSTATES 50
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 266
+#define YYMAXUTOK 272
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 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, 2, 2, 2,
- 20, 21, 14, 12, 22, 13, 2, 15, 2, 2,
+ 26, 27, 22, 20, 28, 21, 2, 23, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 16, 11, 17, 2, 2, 2, 2, 2, 2, 2,
+ 18, 17, 19, 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, 10, 2, 2, 2, 2, 2,
@@ -438,15 +440,17 @@ 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, 7, 8, 9, 18, 19
+ 5, 6, 7, 8, 9, 11, 12, 13, 14, 15,
+ 16, 24, 25
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 58, 58, 59, 68, 69, 70, 71, 72, 73,
- 74, 75, 76, 77, 78, 79, 80, 81
+ 0, 67, 67, 68, 77, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96
};
#endif
@@ -456,7 +460,8 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "NODE", "NUMBER", "SYMBOL", "F1", "F2",
- "EOL", "\"**\"", "'^'", "'='", "'+'", "'-'", "'*'", "'/'", "'<'", "'>'",
+ "EOL", "\"**\"", "'^'", "\">=\"", "\"<=\"", "\"==\"", "\"!=\"",
+ "\"and\"", "\"or\"", "'='", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'",
"NEG", "UPLUS", "'('", "')'", "','", "$accept", "input", "exp", YY_NULLPTR
};
#endif
@@ -467,15 +472,15 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 94, 61, 43, 45, 42, 47, 60, 62, 265, 266,
- 40, 41, 44
+ 94, 265, 266, 267, 268, 269, 270, 61, 60, 62,
+ 43, 45, 42, 47, 271, 272, 40, 41, 44
};
# endif
-#define YYPACT_NINF -18
+#define YYPACT_NINF -24
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-18)))
+ (!!((Yystate) == (-24)))
#define YYTABLE_NINF -1
@@ -484,12 +489,13 @@ static const yytype_uint16 yytoknum[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-static const yytype_int8 yypact[] =
+static const yytype_int16 yypact[] =
{
- -18, 17, -18, -18, -18, -17, -14, 27, 27, 27,
- 70, 27, 27, -2, -2, 40, -18, 27, 27, 27,
- 27, 27, 27, 27, 50, 29, -18, -2, 79, 79,
- 9, 9, -2, -2, -18, 27, 60, -18
+ -24, 23, -24, -24, -24, -23, -20, 27, 27, 27,
+ 112, 27, 27, -2, -2, 61, -24, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 78, 43, -24, -2, 15, 15, 157, 157, 142, 127,
+ 15, 15, 135, 135, -2, -2, -24, 27, 95, -24
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -498,15 +504,16 @@ static const yytype_int8 yypact[] =
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 4, 5, 0, 0, 0, 0, 0,
- 0, 0, 0, 14, 13, 0, 3, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 10, 15, 6, 7,
- 8, 9, 11, 12, 16, 0, 0, 17
+ 0, 0, 0, 20, 19, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 21, 14, 13, 15, 16, 17, 18,
+ 11, 12, 6, 7, 8, 9, 22, 0, 0, 23
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -18, -18, -7
+ -24, -24, -7
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -520,54 +527,75 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 13, 14, 15, 11, 24, 25, 12, 17, 0, 0,
- 27, 28, 29, 30, 31, 32, 33, 2, 17, 0,
- 0, 3, 4, 5, 6, 22, 23, 0, 36, 7,
- 8, 3, 4, 5, 6, 0, 0, 9, 17, 7,
- 8, 18, 19, 20, 21, 22, 23, 9, 0, 17,
- 0, 35, 18, 19, 20, 21, 22, 23, 0, 17,
- 0, 26, 18, 19, 20, 21, 22, 23, 0, 17,
- 0, 34, 18, 19, 20, 21, 22, 23, 16, 17,
- 0, 37, 18, 19, 20, 21, 22, 23, 17, 0,
- 0, 0, 0, 20, 21, 22, 23
+ 13, 14, 15, 11, 30, 31, 12, 17, 0, 0,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 2, 17, 0, 0, 3, 4, 5,
+ 6, 3, 4, 5, 6, 26, 27, 28, 29, 0,
+ 48, 0, 0, 7, 8, 0, 0, 7, 8, 9,
+ 0, 0, 17, 9, 18, 19, 20, 21, 22, 23,
+ 0, 24, 25, 26, 27, 28, 29, 0, 0, 0,
+ 17, 47, 18, 19, 20, 21, 22, 23, 0, 24,
+ 25, 26, 27, 28, 29, 0, 0, 17, 32, 18,
+ 19, 20, 21, 22, 23, 0, 24, 25, 26, 27,
+ 28, 29, 0, 0, 17, 46, 18, 19, 20, 21,
+ 22, 23, 0, 24, 25, 26, 27, 28, 29, 0,
+ 16, 17, 49, 18, 19, 20, 21, 22, 23, 0,
+ 24, 25, 26, 27, 28, 29, 17, 0, 18, 19,
+ 20, 21, 22, 0, 17, 24, 25, 26, 27, 28,
+ 29, 17, 0, 18, 19, 20, 21, 28, 29, 0,
+ 24, 25, 26, 27, 28, 29, 17, 0, 18, 19,
+ 0, 0, 0, 0, 0, 24, 25, 26, 27, 28,
+ 29
};
static const yytype_int8 yycheck[] =
{
- 7, 8, 9, 20, 11, 12, 20, 9, -1, -1,
- 17, 18, 19, 20, 21, 22, 23, 0, 9, -1,
- -1, 4, 5, 6, 7, 16, 17, -1, 35, 12,
- 13, 4, 5, 6, 7, -1, -1, 20, 9, 12,
- 13, 12, 13, 14, 15, 16, 17, 20, -1, 9,
- -1, 22, 12, 13, 14, 15, 16, 17, -1, 9,
- -1, 21, 12, 13, 14, 15, 16, 17, -1, 9,
- -1, 21, 12, 13, 14, 15, 16, 17, 8, 9,
- -1, 21, 12, 13, 14, 15, 16, 17, 9, -1,
- -1, -1, -1, 14, 15, 16, 17
+ 7, 8, 9, 26, 11, 12, 26, 9, -1, -1,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 0, 9, -1, -1, 4, 5, 6,
+ 7, 4, 5, 6, 7, 20, 21, 22, 23, -1,
+ 47, -1, -1, 20, 21, -1, -1, 20, 21, 26,
+ -1, -1, 9, 26, 11, 12, 13, 14, 15, 16,
+ -1, 18, 19, 20, 21, 22, 23, -1, -1, -1,
+ 9, 28, 11, 12, 13, 14, 15, 16, -1, 18,
+ 19, 20, 21, 22, 23, -1, -1, 9, 27, 11,
+ 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
+ 22, 23, -1, -1, 9, 27, 11, 12, 13, 14,
+ 15, 16, -1, 18, 19, 20, 21, 22, 23, -1,
+ 8, 9, 27, 11, 12, 13, 14, 15, 16, -1,
+ 18, 19, 20, 21, 22, 23, 9, -1, 11, 12,
+ 13, 14, 15, -1, 9, 18, 19, 20, 21, 22,
+ 23, 9, -1, 11, 12, 13, 14, 22, 23, -1,
+ 18, 19, 20, 21, 22, 23, 9, -1, 11, 12,
+ -1, -1, -1, -1, -1, 18, 19, 20, 21, 22,
+ 23
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 24, 0, 4, 5, 6, 7, 12, 13, 20,
- 25, 20, 20, 25, 25, 25, 8, 9, 12, 13,
- 14, 15, 16, 17, 25, 25, 21, 25, 25, 25,
- 25, 25, 25, 25, 21, 22, 25, 21
+ 0, 30, 0, 4, 5, 6, 7, 20, 21, 26,
+ 31, 26, 26, 31, 31, 31, 8, 9, 11, 12,
+ 13, 14, 15, 16, 18, 19, 20, 21, 22, 23,
+ 31, 31, 27, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 27, 28, 31, 27
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25
+ 0, 29, 30, 30, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 3, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 2, 2, 3, 4, 6
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 2, 3, 4, 6
};
@@ -583,22 +611,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -638,37 +666,37 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -702,7 +730,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -713,7 +741,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
);
YYFPRINTF (stderr, "\n");
}
@@ -817,7 +845,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -835,7 +866,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -913,10 +944,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -928,6 +959,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -939,9 +971,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1067,23 +1100,31 @@ yyparse (void)
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1099,14 +1140,10 @@ yyparse (void)
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1122,22 +1159,22 @@ yyparse (void)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1146,11 +1183,11 @@ yyparse (void)
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1223,7 +1260,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1244,99 +1281,135 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 59 "wp_parser.y" /* yacc.c:1646 */
+#line 68 "wp_parser.y" /* yacc.c:1652 */
{
wp_defexpr((yyvsp[-1].n));
}
-#line 1252 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1289 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 4:
-#line 68 "wp_parser.y" /* yacc.c:1646 */
+#line 77 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newnumber((yyvsp[0].d)); }
-#line 1258 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1295 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 5:
-#line 69 "wp_parser.y" /* yacc.c:1646 */
+#line 78 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newsymbol((yyvsp[0].s)); }
-#line 1264 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1301 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 6:
-#line 70 "wp_parser.y" /* yacc.c:1646 */
+#line 79 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newnode(WP_ADD, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1270 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1307 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 7:
-#line 71 "wp_parser.y" /* yacc.c:1646 */
+#line 80 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newnode(WP_SUB, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1276 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1313 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 8:
-#line 72 "wp_parser.y" /* yacc.c:1646 */
+#line 81 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newnode(WP_MUL, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1282 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1319 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 9:
-#line 73 "wp_parser.y" /* yacc.c:1646 */
+#line 82 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newnode(WP_DIV, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1288 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1325 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 10:
-#line 74 "wp_parser.y" /* yacc.c:1646 */
+#line 83 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = (yyvsp[-1].n); }
-#line 1294 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1331 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 11:
-#line 75 "wp_parser.y" /* yacc.c:1646 */
+#line 84 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newf2(WP_LT, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1300 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1337 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 12:
-#line 76 "wp_parser.y" /* yacc.c:1646 */
+#line 85 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newf2(WP_GT, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1306 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1343 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 13:
-#line 77 "wp_parser.y" /* yacc.c:1646 */
- { (yyval.n) = wp_newnode(WP_NEG, (yyvsp[0].n), NULL); }
-#line 1312 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 86 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_LEQ, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1349 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 14:
-#line 78 "wp_parser.y" /* yacc.c:1646 */
- { (yyval.n) = (yyvsp[0].n); }
-#line 1318 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 87 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_GEQ, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1355 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 15:
-#line 79 "wp_parser.y" /* yacc.c:1646 */
- { (yyval.n) = wp_newf2(WP_POW, (yyvsp[-2].n), (yyvsp[0].n)); }
-#line 1324 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 88 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_EQ, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1361 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 16:
-#line 80 "wp_parser.y" /* yacc.c:1646 */
- { (yyval.n) = wp_newf1((yyvsp[-3].f1), (yyvsp[-1].n)); }
-#line 1330 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 89 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_NEQ, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1367 "wp_parser.tab.c" /* yacc.c:1652 */
break;
case 17:
-#line 81 "wp_parser.y" /* yacc.c:1646 */
+#line 90 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_AND, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1373 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 18:
+#line 91 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_OR, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1379 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 19:
+#line 92 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newnode(WP_NEG, (yyvsp[0].n), NULL); }
+#line 1385 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 20:
+#line 93 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = (yyvsp[0].n); }
+#line 1391 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 21:
+#line 94 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf2(WP_POW, (yyvsp[-2].n), (yyvsp[0].n)); }
+#line 1397 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 22:
+#line 95 "wp_parser.y" /* yacc.c:1652 */
+ { (yyval.n) = wp_newf1((yyvsp[-3].f1), (yyvsp[-1].n)); }
+#line 1403 "wp_parser.tab.c" /* yacc.c:1652 */
+ break;
+
+ case 23:
+#line 96 "wp_parser.y" /* yacc.c:1652 */
{ (yyval.n) = wp_newf2((yyvsp[-5].f2), (yyvsp[-3].n), (yyvsp[-1].n)); }
-#line 1336 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1409 "wp_parser.tab.c" /* yacc.c:1652 */
break;
-#line 1340 "wp_parser.tab.c" /* yacc.c:1646 */
+#line 1413 "wp_parser.tab.c" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1361,14 +1434,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -1451,12 +1523,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -1518,6 +1588,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -1525,6 +1596,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -1535,6 +1607,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -1564,5 +1640,5 @@ yyreturn:
#endif
return yyresult;
}
-#line 84 "wp_parser.y" /* yacc.c:1906 */
+#line 99 "wp_parser.y" /* yacc.c:1918 */
diff --git a/Source/Parser/wp_parser.tab.h b/Source/Parser/wp_parser.tab.h
index f36b4b611..b50516808 100644
--- a/Source/Parser/wp_parser.tab.h
+++ b/Source/Parser/wp_parser.tab.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 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
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_YY_WP_PARSER_TAB_H_INCLUDED
# define YY_YY_WP_PARSER_TAB_H_INCLUDED
/* Debug traces. */
@@ -52,8 +56,14 @@ extern int yydebug;
F2 = 262,
EOL = 263,
POW = 264,
- NEG = 265,
- UPLUS = 266
+ GEQ = 265,
+ LEQ = 266,
+ EQ = 267,
+ NEQ = 268,
+ AND = 269,
+ OR = 270,
+ NEG = 271,
+ UPLUS = 272
};
#endif
@@ -62,7 +72,7 @@ extern int yydebug;
union YYSTYPE
{
-#line 19 "wp_parser.y" /* yacc.c:1909 */
+#line 19 "wp_parser.y" /* yacc.c:1921 */
struct wp_node* n;
double d;
@@ -70,7 +80,7 @@ union YYSTYPE
enum wp_f1_t f1;
enum wp_f2_t f2;
-#line 74 "wp_parser.tab.h" /* yacc.c:1909 */
+#line 84 "wp_parser.tab.h" /* yacc.c:1921 */
};
typedef union YYSTYPE YYSTYPE;
diff --git a/Source/Parser/wp_parser.y b/Source/Parser/wp_parser.y
index 3081125cc..453eda1cd 100644
--- a/Source/Parser/wp_parser.y
+++ b/Source/Parser/wp_parser.y
@@ -32,12 +32,21 @@
%token <f2> F2
%token EOL
%token POW "**" '^'
+%token GEQ ">="
+%token LEQ "<="
+%token EQ "=="
+%token NEQ "!="
+%token AND "and"
+%token OR "or"
%nonassoc F1 F2
%right '='
+%left OR
+%left AND
+%left EQ NEQ
+%left '<' '>' GEQ LEQ
%left '+' '-'
%left '*' '/'
-%left '<' '>'
%nonassoc NEG UPLUS
%right POW
@@ -74,6 +83,12 @@ exp:
| '(' exp ')' { $$ = $2; }
| exp '<' exp { $$ = wp_newf2(WP_LT, $1, $3); }
| exp '>' exp { $$ = wp_newf2(WP_GT, $1, $3); }
+| exp LEQ exp { $$ = wp_newf2(WP_LEQ, $1, $3); }
+| exp GEQ exp { $$ = wp_newf2(WP_GEQ, $1, $3); }
+| exp EQ exp { $$ = wp_newf2(WP_EQ, $1, $3); }
+| exp NEQ exp { $$ = wp_newf2(WP_NEQ, $1, $3); }
+| exp AND exp { $$ = wp_newf2(WP_AND, $1, $3); }
+| exp OR exp { $$ = wp_newf2(WP_OR, $1, $3); }
| '-'exp %prec NEG { $$ = wp_newnode(WP_NEG, $2, NULL); }
| '+'exp %prec UPLUS { $$ = $2; }
| exp POW exp { $$ = wp_newf2(WP_POW, $1, $3); }
diff --git a/Source/Parser/wp_parser_y.c b/Source/Parser/wp_parser_y.c
index 402c4e67b..46cb199db 100644
--- a/Source/Parser/wp_parser_y.c
+++ b/Source/Parser/wp_parser_y.c
@@ -185,6 +185,18 @@ wp_call_f2 (enum wp_f2_t type, double a, double b)
return (a > b) ? 1.0 : 0.0;
case WP_LT:
return (a < b) ? 1.0 : 0.0;
+ case WP_GEQ:
+ return (a >= b) ? 1.0 : 0.0;
+ case WP_LEQ:
+ return (a <= b) ? 1.0 : 0.0;
+ case WP_EQ:
+ return (a == b) ? 1.0 : 0.0;
+ case WP_NEQ:
+ return (a != b) ? 1.0 : 0.0;
+ case WP_AND:
+ return (a && b) ? 1.0 : 0.0;
+ case WP_OR:
+ return (a || b) ? 1.0 : 0.0;
case WP_HEAVISIDE:
return (a < 0.0) ? 0.0 : ((a > 0.0) ? 1.0 : b);
case WP_MIN:
@@ -805,6 +817,24 @@ wp_ast_print_f2 (struct wp_f2* f2)
case WP_LT:
printf("LT\n");
break;
+ case WP_GEQ:
+ printf("GEQ\n");
+ break;
+ case WP_LEQ:
+ printf("LEQ\n");
+ break;
+ case WP_EQ:
+ printf("EQ\n");
+ break;
+ case WP_NEQ:
+ printf("NEQ\n");
+ break;
+ case WP_AND:
+ printf("AND\n");
+ break;
+ case WP_OR:
+ printf("OR\n");
+ break;
case WP_HEAVISIDE:
printf("HEAVISIDE\n");
break;
@@ -1015,4 +1045,3 @@ wp_parser_setconst (struct wp_parser* parser, char const* name, double c)
wp_ast_setconst(parser->ast, name, c);
wp_ast_optimize(parser->ast);
}
-
diff --git a/Source/Parser/wp_parser_y.h b/Source/Parser/wp_parser_y.h
index c583d1a33..4a3aeda40 100644
--- a/Source/Parser/wp_parser_y.h
+++ b/Source/Parser/wp_parser_y.h
@@ -35,6 +35,12 @@ enum wp_f2_t { // Built-in functions with two arguments
WP_POW = 1,
WP_GT,
WP_LT,
+ WP_GEQ,
+ WP_LEQ,
+ WP_EQ,
+ WP_NEQ,
+ WP_AND,
+ WP_OR,
WP_HEAVISIDE,
WP_MIN,
WP_MAX
diff --git a/Source/Particles/Deposition/CurrentDeposition.H b/Source/Particles/Deposition/CurrentDeposition.H
index efda97892..97bc53c20 100644
--- a/Source/Particles/Deposition/CurrentDeposition.H
+++ b/Source/Particles/Deposition/CurrentDeposition.H
@@ -3,12 +3,12 @@
using namespace amrex;
-// Compute shape factor and return index of leftmost cell where
+// Compute shape factor and return index of leftmost cell where
// particle writes.
// Specialized templates are defined below for orders 1, 2 and 3.
template <int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
-int compute_shape_factor(Real* const sx, Real xint) {return 0;};
+int compute_shape_factor(Real* const sx, Real xint);
// Compute shape factor for order 1.
template <>
@@ -176,4 +176,233 @@ void doDepositionShapeN(const Real * const xp, const Real * const yp, const Real
);
}
+// Compute shape factor and return index of leftmost cell where
+// particle writes.
+// Specialized templates are defined below for orders 1, 2 and 3.
+template <int depos_order>
+AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
+int compute_shifted_shape_factor (Real* const sx, const Real x_old, const int i_new);
+
+// Compute shape factor for order 1.
+template <>
+AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
+int compute_shifted_shape_factor <1> (Real* const sx, const Real x_old, const int i_new){
+ const int i = (int) x_old;
+ const int i_shift = i - i_new;
+ const Real xint = x_old - i;
+ sx[1+i_shift] = 1.0 - xint;
+ sx[2+i_shift] = xint;
+ return i;
+}
+
+// Compute shape factor for order 2.
+template <>
+AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
+int compute_shifted_shape_factor <2> (Real* const sx, const Real x_old, const int i_new){
+ const int i = (int) (x_old+0.5);
+ const int i_shift = i - (i_new + 1);
+ const Real xint = x_old - i;
+ sx[1+i_shift] = 0.5*(0.5-xint)*(0.5-xint);
+ sx[2+i_shift] = 0.75-xint*xint;
+ sx[3+i_shift] = 0.5*(0.5+xint)*(0.5+xint);
+ // index of the leftmost cell where particle deposits
+ return i-1;
+}
+
+// Compute shape factor for order 3.
+template <>
+AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
+int compute_shifted_shape_factor <3> (Real* const sx, const Real x_old, const int i_new){
+ const int i = (int) x_old;
+ const int i_shift = i - (i_new + 1);
+ const Real xint = x_old - i;
+ sx[1+i_shift] = 1.0/6.0*(1.0-xint)*(1.0-xint)*(1.0-xint);
+ sx[2+i_shift] = 2.0/3.0-xint*xint*(1-xint/2.0);
+ sx[3+i_shift] = 2.0/3.0-(1-xint)*(1-xint)*(1.0-0.5*(1-xint));
+ sx[4+i_shift] = 1.0/6.0*xint*xint*xint;
+ // index of the leftmost cell where particle deposits
+ return i-1;
+}
+
+/* \brief Esirkepov Current Deposition for thread thread_num
+ * /param xp, yp, zp : Pointer to arrays of particle positions.
+ * \param wp : Pointer to array of particle weights.
+ * \param uxp uyp uzp : Pointer to arrays of particle momentum.
+ * \param Jx_arr : Array4 of current density, either full array or tile.
+ * \param Jy_arr : Array4 of current density, either full array or tile.
+ * \param Jz_arr : Array4 of current density, either full array or tile.
+ * \param np_to_depose : Number of particles for which current is deposited.
+ * \param dt : Time step for particle level
+ * \param dx : 3D cell size
+ * \param xyzmin : Physical lower bounds of domain.
+ * \param lo : Index lower bounds of domain.
+ * /param q : species charge.
+ */
+template <int depos_order>
+void doEsirkepovDepositionShapeN (const Real * const xp, const Real * const yp, const Real * const zp,
+ const Real * const wp, const Real * const uxp,
+ const Real * const uyp, const Real * const uzp,
+ const amrex::Array4<amrex::Real>& Jx_arr,
+ const amrex::Array4<amrex::Real>& Jy_arr,
+ const amrex::Array4<amrex::Real>& Jz_arr,
+ const long np_to_depose,
+ const amrex::Real dt, const std::array<amrex::Real,3>& dx,
+ const std::array<Real, 3> xyzmin,
+ const Dim3 lo,
+ const amrex::Real q)
+{
+ const Real dxi = 1.0/dx[0];
+ const Real dtsdx0 = dt*dxi;
+ const Real xmin = xyzmin[0];
+#if (AMREX_SPACEDIM == 3)
+ const Real dyi = 1.0/dx[1];
+ const Real dtsdy0 = dt*dyi;
+ const Real ymin = xyzmin[1];
+#endif
+ const Real dzi = 1.0/dx[2];
+ const Real dtsdz0 = dt*dzi;
+ const Real zmin = xyzmin[2];
+
+#if (AMREX_SPACEDIM == 3)
+ const Real invdtdx = 1.0/(dt*dx[1]*dx[2]);
+ const Real invdtdy = 1.0/(dt*dx[0]*dx[2]);
+ const Real invdtdz = 1.0/(dt*dx[0]*dx[1]);
+#elif (AMREX_SPACEDIM == 2)
+ const Real invdtdx = 1.0/(dt*dx[2]);
+ const Real invdtdz = 1.0/(dt*dx[0]);
+ const Real invvol = 1.0/(dx[0]*dx[2]);
+#endif
+
+ const Real clightsq = 1.0/PhysConst::c/PhysConst::c;
+
+ // Loop over particles and deposit into Jx_arr, Jy_arr and Jz_arr
+ ParallelFor( np_to_depose,
+ [=] AMREX_GPU_DEVICE (long ip) {
+
+ // --- Get particle quantities
+ const Real gaminv = 1.0/std::sqrt(1.0 + uxp[ip]*uxp[ip]*clightsq
+ + uyp[ip]*uyp[ip]*clightsq
+ + uzp[ip]*uzp[ip]*clightsq);
+
+ // wqx, wqy wqz are particle current in each direction
+ const Real wq = q*wp[ip];
+ const Real wqx = wq*invdtdx;
+#if (AMREX_SPACEDIM == 3)
+ const Real wqy = wq*invdtdy;
+#endif
+ const Real wqz = wq*invdtdz;
+
+ // computes current and old position in grid units
+ const Real x_new = (xp[ip] - xmin)*dxi;
+ const Real x_old = x_new - dtsdx0*uxp[ip]*gaminv;
+#if (AMREX_SPACEDIM == 3)
+ const Real y_new = (yp[ip] - ymin)*dyi;
+ const Real y_old = y_new - dtsdy0*uyp[ip]*gaminv;
+#endif
+ const Real z_new = (zp[ip] - zmin)*dzi;
+ const Real z_old = z_new - dtsdz0*uzp[ip]*gaminv;
+
+ // Shape factor arrays
+ // Note that there are extra values above and below
+ // to possibly hold the factor for the old particle
+ // which can be at a different grid location.
+ Real AMREX_RESTRICT sx_new[depos_order + 3] = {0.};
+ Real AMREX_RESTRICT sx_old[depos_order + 3] = {0.};
+#if (AMREX_SPACEDIM == 3)
+ Real AMREX_RESTRICT sy_new[depos_order + 3] = {0.};
+ Real AMREX_RESTRICT sy_old[depos_order + 3] = {0.};
+#endif
+ Real AMREX_RESTRICT sz_new[depos_order + 3] = {0.};
+ Real AMREX_RESTRICT sz_old[depos_order + 3] = {0.};
+
+ // --- Compute shape factors
+ // Compute shape factors for position as they are now and at old positions
+ // [ijk]_new: leftmost grid point that the particle touches
+ const int i_new = compute_shape_factor<depos_order>(sx_new+1, x_new);
+ const int i_old = compute_shifted_shape_factor<depos_order>(sx_old, x_old, i_new);
+#if (AMREX_SPACEDIM == 3)
+ const int j_new = compute_shape_factor<depos_order>(sy_new+1, y_new);
+ const int j_old = compute_shifted_shape_factor<depos_order>(sy_old, y_old, j_new);
+#endif
+ const int k_new = compute_shape_factor<depos_order>(sz_new+1, z_new);
+ const int k_old = compute_shifted_shape_factor<depos_order>(sz_old, z_old, k_new);
+
+ // computes min/max positions of current contributions
+ int dil = 1, diu = 1;
+ if (i_old < i_new) dil = 0;
+ if (i_old > i_new) diu = 0;
+#if (AMREX_SPACEDIM == 3)
+ int djl = 1, dju = 1;
+ if (j_old < j_new) djl = 0;
+ if (j_old > j_new) dju = 0;
+#endif
+ int dkl = 1, dku = 1;
+ if (k_old < k_new) dkl = 0;
+ if (k_old > k_new) dku = 0;
+
+#if (AMREX_SPACEDIM == 3)
+
+ for (int k=dkl; k<=depos_order+2-dku; k++) {
+ for (int j=djl; j<=depos_order+2-dju; j++) {
+ Real sdxi = 0.;
+ for (int i=dil; i<=depos_order+1-diu; i++) {
+ sdxi += wqx*(sx_old[i] - sx_new[i])*((sy_new[j] + 0.5*(sy_old[j] - sy_new[j]))*sz_new[k] +
+ (0.5*sy_new[j] + 1./3.*(sy_old[j] - sy_new[j]))*(sz_old[k] - sz_new[k]));
+ amrex::Gpu::Atomic::Add( &Jx_arr(lo.x+i_new-1+i, lo.y+j_new-1+j, lo.z+k_new-1+k), sdxi);
+ }
+ }
+ }
+ for (int k=dkl; k<=depos_order+2-dku; k++) {
+ for (int i=dil; i<=depos_order+2-diu; i++) {
+ Real sdyj = 0.;
+ for (int j=djl; j<=depos_order+1-dju; j++) {
+ sdyj += wqy*(sy_old[j] - sy_new[j])*((sz_new[k] + 0.5*(sz_old[k] - sz_new[k]))*sx_new[i] +
+ (0.5*sz_new[k] + 1./3.*(sz_old[k] - sz_new[k]))*(sx_old[i] - sx_new[i]));
+ amrex::Gpu::Atomic::Add( &Jy_arr(lo.x+i_new-1+i, lo.y+j_new-1+j, lo.z+k_new-1+k), sdyj);
+ }
+ }
+ }
+ for (int j=djl; j<=depos_order+2-dju; j++) {
+ for (int i=dil; i<=depos_order+2-diu; i++) {
+ Real sdzk = 0.;
+ for (int k=dkl; k<=depos_order+1-dku; k++) {
+ sdzk += wqz*(sz_old[k] - sz_new[k])*((sx_new[i] + 0.5*(sx_old[i] - sx_new[i]))*sy_new[j] +
+ (0.5*sx_new[i] + 1./3.*(sx_old[i] - sx_new[i]))*(sy_old[j] - sy_new[j]));
+ amrex::Gpu::Atomic::Add( &Jz_arr(lo.x+i_new-1+i, lo.y+j_new-1+j, lo.z+k_new-1+k), sdzk);
+ }
+ }
+ }
+
+#elif (AMREX_SPACEDIM == 2)
+
+ for (int k=dkl; k<=depos_order+2-dku; k++) {
+ Real sdxi = 0.;
+ for (int i=dil; i<=depos_order+1-diu; i++) {
+ sdxi += wqx*(sx_old[i] - sx_new[i])*(sz_new[k] + 0.5*(sz_old[k] - sz_new[k]));
+ amrex::Gpu::Atomic::Add( &Jx_arr(lo.x+i_new-1+i, lo.y+k_new-1+k, 0), sdxi);
+ }
+ }
+ for (int k=dkl; k<=depos_order+2-dku; k++) {
+ for (int i=dil; i<=depos_order+2-diu; i++) {
+ const Real sdyj = wq*uyp[ip]*gaminv*invvol*((sz_new[k] + 0.5*(sz_old[k] - sz_new[k]))*sx_new[i] +
+ (0.5*sz_new[k] + 1./3.*(sz_old[k] - sz_new[k]))*(sx_old[i] - sx_new[i]));
+ amrex::Gpu::Atomic::Add( &Jy_arr(lo.x+i_new-1+i, lo.y+k_new-1+k, 0), sdyj);
+ }
+ }
+ for (int i=dil; i<=depos_order+2-diu; i++) {
+ Real sdzk = 0.;
+ for (int k=dkl; k<=depos_order+1-dku; k++) {
+ sdzk += wqz*(sz_old[k] - sz_new[k])*(sx_new[i] + 0.5*(sx_old[i] - sx_new[i]));
+ amrex::Gpu::Atomic::Add( &Jz_arr(lo.x+i_new-1+i, lo.y+k_new-1+k, 0), sdzk);
+ }
+ }
+
+#endif
+ }
+ );
+
+
+
+}
+
#endif // CURRENTDEPOSITION_H_
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index 7316dcc95..a20f0035e 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -6,6 +6,7 @@
#include <AMReX_AmrParGDB.H>
#include <WarpX_f.H>
#include <WarpX.H>
+#include <WarpXAlgorithmSelection.H>
// Import low-level single-particle kernels
#include <GetAndSetPosition.H>
@@ -510,21 +511,40 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti,
// Better for memory? worth trying?
const Dim3 lo = lbound(tilebox);
- if (WarpX::nox == 1){
- doDepositionShapeN<1>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
- uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
- jz_arr, offset, np_to_depose, dt, dx,
- xyzmin, lo, stagger_shift, q);
- } else if (WarpX::nox == 2){
- doDepositionShapeN<2>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
- uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
- jz_arr, offset, np_to_depose, dt, dx,
- xyzmin, lo, stagger_shift, q);
- } else if (WarpX::nox == 3){
- doDepositionShapeN<3>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
- uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
- jz_arr, offset, np_to_depose, dt, dx,
- xyzmin, lo, stagger_shift, q);
+ if (WarpX::current_deposition_algo == CurrentDepositionAlgo::Esirkepov) {
+ if (WarpX::nox == 1){
+ doEsirkepovDepositionShapeN<1>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, np_to_depose, dt, dx,
+ xyzmin, lo, q);
+ } else if (WarpX::nox == 2){
+ doEsirkepovDepositionShapeN<2>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, np_to_depose, dt, dx,
+ xyzmin, lo, q);
+ } else if (WarpX::nox == 3){
+ doEsirkepovDepositionShapeN<3>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, np_to_depose, dt, dx,
+ xyzmin, lo, q);
+ }
+ } else {
+ if (WarpX::nox == 1){
+ doDepositionShapeN<1>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, offset, np_to_depose, dt, dx,
+ xyzmin, lo, stagger_shift, q);
+ } else if (WarpX::nox == 2){
+ doDepositionShapeN<2>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, offset, np_to_depose, dt, dx,
+ xyzmin, lo, stagger_shift, q);
+ } else if (WarpX::nox == 3){
+ doDepositionShapeN<3>(xp, yp, zp, wp.dataPtr(), uxp.dataPtr(),
+ uyp.dataPtr(), uzp.dataPtr(), jx_arr, jy_arr,
+ jz_arr, offset, np_to_depose, dt, dx,
+ xyzmin, lo, stagger_shift, q);
+ }
}
#ifndef AMREX_USE_GPU
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index f379d5f4c..1c0d01ce5 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -493,10 +493,6 @@ WarpX::ReadParameters ()
pp.query("use_picsar_deposition", use_picsar_deposition);
#endif
current_deposition_algo = GetAlgorithmInteger(pp, "current_deposition");
- if (!use_picsar_deposition){
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE( current_deposition_algo >= 2,
- "if not use_picsar_deposition, cannot use Esirkepov deposition.");
- }
charge_deposition_algo = GetAlgorithmInteger(pp, "charge_deposition");
field_gathering_algo = GetAlgorithmInteger(pp, "field_gathering");
particle_pusher_algo = GetAlgorithmInteger(pp, "particle_pusher");