diff options
Diffstat (limited to 'src')
33 files changed, 6653 insertions, 2470 deletions
diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am index 74731cfd5..285f458fe 100644 --- a/src/post/goom/Makefile.am +++ b/src/post/goom/Makefile.am @@ -22,7 +22,7 @@ endif xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \ config_param.c convolve_fx.c cpu_info.c drawmethods.c filters.c flying_stars_fx.c \ - gfontlib.c gfontrle.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c \ + gfontlib.c gfontrle.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \ goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c mathtools.c \ plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) @@ -31,5 +31,6 @@ xineplug_post_goom_la_LDFLAGS = -avoid-version -module $(XINE_PLUGIN_MIN_SYMS) noinst_HEADERS = cpu_info.h default_scripts.h drawmethods.h gfontlib.h gfontrle.h goom.h \ goom_config.h goom_config_param.h goom_filters.h goom_fx.h goom_graphic.h \ goom_plugin_info.h goom_tools.h goom_typedefs.h goom_visual_fx.h goomsl.h goomsl_hash.h \ - goomsl_private.h goomsl_yacc.h ifs.h lines.h mathtools.h mmx.h \ - ppc_drawings.h ppc_zoom_ultimate.h sound_tester.h surf3d.h tentacle3d.h v3d.h + goomsl_heap.h goomsl_private.h goomsl_yacc.h ifs.h lines.h mathtools.h mmx.h \ + ppc_drawings.h ppc_zoom_ultimate.h sound_tester.h surf3d.h tentacle3d.h v3d.h \ + motif_goom1.h motif_goom2.h diff --git a/src/post/goom/convolve_fx.c b/src/post/goom/convolve_fx.c index 1aaa4ae28..5f7268a7c 100644 --- a/src/post/goom/convolve_fx.c +++ b/src/post/goom/convolve_fx.c @@ -7,139 +7,329 @@ #include <stdlib.h> #include <string.h> -static const char DEF_SCRIPT[] = "\n\n"; -#if 0 -"-> config;\n" -"-> main;\n" -"\n" -"<config>\n" -" float INCREASE_RATE = 150%;\n" -" float DECAY_RATE = 96%;\n" -"\n" -"<main>\n" -" (Sound.Goom_Detection > 0.8) ?\n" -" Bright_Flash.Factor = Bright_Flash.Factor + Sound.Goom_Power * INCREASE_RATE;\n" -"\n" -" Bright_Flash.Factor = Bright_Flash.Factor * DECAY_RATE;\n" -"\n"; -#endif +//#define CONV_MOTIF_W 32 +//#define CONV_MOTIF_WMASK 0x1f + +#define CONV_MOTIF_W 128 +#define CONV_MOTIF_WMASK 0x7f + +typedef char Motif[CONV_MOTIF_W][CONV_MOTIF_W]; + +#include "motif_goom1.h" +#include "motif_goom2.h" + +#define NB_THETA 512 #define MAX 2.0f typedef struct _CONV_DATA{ -/* float factor; - int lock; - int started; - float curPower;*/ - PluginParam light; - PluginParam factor_adj_p; - PluginParam factor_p; - PluginParam script_p; - PluginParam compile_p; - PluginParameters params; - - GoomSL *script; - + PluginParam light; + PluginParam factor_adj_p; + PluginParam factor_p; + PluginParameters params; + + GoomSL *script; + + /* rotozoom */ + int theta; + float ftheta; + int h_sin[NB_THETA]; + int h_cos[NB_THETA]; + int h_height; + float visibility; + Motif conv_motif; + int inverse_motif; + } ConvData; -static void convolve_init(VisualFX *_this) { - ConvData *data; - data = (ConvData*)malloc(sizeof(ConvData)); +/* init rotozoom tables */ +static void compute_tables(VisualFX *_this, PluginInfo *info) +{ + ConvData *data = (ConvData*)_this->fx_data; + double screen_coef; + int i; + double h; + double radian; + + if (data->h_height == info->screen.height) return; - data->light = secure_f_param("Screen Brightness"); - data->light.param.fval.max = 300.0f; - data->light.param.fval.step = 1.0f; - data->light.param.fval.value = 100.0f; + screen_coef = 2.0 * 300.0 / (double)info->screen.height; + data->h_height = info->screen.height; - data->factor_adj_p = secure_f_param("Flash Intensity"); - data->factor_adj_p.param.fval.max = 100.0f; - data->factor_adj_p.param.fval.step = 1.0f; - data->factor_adj_p.param.fval.value = 50.0f; + for ( i=0 ; i<NB_THETA ; i++ ) { + radian = 2*i*M_PI/NB_THETA; + h = (0.2 + cos (radian) / 15.0 * sin(radian * 2.0 + 12.123)) * screen_coef; + data->h_cos[i] = 0x10000 * (-h * cos (radian) * cos(radian)); + data->h_sin[i] = 0x10000 * (h * sin (radian + 1.57) * sin(radian)); + } +} + +static void set_motif(ConvData *data, Motif motif) +{ + int i,j; + for (i=0;i<CONV_MOTIF_W;++i) for (j=0;j<CONV_MOTIF_W;++j) + data->conv_motif[i][j] = motif[CONV_MOTIF_W-i-1][CONV_MOTIF_W-j-1]; +} - data->factor_p = secure_f_feedback("Factor"); -/* FVAL(data->factor_p) = data->factor / MAX;*/ +static void convolve_init(VisualFX *_this, PluginInfo *info) { + ConvData *data; + data = (ConvData*)malloc(sizeof(ConvData)); + _this->fx_data = (void*)data; - data->script_p = secure_s_param("Script"); - set_str_param_value(&data->script_p, DEF_SCRIPT); - data->compile_p = secure_b_param("Compile", 0); + data->light = secure_f_param("Screen Brightness"); + data->light.param.fval.max = 300.0f; + data->light.param.fval.step = 1.0f; + data->light.param.fval.value = 100.0f; - data->params = plugin_parameters ("Bright Flash", 7); - data->params.params[0] = &data->light; - data->params.params[1] = &data->factor_adj_p; - data->params.params[2] = 0; - data->params.params[3] = &data->factor_p; - data->params.params[4] = 0; - data->params.params[5] = &data->script_p; - data->params.params[6] = &data->compile_p; + data->factor_adj_p = secure_f_param("Flash Intensity"); + data->factor_adj_p.param.fval.max = 200.0f; + data->factor_adj_p.param.fval.step = 1.0f; + data->factor_adj_p.param.fval.value = 70.0f; - data->script = gsl_new(); + data->factor_p = secure_f_feedback("Factor"); - _this->params = &data->params; - _this->fx_data = (void*)data; + data->params = plugin_parameters ("Bright Flash", 5); + data->params.params[0] = &data->light; + data->params.params[1] = &data->factor_adj_p; + data->params.params[2] = 0; + data->params.params[3] = &data->factor_p; + data->params.params[4] = 0; + + /* init rotozoom tables */ + compute_tables(_this, info); + data->theta = 0; + data->ftheta = 0.0; + data->visibility = 1.0; + set_motif(data, CONV_MOTIF2); + data->inverse_motif = 0; + + _this->params = &data->params; } static void convolve_free(VisualFX *_this) { - free (_this->fx_data); + free (_this->fx_data); } -void create_output_with_brightness(Pixel *src, Pixel *dest, int screensize, int iff) { - - int i; - - if (iff-256 == 0) { - memcpy(dest,src,screensize*sizeof(Pixel)); - return; - } - for (i=screensize-1;i--;) { - unsigned int f,h,m,n; - - f = (src[i].cop[0] * iff) >> 8; - h = (src[i].cop[1] * iff) >> 8; - m = (src[i].cop[2] * iff) >> 8; - n = (src[i].cop[3] * iff) >> 8; - - dest[i].cop[0] = (f & 0xffffff00) ? 0xff : (unsigned char)f; - dest[i].cop[1] = (h & 0xffffff00) ? 0xff : (unsigned char)h; - dest[i].cop[2] = (m & 0xffffff00) ? 0xff : (unsigned char)m; - dest[i].cop[3] = (n & 0xffffff00) ? 0xff : (unsigned char)n; - } +static void create_output_with_brightness(VisualFX *_this, Pixel *src, Pixel *dest, + PluginInfo *info, int iff) +{ + ConvData *data = (ConvData*)_this->fx_data; + + int x,y; + int i = 0;//info->screen.height * info->screen.width - 1; + + const int c = data->h_cos [data->theta]; + const int s = data->h_sin [data->theta]; + + const int xi = -(info->screen.width/2) * c; + const int yi = (info->screen.width/2) * s; + + const int xj = -(info->screen.height/2) * s; + const int yj = -(info->screen.height/2) * c; + + int xprime = xj; + int yprime = yj; + + int ifftab[16]; + if (data->inverse_motif) { + int i; + for (i=0;i<16;++i) + ifftab[i] = (double)iff * (1.0 + data->visibility * (15.0 - i) / 15.0); + } + else { + int i; + for (i=0;i<16;++i) + ifftab[i] = (double)iff / (1.0 + data->visibility * (15.0 - i) / 15.0); + } + + for (y=info->screen.height;y--;) { + int xtex,ytex; + + xtex = xprime + xi + CONV_MOTIF_W * 0x10000 / 2; + xprime += s; + + ytex = yprime + yi + CONV_MOTIF_W * 0x10000 / 2; + yprime += c; + +#ifdef HAVE_MMX + __asm__ __volatile__ + ("\n\t pxor %%mm7, %%mm7" /* mm7 = 0 */ + "\n\t movd %[xtex], %%mm2" + "\n\t movd %[ytex], %%mm3" + "\n\t punpckldq %%mm3, %%mm2" /* mm2 = [ ytex | xtex ] */ + "\n\t movd %[c], %%mm4" + "\n\t movd %[s], %%mm6" + "\n\t pxor %%mm5, %%mm5" + "\n\t psubd %%mm6, %%mm5" + "\n\t punpckldq %%mm5, %%mm4" /* mm4 = [ -s | c ] */ + "\n\t movd %[motif], %%mm6" /* mm6 = motif */ + + ::[xtex]"g"(xtex) ,[ytex]"g"(ytex) + , [c]"g"(c), [s]"g"(s) + , [motif] "g"(&data->conv_motif[0][0])); + + for (x=info->screen.width;x--;) + { + __asm__ __volatile__ + ( + "\n\t movd %[src], %%mm0" /* mm0 = src */ + "\n\t paddd %%mm4, %%mm2" /* [ ytex | xtex ] += [ -s | s ] */ + "\n\t movd %%esi, %%mm5" /* save esi into mm5 */ + "\n\t movq %%mm2, %%mm3" + "\n\t psrld $16, %%mm3" /* mm3 = [ (ytex>>16) | (xtex>>16) ] */ + "\n\t movd %%mm3, %%eax" /* eax = xtex' */ + + "\n\t psrlq $25, %%mm3" + "\n\t movd %%mm3, %%ecx" /* ecx = ytex' << 7 */ + + "\n\t andl $127, %%eax" + "\n\t andl $16256, %%ecx" + + "\n\t addl %%ecx, %%eax" + "\n\t movd %%mm6, %%esi" /* esi = motif */ + "\n\t xorl %%ecx, %%ecx" + "\n\t movb (%%eax,%%esi), %%cl" + + "\n\t movl %[ifftab], %%eax" + "\n\t movd %%mm5, %%esi" /* restore esi from mm5 */ + "\n\t movd (%%eax,%%ecx,4), %%mm1" /* mm1 = [0|0|0|iff2] */ + + "\n\t punpcklwd %%mm1, %%mm1" + "\n\t punpcklbw %%mm7, %%mm0" + "\n\t punpckldq %%mm1, %%mm1" + "\n\t psrlw $1, %%mm0" + "\n\t psrlw $2, %%mm1" + "\n\t pmullw %%mm1, %%mm0" + "\n\t psrlw $5, %%mm0" + "\n\t packuswb %%mm7, %%mm0" + "\n\t movd %%mm0, %[dest]" + : [dest] "=g" (dest[i].val) + : [src] "g" (src[i].val) + , [ifftab]"g"(&ifftab[0]) + : "eax","ecx"); + + i++; + } +#else + for (x=info->screen.width;x--;) { + + int iff2; + unsigned int f0,f1,f2,f3; + + xtex += c; + ytex -= s; + + iff2 = ifftab[data->conv_motif[(ytex >>16) & CONV_MOTIF_WMASK][(xtex >> 16) & CONV_MOTIF_WMASK]]; + +#define sat(a) ((a)>0xFF?0xFF:(a)) + f0 = src[i].val; + f1 = ((f0 >> R_OFFSET) & 0xFF) * iff2 >> 8; + f2 = ((f0 >> G_OFFSET) & 0xFF) * iff2 >> 8; + f3 = ((f0 >> B_OFFSET) & 0xFF) * iff2 >> 8; + dest[i].val = (sat(f1) << R_OFFSET) | (sat(f2) << G_OFFSET) | (sat(f3) << B_OFFSET); +/* + f0 = (src[i].cop[0] * iff2) >> 8; + f1 = (src[i].cop[1] * iff2) >> 8; + f2 = (src[i].cop[2] * iff2) >> 8; + f3 = (src[i].cop[3] * iff2) >> 8; + + dest[i].cop[0] = (f0 & 0xffffff00) ? 0xff : (unsigned char)f0; + dest[i].cop[1] = (f1 & 0xffffff00) ? 0xff : (unsigned char)f1; + dest[i].cop[2] = (f2 & 0xffffff00) ? 0xff : (unsigned char)f2; + dest[i].cop[3] = (f3 & 0xffffff00) ? 0xff : (unsigned char)f3; +*/ + i++; + } +#endif + } +#ifdef HAVE_MMX + __asm__ __volatile__ ("\n\t emms"); +#endif + + compute_tables(_this, info); } + +/*#include <stdint.h> + +static uint64_t GetTick() +{ + uint64_t x; + asm volatile ("RDTSC" : "=A" (x)); + return x; +}*/ + + static void convolve_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo *info) { - ConvData *data = (ConvData*)_this->fx_data; - float ff; - int iff; + ConvData *data = (ConvData*)_this->fx_data; + float ff; + int iff; + + ff = (FVAL(data->factor_p) * FVAL(data->factor_adj_p) + FVAL(data->light) ) / 100.0f; + iff = (unsigned int)(ff * 256); - ff = (FVAL(data->factor_p) * FVAL(data->factor_adj_p) + FVAL(data->light) ) / 100.0f; - iff = (unsigned int)(ff * 256); + { + double fcycle = (double)info->cycle; + double rotate_param, rotate_coef; + float INCREASE_RATE = 1.5; + float DECAY_RATE = 0.955; + if (FVAL(info->sound.last_goom_p) > 0.8) + FVAL(data->factor_p) += FVAL(info->sound.goom_power_p) * INCREASE_RATE; + FVAL(data->factor_p) *= DECAY_RATE; - if (!gsl_is_compiled(data->script)) { -#ifdef VERBOSE - printf("setting default script for dynamic brightness\n"); -#endif - gsl_compile(data->script, DEF_SCRIPT); - } + rotate_param = FVAL(info->sound.last_goom_p); + if (rotate_param < 0.0) + rotate_param = 0.0; + rotate_param += FVAL(info->sound.goom_power_p); - if (BVAL(data->compile_p)) { /* le bouton du pauvre ... */ - gsl_compile(data->script, SVAL(data->script_p)); - BVAL(data->compile_p) = 0; - data->compile_p.change_listener(&data->compile_p); - } + rotate_coef = 4.0 + FVAL(info->sound.goom_power_p) * 6.0; + data->ftheta = (data->ftheta + rotate_coef * sin(rotate_param * 6.3)); + data->theta = ((unsigned int)data->ftheta) % NB_THETA; + data->visibility = (cos(fcycle * 0.001 + 1.5) * sin(fcycle * 0.008) + cos(fcycle * 0.011 + 5.0) - 0.8 + info->sound.speedvar) * 1.5; + if (data->visibility < 0.0) data->visibility = 0.0; + data->factor_p.change_listener(&data->factor_p); + } - if (gsl_is_compiled(data->script)) { - gsl_execute(data->script); + if (data->visibility < 0.01) { + switch (goom_irand(info->gRandom, 300)) + { + case 1: + set_motif(data, CONV_MOTIF1); data->inverse_motif = 1; break; + case 2: + set_motif(data, CONV_MOTIF2); data->inverse_motif = 0; break; } + } - info->methods.create_output_with_brightness(src,dest,info->screen.size,iff); + if ((ff > 0.98f) && (ff < 1.02f)) + memcpy(dest, src, info->screen.size * sizeof(Pixel)); + else + create_output_with_brightness(_this,src,dest,info,iff); +/* +// Benching suite... + { + uint64_t before, after; + double timed; + static double stimed = 10000.0; + before = GetTick(); + data->visibility = 1.0; + create_output_with_brightness(_this,src,dest,info,iff); + after = GetTick(); + timed = (double)((after-before) / info->screen.size); + if (timed < stimed) { + stimed = timed; + printf ("CLK = %3.0f CPP\n", stimed); + } + } +*/ } VisualFX convolve_create(void) { - VisualFX vfx = { - init: convolve_init, - free: convolve_free, - apply: convolve_apply, - fx_data: 0 - }; - return vfx; + VisualFX vfx = { + init: convolve_init, + free: convolve_free, + apply: convolve_apply, + fx_data: 0 + }; + return vfx; } diff --git a/src/post/goom/diff_against_release.patch b/src/post/goom/diff_against_release.patch index c01455e41..720e1af94 100644 --- a/src/post/goom/diff_against_release.patch +++ b/src/post/goom/diff_against_release.patch @@ -1,5 +1,43 @@ ---- goom_tools.c 2004-09-10 17:10:39.000000000 +0200 -+++ goom_tools.c 2004-11-21 15:28:12.000000000 +0100 +diff -ru goom2k4-0/src/filters.c xine-lib/src/post/goom/filters.c +--- goom2k4-0/src/filters.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/filters.c 2005-07-18 12:15:50.000000000 -0300 +@@ -704,7 +704,7 @@ + + data->general_speed = 0.0f; + data->reverse = 0; +- data->theMode = AMULETTE_MODE; ++ data->theMode = rand() % 10; + data->waveEffect = 0; + data->hypercosEffect = 0; + data->vPlaneEffect = 0; +diff -ru goom2k4-0/src/goom_core.c xine-lib/src/post/goom/goom_core.c +--- goom2k4-0/src/goom_core.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/goom_core.c 2005-07-19 12:39:22.000000000 -0300 +@@ -26,6 +26,8 @@ + #include "goom_fx.h" + #include "goomsl.h" + ++#include "xine_internal.h" ++ + /* #define VERBOSE */ + + #define STOP_SPEED 128 +@@ -736,7 +738,12 @@ + /* affichage et swappage des buffers.. */ + goomInfo->cycle++; + ++ /* xine: no convolve_fx */ ++ /* + goomInfo->convolve_fx.apply(&goomInfo->convolve_fx,return_val,goomInfo->outputBuf,goomInfo); ++ */ ++ xine_fast_memcpy(goomInfo->outputBuf, return_val, goomInfo->screen.size * sizeof(Pixel)); ++ + + return (guint32*)goomInfo->outputBuf; + } +diff -ru goom2k4-0/src/goom_tools.c xine-lib/src/post/goom/goom_tools.c +--- goom2k4-0/src/goom_tools.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/goom_tools.c 2005-07-18 14:30:02.000000000 -0300 @@ -3,7 +3,6 @@ GoomRandom *goom_random_init(int i) { @@ -8,54 +46,52 @@ grandom->pos = 1; goom_random_update_array(grandom, GOOM_NB_RAND); return grandom; ---- convolve_fx.c 2004-09-10 17:10:38.000000000 +0200 -+++ convolve_fx.c 2004-11-21 15:48:24.729326912 +0100 -@@ -52,9 +52,9 @@ - data->light.param.fval.value = 100.0f; +diff -ru goom2k4-0/src/ifs.c xine-lib/src/post/goom/ifs.c +--- goom2k4-0/src/ifs.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/ifs.c 2005-07-19 14:20:20.000000000 -0300 +@@ -503,6 +503,13 @@ + + for (i = 0; i < 4; i++) { + *tmp = (*tmp) >> cycle10; ++ ++ /* xine: make it darker */ ++ if( *tmp && !((*tmp) >> 1) ) ++ *tmp = 1; ++ else ++ *tmp = (*tmp) >> 1; ++ + tmp++; + } + } +diff -ru goom2k4-0/src/tentacle3d.c xine-lib/src/post/goom/tentacle3d.c +--- goom2k4-0/src/tentacle3d.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/tentacle3d.c 2005-07-19 14:04:57.000000000 -0300 +@@ -10,7 +10,7 @@ + #define D 256.0f - data->factor_adj_p = secure_f_param("Flash Intensity"); -- data->factor_adj_p.param.fval.max = 200.0f; -+ data->factor_adj_p.param.fval.max = 100.0f; - data->factor_adj_p.param.fval.step = 1.0f; -- data->factor_adj_p.param.fval.value = 100.0f; -+ data->factor_adj_p.param.fval.value = 50.0f; + #define nbgrid 6 +-#define definitionx 15 ++#define definitionx 9 + #define definitionz 45 - data->factor_p = secure_f_feedback("Factor"); - /* FVAL(data->factor_p) = data->factor / MAX;*/ ---- filters.c 2004-09-10 17:10:39.000000000 +0200 -+++ filters.c 2004-11-21 15:37:55.000000000 +0100 -@@ -705,7 +705,7 @@ - - data->general_speed = 0.0f; - data->reverse = 0; -- data->theMode = AMULETTE_MODE; -+ data->theMode = rand() % 10; - data->waveEffect = 0; - data->hypercosEffect = 0; - data->vPlaneEffect = 0; ---- goomsl_lex.c 2004-09-10 17:10:39.000000000 +0200 -+++ goomsl_lex.c 2004-11-21 15:42:50.306166960 +0100 -@@ -624,6 +624,7 @@ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION + typedef struct _TENTACLE_FX_DATA { +diff -ru goom2k4-0/src/xmmx.c xine-lib/src/post/goom/xmmx.c +--- goom2k4-0/src/xmmx.c 2005-02-07 11:46:41.000000000 -0200 ++++ xine-lib/src/post/goom/xmmx.c 2005-07-18 15:26:23.000000000 -0300 +@@ -239,7 +239,11 @@ -+YY_DECL; - YY_DECL - { - register yy_state_type yy_current_state; -diff -u -3 -p -r1.4 -r1.5 ---- xmmx.c 2 May 2005 21:13:43 -0000 1.4 -+++ xmmx.c 28 May 2005 12:20:37 -0000 1.5 -@@ -242,7 +242,7 @@ void zoom_filter_xmmx (int prevX, int pr ++loop; } - /*#ifdef HAVE_ATHLON*/ - __asm__ __volatile__ ("femms\n"); ++/*#ifdef HAVE_ATHLON*/ + __asm__ __volatile__ ("emms\n"); - /*#else - emms(); - #endif*/ -@@ -393,7 +393,7 @@ void draw_line_xmmx (Pixel *data, int x1 ++/*#else ++ emms(); ++#endif*/ + } + + #define DRAWMETHOD_PLUS_XMMX(_out,_backbuf,_col) \ +@@ -387,7 +391,7 @@ } } end_of_line: diff --git a/src/post/goom/filters.c b/src/post/goom/filters.c index 47f2637ad..86bfdbde7 100644 --- a/src/post/goom/filters.c +++ b/src/post/goom/filters.c @@ -684,7 +684,7 @@ static void generatePrecalCoef (int precalCoef[16][16]) /* VisualFX Wrapper */ -static void zoomFilterVisualFXWrapper_init (struct _VISUAL_FX *_this) +static void zoomFilterVisualFXWrapper_init (struct _VISUAL_FX *_this, PluginInfo *info) { ZoomFilterFXWrapperData *data = (ZoomFilterFXWrapperData*)malloc(sizeof(ZoomFilterFXWrapperData)); diff --git a/src/post/goom/flying_stars_fx.c b/src/post/goom/flying_stars_fx.c index ff1d5b9b6..0f1e0e73a 100644 --- a/src/post/goom/flying_stars_fx.c +++ b/src/post/goom/flying_stars_fx.c @@ -4,8 +4,28 @@ #include "mathtools.h" -/* TODO:-- FAIRE PROPREMENT */ +/* TODO:-- FAIRE PROPREMENT... BOAH... */ #define NCOL 15 + +/*static const int colval[] = { +0xfdf6f5, +0xfae4e4, +0xf7d1d1, +0xf3b6b5, +0xefa2a2, +0xec9190, +0xea8282, +0xe87575, +0xe46060, +0xe14b4c, +0xde3b3b, +0xdc2d2f, +0xd92726, +0xd81619, +0xd50c09, +0 +}; +*/ static const int colval[] = { 0x1416181a, 0x1419181a, @@ -24,6 +44,7 @@ static const int colval[] = { 0x0 }; + /* The different modes of the visual FX. * Put this values on fx_mode */ #define FIREWORKS_FX 0 @@ -58,7 +79,7 @@ typedef struct _FS_DATA{ PluginParameters params; } FSData; -static void fs_init(VisualFX *_this) { +static void fs_init(VisualFX *_this, PluginInfo *info) { FSData *data; data = (FSData*)malloc(sizeof(FSData)); @@ -167,16 +188,29 @@ static void fs_sound_event_occured(VisualFX *_this, PluginInfo *info) { int max = (int)((1.0f+info->sound.goomPower)*goom_irand(info->gRandom,150)) + 100; float radius = (1.0f+info->sound.goomPower) * (float)(goom_irand(info->gRandom,150)+50)/300; - int mx = goom_irand(info->gRandom,info->screen.width); + int mx; int my; float vage, gravity = 0.02f; switch (data->fx_mode) { case FIREWORKS_FX: - my = goom_irand(info->gRandom,info->screen.height); + { + double dx,dy; + do { + mx = goom_irand(info->gRandom,info->screen.width); + my = goom_irand(info->gRandom,info->screen.height); + dx = (mx - info->screen.width/2); + dy = (my - info->screen.height/2); + } while (dx*dx + dy*dy < (info->screen.height/2)*(info->screen.height/2)); vage = data->max_age * (1.0f - info->sound.goomPower); + } break; case RAIN_FX: + mx = goom_irand(info->gRandom,info->screen.width); + if (mx > info->screen.width/2) + mx = info->screen.width; + else + mx = 0; my = -(info->screen.height/3)-goom_irand(info->gRandom,info->screen.width/3); radius *= 1.5; vage = 0.002f; diff --git a/src/post/goom/goom.h b/src/post/goom/goom.h index 35e4e751e..b0ddab17e 100644 --- a/src/post/goom/goom.h +++ b/src/post/goom/goom.h @@ -22,6 +22,9 @@ void goom_set_resolution (PluginInfo *goomInfo, guint32 resx, guint32 resy); guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512], int forceMode, float fps, char *songTitle, char *message); +/* returns 0 if the buffer wasn't accepted */ +int goom_set_screenbuffer(PluginInfo *goomInfo, void *buffer); + void goom_close (PluginInfo *goomInfo); #endif diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c index 10fe968a6..80abb5299 100644 --- a/src/post/goom/goom_core.c +++ b/src/post/goom/goom_core.c @@ -26,6 +26,8 @@ #include "goom_fx.h" #include "goomsl.h" +#include "xine_internal.h" + /* #define VERBOSE */ #define STOP_SPEED 128 @@ -45,6 +47,8 @@ static void init_buffers(PluginInfo *goomInfo, int buffsize) bzero (goomInfo->back, buffsize * sizeof (guint32) + 128); goomInfo->conv = (Pixel *) malloc (buffsize * sizeof (guint32) + 128); bzero (goomInfo->conv, buffsize * sizeof (guint32) + 128); + + goomInfo->outputBuf = goomInfo->conv; goomInfo->p1 = (Pixel *) ((1 + ((uintptr_t) (goomInfo->pixel)) / 128) * 128); goomInfo->p2 = (Pixel *) ((1 + ((uintptr_t) (goomInfo->back)) / 128) * 128); @@ -64,16 +68,16 @@ PluginInfo *goom_init (guint32 resx, guint32 resy) plugin_info_init(goomInfo,4); goomInfo->star_fx = flying_star_create(); - goomInfo->star_fx.init(&goomInfo->star_fx); + goomInfo->star_fx.init(&goomInfo->star_fx, goomInfo); goomInfo->zoomFilter_fx = zoomFilterVisualFXWrapper_create (); - goomInfo->zoomFilter_fx.init(&goomInfo->zoomFilter_fx); + goomInfo->zoomFilter_fx.init(&goomInfo->zoomFilter_fx, goomInfo); goomInfo->tentacles_fx = tentacle_fx_create(); - goomInfo->tentacles_fx.init(&goomInfo->tentacles_fx); + goomInfo->tentacles_fx.init(&goomInfo->tentacles_fx, goomInfo); goomInfo->convolve_fx = convolve_create(); - goomInfo->convolve_fx.init(&goomInfo->convolve_fx); + goomInfo->convolve_fx.init(&goomInfo->convolve_fx, goomInfo); plugin_info_add_visual (goomInfo, 0, &goomInfo->zoomFilter_fx); plugin_info_add_visual (goomInfo, 1, &goomInfo->tentacles_fx); @@ -90,7 +94,7 @@ PluginInfo *goom_init (guint32 resx, guint32 resy) goomInfo->cycle = 0; goomInfo->ifs_fx = ifs_visualfx_create(); - goomInfo->ifs_fx.init(&goomInfo->ifs_fx); + goomInfo->ifs_fx.init(&goomInfo->ifs_fx, goomInfo); goomInfo->gmline1 = goom_lines_init (goomInfo, resx, goomInfo->screen.height, GML_HLINE, goomInfo->screen.height, GML_BLACK, @@ -107,6 +111,7 @@ PluginInfo *goom_init (guint32 resx, guint32 resy) } + void goom_set_resolution (PluginInfo *goomInfo, guint32 resx, guint32 resy) { free (goomInfo->pixel); @@ -121,12 +126,18 @@ void goom_set_resolution (PluginInfo *goomInfo, guint32 resx, guint32 resy) /* init_ifs (goomInfo, resx, goomInfo->screen.height); */ goomInfo->ifs_fx.free(&goomInfo->ifs_fx); - goomInfo->ifs_fx.init(&goomInfo->ifs_fx); + goomInfo->ifs_fx.init(&goomInfo->ifs_fx, goomInfo); goom_lines_set_res (goomInfo->gmline1, resx, goomInfo->screen.height); goom_lines_set_res (goomInfo->gmline2, resx, goomInfo->screen.height); } +int goom_set_screenbuffer(PluginInfo *goomInfo, void *buffer) +{ + goomInfo->outputBuf = (Pixel*)buffer; + return 1; +} + /******************************************** * UPDATE * ******************************************** @@ -230,7 +241,7 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512], /* changement eventuel de mode */ if (goom_irand(goomInfo->gRandom,16) == 0) - switch (goom_irand(goomInfo->gRandom,32)) { + switch (goom_irand(goomInfo->gRandom,34)) { case 0: case 10: goomInfo->update.zoomFilterData.hypercosEffect = goom_irand(goomInfo->gRandom,2); @@ -298,6 +309,7 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512], break; case 31: case 32: + case 33: goomInfo->update.zoomFilterData.mode = SPEEDWAY_MODE; break; default: @@ -588,14 +600,10 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512], /* * Affichage tentacule */ - - /* if (goomInfo.sound.goomlimit > 0.0001f) */ + goomInfo->tentacles_fx.apply(&goomInfo->tentacles_fx, goomInfo->p1, goomInfo->p2, goomInfo); - /* tentacle_update(goomInfo, goomInfo->p2, goomInfo->p1, goomInfo->screen.width, goomInfo->screen.height, - data, (float)goomInfo->sound.accelvar, goomInfo->curGState->drawTentacle); */ - goomInfo->star_fx.apply (&goomInfo->star_fx,goomInfo->p2,goomInfo->p1,goomInfo); - + /* * Affichage de texte */ @@ -730,9 +738,14 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512], /* affichage et swappage des buffers.. */ goomInfo->cycle++; - goomInfo->convolve_fx.apply(&goomInfo->convolve_fx,return_val,goomInfo->conv,goomInfo); + /* xine: no convolve_fx */ + /* + goomInfo->convolve_fx.apply(&goomInfo->convolve_fx,return_val,goomInfo->outputBuf,goomInfo); + */ + xine_fast_memcpy(goomInfo->outputBuf, return_val, goomInfo->screen.size * sizeof(Pixel)); + - return (guint32*)goomInfo->conv; + return (guint32*)goomInfo->outputBuf; } /**************************************** diff --git a/src/post/goom/goom_fx.h b/src/post/goom/goom_fx.h index fec5e2b40..e672ece3d 100644 --- a/src/post/goom/goom_fx.h +++ b/src/post/goom/goom_fx.h @@ -4,10 +4,9 @@ #include "goom_visual_fx.h" #include "goom_plugin_info.h" -VisualFX convolve_create (void); +VisualFX convolve_create (); VisualFX flying_star_create (void); void zoom_filter_c(int sizeX, int sizeY, Pixel *src, Pixel *dest, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]); -void create_output_with_brightness(Pixel *src, Pixel *dest, int screensize, int iff); #endif diff --git a/src/post/goom/goom_graphic.h b/src/post/goom/goom_graphic.h index 1d78f1d4e..9deaf5a91 100644 --- a/src/post/goom/goom_graphic.h +++ b/src/post/goom/goom_graphic.h @@ -25,6 +25,10 @@ extern const Color VIOLET; #define G_CHANNEL 0x00FF0000 #define R_CHANNEL 0x0000FF00 #define A_CHANNEL 0x000000FF +#define B_OFFSET 24 +#define G_OFFSET 16 +#define R_OFFSET 8 +#define A_OFFSET 0 typedef union _PIXEL { struct { @@ -43,6 +47,10 @@ typedef union _PIXEL { #define R_CHANNEL 0x00FF0000 #define G_CHANNEL 0x0000FF00 #define B_CHANNEL 0x000000FF +#define A_OFFSET 24 +#define R_OFFSET 16 +#define G_OFFSET 8 +#define B_OFFSET 0 typedef union _PIXEL { struct { diff --git a/src/post/goom/goom_plugin_info.h b/src/post/goom/goom_plugin_info.h index b587c0c65..8d5d098ba 100644 --- a/src/post/goom/goom_plugin_info.h +++ b/src/post/goom/goom_plugin_info.h @@ -104,6 +104,7 @@ struct _PLUGIN_INFO { guint32 *back; Pixel *p1, *p2; Pixel *conv; + Pixel *outputBuf; /** state of goom */ guint32 cycle; @@ -158,7 +159,6 @@ struct _PLUGIN_INFO { struct { void (*draw_line) (Pixel *data, int x1, int y1, int x2, int y2, int col, int screenx, int screeny); void (*zoom_filter) (int sizeX, int sizeY, Pixel *src, Pixel *dest, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]); - void (*create_output_with_brightness) (Pixel *src, Pixel *dest, int screensize, int iff); } methods; GoomRandom *gRandom; diff --git a/src/post/goom/goom_tools.c b/src/post/goom/goom_tools.c index ec7ec1934..6753da544 100644 --- a/src/post/goom/goom_tools.c +++ b/src/post/goom/goom_tools.c @@ -14,7 +14,11 @@ void goom_random_free(GoomRandom *grandom) { void goom_random_update_array(GoomRandom *grandom, int numberOfValuesToChange) { while (numberOfValuesToChange > 0) { +#if RAND_MAX < 0x10000 + grandom->array[grandom->pos++] = ((rand()<<16)+rand()) / 127; +#else grandom->array[grandom->pos++] = rand() / 127; +#endif numberOfValuesToChange--; } } diff --git a/src/post/goom/goom_visual_fx.h b/src/post/goom/goom_visual_fx.h index bb5c8f164..6939ac804 100644 --- a/src/post/goom/goom_visual_fx.h +++ b/src/post/goom/goom_visual_fx.h @@ -15,7 +15,7 @@ #include "goom_typedefs.h" struct _VISUAL_FX { - void (*init) (struct _VISUAL_FX *_this); + void (*init) (struct _VISUAL_FX *_this, PluginInfo *info); void (*free) (struct _VISUAL_FX *_this); void (*apply) (struct _VISUAL_FX *_this, Pixel *src, Pixel *dest, PluginInfo *info); void *fx_data; diff --git a/src/post/goom/goomsl.c b/src/post/goom/goomsl.c index c136b657d..e978506d3 100644 --- a/src/post/goom/goomsl.c +++ b/src/post/goom/goomsl.c @@ -6,7 +6,7 @@ #include "goomsl_private.h" #include "goomsl_yacc.h" -/* #define TRACE_SCRIPT */ +/*#define TRACE_SCRIPT*/ /* {{{ definition of the instructions number */ #define INSTR_SETI_VAR_INTEGER 1 @@ -49,6 +49,13 @@ /* #define INSTR_EXT_CALL 38 */ #define INSTR_NOT_VAR 39 /* #define INSTR_JNZERO 40 */ +#define INSTR_SETS_VAR_VAR 41 +#define INSTR_ISEQUALS_VAR_VAR 42 +#define INSTR_ADDS_VAR_VAR 43 +#define INSTR_SUBS_VAR_VAR 44 +#define INSTR_MULS_VAR_VAR 45 +#define INSTR_DIVS_VAR_VAR 46 + /* }}} */ /* {{{ definition of the validation error types */ static const char *VALIDATE_OK = "ok"; @@ -201,58 +208,67 @@ void gsl_instr_display(Instruction *_this) static const char *validate_v_v(Instruction *_this) { /* {{{ */ - _this->data.v_v.var_dest = goom_hash_get(_this->vnamespace[1], _this->params[1]); - _this->data.v_v.var_src = goom_hash_get(_this->vnamespace[0], _this->params[0]); + HashValue *dest = goom_hash_get(_this->vnamespace[1], _this->params[1]); + HashValue *src = goom_hash_get(_this->vnamespace[0], _this->params[0]); - if (_this->data.v_v.var_dest == NULL) { + if (dest == NULL) { return VALIDATE_NO_SUCH_DEST_VAR; } - if (_this->data.v_v.var_src == NULL) { + if (src == NULL) { return VALIDATE_NO_SUCH_SRC_VAR; } + _this->data.udest.var = dest->ptr; + _this->data.usrc.var = src->ptr; return VALIDATE_OK; } /* }}} */ static const char *validate_v_i(Instruction *_this) { /* {{{ */ - _this->data.v_i.var = goom_hash_get(_this->vnamespace[1], _this->params[1]); - _this->data.v_i.value = strtol(_this->params[0],NULL,0); + HashValue *dest = goom_hash_get(_this->vnamespace[1], _this->params[1]); + _this->data.usrc.value_int = strtol(_this->params[0],NULL,0); - if (_this->data.v_i.var == NULL) { + if (dest == NULL) { return VALIDATE_NO_SUCH_INT; } + _this->data.udest.var = dest->ptr; return VALIDATE_OK; } /* }}} */ static const char *validate_v_p(Instruction *_this) { /* {{{ */ - _this->data.v_p.var = goom_hash_get(_this->vnamespace[1], _this->params[1]); - _this->data.v_p.value = strtol(_this->params[0],NULL,0); + HashValue *dest = goom_hash_get(_this->vnamespace[1], _this->params[1]); + _this->data.usrc.value_ptr = strtol(_this->params[0],NULL,0); - if (_this->data.v_p.var == NULL) { + if (dest == NULL) { return VALIDATE_NO_SUCH_INT; } + _this->data.udest.var = dest->ptr; return VALIDATE_OK; } /* }}} */ static const char *validate_v_f(Instruction *_this) { /* {{{ */ - _this->data.v_f.var = goom_hash_get(_this->vnamespace[1], _this->params[1]); - _this->data.v_f.value = atof(_this->params[0]); + HashValue *dest = goom_hash_get(_this->vnamespace[1], _this->params[1]); + _this->data.usrc.value_float = atof(_this->params[0]); - if (_this->data.v_f.var == NULL) { + if (dest == NULL) { return VALIDATE_NO_SUCH_VAR; } + _this->data.udest.var = dest->ptr; return VALIDATE_OK; } /* }}} */ -static const char *validate(Instruction *_this, int vf_f_id, int vf_v_id, int vi_i_id, int vi_v_id, int vp_p_id, int vp_v_id) +static const char *validate(Instruction *_this, + int vf_f_id, int vf_v_id, + int vi_i_id, int vi_v_id, + int vp_p_id, int vp_v_id, + int vs_v_id) { /* {{{ */ if ((_this->types[1] == TYPE_FVAR) && (_this->types[0] == TYPE_FLOAT)) { _this->id = vf_f_id; return validate_v_f(_this); } - else if ((_this->types[1] == TYPE_FVAR) && (_this->types[0] == TYPE_VAR)) { + else if ((_this->types[1] == TYPE_FVAR) && (_this->types[0] == TYPE_FVAR)) { _this->id = vf_v_id; return validate_v_v(_this); } @@ -260,7 +276,7 @@ static const char *validate(Instruction *_this, int vf_f_id, int vf_v_id, int vi _this->id = vi_i_id; return validate_v_i(_this); } - else if ((_this->types[1] == TYPE_IVAR) && (_this->types[0] == TYPE_VAR)) { + else if ((_this->types[1] == TYPE_IVAR) && (_this->types[0] == TYPE_IVAR)) { _this->id = vi_v_id; return validate_v_v(_this); } @@ -269,30 +285,40 @@ static const char *validate(Instruction *_this, int vf_f_id, int vf_v_id, int vi _this->id = vp_p_id; return validate_v_p(_this); } - else if ((_this->types[1] == TYPE_PVAR) && (_this->types[0] == TYPE_VAR)) { + else if ((_this->types[1] == TYPE_PVAR) && (_this->types[0] == TYPE_PVAR)) { _this->id = vp_v_id; if (vp_v_id == INSTR_NOP) return VALIDATE_ERROR; return validate_v_v(_this); } + else if ((_this->types[1] < FIRST_RESERVED) && (_this->types[1] >= 0) && (_this->types[0] == _this->types[1])) { + _this->id = vs_v_id; + if (vs_v_id == INSTR_NOP) return "Impossible operation to perform between two structs"; + return validate_v_v(_this); + } return VALIDATE_ERROR; } /* }}} */ const char *gsl_instr_validate(Instruction *_this) { /* {{{ */ if (_this->id != INSTR_EXT_CALL) { - int i; - for (i=_this->nb_param-1;i>=0;--i) + int i = _this->nb_param; + while (i>0) + { + i--; if (_this->types[i] == TYPE_VAR) { - HashValue *val = goom_hash_get(_this->vnamespace[i], _this->params[i]); - if (val && val->i == INSTR_INT) + int type = gsl_type_of_var(_this->vnamespace[i], _this->params[i]); + + if (type == INSTR_INT) _this->types[i] = TYPE_IVAR; - else if (val && val->i == INSTR_FLOAT) + else if (type == INSTR_FLOAT) _this->types[i] = TYPE_FVAR; - else if (val && val->i == INSTR_PTR) + else if (type == INSTR_PTR) _this->types[i] = TYPE_PVAR; + else if ((type >= 0) && (type < FIRST_RESERVED)) + _this->types[i] = type; else fprintf(stderr,"WARNING: Line %d, %s has no namespace\n", _this->line_number, _this->params[i]); - break; } + } } switch (_this->id) { @@ -302,14 +328,15 @@ const char *gsl_instr_validate(Instruction *_this) return validate(_this, INSTR_SETF_VAR_FLOAT, INSTR_SETF_VAR_VAR, INSTR_SETI_VAR_INTEGER, INSTR_SETI_VAR_VAR, - INSTR_SETP_VAR_PTR, INSTR_SETP_VAR_VAR); + INSTR_SETP_VAR_PTR, INSTR_SETP_VAR_VAR, + INSTR_SETS_VAR_VAR); /* extcall */ case INSTR_EXT_CALL: if (_this->types[0] == TYPE_VAR) { HashValue *fval = goom_hash_get(_this->parent->functions, _this->params[0]); if (fval) { - _this->data.external_function = (struct _ExternalFunctionStruct*)fval->ptr; + _this->data.udest.external_function = (struct _ExternalFunctionStruct*)fval->ptr; return VALIDATE_OK; } } @@ -362,7 +389,8 @@ const char *gsl_instr_validate(Instruction *_this) return validate(_this, INSTR_ISEQUALF_VAR_FLOAT, INSTR_ISEQUALF_VAR_VAR, INSTR_ISEQUALI_VAR_INTEGER, INSTR_ISEQUALI_VAR_VAR, - INSTR_ISEQUALP_VAR_PTR, INSTR_ISEQUALP_VAR_VAR); + INSTR_ISEQUALP_VAR_PTR, INSTR_ISEQUALP_VAR_VAR, + INSTR_ISEQUALS_VAR_VAR); /* not */ case INSTR_NOT: @@ -374,35 +402,39 @@ const char *gsl_instr_validate(Instruction *_this) return validate(_this, INSTR_ISLOWERF_VAR_FLOAT, INSTR_ISLOWERF_VAR_VAR, INSTR_ISLOWERI_VAR_INTEGER, INSTR_ISLOWERI_VAR_VAR, - INSTR_NOP, INSTR_NOP); + INSTR_NOP, INSTR_NOP, INSTR_NOP); /* add */ case INSTR_ADD: return validate(_this, INSTR_ADDF_VAR_FLOAT, INSTR_ADDF_VAR_VAR, INSTR_ADDI_VAR_INTEGER, INSTR_ADDI_VAR_VAR, - INSTR_NOP, INSTR_NOP); + INSTR_NOP, INSTR_NOP, + INSTR_ADDS_VAR_VAR); /* mul */ case INSTR_MUL: return validate(_this, INSTR_MULF_VAR_FLOAT, INSTR_MULF_VAR_VAR, INSTR_MULI_VAR_INTEGER, INSTR_MULI_VAR_VAR, - INSTR_NOP, INSTR_NOP); + INSTR_NOP, INSTR_NOP, + INSTR_MULS_VAR_VAR); /* sub */ case INSTR_SUB: return validate(_this, INSTR_SUBF_VAR_FLOAT, INSTR_SUBF_VAR_VAR, INSTR_SUBI_VAR_INTEGER, INSTR_SUBI_VAR_VAR, - INSTR_NOP, INSTR_NOP); + INSTR_NOP, INSTR_NOP, + INSTR_SUBS_VAR_VAR); /* div */ case INSTR_DIV: return validate(_this, INSTR_DIVF_VAR_FLOAT, INSTR_DIVF_VAR_VAR, INSTR_DIVI_VAR_INTEGER, INSTR_DIVI_VAR_VAR, - INSTR_NOP,INSTR_NOP); + INSTR_NOP,INSTR_NOP, + INSTR_DIVS_VAR_VAR); default: return VALIDATE_TODO; @@ -423,7 +455,42 @@ void iflow_execute(FastInstructionFlow *_this, GoomSL *gsl) stack[stack_pointer++] = -1; - while (1) { + /* Quelques Macro pour rendre le code plus lisible */ +#define pSRC_VAR instr[ip].data.usrc.var +#define SRC_VAR_INT *instr[ip].data.usrc.var_int +#define SRC_VAR_FLOAT *instr[ip].data.usrc.var_float +#define SRC_VAR_PTR *instr[ip].data.usrc.var_ptr + +#define pDEST_VAR instr[ip].data.udest.var +#define DEST_VAR_INT *instr[ip].data.udest.var_int +#define DEST_VAR_FLOAT *instr[ip].data.udest.var_float +#define DEST_VAR_PTR *instr[ip].data.udest.var_ptr + +#define VALUE_INT instr[ip].data.usrc.value_int +#define VALUE_FLOAT instr[ip].data.usrc.value_float +#define VALUE_PTR instr[ip].data.usrc.value_ptr + +#define JUMP_OFFSET instr[ip].data.udest.jump_offset + +#define SRC_STRUCT_ID instr[ip].data.usrc.var_int[-1] +#define DEST_STRUCT_ID instr[ip].data.udest.var_int[-1] +#define SRC_STRUCT_IBLOCK(i) gsl->gsl_struct[SRC_STRUCT_ID]->iBlock[i] +#define SRC_STRUCT_FBLOCK(i) gsl->gsl_struct[SRC_STRUCT_ID]->fBlock[i] +#define DEST_STRUCT_IBLOCK(i) gsl->gsl_struct[DEST_STRUCT_ID]->iBlock[i] +#define DEST_STRUCT_FBLOCK(i) gsl->gsl_struct[DEST_STRUCT_ID]->fBlock[i] +#define DEST_STRUCT_IBLOCK_VAR(i,j) \ + ((int*)((char*)pDEST_VAR + gsl->gsl_struct[DEST_STRUCT_ID]->iBlock[i].data))[j] +#define DEST_STRUCT_FBLOCK_VAR(i,j) \ + ((float*)((char*)pDEST_VAR + gsl->gsl_struct[DEST_STRUCT_ID]->fBlock[i].data))[j] +#define SRC_STRUCT_IBLOCK_VAR(i,j) \ + ((int*)((char*)pSRC_VAR + gsl->gsl_struct[SRC_STRUCT_ID]->iBlock[i].data))[j] +#define SRC_STRUCT_FBLOCK_VAR(i,j) \ + ((float*)((char*)pSRC_VAR + gsl->gsl_struct[SRC_STRUCT_ID]->fBlock[i].data))[j] +#define DEST_STRUCT_SIZE gsl->gsl_struct[DEST_STRUCT_ID]->size + + while (1) + { + int i; #ifdef TRACE_SCRIPT printf("execute "); gsl_instr_display(instr[ip].proto); printf("\n"); #endif @@ -431,163 +498,163 @@ void iflow_execute(FastInstructionFlow *_this, GoomSL *gsl) /* SET.I */ case INSTR_SETI_VAR_INTEGER: - instr[ip].data.v_i.var->i = instr[ip].data.v_i.value; + DEST_VAR_INT = VALUE_INT; ++ip; break; case INSTR_SETI_VAR_VAR: - instr[ip].data.v_v.var_dest->i = instr[ip].data.v_v.var_src->i; + DEST_VAR_INT = SRC_VAR_INT; ++ip; break; /* SET.F */ case INSTR_SETF_VAR_FLOAT: - instr[ip].data.v_f.var->f = instr[ip].data.v_f.value; + DEST_VAR_FLOAT = VALUE_FLOAT; ++ip; break; case INSTR_SETF_VAR_VAR: - instr[ip].data.v_v.var_dest->f = instr[ip].data.v_v.var_src->f; + DEST_VAR_FLOAT = SRC_VAR_FLOAT; ++ip; break; /* SET.P */ case INSTR_SETP_VAR_VAR: - instr[ip].data.v_v.var_dest->ptr = instr[ip].data.v_v.var_src->ptr; + DEST_VAR_PTR = SRC_VAR_PTR; ++ip; break; case INSTR_SETP_VAR_PTR: - instr[ip].data.v_p.var->i = instr[ip].data.v_p.value; + DEST_VAR_PTR = VALUE_PTR; ++ip; break; /* JUMP */ case INSTR_JUMP: - ip += instr[ip].data.jump_offset; break; + ip += JUMP_OFFSET; break; /* JZERO */ case INSTR_JZERO: - ip += (flag ? 1 : instr[ip].data.jump_offset); break; + ip += (flag ? 1 : JUMP_OFFSET); break; case INSTR_NOP: ++ip; break; /* ISEQUAL.P */ case INSTR_ISEQUALP_VAR_VAR: - flag = (instr[ip].data.v_v.var_dest->i == instr[ip].data.v_v.var_src->i); + flag = (DEST_VAR_PTR == SRC_VAR_PTR); ++ip; break; case INSTR_ISEQUALP_VAR_PTR: - flag = (instr[ip].data.v_p.var->i == instr[ip].data.v_p.value); + flag = (DEST_VAR_PTR == VALUE_PTR); ++ip; break; /* ISEQUAL.I */ case INSTR_ISEQUALI_VAR_VAR: - flag = (instr[ip].data.v_v.var_dest->i == instr[ip].data.v_v.var_src->i); + flag = (DEST_VAR_INT == SRC_VAR_INT); ++ip; break; case INSTR_ISEQUALI_VAR_INTEGER: - flag = (instr[ip].data.v_i.var->i == instr[ip].data.v_i.value); + flag = (DEST_VAR_INT == VALUE_INT); ++ip; break; /* ISEQUAL.F */ case INSTR_ISEQUALF_VAR_VAR: - flag = (instr[ip].data.v_v.var_dest->f == instr[ip].data.v_v.var_src->f); + flag = (DEST_VAR_FLOAT == SRC_VAR_FLOAT); ++ip; break; case INSTR_ISEQUALF_VAR_FLOAT: - flag = (instr[ip].data.v_f.var->f == instr[ip].data.v_f.value); + flag = (DEST_VAR_FLOAT == VALUE_FLOAT); ++ip; break; /* ISLOWER.I */ case INSTR_ISLOWERI_VAR_VAR: - flag = (instr[ip].data.v_v.var_dest->i < instr[ip].data.v_v.var_src->i); + flag = (DEST_VAR_INT < SRC_VAR_INT); ++ip; break; case INSTR_ISLOWERI_VAR_INTEGER: - flag = (instr[ip].data.v_i.var->i < instr[ip].data.v_i.value); + flag = (DEST_VAR_INT < VALUE_INT); ++ip; break; /* ISLOWER.F */ case INSTR_ISLOWERF_VAR_VAR: - flag = (instr[ip].data.v_v.var_dest->f < instr[ip].data.v_v.var_src->f); + flag = (DEST_VAR_FLOAT < SRC_VAR_FLOAT); ++ip; break; case INSTR_ISLOWERF_VAR_FLOAT: - flag = (instr[ip].data.v_f.var->f < instr[ip].data.v_f.value); + flag = (DEST_VAR_FLOAT < VALUE_FLOAT); ++ip; break; /* ADD.I */ case INSTR_ADDI_VAR_VAR: - instr[ip].data.v_v.var_dest->i += instr[ip].data.v_v.var_src->i; + DEST_VAR_INT += SRC_VAR_INT; ++ip; break; case INSTR_ADDI_VAR_INTEGER: - instr[ip].data.v_i.var->i += instr[ip].data.v_i.value; + DEST_VAR_INT += VALUE_INT; ++ip; break; /* ADD.F */ case INSTR_ADDF_VAR_VAR: - instr[ip].data.v_v.var_dest->f += instr[ip].data.v_v.var_src->f; + DEST_VAR_FLOAT += SRC_VAR_FLOAT; ++ip; break; case INSTR_ADDF_VAR_FLOAT: - instr[ip].data.v_f.var->f += instr[ip].data.v_f.value; + DEST_VAR_FLOAT += VALUE_FLOAT; ++ip; break; /* MUL.I */ case INSTR_MULI_VAR_VAR: - instr[ip].data.v_v.var_dest->i *= instr[ip].data.v_v.var_src->i; + DEST_VAR_INT *= SRC_VAR_INT; ++ip; break; case INSTR_MULI_VAR_INTEGER: - instr[ip].data.v_i.var->i *= instr[ip].data.v_i.value; + DEST_VAR_INT *= VALUE_INT; ++ip; break; /* MUL.F */ case INSTR_MULF_VAR_FLOAT: - instr[ip].data.v_f.var->f *= instr[ip].data.v_f.value; + DEST_VAR_FLOAT *= VALUE_FLOAT; ++ip; break; case INSTR_MULF_VAR_VAR: - instr[ip].data.v_v.var_dest->f *= instr[ip].data.v_v.var_src->f; + DEST_VAR_FLOAT *= SRC_VAR_FLOAT; ++ip; break; /* DIV.I */ case INSTR_DIVI_VAR_VAR: - instr[ip].data.v_v.var_dest->i /= instr[ip].data.v_v.var_src->i; + DEST_VAR_INT /= SRC_VAR_INT; ++ip; break; case INSTR_DIVI_VAR_INTEGER: - instr[ip].data.v_i.var->i /= instr[ip].data.v_i.value; + DEST_VAR_INT /= VALUE_INT; ++ip; break; /* DIV.F */ case INSTR_DIVF_VAR_FLOAT: - instr[ip].data.v_f.var->f /= instr[ip].data.v_f.value; + DEST_VAR_FLOAT /= VALUE_FLOAT; ++ip; break; case INSTR_DIVF_VAR_VAR: - instr[ip].data.v_v.var_dest->f /= instr[ip].data.v_v.var_src->f; + DEST_VAR_FLOAT /= SRC_VAR_FLOAT; ++ip; break; /* SUB.I */ case INSTR_SUBI_VAR_VAR: - instr[ip].data.v_v.var_dest->i -= instr[ip].data.v_v.var_src->i; + DEST_VAR_INT -= SRC_VAR_INT; ++ip; break; case INSTR_SUBI_VAR_INTEGER: - instr[ip].data.v_i.var->i -= instr[ip].data.v_i.value; + DEST_VAR_INT -= VALUE_INT; ++ip; break; /* SUB.F */ case INSTR_SUBF_VAR_FLOAT: - instr[ip].data.v_f.var->f -= instr[ip].data.v_f.value; + DEST_VAR_FLOAT -= VALUE_FLOAT; ++ip; break; case INSTR_SUBF_VAR_VAR: - instr[ip].data.v_v.var_dest->f -= instr[ip].data.v_v.var_src->f; + DEST_VAR_FLOAT -= SRC_VAR_FLOAT; ++ip; break; /* CALL */ case INSTR_CALL: stack[stack_pointer++] = ip + 1; - ip += instr[ip].data.jump_offset; break; + ip += JUMP_OFFSET; break; /* RET */ case INSTR_RET: @@ -597,7 +664,7 @@ void iflow_execute(FastInstructionFlow *_this, GoomSL *gsl) /* EXT_CALL */ case INSTR_EXT_CALL: - instr[ip].data.external_function->function(gsl, gsl->vars, instr[ip].data.external_function->vars); + instr[ip].data.udest.external_function->function(gsl, gsl->vars, instr[ip].data.udest.external_function->vars); ++ip; break; /* NOT */ @@ -607,7 +674,98 @@ void iflow_execute(FastInstructionFlow *_this, GoomSL *gsl) /* JNZERO */ case INSTR_JNZERO: - ip += (flag ? instr[ip].data.jump_offset : 1); break; + ip += (flag ? JUMP_OFFSET : 1); break; + + case INSTR_SETS_VAR_VAR: + memcpy(pDEST_VAR, pSRC_VAR, DEST_STRUCT_SIZE); + ++ip; break; + + case INSTR_ISEQUALS_VAR_VAR: + break; + + case INSTR_ADDS_VAR_VAR: + /* process integers */ + i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + DEST_STRUCT_IBLOCK_VAR(i,j) += SRC_STRUCT_IBLOCK_VAR(i,j); + } + ++i; + } + /* process floats */ + i=0; + while (DEST_STRUCT_FBLOCK(i).size > 0) { + int j=DEST_STRUCT_FBLOCK(i).size; + while (j--) { + DEST_STRUCT_FBLOCK_VAR(i,j) += SRC_STRUCT_FBLOCK_VAR(i,j); + } + ++i; + } + ++ip; break; + + case INSTR_SUBS_VAR_VAR: + /* process integers */ + i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + DEST_STRUCT_IBLOCK_VAR(i,j) -= SRC_STRUCT_IBLOCK_VAR(i,j); + } + ++i; + } + /* process floats */ + i=0; + while (DEST_STRUCT_FBLOCK(i).size > 0) { + int j=DEST_STRUCT_FBLOCK(i).size; + while (j--) { + DEST_STRUCT_FBLOCK_VAR(i,j) -= SRC_STRUCT_FBLOCK_VAR(i,j); + } + ++i; + } + ++ip; break; + + case INSTR_MULS_VAR_VAR: + /* process integers */ + i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + DEST_STRUCT_IBLOCK_VAR(i,j) *= SRC_STRUCT_IBLOCK_VAR(i,j); + } + ++i; + } + /* process floats */ + i=0; + while (DEST_STRUCT_FBLOCK(i).size > 0) { + int j=DEST_STRUCT_FBLOCK(i).size; + while (j--) { + DEST_STRUCT_FBLOCK_VAR(i,j) *= SRC_STRUCT_FBLOCK_VAR(i,j); + } + ++i; + } + ++ip; break; + + case INSTR_DIVS_VAR_VAR: + /* process integers */ + i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + DEST_STRUCT_IBLOCK_VAR(i,j) /= SRC_STRUCT_IBLOCK_VAR(i,j); + } + ++i; + } + /* process floats */ + i=0; + while (DEST_STRUCT_FBLOCK(i).size > 0) { + int j=DEST_STRUCT_FBLOCK(i).size; + while (j--) { + DEST_STRUCT_FBLOCK_VAR(i,j) /= SRC_STRUCT_FBLOCK_VAR(i,j); + } + ++i; + } + ++ip; break; default: printf("NOT IMPLEMENTED : %d\n", instr[ip].id); @@ -631,7 +789,7 @@ void *gsl_get_ptr(GoomSL *_this, int id) { /* {{{ */ if ((id>=0)&&(id<_this->nbPtr)) return _this->ptrArray[id]; - fprintf(stderr,"INVALID GET PTR %d\n", id); + fprintf(stderr,"INVALID GET PTR 0x%08x\n", id); return NULL; } /* }}} */ @@ -657,9 +815,15 @@ void gsl_enternamespace(const char *name) } } /* }}} */ -void gsl_leavenamespace(void) +void gsl_reenternamespace(GoomHash *nsinfo) { + currentGoomSL->currentNS++; + currentGoomSL->namespaces[currentGoomSL->currentNS] = nsinfo; +} + +GoomHash *gsl_leavenamespace(void) { /* {{{ */ currentGoomSL->currentNS--; + return currentGoomSL->namespaces[currentGoomSL->currentNS+1]; } /* }}} */ GoomHash *gsl_find_namespace(const char *name) @@ -713,7 +877,21 @@ static void reset_scanner(GoomSL *gss) gss->currentNS = 0; gss->namespaces[0] = gss->vars; + goom_hash_free(gss->structIDS); + gss->structIDS = goom_hash_new(); + + while (gss->nbStructID > 0) { + int i; + gss->nbStructID--; + for(i=0;i<gss->gsl_struct[gss->nbStructID]->nbFields;++i) + free(gss->gsl_struct[gss->nbStructID]->fields[i]); + free(gss->gsl_struct[gss->nbStructID]); + } + gss->compilationOK = 1; + + goom_heap_delete(gss->data_heap); + gss->data_heap = goom_heap_new(); } /* }}} */ static void calculate_labels(InstructionFlow *iflow) @@ -724,7 +902,7 @@ static void calculate_labels(InstructionFlow *iflow) if (instr->jump_label) { HashValue *label = goom_hash_get(iflow->labels,instr->jump_label); if (label) { - instr->data.jump_offset = -instr->address + label->i; + instr->data.udest.jump_offset = -instr->address + label->i; } else { fprintf(stderr, "ERROR: Line %d, Could not find label %s\n", instr->line_number, instr->jump_label); @@ -737,18 +915,51 @@ static void calculate_labels(InstructionFlow *iflow) } } /* }}} */ +static int powerOfTwo(int i) +{ + int b; + for (b=0;b<31;b++) + if (i == (1<<b)) + return b; + return 0; +} + /* Cree un flow d'instruction optimise */ static void gsl_create_fast_iflow(void) { /* {{{ */ int number = currentGoomSL->iflow->number; int i; #ifdef USE_JITC_X86 + + /* pour compatibilite avec les MACROS servant a execution */ + int ip = 0; + GoomSL *gsl = currentGoomSL; + JitcX86Env *jitc; + if (currentGoomSL->jitc != NULL) jitc_x86_delete(currentGoomSL->jitc); jitc = currentGoomSL->jitc = jitc_x86_env_new(0xffff); currentGoomSL->jitc_func = jitc_prepare_func(jitc); +#if 0 +#define SRC_STRUCT_ID instr[ip].data.usrc.var_int[-1] +#define DEST_STRUCT_ID instr[ip].data.udest.var_int[-1] +#define SRC_STRUCT_IBLOCK(i) gsl->gsl_struct[SRC_STRUCT_ID]->iBlock[i] +#define SRC_STRUCT_FBLOCK(i) gsl->gsl_struct[SRC_STRUCT_ID]->fBlock[i] +#define DEST_STRUCT_IBLOCK(i) gsl->gsl_struct[DEST_STRUCT_ID]->iBlock[i] +#define DEST_STRUCT_FBLOCK(i) gsl->gsl_struct[DEST_STRUCT_ID]->fBlock[i] +#define DEST_STRUCT_IBLOCK_VAR(i,j) \ + ((int*)((char*)pDEST_VAR + gsl->gsl_struct[DEST_STRUCT_ID]->iBlock[i].data))[j] +#define DEST_STRUCT_FBLOCK_VAR(i,j) \ + ((float*)((char*)pDEST_VAR + gsl->gsl_struct[DEST_STRUCT_ID]->fBlock[i].data))[j] +#define SRC_STRUCT_IBLOCK_VAR(i,j) \ + ((int*)((char*)pSRC_VAR + gsl->gsl_struct[SRC_STRUCT_ID]->iBlock[i].data))[j] +#define SRC_STRUCT_FBLOCK_VAR(i,j) \ + ((float*)((char*)pSRC_VAR + gsl->gsl_struct[SRC_STRUCT_ID]->fBlock[i].data))[j] +#define DEST_STRUCT_SIZE gsl->gsl_struct[DEST_STRUCT_ID]->size +#endif + JITC_JUMP_LABEL(jitc, "__very_end__"); JITC_ADD_LABEL (jitc, "__very_start__"); @@ -756,27 +967,19 @@ static void gsl_create_fast_iflow(void) Instruction *instr = currentGoomSL->iflow->instr[i]; switch (instr->id) { case INSTR_SETI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EAX, instr->data.v_i.value); /* eax = value */ - JITC_LOAD_REG_IMM32(jitc, EBX, &instr->data.v_i.var->i); /* ebx = &dest */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov [$d], $d", instr->data.udest.var_int, instr->data.usrc.value_int); break; case INSTR_SETI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_src->i)); /* eax = &src */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_dest->i)); /* ebx = &dest */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); /* eax = *eax */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov eax, [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); break; /* SET.F */ case INSTR_SETF_VAR_FLOAT : - JITC_LOAD_REG_IMM32(jitc, EAX, *(int*)&(instr->data.v_f.value)); /* eax = value */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_f.var->f)); /* ebx = &dest */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov [$d], $d", instr->data.udest.var_float, *(int*)(&instr->data.usrc.value_float)); break; case INSTR_SETF_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_src->f)); /* eax = &src */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_dest->f)); /* ebx = &dest */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); /* eax = *eax */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov eax, [$d]", instr->data.usrc.var_float); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_float); break; case INSTR_NOP : if (instr->nop_label != 0) @@ -786,29 +989,19 @@ static void gsl_create_fast_iflow(void) JITC_JUMP_LABEL(jitc,instr->jump_label); break; case INSTR_SETP_VAR_PTR : - JITC_LOAD_REG_IMM32(jitc, EAX, instr->data.v_p.value); /* eax = value */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_p.var->ptr)); /* ebx = &dest */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov [$d], $d", instr->data.udest.var_ptr, instr->data.usrc.value_ptr); break; case INSTR_SETP_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_src->ptr)); /* eax = &src */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_dest->ptr)); /* ebx = &dest */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); /* eax = *eax */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "mov eax, [$d]", instr->data.usrc.var_ptr); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_ptr); break; case INSTR_SUBI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_i.var->i)); /* ebx = &var */ - JITC_LOAD_REG_pREG (jitc, EAX, EBX); /* eax = *ebx */ - JITC_SUB_REG_IMM32(jitc, EAX, instr->data.v_i.value); /* eax -= value */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + jitc_add(jitc, "add [$d], $d", instr->data.udest.var_int, -instr->data.usrc.value_int); break; case INSTR_SUBI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, ECX, &(instr->data.v_v.var_dest->i)); /* ecx = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, ECX); /* eax = *ecx */ - JITC_LOAD_REG_pREG (jitc, EBX, EBX); /* ebx = *ebx */ - JITC_SUB_REG_REG (jitc, EAX, EBX); /* eax -= ebx */ - JITC_LOAD_pREG_REG (jitc, ECX, EAX); /* *ecx = eax */ + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "sub eax, [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); break; case INSTR_SUBF_VAR_FLOAT : printf("NOT IMPLEMENTED : %d\n", instr->id); @@ -816,195 +1009,263 @@ static void gsl_create_fast_iflow(void) case INSTR_SUBF_VAR_VAR : printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_ISLOWERF_VAR_VAR : + case INSTR_ISLOWERF_VAR_VAR: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_ISLOWERF_VAR_FLOAT : + case INSTR_ISLOWERF_VAR_FLOAT: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_ISLOWERI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_dest->i)); - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_LOAD_REG_pREG (jitc, EBX, EBX); - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_CMP_REG_REG (jitc, EAX, EBX); - JITC_JUMP_COND (jitc, COND_NOT_BELOW, 1); - JITC_INC_REG (jitc, EDX); + case INSTR_ISLOWERI_VAR_VAR: + jitc_add(jitc,"mov edx, [$d]", instr->data.udest.var_int); + jitc_add(jitc,"sub edx, [$d]", instr->data.usrc.var_int); + jitc_add(jitc,"shr edx, $d", 31); break; - case INSTR_ISLOWERI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_i.var->i)); - JITC_LOAD_REG_IMM32(jitc, EBX, instr->data.v_i.value); - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_CMP_REG_REG (jitc, EAX, EBX); - JITC_JUMP_COND (jitc, COND_NOT_BELOW, 1); - JITC_INC_REG (jitc, EDX); + case INSTR_ISLOWERI_VAR_INTEGER: + jitc_add(jitc,"mov edx, [$d]", instr->data.udest.var_int); + jitc_add(jitc,"sub edx, $d", instr->data.usrc.value_int); + jitc_add(jitc,"shr edx, $d", 31); break; - case INSTR_ADDI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_i.var->i)); /* ebx = &var */ - JITC_LOAD_REG_pREG (jitc, EAX, EBX); /* eax = *ebx */ - JITC_ADD_REG_IMM32(jitc, EAX, instr->data.v_i.value); /* eax += value */ - JITC_LOAD_pREG_REG (jitc, EBX, EAX); /* *ebx = eax */ + case INSTR_ADDI_VAR_INTEGER: + jitc_add(jitc, "add [$d], $d", instr->data.udest.var_int, instr->data.usrc.value_int); break; - case INSTR_ADDI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, ECX, &(instr->data.v_v.var_dest->i)); /* ecx = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, ECX); /* eax = *ecx */ - JITC_LOAD_REG_pREG (jitc, EBX, EBX); /* ebx = *ebx */ - JITC_ADD_REG_REG (jitc, EAX, EBX); /* eax = eax + ebx */ - JITC_LOAD_pREG_REG (jitc, ECX, EAX); /* *ecx = eax */ + case INSTR_ADDI_VAR_VAR: + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "add eax, [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); break; - case INSTR_ADDF_VAR_FLOAT : + case INSTR_ADDF_VAR_FLOAT: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_ADDF_VAR_VAR : + case INSTR_ADDF_VAR_VAR: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_MULI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_i.var->i)); - JITC_LOAD_REG_IMM32(jitc, ECX, instr->data.v_i.value); - JITC_LOAD_REG_pREG (jitc, EAX, EBX); - JITC_IMUL_EAX_REG (jitc, ECX); - JITC_LOAD_pREG_REG (jitc, EBX, EAX); + case INSTR_MULI_VAR_INTEGER: + if (instr->data.usrc.value_int != 1) + { + int po2 = powerOfTwo(instr->data.usrc.value_int); + if (po2) { + /* performs (V / 2^n) by doing V >> n */ + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "sal eax, $d", po2); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); + } + else { + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "imul eax, $d", instr->data.usrc.value_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); + } + } break; - case INSTR_MULI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, ECX, &(instr->data.v_v.var_dest->i)); /* ecx = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, ECX); /* eax = *ecx */ - JITC_LOAD_REG_pREG (jitc, EBX, EBX); /* ebx = *ebx */ - JITC_IMUL_EAX_REG (jitc, EBX); /* eax = eax * ebx */ - JITC_LOAD_pREG_REG (jitc, ECX, EAX); /* *ecx = eax */ + case INSTR_MULI_VAR_VAR: + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "imul eax, [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); break; - case INSTR_MULF_VAR_FLOAT : + case INSTR_MULF_VAR_FLOAT: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_MULF_VAR_VAR : + case INSTR_MULF_VAR_VAR: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_DIVI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_i.var->i)); - JITC_LOAD_REG_IMM32(jitc, ECX, instr->data.v_i.value); - JITC_LOAD_REG_pREG (jitc, EAX, EBX); - JITC_IDIV_EAX_REG (jitc, ECX); - JITC_LOAD_pREG_REG (jitc, EBX, EAX); + case INSTR_DIVI_VAR_INTEGER: + if ((instr->data.usrc.value_int != 1) && (instr->data.usrc.value_int != 0)) + { + int po2 = powerOfTwo(instr->data.usrc.value_int); + if (po2) { + /* performs (V / 2^n) by doing V >> n */ + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "sar eax, $d", po2); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); + } + else { + /* performs (V/n) by doing (V*(32^2/n)) */ + long coef; + double dcoef = (double)4294967296.0 / (double)instr->data.usrc.value_int; + if (dcoef < 0.0) dcoef = -dcoef; + coef = (long)floor(dcoef); + dcoef -= floor(dcoef); + if (dcoef < 0.5) coef += 1; + + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "mov edx, $d", coef); + jitc_add(jitc, "imul edx"); + if (instr->data.usrc.value_int < 0) + jitc_add(jitc, "neg edx"); + jitc_add(jitc, "mov [$d], edx", instr->data.udest.var_int); + } + } break; case INSTR_DIVI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, ECX, &(instr->data.v_v.var_dest->i)); /* ecx = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, ECX); /* eax = *ecx */ - JITC_LOAD_REG_pREG (jitc, EBX, EBX); /* ebx = *ebx */ - JITC_IDIV_EAX_REG (jitc, EBX); /* eax = eax * ebx */ - JITC_LOAD_pREG_REG (jitc, ECX, EAX); /* *ecx = eax */ + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "cdq"); /* sign extend eax into edx */ + jitc_add(jitc, "idiv [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "mov [$d], eax", instr->data.udest.var_int); break; - case INSTR_DIVF_VAR_FLOAT : + case INSTR_DIVF_VAR_FLOAT: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_DIVF_VAR_VAR : + case INSTR_DIVF_VAR_VAR: printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_JZERO : - JITC_CMP_REG_IMM32(jitc,EDX,1); - JITC_JUMP_COND_LABEL(jitc,COND_NOT_EQUAL,instr->jump_label); + case INSTR_JZERO: + jitc_add(jitc, "cmp edx, $d", 0); + jitc_add(jitc, "je $s", instr->jump_label); break; case INSTR_ISEQUALP_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_dest->ptr)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->ptr)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_LOAD_REG_pREG (jitc, EBX, EBX); - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_CMP_REG_REG (jitc, EAX, EBX); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_ptr); + jitc_add(jitc, "mov edx, $d", 0); + jitc_add(jitc, "cmp eax, [$d]", instr->data.usrc.var_ptr); + jitc_add(jitc, "jne $d", 1); + jitc_add(jitc, "inc edx"); break; case INSTR_ISEQUALP_VAR_PTR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_p.var->ptr)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_CMP_REG_IMM32 (jitc, EAX, instr->data.v_p.value); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_ptr); + jitc_add(jitc, "mov edx, $d", 0); + jitc_add(jitc, "cmp eax, $d", instr->data.usrc.value_ptr); + jitc_add(jitc, "jne $d", 1); + jitc_add(jitc, "inc edx"); break; case INSTR_ISEQUALI_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_dest->i)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->i)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_LOAD_REG_pREG (jitc, EBX, EBX); - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_CMP_REG_REG (jitc, EAX, EBX); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "mov edx, $d", 0); + jitc_add(jitc, "cmp eax, [$d]", instr->data.usrc.var_int); + jitc_add(jitc, "jne $d", 1); + jitc_add(jitc, "inc edx"); break; case INSTR_ISEQUALI_VAR_INTEGER : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_i.var->i)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_CMP_REG_IMM32 (jitc, EAX, instr->data.v_i.value); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + jitc_add(jitc, "mov eax, [$d]", instr->data.udest.var_int); + jitc_add(jitc, "mov edx, $d", 0); + jitc_add(jitc, "cmp eax, $d", instr->data.usrc.value_int); + jitc_add(jitc, "jne $d", 1); + jitc_add(jitc, "inc edx"); break; case INSTR_ISEQUALF_VAR_VAR : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_v.var_dest->f)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EBX, &(instr->data.v_v.var_src->f)); /* ebx = &src */ - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_LOAD_REG_pREG (jitc, EBX, EBX); - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_CMP_REG_REG (jitc, EAX, EBX); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + printf("NOT IMPLEMENTED : %d\n", instr->id); break; case INSTR_ISEQUALF_VAR_FLOAT : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.v_f.var->f)); /* eax = &dest */ - JITC_LOAD_REG_IMM32(jitc, EDX, 0); - JITC_LOAD_REG_pREG (jitc, EAX, EAX); - JITC_CMP_REG_IMM32 (jitc, EAX, *(int*)(&instr->data.v_f.value)); - JITC_JUMP_COND (jitc, COND_NOT_EQUAL, 1); - JITC_INC_REG (jitc, EDX); + printf("NOT IMPLEMENTED : %d\n", instr->id); break; - case INSTR_CALL : - JITC_CALL_LABEL(jitc, instr->jump_label); + case INSTR_CALL: + jitc_add(jitc, "call $s", instr->jump_label); break; - case INSTR_RET : - JITC_RETURN_FUNCTION(jitc); + case INSTR_RET: + jitc_add(jitc, "ret"); break; - case INSTR_EXT_CALL : - JITC_LOAD_REG_IMM32(jitc, EAX, &(instr->data.external_function->vars)); - JITC_LOAD_REG_pREG(jitc,EAX,EAX); - JITC_PUSH_REG(jitc,EAX); + case INSTR_EXT_CALL: + jitc_add(jitc, "mov eax, [$d]", &(instr->data.udest.external_function->vars)); + jitc_add(jitc, "push eax"); + jitc_add(jitc, "mov edx, [$d]", &(currentGoomSL->vars)); + jitc_add(jitc, "push edx"); + jitc_add(jitc, "mov eax, [$d]", &(currentGoomSL)); + jitc_add(jitc, "push eax"); + + jitc_add(jitc, "mov eax, [$d]", &(instr->data.udest.external_function)); + jitc_add(jitc, "mov eax, [eax]"); + jitc_add(jitc, "call [eax]"); + jitc_add(jitc, "add esp, $d", 12); + break; + case INSTR_NOT_VAR: + jitc_add(jitc, "mov eax, edx"); + jitc_add(jitc, "mov edx, $d", 1); + jitc_add(jitc, "sub edx, eax"); + break; + case INSTR_JNZERO: + jitc_add(jitc, "cmp edx, $d", 0); + jitc_add(jitc, "jne $s", instr->jump_label); + break; + case INSTR_SETS_VAR_VAR: + { + int loop = DEST_STRUCT_SIZE / sizeof(int); + int dst = (int)pDEST_VAR; + int src = (int)pSRC_VAR; - JITC_LOAD_REG_IMM32(jitc, EAX, &(currentGoomSL->vars)); - JITC_LOAD_REG_pREG(jitc,EAX,EAX); - JITC_PUSH_REG(jitc,EAX); - - JITC_LOAD_REG_IMM32(jitc, EAX, &(currentGoomSL)); - JITC_LOAD_REG_pREG(jitc,EAX,EAX); - JITC_PUSH_REG(jitc,EAX); - - JITC_LOAD_REG_IMM32(jitc,EAX,&(instr->data.external_function)); - JITC_LOAD_REG_pREG(jitc,EAX,EAX); - JITC_LOAD_REG_pREG(jitc,EAX,EAX); - - JITC_CALL_pREG(jitc,EAX); - - JITC_POP_REG(jitc,EAX); - JITC_POP_REG(jitc,EAX); - JITC_POP_REG(jitc,EAX); + while (loop--) { + jitc_add(jitc,"mov eax, [$d]", src); + jitc_add(jitc,"mov [$d], eax", dst); + src += 4; + dst += 4; + } + } + break; + case INSTR_ISEQUALS_VAR_VAR: + break; + case INSTR_ADDS_VAR_VAR: + { + /* process integers */ + int i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { /* TODO interlace 2 */ + jitc_add(jitc, "mov eax, [$d]", &DEST_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "add eax, [$d]", &SRC_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "mov [$d], eax", &DEST_STRUCT_IBLOCK_VAR(i,j)); + } + ++i; + } + /* process floats */ + i=0; + while (DEST_STRUCT_FBLOCK(i).size > 0) { + int j=DEST_STRUCT_FBLOCK(i).size; + while (j--) { + /* DEST_STRUCT_FBLOCK_VAR(i,j) += SRC_STRUCT_FBLOCK_VAR(i,j); */ + /* TODO */ + } + ++i; + } + break; + } + case INSTR_SUBS_VAR_VAR: + { + /* process integers */ + int i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + jitc_add(jitc, "mov eax, [$d]", &DEST_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "sub eax, [$d]", &SRC_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "mov [$d], eax", &DEST_STRUCT_IBLOCK_VAR(i,j)); + } + ++i; + } break; - case INSTR_NOT_VAR : - JITC_LOAD_REG_REG(jitc,EAX,EDX); - JITC_LOAD_REG_IMM32(jitc,EDX,1); - JITC_SUB_REG_REG(jitc,EDX,EAX); + } + case INSTR_MULS_VAR_VAR: + { + /* process integers */ + int i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + jitc_add(jitc, "mov eax, [$d]", &DEST_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "imul eax, [$d]", &SRC_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "mov [$d], eax", &DEST_STRUCT_IBLOCK_VAR(i,j)); + } + ++i; + } break; - case INSTR_JNZERO : - JITC_CMP_REG_IMM32(jitc,EDX,1); - JITC_JUMP_COND_LABEL(jitc,COND_EQUAL,instr->jump_label); + } + case INSTR_DIVS_VAR_VAR: + { + /* process integers */ + int i=0; + while (DEST_STRUCT_IBLOCK(i).size > 0) { + int j=DEST_STRUCT_IBLOCK(i).size; + while (j--) { + jitc_add(jitc, "mov eax, [$d]", &DEST_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "cdq"); + jitc_add(jitc, "idiv [$d]", &SRC_STRUCT_IBLOCK_VAR(i,j)); + jitc_add(jitc, "mov [$d], eax", &DEST_STRUCT_IBLOCK_VAR(i,j)); + } + ++i; + } break; + } } } JITC_ADD_LABEL (jitc, "__very_end__"); - JITC_CALL_LABEL(jitc, "__very_start__"); - JITC_LOAD_REG_IMM32(jitc, EAX, 0); + jitc_add(jitc, "call $s", "__very_start__"); + jitc_add(jitc, "mov eax, $d", 0); jitc_validate_func(jitc); #else InstructionFlow *iflow = currentGoomSL->iflow; @@ -1025,18 +1286,64 @@ static void gsl_create_fast_iflow(void) void yy_scan_string(const char *str); void yyparse(void); +GoomHash *gsl_globals(GoomSL *_this) +{ + return _this->vars; +} + + +/** + * Some native external functions + */ +static void ext_charAt(GoomSL *gsl, GoomHash *global, GoomHash *local) +{ + char *string = GSL_LOCAL_PTR(gsl, local, "value"); + int index = GSL_LOCAL_INT(gsl, local, "index"); + GSL_GLOBAL_INT(gsl, "charAt") = 0; + if (string == NULL) { + return; + } + if (index < strlen(string)) + GSL_GLOBAL_INT(gsl, "charAt") = string[index]; +} + +static void ext_i2f(GoomSL *gsl, GoomHash *global, GoomHash *local) +{ + int i = GSL_LOCAL_INT(gsl, local, "value"); + GSL_GLOBAL_FLOAT(gsl, "i2f") = i; +} + +static void ext_f2i(GoomSL *gsl, GoomHash *global, GoomHash *local) +{ + float f = GSL_LOCAL_FLOAT(gsl, local, "value"); + GSL_GLOBAL_INT(gsl, "f2i") = f; +} + +/** + * + */ void gsl_compile(GoomSL *_currentGoomSL, const char *script) { /* {{{ */ + char *script_and_externals; + static const char *sBinds = + "external <charAt: string value, int index> : int\n" + "external <f2i: float value> : int\n" + "external <i2f: int value> : float\n"; + #ifdef VERBOSE printf("\n=== Starting Compilation ===\n"); #endif + script_and_externals = malloc(strlen(script) + strlen(sBinds) + 2); + strcpy(script_and_externals, sBinds); + strcat(script_and_externals, script); + /* 0- reset */ currentGoomSL = _currentGoomSL; reset_scanner(currentGoomSL); /* 1- create the syntaxic tree */ - yy_scan_string(script); + yy_scan_string(script_and_externals); yyparse(); /* 2- generate code */ @@ -1048,6 +1355,12 @@ void gsl_compile(GoomSL *_currentGoomSL, const char *script) /* 4- optimize code */ gsl_create_fast_iflow(); + /* 5- bind a few internal functions */ + gsl_bind_function(currentGoomSL, "charAt", ext_charAt); + gsl_bind_function(currentGoomSL, "f2i", ext_f2i); + gsl_bind_function(currentGoomSL, "i2f", ext_i2f); + free(script_and_externals); + #ifdef VERBOSE printf("=== Compilation done. # of lines: %d. # of instr: %d ===\n", currentGoomSL->num_lines, currentGoomSL->iflow->number); #endif @@ -1071,9 +1384,16 @@ GoomSL *gsl_new(void) gss->iflow = iflow_new(); gss->vars = goom_hash_new(); gss->functions = goom_hash_new(); + gss->nbStructID = 0; + gss->structIDS = goom_hash_new(); + gss->gsl_struct_size = 32; + gss->gsl_struct = (GSL_Struct**)malloc(gss->gsl_struct_size * sizeof(GSL_Struct*)); gss->currentNS = 0; gss->namespaces[0] = gss->vars; + gss->data_heap = goom_heap_new(); + reset_scanner(gss); + gss->compilationOK = 0; gss->nbPtr=0; gss->ptrArraySize=256; diff --git a/src/post/goom/goomsl.h b/src/post/goom/goomsl.h index 45dcce0fa..b9f20d6cc 100644 --- a/src/post/goom/goomsl.h +++ b/src/post/goom/goomsl.h @@ -21,12 +21,14 @@ int gsl_malloc (GoomSL *_this, int size); void *gsl_get_ptr (GoomSL *_this, int id); void gsl_free_ptr(GoomSL *_this, int id); -#define gsl_local_ptr(gsl,local,name) gsl_get_ptr(gsl, goom_hash_get(local,name)->i) -#define gsl_local_int(gsl,local,name) goom_hash_get(local,name)->i -#define gsl_local_float(gsl,local,name) goom_hash_get(local,name)->i +GoomHash *gsl_globals(GoomSL *_this); -#define gsl_global_ptr(gsl,global,name) gsl_get_ptr(gsl, goom_hash_get(global,name)->i) -#define gsl_global_int(gsl,global,name) goom_hash_get(global,name)->i -#define gsl_global_float(gsl,global,name) goom_hash_get(global,name)->i +#define GSL_LOCAL_PTR(gsl,local,name) gsl_get_ptr(gsl, *(int*)goom_hash_get(local,name)->ptr) +#define GSL_LOCAL_INT(gsl,local,name) (*(int*)goom_hash_get(local,name)->ptr) +#define GSL_LOCAL_FLOAT(gsl,local,name) (*(float*)goom_hash_get(local,name)->ptr) + +#define GSL_GLOBAL_PTR(gsl,name) gsl_get_ptr(gsl, *(int*)goom_hash_get(gsl_globals(gsl),name)->ptr) +#define GSL_GLOBAL_INT(gsl,name) (*(int*)goom_hash_get(gsl_globals(gsl),name)->ptr) +#define GSL_GLOBAL_FLOAT(gsl,name) (*(float*)goom_hash_get(gsl_globals(gsl),name)->ptr) #endif diff --git a/src/post/goom/goomsl_hash.c b/src/post/goom/goomsl_hash.c index b723726ca..af2ec44a6 100644 --- a/src/post/goom/goomsl_hash.c +++ b/src/post/goom/goomsl_hash.c @@ -4,10 +4,11 @@ static GoomHashEntry *entry_new(const char *key, HashValue value) { + int len = strlen(key); GoomHashEntry *entry = (GoomHashEntry*)malloc(sizeof(GoomHashEntry)); - entry->key = (char *)malloc(strlen(key)+1); - strcpy(entry->key,key); + entry->key = (char *)malloc(len+1); + memcpy(entry->key,key,len+1); entry->value = value; entry->lower = NULL; entry->upper = NULL; @@ -57,9 +58,10 @@ static HashValue *entry_get(GoomHashEntry *entry, const char *key) { return &(entry->value); } -GoomHash *goom_hash_new(void) { +GoomHash *goom_hash_new() { GoomHash *_this = (GoomHash*)malloc(sizeof(GoomHash)); _this->root = NULL; + _this->number_of_puts = 0; return _this; } @@ -69,6 +71,7 @@ void goom_hash_free(GoomHash *_this) { } void goom_hash_put(GoomHash *_this, const char *key, HashValue value) { + _this->number_of_puts += 1; if (_this->root == NULL) _this->root = entry_new(key,value); else @@ -98,4 +101,20 @@ void goom_hash_put_ptr(GoomHash *_this, const char *key, void *ptr) { goom_hash_put(_this,key,value); } +/* FOR EACH */ +static void _goom_hash_for_each(GoomHash *_this, GoomHashEntry *entry, GH_Func func) +{ + if (entry == NULL) return; + func(_this, entry->key, &(entry->value)); + _goom_hash_for_each(_this, entry->lower, func); + _goom_hash_for_each(_this, entry->upper, func); +} + +void goom_hash_for_each(GoomHash *_this, GH_Func func) { + _goom_hash_for_each(_this, _this->root, func); +} + +int goom_hash_number_of_puts(GoomHash *_this) { + return _this->number_of_puts; +} diff --git a/src/post/goom/goomsl_hash.h b/src/post/goom/goomsl_hash.h index 7ce496d8e..26f451673 100644 --- a/src/post/goom/goomsl_hash.h +++ b/src/post/goom/goomsl_hash.h @@ -19,9 +19,10 @@ struct GOOM_HASH_ENTRY { struct GOOM_HASH { GoomHashEntry *root; + int number_of_puts; }; -GoomHash *goom_hash_new(void); +GoomHash *goom_hash_new(); void goom_hash_free(GoomHash *gh); void goom_hash_put(GoomHash *gh, const char *key, HashValue value); @@ -31,4 +32,9 @@ void goom_hash_put_int (GoomHash *_this, const char *key, int i); void goom_hash_put_float(GoomHash *_this, const char *key, float f); void goom_hash_put_ptr (GoomHash *_this, const char *key, void *ptr); +typedef void (*GH_Func)(GoomHash *caller, const char *key, HashValue *value); + +void goom_hash_for_each(GoomHash *_this, GH_Func func); +int goom_hash_number_of_puts(GoomHash *_this); + #endif /* _GOOM_HASH_H */ diff --git a/src/post/goom/goomsl_heap.c b/src/post/goom/goomsl_heap.c new file mode 100644 index 000000000..73943bf95 --- /dev/null +++ b/src/post/goom/goomsl_heap.c @@ -0,0 +1,105 @@ +#include "goomsl_heap.h" +#include <stdlib.h> + +struct _GOOM_HEAP { + void **arrays; + int number_of_arrays; + int size_of_each_array; + int consumed_in_last_array; +}; + +/* Constructors / Destructor */ +GoomHeap *goom_heap_new(void) +{ + return goom_heap_new_with_granularity(4096); +} + +GoomHeap *goom_heap_new_with_granularity(int granularity) +{ + GoomHeap *_this; + _this = (GoomHeap*)malloc(sizeof(GoomHeap)); + _this->number_of_arrays = 0; + _this->size_of_each_array = granularity; + _this->consumed_in_last_array = 0; + _this->arrays = (void**)malloc(sizeof(void*)); + return _this; +} + +void goom_heap_delete(GoomHeap *_this) +{ + int i; + for (i=0;i<_this->number_of_arrays;++i) { + free(_this->arrays[i]); + } + free(_this->arrays); + free(_this); +} + +static void align_it(GoomHeap *_this, int alignment) +{ + if ((alignment > 1) && (_this->number_of_arrays>0)) { + void *last_array = _this->arrays[_this->number_of_arrays - 1]; + int last_address = (int)last_array + _this->consumed_in_last_array; + int decal = (last_address % alignment); + if (decal != 0) { + _this->consumed_in_last_array += alignment - decal; + } + } +} + +void *goom_heap_malloc_with_alignment_prefixed(GoomHeap *_this, int nb_bytes, + int alignment, int prefix_bytes) +{ + void *retval = NULL; + + /* d'abord on gere les problemes d'alignement */ + _this->consumed_in_last_array += prefix_bytes; + align_it(_this, alignment); + + /* ensuite on verifie que la quantite de memoire demandee tient dans le buffer */ + if ((_this->consumed_in_last_array + nb_bytes >= _this->size_of_each_array) + || (_this->number_of_arrays == 0)) { + + if (prefix_bytes + nb_bytes + alignment >= _this->size_of_each_array) { + + /* Si la zone demandee est plus grosse que la granularitee */ + /* On alloue un buffer plus gros que les autres */ + _this->arrays = (void**)realloc(_this->arrays, sizeof(void*) * (_this->number_of_arrays+2)); + + _this->number_of_arrays += 1; + _this->consumed_in_last_array = prefix_bytes; + + _this->arrays[_this->number_of_arrays - 1] = malloc(prefix_bytes + nb_bytes + alignment); + align_it(_this,alignment); + retval = (void*)((char*)_this->arrays[_this->number_of_arrays - 1] + _this->consumed_in_last_array); + + /* puis on repart sur un nouveau buffer vide */ + _this->number_of_arrays += 1; + _this->consumed_in_last_array = 0; + _this->arrays[_this->number_of_arrays - 1] = malloc(_this->size_of_each_array); + return retval; + } + else { + _this->number_of_arrays += 1; + _this->consumed_in_last_array = prefix_bytes; + _this->arrays = (void**)realloc(_this->arrays, sizeof(void*) * _this->number_of_arrays); + + _this->arrays[_this->number_of_arrays - 1] = malloc(_this->size_of_each_array); + align_it(_this,alignment); + } + } + retval = (void*)((char*)_this->arrays[_this->number_of_arrays - 1] + _this->consumed_in_last_array); + _this->consumed_in_last_array += nb_bytes; + return retval; +} + +void *goom_heap_malloc_with_alignment(GoomHeap *_this, int nb_bytes, int alignment) +{ + return goom_heap_malloc_with_alignment_prefixed(_this, nb_bytes, alignment, 0); +} + +void *goom_heap_malloc(GoomHeap *_this, int nb_bytes) +{ + return goom_heap_malloc_with_alignment(_this,nb_bytes,1); +} + diff --git a/src/post/goom/goomsl_heap.h b/src/post/goom/goomsl_heap.h new file mode 100644 index 000000000..a22bac695 --- /dev/null +++ b/src/post/goom/goomsl_heap.h @@ -0,0 +1,29 @@ +#ifndef GOOMSL_HEAP +#define GOOMSL_HEAP + +/** + * Resizable Array that guarranty that resizes don't change address of + * the stored datas. + * + * This is implemented as an array of arrays... granularity is the size + * of each arrays. + */ + +typedef struct _GOOM_HEAP GoomHeap; + +/* Constructors / Destructor */ +GoomHeap *goom_heap_new(void); +GoomHeap *goom_heap_new_with_granularity(int granularity); +void goom_heap_delete(GoomHeap *_this); + +/* This method behaves like malloc. */ +void *goom_heap_malloc(GoomHeap *_this, int nb_bytes); +/* This adds an alignment constraint. */ +void *goom_heap_malloc_with_alignment(GoomHeap *_this, int nb_bytes, int alignment); + +/* Returns a pointeur on the bytes... prefix is before */ +void *goom_heap_malloc_with_alignment_prefixed(GoomHeap *_this, int nb_bytes, + int alignment, int prefix_bytes); + +#endif + diff --git a/src/post/goom/goomsl_lex.c b/src/post/goom/goomsl_lex.c index e0b0841b0..988fb99da 100644 --- a/src/post/goom/goomsl_lex.c +++ b/src/post/goom/goomsl_lex.c @@ -1,32 +1,86 @@ -/* A lexical scanner generated by flex */ +#line 2 "goomsl_lex.c" -/* Scanner skeleton version: - * $Header: /nfshome/cvs/xine-lib/src/post/goom/goomsl_lex.c,v 1.1 2004/11/21 15:10:40 mroi Exp $ - */ +#line 4 "goomsl_lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ +/* begin standard C headers. */ #include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) #endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) #endif +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include <stdlib.h> -#include <unistd.h> - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -34,34 +88,17 @@ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -76,71 +113,84 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#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 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. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif 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 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ -typedef unsigned int yy_size_t; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -177,12 +227,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -196,23 +250,33 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -static YY_BUFFER_STATE yy_current_buffer = 0; +/* 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. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - int yyleng; /* Points to current character in buffer. */ @@ -225,99 +289,162 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_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 ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#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 ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( 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,int len ); + +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 ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + 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 ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +#define YY_FLEX_LEX_COMPAT +extern int yylineno; + +int yylineno = 1; + +extern char yytext[]; + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst 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 = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + if ( yyleng + (yy_more_offset) >= YYLMAX ) \ + YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ + yy_flex_strncpy( &yytext[(yy_more_offset)], (yytext_ptr), yyleng + 1 ); \ + yyleng += (yy_more_offset); \ + (yy_prev_more_offset) = (yy_more_offset); \ + (yy_more_offset) = 0; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 49 +#define YY_END_OF_BUFFER 50 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[214] = + { 0, + 50, 48, 49, 47, 48, 49, 4, 49, 48, 49, + 13, 48, 49, 10, 48, 49, 33, 48, 49, 48, + 49, 48, 49, 48, 49, 48, 49, 48, 49, 34, + 48, 49, 34, 48, 49, 48, 49, 48, 49, 33, + 48, 49, 33, 48, 49, 33, 48, 49, 33, 48, + 49, 33, 48, 49, 33, 48, 49, 33, 48, 49, + 33, 48, 49, 33, 48, 49, 33, 48, 49, 47, + 48, 49, 1, 4, 49, 48, 49, 7, 49, 6, + 49, 7, 49, 7, 49, 1, 6, 49, 7, 49, + 3, 49, 1, 3, 49, 17, 49, 49, 16, 17, + + 49, 17, 49, 47, 45, 10, 10, 10, 33, 40, + 39, 41, 11, 12, 42, 38, 37, 34, 43, 46, + 44, 33, 33, 28, 33, 33, 33, 33, 33, 30, + 33, 33, 33, 33, 33, 33, 47, 1, 12, 5, + 15, 14, 10, 10, 35, 37, 36, 33, 33, 33, + 33, 33, 29, 33, 19, 33, 26, 33, 21, 33, + 33, 33, 33, 2, 10, 10, 33, 33, 33, 33, + 33, 33, 33, 31, 33, 33, 10, 10, 33, 33, + 33, 32, 33, 18, 33, 33, 33, 27, 33, 10, + 10, 33, 33, 33, 22, 33, 25, 33, 10, 9, + + 10, 10, 20, 33, 23, 33, 33, 10, 24, 33, + 10, 8, 10 + } ; -#define YY_NUM_RULES 39 -#define YY_END_OF_BUFFER 40 -static yyconst short int yy_accept[125] = +static yyconst flex_int16_t yy_accept[152] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 40, 38, - 37, 4, 12, 9, 38, 38, 38, 38, 27, 27, - 38, 38, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 37, 1, 38, 6, 39, 6, 6, 1, 6, - 3, 1, 16, 15, 16, 37, 9, 9, 9, 32, - 31, 0, 33, 10, 11, 34, 30, 29, 27, 0, - 35, 36, 26, 26, 25, 26, 26, 26, 26, 26, - 26, 26, 37, 1, 0, 11, 5, 0, 0, 14, - 13, 9, 9, 29, 28, 26, 26, 26, 18, 23, - 19, 26, 26, 0, 2, 9, 9, 26, 26, 26, - - 26, 26, 9, 9, 26, 26, 17, 26, 24, 9, - 9, 26, 26, 20, 9, 8, 9, 21, 26, 9, - 22, 9, 7, 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 4, 7, 9, 11, 14, 17, 20, 22, 24, 26, + 28, 30, 33, 36, 38, 40, 43, 46, 49, 52, + 55, 58, 61, 64, 67, 70, 73, 76, 78, 80, + 82, 84, 86, 89, 91, 93, 96, 98, 99, 102, + 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 119, 120, 121, + 122, 123, 124, 126, 127, 128, 129, 130, 132, 133, + 134, 135, 136, 137, 138, 139, 139, 140, 141, 141, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + + 151, 152, 153, 155, 157, 159, 161, 162, 163, 164, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 176, 177, 178, 179, 180, 181, 182, 184, 186, + 187, 188, 190, 191, 192, 193, 194, 195, 197, 199, + 200, 202, 203, 205, 207, 208, 209, 211, 212, 214, + 214 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t 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, 4, 1, 5, 6, 1, 7, 1, 1, 1, - 1, 8, 9, 1, 10, 11, 12, 13, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 1, 1, 15, - 16, 17, 1, 1, 18, 18, 18, 18, 19, 20, - 18, 18, 21, 18, 18, 22, 18, 23, 18, 18, - 18, 24, 25, 26, 18, 18, 18, 18, 18, 18, - 1, 27, 1, 1, 28, 1, 29, 30, 31, 32, - - 33, 34, 35, 36, 37, 18, 18, 38, 18, 39, - 40, 41, 18, 42, 43, 44, 18, 18, 45, 46, - 18, 18, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 7, 1, 8, 9, 10, 1, + 1, 11, 12, 1, 13, 14, 15, 16, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 1, 1, 18, + 19, 20, 1, 9, 21, 21, 21, 21, 22, 23, + 21, 21, 24, 21, 21, 25, 21, 26, 21, 21, + 21, 27, 28, 29, 21, 21, 21, 21, 21, 21, + 1, 30, 1, 1, 31, 1, 32, 33, 34, 35, + + 36, 37, 38, 39, 40, 21, 21, 41, 21, 42, + 43, 44, 21, 45, 46, 47, 48, 21, 49, 50, + 21, 21, 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, @@ -334,128 +461,163 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[47] = +static yyconst flex_int32_t yy_meta[51] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 3, 1, 1, 1, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 1, 4, 3, 3, - 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4 + 1, 1, 1, 3, 1, 4, 4, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, + 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 } ; -static yyconst short int yy_base[132] = +static yyconst flex_int16_t yy_base[159] = { 0, - 0, 45, 47, 50, 199, 57, 60, 61, 201, 203, - 66, 203, 203, 47, 184, 183, 59, 66, 70, 78, - 182, 181, 0, 46, 150, 157, 155, 153, 148, 147, - 154, 91, 203, 88, 203, 203, 177, 95, 203, 176, - 203, 203, 203, 203, 51, 104, 0, 166, 161, 203, - 203, 98, 203, 203, 203, 203, 203, 88, 106, 0, - 203, 203, 0, 154, 0, 140, 143, 138, 137, 138, - 137, 141, 119, 203, 165, 173, 203, 122, 172, 203, - 203, 152, 147, 101, 0, 134, 138, 141, 0, 0, - 0, 132, 130, 164, 203, 147, 137, 135, 121, 118, - - 122, 127, 155, 136, 115, 115, 0, 109, 0, 127, - 111, 97, 100, 0, 122, 121, 95, 0, 72, 61, - 0, 70, 0, 203, 134, 138, 142, 144, 48, 148, - 152 + 0, 49, 51, 54, 221, 57, 60, 64, 223, 225, + 69, 225, 203, 225, 51, 0, 0, 202, 201, 200, + 64, 68, 72, 72, 199, 174, 57, 166, 55, 173, + 171, 166, 165, 166, 171, 99, 225, 93, 225, 225, + 194, 107, 225, 193, 225, 225, 225, 225, 225, 71, + 93, 225, 0, 183, 178, 0, 195, 225, 225, 225, + 225, 225, 225, 225, 89, 107, 0, 225, 225, 225, + 161, 169, 0, 155, 160, 157, 154, 151, 150, 151, + 150, 146, 153, 123, 225, 177, 188, 225, 126, 187, + 225, 225, 164, 159, 225, 100, 0, 146, 145, 149, + + 138, 151, 0, 0, 0, 0, 59, 146, 140, 177, + 225, 157, 147, 141, 144, 130, 138, 126, 130, 137, + 0, 134, 165, 143, 133, 112, 109, 0, 0, 102, + 92, 0, 130, 112, 93, 98, 101, 0, 0, 125, + 124, 94, 0, 0, 78, 59, 0, 61, 0, 225, + 141, 145, 149, 151, 155, 51, 159, 163 } ; -static yyconst short int yy_def[132] = +static yyconst flex_int16_t yy_def[159] = { 0, - 124, 1, 125, 125, 125, 125, 126, 126, 124, 124, - 124, 124, 124, 127, 124, 124, 124, 124, 124, 124, - 124, 124, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 127, 127, 127, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 129, - 124, 124, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 124, 124, 124, 130, 124, 124, 130, 124, - 124, 127, 127, 124, 129, 128, 128, 128, 128, 128, - 128, 128, 128, 130, 124, 127, 127, 128, 128, 128, - - 128, 128, 127, 127, 128, 128, 128, 128, 128, 131, - 127, 128, 128, 128, 131, 131, 127, 128, 128, 127, - 128, 127, 127, 0, 124, 124, 124, 124, 124, 124, - 124 + 150, 1, 151, 151, 151, 151, 152, 152, 150, 150, + 150, 150, 150, 150, 153, 154, 155, 150, 150, 150, + 150, 150, 150, 150, 150, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 153, 153, 153, 154, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 156, 150, 150, 150, + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 150, 150, 150, 157, 150, 150, 157, + 150, 150, 153, 153, 150, 150, 156, 154, 154, 154, + + 154, 154, 154, 154, 154, 154, 154, 154, 154, 157, + 150, 153, 153, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 153, 153, 154, 154, 154, 154, 154, 154, + 154, 154, 158, 153, 154, 154, 154, 154, 154, 158, + 158, 153, 154, 154, 154, 153, 154, 153, 153, 0, + 150, 150, 150, 150, 150, 150, 150, 150 } ; -static yyconst short int yy_nxt[250] = +static yyconst flex_int16_t yy_nxt[276] = { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 17, - 10, 18, 19, 20, 21, 10, 22, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 10, 23, 23, 23, - 23, 24, 25, 26, 23, 23, 27, 23, 28, 23, - 29, 23, 30, 23, 31, 23, 32, 33, 32, 36, - 85, 38, 39, 38, 37, 80, 34, 37, 38, 42, - 38, 40, 36, 36, 44, 44, 48, 46, 40, 46, - 49, 52, 52, 54, 53, 123, 57, 55, 64, 122, - 58, 56, 59, 59, 57, 65, 45, 45, 58, 81, - 59, 59, 73, 74, 73, 54, 78, 74, 78, 76, - - 84, 84, 75, 56, 57, 46, 75, 46, 58, 121, - 52, 52, 57, 84, 84, 60, 58, 120, 59, 59, - 73, 74, 73, 78, 74, 78, 116, 116, 119, 118, - 75, 117, 116, 75, 35, 35, 35, 35, 43, 43, - 43, 43, 47, 114, 47, 47, 63, 63, 94, 94, - 94, 94, 115, 113, 115, 115, 112, 111, 110, 109, - 108, 107, 106, 105, 104, 103, 95, 102, 101, 100, - 99, 98, 97, 96, 95, 95, 79, 93, 92, 91, - 90, 89, 88, 87, 86, 83, 82, 79, 77, 72, - 71, 70, 69, 68, 67, 66, 62, 61, 51, 50, - - 124, 41, 9, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124 + 10, 11, 12, 11, 13, 14, 15, 10, 16, 17, + 18, 19, 20, 10, 21, 22, 23, 24, 10, 25, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 10, + 16, 16, 26, 16, 27, 28, 29, 16, 16, 30, + 16, 31, 16, 32, 16, 33, 34, 16, 35, 16, + 36, 37, 36, 40, 97, 42, 43, 42, 42, 46, + 42, 41, 48, 38, 41, 49, 48, 149, 44, 49, + 51, 44, 51, 54, 61, 64, 91, 55, 62, 64, + 148, 65, 63, 66, 66, 65, 75, 66, 66, 50, + 68, 69, 72, 50, 51, 76, 51, 77, 119, 73, + + 84, 85, 84, 61, 96, 96, 120, 87, 89, 85, + 89, 63, 92, 86, 64, 96, 96, 67, 147, 146, + 65, 86, 66, 66, 84, 85, 84, 89, 85, 89, + 141, 141, 145, 144, 143, 142, 141, 86, 139, 138, + 86, 39, 39, 39, 39, 47, 47, 47, 47, 53, + 137, 53, 53, 56, 56, 57, 136, 57, 57, 110, + 110, 110, 110, 140, 135, 140, 140, 134, 133, 132, + 131, 130, 129, 128, 127, 126, 125, 124, 123, 111, + 122, 121, 118, 117, 116, 115, 114, 113, 112, 111, + 111, 90, 109, 108, 107, 106, 105, 104, 103, 102, + + 101, 100, 99, 98, 95, 94, 93, 90, 88, 83, + 82, 81, 80, 79, 78, 74, 71, 70, 60, 59, + 58, 52, 150, 45, 9, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150 } ; -static yyconst short int yy_chk[250] = +static yyconst flex_int16_t yy_chk[276] = { 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, 1, 1, 1, 2, 2, 2, 3, - 129, 4, 4, 4, 3, 45, 2, 4, 6, 6, - 6, 4, 7, 8, 7, 8, 14, 11, 6, 11, - 14, 17, 17, 18, 17, 122, 19, 18, 24, 120, - 19, 18, 19, 19, 20, 24, 7, 8, 20, 45, - 20, 20, 32, 32, 32, 34, 38, 38, 38, 34, - - 58, 58, 32, 34, 52, 46, 38, 46, 52, 119, - 52, 52, 59, 84, 84, 19, 59, 117, 59, 59, - 73, 73, 73, 78, 78, 78, 116, 115, 113, 112, - 73, 111, 110, 78, 125, 125, 125, 125, 126, 126, - 126, 126, 127, 108, 127, 127, 128, 128, 130, 130, - 130, 130, 131, 106, 131, 131, 105, 104, 103, 102, - 101, 100, 99, 98, 97, 96, 94, 93, 92, 88, - 87, 86, 83, 82, 79, 76, 75, 72, 71, 70, - 69, 68, 67, 66, 64, 49, 48, 40, 37, 31, - 30, 29, 28, 27, 26, 25, 22, 21, 16, 15, - - 9, 5, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 3, 156, 4, 4, 4, 6, 6, + 6, 3, 7, 2, 4, 7, 8, 148, 4, 8, + 11, 6, 11, 15, 21, 22, 50, 15, 21, 23, + 146, 22, 21, 22, 22, 23, 29, 23, 23, 7, + 24, 24, 27, 8, 51, 29, 51, 29, 107, 27, + + 36, 36, 36, 38, 65, 65, 107, 38, 42, 42, + 42, 38, 50, 36, 66, 96, 96, 22, 145, 142, + 66, 42, 66, 66, 84, 84, 84, 89, 89, 89, + 141, 140, 137, 136, 135, 134, 133, 84, 131, 130, + 89, 151, 151, 151, 151, 152, 152, 152, 152, 153, + 127, 153, 153, 154, 154, 155, 126, 155, 155, 157, + 157, 157, 157, 158, 125, 158, 158, 124, 123, 122, + 120, 119, 118, 117, 116, 115, 114, 113, 112, 110, + 109, 108, 102, 101, 100, 99, 98, 94, 93, 90, + 87, 86, 83, 82, 81, 80, 79, 78, 77, 76, + + 75, 74, 72, 71, 57, 55, 54, 44, 41, 35, + 34, 33, 32, 31, 30, 28, 26, 25, 20, 19, + 18, 13, 9, 5, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150 } ; -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[50] = + { 0, +1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; +static char *yy_full_match; +static int yy_lp; +#define REJECT \ +{ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ +yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ +++(yy_lp); \ +goto find_rule; \ +} + +static int yy_more_offset = 0; +static int yy_prev_more_offset = 0; +#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext )) +#define YY_NEED_STRLEN #define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +#define YY_RESTORE_YY_MORE_OFFSET \ + { \ + (yy_more_offset) = (yy_prev_more_offset); \ + yyleng -= (yy_more_offset); \ + } +#ifndef YYLMAX +#define YYLMAX 8192 +#endif + +char yytext[YYLMAX]; +char *yytext_ptr; #line 1 "goomsl_lex.l" -#define INITIAL 0 #line 2 "goomsl_lex.l" #include <math.h> @@ -470,13 +632,25 @@ void yyparse(void); GoomSL *currentGoomSL; static int string_size; static char string[1024]; -#define C_COMMENT 1 -#define LINE_COMMENT 2 + +#line 639 "goomsl_lex.c" + +#define INITIAL 0 +#define C_COMMENT 1 +#define LINE_COMMENT 2 #define STRING 3 -#line 480 "goomsl_lex.c" +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif /* Macros after this point can all be overridden by user definitions in * section 1. @@ -484,65 +658,30 @@ static char string[1024]; #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap (void ); #else -extern int yywrap YY_PROTO(( void )); -#endif +extern int yywrap (void ); #endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); +static int input (void ); #endif -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -551,7 +690,6 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -564,9 +702,10 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -576,9 +715,22 @@ YY_MALLOC_DECL YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -599,12 +751,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -620,32 +778,36 @@ YY_MALLOC_DECL #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION -YY_DECL; +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 25 "goomsl_lex.l" -#line 637 "goomsl_lex.c" +#line 797 "goomsl_lex.c" - if ( yy_init ) + if ( (yy_init) ) { - yy_init = 0; + (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_state_buf) ) + (yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 ); + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -653,87 +815,104 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); /* Support of yytext. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } 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 >= 125 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 203 ); + while ( yy_base[yy_current_state] != 225 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[(yy_lp)]; + { + (yy_full_match) = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; +; + } do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - case 1: +/* rule 1 can match eol */ YY_RULE_SETUP #line 27 "goomsl_lex.l" { ++currentGoomSL->num_lines; /* Ignore empty lines */ } YY_BREAK case 2: +/* rule 2 can match eol */ YY_RULE_SETUP #line 28 "goomsl_lex.l" { ++currentGoomSL->num_lines; /* Ignore empty lines */ } YY_BREAK case 3: +/* rule 3 can match eol */ YY_RULE_SETUP #line 30 "goomsl_lex.l" { ++currentGoomSL->num_lines; yylval.charValue=*yytext; BEGIN INITIAL; return '\n'; } YY_BREAK case 4: +/* rule 4 can match eol */ YY_RULE_SETUP #line 31 "goomsl_lex.l" { ++currentGoomSL->num_lines; yylval.charValue=*yytext; return '\n'; } @@ -744,53 +923,59 @@ YY_RULE_SETUP { BEGIN INITIAL; } YY_BREAK case 6: +/* rule 6 can match eol */ YY_RULE_SETUP #line 34 "goomsl_lex.l" -{ /* eat up comment */ } +{ ++currentGoomSL->num_lines; } YY_BREAK case 7: YY_RULE_SETUP -#line 36 "goomsl_lex.l" -{ currentGoomSL->num_lines = 0; } +#line 35 "goomsl_lex.l" +{ /* eat up comment */ } YY_BREAK case 8: YY_RULE_SETUP #line 37 "goomsl_lex.l" -{ currentGoomSL->num_lines = 0; printf("%s\n", yytext); } +{ currentGoomSL->num_lines = 0; } YY_BREAK case 9: YY_RULE_SETUP #line 38 "goomsl_lex.l" -{ /* ignore preprocessor lines */ } +{ currentGoomSL->num_lines = 0; printf("%s\n", yytext); } YY_BREAK case 10: YY_RULE_SETUP -#line 40 "goomsl_lex.l" -{ BEGIN C_COMMENT; } +#line 39 "goomsl_lex.l" +{ /* ignore preprocessor lines */ } YY_BREAK case 11: YY_RULE_SETUP #line 41 "goomsl_lex.l" -{ BEGIN LINE_COMMENT; } +{ BEGIN C_COMMENT; } YY_BREAK case 12: YY_RULE_SETUP #line 42 "goomsl_lex.l" -{ BEGIN STRING; string_size=0; } +{ BEGIN LINE_COMMENT; } YY_BREAK case 13: YY_RULE_SETUP -#line 44 "goomsl_lex.l" -{ string[string_size++] = '\n'; } +#line 43 "goomsl_lex.l" +{ BEGIN STRING; string_size=0; } YY_BREAK case 14: YY_RULE_SETUP #line 45 "goomsl_lex.l" -{ string[string_size++] = '\"'; } +{ string[string_size++] = '\n'; } YY_BREAK case 15: YY_RULE_SETUP #line 46 "goomsl_lex.l" +{ string[string_size++] = '\"'; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 47 "goomsl_lex.l" { /* fin de la chaine: on cree le pointeur qui va bien */ unsigned int tmp; BEGIN INITIAL; @@ -798,159 +983,204 @@ YY_RULE_SETUP tmp = gsl_malloc(currentGoomSL, string_size+1); strcpy((char*)currentGoomSL->ptrArray[tmp],string); sprintf(yylval.strValue, "0x%08x", tmp); - return TYPE_PTR; + return LTYPE_PTR; } YY_BREAK -case 16: -YY_RULE_SETUP -#line 55 "goomsl_lex.l" -{ string[string_size++] = *yytext; } - YY_BREAK case 17: YY_RULE_SETUP -#line 57 "goomsl_lex.l" -{ return FLOAT_TK; } +#line 56 "goomsl_lex.l" +{ string[string_size++] = *yytext; } YY_BREAK case 18: YY_RULE_SETUP #line 58 "goomsl_lex.l" -{ return INT_TK; } +{ return FLOAT_TK; } YY_BREAK case 19: YY_RULE_SETUP #line 59 "goomsl_lex.l" -{ return PTR_TK; } +{ return INT_TK; } YY_BREAK case 20: YY_RULE_SETUP #line 60 "goomsl_lex.l" -{ return PTR_TK; } +{ return INT_TK; } YY_BREAK case 21: YY_RULE_SETUP #line 61 "goomsl_lex.l" -{ return DECLARE; } +{ return PTR_TK; } YY_BREAK case 22: YY_RULE_SETUP #line 62 "goomsl_lex.l" -{ return EXTERNAL; } +{ return PTR_TK; } YY_BREAK case 23: YY_RULE_SETUP #line 63 "goomsl_lex.l" -{ return NOT; } +{ return DECLARE; } YY_BREAK case 24: YY_RULE_SETUP #line 64 "goomsl_lex.l" -{ return WHILE; } +{ return EXTERNAL; } YY_BREAK case 25: YY_RULE_SETUP #line 65 "goomsl_lex.l" -{ return DO; } +{ return STRUCT; } YY_BREAK case 26: YY_RULE_SETUP #line 66 "goomsl_lex.l" -{ strncpy(yylval.strValue, yytext, 2047); return TYPE_VAR; } +{ return NOT; } YY_BREAK case 27: YY_RULE_SETUP #line 67 "goomsl_lex.l" -{ strncpy(yylval.strValue, yytext, 2047); return TYPE_INTEGER; } +{ return WHILE; } YY_BREAK case 28: YY_RULE_SETUP #line 68 "goomsl_lex.l" -{ strncpy(yylval.strValue, yytext, 2047); return TYPE_INTEGER; } +{ return DO; } YY_BREAK case 29: YY_RULE_SETUP #line 69 "goomsl_lex.l" -{ strncpy(yylval.strValue, yytext, 2047); return TYPE_FLOAT; } +{ return FOR; } YY_BREAK case 30: YY_RULE_SETUP #line 70 "goomsl_lex.l" -{ sprintf(yylval.strValue, "%3.2f", atof(yytext)/100.0f); return TYPE_FLOAT; } +{ return IN; } YY_BREAK case 31: YY_RULE_SETUP #line 71 "goomsl_lex.l" -{ return PLUS_EQ; } +{ strncpy(yylval.strValue, "1", 2047); return LTYPE_INTEGER; } YY_BREAK case 32: YY_RULE_SETUP #line 72 "goomsl_lex.l" -{ return PLUS_EQ; } +{ strncpy(yylval.strValue, "0", 2047); return LTYPE_INTEGER; } YY_BREAK case 33: YY_RULE_SETUP #line 73 "goomsl_lex.l" -{ return PLUS_EQ; } +{ strncpy(yylval.strValue, yytext, 2047); return LTYPE_VAR; } YY_BREAK case 34: YY_RULE_SETUP #line 74 "goomsl_lex.l" -{ return PLUS_EQ; } +{ strncpy(yylval.strValue, yytext, 2047); return LTYPE_INTEGER; } YY_BREAK case 35: YY_RULE_SETUP #line 75 "goomsl_lex.l" -{ return LOW_EQ; } +{ sprintf(yylval.strValue, "%d", (int)yytext[1]); return LTYPE_INTEGER; } YY_BREAK case 36: YY_RULE_SETUP #line 76 "goomsl_lex.l" -{ return SUP_EQ; } +{ strncpy(yylval.strValue, yytext, 2047); return LTYPE_INTEGER; } YY_BREAK case 37: YY_RULE_SETUP #line 77 "goomsl_lex.l" -/* eat up whitespace */ +{ strncpy(yylval.strValue, yytext, 2047); return LTYPE_FLOAT; } YY_BREAK case 38: YY_RULE_SETUP #line 78 "goomsl_lex.l" -{ yylval.charValue = *yytext; return *yytext; } +{ sprintf(yylval.strValue, "%3.2f", atof(yytext)/100.0f); return LTYPE_FLOAT; } YY_BREAK case 39: YY_RULE_SETUP +#line 79 "goomsl_lex.l" +{ return PLUS_EQ; } + YY_BREAK +case 40: +YY_RULE_SETUP #line 80 "goomsl_lex.l" +{ return MUL_EQ; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 81 "goomsl_lex.l" +{ return SUB_EQ; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 82 "goomsl_lex.l" +{ return DIV_EQ; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 83 "goomsl_lex.l" +{ return LOW_EQ; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 84 "goomsl_lex.l" +{ return SUP_EQ; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 85 "goomsl_lex.l" +{ return NOT_EQ; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 86 "goomsl_lex.l" +{ return NOT_EQ; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 87 "goomsl_lex.l" +/* eat up whitespace */ + YY_BREAK +case 48: +YY_RULE_SETUP +#line 88 "goomsl_lex.l" +{ yylval.charValue = *yytext; return *yytext; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 90 "goomsl_lex.l" ECHO; YY_BREAK -#line 924 "goomsl_lex.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(C_COMMENT): -case YY_STATE_EOF(LINE_COMMENT): -case YY_STATE_EOF(STRING): - yyterminate(); +#line 1155 "goomsl_lex.c" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(C_COMMENT): + case YY_STATE_EOF(LINE_COMMENT): + case YY_STATE_EOF(STRING): + yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -960,13 +1190,13 @@ case YY_STATE_EOF(STRING): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -979,30 +1209,30 @@ case YY_STATE_EOF(STRING): yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (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 @@ -1013,7 +1243,7 @@ case YY_STATE_EOF(STRING): * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1021,30 +1251,30 @@ case YY_STATE_EOF(STRING): else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1055,8 +1285,7 @@ case YY_STATE_EOF(STRING): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1065,21 +1294,20 @@ case YY_STATE_EOF(STRING): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1099,86 +1327,52 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (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++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT + YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1186,153 +1380,137 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } 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 >= 125 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - + register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } 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 >= 125 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 124); + yy_is_jam = (yy_current_state == 150); + if ( ! yy_is_jam ) + *(yy_state_ptr)++ = yy_current_state; return yy_is_jam ? 0 : yy_current_state; - } +} - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; + if ( c == '\n' ){ + --yylineno; + } - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1346,16 +1524,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( yywrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1365,91 +1543,98 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + yylineno++; +; return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +} +#endif /* ifndef YY_NO_INPUT */ - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); } + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1458,80 +1643,75 @@ int 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 *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc(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; - } - +} -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } + yyfree((void *) b->yy_ch_buf ); + yyfree((void *) b ); +} -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1548,29 +1728,121 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } +} +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * 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; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + 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; + } -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + if ( size < 2 || 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; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1584,47 +1856,42 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * str ) +{ + + return yy_scan_bytes(str,strlen(str) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1633,7 +1900,7 @@ int len; buf[len] = buf[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()" ); @@ -1643,78 +1910,17 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -1723,68 +1929,147 @@ char msg[]; do \ { \ /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} -/* Internal utility routines. */ +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + yyfree ( (yy_state_buf) ); + + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *yyalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *yyrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1793,28 +2078,31 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} -#if YY_MAIN -int main() - { - yylex(); - return 0; - } +#define YYTABLES_NAME "yytables" + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 80 "goomsl_lex.l" +#line 90 "goomsl_lex.l" + int yywrap(void) { return 1; yyunput(0,0); } + diff --git a/src/post/goom/goomsl_private.h b/src/post/goom/goomsl_private.h index 0b3c419d5..8be151577 100644 --- a/src/post/goom/goomsl_private.h +++ b/src/post/goom/goomsl_private.h @@ -9,6 +9,8 @@ #include "jitc_x86.h" #endif +#include "goomsl_heap.h" + /* {{{ type of nodes */ #define EMPTY_NODE 0 #define CONST_INT_NODE 1 @@ -41,6 +43,8 @@ #define OPR_DIV_EQ 19 #define OPR_CALL_EXPR 20 #define OPR_AFFECT_LIST 21 +#define OPR_FOREACH 22 +#define OPR_VAR_LIST 23 /* }}} */ @@ -71,35 +75,26 @@ typedef struct _NODE_TYPE { /* {{{ */ OprNodeType opr; } unode; } NodeType; /* }}} */ -typedef union _INSTRUCTION_DATA { /* {{{ */ +typedef struct _INSTRUCTION_DATA { /* {{{ */ - /* VAR - PTR */ - struct { - HashValue *var; - int value; - } v_p; - /* VAR - INTEGER */ - struct { - HashValue *var; - int value; - } v_i; - /* VAR - FLOAT */ - struct { - HashValue *var; - float value; - } v_f; - /* VAR - VAR */ - struct { - HashValue *var_src; - HashValue *var_dest; - } v_v; - /* VAR */ - struct { - int jump_offset; - HashValue *var; - } v; - int jump_offset; - struct _ExternalFunctionStruct *external_function; + union { + void *var; + int *var_int; + int *var_ptr; + float *var_float; + int jump_offset; + struct _ExternalFunctionStruct *external_function; + } udest; + + union { + void *var; + int *var_int; + int *var_ptr; + float *var_float; + int value_int; + int value_ptr; + float value_float; + } usrc; } InstructionData; /* }}} */ typedef struct _INSTRUCTION { /* {{{ */ @@ -121,29 +116,52 @@ typedef struct _INSTRUCTION { /* {{{ */ int line_number; -} Instruction; /* }}} */ +} Instruction; +/* }}} */ typedef struct _INSTRUCTION_FLOW { /* {{{ */ Instruction **instr; int number; int tabsize; GoomHash *labels; -} InstructionFlow; /* }}} */ +} InstructionFlow; +/* }}} */ typedef struct _FAST_INSTRUCTION { /* {{{ */ int id; InstructionData data; Instruction *proto; -} FastInstruction; /* }}} */ +} FastInstruction; +/* }}} */ typedef struct _FastInstructionFlow { /* {{{ */ int number; FastInstruction *instr; void *mallocedInstr; -} FastInstructionFlow; /* }}} */ +} FastInstructionFlow; +/* }}} */ typedef struct _ExternalFunctionStruct { /* {{{ */ GoomSL_ExternalFunction function; GoomHash *vars; int is_extern; -} ExternalFunctionStruct; /* }}} */ +} ExternalFunctionStruct; +/* }}} */ +typedef struct _Block { + int data; + int size; +} Block; +typedef struct _GSL_StructField { /* {{{ */ + int type; + char name[256]; + int offsetInStruct; /* Where this field is stored... */ +} GSL_StructField; + /* }}} */ +typedef struct _GSL_Struct { /* {{{ */ + int nbFields; + GSL_StructField *fields[64]; + int size; + Block iBlock[64]; + Block fBlock[64]; +} GSL_Struct; + /* }}} */ struct _GoomSL { /* {{{ */ int num_lines; Instruction *instr; /* instruction en cours de construction */ @@ -157,6 +175,13 @@ struct _GoomSL { /* {{{ */ GoomHash *functions; /* table des fonctions externes */ + GoomHeap *data_heap; /* GSL Heap-like memory space */ + + int nbStructID; + GoomHash *structIDS; + GSL_Struct **gsl_struct; + int gsl_struct_size; + int nbPtr; int ptrArraySize; void **ptrArray; @@ -177,21 +202,30 @@ void gsl_instr_set_namespace(Instruction *_this, GoomHash *ns); void gsl_declare_task(const char *name); void gsl_declare_external_task(const char *name); +int gsl_type_of_var(GoomHash *namespace, const char *name); + void gsl_enternamespace(const char *name); -void gsl_leavenamespace(void); +void gsl_reenternamespace(GoomHash *ns); +GoomHash *gsl_leavenamespace(void); GoomHash *gsl_find_namespace(const char *name); void gsl_commit_compilation(void); -/* #define TYPE_PARAM 1 - #define TYPE_INTEGER 2 - #define TYPE_FLOAT 3 - #define TYPE_VAR 4 */ -#define TYPE_LABEL 5 +/* #define TYPE_PARAM 1 */ + +#define FIRST_RESERVED 0x80000 + +#define TYPE_INTEGER 0x90001 +#define TYPE_FLOAT 0x90002 +#define TYPE_VAR 0x90003 +#define TYPE_PTR 0x90004 +#define TYPE_LABEL 0x90005 + #define TYPE_OP_EQUAL 6 -#define TYPE_IVAR 7 -#define TYPE_FVAR 8 -#define TYPE_PVAR 9 +#define TYPE_IVAR 0xa0001 +#define TYPE_FVAR 0xa0002 +#define TYPE_PVAR 0xa0003 +#define TYPE_SVAR 0xa0004 #define INSTR_JUMP 6 #define INSTR_JZERO 29 @@ -200,18 +234,18 @@ void gsl_commit_compilation(void); #define INSTR_EXT_CALL 38 #define INSTR_JNZERO 40 -#define INSTR_SET 10001 -#define INSTR_INT 10002 -#define INSTR_FLOAT 10003 -#define INSTR_PTR 10004 -#define INSTR_LABEL 10005 -#define INSTR_ISLOWER 10006 -#define INSTR_ADD 10007 -#define INSTR_MUL 10008 -#define INSTR_DIV 10009 -#define INSTR_SUB 10010 -#define INSTR_ISEQUAL 10011 -#define INSTR_NOT 10012 +#define INSTR_SET 0x80001 +#define INSTR_INT 0x80002 +#define INSTR_FLOAT 0x80003 +#define INSTR_PTR 0x80004 +#define INSTR_LABEL 0x80005 +#define INSTR_ISLOWER 0x80006 +#define INSTR_ADD 0x80007 +#define INSTR_MUL 0x80008 +#define INSTR_DIV 0x80009 +#define INSTR_SUB 0x80010 +#define INSTR_ISEQUAL 0x80011 +#define INSTR_NOT 0x80012 #endif diff --git a/src/post/goom/goomsl_yacc.c b/src/post/goom/goomsl_yacc.c index b29d5caef..589b171be 100644 --- a/src/post/goom/goomsl_yacc.c +++ b/src/post/goom/goomsl_yacc.c @@ -1,28 +1,109 @@ +/* A Bison parser, made by GNU Bison 1.875. */ -/* A Bison parser, made from goomsl_yacc.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define TYPE_INTEGER 257 -#define TYPE_FLOAT 258 -#define TYPE_VAR 259 -#define TYPE_PTR 260 -#define PTR_TK 261 -#define INT_TK 262 -#define FLOAT_TK 263 -#define DECLARE 264 -#define EXTERNAL 265 -#define WHILE 266 -#define DO 267 -#define NOT 268 -#define PLUS_EQ 269 -#define SUB_EQ 270 -#define DIV_EQ 271 -#define MUL_EQ 272 -#define SUP_EQ 273 -#define LOW_EQ 274 +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + LTYPE_INTEGER = 258, + LTYPE_FLOAT = 259, + LTYPE_VAR = 260, + LTYPE_PTR = 261, + PTR_TK = 262, + INT_TK = 263, + FLOAT_TK = 264, + DECLARE = 265, + EXTERNAL = 266, + WHILE = 267, + DO = 268, + NOT = 269, + PLUS_EQ = 270, + SUB_EQ = 271, + DIV_EQ = 272, + MUL_EQ = 273, + SUP_EQ = 274, + LOW_EQ = 275, + NOT_EQ = 276, + STRUCT = 277, + FOR = 278, + IN = 279 + }; +#endif +#define LTYPE_INTEGER 258 +#define LTYPE_FLOAT 259 +#define LTYPE_VAR 260 +#define LTYPE_PTR 261 +#define PTR_TK 262 +#define INT_TK 263 +#define FLOAT_TK 264 +#define DECLARE 265 +#define EXTERNAL 266 +#define WHILE 267 +#define DO 268 +#define NOT 269 +#define PLUS_EQ 270 +#define SUB_EQ 271 +#define DIV_EQ 272 +#define MUL_EQ 273 +#define SUP_EQ 274 +#define LOW_EQ 275 +#define NOT_EQ 276 +#define STRUCT 277 +#define FOR 278 +#define IN 279 + + + + +/* Copy the first part of user declarations. */ #line 6 "goomsl_yacc.y" #include <stdio.h> @@ -30,7 +111,10 @@ #include <string.h> #include "goomsl.h" #include "goomsl_private.h" - + +#define STRUCT_ALIGNMENT 16 +/* #define VERBOSE */ + int yylex(void); void yyerror(char *); extern GoomSL *currentGoomSL; @@ -50,10 +134,10 @@ static NodeType *new_nop(const char *str); static NodeType *new_op(const char *str, int type, int nbOp); - static int allocateLabel(void); - static int allocateTemp(void); + static int allocateLabel(); + static int allocateTemp(); static void releaseTemp(int n); - static void releaseAllTemps(void); + static void releaseAllTemps(); static int is_tmp_expr(NodeType *node) { if (node->str) { @@ -107,24 +191,269 @@ GSL_PUT_JXXX(name,"jnzero.i",INSTR_JNZERO,line_number); } /* }}} */ + /* Structures Management */ + +#define ALIGN_ADDR(_addr,_align) {\ + if (_align>1) {\ + int _dec = (_addr%_align);\ + if (_dec != 0) _addr += _align - _dec;\ + }} + + /* */ + void gsl_prepare_struct(GSL_Struct *s, int s_align, int i_align, int f_align) + { + int i; + int consumed = 0; + int iblk=0, fblk=0; + + s->iBlock[0].size = 0; + s->iBlock[0].data = 0; + s->fBlock[0].size = 0; + s->fBlock[0].data = 0; + + /* Prepare sub-struct and calculate space needed for their storage */ + for (i = 0; i < s->nbFields; ++i) + { + if (s->fields[i]->type < FIRST_RESERVED) + { + int j=0; + GSL_Struct *substruct = currentGoomSL->gsl_struct[s->fields[i]->type]; + consumed += sizeof(int); /* stocke le prefix */ + ALIGN_ADDR(consumed, s_align); + s->fields[i]->offsetInStruct = consumed; + gsl_prepare_struct(substruct, s_align, i_align, f_align); + for(j=0;substruct->iBlock[j].size>0;++j) { + s->iBlock[iblk].data = consumed + substruct->iBlock[j].data; + s->iBlock[iblk].size = substruct->iBlock[j].size; + iblk++; + } + for(j=0;substruct->fBlock[j].size>0;++j) { + s->fBlock[fblk].data = consumed + substruct->fBlock[j].data; + s->fBlock[fblk].size = substruct->fBlock[j].size; + fblk++; + } + consumed += substruct->size; + } + } + + /* Then prepare integers */ + ALIGN_ADDR(consumed, i_align); + for (i = 0; i < s->nbFields; ++i) + { + if (s->fields[i]->type == INSTR_INT) + { + if (s->iBlock[iblk].size == 0) { + s->iBlock[iblk].size = 1; + s->iBlock[iblk].data = consumed; + } else { + s->iBlock[iblk].size += 1; + } + s->fields[i]->offsetInStruct = consumed; + consumed += sizeof(int); + } + } + + iblk++; + s->iBlock[iblk].size = 0; + s->iBlock[iblk].data = 0; + + /* Then prepare floats */ + ALIGN_ADDR(consumed, f_align); + for (i = 0; i < s->nbFields; ++i) + { + if (s->fields[i]->type == INSTR_FLOAT) + { + if (s->fBlock[fblk].size == 0) { + s->fBlock[fblk].size = 1; + s->fBlock[fblk].data = consumed; + } else { + s->fBlock[fblk].size += 1; + } + s->fields[i]->offsetInStruct = consumed; + consumed += sizeof(int); + } + } + + fblk++; + s->fBlock[fblk].size = 0; + s->fBlock[fblk].data = 0; + + /* Finally prepare pointers */ + ALIGN_ADDR(consumed, i_align); + for (i = 0; i < s->nbFields; ++i) + { + if (s->fields[i]->type == INSTR_PTR) + { + s->fields[i]->offsetInStruct = consumed; + consumed += sizeof(int); + } + } + s->size = consumed; + } + + /* Returns the ID of a struct from its name */ + int gsl_get_struct_id(const char *name) /* {{{ */ + { + HashValue *ret = goom_hash_get(currentGoomSL->structIDS, name); + if (ret != NULL) return ret->i; + return -1; + } /* }}} */ + + /* Adds the definition of a struct */ + void gsl_add_struct(const char *name, GSL_Struct *gsl_struct) /* {{{ */ + { + /* Prepare the struct: ie calculate internal storage format */ + gsl_prepare_struct(gsl_struct, STRUCT_ALIGNMENT, STRUCT_ALIGNMENT, STRUCT_ALIGNMENT); + + /* If the struct does not already exists */ + if (gsl_get_struct_id(name) < 0) + { + /* adds it */ + int id = currentGoomSL->nbStructID++; + goom_hash_put_int(currentGoomSL->structIDS, name, id); + if (currentGoomSL->gsl_struct_size <= id) { + currentGoomSL->gsl_struct_size *= 2; + currentGoomSL->gsl_struct = (GSL_Struct**)realloc(currentGoomSL->gsl_struct, + sizeof(GSL_Struct*) * currentGoomSL->gsl_struct_size); + } + currentGoomSL->gsl_struct[id] = gsl_struct; + } + } /* }}} */ + + /* Creates a field for a struct */ + GSL_StructField *gsl_new_struct_field(const char *name, int type) + { + GSL_StructField *field = (GSL_StructField*)malloc(sizeof(GSL_StructField)); + strcpy(field->name, name); + field->type = type; + return field; + } + + /* Create as field for a struct which will be a struct itself */ + GSL_StructField *gsl_new_struct_field_struct(const char *name, const char *type) + { + GSL_StructField *field = gsl_new_struct_field(name, gsl_get_struct_id(type)); + if (field->type < 0) { + fprintf(stderr, "ERROR: Line %d, Unknown structure: '%s'\n", + currentGoomSL->num_lines, type); + exit(1); + } + return field; + } + + /* Creates a Struct */ + GSL_Struct *gsl_new_struct(GSL_StructField *field) + { + GSL_Struct *s = (GSL_Struct*)malloc(sizeof(GSL_Struct)); + s->nbFields = 1; + s->fields[0] = field; + return s; + } + + /* Adds a field to a struct */ + void gsl_add_struct_field(GSL_Struct *s, GSL_StructField *field) + { + s->fields[s->nbFields++] = field; + } + + int gsl_type_of_var(GoomHash *ns, const char *name) + { + char type_of[256]; + HashValue *hv; + sprintf(type_of, "__type_of_%s", name); + hv = goom_hash_get(ns, type_of); + if (hv != NULL) + return hv->i; + fprintf(stderr, "ERROR: Unknown variable type: '%s'\n", name); + return -1; + } + + static void gsl_declare_var(GoomHash *ns, const char *name, int type, void *space) + { + char type_of[256]; + if (name[0] == '@') { ns = currentGoomSL->vars; } + + if (space == NULL) { + switch (type) { + case INSTR_INT: + case INSTR_FLOAT: + case INSTR_PTR: + space = goom_heap_malloc_with_alignment(currentGoomSL->data_heap, + sizeof(int), sizeof(int)); + break; + case -1: + fprintf(stderr, "What the fuck!\n"); + exit(1); + default: /* On a un struct_id */ + space = goom_heap_malloc_with_alignment_prefixed(currentGoomSL->data_heap, + currentGoomSL->gsl_struct[type]->size, STRUCT_ALIGNMENT, sizeof(int)); + } + } + goom_hash_put_ptr(ns, name, (void*)space); + sprintf(type_of, "__type_of_%s", name); + goom_hash_put_int(ns, type_of, type); + + /* Ensuite le hack: on ajoute les champs en tant que variables. */ + if (type < FIRST_RESERVED) + { + int i; + GSL_Struct *gsl_struct = currentGoomSL->gsl_struct[type]; + ((int*)space)[-1] = type; /* stockage du type dans le prefixe de structure */ + for (i = 0; i < gsl_struct->nbFields; ++i) + { + char full_name[256]; + char *cspace = (char*)space + gsl_struct->fields[i]->offsetInStruct; + sprintf(full_name, "%s.%s", name, gsl_struct->fields[i]->name); + gsl_declare_var(ns, full_name, gsl_struct->fields[i]->type, cspace); + } + } + } + + /* Declare a variable which will be a struct */ + static void gsl_struct_decl(GoomHash *namespace, const char *struct_name, const char *name) + { + int struct_id = gsl_get_struct_id(struct_name); + gsl_declare_var(namespace, name, struct_id, NULL); + } + + static void gsl_float_decl_global(const char *name) + { + gsl_declare_var(currentGoomSL->vars, name, INSTR_FLOAT, NULL); + } + static void gsl_int_decl_global(const char *name) + { + gsl_declare_var(currentGoomSL->vars, name, INSTR_INT, NULL); + } + static void gsl_ptr_decl_global(const char *name) + { + gsl_declare_var(currentGoomSL->vars, name, INSTR_PTR, NULL); + } + static void gsl_struct_decl_global_from_id(const char *name, int id) + { + gsl_declare_var(currentGoomSL->vars, name, id, NULL); + } + /* FLOAT */ - #define gsl_float_decl_global(name) goom_hash_put_int(currentGoomSL->vars,name,INSTR_FLOAT) - #define gsl_int_decl_global(name) goom_hash_put_int(currentGoomSL->vars,name,INSTR_INT) - #define gsl_ptr_decl_global(name) goom_hash_put_int(currentGoomSL->vars,name,INSTR_PTR) - static void gsl_float_decl(const char *name) + static void gsl_float_decl_local(const char *name) { - goom_hash_put_int(currentGoomSL->namespaces[currentGoomSL->currentNS],name,INSTR_FLOAT); + gsl_declare_var(currentGoomSL->namespaces[currentGoomSL->currentNS], name, INSTR_FLOAT, NULL); } /* INT */ - static void gsl_int_decl(const char *name) + static void gsl_int_decl_local(const char *name) { - goom_hash_put_int(currentGoomSL->namespaces[currentGoomSL->currentNS],name,INSTR_INT); + gsl_declare_var(currentGoomSL->namespaces[currentGoomSL->currentNS], name, INSTR_INT, NULL); } /* PTR */ - static void gsl_ptr_decl(const char *name) + static void gsl_ptr_decl_local(const char *name) { - goom_hash_put_int(currentGoomSL->namespaces[currentGoomSL->currentNS],name,INSTR_PTR); + gsl_declare_var(currentGoomSL->namespaces[currentGoomSL->currentNS], name, INSTR_PTR, NULL); } + /* STRUCT */ + static void gsl_struct_decl_local(const char *struct_name, const char *name) + { + gsl_struct_decl(currentGoomSL->namespaces[currentGoomSL->currentNS],struct_name,name); + } + static void commit_test2(NodeType *set,const char *type, int instr); static NodeType *new_call(const char *name, NodeType *affect_list); @@ -202,7 +531,7 @@ /* DIV_EQ */ static NodeType *new_div_eq(NodeType *lvalue, NodeType *expression) /* {{{ */ { - NodeType *set = new_op("div_eq", OPR_PLUS_EQ, 2); + NodeType *set = new_op("div_eq", OPR_DIV_EQ, 2); set->unode.opr.op[0] = lvalue; set->unode.opr.op[1] = expression; return set; @@ -228,9 +557,9 @@ /* compute "left" and "right" */ switch (expr->unode.opr.nbOp) { case 2: - precommit_node(expr->unode.opr.op[1]); + precommit_node(expr->unode.opr.op[1]); case 1: - precommit_node(expr->unode.opr.op[0]); + precommit_node(expr->unode.opr.op[0]); } if (is_tmp_expr(expr->unode.opr.op[0])) { @@ -243,7 +572,7 @@ } else { char stmp[256]; - /* declare a float to store the result */ + /* declare a temporary variable to store the result */ if (expr->unode.opr.op[0]->type == CONST_INT_NODE) { sprintf(stmp,"_i_tmp_%i",allocateTemp()); gsl_int_decl_global(stmp); @@ -257,23 +586,28 @@ gsl_ptr_decl_global(stmp); } else { - HashValue *val = goom_hash_get(expr->unode.opr.op[0]->vnamespace, expr->unode.opr.op[0]->str); - if (val && (val->i == INSTR_FLOAT)) { + int type = gsl_type_of_var(expr->unode.opr.op[0]->vnamespace, expr->unode.opr.op[0]->str); + if (type == INSTR_FLOAT) { sprintf(stmp,"_f_tmp_%i",allocateTemp()); gsl_float_decl_global(stmp); } - else if (val && (val->i == INSTR_PTR)) { + else if (type == INSTR_PTR) { sprintf(stmp,"_p_tmp_%i",allocateTemp()); gsl_ptr_decl_global(stmp); } - else if (val && (val->i == INSTR_INT)) { + else if (type == INSTR_INT) { sprintf(stmp,"_i_tmp_%i",allocateTemp()); gsl_int_decl_global(stmp); } - else if (val == 0) { - fprintf(stderr, "ERROR: Line %d, Could not find variable '%s'\n", expr->line_number, expr->unode.opr.op[0]->str); + else if (type == -1) { + fprintf(stderr, "ERROR: Line %d, Could not find variable '%s'\n", + expr->line_number, expr->unode.opr.op[0]->str); exit(1); } + else { /* type is a struct_id */ + sprintf(stmp,"_s_tmp_%i",allocateTemp()); + gsl_struct_decl_global_from_id(stmp,type); + } } tmp = new_var(stmp,expr->line_number); @@ -336,6 +670,44 @@ precommit_expr(sub,"sub",INSTR_SUB); } /* }}} */ + /* NEG */ + static NodeType *new_neg(NodeType *expr) { /* {{{ */ + NodeType *zeroConst = NULL; + if (expr->type == CONST_INT_NODE) + zeroConst = new_constInt("0", currentGoomSL->num_lines); + else if (expr->type == CONST_FLOAT_NODE) + zeroConst = new_constFloat("0.0", currentGoomSL->num_lines); + else if (expr->type == CONST_PTR_NODE) { + fprintf(stderr, "ERROR: Line %d, Could not negate const pointer.\n", + currentGoomSL->num_lines); + exit(1); + } + else { + int type = gsl_type_of_var(expr->vnamespace, expr->str); + if (type == INSTR_FLOAT) + zeroConst = new_constFloat("0.0", currentGoomSL->num_lines); + else if (type == INSTR_PTR) { + fprintf(stderr, "ERROR: Line %d, Could not negate pointer.\n", + currentGoomSL->num_lines); + exit(1); + } + else if (type == INSTR_INT) + zeroConst = new_constInt("0", currentGoomSL->num_lines); + else if (type == -1) { + fprintf(stderr, "ERROR: Line %d, Could not find variable '%s'\n", + expr->line_number, expr->unode.opr.op[0]->str); + exit(1); + } + else { /* type is a struct_id */ + fprintf(stderr, "ERROR: Line %d, Could not negate struct '%s'\n", + expr->line_number, expr->str); + exit(1); + } + } + return new_expr2("sub", OPR_SUB, zeroConst, expr); + } + /* }}} */ + /* MUL */ static NodeType *new_mul(NodeType *expr1, NodeType *expr2) { /* {{{ */ return new_expr2("mul", OPR_MUL, expr1, expr2); @@ -364,23 +736,28 @@ static void precommit_call_expr(NodeType *call) { char stmp[256]; NodeType *tmp,*tmpcpy; - HashValue *val = goom_hash_get(call->vnamespace, call->str); - if (val && (val->i == INSTR_FLOAT)) { + int type = gsl_type_of_var(call->vnamespace, call->str); + if (type == INSTR_FLOAT) { sprintf(stmp,"_f_tmp_%i",allocateTemp()); gsl_float_decl_global(stmp); } - else if (val && (val->i == INSTR_PTR)) { + else if (type == INSTR_PTR) { sprintf(stmp,"_p_tmp_%i",allocateTemp()); gsl_ptr_decl_global(stmp); } - else if (val && (val->i == INSTR_INT)) { + else if (type == INSTR_INT) { sprintf(stmp,"_i_tmp_%i",allocateTemp()); gsl_int_decl_global(stmp); } - else if (val == 0) { - fprintf(stderr, "ERROR: Line %d, Could not find variable '%s'\n", call->line_number, call->str); + else if (type == -1) { + fprintf(stderr, "ERROR: Line %d, Could not find variable '%s'\n", + call->line_number, call->str); exit(1); } + else { /* type is a struct_id */ + sprintf(stmp,"_s_tmp_%i",allocateTemp()); + gsl_struct_decl_global_from_id(stmp,type); + } tmp = new_var(stmp,call->line_number); commit_node(call->unode.opr.op[0],0); tmpcpy = nodeClone(tmp); @@ -484,6 +861,62 @@ GSL_PUT_JNZERO(start_while,node->line_number); } /* }}} */ + /* FOR EACH */ + static NodeType *new_static_foreach(NodeType *var, NodeType *var_list, NodeType *instr) { /* {{{ */ + NodeType *node = new_op("for", OPR_FOREACH, 3); + node->unode.opr.op[0] = var; + node->unode.opr.op[1] = var_list; + node->unode.opr.op[2] = instr; + node->line_number = currentGoomSL->num_lines; + return node; + } + static void commit_foreach(NodeType *node) + { + NodeType *cur = node->unode.opr.op[1]; + char tmp_func[256], tmp_loop[256]; + int lbl = allocateLabel(); + sprintf(tmp_func, "|foreach_func_%d|", lbl); + sprintf(tmp_loop, "|foreach_loop_%d|", lbl); + + GSL_PUT_JUMP(tmp_loop, node->line_number); + GSL_PUT_LABEL(tmp_func, node->line_number); + + precommit_node(node->unode.opr.op[2]); + commit_node(node->unode.opr.op[2], 0); + + currentGoomSL->instr = gsl_instr_init(currentGoomSL, "ret", INSTR_RET, 1, node->line_number); + gsl_instr_add_param(currentGoomSL->instr, "|dummy|", TYPE_LABEL); +#ifdef VERBOSE + printf("ret\n"); +#endif + + GSL_PUT_LABEL(tmp_loop, node->line_number); + + while (cur != NULL) + { + NodeType *x, *var; + + /* 1: x=var */ + x = nodeClone(node->unode.opr.op[0]); + var = nodeClone(cur->unode.opr.op[0]); + commit_node(new_set(x, var),0); + + /* 2: instr */ + currentGoomSL->instr = gsl_instr_init(currentGoomSL, "call", INSTR_CALL, 1, node->line_number); + gsl_instr_add_param(currentGoomSL->instr, tmp_func, TYPE_LABEL); +#ifdef VERBOSE + printf("call %s\n", tmp_func); +#endif + + /* 3: var=x */ + x = nodeClone(node->unode.opr.op[0]); + var = cur->unode.opr.op[0]; + commit_node(new_set(var, x),0); + cur = cur->unode.opr.op[1]; + } + nodeFree(node->unode.opr.op[0]); + } /* }}} */ + /* IF */ static NodeType *new_if(NodeType *expression, NodeType *instr) { /* {{{ */ NodeType *node = new_op("if", OPR_IF, 2); @@ -530,7 +963,7 @@ } /* }}} */ /* FUNCTION OUTRO */ - static NodeType *new_function_outro(void) { /* {{{ */ + static NodeType *new_function_outro() { /* {{{ */ return new_op("ret", OPR_FUNC_OUTRO, 0); } static void commit_function_outro(NodeType *node) { @@ -542,6 +975,60 @@ #endif } /* }}} */ + /* AFFECTATION LIST */ + static NodeType *new_affec_list(NodeType *set, NodeType *next) /* {{{ */ + { + NodeType *node = new_op("affect_list", OPR_AFFECT_LIST, 2); + node->unode.opr.op[0] = set; + node->unode.opr.op[1] = next; + return node; + } + static NodeType *new_affect_list_after(NodeType *affect_list) + { + NodeType *ret = NULL; + NodeType *cur = affect_list; + while(cur != NULL) { + NodeType *set = cur->unode.opr.op[0]; + NodeType *next = cur->unode.opr.op[1]; + NodeType *lvalue = set->unode.opr.op[0]; + NodeType *expression = set->unode.opr.op[1]; + if ((lvalue->str[0] == '&') && (expression->type == VAR_NODE)) { + NodeType *nset = new_set(nodeClone(expression), nodeClone(lvalue)); + ret = new_affec_list(nset, ret); + } + cur = next; + } + return ret; + } + static void commit_affect_list(NodeType *node) + { + NodeType *cur = node; + while(cur != NULL) { + NodeType *set = cur->unode.opr.op[0]; + precommit_node(set->unode.opr.op[0]); + precommit_node(set->unode.opr.op[1]); + cur = cur->unode.opr.op[1]; + } + cur = node; + while(cur != NULL) { + NodeType *set = cur->unode.opr.op[0]; + commit_node(set,0); + cur = cur->unode.opr.op[1]; + } + } /* }}} */ + + /* VAR LIST */ + static NodeType *new_var_list(NodeType *var, NodeType *next) /* {{{ */ + { + NodeType *node = new_op("var_list", OPR_VAR_LIST, 2); + node->unode.opr.op[0] = var; + node->unode.opr.op[1] = next; + return node; + } + static void commit_var_list(NodeType *node) + { + } /* }}} */ + /* FUNCTION CALL */ static NodeType *new_call(const char *name, NodeType *affect_list) { /* {{{ */ HashValue *fval; @@ -575,47 +1062,26 @@ } } static void commit_ext_call(NodeType *node) { + NodeType *alafter = new_affect_list_after(node->unode.opr.op[0]); commit_node(node->unode.opr.op[0],0); currentGoomSL->instr = gsl_instr_init(currentGoomSL, "extcall", INSTR_EXT_CALL, 1, node->line_number); gsl_instr_add_param(currentGoomSL->instr, node->str, TYPE_VAR); #ifdef VERBOSE printf("extcall %s\n", node->str); #endif + commit_node(alafter,0); } static void commit_call(NodeType *node) { + NodeType *alafter = new_affect_list_after(node->unode.opr.op[0]); commit_node(node->unode.opr.op[0],0); currentGoomSL->instr = gsl_instr_init(currentGoomSL, "call", INSTR_CALL, 1, node->line_number); gsl_instr_add_param(currentGoomSL->instr, node->str, TYPE_LABEL); #ifdef VERBOSE printf("call %s\n", node->str); #endif + commit_node(alafter,0); } /* }}} */ - /* AFFECTATION LIST */ - static NodeType *new_affec_list(NodeType *set, NodeType *next) - { - NodeType *node = new_op("affect_list", OPR_AFFECT_LIST, 2); - node->unode.opr.op[0] = set; - node->unode.opr.op[1] = next; - return node; - } - static void commit_affect_list(NodeType *node) - { - NodeType *cur = node; - while(cur != NULL) { - NodeType *set = cur->unode.opr.op[0]; - precommit_node(set->unode.opr.op[0]); - precommit_node(set->unode.opr.op[1]); - cur = cur->unode.opr.op[1]; - } - cur = node; - while(cur != NULL) { - NodeType *set = cur->unode.opr.op[0]; - commit_node(set,0); - cur = cur->unode.opr.op[1]; - } - } - /** **/ static NodeType *rootNode = 0; /* TODO: reinitialiser a chaque compilation. */ @@ -632,16 +1098,16 @@ } /* }}} */ #if 1 - static int allocateTemp(void) { + int allocateTemp() { return allocateLabel(); } - static void releaseAllTemps(void) {} - static void releaseTemp(int n) {} + void releaseAllTemps() {} + void releaseTemp(int n) {} #else static int nbTemp = 0; static int *tempArray = 0; static int tempArraySize = 0; - static int allocateTemp(void) { /* TODO: allocateITemp, allocateFTemp */ + int allocateTemp() { /* TODO: allocateITemp, allocateFTemp */ int i = 0; /* {{{ */ if (tempArray == 0) { tempArraySize = 256; @@ -663,10 +1129,10 @@ i++; } } /* }}} */ - static void releaseAllTemps(void) { + void releaseAllTemps() { nbTemp = 0; /* {{{ */ } /* }}} */ - static void releaseTemp(int n) { + void releaseTemp(int n) { int j; /* {{{ */ for (j=0;j<nbTemp;++j) { if (tempArray[j] == n) { @@ -678,11 +1144,11 @@ #endif static int lastLabel = 0; - static int allocateLabel(void) { + int allocateLabel() { return ++lastLabel; /* {{{ */ } /* }}} */ - void gsl_commit_compilation(void) + void gsl_commit_compilation() { /* {{{ */ commit_node(rootNode,0); rootNode = 0; @@ -725,6 +1191,8 @@ case OPR_LOW: commit_low(node); break; case OPR_NOT: commit_not(node); break; case OPR_AFFECT_LIST: commit_affect_list(node); break; + case OPR_FOREACH: commit_foreach(node); break; + case OPR_VAR_LIST: commit_var_list(node); break; #ifdef VERBOSE case EMPTY_NODE: printf("NOP\n"); break; #endif @@ -814,541 +1282,912 @@ } /* }}} */ - static void DECL_VAR(int type, char *name) { + void gsl_declare_global_variable(int type, char *name) { switch(type){ + case -1: break; case FLOAT_TK:gsl_float_decl_global(name);break; case INT_TK: gsl_int_decl_global(name);break; case PTR_TK: gsl_ptr_decl_global(name);break; + default: + { + int id = type - 1000; + gsl_struct_decl_global_from_id(name,id); + } } } -#line 806 "goomsl_yacc.y" -typedef union { + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 1199 "goomsl_yacc.y" +typedef union YYSTYPE { int intValue; float floatValue; char charValue; char strValue[2048]; NodeType *nPtr; + GoomHash *namespace; + GSL_Struct *gsl_struct; + GSL_StructField *gsl_struct_field; } YYSTYPE; -#include <stdio.h> - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif +/* Line 191 of yacc.c. */ +#line 1327 "goomsl_yacc.c" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -#define YYFINAL 149 -#define YYFLAG -32768 -#define YYNTBASE 38 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 59) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 28, - 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, 31, - 32, 26, 24, 30, 25, 2, 27, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 29, 2, 22, - 21, 23, 33, 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, - 36, 2, 37, 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, 34, 2, 35, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20 -}; +/* Copy the second part of user declarations. */ -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 4, 7, 16, 27, 36, 47, 50, 51, 52, - 55, 58, 61, 63, 66, 67, 71, 76, 83, 84, - 86, 87, 89, 93, 98, 103, 108, 111, 114, 117, - 120, 123, 130, 137, 144, 146, 150, 154, 158, 162, - 164, 165, 169, 175, 178, 180, 184, 185, 187, 189, - 193, 197, 201, 205, 209, 214, 221, 223, 227, 231, - 235, 239, 243, 246, 248, 250 -}; -static const short yyrhs[] = { 39, - 45, 42, 0, 39, 50, 0, 39, 11, 22, 41, - 23, 40, 28, 47, 0, 39, 11, 22, 41, 29, - 48, 23, 40, 28, 47, 0, 39, 10, 22, 46, - 23, 40, 28, 47, 0, 39, 10, 22, 46, 29, - 48, 23, 40, 28, 47, 0, 39, 28, 0, 0, - 0, 29, 8, 0, 29, 9, 0, 29, 7, 0, - 5, 0, 42, 43, 0, 0, 44, 39, 45, 0, - 22, 46, 23, 28, 0, 22, 46, 29, 48, 23, - 28, 0, 0, 5, 0, 0, 49, 0, 49, 30, - 48, 0, 9, 5, 21, 56, 0, 8, 5, 21, - 56, 0, 7, 5, 21, 56, 0, 9, 5, 0, - 8, 5, 0, 7, 5, 0, 54, 28, 0, 49, - 28, 0, 31, 57, 32, 33, 51, 50, 0, 12, - 57, 51, 13, 51, 50, 0, 34, 28, 55, 39, - 35, 28, 0, 52, 0, 5, 15, 56, 0, 5, - 16, 56, 0, 5, 18, 56, 0, 5, 17, 56, - 0, 28, 0, 0, 46, 28, 47, 0, 46, 29, - 53, 28, 47, 0, 54, 53, 0, 54, 0, 5, - 21, 56, 0, 0, 5, 0, 58, 0, 56, 26, - 56, 0, 56, 27, 56, 0, 56, 24, 56, 0, - 56, 25, 56, 0, 31, 56, 32, 0, 36, 46, - 47, 37, 0, 36, 46, 29, 53, 37, 47, 0, - 56, 0, 56, 21, 56, 0, 56, 22, 56, 0, - 56, 23, 56, 0, 56, 19, 56, 0, 56, 20, - 56, 0, 14, 57, 0, 4, 0, 3, 0, 6, - 0 -}; +/* Line 214 of yacc.c. */ +#line 1339 "goomsl_yacc.c" -#endif +#if ! defined (yyoverflow) || YYERROR_VERBOSE -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 835, 837, 838, 839, 840, 841, 842, 843, 846, 847, - 848, 849, 852, 854, 855, 858, 860, 861, 862, 864, - 865, 867, 868, 871, 872, 873, 874, 875, 876, 879, - 880, 881, 882, 883, 884, 885, 886, 887, 888, 891, - 891, 893, 894, 897, 898, 900, 903, 906, 907, 908, - 909, 910, 911, 912, 913, 914, 917, 918, 919, 920, - 921, 922, 923, 926, 927, 928 -}; +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; #endif +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 229 -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 42 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 30 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 89 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 217 -static const char * const yytname[] = { "$","error","$undefined.","TYPE_INTEGER", -"TYPE_FLOAT","TYPE_VAR","TYPE_PTR","PTR_TK","INT_TK","FLOAT_TK","DECLARE","EXTERNAL", -"WHILE","DO","NOT","PLUS_EQ","SUB_EQ","DIV_EQ","MUL_EQ","SUP_EQ","LOW_EQ","'='", -"'<'","'>'","'+'","'-'","'*'","'/'","'\\n'","':'","','","'('","')'","'?'","'{'", -"'}'","'['","']'","gsl","gsl_code","return_type","ext_task_name","gsl_def_functions", -"function","function_intro","function_outro","task_name","leave_namespace","arglist", -"declaration","instruction","opt_nl","func_call","affectations","affectation", -"start_block","expression","test","constValue", NULL +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 279 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 25, 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, + 35, 36, 32, 29, 34, 30, 2, 31, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 33, 2, + 27, 26, 28, 37, 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, 40, 2, 41, 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, 38, 2, 39, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 }; -#endif -static const short yyr1[] = { 0, - 38, 39, 39, 39, 39, 39, 39, 39, 40, 40, - 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, - 47, 48, 48, 49, 49, 49, 49, 49, 49, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, - 51, 52, 52, 53, 53, 54, 55, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, - 57, 57, 57, 58, 58, 58 +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short yyprhs[] = +{ + 0, 0, 3, 7, 10, 19, 30, 39, 50, 53, + 56, 57, 65, 68, 73, 76, 79, 82, 85, 87, + 89, 90, 93, 96, 99, 102, 104, 108, 111, 112, + 116, 122, 130, 131, 132, 137, 142, 147, 152, 154, + 157, 160, 163, 166, 169, 172, 179, 186, 193, 195, + 199, 203, 207, 211, 218, 222, 224, 227, 231, 232, + 234, 236, 240, 244, 248, 252, 255, 259, 261, 265, + 269, 273, 277, 281, 285, 288, 290, 292, 294, 298, + 304, 310, 318, 323, 330, 333, 335, 340, 344, 346 }; -static const short yyr2[] = { 0, - 3, 2, 8, 10, 8, 10, 2, 0, 0, 2, - 2, 2, 1, 2, 0, 3, 4, 6, 0, 1, - 0, 1, 3, 4, 4, 4, 2, 2, 2, 2, - 2, 6, 6, 6, 1, 3, 3, 3, 3, 1, - 0, 3, 5, 2, 1, 3, 0, 1, 1, 3, - 3, 3, 3, 3, 4, 6, 1, 3, 3, 3, - 3, 3, 2, 1, 1, 1 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 43, 0, -1, 44, 55, 52, -1, 44, 59, -1, + 44, 11, 27, 48, 28, 50, 25, 56, -1, 44, + 11, 27, 48, 33, 51, 28, 50, 25, 56, -1, + 44, 10, 27, 49, 28, 50, 25, 56, -1, 44, + 10, 27, 49, 33, 51, 28, 50, 25, 56, -1, + 44, 45, -1, 44, 25, -1, -1, 22, 27, 5, + 33, 46, 28, 25, -1, 71, 47, -1, 46, 34, + 71, 47, -1, 8, 5, -1, 9, 5, -1, 7, + 5, -1, 5, 5, -1, 5, -1, 5, -1, -1, + 33, 8, -1, 33, 9, -1, 33, 7, -1, 33, + 5, -1, 58, -1, 58, 34, 51, -1, 52, 53, + -1, -1, 54, 44, 55, -1, 27, 49, 28, 50, + 25, -1, 27, 49, 33, 51, 28, 50, 25, -1, + -1, -1, 9, 5, 26, 64, -1, 8, 5, 26, + 64, -1, 7, 5, 26, 64, -1, 5, 5, 26, + 64, -1, 58, -1, 9, 5, -1, 8, 5, -1, + 7, 5, -1, 5, 5, -1, 62, 25, -1, 57, + 25, -1, 35, 65, 36, 37, 71, 59, -1, 12, + 65, 71, 13, 71, 59, -1, 38, 25, 63, 44, + 39, 25, -1, 67, -1, 5, 15, 64, -1, 5, + 16, 64, -1, 5, 18, 64, -1, 5, 17, 64, + -1, 23, 5, 24, 60, 13, 59, -1, 35, 61, + 36, -1, 5, -1, 5, 61, -1, 5, 26, 64, + -1, -1, 5, -1, 66, -1, 64, 32, 64, -1, + 64, 31, 64, -1, 64, 29, 64, -1, 64, 30, + 64, -1, 30, 64, -1, 35, 64, 36, -1, 68, + -1, 64, 26, 64, -1, 64, 27, 64, -1, 64, + 28, 64, -1, 64, 19, 64, -1, 64, 20, 64, + -1, 64, 21, 64, -1, 14, 65, -1, 4, -1, + 3, -1, 6, -1, 49, 25, 56, -1, 49, 33, + 69, 25, 56, -1, 40, 49, 41, 25, 56, -1, + 40, 49, 33, 69, 41, 25, 56, -1, 40, 49, + 56, 41, -1, 40, 49, 33, 69, 41, 56, -1, + 70, 69, -1, 70, -1, 5, 26, 56, 64, -1, + 33, 56, 64, -1, 25, -1, -1 }; -static const short yydefact[] = { 8, - 19, 20, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 15, 0, 0, 2, 35, 0, 0, 0, 0, - 0, 0, 29, 28, 27, 0, 0, 65, 64, 48, - 66, 0, 0, 0, 57, 41, 49, 0, 47, 1, - 21, 0, 31, 30, 36, 37, 39, 38, 46, 0, - 0, 0, 20, 0, 13, 0, 63, 0, 21, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, - 0, 8, 0, 14, 8, 42, 0, 0, 45, 26, - 25, 24, 9, 0, 9, 0, 54, 0, 0, 61, - 62, 58, 59, 60, 52, 53, 50, 51, 41, 41, - 0, 0, 19, 21, 44, 0, 0, 0, 22, 0, - 0, 0, 55, 0, 0, 0, 0, 0, 16, 43, - 12, 10, 11, 21, 9, 0, 21, 9, 21, 33, - 32, 34, 17, 0, 5, 0, 23, 3, 0, 56, - 0, 21, 21, 18, 6, 4, 0, 0, 0 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short yyrline[] = +{ + 0, 1236, 1236, 1238, 1239, 1240, 1241, 1242, 1243, 1244, + 1245, 1250, 1253, 1254, 1257, 1258, 1259, 1260, 1265, 1267, + 1270, 1271, 1272, 1273, 1274, 1277, 1278, 1283, 1284, 1287, + 1289, 1291, 1294, 1296, 1300, 1301, 1302, 1303, 1304, 1307, + 1308, 1309, 1310, 1315, 1316, 1317, 1318, 1319, 1320, 1321, + 1322, 1323, 1324, 1325, 1328, 1330, 1331, 1334, 1336, 1339, + 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1350, 1351, + 1352, 1353, 1354, 1355, 1356, 1359, 1360, 1361, 1366, 1367, + 1368, 1369, 1373, 1374, 1377, 1378, 1380, 1384, 1393, 1393 }; +#endif -static const short yydefgoto[] = { 147, - 1, 107, 56, 40, 74, 75, 12, 13, 76, 108, - 14, 15, 70, 16, 78, 17, 72, 35, 36, 37 +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "LTYPE_INTEGER", "LTYPE_FLOAT", + "LTYPE_VAR", "LTYPE_PTR", "PTR_TK", "INT_TK", "FLOAT_TK", "DECLARE", + "EXTERNAL", "WHILE", "DO", "NOT", "PLUS_EQ", "SUB_EQ", "DIV_EQ", + "MUL_EQ", "SUP_EQ", "LOW_EQ", "NOT_EQ", "STRUCT", "FOR", "IN", "'\\n'", + "'='", "'<'", "'>'", "'+'", "'-'", "'/'", "'*'", "':'", "','", "'('", + "')'", "'?'", "'{'", "'}'", "'['", "']'", "$accept", "gsl", "gsl_code", + "struct_declaration", "struct_members", "struct_member", + "ext_task_name", "task_name", "return_type", "arglist", + "gsl_def_functions", "function", "function_intro", "function_outro", + "leave_namespace", "declaration", "empty_declaration", "instruction", + "var_list", "var_list_content", "affectation", "start_block", + "expression", "test", "constValue", "func_call", "func_call_expression", + "affectation_list", "affectation_in_list", "opt_nl", 0 }; +#endif -static const short yypact[] = {-32768, - 111, 131, -3, 8, 10, 3, 5, 26,-32768, 26, - -5,-32768, 47, 6,-32768,-32768, 35, 68, 68, 68, - 68, 68, 46, 48, 56, 77, 92,-32768,-32768,-32768, --32768, 26, 68, 77, 109, 75,-32768, 85,-32768, 103, --32768, 121,-32768,-32768, 69, 69, 69, 69, 69, 68, - 68, 68,-32768, -13,-32768, -9,-32768, 54, 108, 68, - 68, 68, 68, 68, 68, 68, 68, 68,-32768, 125, - 107,-32768, 77,-32768,-32768,-32768, 120, 115, 121, 69, - 69, 69, 122, 52, 122, 52,-32768, 121, 113, 69, - 69, 69, 69, 69, 83, 83, 117,-32768, 75, 75, - 80, -1, 111,-32768,-32768, 146, 128, 134, 129, 130, - 137, 124,-32768, 93, 93, 135, 136, 52,-32768,-32768, --32768,-32768,-32768,-32768, 122, 52,-32768, 122,-32768,-32768, --32768,-32768,-32768, 139,-32768, 138,-32768,-32768, 140,-32768, - 141,-32768,-32768,-32768,-32768,-32768, 165, 167,-32768 +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 10, 61, 60, 62, 43, + 45, 47, 42, 58, 44, 40, 41, 63, 123, 125, + 91, 93 }; +# endif -static const short yypgoto[] = {-32768, - -33, -84,-32768,-32768,-32768,-32768, 67, -17, -59, -83, - -60, -8, 13,-32768, -67, -24,-32768, -14, 1,-32768 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 42, 43, 44, 44, 44, 44, 44, 44, 44, + 44, 45, 46, 46, 47, 47, 47, 47, 48, 49, + 50, 50, 50, 50, 50, 51, 51, 52, 52, 53, + 54, 54, 55, 56, 57, 57, 57, 57, 57, 58, + 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 60, 61, 61, 62, 63, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, + 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, + 67, 67, 68, 68, 69, 69, 70, 70, 71, 71 }; +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 3, 2, 8, 10, 8, 10, 2, 2, + 0, 7, 2, 4, 2, 2, 2, 2, 1, 1, + 0, 2, 2, 2, 2, 1, 3, 2, 0, 3, + 5, 7, 0, 0, 4, 4, 4, 4, 1, 2, + 2, 2, 2, 2, 2, 6, 6, 6, 1, 3, + 3, 3, 3, 6, 3, 1, 2, 3, 0, 1, + 1, 3, 3, 3, 3, 2, 3, 1, 3, 3, + 3, 3, 3, 3, 2, 1, 1, 1, 3, 5, + 5, 7, 4, 6, 2, 1, 4, 3, 1, 0 +}; -#define YYLAST 170 - - -static const short yytable[] = { 89, - 110, 23, 111, 45, 46, 47, 48, 49, 54, 83, - 38, 105, 24, 85, 25, 84, 59, 79, 58, 86, - 112, 117, 39, 109, 26, 109, 27, 118, 28, 29, - 30, 31, 57, 43, 134, 80, 81, 82, 101, 32, - 136, 103, 137, 139, 120, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 79, 102, 33, 109, 3, 4, - 5, 34, 44, 79, 135, 109, 50, 138, 51, 140, - 28, 29, 30, 31, 41, 42, 52, 65, 66, 67, - 68, 53, 145, 146, 2, 87, 3, 4, 5, 6, - 7, 8, 65, 66, 67, 68, 55, 2, 33, 3, - 4, 5, 69, 34, 8, 130, 131, 9, 67, 68, - 10, 114, 115, 11, 116, 2, 71, 3, 4, 5, - 6, 7, 8, 10, 73, 77, 11, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 88, 99, 9, 100, - 22, 10, 104, 68, 11, 18, 19, 20, 21, 113, - 106, 22, 121, 122, 123, 124, 125, 127, 126, 128, - 129, 141, 132, 133, 148, 142, 149, 143, 144, 119 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 10, 0, 32, 1, 19, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 0, 0, 0, 8, 0, 28, + 0, 38, 3, 0, 48, 42, 0, 0, 0, 0, + 0, 41, 40, 39, 0, 0, 76, 75, 59, 77, + 0, 0, 0, 0, 0, 89, 60, 67, 0, 0, + 0, 58, 19, 0, 33, 0, 2, 44, 43, 0, + 49, 50, 52, 51, 57, 0, 0, 0, 0, 18, + 0, 74, 65, 0, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, + 10, 0, 0, 78, 0, 33, 0, 85, 0, 27, + 10, 37, 36, 35, 34, 20, 0, 20, 0, 66, + 0, 0, 71, 72, 73, 68, 69, 70, 63, 64, + 62, 61, 89, 89, 0, 0, 89, 0, 0, 33, + 33, 0, 33, 84, 0, 32, 0, 0, 0, 0, + 0, 0, 0, 25, 0, 0, 0, 82, 0, 0, + 0, 55, 0, 0, 0, 0, 0, 80, 0, 87, + 79, 20, 0, 29, 24, 23, 21, 22, 33, 42, + 41, 40, 39, 20, 0, 33, 20, 33, 46, 0, + 89, 0, 0, 0, 0, 12, 56, 54, 53, 45, + 47, 33, 86, 0, 0, 6, 0, 26, 4, 0, + 83, 11, 0, 17, 16, 14, 15, 81, 30, 20, + 33, 33, 13, 0, 7, 5, 31 }; -static const short yycheck[] = { 59, - 85, 5, 86, 18, 19, 20, 21, 22, 26, 23, - 10, 79, 5, 23, 5, 29, 34, 42, 33, 29, - 88, 23, 28, 84, 22, 86, 22, 29, 3, 4, - 5, 6, 32, 28, 118, 50, 51, 52, 72, 14, - 125, 75, 126, 128, 104, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 79, 73, 31, 118, 7, 8, - 9, 36, 28, 88, 124, 126, 21, 127, 21, 129, - 3, 4, 5, 6, 28, 29, 21, 24, 25, 26, - 27, 5, 142, 143, 5, 32, 7, 8, 9, 10, - 11, 12, 24, 25, 26, 27, 5, 5, 31, 7, - 8, 9, 28, 36, 12, 114, 115, 28, 26, 27, - 31, 99, 100, 34, 35, 5, 32, 7, 8, 9, - 10, 11, 12, 31, 22, 5, 34, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 29, 13, 28, 33, - 21, 31, 28, 27, 34, 15, 16, 17, 18, 37, - 29, 21, 7, 8, 9, 28, 23, 28, 30, 23, - 37, 23, 28, 28, 0, 28, 0, 28, 28, 103 +/* YYDEFGOTO[NTERM-NUM]. */ +static const short yydefgoto[] = +{ + -1, 1, 2, 17, 149, 185, 70, 18, 137, 142, + 56, 99, 100, 19, 93, 20, 21, 22, 125, 152, + 23, 90, 44, 45, 46, 24, 47, 96, 97, 86 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* This file comes from bison-1.28. */ -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -116 +static const short yypact[] = +{ + -116, 40, 136, -116, 103, 39, 66, 68, 61, 65, + 1, 77, 101, -116, 1, 84, 109, -116, 12, -116, + 91, -116, -116, 97, -116, 98, 72, 72, 72, 72, + 72, 99, 104, 113, 109, 130, -116, -116, -116, -116, + 1, 72, 72, 109, 166, 115, -116, -116, 145, 131, + 118, -116, -116, -24, -116, -3, 138, -116, -116, 72, + 159, 159, 159, 159, 159, 72, 72, 72, 14, -116, + 51, -116, 22, 102, 124, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, -116, 160, 139, 140, 141, + -116, -3, 152, -116, 154, -116, 156, -3, 109, -116, + -116, 159, 159, 159, 159, 150, 82, 150, 82, -116, + -3, 158, 159, 159, 159, 159, 159, 159, 22, 22, + -116, -116, 115, 115, 195, 188, 115, 88, 162, -116, + -116, 72, -116, -116, 52, 136, 155, 177, 199, 200, + 201, 202, 180, 175, 185, 183, 171, -116, 144, 18, + 161, 195, 178, 144, 144, 190, 191, -116, 72, 159, + -116, 150, 82, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, 150, 82, -116, 150, -116, -116, 192, + 115, 208, 213, 214, 215, -116, -116, -116, -116, -116, + -116, -116, 159, 196, 194, -116, 198, -116, -116, 203, + -116, -116, 161, -116, -116, -116, -116, -116, -116, 150, + -116, -116, -116, 204, -116, -116, -116 +}; - 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -116, -116, -68, -116, -116, 23, -116, -15, -104, -92, + -116, -116, -116, 89, -74, -116, -88, -115, -116, 75, + -116, -116, -16, -6, -116, -116, -116, -62, -116, -99 +}; - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const unsigned char yytable[] = +{ + 111, 53, 94, 144, 36, 37, 38, 39, 50, 91, + 60, 61, 62, 63, 64, 40, 145, 92, 143, 68, + 143, 131, 127, 148, 150, 72, 73, 154, 74, 128, + 95, 41, 135, 178, 71, 133, 42, 54, 188, 189, + 3, 43, 105, 101, 31, 55, 179, 106, 146, 102, + 103, 104, 180, 83, 84, 157, 158, 193, 160, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 196, + 194, 32, 199, 33, 143, 36, 37, 38, 39, 107, + 161, 202, 197, 134, 108, 162, 143, 138, 34, 139, + 140, 141, 35, 4, 195, 5, 6, 7, 8, 9, + 10, 198, 41, 200, 48, 213, 49, 42, 25, 51, + 11, 12, 43, 13, 52, 159, 57, 207, 26, 27, + 28, 29, 58, 14, 59, 65, 15, 155, 16, 30, + 66, 81, 82, 83, 84, 69, 214, 215, 109, 67, + 85, 4, 192, 5, 6, 7, 8, 9, 10, 4, + 87, 5, 6, 7, 89, 88, 10, 110, 11, 12, + 164, 13, 165, 166, 167, 98, 181, 12, 182, 183, + 184, 14, 123, 122, 15, 124, 16, 129, 126, 14, + 130, 132, 15, 136, 16, 75, 76, 77, 81, 82, + 83, 84, 78, 79, 80, 81, 82, 83, 84, 147, + 151, 153, 168, 156, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 203, 187, 190, 191, 201, 204, 205, + 206, 208, 209, 210, 163, 212, 186, 0, 211, 216 +}; - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ +static const short yycheck[] = +{ + 74, 16, 5, 107, 3, 4, 5, 6, 14, 33, + 26, 27, 28, 29, 30, 14, 108, 41, 106, 34, + 108, 95, 90, 122, 123, 41, 42, 126, 43, 91, + 33, 30, 100, 148, 40, 97, 35, 25, 153, 154, + 0, 40, 28, 59, 5, 33, 28, 33, 110, 65, + 66, 67, 34, 31, 32, 129, 130, 161, 132, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 173, + 162, 5, 176, 5, 162, 3, 4, 5, 6, 28, + 28, 180, 174, 98, 33, 33, 174, 5, 27, 7, + 8, 9, 27, 5, 168, 7, 8, 9, 10, 11, + 12, 175, 30, 177, 27, 209, 5, 35, 5, 25, + 22, 23, 40, 25, 5, 131, 25, 191, 15, 16, + 17, 18, 25, 35, 26, 26, 38, 39, 40, 26, + 26, 29, 30, 31, 32, 5, 210, 211, 36, 26, + 25, 5, 158, 7, 8, 9, 10, 11, 12, 5, + 5, 7, 8, 9, 36, 24, 12, 33, 22, 23, + 5, 25, 7, 8, 9, 27, 5, 23, 7, 8, + 9, 35, 33, 13, 38, 35, 40, 25, 37, 35, + 26, 25, 38, 33, 40, 19, 20, 21, 29, 30, + 31, 32, 26, 27, 28, 29, 30, 31, 32, 41, + 5, 13, 25, 41, 5, 5, 5, 5, 28, 34, + 25, 28, 41, 5, 36, 25, 25, 25, 5, 5, + 5, 25, 28, 25, 135, 202, 151, -1, 25, 25 +}; -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 43, 44, 0, 5, 7, 8, 9, 10, 11, + 12, 22, 23, 25, 35, 38, 40, 45, 49, 55, + 57, 58, 59, 62, 67, 5, 15, 16, 17, 18, + 26, 5, 5, 5, 27, 27, 3, 4, 5, 6, + 14, 30, 35, 40, 64, 65, 66, 68, 27, 5, + 65, 25, 5, 49, 25, 33, 52, 25, 25, 26, + 64, 64, 64, 64, 64, 26, 26, 26, 49, 5, + 48, 65, 64, 64, 49, 19, 20, 21, 26, 27, + 28, 29, 30, 31, 32, 25, 71, 5, 24, 36, + 63, 33, 41, 56, 5, 33, 69, 70, 27, 53, + 54, 64, 64, 64, 64, 28, 33, 28, 33, 36, + 33, 56, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 13, 33, 35, 60, 37, 44, 69, 25, + 26, 56, 25, 69, 49, 44, 33, 50, 5, 7, + 8, 9, 51, 58, 50, 51, 69, 41, 71, 46, + 71, 5, 61, 13, 71, 39, 41, 56, 56, 64, + 56, 28, 33, 55, 5, 7, 8, 9, 25, 5, + 5, 5, 5, 28, 34, 25, 28, 41, 59, 28, + 34, 5, 7, 8, 9, 47, 61, 36, 59, 59, + 25, 25, 64, 50, 51, 56, 50, 51, 56, 50, + 56, 25, 71, 5, 5, 5, 5, 56, 25, 28, + 25, 25, 47, 50, 56, 56, 25 +}; -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include <alloca.h> -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include <malloc.h> +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ #endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include <malloc.h> */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t #endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int #endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab +#define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() -#endif +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif -#else /* not YYLSP_NEEDED */ + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) -/* If nonreentrant, generate the variables here */ +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (cinluded). | +`------------------------------------------------------------------*/ -#ifndef YYPURE +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short *bottom, short *top) +#else +static void +yy_stack_print (bottom, top) + short *bottom; + short *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; #endif +{ + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 -#undef YYMAXDEPTH +# undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; - while (i-- > 0) - *t++ = *f++; + return yyd - 1; } +# endif +# endif -#else /* __cplusplus */ +#endif /* !YYERROR_VERBOSE */ -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) static void -__yy_memcpy (char *to, char *from, unsigned int count) +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif { - register char *t = to; - register char *f = from; - register int i = count; + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - while (i-- > 0) - *t++ = *f++; + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); } +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; #endif -#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} -#line 217 "/usr/share/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void); +#else +int yyparse (); #endif -#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL +yyparse () + +#endif +#endif { + register int yystate; register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else #define YYPOPSTACK (yyvsp--, yyssp--) -#endif - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -1360,110 +2199,96 @@ yyparse(YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + 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++; - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif + yysetstate: + *yyssp = yystate; + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -1472,591 +2297,693 @@ yynewstate: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; + -/* Do a reduction. yyn is the number of a rule to reduce with. */ +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (yydebug) + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) { - int i; + case 3: +#line 1238 "goomsl_yacc.y" + { gsl_append(yyvsp[0].nPtr); } + break; + + case 4: +#line 1239 "goomsl_yacc.y" + { gsl_declare_global_variable(yyvsp[-2].intValue,yyvsp[-4].strValue); } + break; + + case 5: +#line 1240 "goomsl_yacc.y" + { gsl_declare_global_variable(yyvsp[-2].intValue,yyvsp[-6].strValue); } + break; + + case 6: +#line 1241 "goomsl_yacc.y" + { gsl_declare_global_variable(yyvsp[-2].intValue,yyvsp[-4].strValue); } + break; + + case 7: +#line 1242 "goomsl_yacc.y" + { gsl_declare_global_variable(yyvsp[-2].intValue,yyvsp[-6].strValue); } + break; + + case 11: +#line 1250 "goomsl_yacc.y" + { gsl_add_struct(yyvsp[-4].strValue, yyvsp[-2].gsl_struct); } + break; + + case 12: +#line 1253 "goomsl_yacc.y" + { yyval.gsl_struct = gsl_new_struct(yyvsp[0].gsl_struct_field); } + break; + + case 13: +#line 1254 "goomsl_yacc.y" + { yyval.gsl_struct = yyvsp[-3].gsl_struct; gsl_add_struct_field(yyvsp[-3].gsl_struct, yyvsp[0].gsl_struct_field); } + break; + + case 14: +#line 1257 "goomsl_yacc.y" + { yyval.gsl_struct_field = gsl_new_struct_field(yyvsp[0].strValue, INSTR_INT); } + break; + + case 15: +#line 1258 "goomsl_yacc.y" + { yyval.gsl_struct_field = gsl_new_struct_field(yyvsp[0].strValue, INSTR_FLOAT); } + break; + + case 16: +#line 1259 "goomsl_yacc.y" + { yyval.gsl_struct_field = gsl_new_struct_field(yyvsp[0].strValue, INSTR_PTR); } + break; + + case 17: +#line 1260 "goomsl_yacc.y" + { yyval.gsl_struct_field = gsl_new_struct_field_struct(yyvsp[0].strValue, yyvsp[-1].strValue); } + break; + + case 18: +#line 1265 "goomsl_yacc.y" + { gsl_declare_external_task(yyvsp[0].strValue); gsl_enternamespace(yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); } + break; + + case 19: +#line 1267 "goomsl_yacc.y" + { gsl_declare_task(yyvsp[0].strValue); gsl_enternamespace(yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); } + break; + + case 20: +#line 1270 "goomsl_yacc.y" + { yyval.intValue=-1; } + break; + + case 21: +#line 1271 "goomsl_yacc.y" + { yyval.intValue=INT_TK; } + break; + + case 22: +#line 1272 "goomsl_yacc.y" + { yyval.intValue=FLOAT_TK; } + break; + + case 23: +#line 1273 "goomsl_yacc.y" + { yyval.intValue=PTR_TK; } + break; + + case 24: +#line 1274 "goomsl_yacc.y" + { yyval.intValue= 1000 + gsl_get_struct_id(yyvsp[0].strValue); } + break; + + case 29: +#line 1287 "goomsl_yacc.y" + { gsl_leavenamespace(); } + break; + + case 30: +#line 1289 "goomsl_yacc.y" + { gsl_append(new_function_intro(yyvsp[-3].strValue)); + gsl_declare_global_variable(yyvsp[-1].intValue,yyvsp[-3].strValue); } + break; + + case 31: +#line 1291 "goomsl_yacc.y" + { gsl_append(new_function_intro(yyvsp[-5].strValue)); + gsl_declare_global_variable(yyvsp[-1].intValue,yyvsp[-5].strValue); } + break; + + case 32: +#line 1294 "goomsl_yacc.y" + { gsl_append(new_function_outro()); } + break; + + case 33: +#line 1296 "goomsl_yacc.y" + { yyval.namespace = gsl_leavenamespace(); } + break; + + case 34: +#line 1300 "goomsl_yacc.y" + { gsl_float_decl_local(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); } + break; + + case 35: +#line 1301 "goomsl_yacc.y" + { gsl_int_decl_local(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); } + break; + + case 36: +#line 1302 "goomsl_yacc.y" + { gsl_ptr_decl_local(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); } + break; + + case 37: +#line 1303 "goomsl_yacc.y" + { gsl_struct_decl_local(yyvsp[-3].strValue,yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); } + break; + + case 38: +#line 1304 "goomsl_yacc.y" + { yyval.nPtr = 0; } + break; + + case 39: +#line 1307 "goomsl_yacc.y" + { gsl_float_decl_local(yyvsp[0].strValue); } + break; + + case 40: +#line 1308 "goomsl_yacc.y" + { gsl_int_decl_local(yyvsp[0].strValue); } + break; + + case 41: +#line 1309 "goomsl_yacc.y" + { gsl_ptr_decl_local(yyvsp[0].strValue); } + break; + + case 42: +#line 1310 "goomsl_yacc.y" + { gsl_struct_decl_local(yyvsp[-1].strValue,yyvsp[0].strValue); } + break; + + case 43: +#line 1315 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[-1].nPtr; } + break; + + case 44: +#line 1316 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[-1].nPtr; } + break; + + case 45: +#line 1317 "goomsl_yacc.y" + { yyval.nPtr = new_if(yyvsp[-4].nPtr,yyvsp[0].nPtr); } + break; + + case 46: +#line 1318 "goomsl_yacc.y" + { yyval.nPtr = new_while(yyvsp[-4].nPtr,yyvsp[0].nPtr); } + break; + + case 47: +#line 1319 "goomsl_yacc.y" + { lastNode = yyvsp[-3].nPtr->unode.opr.op[1]; yyval.nPtr=yyvsp[-3].nPtr; } + break; + + case 48: +#line 1320 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[0].nPtr; } + break; + + case 49: +#line 1321 "goomsl_yacc.y" + { yyval.nPtr = new_plus_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); } + break; + + case 50: +#line 1322 "goomsl_yacc.y" + { yyval.nPtr = new_sub_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); } + break; + + case 51: +#line 1323 "goomsl_yacc.y" + { yyval.nPtr = new_mul_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); } + break; + + case 52: +#line 1324 "goomsl_yacc.y" + { yyval.nPtr = new_div_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); } + break; + + case 53: +#line 1325 "goomsl_yacc.y" + { yyval.nPtr = new_static_foreach(new_var(yyvsp[-4].strValue, currentGoomSL->num_lines), yyvsp[-2].nPtr, yyvsp[0].nPtr); } + break; + + case 54: +#line 1328 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[-1].nPtr; } + break; + + case 55: +#line 1330 "goomsl_yacc.y" + { yyval.nPtr = new_var_list(new_var(yyvsp[0].strValue,currentGoomSL->num_lines), NULL); } + break; + + case 56: +#line 1331 "goomsl_yacc.y" + { yyval.nPtr = new_var_list(new_var(yyvsp[-1].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); } + break; + + case 57: +#line 1334 "goomsl_yacc.y" + { yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); } + break; + + case 58: +#line 1336 "goomsl_yacc.y" + { yyval.nPtr = new_block(lastNode); lastNode = yyval.nPtr->unode.opr.op[0]; } + break; + + case 59: +#line 1339 "goomsl_yacc.y" + { yyval.nPtr = new_var(yyvsp[0].strValue,currentGoomSL->num_lines); } + break; + + case 60: +#line 1340 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[0].nPtr; } + break; + + case 61: +#line 1341 "goomsl_yacc.y" + { yyval.nPtr = new_mul(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 62: +#line 1342 "goomsl_yacc.y" + { yyval.nPtr = new_div(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 63: +#line 1343 "goomsl_yacc.y" + { yyval.nPtr = new_add(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 64: +#line 1344 "goomsl_yacc.y" + { yyval.nPtr = new_sub(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 65: +#line 1345 "goomsl_yacc.y" + { yyval.nPtr = new_neg(yyvsp[0].nPtr); } + break; + + case 66: +#line 1346 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[-1].nPtr; } + break; + + case 67: +#line 1347 "goomsl_yacc.y" + { yyval.nPtr = yyvsp[0].nPtr; } + break; + + case 68: +#line 1350 "goomsl_yacc.y" + { yyval.nPtr = new_equ(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 69: +#line 1351 "goomsl_yacc.y" + { yyval.nPtr = new_low(yyvsp[-2].nPtr,yyvsp[0].nPtr); } + break; + + case 70: +#line 1352 "goomsl_yacc.y" + { yyval.nPtr = new_low(yyvsp[0].nPtr,yyvsp[-2].nPtr); } + break; + + case 71: +#line 1353 "goomsl_yacc.y" + { yyval.nPtr = new_not(new_low(yyvsp[-2].nPtr,yyvsp[0].nPtr)); } + break; + + case 72: +#line 1354 "goomsl_yacc.y" + { yyval.nPtr = new_not(new_low(yyvsp[0].nPtr,yyvsp[-2].nPtr)); } + break; + + case 73: +#line 1355 "goomsl_yacc.y" + { yyval.nPtr = new_not(new_equ(yyvsp[-2].nPtr,yyvsp[0].nPtr)); } + break; + + case 74: +#line 1356 "goomsl_yacc.y" + { yyval.nPtr = new_not(yyvsp[0].nPtr); } + break; + + case 75: +#line 1359 "goomsl_yacc.y" + { yyval.nPtr = new_constFloat(yyvsp[0].strValue,currentGoomSL->num_lines); } + break; + + case 76: +#line 1360 "goomsl_yacc.y" + { yyval.nPtr = new_constInt(yyvsp[0].strValue,currentGoomSL->num_lines); } + break; + + case 77: +#line 1361 "goomsl_yacc.y" + { yyval.nPtr = new_constPtr(yyvsp[0].strValue,currentGoomSL->num_lines); } + break; + + case 78: +#line 1366 "goomsl_yacc.y" + { yyval.nPtr = new_call(yyvsp[-2].strValue,NULL); } + break; + + case 79: +#line 1367 "goomsl_yacc.y" + { yyval.nPtr = new_call(yyvsp[-4].strValue,yyvsp[-2].nPtr); } + break; + + case 80: +#line 1368 "goomsl_yacc.y" + { yyval.nPtr = new_call(yyvsp[-3].strValue,NULL); } + break; + + case 81: +#line 1369 "goomsl_yacc.y" + { yyval.nPtr = new_call(yyvsp[-5].strValue,yyvsp[-3].nPtr); } + break; + + case 82: +#line 1373 "goomsl_yacc.y" + { yyval.nPtr = new_call_expr(yyvsp[-2].strValue,NULL); } + break; + + case 83: +#line 1374 "goomsl_yacc.y" + { yyval.nPtr = new_call_expr(yyvsp[-4].strValue,yyvsp[-2].nPtr); } + break; + + case 84: +#line 1377 "goomsl_yacc.y" + { yyval.nPtr = new_affec_list(yyvsp[-1].nPtr,yyvsp[0].nPtr); } + break; + + case 85: +#line 1378 "goomsl_yacc.y" + { yyval.nPtr = new_affec_list(yyvsp[0].nPtr,NULL); } + break; + + case 86: +#line 1380 "goomsl_yacc.y" + { + gsl_reenternamespace(yyvsp[-1].namespace); + yyval.nPtr = new_set(new_var(yyvsp[-3].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); + } + break; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + case 87: +#line 1384 "goomsl_yacc.y" + { + gsl_reenternamespace(yyvsp[-1].namespace); + yyval.nPtr = new_set(new_var("&this", currentGoomSL->num_lines),yyvsp[0].nPtr); + } + break; - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif + } - switch (yyn) { - -case 2: -#line 837 "goomsl_yacc.y" -{ gsl_append(yyvsp[0].nPtr); ; - break;} -case 3: -#line 838 "goomsl_yacc.y" -{ DECL_VAR(yyvsp[-2].intValue,yyvsp[-4].strValue); ; - break;} -case 4: -#line 839 "goomsl_yacc.y" -{ DECL_VAR(yyvsp[-2].intValue,yyvsp[-6].strValue); ; - break;} -case 5: -#line 840 "goomsl_yacc.y" -{ DECL_VAR(yyvsp[-2].intValue,yyvsp[-4].strValue); ; - break;} -case 6: -#line 841 "goomsl_yacc.y" -{ DECL_VAR(yyvsp[-2].intValue,yyvsp[-6].strValue); ; - break;} -case 9: -#line 846 "goomsl_yacc.y" -{ yyval.intValue=-1; ; - break;} -case 10: -#line 847 "goomsl_yacc.y" -{ yyval.intValue=INT_TK; ; - break;} -case 11: -#line 848 "goomsl_yacc.y" -{ yyval.intValue=FLOAT_TK; ; - break;} -case 12: -#line 849 "goomsl_yacc.y" -{ yyval.intValue=PTR_TK; ; - break;} -case 13: -#line 852 "goomsl_yacc.y" -{ gsl_declare_external_task(yyvsp[0].strValue); gsl_enternamespace(yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); ; - break;} -case 16: -#line 858 "goomsl_yacc.y" -{ gsl_leavenamespace(); ; - break;} -case 17: -#line 860 "goomsl_yacc.y" -{ gsl_append(new_function_intro(yyvsp[-2].strValue)); ; - break;} -case 18: -#line 861 "goomsl_yacc.y" -{ gsl_append(new_function_intro(yyvsp[-4].strValue)); ; - break;} -case 19: -#line 862 "goomsl_yacc.y" -{ gsl_append(new_function_outro()); ; - break;} -case 20: -#line 864 "goomsl_yacc.y" -{ gsl_declare_task(yyvsp[0].strValue); gsl_enternamespace(yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); strcpy(yyval.strValue,yyvsp[0].strValue); ; - break;} -case 21: -#line 865 "goomsl_yacc.y" -{ gsl_leavenamespace(); ; - break;} -case 22: -#line 867 "goomsl_yacc.y" -{ gsl_append(yyvsp[0].nPtr); ; - break;} -case 23: -#line 868 "goomsl_yacc.y" -{ gsl_append(yyvsp[-2].nPtr); ; - break;} -case 24: -#line 871 "goomsl_yacc.y" -{ gsl_float_decl(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); ; - break;} -case 25: -#line 872 "goomsl_yacc.y" -{ gsl_int_decl(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); ; - break;} -case 26: -#line 873 "goomsl_yacc.y" -{ gsl_ptr_decl(yyvsp[-2].strValue); yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines), yyvsp[0].nPtr); ; - break;} -case 27: -#line 874 "goomsl_yacc.y" -{ yyval.nPtr = 0; gsl_float_decl(yyvsp[0].strValue); ; - break;} -case 28: -#line 875 "goomsl_yacc.y" -{ yyval.nPtr = 0; gsl_int_decl(yyvsp[0].strValue); ; - break;} -case 29: -#line 876 "goomsl_yacc.y" -{ yyval.nPtr = 0; gsl_ptr_decl(yyvsp[0].strValue); ; - break;} -case 30: -#line 879 "goomsl_yacc.y" -{ yyval.nPtr = yyvsp[-1].nPtr; ; - break;} -case 31: -#line 880 "goomsl_yacc.y" -{ yyval.nPtr = yyvsp[-1].nPtr; ; - break;} -case 32: -#line 881 "goomsl_yacc.y" -{ yyval.nPtr = new_if(yyvsp[-4].nPtr,yyvsp[0].nPtr); ; - break;} -case 33: -#line 882 "goomsl_yacc.y" -{ yyval.nPtr = new_while(yyvsp[-4].nPtr,yyvsp[0].nPtr); ; - break;} -case 34: -#line 883 "goomsl_yacc.y" -{ lastNode = yyvsp[-3].nPtr->unode.opr.op[1]; yyval.nPtr=yyvsp[-3].nPtr; ; - break;} -case 35: -#line 884 "goomsl_yacc.y" -{ yyval.nPtr = yyvsp[0].nPtr; ; - break;} -case 36: -#line 885 "goomsl_yacc.y" -{ yyval.nPtr = new_plus_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); ; - break;} -case 37: -#line 886 "goomsl_yacc.y" -{ yyval.nPtr = new_sub_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); ; - break;} -case 38: -#line 887 "goomsl_yacc.y" -{ yyval.nPtr = new_mul_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); ; - break;} -case 39: -#line 888 "goomsl_yacc.y" -{ yyval.nPtr = new_div_eq(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); ; - break;} -case 42: -#line 893 "goomsl_yacc.y" -{ yyval.nPtr = new_call(yyvsp[-2].strValue,NULL); ; - break;} -case 43: -#line 894 "goomsl_yacc.y" -{ yyval.nPtr = new_call(yyvsp[-4].strValue,yyvsp[-2].nPtr); ; - break;} -case 44: -#line 897 "goomsl_yacc.y" -{ yyval.nPtr = new_affec_list(yyvsp[-1].nPtr,yyvsp[0].nPtr); ; - break;} -case 45: -#line 898 "goomsl_yacc.y" -{ yyval.nPtr = new_affec_list(yyvsp[0].nPtr,NULL); ; - break;} -case 46: -#line 900 "goomsl_yacc.y" -{ yyval.nPtr = new_set(new_var(yyvsp[-2].strValue,currentGoomSL->num_lines),yyvsp[0].nPtr); ; - break;} -case 47: -#line 903 "goomsl_yacc.y" -{ yyval.nPtr = new_block(lastNode); lastNode = yyval.nPtr->unode.opr.op[0]; ; - break;} -case 48: -#line 906 "goomsl_yacc.y" -{ yyval.nPtr = new_var(yyvsp[0].strValue,currentGoomSL->num_lines); ; - break;} -case 49: -#line 907 "goomsl_yacc.y" -{ yyval.nPtr = yyvsp[0].nPtr; ; - break;} -case 50: -#line 908 "goomsl_yacc.y" -{ yyval.nPtr = new_mul(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 51: -#line 909 "goomsl_yacc.y" -{ yyval.nPtr = new_div(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 52: -#line 910 "goomsl_yacc.y" -{ yyval.nPtr = new_add(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 53: -#line 911 "goomsl_yacc.y" -{ yyval.nPtr = new_sub(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 54: -#line 912 "goomsl_yacc.y" -{ yyval.nPtr = yyvsp[-1].nPtr; ; - break;} -case 55: -#line 913 "goomsl_yacc.y" -{ yyval.nPtr = new_call_expr(yyvsp[-2].strValue,NULL); ; - break;} -case 56: -#line 914 "goomsl_yacc.y" -{ yyval.nPtr = new_call_expr(yyvsp[-4].strValue,yyvsp[-2].nPtr); ; - break;} -case 57: -#line 917 "goomsl_yacc.y" -{ yyval.nPtr=yyvsp[0].nPtr; ; - break;} -case 58: -#line 918 "goomsl_yacc.y" -{ yyval.nPtr = new_equ(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 59: -#line 919 "goomsl_yacc.y" -{ yyval.nPtr = new_low(yyvsp[-2].nPtr,yyvsp[0].nPtr); ; - break;} -case 60: -#line 920 "goomsl_yacc.y" -{ yyval.nPtr = new_low(yyvsp[0].nPtr,yyvsp[-2].nPtr); ; - break;} -case 61: -#line 921 "goomsl_yacc.y" -{ yyval.nPtr = new_not(new_low(yyvsp[-2].nPtr,yyvsp[0].nPtr)); ; - break;} -case 62: -#line 922 "goomsl_yacc.y" -{ yyval.nPtr = new_not(new_low(yyvsp[0].nPtr,yyvsp[-2].nPtr)); ; - break;} -case 63: -#line 923 "goomsl_yacc.y" -{ yyval.nPtr = new_not(yyvsp[0].nPtr); ; - break;} -case 64: -#line 926 "goomsl_yacc.y" -{ yyval.nPtr = new_constFloat(yyvsp[0].strValue,currentGoomSL->num_lines); ; - break;} -case 65: -#line 927 "goomsl_yacc.y" -{ yyval.nPtr = new_constInt(yyvsp[0].strValue,currentGoomSL->num_lines); ; - break;} -case 66: -#line 928 "goomsl_yacc.y" -{ yyval.nPtr = new_constPtr(yyvsp[0].strValue,currentGoomSL->num_lines); ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" +/* Line 999 of yacc.c. */ +#line 2792 "goomsl_yacc.c" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - /* 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. */ + /* 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 - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) { - strcpy(msg, "parse error"); + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); - if (count < 5) + if (yycount < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; } } - yyerror(msg); - free(msg); + yyerror (yymsg); + YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exceeded"); + yyerror ("syntax error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror ("syntax error"); } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - /* return failure if at end of input */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); yychar = YYEMPTY; - } - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ + } -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG != 0 - if (yydebug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif + YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 1; +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; } -#line 931 "goomsl_yacc.y" + + +#line 1396 "goomsl_yacc.y" @@ -2067,3 +2994,4 @@ void yyerror(char *str) exit(1); } /* }}} */ + diff --git a/src/post/goom/goomsl_yacc.h b/src/post/goom/goomsl_yacc.h index 8f3ecf476..fae0c010f 100644 --- a/src/post/goom/goomsl_yacc.h +++ b/src/post/goom/goomsl_yacc.h @@ -1,28 +1,104 @@ -typedef union { +/* A Bison parser, made by GNU Bison 1.875. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + LTYPE_INTEGER = 258, + LTYPE_FLOAT = 259, + LTYPE_VAR = 260, + LTYPE_PTR = 261, + PTR_TK = 262, + INT_TK = 263, + FLOAT_TK = 264, + DECLARE = 265, + EXTERNAL = 266, + WHILE = 267, + DO = 268, + NOT = 269, + PLUS_EQ = 270, + SUB_EQ = 271, + DIV_EQ = 272, + MUL_EQ = 273, + SUP_EQ = 274, + LOW_EQ = 275, + NOT_EQ = 276, + STRUCT = 277, + FOR = 278, + IN = 279 + }; +#endif +#define LTYPE_INTEGER 258 +#define LTYPE_FLOAT 259 +#define LTYPE_VAR 260 +#define LTYPE_PTR 261 +#define PTR_TK 262 +#define INT_TK 263 +#define FLOAT_TK 264 +#define DECLARE 265 +#define EXTERNAL 266 +#define WHILE 267 +#define DO 268 +#define NOT 269 +#define PLUS_EQ 270 +#define SUB_EQ 271 +#define DIV_EQ 272 +#define MUL_EQ 273 +#define SUP_EQ 274 +#define LOW_EQ 275 +#define NOT_EQ 276 +#define STRUCT 277 +#define FOR 278 +#define IN 279 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 1199 "goomsl_yacc.y" +typedef union YYSTYPE { int intValue; float floatValue; char charValue; char strValue[2048]; NodeType *nPtr; + GoomHash *namespace; + GSL_Struct *gsl_struct; + GSL_StructField *gsl_struct_field; } YYSTYPE; -#define TYPE_INTEGER 257 -#define TYPE_FLOAT 258 -#define TYPE_VAR 259 -#define TYPE_PTR 260 -#define PTR_TK 261 -#define INT_TK 262 -#define FLOAT_TK 263 -#define DECLARE 264 -#define EXTERNAL 265 -#define WHILE 266 -#define DO 267 -#define NOT 268 -#define PLUS_EQ 269 -#define SUB_EQ 270 -#define DIV_EQ 271 -#define MUL_EQ 272 -#define SUP_EQ 273 -#define LOW_EQ 274 - +/* Line 1240 of yacc.c. */ +#line 95 "goomsl_yacc.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE yylval; + + + diff --git a/src/post/goom/ifs.c b/src/post/goom/ifs.c index 901bf7348..c51faae8b 100644 --- a/src/post/goom/ifs.c +++ b/src/post/goom/ifs.c @@ -70,7 +70,12 @@ IFSPoint; #define LRAND() ((long) (goom_random(goomInfo->gRandom) & 0x7fffffff)) #define NRAND(n) ((int) (LRAND() % (n))) + +#if RAND_MAX < 0x10000 +#define MAXRAND (((float)(RAND_MAX<16)+((float)RAND_MAX)+1.0f)/127.0f) +#else #define MAXRAND (2147483648.0/127.0) /* unsigned 1<<31 / 127.0 (cf goom_tools) as a float */ +#endif /*****************************************************/ @@ -498,6 +503,13 @@ static void ifs_update (PluginInfo *goomInfo, Pixel * data, Pixel * back, int in for (i = 0; i < 4; i++) { *tmp = (*tmp) >> cycle10; + + /* xine: make it darker */ + if( *tmp && !((*tmp) >> 1) ) + *tmp = 1; + else + *tmp = (*tmp) >> 1; + tmp++; } } @@ -735,7 +747,7 @@ static void ifs_vfx_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo * /*TODO: trouver meilleur soluce pour increment (mettre le code de gestion de l'ifs dans ce fichier: ifs_vfx_apply) */ } -static void ifs_vfx_init(VisualFX *_this) { +static void ifs_vfx_init(VisualFX *_this, PluginInfo *info) { IfsData *data = (IfsData*)malloc(sizeof(IfsData)); data->Root = (FRACTAL*)NULL; diff --git a/src/post/goom/lines.c b/src/post/goom/lines.c index 877f1894c..304406ffa 100644 --- a/src/post/goom/lines.c +++ b/src/post/goom/lines.c @@ -82,19 +82,19 @@ static guint32 getcouleur (int mode) { switch (mode) { case GML_RED: - return (230 << (ROUGE * 8)) | (120 << (VERT * 8)) | (10 << (BLEU * 8)); + return (230 << (ROUGE * 8)) | (120 << (VERT * 8)) | (18 << (BLEU * 8)); case GML_ORANGE_J: - return (120 << (VERT * 8)) | (252 << (ROUGE * 8)) | (10 << (BLEU * 8)); + return (120 << (VERT * 8)) | (252 << (ROUGE * 8)) | (18 << (BLEU * 8)); case GML_ORANGE_V: return (160 << (VERT * 8)) | (236 << (ROUGE * 8)) | (40 << (BLEU * 8)); case GML_BLEUBLANC: return (40 << (BLEU * 8)) | (220 << (ROUGE * 8)) | (140 << (VERT * 8)); case GML_VERT: - return (200 << (VERT * 8)) | (80 << (ROUGE * 8)) | (10 << (BLEU * 8)); + return (200 << (VERT * 8)) | (80 << (ROUGE * 8)) | (18 << (BLEU * 8)); case GML_BLEU: return (250 << (BLEU * 8)) | (30 << (VERT * 8)) | (80 << (ROUGE * 8)); case GML_BLACK: - return 0x5 << (BLEU * 8); + return (16 << (BLEU * 8)) | (16 << (VERT * 8)) | (16 << (ROUGE * 8)); } return 0; } diff --git a/src/post/goom/mmx.h b/src/post/goom/mmx.h index e43a1987c..3fae26b98 100755 --- a/src/post/goom/mmx.h +++ b/src/post/goom/mmx.h @@ -72,9 +72,9 @@ mm_support(void) register int rval = 0; __asm__ __volatile__ ( - "push %%ebx\n\t" /* See if CPUID instruction is supported ... */ /* ... Get copies of EFLAGS into eax and ecx */ + "pushl %%ebx\n\t" "pushf\n\t" "popl %%eax\n\t" "movl %%eax, %%ecx\n\t" @@ -215,7 +215,7 @@ mm_support(void) "movl $0, %0\n\n\t" "Return:\n\t" - "pop %%ebx\n\t" + "popl %%ebx\n\t" : "=X" (rval) : /* no input */ : "eax", "ecx", "edx" diff --git a/src/post/goom/motif_goom1.h b/src/post/goom/motif_goom1.h new file mode 100644 index 000000000..b4a9f3f1d --- /dev/null +++ b/src/post/goom/motif_goom1.h @@ -0,0 +1,1026 @@ +static Motif CONV_MOTIF1 = { + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,14,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,13,9,9,7,2,2,9,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,11, + 11,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,12,7,4,0,0,0,2,0,0,3,14,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,12,10,9,9,4,1,0, + 1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,10,3,0,0,0,1,1,3,5,0,0,1,14,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,6,3,1,1,4,9,1, + 1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 10,3,0,0,2,7,13,14,14,14,7,0,0,2,14,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,12,1,9,15,15,15,15,3, + 0,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,4, + 0,0,2,10,15,15,15,15,15,15,1,0,0,10,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,9,0,2,14,15,15,15,7, + 0,9,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,14,6,0,0, + 2,9,15,15,15,15,15,15,15,13,0,0,3,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,11,0,0,10,15,15,15,9, + 0,9,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,13,3,0,1,5, + 5,4,4,4,6,12,15,15,15,13,0,0,7,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,0,0,5,15,15,15,10, + 0,7,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,11,1,0,3,3,1, + 0,0,0,0,0,0,5,13,15,12,0,0,13,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,13,14,15, + 15,15,15,15,15,15,15,15,14,0,0,1,15,15,15,12, + 0,3,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,10,1,2,4,0,0,1, + 9,12,12,12,9,3,0,2,14,5,0,7,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,14,7,4,4,1,1,12, + 15,15,15,15,15,15,15,15,14,1,0,0,12,15,15,15, + 1,0,12,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,10,0,3,2,0,0,3,12, + 15,15,15,15,15,14,2,1,13,2,0,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,3,0,0,0,0,0,2, + 13,15,15,15,15,15,15,15,14,1,0,0,8,15,15,15, + 1,0,9,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,12,2,1,0,0,0,9,14,15, + 15,15,15,15,15,14,1,1,11,0,3,14,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,7,4,11,12,10,1,0, + 3,12,15,15,15,15,15,15,13,1,1,0,4,15,15,15, + 2,0,10,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,2,1,0,0,3,12,15,15,15, + 15,15,15,15,15,11,0,5,9,1,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,5,1,13,15,15,12,1, + 0,1,9,15,15,15,15,15,14,2,5,0,1,14,15,15, + 2,0,7,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,14,3,0,0,0,7,14,15,15,15,15, + 15,15,15,15,15,9,0,8,7,4,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,7,0,7,8,11,15,13, + 2,0,0,3,10,15,15,15,15,5,11,0,0,11,15,15, + 6,0,2,14,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,6,0,0,0,8,15,15,15,15,15,15, + 15,15,15,15,15,6,0,4,0,6,15,15,15,15,15,15, + 14,9,14,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,11,0,3,3,0,8,15, + 14,5,0,0,0,4,12,15,15,5,13,2,0,6,15,15, + 12,0,0,11,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,10,0,0,0,8,15,15,15,15,15,15,15, + 15,15,15,15,10,1,7,6,4,13,15,15,15,15,13,11, + 6,0,8,11,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,1,1,11,2,0,5, + 14,15,8,0,0,0,0,7,15,5,14,6,0,2,15,15, + 15,3,0,5,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,1,0,0,7,15,15,15,15,15,15,15,15, + 15,15,15,15,7,9,15,15,15,15,15,15,12,6,2,1, + 1,1,8,6,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,4,0,6,12,1,0, + 3,13,15,11,2,0,0,0,8,4,14,10,0,0,13,15, + 15,7,0,1,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,5,0,0,5,15,15,15,15,15,15,15,15,15, + 15,15,15,15,13,15,15,15,15,14,8,3,1,2,7,11, + 5,4,5,6,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,8,0,1,14,11,0, + 0,1,9,15,14,5,0,0,2,4,14,13,0,0,10,15, + 15,12,0,0,12,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,10,0,0,1,14,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,13,7,2,0,5,9,15,15,15, + 5,3,6,9,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,13,0,0,9,15,12, + 2,0,0,4,13,14,4,0,3,2,12,15,1,0,5,15, + 15,14,1,0,8,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,2,0,0,9,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,11,6,1,0,2,3,10,15,15,15,15,7, + 1,2,4,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,5,0,3,14,15, + 9,2,0,0,1,6,12,13,13,1,9,12,0,0,2,14, + 15,15,4,0,4,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,10,0,0,2,14,15,15,15,15,15,15,15,15,15,15, + 13,9,6,0,1,2,9,10,15,15,15,15,14,7,1,0, + 6,2,4,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,11,0,0,9,15, + 4,4,11,6,1,0,0,1,1,0,10,4,0,0,0,12, + 15,15,9,0,1,14,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,3,0,0,8,15,15,15,15,15,15,15,13,12,4,4, + 1,1,3,10,12,15,15,15,15,15,9,2,1,0,1,6, + 6,0,10,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,4,0,3,14, + 4,3,15,15,14,9,7,9,1,0,0,0,0,1,0,7, + 15,15,13,0,0,9,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 13,0,0,1,14,15,15,15,15,15,12,9,1,0,1,4, + 7,15,15,15,15,15,15,14,8,2,0,0,0,2,13,9, + 0,4,14,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,11,0,0,9, + 3,0,8,14,15,15,15,15,10,5,4,4,7,4,0,3, + 15,15,15,4,0,3,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 5,0,0,5,15,15,15,15,14,8,7,8,10,12,14,15, + 15,15,15,15,15,15,11,1,0,0,0,5,11,15,13,1, + 1,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,3,0,4, + 4,0,0,2,6,10,15,15,15,15,15,15,15,10,0,0, + 12,15,15,9,0,0,12,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 1,0,0,10,15,15,15,15,15,13,14,15,15,15,15,15, + 15,15,15,15,14,7,1,0,0,3,12,15,15,15,6,0, + 7,15,15,15,12,10,9,10,12,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,9,0,0, + 8,3,1,4,1,0,1,12,15,15,15,15,15,14,2,0, + 6,15,15,15,2,0,6,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 0,0,1,14,15,15,15,15,14,5,15,15,15,15,15,15, + 15,15,15,7,2,0,0,1,8,15,15,15,15,12,0,2, + 14,15,12,4,0,0,0,0,0,1,5,10,14,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,14,0,0, + 5,4,1,14,15,10,7,13,15,15,15,15,15,15,8,0, + 1,14,15,15,7,0,1,14,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 0,0,4,15,15,15,15,15,13,2,13,15,15,15,15,15, + 12,7,0,0,0,0,5,12,15,15,15,15,14,3,0,9, + 11,1,0,0,1,1,0,1,0,0,0,0,2,12,15,15, + 15,15,15,15,15,15,15,14,15,15,15,15,15,15,2,0, + 5,2,1,14,15,14,13,15,15,15,15,15,15,15,12,0, + 0,10,15,15,13,0,0,9,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12, + 0,0,4,15,15,15,15,15,12,0,12,15,15,15,12,6, + 0,0,0,0,6,14,15,15,15,15,15,15,7,0,0,12, + 1,0,0,2,2,1,1,7,12,8,3,0,0,1,13,15, + 15,15,15,15,15,8,4,8,12,15,15,15,15,15,8,0, + 4,2,0,14,15,11,9,15,15,15,15,15,15,15,15,3, + 0,5,15,15,15,5,0,3,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12, + 0,0,4,15,15,15,15,15,12,0,12,15,13,3,1,0, + 0,0,5,12,15,15,15,15,15,15,15,12,0,0,7,7, + 0,0,0,0,0,0,0,1,12,15,15,12,3,0,5,15, + 15,15,15,14,5,0,0,0,0,2,2,3,7,14,9,8, + 14,2,1,14,15,2,12,13,15,15,15,15,15,15,15,9, + 0,0,13,15,15,10,0,0,12,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 0,0,5,15,15,15,15,15,12,0,11,10,1,0,0,1, + 5,14,15,15,15,15,15,15,15,15,15,6,0,2,7,0, + 0,0,0,1,2,7,4,0,3,14,15,15,14,2,0,12, + 15,15,15,9,0,1,2,1,0,0,0,0,0,1,3,7, + 15,3,0,14,15,4,12,15,15,15,15,15,15,15,15,14, + 1,0,8,15,15,14,1,0,8,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 0,0,4,15,15,15,15,15,12,0,2,0,0,1,10,15, + 15,15,15,15,15,15,15,15,15,15,12,0,0,6,0,0, + 0,1,10,14,15,15,11,1,0,9,15,15,15,8,0,9, + 15,15,12,4,8,14,15,8,1,0,0,0,0,0,1,9, + 15,2,0,13,15,1,9,15,15,15,15,15,15,15,15,15, + 6,0,1,14,15,14,1,0,3,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14, + 1,0,1,14,15,15,15,15,12,1,3,7,9,13,15,15, + 15,15,15,15,15,15,15,15,15,15,3,0,2,3,0,4, + 0,8,15,15,15,15,15,13,1,2,14,15,15,10,0,6, + 15,14,2,6,15,15,15,1,3,7,3,0,0,0,0,1, + 11,1,0,11,12,0,12,15,15,15,15,15,15,15,15,15, + 11,0,0,9,15,15,4,0,0,12,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 6,0,0,9,15,15,15,15,15,12,14,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,11,0,0,3,0,8,14, + 2,5,15,15,15,15,15,15,5,0,8,15,15,12,0,4, + 15,5,2,14,15,15,10,0,13,15,13,2,4,5,5,0, + 9,1,0,10,9,1,14,15,15,15,15,15,15,15,15,15, + 13,0,0,3,15,15,9,0,0,8,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 12,0,0,3,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,3,0,1,1,5,14,15, + 11,0,12,15,15,15,15,15,14,1,1,14,15,12,0,4, + 10,0,9,15,15,11,1,8,15,15,8,1,14,15,14,2, + 5,0,0,10,6,2,15,15,15,15,15,15,15,15,15,15, + 15,3,0,0,12,15,13,0,0,2,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,3,0,0,10,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,10,0,0,1,0,11,15,15, + 15,2,6,15,15,15,15,15,15,6,0,9,15,13,0,6, + 3,0,13,15,14,2,6,15,15,13,1,8,15,15,15,4, + 3,1,0,10,7,2,15,15,15,15,15,15,15,15,15,15, + 15,9,0,0,6,15,15,3,0,0,13,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,9,0,0,2,14,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,11,10,2,0,3,0,3,15,15,15, + 15,8,1,14,15,15,15,15,15,13,0,2,15,9,1,10, + 0,3,15,15,6,2,14,15,14,3,1,14,15,15,15,2, + 4,0,0,12,5,3,15,15,15,15,15,15,15,15,15,15, + 15,14,1,0,1,14,15,5,0,0,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,4,0,0,6,15,15,15,15,15,15,15,15,14,12, + 12,9,5,4,4,3,0,0,0,0,4,0,8,15,15,15, + 15,13,1,10,15,15,15,15,15,15,2,0,11,3,5,10, + 0,7,15,9,1,11,15,15,8,0,6,15,15,15,10,0, + 3,0,0,13,3,6,15,15,15,15,15,15,15,15,15,15, + 15,15,6,0,0,12,15,5,0,0,7,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,13,1,0,0,8,14,15,15,13,6,4,4,1,0, + 0,0,0,0,0,0,2,0,0,4,3,0,12,15,15,15, + 15,15,5,3,15,15,15,15,14,8,0,0,1,1,12,9, + 0,9,10,0,6,15,15,15,2,2,14,15,15,13,2,0, + 4,0,1,13,0,10,15,15,15,15,15,15,15,15,15,15, + 15,15,13,1,0,10,15,10,0,0,5,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,9,0,0,0,3,2,2,1,0,0,0,1,4, + 4,5,10,12,12,12,11,0,0,11,4,0,12,15,15,15, + 15,15,12,0,7,13,15,15,5,0,0,0,1,6,15,9, + 0,3,0,0,1,6,14,10,0,12,15,15,11,2,0,2, + 3,0,3,12,1,11,15,15,15,15,15,15,15,15,15,15, + 15,15,15,3,0,6,8,7,0,0,5,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,9,1,0,0,0,2,6,10,12,12,14,15, + 15,15,15,15,11,5,4,0,2,14,4,0,12,15,15,15, + 15,15,15,4,0,3,13,6,0,0,0,1,2,14,15,12, + 0,0,0,0,0,0,2,2,6,15,14,8,0,0,0,7, + 4,0,4,12,0,12,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,0,0,0,0,0,1,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,12,2,0,0,0,1,6,11,15,15,15, + 15,15,15,15,2,1,0,0,9,15,6,0,7,15,15,15, + 15,15,15,13,2,0,0,0,0,0,0,1,12,15,15,15, + 4,0,0,0,0,0,0,6,13,6,1,0,0,4,13,15, + 6,0,6,12,0,12,15,15,15,15,15,15,15,15,15,15, + 15,15,15,14,5,0,0,0,0,0,5,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,5,0,0,0,0,0,2,4,5, + 7,3,6,3,0,2,0,2,15,15,11,0,0,9,15,15, + 15,15,15,15,11,0,0,0,0,0,2,11,15,15,15,15, + 12,1,0,0,1,4,6,10,2,0,0,0,7,14,15,15, + 9,0,9,9,0,12,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,13,9,8,9,7,13,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,12,6,1,0,0,0,0,0, + 0,0,0,2,8,0,0,9,15,15,14,4,0,0,3,10, + 14,15,15,15,15,13,3,0,0,4,14,15,15,15,15,15, + 15,11,2,0,0,1,1,0,0,0,1,11,15,15,15,15, + 9,0,10,5,3,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,14,12,10,5,4,6, + 2,4,10,14,8,0,1,14,15,15,15,14,5,0,0,0, + 1,2,4,4,4,3,1,2,9,14,15,15,15,15,15,15, + 15,15,15,11,11,13,10,9,9,11,15,15,15,15,15,15, + 10,0,8,2,4,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 2,7,15,14,1,0,6,15,15,15,15,15,15,10,6,4, + 2,2,4,4,4,3,9,14,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 11,0,3,1,4,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,11, + 1,10,15,9,0,0,13,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 11,0,11,11,11,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,2, + 5,15,14,2,0,5,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 14,1,13,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,10,1, + 13,15,11,0,0,12,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,5,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,8,1, + 15,15,5,0,3,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,10,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,12,2,3, + 15,14,1,0,7,15,15,15,15,15,13,15,15,15,15,14, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,13,12,12,11,9,4,7,14,15, + 14,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,12,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,14,3,0,10, + 15,9,0,0,8,7,4,2,2,1,0,3,4,3,4,9, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,14,13,11,7,4,2,0,0,0,0,0,0,1,12,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,14,13,11,7,4,2,2,13,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,12,0,3,11, + 7,1,0,0,0,0,0,1,4,9,11,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,14,12,11,9,7,4, + 3,1,0,0,0,0,0,0,0,0,0,2,11,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,13,11,8, + 4,3,1,0,0,0,0,3,8,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,14,11,3,0,0,0, + 0,0,0,2,6,9,12,14,15,15,15,15,15,15,15,15, + 15,15,15,15,15,13,9,6,3,1,0,0,0,0,0,0, + 0,0,0,0,1,4,7,11,12,12,12,14,15,15,15,15, + 15,15,15,15,15,15,15,14,12,11,7,4,2,0,0,0, + 0,0,0,1,5,10,13,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,12,7,3,1,0,0,0,2,5, + 2,0,2,14,15,15,15,15,15,15,15,15,15,14,13,12, + 11,9,6,4,2,0,0,0,0,0,0,0,0,1,2,4, + 5,9,11,13,15,15,15,15,15,15,15,15,15,15,15,15, + 15,14,12,11,7,4,3,1,0,0,0,0,0,0,0,1, + 4,5,10,14,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,10,5,1,0,0,0,1,0,0,2,13,14, + 1,0,8,15,15,14,12,11,9,8,4,3,2,1,0,0, + 0,0,0,0,1,3,2,3,5,9,10,12,13,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,13,11,10,6,4, + 3,1,0,0,0,0,0,0,0,0,1,4,7,11,13,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,11,4,0,0,0,1,4,9,13,13,1,0,0,1,7, + 0,0,7,8,5,2,0,0,0,0,0,0,1,2,3,4, + 5,9,10,12,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,14,11,8,4,3,1,0,0,0,0,0, + 0,0,0,0,1,4,5,9,12,13,15,15,15,15,15,15, + 15,15,14,12,9,8,8,7,4,2,5,4,5,5,12,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,14,10,5, + 1,0,1,3,6,11,14,15,15,15,15,13,12,8,3,2, + 0,0,1,1,3,3,4,5,8,10,12,13,14,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 11,9,6,4,2,1,0,0,0,0,0,0,0,1,2,4, + 6,10,11,13,15,15,15,15,15,15,15,15,13,11,9,7, + 4,2,1,0,0,0,0,2,4,7,12,14,14,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,10,5,1,1,3, + 8,12,14,15,15,15,15,15,15,15,15,15,15,15,15,9, + 3,11,14,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,8,6,9,9,9,9,9,8,5,4,4,3,1,0, + 0,0,0,0,1,2,3,2,4,5,9,11,12,14,15,15, + 15,15,15,15,15,15,15,14,12,9,5,2,0,0,0,0, + 0,1,2,4,7,10,14,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,9,4,1,3,9,13,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 11,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,13,3,1,1,1,1,1,1,1,0,0,0,0,2,3, + 5,8,10,12,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,12,5,2,0,0,0,1,3,4,7,10, + 12,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,13,11,13,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,14,12,12,12,13,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,8,1,0,1,4,7,11,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,7,8,11,14,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 + }; diff --git a/src/post/goom/motif_goom2.h b/src/post/goom/motif_goom2.h new file mode 100644 index 000000000..4bde2a3d0 --- /dev/null +++ b/src/post/goom/motif_goom2.h @@ -0,0 +1,1026 @@ +static Motif CONV_MOTIF2 = { + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,12,5,14, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,12,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,10,1,14, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,10,0,12,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,6,0,12, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,7,0,8,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,13,2,0,10, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,6,0,2,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,5,0,0,10, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,9,0,0,12,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,14,9,0,0,1,14, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,8,0,0,8,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,8,3,0,0,0,9,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,11,0,0,2,14,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,9,5,3,4,1,0,0,0,0,7,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,14,4,0,0,4,11,13,13,15,15,14,12,10,8,5, + 6,4,1,0,0,0,0,0,0,0,0,0,0,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,12,1,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,9,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 13,9,10,13,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,3,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,2,5,6,0,0,0,0,12,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 5,0,0,0,3,10,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,14,9,2,1,0,0,0,1,4,6,6,1, + 0,0,0,8,13,15,15,15,12,1,0,2,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14, + 2,0,0,0,0,0,4,12,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,3,0,0,10,15,15,15,10, + 0,0,4,15,15,15,15,15,15,2,0,6,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,5, + 3,11,5,0,0,0,0,0,4,11,14,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,0,13,15,15,15,11, + 0,0,7,15,15,15,15,15,15,1,0,9,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,9,0, + 13,15,15,12,5,0,0,0,0,0,1,8,14,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,1,14,15,15,15,11, + 0,0,7,15,15,15,15,15,14,0,0,9,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,11,1,10, + 15,15,15,15,15,11,5,0,0,0,0,0,1,6,13,15, + 15,15,15,15,14,8,11,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,6,0,2,15,15,15,15,11, + 0,0,6,15,15,15,15,15,13,0,0,11,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,11,1,6,15, + 15,15,15,15,15,15,15,14,5,0,0,0,0,0,0,6, + 14,15,15,15,6,0,4,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,5,15,15,15,15,11, + 0,0,5,15,15,15,15,15,12,0,0,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,13,2,1,13,15, + 15,15,15,15,15,15,15,15,15,12,2,0,0,0,0,0, + 1,6,11,7,0,0,4,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,7,15,15,15,15,11, + 0,0,6,15,15,15,15,15,12,0,0,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,5,0,7,15,15, + 15,15,15,15,15,15,15,15,15,15,15,11,5,0,0,0, + 0,0,0,0,0,1,11,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,10,15,15,15,15,11, + 0,0,6,15,15,15,15,15,12,0,0,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,10,0,4,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,13,7,0, + 0,0,0,0,0,1,6,12,14,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,10,15,15,15,15,11, + 0,0,7,15,15,15,15,15,12,0,0,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,13,1,1,12,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13, + 5,0,0,0,0,0,0,0,3,10,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,10,15,15,15,15,11, + 0,0,7,15,15,15,15,15,11,0,0,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,14,4,0,8,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 13,0,0,0,1,0,0,0,0,1,13,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,10,15,15,15,15,11, + 0,0,8,15,15,15,15,15,8,0,2,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,9,0,4,14,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14, + 4,0,0,5,13,12,6,2,0,2,13,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,7,0,10,15,15,15,15,11, + 0,0,7,15,15,15,15,15,4,0,4,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,13,1,1,13,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,11, + 0,0,1,13,15,15,15,14,9,13,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,5,0,6,15,15,15,15,11, + 0,0,8,15,15,15,15,15,2,0,8,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,5,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,14,11,15,15,15,15,15,15,15,9, + 0,0,10,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,4,0,4,15,15,15,15,11, + 0,0,7,15,15,15,15,13,0,0,11,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,10,0,3,14,15,15,15,15,15,15, + 15,15,15,15,15,14,3,0,13,15,15,15,15,15,15,14, + 9,11,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,4,0,4,15,15,15,15,11, + 0,0,8,15,15,15,15,12,0,0,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,14,2,1,12,15,15,15,15,15,15,15, + 15,15,15,15,14,3,0,0,9,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,6,0,3,15,15,15,15,13, + 1,0,8,15,15,15,15,12,0,0,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,9,0,5,15,15,15,15,15,15,15,15, + 15,15,15,14,4,0,0,0,10,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,8,0,2,15,15,15,15,15, + 3,0,13,15,15,15,15,12,0,0,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,13,2,1,12,15,15,15,15,15,15,15,15, + 15,15,15,7,0,0,0,0,8,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,10,0,1,14,15,15,15,15, + 11,5,15,15,15,15,15,12,0,0,11,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,6,0,7,15,15,15,15,15,15,15,15,15, + 15,15,8,0,0,0,0,0,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,12,0,0,12,15,15,15,15, + 15,14,15,15,15,15,15,10,0,0,12,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,1,2,14,15,15,15,15,15,15,15,15,15, + 15,10,0,0,0,6,6,0,0,0,5,12,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,12, + 15,15,15,15,15,15,15,15,13,0,0,11,15,15,15,15, + 15,15,15,15,15,15,15,9,0,1,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,7,0,8,15,15,15,15,15,15,15,15,15,15, + 15,9,0,0,4,15,15,8,0,0,0,1,5,13,15,15, + 15,15,15,15,15,15,15,15,15,15,12,8,7,6,5,3, + 3,3,4,12,15,15,15,15,15,15,15,15,15,7,0,6, + 15,15,15,15,15,15,15,15,14,1,0,10,15,15,15,15, + 15,15,15,15,15,15,15,6,0,3,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,13,1,0,13,15,15,15,15,15,15,15,15,15,15, + 15,14,7,8,13,15,15,15,11,2,0,0,0,0,5,11, + 15,15,15,15,15,15,15,15,13,3,0,0,0,0,0,0, + 0,0,0,5,15,15,15,15,15,15,15,15,12,1,0,0, + 3,11,15,15,15,15,15,15,13,1,0,10,15,15,15,15, + 15,15,15,15,15,15,15,3,0,5,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,9,0,5,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,14,8,1,0,0,0,0, + 4,12,15,15,15,15,15,15,4,0,0,0,0,0,0,0, + 0,0,0,2,15,15,15,15,15,15,15,14,4,0,0,0, + 0,0,9,15,15,15,15,15,14,1,0,10,15,15,15,15, + 15,15,15,15,15,15,15,2,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,14,4,0,11,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,14,8,2,0,0, + 0,0,4,10,14,15,15,15,4,0,0,0,0,0,0,0, + 0,0,0,3,15,15,15,15,15,15,15,6,0,0,0,2, + 3,0,0,8,15,15,15,15,14,1,0,10,15,15,15,15, + 15,15,15,15,15,15,15,1,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 14,5,0,4,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,14,9,3, + 0,0,0,0,2,5,10,15,5,0,1,11,11,12,13,15, + 11,0,0,7,15,15,15,15,15,15,8,0,0,0,1,12, + 14,6,0,0,7,14,15,15,14,1,0,9,15,15,15,15, + 15,15,15,15,15,15,15,2,0,10,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 9,0,1,13,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14, + 10,2,0,0,0,0,1,14,4,0,1,14,15,15,15,15, + 9,0,0,9,15,15,15,15,15,9,0,0,0,0,9,15, + 15,15,7,0,0,6,14,15,15,3,0,6,15,15,15,15, + 15,15,15,15,15,15,15,1,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,9, + 0,0,1,10,14,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,13,1,0,0,0,1,14,3,0,0,14,15,15,15,15, + 5,0,0,11,15,15,15,15,13,1,0,0,0,6,15,15, + 15,15,15,8,0,0,2,10,15,6,0,3,15,15,15,15, + 15,15,15,15,15,15,15,2,0,10,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,1, + 0,0,0,0,3,9,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,6,1,0,0,0,8,15,1,0,0,14,15,15,15,15, + 4,0,0,13,15,15,15,14,4,0,0,0,3,14,15,15, + 15,15,15,15,5,0,0,1,14,9,0,1,14,15,15,15, + 15,15,15,15,15,15,15,1,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,1, + 0,0,0,0,0,0,4,12,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 9,0,0,0,0,7,15,15,1,0,0,14,15,15,15,14, + 2,0,1,14,15,15,15,12,0,0,0,3,13,15,15,15, + 15,15,15,9,0,0,0,1,14,12,0,0,12,15,15,15, + 15,15,15,15,15,15,14,1,0,10,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12, + 3,0,0,0,0,0,0,1,8,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,9, + 0,0,0,0,7,15,15,15,1,0,0,14,15,15,15,13, + 0,0,1,15,15,15,15,12,0,0,0,6,14,15,15,15, + 15,15,12,0,0,0,0,3,14,12,0,0,12,15,15,15, + 15,15,15,15,15,15,12,0,0,12,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,13,3,0,0,0,0,0,0,1,6,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,0, + 0,0,0,3,15,15,15,12,0,0,0,14,15,15,15,11, + 0,0,3,15,15,15,15,15,12,7,0,0,4,14,15,15, + 15,11,1,0,0,0,4,13,15,12,0,0,12,15,15,15, + 15,15,15,15,15,15,10,0,1,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,7,0,0,0,0,0,0,0,3,8,12,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,0, + 0,0,1,13,15,15,15,6,0,0,0,14,15,15,15,8, + 0,0,7,15,15,15,15,15,15,15,8,1,0,2,13,15, + 14,2,0,0,0,4,14,15,15,13,1,0,10,15,15,15, + 15,15,15,15,15,15,9,0,2,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,11,6,2,0,0,0,0,0,0,0,1, + 10,15,15,15,15,15,15,15,15,15,15,15,15,8,0,0, + 0,0,10,15,15,15,15,4,0,0,1,15,15,15,15,4, + 0,0,8,15,15,15,15,15,15,15,15,10,1,0,1,8, + 2,0,0,0,5,15,15,15,15,15,2,0,6,15,15,15, + 15,15,15,15,15,15,9,0,1,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,9,1,0,0,0,0,0,0, + 0,1,7,13,14,15,15,15,15,15,15,15,9,0,0,0, + 0,6,15,15,15,15,15,4,0,0,4,15,15,15,14,1, + 0,0,9,15,15,15,15,15,15,15,15,15,12,2,0,0, + 0,0,0,4,14,15,15,15,15,15,4,0,4,15,15,15, + 15,15,15,15,15,15,7,0,0,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,14,11,6,2,0,0,0, + 0,0,0,0,1,9,12,15,15,15,15,14,3,0,0,0, + 4,15,15,15,15,15,15,4,0,0,3,6,4,4,2,0, + 0,0,13,15,15,15,15,15,15,15,15,15,15,12,1,0, + 0,0,3,14,15,15,15,15,15,15,4,0,4,15,15,15, + 15,15,15,15,15,15,5,0,0,12,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,8,2,0, + 0,0,0,0,0,0,0,1,9,15,15,5,0,0,0,0, + 12,15,15,15,15,15,15,4,0,0,0,0,0,0,0,0, + 0,3,15,15,15,15,15,15,15,15,15,15,15,14,4,0, + 0,1,12,15,15,15,15,15,15,15,6,0,1,14,15,15, + 15,15,15,15,15,15,5,0,0,13,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12, + 7,1,0,0,0,0,0,0,0,5,7,0,0,0,0,10, + 15,15,15,15,15,15,15,7,0,0,0,0,0,0,0,0, + 1,10,15,15,15,15,15,15,15,15,15,15,15,14,3,0, + 3,12,15,15,15,15,15,15,15,15,12,0,0,12,15,15, + 15,15,15,15,15,15,5,0,0,1,1,4,11,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,11,6,1,0,0,0,0,0,0,0,0,0,7,15, + 15,15,15,15,15,15,15,14,7,4,4,4,5,9,12,13, + 14,15,15,15,15,15,15,15,15,15,15,15,15,15,11,9, + 14,15,15,14,12,11,11,11,10,9,7,0,0,5,13,15, + 15,15,15,15,15,12,1,0,0,0,0,0,0,10,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,14,7,1,0,0,0,0,0,3,14,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,13,2,0,0,0,0,0,0,0,0,0,0,0,8, + 15,15,15,15,15,11,0,0,0,0,0,0,0,9,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,13,5,0,0,0,0,12,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,8,0,0,0,0,0,0,0,0,0,0,0,0,5, + 15,15,15,15,15,15,10,5,6,7,7,7,9,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,8,3,2,2,2,2,5,14,15, + 15,15,15,15,15,15,15,15,15,10,3,0,6,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,13,3,1,0,1,0,1,1,2,4,4,3,9,14, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,12,4,0,1,6,7,7,4,1,3,13, + 15,15,15,15,15,15,15,15,15,15,14,10,13,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,11,11,15,15,15,15, + 15,15,15,14,14,14,14,14,14,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,14,2,0,4,13,15,15,15,15,10,0,12, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,13,14,12,12,12,12,12,12,12, + 12,14,15,15,15,15,15,15,15,15,4,14,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,7,1,5,14,15,15,15,15,15,12,1,11, + 15,15,15,13,12,13,15,15,14,11,13,15,15,15,15,15, + 15,15,15,11,6,3,1,1,1,0,0,0,0,0,0,0, + 0,1,4,7,11,14,15,15,15,14,4,15,13,10,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,14,7,4,5, + 12,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,13,1,1,14,15,15,14,10,12,15,11,1,12, + 15,15,11,1,0,4,15,15,6,0,2,14,15,15,15,15, + 15,15,14,8,6,3,3,2,2,1,0,0,0,0,0,0, + 0,0,0,0,0,3,11,15,15,11,8,15,12,6,15,9, + 8,15,15,15,15,15,15,15,15,15,15,15,10,4,4,1, + 4,15,15,15,15,11,6,2,8,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,4,15,15,15,11,2,10,15,9,1,13, + 15,13,1,7,6,2,14,14,1,2,1,14,15,15,15,15, + 15,15,15,15,15,15,15,15,15,13,12,12,12,12,12,12, + 11,11,11,10,9,10,12,15,15,6,7,15,9,4,15,4, + 1,14,15,15,15,15,15,15,15,15,15,15,2,11,15,4, + 4,15,15,15,15,3,9,4,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,4,15,15,15,5,0,6,6,1,9,15, + 15,4,1,13,10,1,13,9,2,7,1,14,14,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,3,5,15,3,5,14,1, + 0,12,13,9,14,15,15,15,15,15,15,15,2,2,4,1, + 6,15,15,15,14,1,5,6,0,9,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,4,15,15,15,12,4,2,2,10,15,15, + 11,0,6,15,12,0,10,7,9,10,1,14,7,14,15,15, + 15,15,15,15,15,15,13,12,11,11,10,9,9,10,11,13, + 15,15,15,15,15,15,15,15,15,1,9,15,2,7,14,1, + 0,10,7,0,8,15,15,15,15,15,15,15,11,4,4,4, + 13,15,15,15,15,10,2,2,4,14,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,4,15,15,15,15,15,15,15,15,15,15, + 4,2,14,15,15,1,9,5,14,9,1,14,8,14,15,15, + 15,15,15,15,15,10,3,0,1,0,0,0,0,0,0,5, + 15,15,15,15,15,15,15,15,15,1,9,14,1,8,14,1, + 0,11,13,6,11,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,14,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,0,4,15,15,15,15,15,15,15,15,15,11, + 0,6,15,15,15,1,5,3,13,10,0,6,8,15,15,15, + 15,15,15,15,15,15,13,12,12,11,10,9,9,10,11,13, + 15,15,15,15,15,15,15,15,15,1,9,12,1,11,15,4, + 1,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 14,10,4,2,12,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,12,1,3,14,15,15,15,15,15,15,15,15,4, + 3,14,15,15,15,5,1,8,15,14,5,2,9,15,15,15, + 15,15,15,15,15,15,15,15,15,11,9,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,1,9,12,1,12,15,13, + 11,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 10,2,9,2,3,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,14,4,0,5,14,15,15,15,15,15,15,11,0, + 6,15,15,15,15,15,14,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,8,1,0,3,15,15,15,15, + 15,15,15,15,15,15,15,15,15,1,9,15,11,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 7,1,12,6,1,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,11,1,0,3,8,9,9,10,11,9,5,4, + 13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,12,9,13,15,15,15,15, + 15,15,15,15,15,15,15,15,15,5,11,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 10,3,4,1,5,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,12,2,0,0,0,0,0,0,1,8,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,14,12,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,13,8,8,10,9,10,11,14,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 + }; diff --git a/src/post/goom/plugin_info.c b/src/post/goom/plugin_info.c index 856dd8aa5..7fbdd4125 100644 --- a/src/post/goom/plugin_info.c +++ b/src/post/goom/plugin_info.c @@ -28,7 +28,7 @@ static void setOptimizedMethods(PluginInfo *p) { /* set default methods */ p->methods.draw_line = draw_line; p->methods.zoom_filter = zoom_filter_c; - p->methods.create_output_with_brightness = create_output_with_brightness; +/* p->methods.create_output_with_brightness = create_output_with_brightness;*/ #ifdef CPU_X86 if (cpuFlavour & CPU_OPTION_XMMX) { @@ -54,16 +54,16 @@ static void setOptimizedMethods(PluginInfo *p) { #ifdef CPU_POWERPC if ((cpuFlavour & CPU_OPTION_64_BITS) != 0) { - p->methods.create_output_with_brightness = ppc_brightness_G5; +/* p->methods.create_output_with_brightness = ppc_brightness_G5; */ p->methods.zoom_filter = ppc_zoom_generic; } else if ((cpuFlavour & CPU_OPTION_ALTIVEC) != 0) { - p->methods.create_output_with_brightness = ppc_brightness_G4; +/* p->methods.create_output_with_brightness = ppc_brightness_G4; */ p->methods.zoom_filter = ppc_zoom_G4; } else { - p->methods.create_output_with_brightness = ppc_brightness_generic; +/* p->methods.create_output_with_brightness = ppc_brightness_generic;*/ p->methods.zoom_filter = ppc_zoom_generic; } #endif /* CPU_POWERPC */ diff --git a/src/post/goom/ppc_zoom_ultimate.s b/src/post/goom/ppc_zoom_ultimate.s index 7b349906e..da252c676 100644 --- a/src/post/goom/ppc_zoom_ultimate.s +++ b/src/post/goom/ppc_zoom_ultimate.s @@ -68,6 +68,8 @@ lwz r29,4(r31) ; py lwz r8,0(r30) ; px2 lwz r10,4(r30) ; py2 +b L1 +.align 5 L1: ; computes dynamically the position to fetch @@ -200,8 +202,20 @@ lwz r10,4(r30) ; py2 ;********************* lis r17,0x0F01 +b L100 +.align 5 L100: +addi r6,r6,4 + +; Optimization to ensure the destination buffer +; won't be loaded into the data cache +rlwinm. r0,r6,0,27,31 +bne+ L500 +dcbz 0,r6 +;dcba 0,r6 +L500: + ; computes dynamically the position to fetch ;mullw r8,r8,r29 ;mullw r2,r2,r29 @@ -251,7 +265,8 @@ add r2,r2,r20 ; Adds one line for future load of col3 and col4 and r8, r25,r12 ; Masks col1 channels 1 & 3 : 0x00XX00XX rlwinm r24,r10,8,24,31 ; Isolates coef4 (44?????? -> 00000044) dst r2,r17,2 -andi. r25,r25,0xFF00 ; Masks col1 channel 2 : 0x0000XX00 +rlwinm r25,r25,0,16,23 ; Masks col1 channel 2 : 0x0000XX00 +;andi. r25,r25,0xFF00 ; Masks col1 channel 2 : 0x0000XX00 mullw r8, r8, r21 ; Applies coef1 on col1 channels 1 & 3 @@ -260,14 +275,16 @@ and r10,r26,r12 ; Masks col2 channels 1 & 3 : 0x00XX00XX lwz r27,0(r2) ; Loads col3 -> r27 mullw r10,r10,r22 ; Applies coef2 on col2 channels 1 & 3 mullw r25,r25,r21 ; Applies coef1 on col1 channel 2 -andi. r29,r26,0xFF00 ; Masks col2 channel 2 : 0x0000XX00 +rlwinm r29,r26,0,16,23 ; Masks col2 channel 2 : 0x0000XX00 +;andi. r29,r26,0xFF00 ; Masks col2 channel 2 : 0x0000XX00 mullw r29,r29,r22 ; Applies coef2 on col2 channel 2 lwz r28,4(r2) ; Loads col4 -> r28 add r8 ,r8 ,r10 ; Adds col1 & col2 channels 1 & 3 and r10,r27,r12 ; Masks col3 channels 1 & 3 : 0x00XX00XX add r25,r25,r29 ; Adds col1 & col2 channel 2 mullw r10,r10,r23 ; Applies coef3 on col3 channels 1 & 3 -andi. r29,r27,0xFF00 ; Masks col3 channel 2 : 0x0000XX00 +rlwinm r29,r27,0,16,23 ; Masks col3 channel 2 : 0x0000XX00 +;andi. r29,r27,0xFF00 ; Masks col3 channel 2 : 0x0000XX00 mullw r29,r29,r23 ; Applies coef3 on col3 channel 2 lwz r2,0(r31) ; px add r7 ,r8 ,r10 ; Adds col3 to (col1 + col2) channels 1 & 3 @@ -275,7 +292,8 @@ and r10,r28,r12 ; Masks col4 channels 1 & 3 : 0x00XX00XX mullw r10,r10,r24 ; Applies coef4 on col4 channels 1 & 3 add r25,r25,r29 ; Adds col 3 to (col1 + col2) channel 2 lwz r8,0(r30) ; px2 -andi. r28,r28,0xFF00 ; Masks col4 channel 2 : 0x0000XX00 +rlwinm r28,r28,0,16,23 ; Masks col4 channel 2 : 0x0000XX00 +;andi. r28,r28,0xFF00 ; Masks col4 channel 2 : 0x0000XX00 add r7 ,r7 ,r10 ; Adds col4 to (col1 + col2 + col3) channels 1 & 3 lwz r10,4(r30) ; py2 mullw r28,r28,r24 ; Applies coef4 on col4 channel 2 @@ -283,14 +301,14 @@ srawi r7, r7, 8 ; (sum of channels 1 & 3) >> 8 lwz r29,4(r31) ; py add r25,r25,r28 ; Adds col 4 to (col1 + col2 + col3) channel 2 rlwimi r7, r25, 24, 16, 23 ; (((sum of channels 2) >> 8 ) & 0x0000FF00) | ((sum of channels 1 and 3) & 0xFFFF00FF) -stwu r7,4(r6) ; Stores the computed pixel +stw r7,0(r6) ; Stores the computed pixel bdnz L100 ; Iterate again if needed b L300 ;goto end ; If not, returns from the function ; if out of range L400: -stwu r18,4(r6) +stw r18,0(r6) lwz r8,0(r30) ; px2 lwz r10,4(r30) ; py2 lwz r2,0(r31) ; px diff --git a/src/post/goom/sound_tester.c b/src/post/goom/sound_tester.c index 5b6c0fac5..ac50a11b2 100644 --- a/src/post/goom/sound_tester.c +++ b/src/post/goom/sound_tester.c @@ -15,6 +15,7 @@ void evaluate_sound(gint16 data[2][512], SoundInfo *info) { int i; float difaccel; + float prevspeed; /* find the max */ int incvar = 0; @@ -55,8 +56,10 @@ void evaluate_sound(gint16 data[2][512], SoundInfo *info) { difaccel = - difaccel; /* mise a jour de la vitesse */ + prevspeed = info->speedvar; info->speedvar = (info->speedvar + difaccel * 0.5f) / 2; info->speedvar *= SPEED_MULT; + info->speedvar = (info->speedvar + 3.0f * prevspeed) / 4.0f; if (info->speedvar < 0) info->speedvar = 0; if (info->speedvar > 1) diff --git a/src/post/goom/tentacle3d.c b/src/post/goom/tentacle3d.c index b42e80525..bfe73ae13 100755 --- a/src/post/goom/tentacle3d.c +++ b/src/post/goom/tentacle3d.c @@ -10,7 +10,7 @@ #define D 256.0f #define nbgrid 6 -#define definitionx 15 +#define definitionx 9 #define definitionz 45 typedef struct _TENTACLE_FX_DATA { @@ -21,7 +21,7 @@ typedef struct _TENTACLE_FX_DATA { grid3d *grille[nbgrid]; float *vals; -#define NB_TENTACLE_COLORS 3 +#define NB_TENTACLE_COLORS 4 int colors[NB_TENTACLE_COLORS]; int col; @@ -47,7 +47,7 @@ static void tentacle_free (TentacleFXData *data); * VisualFX wrapper for the tentacles */ -static void tentacle_fx_init(VisualFX *_this) { +static void tentacle_fx_init(VisualFX *_this, PluginInfo *info) { TentacleFXData *data = (TentacleFXData*)malloc(sizeof(TentacleFXData)); @@ -71,16 +71,22 @@ static void tentacle_fx_init(VisualFX *_this) { data->colors[0] = (0x18<<(ROUGE*8))|(0x4c<<(VERT*8))|(0x2f<<(BLEU*8)); data->colors[1] = (0x48<<(ROUGE*8))|(0x2c<<(VERT*8))|(0x6f<<(BLEU*8)); data->colors[2] = (0x58<<(ROUGE*8))|(0x3c<<(VERT*8))|(0x0f<<(BLEU*8)); + data->colors[3] = (0x87<<(ROUGE*8))|(0x55<<(VERT*8))|(0x74<<(BLEU*8)); tentacle_new(data); _this->params = &data->params; _this->fx_data = (void*)data; } -static void tentacle_fx_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo *goomInfo) { - - tentacle_update(goomInfo, dest, src, goomInfo->screen.width, goomInfo->screen.height, goomInfo->sound.samples, - (float)goomInfo->sound.accelvar, goomInfo->curGState->drawTentacle, (TentacleFXData*)_this->fx_data); +static void tentacle_fx_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo *goomInfo) +{ + TentacleFXData *data = (TentacleFXData*)_this->fx_data; + if (BVAL(data->enabled_bp)) { + tentacle_update(goomInfo, dest, src, goomInfo->screen.width, + goomInfo->screen.height, goomInfo->sound.samples, + (float)goomInfo->sound.accelvar, + goomInfo->curGState->drawTentacle, data); + } } static void tentacle_fx_free(VisualFX *_this) { @@ -172,7 +178,6 @@ static int evolutecolor (unsigned int src,unsigned int dest, static void pretty_move (PluginInfo *goomInfo, float cycle, float *dist, float *dist2, float *rotangle, TentacleFXData *fx_data) { - /* TODO: remove these STATICS !! */ float tmp; /* many magic numbers here... I don't really like that. */ diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 02cf1f372..e4e091b1e 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_goom.c,v 1.57 2005/05/03 01:31:13 dsalt Exp $ + * $Id: xine_goom.c,v 1.58 2005/07/19 18:10:31 miguelfreitas Exp $ * * GOOM post plugin. * @@ -44,7 +44,7 @@ #include "goom.h" #define NUMSAMPLES 512 -#define FPS 10 +#define FPS 14 #define GOOM_WIDTH 320 #define GOOM_HEIGHT 240 diff --git a/src/post/goom/xmmx.c b/src/post/goom/xmmx.c index b0afc31a6..ed82172b8 100644 --- a/src/post/goom/xmmx.c +++ b/src/post/goom/xmmx.c @@ -1,12 +1,10 @@ -/* a definir pour avoir exactement le meme resultat que la fonction C - * (un chouillat plus lent) - */ #ifdef HAVE_MMX -#define STRICT_COMPAT - -//#define HAVE_ATHLON +/* a definir pour avoir exactement le meme resultat que la fonction C + * (un chouillat plus lent).. mais la difference est assez peu notable. + */ +// #define STRICT_COMPAT #define BUFFPOINTNB 16 #define BUFFPOINTMASK 0xffff @@ -50,10 +48,12 @@ void zoom_filter_xmmx (int prevX, int prevY, ratiox.d[0] = buffratio; ratiox.d[1] = buffratio; - movq_m2r (ratiox, mm6); - pslld_i2r (16,mm6); - pxor_r2r (mm7,mm7); /* mise a zero de mm7 */ + asm volatile + ("\n\t movq %[ratio], %%mm6" + "\n\t pslld $16, %%mm6" /* mm6 = [rat16=buffratio<<16 | rat16=buffratio<<16] */ + "\n\t pxor %%mm7, %%mm7" /* mm7 = 0 */ + ::[ratio]"m"(ratiox)); loop=0; @@ -62,30 +62,30 @@ void zoom_filter_xmmx (int prevX, int prevY, */ while (loop < bufsize) { - /* - * pre : mm6 = [buffratio<<16|buffratio<<16] - * post : mm0 = S + ((D-S)*buffratio)>>16 format [X|Y] + /* Thread #1 + * pre : mm6 = [rat16|rat16] + * post : mm0 = S + ((D-S)*rat16 format [X|Y] * modified = mm0,mm1,mm2 */ - __asm__ __volatile__ ( - "movq %0,%%mm0\n" - "movq %1,%%mm1\n" - : :"X"(brutS[loop]),"X"(brutD[loop]) - ); /* mm0 = S */ - - psubd_r2r (mm0,mm1); /* mm1 = D - S */ - movq_r2r (mm1, mm2); /* mm2 = D - S */ - - pslld_i2r (16,mm1); - mmx_r2r (pmulhuw, mm6, mm1); /* mm1 = ?? */ - pmullw_r2r (mm6, mm2); - - paddd_r2r (mm2, mm1); /* mm1 = (D - S) * buffratio >> 16 */ - pslld_i2r (16,mm0); - - paddd_r2r (mm1, mm0); /* mm0 = S + mm1 */ - psrld_i2r (16, mm0); + asm volatile + ("#1 \n\t movq %[brutS], %%mm0" + "#1 \n\t movq %[brutD], %%mm1" + "#1 \n\t psubd %%mm0, %%mm1" /* mm1 = D - S */ + "#1 \n\t movq %%mm1, %%mm2" /* mm2 = D - S */ + "#1 \n\t pslld $16, %%mm1" + "#1 \n\t pmullw %%mm6, %%mm2" + "#1 \n\t pmulhuw %%mm6, %%mm1" + + "#1 \n\t pslld $16, %%mm0" + "#1 \n\t paddd %%mm2, %%mm1" /* mm1 = (D - S) * buffratio >> 16 */ + + "#1 \n\t paddd %%mm1, %%mm0" /* mm0 = S + mm1 */ + "#1 \n\t psrld $16, %%mm0" + : + : [brutS]"g"(brutS[loop]) + , [brutD]"g"(brutD[loop]) + ); /* mm0 = S */ /* * pre : mm0 : position vector on screen @@ -93,45 +93,48 @@ void zoom_filter_xmmx (int prevX, int prevY, * post : clipped mm0 * modified : mm0,mm1,mm2 */ - movq_m2r (prevXY,mm1); - pcmpgtd_r2r (mm0, mm1); /* mm0 en X contient : - 1111 si prevXY > px - 0000 si prevXY <= px - (idem pour y) */ + asm volatile + ("#1 \n\t movq %[prevXY], %%mm1" + "#1 \n\t pcmpgtd %%mm0, %%mm1" + /* mm0 en X contient (idem pour Y) : + * 1111 si prevXY > px + * 0000 si prevXY <= px */ #ifdef STRICT_COMPAT - movq_r2r (mm1,mm2); - punpckhdq_r2r (mm2,mm2); - punpckldq_r2r (mm1,mm1); - pand_r2r (mm2, mm0); + "#1 \n\t movq %%mm1, %%mm2" + "#1 \n\t punpckhdq %%mm2, %%mm2" + "#1 \n\t punpckldq %%mm1, %%mm1" + "#1 \n\t pand %%mm2, %%mm0" #endif - pand_r2r (mm1, mm0); /* on met a zero la partie qui deborde */ - /* - * pre : mm0 : clipped position on screen + "#1 \n\t pand %%mm1, %%mm0" /* on met a zero la partie qui deborde */ + ::[prevXY]"m"(prevXY)); + + /* Thread #2 + * pre : mm0 : clipped position on screen * - * post : mm3 & mm4 : coefs for this position - * mm1 : X vector [0|X] + * post : mm3 : coefs for this position + * mm1 : X vector [0|X] * - * modif : eax,ecx + * modif : eax,esi */ __asm__ __volatile__ ( - "movd %%mm0,%%ecx\n" - "movq %%mm0,%%mm1\n" + "#2 \n\t movd %%mm0,%%esi" + "#2 \n\t movq %%mm0,%%mm1" - "andl $15,%%ecx\n" - "psrlq $32,%%mm1\n" + "#2 \n\t andl $15,%%esi" + "#2 \n\t psrlq $32,%%mm1" - "shll $6,%%ecx\n" - "movd %%mm1,%%eax\n" + "#2 \n\t shll $6,%%esi" + "#2 \n\t movd %%mm1,%%eax" - "addl %0,%%ecx\n" - "andl $15,%%eax\n" + "#2 \n\t addl %[precalCoef],%%esi" + "#2 \n\t andl $15,%%eax" - "movd (%%ecx,%%eax,4),%%mm3\n" - ::"g"(precalCoef):"eax","ecx"); + "#2 \n\t movd (%%esi,%%eax,4),%%mm3" + ::[precalCoef]"g"(precalCoef):"eax","esi"); /* - * extraction des coefficients... + * extraction des coefficients... (Thread #3) * * pre : coef dans mm3 * @@ -141,49 +144,44 @@ void zoom_filter_xmmx (int prevX, int prevY, * modif : mm5 */ - /* entrelace avec portion d'apres (cf les '^') - movq_r2r (mm3, mm5); / * ??-??-??-??-c4-c3-c2-c1 * / - punpcklbw_r2r (mm5, mm3); / * c4-c4-c3-c3-c2-c2-c1-c1 * / - movq_r2r (mm3, mm4); / * c4-c4-c3-c3-c2-c2-c1-c1 * / - movq_r2r (mm3, mm5); / * c4-c4-c3-c3-c2-c2-c1-c1 * / - - punpcklbw_r2r (mm5, mm3); / * c2-c2-c2-c2-c1-c1-c1-c1 * / - punpckhbw_r2r (mm5, mm4); / * c4-c4-c4-c4-c3-c3-c3-c3 * / - */ - - /* + /* (Thread #4) * pre : mm0 : Y pos [*|Y] * mm1 : X pos [*|X] * * post : mm0 : expix1[position] * mm2 : expix1[position+largeur] * - * modif : eax,ecx + * modif : eax, esi */ - psrld_i2r (PERTEDEC,mm0); - psrld_i2r (PERTEDEC,mm1); __asm__ __volatile__ ( - "movd %%mm1,%%eax\n" - /*^*/ "movq %%mm3,%%mm5\n" /*^*/ + "#2 \n\t psrld $4, %%mm0" + "#2 \n\t psrld $4, %%mm1" /* PERTEDEC = $4 */ + + "#4 \n\t movd %%mm1,%%eax" + "#3 \n\t movq %%mm3,%%mm5" + + "#4 \n\t mull %[prevX]" + "#4 \n\t movd %%mm0,%%esi" - "mull %1\n" - "movd %%mm0,%%ecx\n" - /*^*/ "punpcklbw %%mm5, %%mm3\n" /*^*/ + "#3 \n\t punpcklbw %%mm5, %%mm3" + "#4 \n\t addl %%esi, %%eax" - "addl %%ecx,%%eax\n" - /*^*/ "movq %%mm3,%%mm4\n" /*^*/ - /*^*/ "movq %%mm3,%%mm5\n" /*^*/ + "#3 \n\t movq %%mm3, %%mm4" + "#3 \n\t movq %%mm3, %%mm5" - "movl %0,%%ecx\n" - /*^*/ "punpcklbw %%mm5,%%mm3\n" /*^*/ + "#4 \n\t movl %[expix1], %%esi" + "#3 \n\t punpcklbw %%mm5, %%mm3" - "movq (%%ecx,%%eax,4),%%mm0\n" - /*^*/ "punpckhbw %%mm5,%%mm4\n" /*^*/ + "#4 \n\t movq (%%esi,%%eax,4),%%mm0" + "#3 \n\t punpckhbw %%mm5, %%mm4" - "addl %1,%%eax\n" - "movq (%%ecx,%%eax,4),%%mm2\n" + "#4 \n\t addl %[prevX],%%eax" + "#4 \n\t movq (%%esi,%%eax,4),%%mm2" - : : "X"(expix1), "X"(prevX):"eax","ecx" + : + : [expix1] "g"(expix1) + , [prevX] "g"(prevX) + :"eax","esi" ); /* |