Added watchlist support 56/3556/1
authorvlad shkapenyuk <vshkap@research.att.com>
Fri, 1 May 2020 16:22:28 +0000 (12:22 -0400)
committervlad shkapenyuk <vshkap@research.att.com>
Fri, 1 May 2020 16:22:28 +0000 (12:22 -0400)
Signed-off-by: vlad shkapenyuk <vshkap@research.att.com>
Change-Id: Ifa9641602d61f1f827e1e9d41e03b075ba9c4eac

28 files changed:
cfg/external_fcns.def
include/hfta/hfta.h
include/hfta/hfta_runtime_library.h
include/hfta/hfta_udaf.h
include/lfta/rts_external.h
include/lfta/rts_udaf.h
include/watchlist.h [new file with mode: 0644]
src/ftacmp/analyze_fta.cc
src/ftacmp/fta.l
src/ftacmp/fta.tab.cc
src/ftacmp/fta.tab.cc.h
src/ftacmp/fta.y
src/ftacmp/ftalexer.cc
src/ftacmp/generate_lfta_code.cc
src/ftacmp/generate_lfta_code.h
src/ftacmp/parse_fta.h
src/ftacmp/parse_schema.cc
src/ftacmp/parse_schema.h
src/ftacmp/query_plan.cc
src/ftacmp/query_plan.h
src/ftacmp/stream_query.cc
src/ftacmp/translate_fta.cc
src/ftacmp/type_objects.cc
src/ftacmp/type_objects.h
src/lib/gscphftaaux/hfta_runtime_library.cc
src/lib/gscphftaaux/hfta_udaf.cc
src/lib/gscplftaaux/rts_udaf.c
src/tools/gsprintconsole.c

index 8091c8a..0043b84 100644 (file)
 //          MIN/MAX functions
 ///////////////////////////////////////////////////////////
 
-
+// return ullong
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,float);
+
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,float);
+
+// return llong
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,llong);
         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,ullong);
-        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,ullong); 
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,float);
+
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,float);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,int);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,uint);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,llong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,ullong);
+        ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,float);
+
+// return uint
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,int);
         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,uint);
-        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,uint); 
-
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,float);
+
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,float);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,int);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,uint);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,llong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,ullong);
+        uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,float);
+
+// return int
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (int,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (int,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (int,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (int,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (int,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (float,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (float,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (float,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (float,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMIN (float,float);
+
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (int,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (int,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (int,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (int,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (int,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,float);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (float,int);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (float,uint);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (float,llong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (float,ullong);
+        int FUN [LFTA_LEGAL, COST FREE] LMAX (float,float);
+
+// return float
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (int,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (int,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (int,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (int,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (int,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (float,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (float,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (float,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (float,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMIN (float,float);
+
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (int,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (int,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (int,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (int,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (int,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,float);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (float,int);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (float,uint);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (float,llong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (float,ullong);
+        float FUN [LFTA_LEGAL, COST FREE] FMAX (float,float);
+
+// return IP
         IP FUN [LFTA_LEGAL, COST FREE] UMIN (IP,IP);
         IP FUN [LFTA_LEGAL, COST FREE] UMAX (IP,IP);
    
 //          conditional functions
 ///////////////////////////////////////////////////////////
 
+// rhs == lhs
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, int);
        uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, float);
        uint FUN [LFTA_LEGAL, COST FREE] EQ (int, int);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (int, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (int, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (int, float);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, llong);
        uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (float, int);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (float, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (float, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (float, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] EQ (float, float);
+
+// rhs >= lhs
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, int);
        uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, float);
        uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, llong);
        uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, float);
+
+// rhs > lhs
+       uint FUN [LFTA_LEGAL, COST FREE] GE (uint, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (uint, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (uint, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (uint, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (uint, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (int, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (int, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (int, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (int, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (llong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (llong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (llong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (llong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (llong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (float, int);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (float, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (float, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (float, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] GE (float, float);
+
+// rhs <= lhs
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, int);
        uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, float);
        uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, llong);
        uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, float);
+
+// rhs < lhs
+       uint FUN [LFTA_LEGAL, COST FREE] LE (uint, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (uint, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (uint, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (uint, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (uint, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (int, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (int, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (int, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (int, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (llong, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (llong, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (llong, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (llong, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (llong, float);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (float, int);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (float, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (float, llong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (float, ullong);
+       uint FUN [LFTA_LEGAL, COST FREE] LE (float, float);
+
+//////////////////////////////////////////////////////////////
+//     Conditional evaluation
+//             add int, uint in the else clause to allow for constants
+///////////////////////////////////////////////////////
+
+       int FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, int, int);
+       int FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, int, uint);
+       uint FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, uint, uint); 
+       uint FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, uint, int);
+       llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, llong);
+       llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, uint);
+       llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, int);
+       ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, ullong);
+       ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, int);
+       ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, uint);
+
+
+///////////////////////////////////////////////////////////
+//          Function for regex matching
+///////////////////////////////////////////////////////////
 
+       uint FUN [LFTA_LEGAL] endian_swap_ui(uint);
 
 ///////////////////////////////////////////////////////////
 //          Function for regex matching
@@ -45,11 +452,21 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE]
                str_partial_regex_match( string, string HANDLE, uint);
        string FUN [PARTIAL, COST EXPENSIVE] str_extract_regex( string, string HANDLE);
   
+
 ///////////////////////////////////////////////////////////
 //         Truncating strings        
 ///////////////////////////////////////////////////////////
        
         string FUN [LFTA_LEGAL,PARTIAL,COST FREE] str_truncate (string, uint);
+
+
+///////////////////////////////////////////////////////////
+//         hashing
+///////////////////////////////////////////////////////////
+
+       uint FUN [LFTA_LEGAL] string_hash(string);
+       ullong FUN string_hash_long(string);
+
  
 ///////////////////////////////////////////////////////////
 //          Function for casting
@@ -61,27 +478,56 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE]
        ullong FUN [LFTA_LEGAL,COST FREE] non_temporal(ullong);
 
        int FUN [LFTA_LEGAL,COST FREE]INT(uint);
-        int FUN [LFTA_LEGAL,COST FREE]INT(ullong);
-        int FUN [LFTA_LEGAL,COST FREE]INT(llong);
+       int FUN [LFTA_LEGAL,COST FREE]INT(int);
+    int FUN [LFTA_LEGAL,COST FREE]INT(ullong);
+    int FUN [LFTA_LEGAL,COST FREE]INT(llong);
+    int FUN [LFTA_LEGAL,COST FREE]INT(float);
  
-        uint FUN [LFTA_LEGAL,COST FREE]UINT(int);
-        uint FUN [LFTA_LEGAL,COST FREE]UINT(ullong);
-        uint FUN [LFTA_LEGAL,COST FREE]UINT(llong);
+    uint FUN [LFTA_LEGAL,COST FREE]UINT(uint);
+    uint FUN [LFTA_LEGAL,COST FREE]UINT(int);
+    uint FUN [LFTA_LEGAL,COST FREE]UINT(ullong);
+    uint FUN [LFTA_LEGAL,COST FREE]UINT(llong);
+    uint FUN [LFTA_LEGAL,COST FREE]UINT(float);
        uint FUN [LFTA_LEGAL,COST FREE]UINT(IP);
 
        float FUN [LFTA_LEGAL,COST FREE] FLOAT(llong);
+       float FUN [LFTA_LEGAL,COST FREE] FLOAT(float);
        float FUN [LFTA_LEGAL,COST FREE] FLOAT(ullong);
        float FUN [LFTA_LEGAL,COST FREE] FLOAT(int);
        float FUN [LFTA_LEGAL,COST FREE] FLOAT(uint);
 
        ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(uint);
        ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(int);
+       ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(ullong);
+       ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(llong);
+       ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(float);
+
+       llong FUN [LFTA_LEGAL,COST FREE]LLONG(uint);
+       llong FUN [LFTA_LEGAL,COST FREE]LLONG(int);
+       llong FUN [LFTA_LEGAL,COST FREE]LLONG(ullong);
+       llong FUN [LFTA_LEGAL,COST FREE]LLONG(llong);
+       llong FUN [LFTA_LEGAL,COST FREE]LLONG(float);
 
 ///////////////////////////////////////////////////////////
 //          Numeric functions
 ///////////////////////////////////////////////////////////
 
        float FUN [LFTA_LEGAL, COST LOW] sqrt(float); 
+       float FUN [LFTA_LEGAL, COST LOW] pow(float, float); 
+       float FUN [LFTA_LEGAL, COST LOW] sin(float); 
+       float FUN [LFTA_LEGAL, COST LOW] cos(float); 
+       float FUN [LFTA_LEGAL, COST LOW] tan(float); 
+       float FUN [LFTA_LEGAL, COST LOW] asin(float); 
+       float FUN [LFTA_LEGAL, COST LOW] acos(float); 
+       float FUN [LFTA_LEGAL, COST LOW] atan(float); 
+       float FUN [LFTA_LEGAL, COST LOW] log(float); 
+       float FUN [LFTA_LEGAL, COST LOW] log2(float); 
+       float FUN [LFTA_LEGAL, COST LOW] log10(float); 
+       float FUN [LFTA_LEGAL, COST LOW] ceil(float); 
+       float FUN [LFTA_LEGAL, COST LOW] floor(float); 
+       float FUN [LFTA_LEGAL, COST LOW] fmod(float); 
+       float FUN [LFTA_LEGAL, COST LOW] trunc(float); 
+
 
 
 ///////////////////////////////////////////////////////////
@@ -173,14 +619,23 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE]
 //     Should be replaced by builtins
 ///////////////////////////////////////////////////////////
 
+// FIRST
        uint UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST uint (uint);
        uint UDAF [RUNNING] FIRST_hfta uint (uint);
        uint UDAF [RUNNING] FIRST_lfta uint (uint);
 
+       int UDAF [RUNNING, SUBAGGR FIRST_INT_lfta, SUPERAGGR FIRST_INT_hfta] FIRST int (int);
+       int UDAF [RUNNING] FIRST_INT_hfta int (int);
+       int UDAF [RUNNING] FIRST_INT_lfta int (int);
+
        ullong UDAF [RUNNING, SUBAGGR FIRST_ULL_lfta, SUPERAGGR FIRST_ULL_hfta] FIRST ullong (ullong);
        ullong UDAF [RUNNING] FIRST_ULL_hfta ullong (ullong);
        ullong UDAF [RUNNING] FIRST_ULL_lfta ullong (ullong);
 
+       llong UDAF [RUNNING, SUBAGGR FIRST_LL_lfta, SUPERAGGR FIRST_LL_hfta] FIRST llong (llong);
+       llong UDAF [RUNNING] FIRST_LL_hfta llong (llong);
+       llong UDAF [RUNNING] FIRST_LL_lfta llong (llong);
+
        IP UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST IP (IP);
        IP UDAF [RUNNING] FIRST_hfta IP (IP);
        IP UDAF [RUNNING] FIRST_lfta IP (IP);
@@ -189,14 +644,24 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE]
        string UDAF [RUNNING] FIRST_STR_hfta string (string);
        string UDAF [RUNNING] FIRST_STR_lfta string (string);
 
+
+// LAST
        uint UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST uint (uint);
        uint UDAF [RUNNING] LAST_hfta uint (uint);
        uint UDAF [RUNNING] LAST_lfta uint (uint);
 
+       int UDAF [RUNNING, SUBAGGR LAST_INT_lfta, SUPERAGGR LAST_INT_hfta] LAST int (int);
+       int UDAF [RUNNING] LAST_INT_hfta int (int);
+       int UDAF [RUNNING] LAST_INT_lfta int (int);
+
        ullong UDAF [RUNNING, SUBAGGR LAST_ULL_lfta, SUPERAGGR LAST_ULL_hfta] LAST ullong (ullong);
        ullong UDAF [RUNNING] LAST_ULL_hfta ullong (ullong);
        ullong UDAF [RUNNING] LAST_ULL_lfta ullong (ullong);
 
+       llong UDAF [RUNNING, SUBAGGR LAST_LL_lfta, SUPERAGGR LAST_LL_hfta] LAST llong (llong);
+       llong UDAF [RUNNING] LAST_LL_hfta llong (llong);
+       llong UDAF [RUNNING] LAST_LL_lfta llong (llong);
+
        IP UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST IP (IP);
        IP UDAF [RUNNING] LAST_hfta IP (IP);
        IP UDAF [RUNNING] LAST_lfta IP (IP);
@@ -205,6 +670,29 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE]
        string UDAF [RUNNING] LAST_STR_hfta string (string);
        string UDAF [RUNNING] LAST_STR_lfta string (string);
 
+
+////////////////////////////////////////////////////////////
+//     count_diff aggregation
+//     count the # times the payload is different from the previous value
+/////////////////////////////////////////////////////////////
+
+       uint UDAF [SUBAGGR count_diff_lfta_ui, SUPERAGGR count_diff_hfta] count_diff fstring12 (uint);
+       uint UDAF  count_diff_hfta fstring12 (string);
+       string UDAF  count_diff_lfta_ui fstring20 (uint);
+
+       uint UDAF [SUBAGGR count_diff_lfta_i, SUPERAGGR count_diff_hfta] count_diff fstring12 (int);
+       string UDAF  count_diff_lfta_i fstring20 (int);
+
+       uint UDAF [SUBAGGR count_diff_lfta_ul, SUPERAGGR count_diff_hfta] count_diff fstring12 (ullong);
+       string UDAF  count_diff_lfta_ul fstring20 (ullong);
+
+       uint UDAF [SUBAGGR count_diff_lfta_l, SUPERAGGR count_diff_hfta] count_diff fstring12 (llong);
+       string UDAF  count_diff_lfta_l fstring20 (llong);
+
+       uint UDAF [SUBAGGR count_diff_lfta_s, SUPERAGGR count_diff_hfta] count_diff fstring12 (string);
+       string UDAF  count_diff_lfta_s fstring20 (string);
+
+
 ///////////////////////////////////////////////////////////
 //               integer array aggregation funciton
 //     We are going to store 4 values in LFTA in fixed size buffer
index b95f77d..f9e3c87 100644 (file)
@@ -26,17 +26,55 @@ Copyright 2014 AT&T Intellectual Property
 using namespace std;
 
 #define hfta_ullong_hashfunc(x) (((int)(*(x)))^((int)((*(x))>>32)))
-#define LLMIN(x,y) ((x)<(y)?(x):(y))
-#define LLMAX(x,y) ((x)<(y)?(y):(x))
-#define UMIN(x,y) ((x)<(y)?(x):(y))
-#define UMAX(x,y) ((x)<(y)?(y):(x))
+
+// min, max
+#define ULLMIN(x,y) (unsigned long long)(((x)<(y)?(x):(y)))
+#define ULLMAX(x,y) (unsigned long long)(((x)<(y)?(y):(x)))
+#define LLMIN(x,y) (long long int)(((x)<(y)?(x):(y)))
+#define LLMAX(x,y) (long long int)(((x)<(y)?(y):(x)))
+#define UMIN(x,y) (unsigned int)(((x)<(y)?(x):(y)))
+#define UMAX(x,y) (unsigned int)(((x)<(y)?(y):(x)))
+#define LMIN(x,y) (int)(((x)<(y)?(x):(y)))
+#define LMAX(x,y) (int)(((x)<(y)?(y):(x)))
+#define FMIN(x,y) (double)(((x)<(y)?(x):(y)))
+#define FMAX(x,y) (double)(((x)<(y)?(y):(x)))
+
+// comparison
 #define EQ(x,y) ((x)==(y))
 #define GEQ(x,y) ((x)>=(y))
+#define GE(x,y) ((x)>(y))
 #define LEQ(x,y) ((x)<=(y))
+#define LE(x,y) ((x)<(y))
+
+// if_else
+#define if_else_f(x,y,z) (double)(((x)==0?(z):(y)))
+#define if_else_ll(x,y,z) (long long int)(((x)==0?(z):(y)))
+#define if_else_ul(x,y,z) (unsigned long long)(((x)==0?(z):(y)))
+#define if_else_u(x,y,z) (unsigned int)(((x)==0?(z):(y)))
+#define if_else_i(x,y,z) (int)(((x)==0?(z):(y)))
+
 //     Cast away temporality
 #define non_temporal(x)(x)
+
+//     endian swap
+#define endian_swap_ui(x) ( (( (x) & 0xFF000000) >> 24) | (( (x) & 0x00FF0000) >> 8) | (( (x) & 0x0000FF00) << 8) | (( (x) & 0x000000FF) << 24) ) 
+
 //     Access math libraries
 #define sqrt(x) sqrt(x)
+#define pow(x,y) pow((x),(y))
+#define sin(x) sin(x)
+#define cos(x) cos(x)
+#define tan(x) tan(x)
+#define asin(x) asin(x)
+#define acos(x) acos(x)
+#define atan(x) atan(x)
+#define log(x) log(x)
+#define log2(x) log2(x)
+#define log10(x) log10(x)
+#define ceil(x) ceil(x)
+#define floor(x) floor(x)
+#define fmod(x) fmod(x)
+#define trunc(x) trunc(x)
 
 
 extern "C" {
index 3a20ff3..afcf682 100644 (file)
@@ -19,6 +19,11 @@ Copyright 2014 AT&T Intellectual Property
 #include "gsconfig.h"
 #include "gstypes.h"
 
+
+#define string_hash(s) hfta_vstr_hashfunc(s)
+#define string_hash_long(s) hfta_vstr_long_hashfunc(s) 
+
+
 #define DNS_SAMPLE_HASH_SZ 50000000
 #define DNS_HITLIST_HASH_SZ 50000000
 #define DNS_HITLIST_ENTRY_SZ 500000
@@ -33,6 +38,7 @@ void hfta_vstr_destroy(vstring *);
 void hfta_vstr_replace(vstring *, vstring *);
 
 gs_uint32_t hfta_vstr_hashfunc(const vstring *);
+gs_uint64_t hfta_vstr_long_hashfunc(const vstring *);
 gs_retval_t hfta_vstr_compare(const vstring *, const vstring *);
 
 gs_retval_t hfta_ipv6_compare(const hfta_ipv6_str &i1, const hfta_ipv6_str &i2);
@@ -80,10 +86,14 @@ gs_retval_t deregister_handle_for_str_extract_regex_slot_1(gs_param_handle_t han
 
 
 // type conversion
-#define INT(c) ((int)(c))
-#define UINT(c) ((gs_uint32_t)(c))
-#define FLOAT(c) ((gs_float_t)(c))
-#define ULLONG(c) ((gs_uint64_t)(c))
+//             Avoid redefinition from rts_udaf.h
+#ifndef INT
+       #define INT(c) ((int)(c))
+       #define UINT(c) ((gs_uint32_t)(c))
+       #define FLOAT(c) ((gs_float_t)(c))
+       #define LLONG(c) ((long long int)(c))
+       #define ULLONG(c) ((gs_uint64_t)(c))
+#endif
 
 // string conversions
 
@@ -91,13 +101,16 @@ gs_uint32_t strtoi(gs_uint32_t * r, struct vstring *data);
 gs_uint32_t strtoip(gs_uint32_t * r, struct vstring *data);
 
 //     constant string conversions
+//             Avoid redefinition from rts_udaf.h
+#ifndef strtoi_c
+       #define strtoi_c(h) ((gs_uint32_t)(h))
+       #define strtoip_c(h) ((gs_uint32_t)(h))
+#endif
 gs_param_handle_t register_handle_for_strtoi_c_slot_0(vstring* istr) ;
 gs_retval_t deregister_handle_for_strtoi_c_slot_0(gs_param_handle_t h) ;
-#define strtoi_c(h) ((gs_uint32_t)(h))
 
 gs_param_handle_t register_handle_for_strtoip_c_slot_0(vstring* istr) ;
 gs_retval_t deregister_handle_for_strtoip_c_slot_0(gs_param_handle_t h) ;
-#define strtoip_c(h) ((gs_uint32_t)(h))
 
 
 inline gs_uint32_t str_match_offset( gs_uint32_t offset, struct vstring * s1, struct vstring * s2) {
index 9f8e6c8..d3bb8d0 100644 (file)
@@ -82,24 +82,29 @@ void FIRST_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val);
 void FIRST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void FIRST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void FIRST_HFTA_AGGR_INIT_(gs_int32_t* scratch);
+void FIRST_HFTA_AGGR_REINIT_(gs_int32_t* scratch);
+void FIRST_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+void FIRST_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void FIRST_HFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void FIRST_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void FIRST_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
 void FIRST_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 void FIRST_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void FIRST_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
-
-void FIRST_ULL_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
-void FIRST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
-void FIRST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
-void FIRST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
-void FIRST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
-
-void FIRST_STR_HFTA_AGGR_INIT_(vstring* scratch);
-void FIRST_STR_HFTA_AGGR_REINIT_(vstring* scratch);
-void FIRST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
-void FIRST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch);
-void FIRST_STR_HFTA_AGGR_DESTROY_(vstring* scratch);
+void FIRST_HFTA_AGGR_INIT_(gs_int64_t* scratch);
+void FIRST_HFTA_AGGR_REINIT_(gs_int64_t* scratch);
+void FIRST_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+void FIRST_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void FIRST_HFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
+void FIRST_HFTA_AGGR_INIT_(vstring* scratch);
+void FIRST_HFTA_AGGR_REINIT_(vstring* scratch);
+void FIRST_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
+void FIRST_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch);
+void FIRST_HFTA_AGGR_DESTROY_(vstring* scratch);
 // hfts-lfta split
 void FIRST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch);
 void FIRST_hfta_HFTA_AGGR_REINIT_(gs_uint32_t* scratch);
@@ -107,12 +112,24 @@ void FIRST_hfta_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val);
 void FIRST_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void FIRST_hfta_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void FIRST_INT_hfta_HFTA_AGGR_INIT_(gs_int32_t* scratch);
+void FIRST_INT_hfta_HFTA_AGGR_REINIT_(gs_int32_t* scratch);
+void FIRST_INT_hfta_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+void FIRST_INT_hfta_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void FIRST_INT_hfta_HFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void FIRST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void FIRST_ULL_hfta_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
 void FIRST_ULL_hfta_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 void FIRST_ULL_hfta_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void FIRST_ULL_hfta_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
+void FIRST_LL_hfta_HFTA_AGGR_INIT_(gs_int64_t* scratch);
+void FIRST_LL_hfta_HFTA_AGGR_REINIT_(gs_int64_t* scratch);
+void FIRST_LL_hfta_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+void FIRST_LL_hfta_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void FIRST_LL_hfta_HFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
 void FIRST_STR_hfta_HFTA_AGGR_INIT_(vstring* scratch);
 void FIRST_STR_hfta_HFTA_AGGR_REINIT_(vstring* scratch);
 void FIRST_STR_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
@@ -127,23 +144,30 @@ void LAST_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val);
 void LAST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void LAST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void LAST_HFTA_AGGR_INIT_(gs_int32_t* scratch);
+void LAST_HFTA_AGGR_REINIT_(gs_int32_t* scratch);
+void LAST_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+void LAST_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void LAST_HFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void LAST_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void LAST_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
 void LAST_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 void LAST_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void LAST_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
-void LAST_ULL_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
-void LAST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
-void LAST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
-void LAST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
-void LAST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
+void LAST_HFTA_AGGR_INIT_(gs_int64_t* scratch);
+void LAST_HFTA_AGGR_REINIT_(gs_int64_t* scratch);
+void LAST_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+void LAST_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void LAST_HFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
+void LAST_HFTA_AGGR_INIT_(vstring* scratch);
+void LAST_HFTA_AGGR_REINIT_(vstring* scratch);
+void LAST_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
+void LAST_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch);
+void LAST_HFTA_AGGR_DESTROY_(vstring* scratch);
 
-void LAST_STR_HFTA_AGGR_INIT_(vstring* scratch);
-void LAST_STR_HFTA_AGGR_REINIT_(vstring* scratch);
-void LAST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
-void LAST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch);
-void LAST_STR_HFTA_AGGR_DESTROY_(vstring* scratch);
 
 // hfta/lfta split
 void LAST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch);
@@ -152,19 +176,55 @@ void LAST_hfta_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val);
 void LAST_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void LAST_hfta_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void LAST_INT_hfta_HFTA_AGGR_INIT_(gs_int32_t* scratch);
+void LAST_INT_hfta_HFTA_AGGR_REINIT_(gs_int32_t* scratch);
+void LAST_INT_hfta_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+void LAST_INT_hfta_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void LAST_INT_hfta_HFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void LAST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void LAST_ULL_hfta_HFTA_AGGR_REINIT_(gs_uint64_t* scratch);
 void LAST_ULL_hfta_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 void LAST_ULL_hfta_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void LAST_ULL_hfta_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
+void LAST_LL_hfta_HFTA_AGGR_INIT_(gs_int64_t* scratch);
+void LAST_LL_hfta_HFTA_AGGR_REINIT_(gs_int64_t* scratch);
+void LAST_LL_hfta_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+void LAST_LL_hfta_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void LAST_LL_hfta_HFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
 void LAST_STR_hfta_HFTA_AGGR_INIT_(vstring* scratch);
 void LAST_STR_hfta_HFTA_AGGR_REINIT_(vstring* scratch);
 void LAST_STR_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
 void LAST_STR_hfta_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch);
 void LAST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch);
 
+///////////////////////////////////////////////////////////////
+//     count_diff aggregate
+///////////////////////////////////////////////////////////////
+
+void count_diff_HFTA_AGGR_INIT_(gs_sp_t scratch);
+void count_diff_HFTA_AGGR_REINIT_(gs_sp_t scratch);
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t scratch, gs_uint32_t val);
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t scratch, gs_int32_t val);
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t scratch, gs_uint64_t val);
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t scratch, gs_int64_t val);
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t scratch, vstring *val);
+void count_diff_HFTA_AGGR_OUTPUT_(gs_uint32_t *res, gs_sp_t scratch);
+void count_diff_HFTA_AGGR_DESTROY_(gs_sp_t scratch);
+
+void count_diff_hfta_HFTA_AGGR_INIT_(gs_sp_t s);
+void count_diff_hfta_HFTA_AGGR_REINIT_(gs_sp_t s);
+void count_diff_hfta_HFTA_AGGR_UPDATE_(gs_sp_t s, vstring *val);
+void count_diff_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t *res, gs_sp_t s);
+void count_diff_hfta_HFTA_AGGR_DESTROY_(gs_sp_t scratch);
+
+
+
+///////////////////////////////////////////////////////////////
 //             running_array_aggr aggregate
+///////////////////////////////////////////////////////////////
 void running_array_aggr_hfta_HFTA_AGGR_INIT_(vstring* scratch);
 void running_array_aggr_hfta_HFTA_AGGR_REINIT_(vstring* scratch);
 void running_array_aggr_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val);
index 5e0f197..358527e 100644 (file)
@@ -74,27 +74,67 @@ gs_retval_t str_compare( struct gs_string * str1, struct gs_string * str2);
 
 gs_retval_t str_constructor(struct gs_string *s, gs_sp_t l);
 
+/*     string hash     */
+
+#define string_hash(s) lfta_V_STR_to_hash((*(s)))
 
 /* External Function definitions */
 
-#define LLMIN(x,y) ((x)<(y)?(x):(y))
-#define LLMAX(x,y) ((x)<(y)?(y):(x))
-#define UMIN(x,y) ((x)<(y)?(x):(y))
-#define UMAX(x,y) ((x)<(y)?(y):(x))
+#define ULLMIN(x,y) (unsigned long long)(((x)<(y)?(x):(y)))
+#define ULLMAX(x,y) (unsigned long long)(((x)<(y)?(y):(x)))
+#define LLMIN(x,y) (long long int)(((x)<(y)?(x):(y)))
+#define LLMAX(x,y) (long long int)(((x)<(y)?(y):(x)))
+#define UMIN(x,y) (unsigned int)(((x)<(y)?(x):(y)))
+#define UMAX(x,y) (unsigned int)(((x)<(y)?(y):(x)))
+#define LMIN(x,y) (int)(((x)<(y)?(x):(y)))
+#define LMAX(x,y) (int)(((x)<(y)?(y):(x)))
+#define FMIN(x,y) (double)(((x)<(y)?(x):(y)))
+#define FMAX(x,y) (double)(((x)<(y)?(y):(x)))
+
 // type conversion
 #define INT(c) ((int)(c))
 #define UINT(c) ((unsigned int)(c))
 #define ULLONG(c) ((unsigned long long)(c))
+#define LLONG(c) ((long long int)(c))
 #define FLOAT(c) ((double)(c))
+
+// comparison
 #define EQ(x,y) ((x)==(y))
 #define GEQ(x,y) ((x)>=(y))
+#define GE(x,y) ((x)>(y))
 #define LEQ(x,y) ((x)<=(y))
+#define LE(x,y) ((x)<(y))
+
+// if_else
+#define if_else_f(x,y,z) (double)(((x)==0?(z):(y)))
+#define if_else_ll(x,y,z) (long long int)(((x)==0?(z):(y)))
+#define if_else_ul(x,y,z) (unsigned long long)(((x)==0?(z):(y)))
+#define if_else_u(x,y,z) (unsigned int)(((x)==0?(z):(y)))
+#define if_else_i(x,y,z) (int)(((x)==0?(z):(y)))
 
 //     Cast away temporality
 #define non_temporal(x)(x)
 
+//     endian swap
+#define endian_swap_ui(x) ( (( (x) & 0xFF000000) >> 24) | (( (x) & 0x00FF0000) >> 8) | (( (x) & 0x0000FF00) << 8) | (( (x) & 0x000000FF) << 24) ) 
+
+
 //     Access math libraries
 #define sqrt(x) sqrt(x)
+#define pow(x,y) pow((x),(y))
+#define sin(x) sin(x)
+#define cos(x) cos(x)
+#define tan(x) tan(x)
+#define asin(x) asin(x)
+#define acos(x) acos(x)
+#define atan(x) atan(x)
+#define log(x) log(x)
+#define log2(x) log2(x)
+#define log10(x) log10(x)
+#define ceil(x) ceil(x)
+#define floor(x) floor(x)
+#define fmod(x) fmod(x)
+#define trunc(x) trunc(x)
 
 
 
index a500868..786a041 100644 (file)
@@ -42,12 +42,24 @@ gs_retval_t FIRST_lfta_LFTA_AGGR_FLUSHME_(gs_uint32_t* scratch);
 void FIRST_lfta_LFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void FIRST_lfta_LFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void FIRST_INT_lfta_LFTA_AGGR_INIT_(gs_int32_t* scratch);
+void FIRST_INT_lfta_LFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+gs_retval_t FIRST_INT_lfta_LFTA_AGGR_FLUSHME_(gs_int32_t* scratch);
+void FIRST_INT_lfta_LFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void FIRST_INT_lfta_LFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void FIRST_ULL_lfta_LFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void FIRST_ULL_lfta_LFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 gs_retval_t FIRST_ULL_lfta_LFTA_AGGR_FLUSHME_(gs_uint64_t* scratch);
 void FIRST_ULL_lfta_LFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void FIRST_ULL_lfta_LFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
+void FIRST_LL_lfta_LFTA_AGGR_INIT_(gs_int64_t* scratch);
+void FIRST_LL_lfta_LFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+gs_retval_t FIRST_LL_lfta_LFTA_AGGR_FLUSHME_(gs_int64_t* scratch);
+void FIRST_LL_lfta_LFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void FIRST_LL_lfta_LFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
 void FIRST_STR_lfta_LFTA_AGGR_INIT_(struct gs_string* scratch);
 void FIRST_STR_lfta_LFTA_AGGR_UPDATE_(struct gs_string* scratch, struct gs_string* val);
 gs_retval_t FIRST_STR_lfta_LFTA_AGGR_FLUSHME_(struct gs_string* scratch);
@@ -61,18 +73,62 @@ gs_retval_t LAST_lfta_LFTA_AGGR_FLUSHME_(gs_uint32_t* scratch);
 void LAST_lfta_LFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch);
 void LAST_lfta_LFTA_AGGR_DESTROY_(gs_uint32_t* scratch);
 
+void LAST_INT_lfta_LFTA_AGGR_INIT_(gs_int32_t* scratch);
+void LAST_INT_lfta_LFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val);
+gs_retval_t LAST_INT_lfta_LFTA_AGGR_FLUSHME_(gs_int32_t* scratch);
+void LAST_INT_lfta_LFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch);
+void LAST_INT_lfta_LFTA_AGGR_DESTROY_(gs_int32_t* scratch);
+
 void LAST_ULL_lfta_LFTA_AGGR_INIT_(gs_uint64_t* scratch);
 void LAST_ULL_lfta_LFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val);
 gs_retval_t LAST_ULL_lfta_LFTA_AGGR_FLUSHME_(gs_uint64_t* scratch);
 void LAST_ULL_lfta_LFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch);
 void LAST_ULL_lfta_LFTA_AGGR_DESTROY_(gs_uint64_t* scratch);
 
+void LAST_LL_lfta_LFTA_AGGR_INIT_(gs_int64_t* scratch);
+void LAST_LL_lfta_LFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val);
+gs_retval_t LAST_LL_lfta_LFTA_AGGR_FLUSHME_(gs_int64_t* scratch);
+void LAST_LL_lfta_LFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch);
+void LAST_LL_lfta_LFTA_AGGR_DESTROY_(gs_int64_t* scratch);
+
 void LAST_STR_lfta_LFTA_AGGR_INIT_(struct gs_string* scratch);
 void LAST_STR_lfta_LFTA_AGGR_UPDATE_(struct gs_string* scratch, struct gs_string* val);
 gs_retval_t LAST_STR_lfta_LFTA_AGGR_FLUSHME_(struct gs_string* scratch);
 void LAST_STR_lfta_LFTA_AGGR_OUTPUT_(struct gs_string* res, struct gs_string* scratch);
 void LAST_STR_lfta_LFTA_AGGR_DESTROY_(struct gs_string* scratch);
 
+//     count_diff aggregate
+void count_diff_lfta_ui_LFTA_AGGR_INIT_(gs_sp_t s) ;
+void count_diff_lfta_ui_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint32_t val) ;
+void count_diff_lfta_ui_LFTA_AGGR_OUTPUT_(struct gs_string *res, gs_sp_t s) ;
+void count_diff_lfta_ui_LFTA_AGGR_DESTROY_(gs_sp_t s) ;
+gs_retval_t count_diff_lfta_ui_LFTA_AGGR_FLUSHME_(gs_sp_t s) ;
+
+void count_diff_lfta_i_LFTA_AGGR_INIT_(gs_sp_t s) ;
+void count_diff_lfta_i_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_int32_t val) ;
+void count_diff_lfta_i_LFTA_AGGR_OUTPUT_(struct gs_string *res, gs_sp_t s) ;
+void count_diff_lfta_i_LFTA_AGGR_DESTROY_(gs_sp_t s) ;
+gs_retval_t count_diff_lfta_i_LFTA_AGGR_FLUSHME_(gs_sp_t s) ;
+
+void count_diff_lfta_ul_LFTA_AGGR_INIT_(gs_sp_t s) ;
+void count_diff_lfta_ul_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint64_t val) ;
+void count_diff_lfta_ul_LFTA_AGGR_OUTPUT_(struct gs_string *res, gs_sp_t s) ;
+void count_diff_lfta_ul_LFTA_AGGR_DESTROY_(gs_sp_t s) ;
+gs_retval_t count_diff_lfta_ul_LFTA_AGGR_FLUSHME_(gs_sp_t s) ;
+
+void count_diff_lfta_l_LFTA_AGGR_INIT_(gs_sp_t s) ;
+void count_diff_lfta_l_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_int64_t val) ;
+void count_diff_lfta_l_LFTA_AGGR_OUTPUT_(struct gs_string *res, gs_sp_t s) ;
+void count_diff_lfta_l_LFTA_AGGR_DESTROY_(gs_sp_t s) ;
+gs_retval_t count_diff_lfta_l_LFTA_AGGR_FLUSHME_(gs_sp_t s) ;
+
+void count_diff_lfta_s_LFTA_AGGR_INIT_(gs_sp_t s) ;
+void count_diff_lfta_s_LFTA_AGGR_UPDATE_(gs_sp_t s, struct gs_string *val) ;
+void count_diff_lfta_s_LFTA_AGGR_OUTPUT_(struct gs_string *res, gs_sp_t s) ;
+void count_diff_lfta_s_LFTA_AGGR_DESTROY_(gs_sp_t s) ;
+gs_retval_t count_diff_lfta_s_LFTA_AGGR_FLUSHME_(gs_sp_t s) ;
+
+
 //             running_array_aggr aggregate
 void running_array_aggr_lfta_LFTA_AGGR_INIT_(char* scratch);
 void running_array_aggr_lfta_LFTA_AGGR_UPDATE_(char* scratch, gs_uint32_t val);
diff --git a/include/watchlist.h b/include/watchlist.h
new file mode 100644 (file)
index 0000000..a5719c5
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef __WATCHLIST_H_DEFINED__
+#define __WATCHLIST_H_DEFINED__
+
+
+static inline gs_retval_t wl_csv_uint(char *p, gs_uint32_t *t)
+{
+    *t = strtoul((const char*)p, NULL, 10);
+       return 0;
+}
+
+static inline gs_retval_t wl_csv_ullong(char *p, gs_uint64_t *t)
+{
+    *t = strtoull((const char*)p, NULL, 10);
+       return 0;
+}
+
+static inline gs_retval_t wl_csv_ip(char *p, gs_uint32_t *t)
+{
+       unsigned ip1,ip2,ip3,ip4;
+    sscanf((const char*) p,"%u.%u.%u.%u",&ip1,&ip2,&ip3,&ip4);
+       *t=(ip1<<24)|(ip2<<16)|(ip3<<8)|ip4;
+       return 0;
+}
+
+static inline gs_retval_t wl_csv_ipv6(char *p, struct ipv6_str *t)
+{
+    gs_uint32_t v[8];
+    sscanf((const char*) p,"%x:%x:%x:%x:%x:%x:%x:%x",&v[0],&v[1],&v[2],&v[3],&v[4],&v[5],&v[6],&v[7]);
+       t->v[0]=htonl(v[0]<<16|v[1]);
+       t->v[1]=htonl(v[2]<<16|v[3]);
+       t->v[2]=htonl(v[4]<<16|v[5]);
+       t->v[3]=htonl(v[6]<<16|v[7]);
+       return 0;
+}
+
+static inline gs_retval_t wl_csv_string(char *p, struct gs_string * t)
+{
+    size_t sz = strlen(p);
+       t->data=(gs_sp_t)strndup(p, sz);
+    t->length=sz;
+       t->owner=(struct FTA *)1;
+    return 0;
+}
+
+static inline gs_retval_t wl_csv_bool(char *p, gs_uint32_t *t)
+{
+       *t=0;
+       if ((strlen((const char*)p)==4) &&
+               (strncasecmp("TRUE",(const char*)p,4) ==0) ) {
+               *t=1;
+       }
+    return 0;
+}
+
+static inline gs_retval_t wl_csv_int(char *p, gs_int32_t *t)
+{
+    *t = strtol((const char*)p, NULL, 10);
+    return 0;
+}
+
+static inline gs_retval_t wl_csv_llong(char *p, gs_int64_t *t)
+{
+    *t = strtoll((const char*)p, NULL, 10);
+    return 0;
+}
+
+static inline gs_retval_t wl_csv_float(char *p, gs_float_t *t)
+{
+    *t = strtod((const char*)p, NULL);
+    return 0;
+}
+
+
+
+
+#endif
index 430dd47..d793577 100644 (file)
@@ -283,6 +283,10 @@ int verify_colref(scalarexp_t *se, tablevar_list_t *fm,
                        cr->set_interface("");
                        cr->set_table_name(fm->get_tablevar_name(table_var));
 
+                       if(! schema->contains_field(cr->get_schema_ref(), field)){
+                               fprintf(stderr, "Error, field %s is not in stream %s\n", field.c_str(), schema->get_table_name( cr->get_schema_ref() ).c_str());
+                               return -1;
+                       }
 
                        type_name = schema->get_type_name(cr->get_schema_ref(), field);
                        param_list *modifiers = schema->get_modifier_list(cr->get_schema_ref(), field);
@@ -4116,7 +4120,7 @@ query_summary_class *analyze_fta(table_exp_t *fta_tree, table_list *schema,
 //             Require explicit INNER_JOIN, ... specification for join queries.
        if(jprop < 0){
                if(qs->query_type != MERGE_QUERY && tbl_vec.size() > 1){
-                       fprintf(stderr,"ERROR, a join query must specify one of INNER_JOIM, OUTER_JOIN, LEFT_OUTER_JOIN, RIGHT_OUTER_JOIN, FILTER_JOIN.\n");
+                       fprintf(stderr,"ERROR, a join query must specify one of INNER_JOIM, OUTER_JOIN, LEFT_OUTER_JOIN, RIGHT_OUTER_JOIN, WATCHLIST_JOIN, FILTER_JOIN.\n");
                        return(NULL);
                }
        }
@@ -4152,12 +4156,11 @@ query_summary_class *analyze_fta(table_exp_t *fta_tree, table_list *schema,
                data_type *dt0 = new data_type(type_name, modifiers);
                string dt0_type = dt0->get_type_str();
                if(dt0_type != "INT" && dt0_type != "UINT" && dt0_type != "LLONG" && dt0_type != "ULLONG"){
-//             if(dt0->get_type_str() != "UINT"){
                        fprintf(stderr,"ERROR, the temporal attribute in a filter join must be one of INT/UINT/LLONG/ULLONG.\n");
                        return NULL;
                }
                if(! dt0->is_increasing()){
-                       fprintf(stderr,"ERROR, the temporal attribtue in a filter join must be temporal increasing.\n");
+                       fprintf(stderr,"ERROR, the temporal attribute in a filter join must be temporal increasing.\n");
                        return NULL;
                }
        }
@@ -4192,6 +4195,12 @@ query_summary_class *analyze_fta(table_exp_t *fta_tree, table_list *schema,
 //             unpack the param table to a global for easier analysis.
        param_tbl=qs->param_tbl;
 
+
+//////////////////             WATCHLIST specialized analysis
+       if(qs->query_type == WATCHLIST_QUERY){
+//             Populate a SELECT clause?
+       }
+
 //////////////////             MERGE specialized analysis
 
        if(qs->query_type == MERGE_QUERY){
index 062fd6d..389119b 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------
-Copyright 2014 AT&T Intellectual Property
+Copyright 2020 AT&T Intellectual Property
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
@@ -50,7 +50,7 @@ Copyright 2014 AT&T Intellectual Property
 /*             No lex lib, supply the yywrap fcn. that normally resides there
 */
 
-int FtaParserwrap(){return(1);}
+//int FtaParserwrap(){return(1);}
 
 extern int FtaParserdebug;
 
@@ -134,6 +134,7 @@ INNER_JOIN|Inner_Join|inner_join    { flex_fta_ch+=FtaParserleng; return INNER_JOIN
 OUTER_JOIN|Outer_Join|outer_join       { flex_fta_ch+=FtaParserleng; return OUTER_JOIN; }
 RIGHT_OUTER_JOIN|Right_Outer_Join|right_outer_join     { flex_fta_ch+=FtaParserleng; return RIGHT_OUTER_JOIN; }
 LEFT_OUTER_JOIN|Left_Outer_Join|left_outer_join        { flex_fta_ch+=FtaParserleng; return LEFT_OUTER_JOIN; }
+WATCHLIST_JOIN|Watchlist_Join|watchlist_join   { flex_fta_ch+=FtaParserleng; return WATCHLIST_JOIN; }
 FILTER_JOIN|Filter_Join|filter_join    { flex_fta_ch+=FtaParserleng; return FILTER_JOIN; }
 GROUP|Group|group      { flex_fta_ch+=FtaParserleng; return GROUP; }
 ROLLUP|Rollup|rollup   { flex_fta_ch+=FtaParserleng; return ROLLUP; }
@@ -155,6 +156,7 @@ SUCH|Such|such      { flex_fta_ch+=FtaParserleng; return SUCH;}
 THAT|That|that { flex_fta_ch+=FtaParserleng; return THAT;}
 MERGE|Merge|merge       {flex_fta_ch+=FtaParserleng; return MERGE;}
 SLACK   {flex_fta_ch+=FtaParserleng; return SLACK;}
+WATCHLIST|Watchlist|watchlist   {flex_fta_ch+=FtaParserleng; return WATCHLIST;}
 
 TRUE   { flex_fta_ch+=FtaParserleng; return TRUE_V;}
 FALSE  { flex_fta_ch+=FtaParserleng; return FALSE_V;}
index 30b1938..8bd2ab0 100644 (file)
@@ -154,41 +154,43 @@ extern int FtaParserdebug;
     OUTER_JOIN = 278,
     LEFT_OUTER_JOIN = 279,
     RIGHT_OUTER_JOIN = 280,
-    GROUP = 281,
-    HAVING = 282,
-    IN = 283,
-    SELECT = 284,
-    WHERE = 285,
-    SUPERGROUP = 286,
-    CLEANING_WHEN = 287,
-    CLEANING_BY = 288,
-    CLOSING_WHEN = 289,
-    SUCH = 290,
-    THAT = 291,
-    CUBE = 292,
-    ROLLUP = 293,
-    GROUPING_SETS = 294,
-    TRUE_V = 295,
-    FALSE_V = 296,
-    TIMEVAL_L = 297,
-    HEX_L = 298,
-    LHEX_L = 299,
-    IP_L = 300,
-    IPV6_L = 301,
-    MERGE = 302,
-    SLACK = 303,
-    DEFINE_SEC = 304,
-    PARAM_SEC = 305,
-    PROTOCOL = 306,
-    TABLE = 307,
-    STREAM = 308,
-    FTA = 309,
-    UNPACK_FCNS = 310,
-    OPERATOR = 311,
-    OPERATOR_VIEW = 312,
-    FIELDS = 313,
-    SUBQUERIES = 314,
-    SELECTION_PUSHDOWN = 315
+    WATCHLIST_JOIN = 281,
+    GROUP = 282,
+    HAVING = 283,
+    IN = 284,
+    SELECT = 285,
+    WATCHLIST = 286,
+    WHERE = 287,
+    SUPERGROUP = 288,
+    CLEANING_WHEN = 289,
+    CLEANING_BY = 290,
+    CLOSING_WHEN = 291,
+    SUCH = 292,
+    THAT = 293,
+    CUBE = 294,
+    ROLLUP = 295,
+    GROUPING_SETS = 296,
+    TRUE_V = 297,
+    FALSE_V = 298,
+    TIMEVAL_L = 299,
+    HEX_L = 300,
+    LHEX_L = 301,
+    IP_L = 302,
+    IPV6_L = 303,
+    MERGE = 304,
+    SLACK = 305,
+    DEFINE_SEC = 306,
+    PARAM_SEC = 307,
+    PROTOCOL = 308,
+    TABLE = 309,
+    STREAM = 310,
+    FTA = 311,
+    UNPACK_FCNS = 312,
+    OPERATOR = 313,
+    OPERATOR_VIEW = 314,
+    FIELDS = 315,
+    SUBQUERIES = 316,
+    SELECTION_PUSHDOWN = 317
   };
 #endif
 
@@ -242,7 +244,7 @@ union YYSTYPE
        unpack_fcn_list *ufcnl;
 
 
-#line 246 "fta.tab.cc" /* yacc.c:355  */
+#line 248 "fta.tab.cc" /* yacc.c:355  */
 };
 
 typedef union YYSTYPE YYSTYPE;
@@ -259,7 +261,7 @@ int FtaParserparse (void);
 
 /* Copy the second part of user declarations.  */
 
-#line 263 "fta.tab.cc" /* yacc.c:358  */
+#line 265 "fta.tab.cc" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -499,23 +501,23 @@ union yyalloc
 #endif /* !YYCOPY_NEEDED */
 
 /* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  57
+#define YYFINAL  60
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   695
+#define YYLAST   738
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  80
+#define YYNTOKENS  82
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  59
+#define YYNNTS  60
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  176
+#define YYNRULES  183
 /* YYNSTATES -- Number of states.  */
-#define YYNSTATES  377
+#define YYNSTATES  390
 
 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
    by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   315
+#define YYMAXUTOK   317
 
 #define YYTRANSLATE(YYX)                                                \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -527,16 +529,16 @@ static const yytype_uint8 yytranslate[] =
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    74,     2,    77,    76,    19,    13,     2,
-      68,    70,    17,    15,    69,    16,    71,    18,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,    79,     2,
-       2,     2,     2,     2,    78,     2,     2,     2,     2,     2,
+       2,     2,     2,    76,     2,    79,    78,    19,    13,     2,
+      70,    72,    17,    15,    71,    16,    73,    18,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,    81,     2,
+       2,     2,     2,     2,    80,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,    72,     2,    73,     2,     2,     2,     2,     2,     2,
+       2,    74,     2,    75,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,    12,     2,    75,     2,     2,     2,
+       2,     2,     2,     2,    12,     2,    77,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -555,31 +557,32 @@ static const yytype_uint8 yytranslate[] =
       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67
+      62,    63,    64,    65,    66,    67,    68,    69
 };
 
 #if YYDEBUG
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   204,   204,   209,   216,   230,   235,   240,   245,   249,
-     252,   257,   262,   266,   270,   275,   276,   280,   281,   285,
-     286,   290,   291,   295,   296,   300,   304,   306,   314,   318,
-     330,   331,   332,   333,   334,   335,   339,   340,   344,   345,
-     349,   350,   351,   352,   353,   357,   358,   363,   364,   368,
-     372,   373,   377,   378,   382,   383,   387,   388,   392,   399,
-     400,   401,   402,   403,   407,   408,   409,   410,   414,   418,
-     422,   423,   429,   430,   431,   432,   433,   434,   435,   436,
-     437,   438,   439,   440,   441,   442,   443,   444,   445,   446,
-     447,   448,   449,   450,   451,   452,   453,   458,   459,   460,
-     461,   465,   466,   470,   471,   472,   473,   474,   475,   476,
-     477,   478,   479,   480,   481,   487,   488,   492,   493,   497,
-     498,   502,   503,   504,   505,   509,   510,   514,   515,   519,
-     520,   521,   522,   533,   534,   538,   539,   540,   544,   545,
-     549,   553,   554,   569,   570,   573,   575,   577,   579,   583,
-     584,   588,   592,   593,   597,   600,   601,   605,   606,   610,
-     611,   615,   616,   617,   618,   619,   620,   621,   622,   626,
-     627,   631,   632,   636,   637,   641,   642
+       0,   206,   206,   211,   218,   232,   237,   242,   247,   251,
+     254,   259,   264,   268,   272,   275,   280,   285,   289,   293,
+     298,   299,   303,   304,   308,   309,   313,   314,   318,   319,
+     323,   327,   329,   334,   342,   346,   358,   359,   360,   361,
+     362,   363,   364,   368,   369,   373,   374,   378,   379,   380,
+     381,   382,   386,   387,   392,   393,   397,   401,   402,   406,
+     407,   411,   412,   416,   417,   421,   428,   429,   430,   431,
+     432,   436,   437,   438,   439,   443,   447,   451,   452,   458,
+     459,   460,   461,   462,   463,   464,   465,   466,   467,   468,
+     469,   470,   471,   472,   473,   474,   475,   476,   477,   478,
+     479,   480,   481,   482,   487,   488,   489,   490,   494,   495,
+     499,   500,   501,   502,   503,   504,   505,   506,   507,   508,
+     509,   510,   516,   517,   521,   522,   526,   527,   531,   532,
+     533,   534,   538,   539,   543,   544,   548,   549,   550,   551,
+     562,   563,   567,   568,   569,   573,   574,   578,   582,   583,
+     598,   599,   602,   604,   606,   608,   612,   613,   617,   621,
+     622,   626,   629,   630,   634,   635,   639,   640,   644,   645,
+     646,   647,   648,   649,   650,   651,   655,   656,   660,   661,
+     665,   666,   670,   671
 };
 #endif
 
@@ -593,18 +596,19 @@ static const char *const yytname[] =
   "'&'", "SHIFT_OP", "'+'", "'-'", "'*'", "'/'", "'%'", "UMINUS",
   "SEMICOLON", "LEFTBRACE", "RIGHTBRACE", "BY", "AS", "AGGR", "FROM",
   "INNER_JOIN", "FILTER_JOIN", "OUTER_JOIN", "LEFT_OUTER_JOIN",
-  "RIGHT_OUTER_JOIN", "GROUP", "HAVING", "IN", "SELECT", "WHERE",
-  "SUPERGROUP", "CLEANING_WHEN", "CLEANING_BY", "CLOSING_WHEN", "SUCH",
-  "THAT", "CUBE", "ROLLUP", "GROUPING_SETS", "TRUE_V", "FALSE_V",
-  "TIMEVAL_L", "HEX_L", "LHEX_L", "IP_L", "IPV6_L", "MERGE", "SLACK",
-  "DEFINE_SEC", "PARAM_SEC", "PROTOCOL", "TABLE", "STREAM", "FTA",
-  "UNPACK_FCNS", "OPERATOR", "OPERATOR_VIEW", "FIELDS", "SUBQUERIES",
-  "SELECTION_PUSHDOWN", "'('", "','", "')'", "'.'", "'['", "']'", "'!'",
-  "'~'", "'$'", "'#'", "'@'", "':'", "$accept", "parse_result", "gsql",
-  "query_list", "params_def", "variable_def", "variable_list",
-  "variable_assign", "select_statement", "merge_statement", "selection",
-  "table_exp", "from_clause", "table_ref_commalist", "table_ref", "table",
-  "qname", "opt_where_clause", "where_clause", "opt_cleaning_when_clause",
+  "RIGHT_OUTER_JOIN", "WATCHLIST_JOIN", "GROUP", "HAVING", "IN", "SELECT",
+  "WATCHLIST", "WHERE", "SUPERGROUP", "CLEANING_WHEN", "CLEANING_BY",
+  "CLOSING_WHEN", "SUCH", "THAT", "CUBE", "ROLLUP", "GROUPING_SETS",
+  "TRUE_V", "FALSE_V", "TIMEVAL_L", "HEX_L", "LHEX_L", "IP_L", "IPV6_L",
+  "MERGE", "SLACK", "DEFINE_SEC", "PARAM_SEC", "PROTOCOL", "TABLE",
+  "STREAM", "FTA", "UNPACK_FCNS", "OPERATOR", "OPERATOR_VIEW", "FIELDS",
+  "SUBQUERIES", "SELECTION_PUSHDOWN", "'('", "','", "')'", "'.'", "'['",
+  "']'", "'!'", "'~'", "'$'", "'#'", "'@'", "':'", "$accept",
+  "parse_result", "gsql", "query_list", "params_def", "variable_def",
+  "variable_list", "variable_assign", "select_statement",
+  "merge_statement", "watchlist_statement", "selection", "table_exp",
+  "from_clause", "table_ref_commalist", "table_ref", "table", "qname",
+  "opt_where_clause", "where_clause", "opt_cleaning_when_clause",
   "opt_cleaning_by_clause", "opt_closing_when_clause", "opt_having_clause",
   "having_clause", "search_condition", "predicate", "comparison_predicate",
   "in_predicate", "literal_commalist", "scalar_exp", "select_commalist",
@@ -630,17 +634,18 @@ static const yytype_uint16 yytoknum[] =
      278,   279,   280,   281,   282,   283,   284,   285,   286,   287,
      288,   289,   290,   291,   292,   293,   294,   295,   296,   297,
      298,   299,   300,   301,   302,   303,   304,   305,   306,   307,
-     308,   309,   310,   311,   312,   313,   314,   315,    40,    44,
-      41,    46,    91,    93,    33,   126,    36,    35,    64,    58
+     308,   309,   310,   311,   312,   313,   314,   315,   316,   317,
+      40,    44,    41,    46,    91,    93,    33,   126,    36,    35,
+      64,    58
 };
 # endif
 
-#define YYPACT_NINF -277
+#define YYPACT_NINF -290
 
 #define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-277)))
+  (!!((Yystate) == (-290)))
 
-#define YYTABLE_NINF -138
+#define YYTABLE_NINF -145
 
 #define yytable_value_is_error(Yytable_value) \
   0
@@ -649,44 +654,45 @@ static const yytype_uint16 yytoknum[] =
      STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
-     413,   489,    37,    51,   105,   114,   120,   124,   128,   126,
-     142,  -277,   136,    72,    24,  -277,  -277,   169,  -277,   104,
-    -277,  -277,  -277,  -277,   489,   489,     0,  -277,  -277,   175,
-     189,   213,   217,   224,   489,   489,   489,   170,   229,   240,
-     338,   426,   182,  -277,  -277,  -277,   235,   230,   369,    35,
-      36,   253,  -277,     1,   169,   319,   289,  -277,    -9,    95,
-    -277,  -277,    95,  -277,  -277,  -277,   148,     8,   255,  -277,
-    -277,   242,   267,  -277,  -277,  -277,  -277,  -277,   257,  -277,
-    -277,  -277,  -277,  -277,    17,   309,   269,   312,   313,   321,
-    -277,   316,   489,   489,   489,   489,   489,   489,   489,   489,
-     347,   489,   351,    37,   489,    37,  -277,   130,  -277,    41,
-    -277,  -277,    81,   372,   305,   375,   378,   360,    83,   382,
-      62,  -277,   323,  -277,  -277,  -277,  -277,  -277,  -277,   676,
-     101,   331,   400,   281,   342,   595,   357,  -277,   348,   349,
-     410,   353,  -277,   420,   412,    17,    37,    17,    17,    17,
-     411,   395,  -277,   264,   554,   248,   143,   143,  -277,  -277,
-    -277,  -277,   533,  -277,   615,  -277,   408,   415,  -277,  -277,
-    -277,   187,   112,   378,   425,  -277,  -277,   150,   447,   429,
-     463,   319,  -277,   253,   489,  -277,   469,  -277,  -277,   165,
-    -277,  -277,   414,   603,   475,   477,   409,    17,  -277,   353,
-     421,   353,   353,   353,   308,   411,   411,   176,  -277,  -277,
-    -277,   495,   457,   445,   488,  -277,  -277,  -277,  -277,  -277,
-    -277,   513,  -277,   -37,   447,   514,  -277,   516,   107,  -277,
-    -277,  -277,  -277,   455,   676,  -277,  -277,  -277,  -277,   451,
-     412,   458,   482,  -277,   550,   450,  -277,    20,   376,   411,
-     411,   489,   449,   162,   553,   525,  -277,   199,  -277,   113,
-    -277,    11,  -277,  -277,   538,   120,   120,   120,   491,  -277,
-     -32,  -277,   565,  -277,   676,   294,    38,   494,   522,   523,
-     636,  -277,   524,  -277,  -277,   529,   530,   411,   555,  -277,
-    -277,  -277,  -277,  -277,   253,   571,   447,   412,   412,   412,
-     573,  -277,   -27,  -277,    10,   528,   528,   556,   594,   162,
-     553,   553,   176,   411,   561,   305,  -277,   115,    17,   294,
-    -277,   570,   172,  -277,   184,   528,   186,  -277,  -277,  -277,
-    -277,   176,   411,   582,   604,   560,   353,  -277,   632,   528,
-    -277,  -277,   233,   568,  -277,   176,   411,  -277,  -277,   616,
-     662,  -277,  -277,   528,   176,   634,   243,   572,    99,  -277,
-    -277,   653,   634,   590,   655,   245,  -277,   253,   253,   656,
-    -277,   637,  -277,   659,  -277,   253,  -277
+      87,   519,   -34,    49,    60,    70,    66,   108,   104,   112,
+     137,   161,  -290,   157,    16,    98,  -290,  -290,  -290,   277,
+    -290,    45,  -290,  -290,  -290,  -290,   519,   519,   -12,  -290,
+    -290,   184,   198,   220,   256,   295,   519,   519,   519,   196,
+     226,   308,   500,   315,   265,  -290,  -290,  -290,   320,   280,
+     285,   141,    20,    28,   306,  -290,     6,   277,   374,   358,
+    -290,   -10,    92,  -290,  -290,  -290,    92,  -290,  -290,  -290,
+    -290,   228,    13,   311,  -290,  -290,   309,   312,  -290,  -290,
+    -290,  -290,  -290,   356,  -290,  -290,  -290,  -290,  -290,    17,
+     351,   313,   357,   370,   371,   372,  -290,   361,   519,   519,
+     519,   519,   519,   519,   519,   519,   398,   519,   404,   405,
+      49,   519,    49,  -290,   152,  -290,    44,  -290,  -290,   119,
+     406,   336,   409,   419,   401,   121,   421,   116,  -290,   362,
+    -290,  -290,  -290,  -290,  -290,  -290,  -290,  -290,   719,   170,
+     353,   426,   341,   359,   446,   399,  -290,   360,   366,   427,
+     369,  -290,   429,   424,    17,    49,    17,    17,    17,    17,
+     431,   410,  -290,   618,   481,   176,   209,   209,  -290,  -290,
+    -290,  -290,   674,   440,   181,  -290,  -290,   652,  -290,   434,
+     435,  -290,  -290,  -290,   252,   192,   419,   423,  -290,  -290,
+     213,   404,   443,   462,   374,  -290,   306,   519,  -290,   465,
+    -290,  -290,   215,  -290,  -290,   400,   644,   467,   468,   412,
+      17,  -290,   369,   402,   369,   369,   369,   369,   188,   431,
+     431,   260,  -290,  -290,  -290,   234,   450,   448,   486,    26,
+    -290,  -290,  -290,  -290,  -290,  -290,  -290,  -290,   501,  -290,
+     -41,   404,   502,  -290,   197,  -290,  -290,  -290,   439,   719,
+    -290,  -290,  -290,  -290,   441,   424,   442,   444,  -290,   507,
+     487,  -290,    36,   602,   431,   431,   519,   445,   160,   513,
+     485,  -290,   306,   522,   268,  -290,   200,  -290,  -290,   499,
+     108,   108,   108,   472,  -290,   -16,  -290,   545,  -290,   719,
+      35,   534,   488,   490,   491,   688,  -290,   484,  -290,  -290,
+     504,   505,   431,   515,  -290,   336,  -290,  -290,  -290,  -290,
+    -290,   404,   424,   424,   424,   550,  -290,   146,  -290,    15,
+     575,   575,   514,   580,   160,   513,   513,   260,   431,   543,
+     565,   202,    17,    35,  -290,   276,   225,  -290,   231,   575,
+     238,  -290,  -290,  -290,  -290,   260,   431,   544,  -290,   520,
+     369,  -290,   589,   575,  -290,  -290,   246,   523,  -290,   260,
+     431,  -290,   572,   705,  -290,  -290,   575,   260,   597,   250,
+     532,   195,  -290,  -290,   600,   597,   536,   603,   279,  -290,
+     306,   306,   605,  -290,   586,  -290,   607,  -290,   306,  -290
 };
 
   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -695,65 +701,66 @@ static const yytype_int16 yypact[] =
 static const yytype_uint8 yydefact[] =
 {
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    15,     2,     0,     0,     9,    14,     3,   143,   135,
-     103,   104,   105,   106,     0,     0,     0,   107,   108,     0,
+       0,     0,    20,     2,     0,     0,     9,    14,    19,     3,
+     150,   142,   110,   111,   112,   113,     0,     0,     0,   114,
+     115,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   104,    34,    91,    93,    94,     0,   142,
+       0,     0,     0,     0,   166,    52,   178,     0,     0,     0,
+       1,     0,     0,     7,    12,    17,     0,     8,    13,    18,
+     151,     0,     0,     0,    87,    88,     0,     0,   116,   117,
+     118,   119,   120,     0,    89,    90,    92,   121,   140,     0,
+       0,     0,     0,     0,     0,     0,    30,    54,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    97,    28,    84,    86,    87,   135,     0,     0,     0,
-       0,   159,    45,   171,     0,     0,     0,     1,     0,     0,
-       7,    12,     0,     8,    13,   144,     0,     0,     0,    80,
-      81,     0,     0,   109,   110,   111,   112,   113,     0,    82,
-      83,    85,   114,   133,     0,     0,     0,     0,     0,     0,
-      25,    47,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    26,     0,    20,     0,
-      21,    18,     0,     0,   169,     0,     0,     0,     0,     0,
-       0,   149,     0,    16,     6,    11,     5,    10,    92,   101,
-       0,   136,     0,     0,     0,     0,     0,    88,    45,     0,
-       0,    30,    36,    38,    40,     0,     0,     0,     0,     0,
-       0,   115,    48,    74,    77,    79,    72,    73,    75,    76,
-      78,    98,    99,   138,     0,   139,     0,     0,    19,    22,
-      17,   161,     0,     0,     0,    46,   173,     0,     0,     0,
-       0,     0,   148,   159,     0,    91,     0,   134,    96,     0,
-      89,    90,     0,     0,     0,     0,     0,     0,    39,    31,
-       0,    32,    34,    33,   135,     0,     0,    49,    63,    64,
-      65,     0,     0,   117,     0,    27,    24,    23,   162,   163,
-     164,     0,   160,     0,     0,     0,   172,     0,     0,   155,
-       4,   151,   150,     0,   102,   137,    95,    93,    94,    45,
-      41,     0,     0,    37,     0,     0,    61,     0,     0,     0,
-       0,     0,     0,     0,     0,    56,   100,   165,   170,     0,
-     174,   159,   146,   156,     0,     0,     0,     0,     0,    66,
-       0,    62,    59,    60,    68,     0,   129,     0,     0,     0,
-       0,   125,   116,   121,   140,     0,   118,     0,    50,    57,
-     166,   167,   168,   145,   159,     0,     0,    42,    43,    44,
-       0,    67,     0,    70,     0,     0,     0,     0,     0,     0,
-       0,     0,    58,     0,    52,   169,   158,     0,     0,     0,
-      69,   130,     0,   127,     0,     0,     0,   132,   126,   141,
-     142,    51,     0,    54,     0,     0,    35,    71,     0,     0,
-     123,   122,     0,     0,   124,    53,     0,    29,   157,     0,
-     131,   128,   119,     0,    55,     0,     0,     0,     0,   152,
-     120,     0,     0,     0,     0,     0,   153,   159,   159,     0,
-     154,     0,   175,     0,   147,   159,   176
+       0,     0,     0,    31,     0,    25,     0,    26,    23,     0,
+       0,   176,     0,     0,     0,     0,     0,     0,   156,     0,
+      21,     6,    11,    16,     5,    10,    15,    99,   108,     0,
+     143,     0,     0,     0,     0,     0,    95,    52,     0,     0,
+      36,    43,    45,    47,     0,     0,     0,     0,     0,     0,
+       0,   122,    55,    81,    84,    86,    79,    80,    82,    83,
+      85,   105,   106,     0,     0,   162,   145,     0,   146,     0,
+       0,    24,    27,    22,   168,     0,     0,     0,    53,   180,
+       0,     0,     0,     0,     0,   155,   166,     0,    98,     0,
+     141,   103,     0,    96,    97,     0,     0,     0,     0,     0,
+       0,    46,    37,     0,    38,    40,    39,    41,   142,     0,
+       0,    56,    70,    71,    72,     0,     0,   124,     0,   166,
+      33,   163,    32,    29,    28,   169,   170,   171,     0,   167,
+       0,     0,     0,   179,     0,     4,   158,   157,     0,   109,
+     144,   102,   100,   101,    52,    48,     0,     0,    44,     0,
+       0,    68,     0,     0,     0,     0,     0,     0,     0,     0,
+      63,   107,   166,     0,   172,   177,     0,   181,   153,     0,
+       0,     0,     0,     0,    73,     0,    69,    66,    67,    75,
+       0,   136,     0,     0,     0,     0,   132,   123,   128,   147,
+       0,   125,     0,    57,    64,   176,   165,   173,   174,   175,
+     152,     0,    49,    50,    51,     0,    74,     0,    77,     0,
+       0,     0,     0,     0,     0,     0,     0,    65,     0,    59,
+       0,     0,     0,     0,    76,   137,     0,   134,     0,     0,
+       0,   139,   133,   148,   149,    58,     0,    61,   164,     0,
+      42,    78,     0,     0,   130,   129,     0,     0,   131,    60,
+       0,    35,     0,   138,   135,   126,     0,    62,     0,     0,
+       0,     0,   159,   127,     0,     0,     0,     0,     0,   160,
+     166,   166,     0,   161,     0,   182,     0,   154,   166,   183
 };
 
   /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -277,  -277,   -36,  -277,   625,   650,   614,    47,    12,    53,
-    -277,  -277,   -40,  -142,   470,  -277,    -5,  -277,  -277,  -277,
-    -277,  -277,  -277,  -277,  -188,  -277,  -277,  -277,  -277,    -1,
-    -277,  -124,  -244,  -277,  -277,  -277,   359,  -277,  -276,  -237,
-    -277,     2,  -277,    15,  -277,   612,    -7,  -277,   490,  -277,
-     307,  -209,  -216,  -181,  -277,   355,  -277,   499,  -277
+    -290,  -290,   -42,  -290,   596,   608,   570,   -48,    47,    50,
+      65,  -290,  -290,   -49,  -150,   430,  -290,    -6,  -290,  -290,
+    -290,  -290,  -290,  -290,  -290,  -208,  -290,  -290,  -290,  -290,
+      -1,  -290,  -128,  -273,  -290,  -290,  -290,   317,  -290,  -289,
+    -246,  -290,     7,  -290,    29,  -290,   582,    -4,  -290,   449,
+    -290,   267,  -178,  -171,  -191,  -290,   339,  -290,   460,  -290
 };
 
   /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,    10,    11,    12,    13,    14,   109,   110,    15,    16,
-      40,    90,    91,   141,   142,   143,   144,   151,   152,   314,
-     333,   347,   288,   289,   207,   208,   209,   210,   302,   211,
-      42,   130,    43,   213,   255,   326,   281,   282,   322,   323,
-      44,    45,    48,   285,   286,    17,    18,   120,   121,   358,
-     359,   228,   229,   114,   172,   174,   117,   177,   365
+      -1,    11,    12,    13,    14,    15,   116,   117,    16,    17,
+      18,    42,    96,    97,   150,   151,   152,   153,   161,   162,
+     329,   347,   361,   303,   304,   221,   222,   223,   224,   317,
+     225,    44,   139,    45,   227,   270,   340,   296,   297,   336,
+     337,    46,    47,    51,   300,   301,    19,    20,   127,   128,
+     371,   372,   174,   175,   121,   185,   187,   124,   190,   378
 };
 
   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
@@ -761,240 +768,251 @@ static const yytype_int16 yydefgoto[] =
      number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int16 yytable[] =
 {
-      41,    53,   233,   199,    47,   201,   202,   203,   106,   189,
-      65,   131,   263,   321,   294,   259,   283,   246,   247,   115,
-     138,   139,   123,    69,    70,    60,    63,     1,   249,   250,
-     324,   303,   225,    78,    79,    80,   258,   184,   107,   107,
-      46,   301,   319,   263,   107,     2,   320,     3,     4,   342,
-    -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,   108,   111,
-       1,   272,   273,  -135,   168,   129,    61,    64,    71,   116,
-     135,   124,   283,    49,   126,   337,    72,   356,     2,   113,
-     295,     4,   179,   181,   107,   182,   132,   317,   132,   140,
-     271,   153,   154,   155,   156,   157,   158,   159,   160,   312,
-     162,   263,   351,   164,   170,   163,    66,   165,     1,   304,
-     227,    65,   125,   315,    68,   127,   227,    51,   227,     1,
-     362,   270,   363,    52,   215,   331,     2,    50,     3,    56,
-     262,     1,   129,   166,   167,   193,   293,     2,   335,     3,
-       4,     5,    57,     6,   345,     8,    54,     9,   200,     2,
-      55,    19,    20,    21,    22,    23,   169,    58,   354,   169,
-      97,    98,    99,    24,    25,   276,    20,    21,    22,    23,
-     184,   185,    66,    81,    26,    67,   336,    24,    25,    73,
-      68,   221,   222,   234,   249,   250,   371,   372,    26,   240,
-     218,   219,   220,    74,   376,    27,    28,    29,    30,    31,
-      32,    33,   290,   291,   292,   248,   277,   278,   279,    27,
-      28,    29,    30,    31,    32,    33,    34,    75,   128,   225,
-     226,    76,    35,    36,    37,    38,    39,     5,    77,     6,
-      34,     8,    82,     9,   184,   236,    35,    36,    37,    38,
-      39,   339,   340,    83,   129,    19,    20,    21,    22,    23,
-     274,   101,   280,   339,   341,   343,   344,    24,    25,   134,
-     297,   298,   299,    95,    96,    97,    98,    99,    26,    92,
-      93,    94,    95,    96,    97,    98,    99,    93,    94,    95,
-      96,    97,    98,    99,    19,    20,    21,    22,    23,    27,
-      28,    29,    30,    31,    32,    33,    24,    25,    20,    21,
-      22,    23,   339,   352,   280,   280,   102,    26,   280,   103,
-      34,   122,   339,   360,   369,   370,    35,    36,    37,    38,
-      39,   113,   119,   133,   280,   329,   330,   137,    27,    28,
-      29,    30,    31,    32,    33,   136,   145,   146,   280,   147,
-     148,    27,    28,    29,    30,    31,    32,    33,   149,    34,
-     161,   188,   280,   150,   131,    35,    36,    37,    38,    39,
-      19,    20,    21,    22,    23,    84,    85,    86,    87,    88,
-      89,    38,    24,    25,   192,   171,    66,   173,   175,    67,
-     245,   176,   178,    26,    68,   180,   183,   251,    92,    93,
-      94,    95,    96,    97,    98,    99,    84,    85,    86,    87,
-      88,    89,   186,   187,    27,    28,    29,    30,    31,    32,
-      33,   252,   190,   196,   204,    20,    21,    22,    23,   194,
-     195,   205,   197,   198,   104,    34,    24,    25,   212,   216,
-     115,    35,    36,    37,    38,    39,   217,    26,    92,    93,
-      94,    95,    96,    97,    98,    99,   137,   224,   105,     1,
-     227,   100,   230,    19,    20,    21,    22,    23,    27,    28,
-      29,    30,    31,    32,    33,    24,    25,     2,   231,     3,
-       4,     5,   235,     6,     7,     8,    26,     9,   239,   206,
-     241,   253,   242,   254,   237,    35,    36,    37,    38,    39,
-     244,   256,    19,    20,    21,    22,    23,    27,    28,    29,
-      30,    31,    32,    33,    24,    25,   251,    92,    93,    94,
-      95,    96,    97,    98,    99,    26,   257,   260,    34,   261,
-     264,   275,   265,   269,    35,    36,    37,    38,    39,   266,
-     252,   276,    20,    21,    22,    23,    27,    28,    29,    30,
-      31,    32,    33,    24,    25,    92,    93,    94,    95,    96,
-      97,    98,    99,   267,    26,   268,   284,    34,   214,   287,
-     296,   300,   305,    35,    36,    37,    38,    39,    94,    95,
-      96,    97,    98,    99,   250,    27,    28,    29,    30,    31,
-      32,    33,  -136,  -136,  -136,  -136,  -136,  -136,  -136,  -136,
-     306,   307,   316,   309,   313,  -136,    34,   327,   310,   311,
-     318,   332,    35,    36,    37,    38,    39,    92,    93,    94,
-      95,    96,    97,    98,    99,    92,    93,    94,    95,    96,
-      97,    98,    99,   346,   325,   348,   349,    92,    93,    94,
-      95,    96,    97,    98,    99,   350,   353,   357,   355,    62,
-     361,   338,    84,    85,    86,    87,    88,    89,    92,    93,
-      94,    95,    96,    97,    98,    99,   364,   367,   368,   373,
-     374,   308,   375,    59,   112,   191,   118,   243,   328,   366,
-     334,   232,   223,   238,  -137,  -137,  -137,  -137,  -137,  -137,
-    -137,  -137,     0,     0,     0,     0,     0,  -137,    92,    93,
-      94,    95,    96,    97,    98,    99
+      43,    56,   113,   231,   212,   248,   214,   215,   216,   217,
+      50,   261,   262,   244,   202,    70,   140,   318,   335,   130,
+     147,   148,   298,   114,   122,    74,    75,     1,     2,   272,
+     242,   114,   338,    48,   275,    83,    84,    85,   273,    22,
+      23,    24,    25,   115,   264,   265,     3,   114,     4,     5,
+     356,   118,    49,     1,     2,   197,   287,   288,    76,   316,
+     351,    63,    67,   276,    64,    68,    77,   181,   182,    54,
+     138,   182,     3,   231,     4,   144,   123,   369,   298,    65,
+      69,   305,    52,   192,    29,    30,    31,    32,    33,    34,
+      35,   149,    53,   141,   327,   141,   120,   163,   164,   165,
+     166,   167,   168,   169,   170,   231,   172,   364,   286,   131,
+     177,    55,   132,   134,    40,    71,   135,   176,    72,   178,
+     345,    70,   114,    73,     1,     2,    57,   133,   232,     1,
+       2,   136,   285,   331,    58,     1,     2,   194,   359,   195,
+      59,   138,   183,     3,   206,     4,     5,     6,     3,     7,
+       8,     9,   367,    10,     3,   179,   180,     5,     1,     2,
+     231,    60,   213,   291,    22,    23,    24,    25,    89,    90,
+      91,    92,    93,    94,    95,    26,    27,     3,    61,     4,
+       5,     6,   350,     7,   173,     9,    28,    10,    78,   384,
+     385,   101,   102,   103,   104,   105,   249,   389,   111,    86,
+     173,   255,    79,   173,   230,   173,   292,   293,   294,    29,
+      30,    31,    32,    33,    34,    35,   375,   333,   376,   263,
+     278,   334,   112,   310,    80,   349,   103,   104,   105,    87,
+      36,    21,    22,    23,    24,    25,    37,    38,    39,    40,
+      41,   197,   198,    26,    27,   266,    98,    99,   100,   101,
+     102,   103,   104,   105,    28,   235,   236,   237,    71,   138,
+      81,    72,   260,   238,   239,   289,    73,   295,   264,   265,
+     267,   307,   308,   309,   312,   313,   314,    29,    30,    31,
+      32,    33,    34,    35,   242,   243,   197,   251,  -143,  -143,
+    -143,  -143,  -143,  -143,  -143,  -143,   353,   354,    36,    82,
+     137,  -143,   353,   355,    37,    38,    39,    40,    41,   357,
+     358,    88,    21,    22,    23,    24,    25,   353,   365,   295,
+     295,   353,   373,   295,    26,    27,   143,    98,    99,   100,
+     101,   102,   103,   104,   105,    28,   107,     6,   295,     7,
+     106,     9,   108,    10,    21,    22,    23,    24,    25,   352,
+     382,   383,   295,   109,   343,   344,    26,    27,    29,    30,
+      31,    32,    33,    34,    35,   295,   110,    28,    98,    99,
+     100,   101,   102,   103,   104,   105,   120,   126,   154,    36,
+     129,   142,   145,   155,   156,    37,    38,    39,    40,    41,
+      29,    30,    31,    32,    33,    34,    35,   157,   158,   159,
+     160,   171,    21,    22,    23,    24,    25,   173,   140,   184,
+     186,    36,   188,   201,    26,    27,   205,    37,    38,    39,
+      40,    41,   189,   191,   193,    28,   199,   196,   146,   200,
+     209,   203,   211,   207,   218,    22,    23,    24,    25,   208,
+     210,   219,   122,   229,   226,   241,    26,    27,    29,    30,
+      31,    32,    33,    34,    35,   233,   234,    28,    98,    99,
+     100,   101,   102,   103,   104,   105,   245,   246,   250,    36,
+     254,   256,   252,   259,   268,    37,    38,    39,    40,    41,
+      29,    30,    31,    32,    33,    34,    35,   257,   269,   271,
+      21,    22,    23,    24,    25,   100,   101,   102,   103,   104,
+     105,   220,    26,    27,   274,   277,   279,    37,    38,    39,
+      40,    41,   283,    28,   280,   281,   299,   282,   204,   290,
+     302,   311,    21,    22,    23,    24,    25,    89,    90,    91,
+      92,    93,    94,    95,    26,    27,    29,    30,    31,    32,
+      33,    34,    35,   306,   315,    28,  -142,  -142,  -142,  -142,
+    -142,  -142,  -142,  -142,   265,   324,   328,    36,   320,  -142,
+     321,   322,   284,    37,    38,    39,    40,    41,    29,    30,
+      31,    32,    33,    34,    35,   325,   326,   332,   291,    22,
+      23,    24,    25,   341,   339,   346,   348,   360,   362,    36,
+      26,    27,   363,   366,   368,    37,    38,    39,    40,    41,
+     370,    28,   374,   377,    71,   380,   381,   319,   386,   387,
+     388,    66,    73,   266,    98,    99,   100,   101,   102,   103,
+     104,   105,    62,   119,    29,    30,    31,    32,    33,    34,
+      35,    99,   100,   101,   102,   103,   104,   105,   267,   125,
+     258,   342,   379,   247,   330,    36,   240,     0,     0,     0,
+       0,    37,    38,    39,    40,    41,    98,    99,   100,   101,
+     102,   103,   104,   105,    98,    99,   100,   101,   102,   103,
+     104,   105,     0,     0,   146,     0,     0,     0,     0,    89,
+      90,    91,    92,    93,    94,    95,    98,    99,   100,   101,
+     102,   103,   104,   105,     0,     0,     0,     0,     0,   228,
+      98,    99,   100,   101,   102,   103,   104,   105,     0,     0,
+       0,     0,     0,   323,     0,     0,   253,  -144,  -144,  -144,
+    -144,  -144,  -144,  -144,  -144,     0,     0,     0,     0,     0,
+    -144,    98,    99,   100,   101,   102,   103,   104,   105
 };
 
 static const yytype_int16 yycheck[] =
 {
-       1,     6,   183,   145,     2,   147,   148,   149,    48,   133,
-      17,     3,   228,     3,     3,   224,   253,   205,   206,    18,
-       3,     4,    58,    24,    25,    13,    14,    36,     8,     9,
-     306,   275,    69,    34,    35,    36,    73,    69,     3,     3,
-       3,    73,    69,   259,     3,    54,    73,    56,    57,   325,
-      12,    13,    14,    15,    16,    17,    18,    19,    23,    23,
-      36,   249,   250,    25,    23,    66,    13,    14,    68,    68,
-      71,    59,   309,    22,    62,   319,    76,   353,    54,    68,
-     261,    57,   118,    21,     3,    23,    78,   296,    78,    72,
-      70,    92,    93,    94,    95,    96,    97,    98,    99,   287,
-     101,   317,   339,   104,    23,   103,    68,   105,    36,    71,
-       3,   118,    59,   294,    76,    62,     3,     3,     3,    36,
-      21,   245,    23,     3,   164,   313,    54,    22,    56,     3,
-      23,    36,   133,     3,     4,   136,    23,    54,    23,    56,
-      57,    58,     0,    60,   332,    62,    22,    64,   146,    54,
-      22,     3,     4,     5,     6,     7,   109,    21,   346,   112,
-      17,    18,    19,    15,    16,     3,     4,     5,     6,     7,
-      69,    70,    68,     3,    26,    71,   318,    15,    16,     4,
-      76,    69,    70,   184,     8,     9,   367,   368,    26,   194,
-       3,     4,     5,     4,   375,    47,    48,    49,    50,    51,
-      52,    53,     3,     4,     5,   206,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    68,     4,    70,    69,
-      70,     4,    74,    75,    76,    77,    78,    58,     4,    60,
-      68,    62,     3,    64,    69,    70,    74,    75,    76,    77,
-      78,    69,    70,     3,   245,     3,     4,     5,     6,     7,
-     251,    69,   253,    69,    70,    69,    70,    15,    16,    17,
-     265,   266,   267,    15,    16,    17,    18,    19,    26,    12,
-      13,    14,    15,    16,    17,    18,    19,    13,    14,    15,
-      16,    17,    18,    19,     3,     4,     5,     6,     7,    47,
-      48,    49,    50,    51,    52,    53,    15,    16,     4,     5,
-       6,     7,    69,    70,   305,   306,    71,    26,   309,    79,
-      68,    22,    69,    70,    69,    70,    74,    75,    76,    77,
-      78,    68,     3,    68,   325,   310,   311,    70,    47,    48,
-      49,    50,    51,    52,    53,    68,    27,    68,   339,    27,
-      27,    47,    48,    49,    50,    51,    52,    53,    27,    68,
-       3,    70,   353,    37,     3,    74,    75,    76,    77,    78,
-       3,     4,     5,     6,     7,    27,    28,    29,    30,    31,
-      32,    77,    15,    16,    17,     3,    68,    72,     3,    71,
-      72,     3,    22,    26,    76,     3,    63,    11,    12,    13,
-      14,    15,    16,    17,    18,    19,    27,    28,    29,    30,
-      31,    32,    71,     3,    47,    48,    49,    50,    51,    52,
-      53,    35,    70,     3,     3,     4,     5,     6,     7,    71,
-      71,    10,    69,     3,    55,    68,    15,    16,    33,    21,
-      18,    74,    75,    76,    77,    78,    21,    26,    12,    13,
-      14,    15,    16,    17,    18,    19,    70,    22,    79,    36,
-       3,    25,    23,     3,     4,     5,     6,     7,    47,    48,
-      49,    50,    51,    52,    53,    15,    16,    54,     5,    56,
-      57,    58,     3,    60,    61,    62,    26,    64,     3,    68,
-       3,    24,    73,    38,    70,    74,    75,    76,    77,    78,
-      69,     3,     3,     4,     5,     6,     7,    47,    48,    49,
-      50,    51,    52,    53,    15,    16,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    26,     3,     3,    68,     3,
-      65,    72,    71,    73,    74,    75,    76,    77,    78,    71,
-      35,     3,     4,     5,     6,     7,    47,    48,    49,    50,
-      51,    52,    53,    15,    16,    12,    13,    14,    15,    16,
-      17,    18,    19,    71,    26,     5,     3,    68,    25,    34,
-      22,    70,    68,    74,    75,    76,    77,    78,    14,    15,
-      16,    17,    18,    19,     9,    47,    48,    49,    50,    51,
-      52,    53,    12,    13,    14,    15,    16,    17,    18,    19,
-      68,    68,    21,    69,    39,    25,    68,     3,    69,    69,
-      27,    40,    74,    75,    76,    77,    78,    12,    13,    14,
-      15,    16,    17,    18,    19,    12,    13,    14,    15,    16,
-      17,    18,    19,    41,    68,    21,    66,    12,    13,    14,
-      15,    16,    17,    18,    19,     3,    68,     3,    22,    14,
-      68,    71,    27,    28,    29,    30,    31,    32,    12,    13,
-      14,    15,    16,    17,    18,    19,     3,    67,     3,     3,
-      23,    25,     3,    13,    50,    70,    54,   197,   309,   362,
-     315,   181,   173,    70,    12,    13,    14,    15,    16,    17,
-      18,    19,    -1,    -1,    -1,    -1,    -1,    25,    12,    13,
-      14,    15,    16,    17,    18,    19
+       1,     7,    51,   174,   154,   196,   156,   157,   158,   159,
+       3,   219,   220,   191,   142,    19,     3,   290,     3,    61,
+       3,     4,   268,     3,    18,    26,    27,    37,    38,     3,
+      71,     3,   321,    67,    75,    36,    37,    38,   229,     4,
+       5,     6,     7,    23,     8,     9,    56,     3,    58,    59,
+     339,    23,     3,    37,    38,    71,   264,   265,    70,    75,
+     333,    14,    15,   241,    14,    15,    78,    23,   116,     3,
+      71,   119,    56,   244,    58,    76,    70,   366,   324,    14,
+      15,   272,    22,   125,    49,    50,    51,    52,    53,    54,
+      55,    74,    22,    80,   302,    80,    70,    98,    99,   100,
+     101,   102,   103,   104,   105,   276,   107,   353,    72,    62,
+     111,     3,    62,    66,    79,    70,    66,   110,    73,   112,
+     328,   125,     3,    78,    37,    38,    22,    62,   177,    37,
+      38,    66,   260,   311,    22,    37,    38,    21,   346,    23,
+       3,   142,    23,    56,   145,    58,    59,    60,    56,    62,
+      63,    64,   360,    66,    56,     3,     4,    59,    37,    38,
+     331,     0,   155,     3,     4,     5,     6,     7,    27,    28,
+      29,    30,    31,    32,    33,    15,    16,    56,    21,    58,
+      59,    60,   332,    62,     3,    64,    26,    66,     4,   380,
+     381,    15,    16,    17,    18,    19,   197,   388,    57,     3,
+       3,   207,     4,     3,    23,     3,    46,    47,    48,    49,
+      50,    51,    52,    53,    54,    55,    21,    71,    23,   220,
+      23,    75,    81,    23,     4,    23,    17,    18,    19,     3,
+      70,     3,     4,     5,     6,     7,    76,    77,    78,    79,
+      80,    71,    72,    15,    16,    11,    12,    13,    14,    15,
+      16,    17,    18,    19,    26,     3,     4,     5,    70,   260,
+       4,    73,    74,    71,    72,   266,    78,   268,     8,     9,
+      36,     3,     4,     5,   280,   281,   282,    49,    50,    51,
+      52,    53,    54,    55,    71,    72,    71,    72,    12,    13,
+      14,    15,    16,    17,    18,    19,    71,    72,    70,     4,
+      72,    25,    71,    72,    76,    77,    78,    79,    80,    71,
+      72,     3,     3,     4,     5,     6,     7,    71,    72,   320,
+     321,    71,    72,   324,    15,    16,    17,    12,    13,    14,
+      15,    16,    17,    18,    19,    26,    71,    60,   339,    62,
+      25,    64,    22,    66,     3,     4,     5,     6,     7,    73,
+      71,    72,   353,    73,   325,   326,    15,    16,    49,    50,
+      51,    52,    53,    54,    55,   366,    81,    26,    12,    13,
+      14,    15,    16,    17,    18,    19,    70,     3,    27,    70,
+      22,    70,    70,    70,    27,    76,    77,    78,    79,    80,
+      49,    50,    51,    52,    53,    54,    55,    27,    27,    27,
+      39,     3,     3,     4,     5,     6,     7,     3,     3,     3,
+      74,    70,     3,    72,    15,    16,    17,    76,    77,    78,
+      79,    80,     3,    22,     3,    26,    73,    65,    72,     3,
+       3,    72,     3,    73,     3,     4,     5,     6,     7,    73,
+      71,    10,    18,     3,    34,    22,    15,    16,    49,    50,
+      51,    52,    53,    54,    55,    21,    21,    26,    12,    13,
+      14,    15,    16,    17,    18,    19,    23,     5,     3,    70,
+       3,     3,    72,    71,    24,    76,    77,    78,    79,    80,
+      49,    50,    51,    52,    53,    54,    55,    75,    40,     3,
+       3,     4,     5,     6,     7,    14,    15,    16,    17,    18,
+      19,    70,    15,    16,     3,     3,    67,    76,    77,    78,
+      79,    80,     5,    26,    73,    73,     3,    73,    72,    74,
+      35,    22,     3,     4,     5,     6,     7,    27,    28,    29,
+      30,    31,    32,    33,    15,    16,    49,    50,    51,    52,
+      53,    54,    55,    21,    72,    26,    12,    13,    14,    15,
+      16,    17,    18,    19,     9,    71,    41,    70,    70,    25,
+      70,    70,    75,    76,    77,    78,    79,    80,    49,    50,
+      51,    52,    53,    54,    55,    71,    71,    27,     3,     4,
+       5,     6,     7,     3,    70,    42,    21,    43,    68,    70,
+      15,    16,     3,    70,    22,    76,    77,    78,    79,    80,
+       3,    26,    70,     3,    70,    69,     3,    73,     3,    23,
+       3,    15,    78,    11,    12,    13,    14,    15,    16,    17,
+      18,    19,    14,    53,    49,    50,    51,    52,    53,    54,
+      55,    13,    14,    15,    16,    17,    18,    19,    36,    57,
+     210,   324,   375,   194,   305,    70,   186,    -1,    -1,    -1,
+      -1,    76,    77,    78,    79,    80,    12,    13,    14,    15,
+      16,    17,    18,    19,    12,    13,    14,    15,    16,    17,
+      18,    19,    -1,    -1,    72,    -1,    -1,    -1,    -1,    27,
+      28,    29,    30,    31,    32,    33,    12,    13,    14,    15,
+      16,    17,    18,    19,    -1,    -1,    -1,    -1,    -1,    25,
+      12,    13,    14,    15,    16,    17,    18,    19,    -1,    -1,
+      -1,    -1,    -1,    25,    -1,    -1,    72,    12,    13,    14,
+      15,    16,    17,    18,    19,    -1,    -1,    -1,    -1,    -1,
+      25,    12,    13,    14,    15,    16,    17,    18,    19
 };
 
   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
      symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    36,    54,    56,    57,    58,    60,    61,    62,    64,
-      81,    82,    83,    84,    85,    88,    89,   125,   126,     3,
-       4,     5,     6,     7,    15,    16,    26,    47,    48,    49,
-      50,    51,    52,    53,    68,    74,    75,    76,    77,    78,
-      90,   109,   110,   112,   120,   121,     3,   121,   122,    22,
-      22,     3,     3,    96,    22,    22,     3,     0,    21,    85,
-      88,    89,    84,    88,    89,   126,    68,    71,    76,   109,
-     109,    68,    76,     4,     4,     4,     4,     4,   109,   109,
-     109,     3,     3,     3,    27,    28,    29,    30,    31,    32,
-      91,    92,    12,    13,    14,    15,    16,    17,    18,    19,
-      25,    69,    71,    79,    55,    79,    92,     3,    23,    86,
-      87,    23,    86,    68,   133,    18,    68,   136,   125,     3,
-     127,   128,    22,    82,    88,    89,    88,    89,    70,   109,
-     111,     3,    78,    68,    17,   109,    68,    70,     3,     4,
-      72,    93,    94,    95,    96,    27,    68,    27,    27,    27,
-      37,    97,    98,   109,   109,   109,   109,   109,   109,   109,
-     109,     3,   109,   121,   109,   121,     3,     4,    23,    87,
-      23,     3,   134,    72,   135,     3,     3,   137,    22,    82,
-       3,    21,    23,    63,    69,    70,    71,     3,    70,   111,
-      70,    70,    17,   109,    71,    71,     3,    69,     3,    93,
-     121,    93,    93,    93,     3,    10,    68,   104,   105,   106,
-     107,   109,    33,   113,    25,    92,    21,    21,     3,     4,
-       5,    69,    70,   137,    22,    69,    70,     3,   131,   132,
-      23,     5,   128,   133,   109,     3,    70,    70,    70,     3,
-      96,     3,    73,    94,    69,    72,   104,   104,   109,     8,
-       9,    11,    35,    24,    38,   114,     3,     3,    73,   131,
-       3,     3,    23,   132,    65,    71,    71,    71,     5,    73,
-     111,    70,   104,   104,   109,    72,     3,    44,    45,    46,
-     109,   116,   117,   119,     3,   123,   124,    34,   102,   103,
-       3,     4,     5,    23,     3,   133,    22,    96,    96,    96,
-      70,    73,   108,   112,    71,    68,    68,    68,    25,    69,
-      69,    69,   104,    39,    99,   133,    21,   131,    27,    69,
-      73,     3,   118,   119,   118,    68,   115,     3,   116,   123,
-     123,   104,    40,   100,   135,    23,    93,   112,    71,    69,
-      70,    70,   118,    69,    70,   104,    41,   101,    21,    66,
-       3,   119,    70,    68,   104,    22,   118,     3,   129,   130,
-      70,    68,    21,    23,     3,   138,   130,    67,     3,    69,
-      70,   133,   133,     3,    23,     3,   133
+       0,    37,    38,    56,    58,    59,    60,    62,    63,    64,
+      66,    83,    84,    85,    86,    87,    90,    91,    92,   128,
+     129,     3,     4,     5,     6,     7,    15,    16,    26,    49,
+      50,    51,    52,    53,    54,    55,    70,    76,    77,    78,
+      79,    80,    93,   112,   113,   115,   123,   124,    67,     3,
+     124,   125,    22,    22,     3,     3,    99,    22,    22,     3,
+       0,    21,    87,    90,    91,    92,    86,    90,    91,    92,
+     129,    70,    73,    78,   112,   112,    70,    78,     4,     4,
+       4,     4,     4,   112,   112,   112,     3,     3,     3,    27,
+      28,    29,    30,    31,    32,    33,    94,    95,    12,    13,
+      14,    15,    16,    17,    18,    19,    25,    71,    22,    73,
+      81,    57,    81,    95,     3,    23,    88,    89,    23,    88,
+      70,   136,    18,    70,   139,   128,     3,   130,   131,    22,
+      84,    90,    91,    92,    90,    91,    92,    72,   112,   114,
+       3,    80,    70,    17,   112,    70,    72,     3,     4,    74,
+      96,    97,    98,    99,    27,    70,    27,    27,    27,    27,
+      39,   100,   101,   112,   112,   112,   112,   112,   112,   112,
+     112,     3,   112,     3,   134,   135,   124,   112,   124,     3,
+       4,    23,    89,    23,     3,   137,    74,   138,     3,     3,
+     140,    22,    84,     3,    21,    23,    65,    71,    72,    73,
+       3,    72,   114,    72,    72,    17,   112,    73,    73,     3,
+      71,     3,    96,   124,    96,    96,    96,    96,     3,    10,
+      70,   107,   108,   109,   110,   112,    34,   116,    25,     3,
+      23,   135,    95,    21,    21,     3,     4,     5,    71,    72,
+     140,    22,    71,    72,   134,    23,     5,   131,   136,   112,
+       3,    72,    72,    72,     3,    99,     3,    75,    97,    71,
+      74,   107,   107,   112,     8,     9,    11,    36,    24,    40,
+     117,     3,     3,   136,     3,    75,   134,     3,    23,    67,
+      73,    73,    73,     5,    75,   114,    72,   107,   107,   112,
+      74,     3,    46,    47,    48,   112,   119,   120,   122,     3,
+     126,   127,    35,   105,   106,   136,    21,     3,     4,     5,
+      23,    22,    99,    99,    99,    72,    75,   111,   115,    73,
+      70,    70,    70,    25,    71,    71,    71,   107,    41,   102,
+     138,   134,    27,    71,    75,     3,   121,   122,   121,    70,
+     118,     3,   119,   126,   126,   107,    42,   103,    21,    23,
+      96,   115,    73,    71,    72,    72,   121,    71,    72,   107,
+      43,   104,    68,     3,   122,    72,    70,   107,    22,   121,
+       3,   132,   133,    72,    70,    21,    23,     3,   141,   133,
+      69,     3,    71,    72,   136,   136,     3,    23,     3,   136
 };
 
   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    80,    81,    81,    81,    82,    82,    82,    82,    82,
-      82,    82,    82,    82,    82,    83,    83,    84,    84,    85,
-      85,    86,    86,    87,    87,    88,    89,    89,    90,    91,
-      92,    92,    92,    92,    92,    92,    93,    93,    94,    94,
-      95,    95,    95,    95,    95,    96,    96,    97,    97,    98,
-      99,    99,   100,   100,   101,   101,   102,   102,   103,   104,
-     104,   104,   104,   104,   105,   105,   105,   105,   106,   107,
-     108,   108,   109,   109,   109,   109,   109,   109,   109,   109,
-     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
-     109,   109,   109,   109,   109,   109,   109,   110,   110,   110,
-     110,   111,   111,   112,   112,   112,   112,   112,   112,   112,
-     112,   112,   112,   112,   112,   113,   113,   114,   114,   115,
-     115,   116,   116,   116,   116,   117,   117,   118,   118,   119,
-     119,   119,   119,   120,   120,   121,   121,   121,   122,   122,
-     123,   124,   124,   125,   125,   126,   126,   126,   126,   127,
-     127,   128,   129,   129,   130,   131,   131,   132,   132,   133,
-     133,   134,   134,   134,   134,   134,   134,   134,   134,   135,
-     135,   136,   136,   137,   137,   138,   138
+       0,    82,    83,    83,    83,    84,    84,    84,    84,    84,
+      84,    84,    84,    84,    84,    84,    84,    84,    84,    84,
+      85,    85,    86,    86,    87,    87,    88,    88,    89,    89,
+      90,    91,    91,    92,    93,    94,    95,    95,    95,    95,
+      95,    95,    95,    96,    96,    97,    97,    98,    98,    98,
+      98,    98,    99,    99,   100,   100,   101,   102,   102,   103,
+     103,   104,   104,   105,   105,   106,   107,   107,   107,   107,
+     107,   108,   108,   108,   108,   109,   110,   111,   111,   112,
+     112,   112,   112,   112,   112,   112,   112,   112,   112,   112,
+     112,   112,   112,   112,   112,   112,   112,   112,   112,   112,
+     112,   112,   112,   112,   113,   113,   113,   113,   114,   114,
+     115,   115,   115,   115,   115,   115,   115,   115,   115,   115,
+     115,   115,   116,   116,   117,   117,   118,   118,   119,   119,
+     119,   119,   120,   120,   121,   121,   122,   122,   122,   122,
+     123,   123,   124,   124,   124,   125,   125,   126,   127,   127,
+     128,   128,   129,   129,   129,   129,   130,   130,   131,   132,
+     132,   133,   134,   134,   135,   135,   136,   136,   137,   137,
+     137,   137,   137,   137,   137,   137,   138,   138,   139,   139,
+     140,   140,   141,   141
 };
 
   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
        0,     2,     1,     1,     5,     3,     3,     2,     2,     1,
-       3,     3,     2,     2,     1,     1,     3,     4,     3,     4,
-       3,     1,     2,     3,     3,     3,     3,     5,     1,     8,
-       2,     3,     3,     3,     3,     8,     1,     3,     1,     2,
-       1,     3,     5,     5,     5,     1,     3,     0,     1,     2,
-       0,     2,     0,     2,     0,     2,     0,     1,     2,     3,
-       3,     2,     3,     1,     1,     1,     3,     4,     3,     5,
-       1,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-       2,     2,     2,     2,     1,     2,     1,     1,     3,     4,
-       4,     4,     3,     5,     5,     5,     4,     1,     3,     3,
-       5,     1,     3,     1,     1,     1,     1,     1,     1,     2,
-       2,     2,     2,     2,     2,     0,     3,     0,     2,     3,
-       5,     1,     4,     4,     4,     1,     3,     1,     3,     1,
-       3,     5,     3,     2,     4,     1,     3,     5,     3,     3,
-       1,     3,     3,     1,     2,     7,     6,    16,     4,     1,
-       3,     3,     1,     3,     4,     1,     2,     6,     4,     0,
-       3,     1,     2,     2,     2,     3,     4,     4,     4,     0,
-       3,     0,     3,     1,     3,     3,     5
+       3,     3,     2,     2,     1,     3,     3,     2,     2,     1,
+       1,     3,     4,     3,     4,     3,     1,     2,     3,     3,
+       3,     3,     5,     5,     1,     8,     2,     3,     3,     3,
+       3,     3,     8,     1,     3,     1,     2,     1,     3,     5,
+       5,     5,     1,     3,     0,     1,     2,     0,     2,     0,
+       2,     0,     2,     0,     1,     2,     3,     3,     2,     3,
+       1,     1,     1,     3,     4,     3,     5,     1,     3,     3,
+       3,     3,     3,     3,     3,     3,     3,     2,     2,     2,
+       2,     1,     2,     1,     1,     3,     4,     4,     4,     3,
+       5,     5,     5,     4,     1,     3,     3,     5,     1,     3,
+       1,     1,     1,     1,     1,     1,     2,     2,     2,     2,
+       2,     2,     0,     3,     0,     2,     3,     5,     1,     4,
+       4,     4,     1,     3,     1,     3,     1,     3,     5,     3,
+       2,     4,     1,     3,     5,     3,     3,     1,     3,     3,
+       1,     2,     7,     6,    16,     4,     1,     3,     3,     1,
+       3,     4,     1,     2,     6,     4,     0,     3,     1,     2,
+       2,     2,     3,     4,     4,     4,     0,     3,     0,     3,
+       1,     3,     3,     5
 };
 
 
@@ -1671,1107 +1689,1165 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 204 "fta.y" /* yacc.c:1646  */
+#line 206 "fta.y" /* yacc.c:1646  */
     {
                fta_parse_result->parse_tree_list = (yyvsp[0].q_list);
                fta_parse_result->tables = NULL;
                fta_parse_result->parse_type = QUERY_PARSE;
        }
-#line 1681 "fta.tab.cc" /* yacc.c:1646  */
+#line 1699 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 3:
-#line 209 "fta.y" /* yacc.c:1646  */
+#line 211 "fta.y" /* yacc.c:1646  */
     {
                fta_parse_result->parse_tree_list = NULL;
                fta_parse_result->fta_parse_tree = NULL;
                fta_parse_result->tables = (yyvsp[0].table_list_schema);
                fta_parse_result->parse_type = TABLE_PARSE;
        }
-#line 1692 "fta.tab.cc" /* yacc.c:1646  */
+#line 1710 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 4:
-#line 216 "fta.y" /* yacc.c:1646  */
+#line 218 "fta.y" /* yacc.c:1646  */
     {
                fta_parse_result->parse_tree_list = NULL;
                fta_parse_result->fta_parse_tree = (yyvsp[-1].tblp);
                fta_parse_result->tables = (yyvsp[-2].table_list_schema);
                fta_parse_result->parse_type = STREAM_PARSE;
        }
-#line 1703 "fta.tab.cc" /* yacc.c:1646  */
+#line 1721 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 5:
-#line 230 "fta.y" /* yacc.c:1646  */
+#line 232 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-2].var_defs));                        // Memory leak : plug it.
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1713 "fta.tab.cc" /* yacc.c:1646  */
+#line 1731 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 6:
-#line 235 "fta.y" /* yacc.c:1646  */
+#line 237 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-2].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1723 "fta.tab.cc" /* yacc.c:1646  */
+#line 1741 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 7:
-#line 240 "fta.y" /* yacc.c:1646  */
+#line 242 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap(NULL);                        // Memory leak : plug it.
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1733 "fta.tab.cc" /* yacc.c:1646  */
+#line 1751 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 245 "fta.y" /* yacc.c:1646  */
+#line 247 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1742 "fta.tab.cc" /* yacc.c:1646  */
+#line 1760 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 249 "fta.y" /* yacc.c:1646  */
+#line 251 "fta.y" /* yacc.c:1646  */
     {
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1750 "fta.tab.cc" /* yacc.c:1646  */
+#line 1768 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 10:
-#line 252 "fta.y" /* yacc.c:1646  */
+#line 254 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-2].var_defs));                        // Memory leak : plug it.
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1760 "fta.tab.cc" /* yacc.c:1646  */
+#line 1778 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 11:
-#line 257 "fta.y" /* yacc.c:1646  */
+#line 259 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-2].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1770 "fta.tab.cc" /* yacc.c:1646  */
+#line 1788 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 262 "fta.y" /* yacc.c:1646  */
+#line 264 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1779 "fta.tab.cc" /* yacc.c:1646  */
+#line 1797 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 266 "fta.y" /* yacc.c:1646  */
+#line 268 "fta.y" /* yacc.c:1646  */
     {
                                (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1788 "fta.tab.cc" /* yacc.c:1646  */
+#line 1806 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 14:
-#line 270 "fta.y" /* yacc.c:1646  */
+#line 272 "fta.y" /* yacc.c:1646  */
     {
                                (yyval.tblp) = (yyvsp[0].tblp);
                        }
-#line 1796 "fta.tab.cc" /* yacc.c:1646  */
+#line 1814 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 15:
 #line 275 "fta.y" /* yacc.c:1646  */
-    {(yyval.q_list) = new query_list_t((yyvsp[0].tblp));}
-#line 1802 "fta.tab.cc" /* yacc.c:1646  */
+    {
+                               (yyvsp[0].tblp)->add_nmap((yyvsp[-2].var_defs));                        // Memory leak : plug it.
+                               (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
+                               (yyval.tblp) = (yyvsp[0].tblp);
+                       }
+#line 1824 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 276 "fta.y" /* yacc.c:1646  */
-    {(yyval.q_list) = (yyvsp[-2].q_list)->append((yyvsp[0].tblp));}
-#line 1808 "fta.tab.cc" /* yacc.c:1646  */
+#line 280 "fta.y" /* yacc.c:1646  */
+    {
+                               (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
+                               (yyvsp[0].tblp)->add_param_list((yyvsp[-2].var_defs));          // Memory leak : plug it.
+                               (yyval.tblp) = (yyvsp[0].tblp);
+                       }
+#line 1834 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 280 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs)=(yyvsp[-1].var_defs);}
-#line 1814 "fta.tab.cc" /* yacc.c:1646  */
+#line 285 "fta.y" /* yacc.c:1646  */
+    {
+                               (yyvsp[0].tblp)->add_param_list((yyvsp[-1].var_defs));          // Memory leak : plug it.
+                               (yyval.tblp) = (yyvsp[0].tblp);
+                       }
+#line 1843 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 281 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs)=NULL;}
-#line 1820 "fta.tab.cc" /* yacc.c:1646  */
+#line 289 "fta.y" /* yacc.c:1646  */
+    {
+                               (yyvsp[0].tblp)->add_nmap((yyvsp[-1].var_defs));                        // Memory leak : plug it.
+                               (yyval.tblp) = (yyvsp[0].tblp);
+                       }
+#line 1852 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 19:
-#line 285 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs)=(yyvsp[-1].var_defs);fta_parse_defines=(yyvsp[-1].var_defs);}
-#line 1826 "fta.tab.cc" /* yacc.c:1646  */
+#line 293 "fta.y" /* yacc.c:1646  */
+    {
+                               (yyval.tblp) = (yyvsp[0].tblp);
+                       }
+#line 1860 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 20:
-#line 286 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs)=NULL;fta_parse_defines = NULL;}
-#line 1832 "fta.tab.cc" /* yacc.c:1646  */
+#line 298 "fta.y" /* yacc.c:1646  */
+    {(yyval.q_list) = new query_list_t((yyvsp[0].tblp));}
+#line 1866 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 21:
-#line 290 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs) = new var_defs_t((yyvsp[0].var_pair));}
-#line 1838 "fta.tab.cc" /* yacc.c:1646  */
+#line 299 "fta.y" /* yacc.c:1646  */
+    {(yyval.q_list) = (yyvsp[-2].q_list)->append((yyvsp[0].tblp));}
+#line 1872 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 22:
-#line 291 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_defs) = (yyvsp[-1].var_defs)->add_var_pair((yyvsp[0].var_pair));}
-#line 1844 "fta.tab.cc" /* yacc.c:1646  */
+#line 303 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs)=(yyvsp[-1].var_defs);}
+#line 1878 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 23:
-#line 295 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_pair) = new var_pair_t((yyvsp[-2].strval),(yyvsp[-1].strval));}
-#line 1850 "fta.tab.cc" /* yacc.c:1646  */
+#line 304 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs)=NULL;}
+#line 1884 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 24:
-#line 296 "fta.y" /* yacc.c:1646  */
-    {(yyval.var_pair) = new var_pair_t((yyvsp[-2].strval),(yyvsp[-1].strval));}
-#line 1856 "fta.tab.cc" /* yacc.c:1646  */
+#line 308 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs)=(yyvsp[-1].var_defs);fta_parse_defines=(yyvsp[-1].var_defs);}
+#line 1890 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 300 "fta.y" /* yacc.c:1646  */
-    {(yyval.tblp) = (yyvsp[0].tblp)->add_selection((yyvsp[-1].select_listval));}
-#line 1862 "fta.tab.cc" /* yacc.c:1646  */
+#line 309 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs)=NULL;fta_parse_defines = NULL;}
+#line 1896 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 305 "fta.y" /* yacc.c:1646  */
-    {(yyval.tblp) = new table_exp_t((yyvsp[-1].clist),(yyvsp[0].tbl_list));}
-#line 1868 "fta.tab.cc" /* yacc.c:1646  */
+#line 313 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs) = new var_defs_t((yyvsp[0].var_pair));}
+#line 1902 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 307 "fta.y" /* yacc.c:1646  */
-    {(yyval.tblp) = new table_exp_t((yyvsp[-3].clist),(yyvsp[-1].scalarval),(yyvsp[0].tbl_list));}
-#line 1874 "fta.tab.cc" /* yacc.c:1646  */
+#line 314 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_defs) = (yyvsp[-1].var_defs)->add_var_pair((yyvsp[0].var_pair));}
+#line 1908 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 314 "fta.y" /* yacc.c:1646  */
-    { (yyval.select_listval) = (yyvsp[0].select_listval);}
-#line 1880 "fta.tab.cc" /* yacc.c:1646  */
+#line 318 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_pair) = new var_pair_t((yyvsp[-2].strval),(yyvsp[-1].strval));}
+#line 1914 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 326 "fta.y" /* yacc.c:1646  */
-    {(yyval.tblp)=new table_exp_t((yyvsp[-7].tbl_list),(yyvsp[-6].predp),(yyvsp[-5].extended_gb_list),(yyvsp[-4].clist),(yyvsp[-3].predp),(yyvsp[-2].predp),(yyvsp[-1].predp), (yyvsp[0].predp));}
-#line 1886 "fta.tab.cc" /* yacc.c:1646  */
+#line 319 "fta.y" /* yacc.c:1646  */
+    {(yyval.var_pair) = new var_pair_t((yyvsp[-2].strval),(yyvsp[-1].strval));}
+#line 1920 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 330 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(-1);}
-#line 1892 "fta.tab.cc" /* yacc.c:1646  */
+#line 323 "fta.y" /* yacc.c:1646  */
+    {(yyval.tblp) = (yyvsp[0].tblp)->add_selection((yyvsp[-1].select_listval));}
+#line 1926 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 31:
-#line 331 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(INNER_JOIN_PROPERTY);}
-#line 1898 "fta.tab.cc" /* yacc.c:1646  */
+#line 328 "fta.y" /* yacc.c:1646  */
+    {(yyval.tblp) = new table_exp_t((yyvsp[-1].clist),(yyvsp[0].tbl_list));}
+#line 1932 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 332 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(OUTER_JOIN_PROPERTY);}
-#line 1904 "fta.tab.cc" /* yacc.c:1646  */
+#line 330 "fta.y" /* yacc.c:1646  */
+    {(yyval.tblp) = new table_exp_t((yyvsp[-3].clist),(yyvsp[-1].scalarval),(yyvsp[0].tbl_list));}
+#line 1938 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 333 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(RIGHT_OUTER_JOIN_PROPERTY);}
-#line 1910 "fta.tab.cc" /* yacc.c:1646  */
+#line 335 "fta.y" /* yacc.c:1646  */
+    {(yyval.tblp) = table_exp_t::make_watchlist_tbl((yyvsp[-1].field_list_t)); }
+#line 1944 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 334 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(LEFT_OUTER_JOIN_PROPERTY);}
-#line 1916 "fta.tab.cc" /* yacc.c:1646  */
+#line 342 "fta.y" /* yacc.c:1646  */
+    { (yyval.select_listval) = (yyvsp[0].select_listval);}
+#line 1950 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 335 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(FILTER_JOIN_PROPERTY); (yyval.tbl_list)->set_colref((yyvsp[-5].colref)); (yyval.tbl_list)->set_temporal_range((yyvsp[-3].strval));}
-#line 1922 "fta.tab.cc" /* yacc.c:1646  */
+#line 354 "fta.y" /* yacc.c:1646  */
+    {(yyval.tblp)=new table_exp_t((yyvsp[-7].tbl_list),(yyvsp[-6].predp),(yyvsp[-5].extended_gb_list),(yyvsp[-4].clist),(yyvsp[-3].predp),(yyvsp[-2].predp),(yyvsp[-1].predp), (yyvsp[0].predp));}
+#line 1956 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 36:
-#line 339 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list) = new tablevar_list_t((yyvsp[0].table));}
-#line 1928 "fta.tab.cc" /* yacc.c:1646  */
+#line 358 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(-1);}
+#line 1962 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 340 "fta.y" /* yacc.c:1646  */
-    {(yyval.tbl_list)= (yyvsp[-2].tbl_list)->append_table((yyvsp[0].table));}
-#line 1934 "fta.tab.cc" /* yacc.c:1646  */
+#line 359 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(INNER_JOIN_PROPERTY);}
+#line 1968 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 344 "fta.y" /* yacc.c:1646  */
-    { (yyval.table) = (yyvsp[0].table);}
-#line 1940 "fta.tab.cc" /* yacc.c:1646  */
+#line 360 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(OUTER_JOIN_PROPERTY);}
+#line 1974 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 345 "fta.y" /* yacc.c:1646  */
-    { (yyval.table)= (yyvsp[-1].table)->set_range_var((yyvsp[0].strval));}
-#line 1946 "fta.tab.cc" /* yacc.c:1646  */
+#line 361 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(RIGHT_OUTER_JOIN_PROPERTY);}
+#line 1980 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 349 "fta.y" /* yacc.c:1646  */
-    {(yyval.table) = new tablevar_t((yyvsp[0].stringval)->c_str());}
-#line 1952 "fta.tab.cc" /* yacc.c:1646  */
+#line 362 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(LEFT_OUTER_JOIN_PROPERTY);}
+#line 1986 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 350 "fta.y" /* yacc.c:1646  */
-    {(yyval.table) = new tablevar_t((yyvsp[-2].strval),(yyvsp[0].stringval)->c_str(),0);}
-#line 1958 "fta.tab.cc" /* yacc.c:1646  */
+#line 363 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(WATCHLIST_JOIN_PROPERTY);}
+#line 1992 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 351 "fta.y" /* yacc.c:1646  */
-    {(yyval.table) = new tablevar_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].stringval)->c_str());}
-#line 1964 "fta.tab.cc" /* yacc.c:1646  */
+#line 364 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = (yyvsp[0].tbl_list); (yyval.tbl_list)->set_properties(FILTER_JOIN_PROPERTY); (yyval.tbl_list)->set_colref((yyvsp[-5].colref)); (yyval.tbl_list)->set_temporal_range((yyvsp[-3].strval));}
+#line 1998 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 352 "fta.y" /* yacc.c:1646  */
-    {(yyval.table) = new tablevar_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].stringval)->c_str());}
-#line 1970 "fta.tab.cc" /* yacc.c:1646  */
+#line 368 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list) = new tablevar_list_t((yyvsp[0].table));}
+#line 2004 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 353 "fta.y" /* yacc.c:1646  */
-    {(yyval.table) = new tablevar_t((yyvsp[-3].strval),(yyvsp[0].stringval)->c_str(),1);}
-#line 1976 "fta.tab.cc" /* yacc.c:1646  */
+#line 369 "fta.y" /* yacc.c:1646  */
+    {(yyval.tbl_list)= (yyvsp[-2].tbl_list)->append_table((yyvsp[0].table));}
+#line 2010 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 357 "fta.y" /* yacc.c:1646  */
-    {(yyval.stringval) = new string_t((yyvsp[0].strval));}
-#line 1982 "fta.tab.cc" /* yacc.c:1646  */
+#line 373 "fta.y" /* yacc.c:1646  */
+    { (yyval.table) = (yyvsp[0].table);}
+#line 2016 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 358 "fta.y" /* yacc.c:1646  */
-    {(yyval.stringval) = (yyval.stringval)->append("/",(yyvsp[0].strval));}
-#line 1988 "fta.tab.cc" /* yacc.c:1646  */
+#line 374 "fta.y" /* yacc.c:1646  */
+    { (yyval.table)= (yyvsp[-1].table)->set_range_var((yyvsp[0].strval));}
+#line 2022 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 363 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=NULL;}
-#line 1994 "fta.tab.cc" /* yacc.c:1646  */
+#line 378 "fta.y" /* yacc.c:1646  */
+    {(yyval.table) = new tablevar_t((yyvsp[0].stringval)->c_str());}
+#line 2028 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 364 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=(yyvsp[0].predp);}
-#line 2000 "fta.tab.cc" /* yacc.c:1646  */
+#line 379 "fta.y" /* yacc.c:1646  */
+    {(yyval.table) = new tablevar_t((yyvsp[-2].strval),(yyvsp[0].stringval)->c_str(),0);}
+#line 2034 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 368 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = (yyvsp[0].predp);}
-#line 2006 "fta.tab.cc" /* yacc.c:1646  */
+#line 380 "fta.y" /* yacc.c:1646  */
+    {(yyval.table) = new tablevar_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].stringval)->c_str());}
+#line 2040 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 50:
-#line 372 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=NULL;}
-#line 2012 "fta.tab.cc" /* yacc.c:1646  */
+#line 381 "fta.y" /* yacc.c:1646  */
+    {(yyval.table) = new tablevar_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].stringval)->c_str());}
+#line 2046 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 373 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=(yyvsp[0].predp); }
-#line 2018 "fta.tab.cc" /* yacc.c:1646  */
+#line 382 "fta.y" /* yacc.c:1646  */
+    {(yyval.table) = new tablevar_t((yyvsp[-3].strval),(yyvsp[0].stringval)->c_str(),1);}
+#line 2052 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 377 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=NULL;}
-#line 2024 "fta.tab.cc" /* yacc.c:1646  */
+#line 386 "fta.y" /* yacc.c:1646  */
+    {(yyval.stringval) = new string_t((yyvsp[0].strval));}
+#line 2058 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 378 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=(yyvsp[0].predp); }
-#line 2030 "fta.tab.cc" /* yacc.c:1646  */
+#line 387 "fta.y" /* yacc.c:1646  */
+    {(yyval.stringval) = (yyval.stringval)->append("/",(yyvsp[0].strval));}
+#line 2064 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 54:
-#line 382 "fta.y" /* yacc.c:1646  */
+#line 392 "fta.y" /* yacc.c:1646  */
     {(yyval.predp)=NULL;}
-#line 2036 "fta.tab.cc" /* yacc.c:1646  */
+#line 2070 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 383 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=(yyvsp[0].predp); }
-#line 2042 "fta.tab.cc" /* yacc.c:1646  */
+#line 393 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=(yyvsp[0].predp);}
+#line 2076 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 387 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=NULL;}
-#line 2048 "fta.tab.cc" /* yacc.c:1646  */
+#line 397 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = (yyvsp[0].predp);}
+#line 2082 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 388 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=(yyvsp[0].predp);}
-#line 2054 "fta.tab.cc" /* yacc.c:1646  */
+#line 401 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=NULL;}
+#line 2088 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 392 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = (yyvsp[0].predp);}
-#line 2060 "fta.tab.cc" /* yacc.c:1646  */
+#line 402 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=(yyvsp[0].predp); }
+#line 2094 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 59:
-#line 399 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=new predicate_t("OR",(yyvsp[-2].predp),(yyvsp[0].predp));}
-#line 2066 "fta.tab.cc" /* yacc.c:1646  */
+#line 406 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=NULL;}
+#line 2100 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 400 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp)=new predicate_t("AND",(yyvsp[-2].predp),(yyvsp[0].predp));}
-#line 2072 "fta.tab.cc" /* yacc.c:1646  */
+#line 407 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=(yyvsp[0].predp); }
+#line 2106 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 401 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = new predicate_t("NOT", (yyvsp[0].predp) );}
-#line 2078 "fta.tab.cc" /* yacc.c:1646  */
+#line 411 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=NULL;}
+#line 2112 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 402 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = (yyvsp[-1].predp);}
-#line 2084 "fta.tab.cc" /* yacc.c:1646  */
+#line 412 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=(yyvsp[0].predp); }
+#line 2118 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 403 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = (yyvsp[0].predp);}
-#line 2090 "fta.tab.cc" /* yacc.c:1646  */
+#line 416 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=NULL;}
+#line 2124 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 407 "fta.y" /* yacc.c:1646  */
-    { (yyval.predp)=(yyvsp[0].predp);}
-#line 2096 "fta.tab.cc" /* yacc.c:1646  */
+#line 417 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=(yyvsp[0].predp);}
+#line 2130 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 65:
-#line 408 "fta.y" /* yacc.c:1646  */
-    { (yyval.predp) = (yyvsp[0].predp);}
-#line 2102 "fta.tab.cc" /* yacc.c:1646  */
+#line 421 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = (yyvsp[0].predp);}
+#line 2136 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 409 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = predicate_t::make_paramless_fcn_predicate((yyvsp[-2].strval)); }
-#line 2108 "fta.tab.cc" /* yacc.c:1646  */
+#line 428 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=new predicate_t("OR",(yyvsp[-2].predp),(yyvsp[0].predp));}
+#line 2142 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 410 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = new predicate_t((yyvsp[-3].strval), (yyvsp[-1].se_listval)->get_se_list()); }
-#line 2114 "fta.tab.cc" /* yacc.c:1646  */
+#line 429 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp)=new predicate_t("AND",(yyvsp[-2].predp),(yyvsp[0].predp));}
+#line 2148 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 414 "fta.y" /* yacc.c:1646  */
-    {(yyval.predp) = new predicate_t((yyvsp[-2].scalarval),(yyvsp[-1].strval),(yyvsp[0].scalarval));}
-#line 2120 "fta.tab.cc" /* yacc.c:1646  */
+#line 430 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = new predicate_t("NOT", (yyvsp[0].predp) );}
+#line 2154 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 418 "fta.y" /* yacc.c:1646  */
-    { (yyval.predp) = new predicate_t((yyvsp[-4].scalarval),(yyvsp[-1].lit_l)); }
-#line 2126 "fta.tab.cc" /* yacc.c:1646  */
+#line 431 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = (yyvsp[-1].predp);}
+#line 2160 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 422 "fta.y" /* yacc.c:1646  */
-    {(yyval.lit_l) = new literal_list_t((yyvsp[0].litval));}
-#line 2132 "fta.tab.cc" /* yacc.c:1646  */
+#line 432 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = (yyvsp[0].predp);}
+#line 2166 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 423 "fta.y" /* yacc.c:1646  */
-    {(yyval.lit_l) = (yyvsp[-2].lit_l)->append_literal((yyvsp[0].litval));}
-#line 2138 "fta.tab.cc" /* yacc.c:1646  */
+#line 436 "fta.y" /* yacc.c:1646  */
+    { (yyval.predp)=(yyvsp[0].predp);}
+#line 2172 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 429 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("+",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2144 "fta.tab.cc" /* yacc.c:1646  */
+#line 437 "fta.y" /* yacc.c:1646  */
+    { (yyval.predp) = (yyvsp[0].predp);}
+#line 2178 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 430 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("-",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2150 "fta.tab.cc" /* yacc.c:1646  */
+#line 438 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = predicate_t::make_paramless_fcn_predicate((yyvsp[-2].strval)); }
+#line 2184 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 431 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("|",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2156 "fta.tab.cc" /* yacc.c:1646  */
+#line 439 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = new predicate_t((yyvsp[-3].strval), (yyvsp[-1].se_listval)->get_se_list()); }
+#line 2190 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 432 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("*",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2162 "fta.tab.cc" /* yacc.c:1646  */
+#line 443 "fta.y" /* yacc.c:1646  */
+    {(yyval.predp) = new predicate_t((yyvsp[-2].scalarval),(yyvsp[-1].strval),(yyvsp[0].scalarval));}
+#line 2196 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 433 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("/",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2168 "fta.tab.cc" /* yacc.c:1646  */
+#line 447 "fta.y" /* yacc.c:1646  */
+    { (yyval.predp) = new predicate_t((yyvsp[-4].scalarval),(yyvsp[-1].lit_l)); }
+#line 2202 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 434 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("&",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2174 "fta.tab.cc" /* yacc.c:1646  */
+#line 451 "fta.y" /* yacc.c:1646  */
+    {(yyval.lit_l) = new literal_list_t((yyvsp[0].litval));}
+#line 2208 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 435 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t("%",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2180 "fta.tab.cc" /* yacc.c:1646  */
+#line 452 "fta.y" /* yacc.c:1646  */
+    {(yyval.lit_l) = (yyvsp[-2].lit_l)->append_literal((yyvsp[0].litval));}
+#line 2214 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 436 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)=new scalarexp_t((yyvsp[-1].strval),(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
-#line 2186 "fta.tab.cc" /* yacc.c:1646  */
+#line 458 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("+",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2220 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 437 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = new scalarexp_t("+",(yyvsp[0].scalarval));}
-#line 2192 "fta.tab.cc" /* yacc.c:1646  */
+#line 459 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("-",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2226 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 438 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = new scalarexp_t("-",(yyvsp[0].scalarval));}
-#line 2198 "fta.tab.cc" /* yacc.c:1646  */
+#line 460 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("|",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2232 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 439 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = new scalarexp_t("!",(yyvsp[0].scalarval));}
-#line 2204 "fta.tab.cc" /* yacc.c:1646  */
+#line 461 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("*",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2238 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 440 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = new scalarexp_t("~",(yyvsp[0].scalarval));}
-#line 2210 "fta.tab.cc" /* yacc.c:1646  */
+#line 462 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("/",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2244 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 441 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval)= new scalarexp_t((yyvsp[0].litval));}
-#line 2216 "fta.tab.cc" /* yacc.c:1646  */
+#line 463 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("&",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2250 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 442 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = scalarexp_t::make_param_reference((yyvsp[0].strval));}
-#line 2222 "fta.tab.cc" /* yacc.c:1646  */
+#line 464 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t("%",(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2256 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 443 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = scalarexp_t::make_iface_param_reference((yyvsp[0].ifpref));}
-#line 2228 "fta.tab.cc" /* yacc.c:1646  */
+#line 465 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)=new scalarexp_t((yyvsp[-1].strval),(yyvsp[-2].scalarval),(yyvsp[0].scalarval));}
+#line 2262 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 444 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = new scalarexp_t((yyvsp[0].colref));}
-#line 2234 "fta.tab.cc" /* yacc.c:1646  */
+#line 466 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = new scalarexp_t("+",(yyvsp[0].scalarval));}
+#line 2268 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 445 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = (yyvsp[-1].scalarval);}
-#line 2240 "fta.tab.cc" /* yacc.c:1646  */
+#line 467 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = new scalarexp_t("-",(yyvsp[0].scalarval));}
+#line 2274 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 446 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = scalarexp_t::make_star_aggr((yyvsp[-3].strval)); }
-#line 2246 "fta.tab.cc" /* yacc.c:1646  */
+#line 468 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = new scalarexp_t("!",(yyvsp[0].scalarval));}
+#line 2280 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 447 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = scalarexp_t::make_se_aggr((yyvsp[-3].strval),(yyvsp[-1].scalarval)); }
-#line 2252 "fta.tab.cc" /* yacc.c:1646  */
+#line 469 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = new scalarexp_t("~",(yyvsp[0].scalarval));}
+#line 2286 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 448 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = new scalarexp_t((yyvsp[-3].strval), (yyvsp[-1].se_listval)->get_se_list()); }
-#line 2258 "fta.tab.cc" /* yacc.c:1646  */
+#line 470 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval)= new scalarexp_t((yyvsp[0].litval));}
+#line 2292 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 449 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = scalarexp_t::make_paramless_fcn((yyvsp[-2].strval)); }
-#line 2264 "fta.tab.cc" /* yacc.c:1646  */
+#line 471 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = scalarexp_t::make_param_reference((yyvsp[0].strval));}
+#line 2298 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 450 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = scalarexp_t::make_star_aggr((yyvsp[-4].strval)); (yyval.scalarval)->set_superaggr(true); }
-#line 2270 "fta.tab.cc" /* yacc.c:1646  */
+#line 472 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = scalarexp_t::make_iface_param_reference((yyvsp[0].ifpref));}
+#line 2304 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 451 "fta.y" /* yacc.c:1646  */
-    { (yyval.scalarval) = scalarexp_t::make_se_aggr((yyvsp[-4].strval),(yyvsp[-1].scalarval)); (yyval.scalarval)->set_superaggr(true); }
-#line 2276 "fta.tab.cc" /* yacc.c:1646  */
+#line 473 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = new scalarexp_t((yyvsp[0].colref));}
+#line 2310 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 452 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = new scalarexp_t((yyvsp[-4].strval), (yyvsp[-1].se_listval)->get_se_list()); (yyval.scalarval)->set_superaggr(true); }
-#line 2282 "fta.tab.cc" /* yacc.c:1646  */
+#line 474 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = (yyvsp[-1].scalarval);}
+#line 2316 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 453 "fta.y" /* yacc.c:1646  */
-    {(yyval.scalarval) = scalarexp_t::make_paramless_fcn((yyvsp[-3].strval)); (yyval.scalarval)->set_superaggr(true); }
-#line 2288 "fta.tab.cc" /* yacc.c:1646  */
+#line 475 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = scalarexp_t::make_star_aggr((yyvsp[-3].strval)); }
+#line 2322 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 458 "fta.y" /* yacc.c:1646  */
-    {  (yyval.select_listval)= new select_list_t((yyvsp[0].scalarval)); }
-#line 2294 "fta.tab.cc" /* yacc.c:1646  */
+#line 476 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = scalarexp_t::make_se_aggr((yyvsp[-3].strval),(yyvsp[-1].scalarval)); }
+#line 2328 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 98:
-#line 459 "fta.y" /* yacc.c:1646  */
-    {  (yyval.select_listval)= new select_list_t((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
-#line 2300 "fta.tab.cc" /* yacc.c:1646  */
+#line 477 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = new scalarexp_t((yyvsp[-3].strval), (yyvsp[-1].se_listval)->get_se_list()); }
+#line 2334 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 99:
-#line 460 "fta.y" /* yacc.c:1646  */
-    { (yyval.select_listval)=(yyvsp[-2].select_listval)->append((yyvsp[0].scalarval)); }
-#line 2306 "fta.tab.cc" /* yacc.c:1646  */
+#line 478 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = scalarexp_t::make_paramless_fcn((yyvsp[-2].strval)); }
+#line 2340 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 100:
-#line 461 "fta.y" /* yacc.c:1646  */
-    { (yyval.select_listval)=(yyvsp[-4].select_listval)->append((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
-#line 2312 "fta.tab.cc" /* yacc.c:1646  */
+#line 479 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = scalarexp_t::make_star_aggr((yyvsp[-4].strval)); (yyval.scalarval)->set_superaggr(true); }
+#line 2346 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 101:
-#line 465 "fta.y" /* yacc.c:1646  */
-    {  (yyval.se_listval)= new se_list_t((yyvsp[0].scalarval)); }
-#line 2318 "fta.tab.cc" /* yacc.c:1646  */
+#line 480 "fta.y" /* yacc.c:1646  */
+    { (yyval.scalarval) = scalarexp_t::make_se_aggr((yyvsp[-4].strval),(yyvsp[-1].scalarval)); (yyval.scalarval)->set_superaggr(true); }
+#line 2352 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 102:
-#line 466 "fta.y" /* yacc.c:1646  */
-    { (yyval.se_listval)=(yyvsp[-2].se_listval)->append((yyvsp[0].scalarval)); }
-#line 2324 "fta.tab.cc" /* yacc.c:1646  */
+#line 481 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = new scalarexp_t((yyvsp[-4].strval), (yyvsp[-1].se_listval)->get_se_list()); (yyval.scalarval)->set_superaggr(true); }
+#line 2358 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 103:
-#line 470 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_STRING);}
-#line 2330 "fta.tab.cc" /* yacc.c:1646  */
+#line 482 "fta.y" /* yacc.c:1646  */
+    {(yyval.scalarval) = scalarexp_t::make_paramless_fcn((yyvsp[-3].strval)); (yyval.scalarval)->set_superaggr(true); }
+#line 2364 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 104:
-#line 471 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_INT);}
-#line 2336 "fta.tab.cc" /* yacc.c:1646  */
+#line 487 "fta.y" /* yacc.c:1646  */
+    {  (yyval.select_listval)= new select_list_t((yyvsp[0].scalarval)); }
+#line 2370 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 105:
-#line 472 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_LONGINT);}
-#line 2342 "fta.tab.cc" /* yacc.c:1646  */
+#line 488 "fta.y" /* yacc.c:1646  */
+    {  (yyval.select_listval)= new select_list_t((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
+#line 2376 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 106:
-#line 473 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_FLOAT);}
-#line 2348 "fta.tab.cc" /* yacc.c:1646  */
+#line 489 "fta.y" /* yacc.c:1646  */
+    { (yyval.select_listval)=(yyvsp[-2].select_listval)->append((yyvsp[0].scalarval)); }
+#line 2382 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 107:
-#line 474 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t("TRUE",LITERAL_BOOL);}
-#line 2354 "fta.tab.cc" /* yacc.c:1646  */
+#line 490 "fta.y" /* yacc.c:1646  */
+    { (yyval.select_listval)=(yyvsp[-4].select_listval)->append((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
+#line 2388 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 108:
-#line 475 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t("FALSE",LITERAL_BOOL);}
-#line 2360 "fta.tab.cc" /* yacc.c:1646  */
+#line 494 "fta.y" /* yacc.c:1646  */
+    {  (yyval.se_listval)= new se_list_t((yyvsp[0].scalarval)); }
+#line 2394 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 109:
-#line 476 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_TIMEVAL);}
-#line 2366 "fta.tab.cc" /* yacc.c:1646  */
+#line 495 "fta.y" /* yacc.c:1646  */
+    { (yyval.se_listval)=(yyvsp[-2].se_listval)->append((yyvsp[0].scalarval)); }
+#line 2400 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 110:
-#line 477 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_HEX);}
-#line 2372 "fta.tab.cc" /* yacc.c:1646  */
+#line 499 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_STRING);}
+#line 2406 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 111:
-#line 478 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_LONGHEX);}
-#line 2378 "fta.tab.cc" /* yacc.c:1646  */
+#line 500 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_INT);}
+#line 2412 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 112:
-#line 479 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_IP);}
-#line 2384 "fta.tab.cc" /* yacc.c:1646  */
+#line 501 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_LONGINT);}
+#line 2418 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 113:
-#line 480 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_IPV6);}
-#line 2390 "fta.tab.cc" /* yacc.c:1646  */
+#line 502 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_FLOAT);}
+#line 2424 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 114:
-#line 481 "fta.y" /* yacc.c:1646  */
-    {(yyval.litval) = literal_t::make_define_literal((yyvsp[0].strval),fta_parse_defines);}
-#line 2396 "fta.tab.cc" /* yacc.c:1646  */
+#line 503 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t("TRUE",LITERAL_BOOL);}
+#line 2430 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 115:
-#line 487 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb_list) = NULL;}
-#line 2402 "fta.tab.cc" /* yacc.c:1646  */
+#line 504 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t("FALSE",LITERAL_BOOL);}
+#line 2436 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 116:
-#line 488 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb_list) = (yyvsp[0].extended_gb_list);}
-#line 2408 "fta.tab.cc" /* yacc.c:1646  */
+#line 505 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_TIMEVAL);}
+#line 2442 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 117:
-#line 492 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist) = NULL;}
-#line 2414 "fta.tab.cc" /* yacc.c:1646  */
+#line 506 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_HEX);}
+#line 2448 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 118:
-#line 493 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist) = (yyvsp[0].clist);}
-#line 2420 "fta.tab.cc" /* yacc.c:1646  */
+#line 507 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_LONGHEX);}
+#line 2454 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 119:
-#line 497 "fta.y" /* yacc.c:1646  */
-    { (yyval.list_of_gb_list) = new list_of_gb_list_t((yyvsp[-1].gb_list));}
-#line 2426 "fta.tab.cc" /* yacc.c:1646  */
+#line 508 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_IP);}
+#line 2460 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 120:
-#line 498 "fta.y" /* yacc.c:1646  */
-    {(yyval.list_of_gb_list) = (yyvsp[-4].list_of_gb_list)->append((yyvsp[-1].gb_list));}
-#line 2432 "fta.tab.cc" /* yacc.c:1646  */
+#line 509 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = new literal_t((yyvsp[0].strval),LITERAL_IPV6);}
+#line 2466 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 121:
-#line 502 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb) = extended_gb_t::create_from_gb((yyvsp[0].gb_val));}
-#line 2438 "fta.tab.cc" /* yacc.c:1646  */
+#line 510 "fta.y" /* yacc.c:1646  */
+    {(yyval.litval) = literal_t::make_define_literal((yyvsp[0].strval),fta_parse_defines);}
+#line 2472 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 122:
-#line 503 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb) = extended_gb_t::extended_create_from_rollup((yyvsp[-1].gb_list));}
-#line 2444 "fta.tab.cc" /* yacc.c:1646  */
+#line 516 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb_list) = NULL;}
+#line 2478 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 123:
-#line 504 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb) = extended_gb_t::extended_create_from_cube((yyvsp[-1].gb_list));}
-#line 2450 "fta.tab.cc" /* yacc.c:1646  */
+#line 517 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb_list) = (yyvsp[0].extended_gb_list);}
+#line 2484 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 124:
-#line 505 "fta.y" /* yacc.c:1646  */
-    {(yyval.extended_gb) = extended_gb_t::extended_create_from_gsets((yyvsp[-1].list_of_gb_list));}
-#line 2456 "fta.tab.cc" /* yacc.c:1646  */
+#line 521 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist) = NULL;}
+#line 2490 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 125:
-#line 509 "fta.y" /* yacc.c:1646  */
-    { (yyval.extended_gb_list) = new extended_gb_list_t((yyvsp[0].extended_gb));}
-#line 2462 "fta.tab.cc" /* yacc.c:1646  */
+#line 522 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist) = (yyvsp[0].clist);}
+#line 2496 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 126:
-#line 510 "fta.y" /* yacc.c:1646  */
-    { (yyval.extended_gb_list)=(yyvsp[-2].extended_gb_list)->append((yyvsp[0].extended_gb));}
-#line 2468 "fta.tab.cc" /* yacc.c:1646  */
+#line 526 "fta.y" /* yacc.c:1646  */
+    { (yyval.list_of_gb_list) = new list_of_gb_list_t((yyvsp[-1].gb_list));}
+#line 2502 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 127:
-#line 514 "fta.y" /* yacc.c:1646  */
-    { (yyval.gb_list) = new gb_list_t((yyvsp[0].gb_val));}
-#line 2474 "fta.tab.cc" /* yacc.c:1646  */
+#line 527 "fta.y" /* yacc.c:1646  */
+    {(yyval.list_of_gb_list) = (yyvsp[-4].list_of_gb_list)->append((yyvsp[-1].gb_list));}
+#line 2508 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 128:
-#line 515 "fta.y" /* yacc.c:1646  */
-    { (yyval.gb_list)=(yyvsp[-2].gb_list)->append((yyvsp[0].gb_val));}
-#line 2480 "fta.tab.cc" /* yacc.c:1646  */
+#line 531 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb) = extended_gb_t::create_from_gb((yyvsp[0].gb_val));}
+#line 2514 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 129:
-#line 519 "fta.y" /* yacc.c:1646  */
-    {(yyval.gb_val) = new gb_t((yyvsp[0].strval)); }
-#line 2486 "fta.tab.cc" /* yacc.c:1646  */
+#line 532 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb) = extended_gb_t::extended_create_from_rollup((yyvsp[-1].gb_list));}
+#line 2520 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 130:
-#line 520 "fta.y" /* yacc.c:1646  */
-    {(yyval.gb_val) = new gb_t((yyvsp[-2].strval),(yyvsp[0].strval)); }
-#line 2492 "fta.tab.cc" /* yacc.c:1646  */
+#line 533 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb) = extended_gb_t::extended_create_from_cube((yyvsp[-1].gb_list));}
+#line 2526 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 131:
-#line 521 "fta.y" /* yacc.c:1646  */
-    {(yyval.gb_val) = new gb_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].strval)); }
-#line 2498 "fta.tab.cc" /* yacc.c:1646  */
+#line 534 "fta.y" /* yacc.c:1646  */
+    {(yyval.extended_gb) = extended_gb_t::extended_create_from_gsets((yyvsp[-1].list_of_gb_list));}
+#line 2532 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 132:
-#line 522 "fta.y" /* yacc.c:1646  */
-    {(yyval.gb_val) = new gb_t((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
-#line 2504 "fta.tab.cc" /* yacc.c:1646  */
+#line 538 "fta.y" /* yacc.c:1646  */
+    { (yyval.extended_gb_list) = new extended_gb_list_t((yyvsp[0].extended_gb));}
+#line 2538 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 133:
-#line 533 "fta.y" /* yacc.c:1646  */
-    {(yyval.ifpref) = new ifpref_t((yyvsp[0].strval));}
-#line 2510 "fta.tab.cc" /* yacc.c:1646  */
+#line 539 "fta.y" /* yacc.c:1646  */
+    { (yyval.extended_gb_list)=(yyvsp[-2].extended_gb_list)->append((yyvsp[0].extended_gb));}
+#line 2544 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 134:
-#line 534 "fta.y" /* yacc.c:1646  */
-    {(yyval.ifpref) = new ifpref_t((yyvsp[-3].strval), (yyvsp[0].strval));}
-#line 2516 "fta.tab.cc" /* yacc.c:1646  */
+#line 543 "fta.y" /* yacc.c:1646  */
+    { (yyval.gb_list) = new gb_list_t((yyvsp[0].gb_val));}
+#line 2550 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 135:
-#line 538 "fta.y" /* yacc.c:1646  */
-    {(yyval.colref) = new colref_t((yyvsp[0].strval)); }
-#line 2522 "fta.tab.cc" /* yacc.c:1646  */
+#line 544 "fta.y" /* yacc.c:1646  */
+    { (yyval.gb_list)=(yyvsp[-2].gb_list)->append((yyvsp[0].gb_val));}
+#line 2556 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 136:
-#line 539 "fta.y" /* yacc.c:1646  */
-    {(yyval.colref) = new colref_t((yyvsp[-2].strval),(yyvsp[0].strval)); }
-#line 2528 "fta.tab.cc" /* yacc.c:1646  */
+#line 548 "fta.y" /* yacc.c:1646  */
+    {(yyval.gb_val) = new gb_t((yyvsp[0].strval)); }
+#line 2562 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 137:
-#line 540 "fta.y" /* yacc.c:1646  */
-    {(yyval.colref) = new colref_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].strval)); }
-#line 2534 "fta.tab.cc" /* yacc.c:1646  */
+#line 549 "fta.y" /* yacc.c:1646  */
+    {(yyval.gb_val) = new gb_t((yyvsp[-2].strval),(yyvsp[0].strval)); }
+#line 2568 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 138:
-#line 544 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist)=new colref_list_t((yyvsp[-2].colref)); (yyval.clist)->append((yyvsp[0].colref));}
-#line 2540 "fta.tab.cc" /* yacc.c:1646  */
+#line 550 "fta.y" /* yacc.c:1646  */
+    {(yyval.gb_val) = new gb_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].strval)); }
+#line 2574 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 139:
-#line 545 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist) = (yyvsp[-2].clist)->append((yyvsp[0].colref));}
-#line 2546 "fta.tab.cc" /* yacc.c:1646  */
+#line 551 "fta.y" /* yacc.c:1646  */
+    {(yyval.gb_val) = new gb_t((yyvsp[-2].scalarval),(yyvsp[0].strval)); }
+#line 2580 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 140:
-#line 549 "fta.y" /* yacc.c:1646  */
-    {(yyval.colref) = new colref_t((yyvsp[0].strval)); }
-#line 2552 "fta.tab.cc" /* yacc.c:1646  */
+#line 562 "fta.y" /* yacc.c:1646  */
+    {(yyval.ifpref) = new ifpref_t((yyvsp[0].strval));}
+#line 2586 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 141:
-#line 553 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist)=new colref_list_t((yyvsp[-2].colref)); (yyval.clist)->append((yyvsp[0].colref));}
-#line 2558 "fta.tab.cc" /* yacc.c:1646  */
+#line 563 "fta.y" /* yacc.c:1646  */
+    {(yyval.ifpref) = new ifpref_t((yyvsp[-3].strval), (yyvsp[0].strval));}
+#line 2592 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 142:
-#line 554 "fta.y" /* yacc.c:1646  */
-    {(yyval.clist) = (yyvsp[-2].clist)->append((yyvsp[0].colref));}
-#line 2564 "fta.tab.cc" /* yacc.c:1646  */
+#line 567 "fta.y" /* yacc.c:1646  */
+    {(yyval.colref) = new colref_t((yyvsp[0].strval)); }
+#line 2598 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 143:
-#line 569 "fta.y" /* yacc.c:1646  */
-    {(yyval.table_list_schema) = new table_list((yyvsp[0].table_def_t));}
-#line 2570 "fta.tab.cc" /* yacc.c:1646  */
+#line 568 "fta.y" /* yacc.c:1646  */
+    {(yyval.colref) = new colref_t((yyvsp[-2].strval),(yyvsp[0].strval)); }
+#line 2604 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 144:
-#line 570 "fta.y" /* yacc.c:1646  */
-    {(yyval.table_list_schema) = (yyvsp[-1].table_list_schema)->append_table((yyvsp[0].table_def_t));}
-#line 2576 "fta.tab.cc" /* yacc.c:1646  */
+#line 569 "fta.y" /* yacc.c:1646  */
+    {(yyval.colref) = new colref_t((yyvsp[-4].strval),(yyvsp[-2].strval),(yyvsp[0].strval)); }
+#line 2610 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
   case 145:
 #line 573 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist)=new colref_list_t((yyvsp[-2].colref)); (yyval.clist)->append((yyvsp[0].colref));}
+#line 2616 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 146:
+#line 574 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist) = (yyvsp[-2].clist)->append((yyvsp[0].colref));}
+#line 2622 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 147:
+#line 578 "fta.y" /* yacc.c:1646  */
+    {(yyval.colref) = new colref_t((yyvsp[0].strval)); }
+#line 2628 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 148:
+#line 582 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist)=new colref_list_t((yyvsp[-2].colref)); (yyval.clist)->append((yyvsp[0].colref));}
+#line 2634 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 149:
+#line 583 "fta.y" /* yacc.c:1646  */
+    {(yyval.clist) = (yyvsp[-2].clist)->append((yyvsp[0].colref));}
+#line 2640 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 150:
+#line 598 "fta.y" /* yacc.c:1646  */
+    {(yyval.table_list_schema) = new table_list((yyvsp[0].table_def_t));}
+#line 2646 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 151:
+#line 599 "fta.y" /* yacc.c:1646  */
+    {(yyval.table_list_schema) = (yyvsp[-1].table_list_schema)->append_table((yyvsp[0].table_def_t));}
+#line 2652 "fta.tab.cc" /* yacc.c:1646  */
+    break;
+
+  case 152:
+#line 602 "fta.y" /* yacc.c:1646  */
     {
                                        (yyval.table_def_t)=new table_def((yyvsp[-5].strval),(yyvsp[-4].plist_t),(yyvsp[-3].plist_t), (yyvsp[-1].field_list_t), PROTOCOL_SCHEMA); delete (yyvsp[-4].plist_t); delete (yyvsp[-1].field_list_t);}
-#line 2583 "fta.tab.cc" /* yacc.c:1646  */
+#line 2659 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 146:
-#line 575 "fta.y" /* yacc.c:1646  */
+  case 153:
+#line 604 "fta.y" /* yacc.c:1646  */
     {
                                        (yyval.table_def_t)=new table_def((yyvsp[-4].stringval)->c_str(),(yyvsp[-3].plist_t),NULL,(yyvsp[-1].field_list_t), STREAM_SCHEMA); delete (yyvsp[-1].field_list_t);}
-#line 2590 "fta.tab.cc" /* yacc.c:1646  */
+#line 2666 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 147:
-#line 577 "fta.y" /* yacc.c:1646  */
+  case 154:
+#line 606 "fta.y" /* yacc.c:1646  */
     {
                                (yyval.table_def_t) = new table_def((yyvsp[-14].strval), (yyvsp[-11].plist_t), (yyvsp[-8].field_list_t), (yyvsp[-4].subqueryspec_list_t), (yyvsp[-1].plist_t)); }
-#line 2597 "fta.tab.cc" /* yacc.c:1646  */
+#line 2673 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 148:
-#line 579 "fta.y" /* yacc.c:1646  */
+  case 155:
+#line 608 "fta.y" /* yacc.c:1646  */
     { (yyval.table_def_t) = new table_def((yyvsp[-1].ufcnl)); }
-#line 2603 "fta.tab.cc" /* yacc.c:1646  */
+#line 2679 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 149:
-#line 583 "fta.y" /* yacc.c:1646  */
+  case 156:
+#line 612 "fta.y" /* yacc.c:1646  */
     {(yyval.ufcnl) = new unpack_fcn_list((yyvsp[0].ufcn));}
-#line 2609 "fta.tab.cc" /* yacc.c:1646  */
+#line 2685 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 150:
-#line 584 "fta.y" /* yacc.c:1646  */
+  case 157:
+#line 613 "fta.y" /* yacc.c:1646  */
     {(yyval.ufcnl) = (yyvsp[-2].ufcnl) -> append((yyvsp[0].ufcn));}
-#line 2615 "fta.tab.cc" /* yacc.c:1646  */
+#line 2691 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 151:
-#line 588 "fta.y" /* yacc.c:1646  */
+  case 158:
+#line 617 "fta.y" /* yacc.c:1646  */
     {(yyval.ufcn) = new unpack_fcn((yyvsp[-2].strval),(yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2621 "fta.tab.cc" /* yacc.c:1646  */
+#line 2697 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 152:
-#line 592 "fta.y" /* yacc.c:1646  */
+  case 159:
+#line 621 "fta.y" /* yacc.c:1646  */
     {(yyval.subqueryspec_list_t) = new subqueryspec_list((yyvsp[0].subq_spec_t));}
-#line 2627 "fta.tab.cc" /* yacc.c:1646  */
+#line 2703 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 153:
-#line 593 "fta.y" /* yacc.c:1646  */
+  case 160:
+#line 622 "fta.y" /* yacc.c:1646  */
     {(yyval.subqueryspec_list_t) = (yyvsp[-2].subqueryspec_list_t)->append((yyvsp[0].subq_spec_t));}
-#line 2633 "fta.tab.cc" /* yacc.c:1646  */
+#line 2709 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 154:
-#line 597 "fta.y" /* yacc.c:1646  */
+  case 161:
+#line 626 "fta.y" /* yacc.c:1646  */
     {(yyval.subq_spec_t)=new subquery_spec((yyvsp[-3].strval), (yyvsp[-1].namevec_t)); delete (yyvsp[-1].namevec_t);}
-#line 2639 "fta.tab.cc" /* yacc.c:1646  */
+#line 2715 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 155:
-#line 600 "fta.y" /* yacc.c:1646  */
+  case 162:
+#line 629 "fta.y" /* yacc.c:1646  */
     {(yyval.field_list_t) = new field_entry_list((yyvsp[0].field_t));}
-#line 2645 "fta.tab.cc" /* yacc.c:1646  */
+#line 2721 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 156:
-#line 601 "fta.y" /* yacc.c:1646  */
+  case 163:
+#line 630 "fta.y" /* yacc.c:1646  */
     {(yyval.field_list_t) = (yyvsp[-1].field_list_t)->append_field((yyvsp[0].field_t));}
-#line 2651 "fta.tab.cc" /* yacc.c:1646  */
+#line 2727 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 157:
-#line 605 "fta.y" /* yacc.c:1646  */
+  case 164:
+#line 634 "fta.y" /* yacc.c:1646  */
     {(yyval.field_t) = new field_entry((yyvsp[-5].strval),(yyvsp[-4].strval),(yyvsp[-3].strval),(yyvsp[-2].plist_t),(yyvsp[-1].plist_t));}
-#line 2657 "fta.tab.cc" /* yacc.c:1646  */
+#line 2733 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 158:
-#line 606 "fta.y" /* yacc.c:1646  */
+  case 165:
+#line 635 "fta.y" /* yacc.c:1646  */
     {(yyval.field_t) = new field_entry((yyvsp[-3].strval),(yyvsp[-2].strval),"",(yyvsp[-1].plist_t),NULL);}
-#line 2663 "fta.tab.cc" /* yacc.c:1646  */
+#line 2739 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 159:
-#line 610 "fta.y" /* yacc.c:1646  */
+  case 166:
+#line 639 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = NULL;}
-#line 2669 "fta.tab.cc" /* yacc.c:1646  */
+#line 2745 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 160:
-#line 611 "fta.y" /* yacc.c:1646  */
+  case 167:
+#line 640 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-1].plist_t);}
-#line 2675 "fta.tab.cc" /* yacc.c:1646  */
+#line 2751 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 161:
-#line 615 "fta.y" /* yacc.c:1646  */
+  case 168:
+#line 644 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = new param_list((yyvsp[0].strval));}
-#line 2681 "fta.tab.cc" /* yacc.c:1646  */
+#line 2757 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 162:
-#line 616 "fta.y" /* yacc.c:1646  */
+  case 169:
+#line 645 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = new param_list((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2687 "fta.tab.cc" /* yacc.c:1646  */
+#line 2763 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 163:
-#line 617 "fta.y" /* yacc.c:1646  */
+  case 170:
+#line 646 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = new param_list((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2693 "fta.tab.cc" /* yacc.c:1646  */
+#line 2769 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 164:
-#line 618 "fta.y" /* yacc.c:1646  */
+  case 171:
+#line 647 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = new param_list((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2699 "fta.tab.cc" /* yacc.c:1646  */
+#line 2775 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 165:
-#line 619 "fta.y" /* yacc.c:1646  */
+  case 172:
+#line 648 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-2].plist_t)->append((yyvsp[0].strval));}
-#line 2705 "fta.tab.cc" /* yacc.c:1646  */
+#line 2781 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 166:
-#line 620 "fta.y" /* yacc.c:1646  */
+  case 173:
+#line 649 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-3].plist_t)->append((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2711 "fta.tab.cc" /* yacc.c:1646  */
+#line 2787 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 167:
-#line 621 "fta.y" /* yacc.c:1646  */
+  case 174:
+#line 650 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-3].plist_t)->append((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2717 "fta.tab.cc" /* yacc.c:1646  */
+#line 2793 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 168:
-#line 622 "fta.y" /* yacc.c:1646  */
+  case 175:
+#line 651 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-3].plist_t)->append((yyvsp[-1].strval),(yyvsp[0].strval));}
-#line 2723 "fta.tab.cc" /* yacc.c:1646  */
+#line 2799 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 169:
-#line 626 "fta.y" /* yacc.c:1646  */
+  case 176:
+#line 655 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = NULL;}
-#line 2729 "fta.tab.cc" /* yacc.c:1646  */
+#line 2805 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 170:
-#line 627 "fta.y" /* yacc.c:1646  */
+  case 177:
+#line 656 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-1].plist_t);}
-#line 2735 "fta.tab.cc" /* yacc.c:1646  */
+#line 2811 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 171:
-#line 631 "fta.y" /* yacc.c:1646  */
+  case 178:
+#line 660 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = NULL;}
-#line 2741 "fta.tab.cc" /* yacc.c:1646  */
+#line 2817 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 172:
-#line 632 "fta.y" /* yacc.c:1646  */
+  case 179:
+#line 661 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-1].plist_t);}
-#line 2747 "fta.tab.cc" /* yacc.c:1646  */
+#line 2823 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 173:
-#line 636 "fta.y" /* yacc.c:1646  */
+  case 180:
+#line 665 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = new param_list((yyvsp[0].strval));}
-#line 2753 "fta.tab.cc" /* yacc.c:1646  */
+#line 2829 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 174:
-#line 637 "fta.y" /* yacc.c:1646  */
+  case 181:
+#line 666 "fta.y" /* yacc.c:1646  */
     {(yyval.plist_t) = (yyvsp[-2].plist_t)->append((yyvsp[0].strval));}
-#line 2759 "fta.tab.cc" /* yacc.c:1646  */
+#line 2835 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 175:
-#line 641 "fta.y" /* yacc.c:1646  */
+  case 182:
+#line 670 "fta.y" /* yacc.c:1646  */
     {(yyval.namevec_t) = new name_vec((yyvsp[-2].strval),(yyvsp[-1].strval),(yyvsp[0].plist_t));}
-#line 2765 "fta.tab.cc" /* yacc.c:1646  */
+#line 2841 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
-  case 176:
-#line 642 "fta.y" /* yacc.c:1646  */
+  case 183:
+#line 671 "fta.y" /* yacc.c:1646  */
     {(yyval.namevec_t) = (yyvsp[-4].namevec_t)->append((yyvsp[-2].strval),(yyvsp[-1].strval), (yyvsp[0].plist_t));}
-#line 2771 "fta.tab.cc" /* yacc.c:1646  */
+#line 2847 "fta.tab.cc" /* yacc.c:1646  */
     break;
 
 
-#line 2775 "fta.tab.cc" /* yacc.c:1646  */
+#line 2851 "fta.tab.cc" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -2999,6 +3075,6 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 645 "fta.y" /* yacc.c:1906  */
+#line 674 "fta.y" /* yacc.c:1906  */
 
 
index 038a211..61e12d6 100644 (file)
@@ -68,41 +68,43 @@ extern int FtaParserdebug;
     OUTER_JOIN = 278,
     LEFT_OUTER_JOIN = 279,
     RIGHT_OUTER_JOIN = 280,
-    GROUP = 281,
-    HAVING = 282,
-    IN = 283,
-    SELECT = 284,
-    WHERE = 285,
-    SUPERGROUP = 286,
-    CLEANING_WHEN = 287,
-    CLEANING_BY = 288,
-    CLOSING_WHEN = 289,
-    SUCH = 290,
-    THAT = 291,
-    CUBE = 292,
-    ROLLUP = 293,
-    GROUPING_SETS = 294,
-    TRUE_V = 295,
-    FALSE_V = 296,
-    TIMEVAL_L = 297,
-    HEX_L = 298,
-    LHEX_L = 299,
-    IP_L = 300,
-    IPV6_L = 301,
-    MERGE = 302,
-    SLACK = 303,
-    DEFINE_SEC = 304,
-    PARAM_SEC = 305,
-    PROTOCOL = 306,
-    TABLE = 307,
-    STREAM = 308,
-    FTA = 309,
-    UNPACK_FCNS = 310,
-    OPERATOR = 311,
-    OPERATOR_VIEW = 312,
-    FIELDS = 313,
-    SUBQUERIES = 314,
-    SELECTION_PUSHDOWN = 315
+    WATCHLIST_JOIN = 281,
+    GROUP = 282,
+    HAVING = 283,
+    IN = 284,
+    SELECT = 285,
+    WATCHLIST = 286,
+    WHERE = 287,
+    SUPERGROUP = 288,
+    CLEANING_WHEN = 289,
+    CLEANING_BY = 290,
+    CLOSING_WHEN = 291,
+    SUCH = 292,
+    THAT = 293,
+    CUBE = 294,
+    ROLLUP = 295,
+    GROUPING_SETS = 296,
+    TRUE_V = 297,
+    FALSE_V = 298,
+    TIMEVAL_L = 299,
+    HEX_L = 300,
+    LHEX_L = 301,
+    IP_L = 302,
+    IPV6_L = 303,
+    MERGE = 304,
+    SLACK = 305,
+    DEFINE_SEC = 306,
+    PARAM_SEC = 307,
+    PROTOCOL = 308,
+    TABLE = 309,
+    STREAM = 310,
+    FTA = 311,
+    UNPACK_FCNS = 312,
+    OPERATOR = 313,
+    OPERATOR_VIEW = 314,
+    FIELDS = 315,
+    SUBQUERIES = 316,
+    SELECTION_PUSHDOWN = 317
   };
 #endif
 
@@ -156,7 +158,7 @@ union YYSTYPE
        unpack_fcn_list *ufcnl;
 
 
-#line 160 "fta.tab.cc.h" /* yacc.c:1909  */
+#line 162 "fta.tab.cc.h" /* yacc.c:1909  */
 };
 
 typedef union YYSTYPE YYSTYPE;
index 18d8685..ce4d54a 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------
-Copyright 2014 AT&T Intellectual Property
+Copyright 2020 AT&T Intellectual Property
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
@@ -105,6 +105,7 @@ extern var_defs_t *fta_parse_defines;
 %type <tblp> gsql
 %type <tblp> select_statement
 %type <tblp> merge_statement
+%type <tblp> watchlist_statement
 %type <predp> opt_where_clause
 %type <predp> opt_having_clause
 %type <select_listval> selection
@@ -181,8 +182,9 @@ extern var_defs_t *fta_parse_defines;
 %token BY AS
 %token <strval> AGGR
 %token FROM INNER_JOIN FILTER_JOIN OUTER_JOIN LEFT_OUTER_JOIN RIGHT_OUTER_JOIN
+%token WATCHLIST_JOIN
 %token GROUP HAVING IN
-%token SELECT
+%token SELECT WATCHLIST
 %token WHERE SUPERGROUP CLEANING_WHEN CLEANING_BY CLOSING_WHEN
 %token SUCH THAT
 %token CUBE ROLLUP GROUPING_SETS
@@ -270,6 +272,27 @@ gsql:              variable_def params_def select_statement {
                |       merge_statement{
                                $$ = $1;
                        }
+               |       variable_def params_def watchlist_statement{
+                               $3->add_nmap($1);                       // Memory leak : plug it.
+                               $3->add_param_list($2);         // Memory leak : plug it.
+                               $$ = $3;
+                       }
+               |       params_def variable_def watchlist_statement{
+                               $3->add_nmap($2);                       // Memory leak : plug it.
+                               $3->add_param_list($1);         // Memory leak : plug it.
+                               $$ = $3;
+                       }
+               |       params_def watchlist_statement{
+                               $2->add_param_list($1);         // Memory leak : plug it.
+                               $$ = $2;
+                       }
+               |       variable_def watchlist_statement{
+                               $2->add_nmap($1);                       // Memory leak : plug it.
+                               $$ = $2;
+                       }
+               |       watchlist_statement{
+                               $$ = $1;
+                       }
        ;
 
 query_list:    gsql    {$$ = new query_list_t($1);}
@@ -307,6 +330,11 @@ merge_statement:
                from_clause             {$$ = new table_exp_t($2,$4,$5);}
        ;
 
+watchlist_statement:
+               WATCHLIST
+               FIELDS LEFTBRACE field_list RIGHTBRACE {$$ = table_exp_t::make_watchlist_tbl($4); }
+       ; 
+
        /* query expressions */
 
 
@@ -332,6 +360,7 @@ from_clause:
        |       OUTER_JOIN FROM table_ref_commalist     {$$ = $3; $$->set_properties(OUTER_JOIN_PROPERTY);}
        |       RIGHT_OUTER_JOIN FROM table_ref_commalist       {$$ = $3; $$->set_properties(RIGHT_OUTER_JOIN_PROPERTY);}
        |       LEFT_OUTER_JOIN FROM table_ref_commalist        {$$ = $3; $$->set_properties(LEFT_OUTER_JOIN_PROPERTY);}
+       |       WATCHLIST_JOIN FROM table_ref_commalist {$$ = $3; $$->set_properties(WATCHLIST_JOIN_PROPERTY);}
        |       FILTER_JOIN '(' column_ref ',' INTNUM ')' FROM table_ref_commalist      {$$ = $8; $$->set_properties(FILTER_JOIN_PROPERTY); $$->set_colref($3); $$->set_temporal_range($5);}
        ;
 
index 0b40c39..2882ba5 100644 (file)
@@ -1,8 +1,13 @@
+#line 2 "ftalexer.cc"
+
+#line 4 "ftalexer.cc"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
 #define yy_create_buffer FtaParser_create_buffer
 #define yy_delete_buffer FtaParser_delete_buffer
-#define yy_scan_buffer FtaParser_scan_buffer
-#define yy_scan_string FtaParser_scan_string
-#define yy_scan_bytes FtaParser_scan_bytes
 #define yy_flex_debug FtaParser_flex_debug
 #define yy_init_buffer FtaParser_init_buffer
 #define yy_flush_buffer FtaParser_flush_buffer
 #define yyin FtaParserin
 #define yyleng FtaParserleng
 #define yylex FtaParserlex
+#define yylineno FtaParserlineno
 #define yyout FtaParserout
 #define yyrestart FtaParserrestart
 #define yytext FtaParsertext
-
-#line 19 "ftalexer.cc"
-/* A lexical scanner generated by flex*/
-
-/* Scanner skeleton version:
- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
- */
+#define yywrap FtaParserwrap
+#define yyalloc FtaParseralloc
+#define yyrealloc FtaParserrealloc
+#define yyfree FtaParserfree
 
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
+#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 <unistd.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
-#endif
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
 #endif
 
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
 
-#ifdef __cplusplus
+/* 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
 
-#include <stdlib.h>
+#endif /* ! C99 */
 
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
 
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
-#define YY_USE_PROTOS
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__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
 
  * 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 FtaParserrestart(FtaParserin  )
 
 #define YY_END_OF_BUFFER_CHAR 0
 
 /* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
 #define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
 
-extern int yyleng;
-extern FILE *yyin, *yyout;
+extern yy_size_t FtaParserleng;
+
+extern FILE *FtaParserin, *FtaParserout;
 
 #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. */
-
+    #define YY_LESS_LINENO(n)
+    #define YY_LINENO_REWIND_TO(ptr)
+    
+/* 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; \
+               /* Undo effects of setting up FtaParsertext. */ \
+        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_DO_BEFORE_ACTION; /* set up yytext again */ \
+               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+               YY_DO_BEFORE_ACTION; /* set up FtaParsertext again */ \
                } \
        while ( 0 )
 
-#define unput(c) yyunput( c, yytext_ptr )
-
-/* Some routines like yy_flex_realloc() are emitted as static but are
-   not called by all lexers. This generates warnings in some compilers,
-   notably GCC. Arrange to suppress these. */
-#ifdef __GNUC__
-#define YY_MAY_BE_UNUSED __attribute__((unused))
-#else
-#define YY_MAY_BE_UNUSED
-#endif
-
-/* 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;
-
+#define unput(c) yyunput( c, (yytext_ptr)  )
 
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
        {
        FILE *yy_input_file;
@@ -204,12 +251,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
@@ -219,179 +270,226 @@ struct yy_buffer_state
         * possible backing-up.
         *
         * When we actually see the EOF, we change the status to "new"
-        * (via yyrestart()), so that the user can continue scanning by
-        * just pointing yyin at a new input file.
+        * (via FtaParserrestart()), so that the user can continue scanning by
+        * just pointing FtaParserin 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. */
+/* yy_hold_char holds the character lost when FtaParsertext is formed. */
 static char yy_hold_char;
-
 static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
+yy_size_t FtaParserleng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1;                /* whether we need to initialize */
+static int yy_init = 0;                /* whether we need to initialize */
 static int yy_start = 0;       /* start state number */
 
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin.  A bit of a hack ...
+/* Flag which is used to allow FtaParserwrap()'s to do buffer switches
+ * instead of setting up a fresh FtaParserin.  A bit of a hack ...
  */
 static int yy_did_buffer_switch_on_eof;
 
-void yyrestart YY_PROTO(( FILE *input_file ));
+void FtaParserrestart (FILE *input_file  );
+void FtaParser_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE FtaParser_create_buffer (FILE *file,int size  );
+void FtaParser_delete_buffer (YY_BUFFER_STATE b  );
+void FtaParser_flush_buffer (YY_BUFFER_STATE b  );
+void FtaParserpush_buffer_state (YY_BUFFER_STATE new_buffer  );
+void FtaParserpop_buffer_state (void );
+
+static void FtaParserensure_buffer_stack (void );
+static void FtaParser_load_buffer_state (void );
+static void FtaParser_init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
-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 )
+#define YY_FLUSH_BUFFER FtaParser_flush_buffer(YY_CURRENT_BUFFER )
 
-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 ));
+YY_BUFFER_STATE FtaParser_scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE FtaParser_scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE FtaParser_scan_bytes (yyconst char *bytes,yy_size_t len  );
 
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
-static void yy_flex_free YY_PROTO(( void * ));
+void *FtaParseralloc (yy_size_t  );
+void *FtaParserrealloc (void *,yy_size_t  );
+void FtaParserfree (void *  );
 
-#define yy_new_buffer yy_create_buffer
+#define yy_new_buffer FtaParser_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 ){ \
+        FtaParserensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            FtaParser_create_buffer(FtaParserin,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 ){\
+        FtaParserensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            FtaParser_create_buffer(FtaParserin,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 */
 
-#define yywrap() 1
+#define FtaParserwrap() (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
+
 typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+FILE *FtaParserin = (FILE *) 0, *FtaParserout = (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[] ));
+extern int FtaParserlineno;
+
+int FtaParserlineno = 1;
+
+extern char *FtaParsertext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
+#define yytext_ptr FtaParsertext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
+static int yy_get_next_buffer (void );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
+static void yy_fatal_error (yyconst char msg[]  );
 
 /* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
+ * corresponding action - sets up FtaParsertext.
  */
 #define YY_DO_BEFORE_ACTION \
-       yytext_ptr = yy_bp; \
-       yytext_ptr -= yy_more_len; \
-       yyleng = (int) (yy_cp - yytext_ptr); \
-       yy_hold_char = *yy_cp; \
+       (yytext_ptr) = yy_bp; \
+       (yytext_ptr) -= (yy_more_len); \
+       FtaParserleng = (size_t) (yy_cp - (yytext_ptr)); \
+       (yy_hold_char) = *yy_cp; \
        *yy_cp = '\0'; \
-       yy_c_buf_p = yy_cp;
+       (yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 85
-#define YY_END_OF_BUFFER 86
-static yyconst short int yy_accept[655] =
+#define YY_NUM_RULES 87
+#define YY_END_OF_BUFFER 88
+/* 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_accept[692] =
     {   0,
-        0,    0,   86,   84,   81,   80,   66,   84,   67,   66,
-       66,   70,   57,   62,   60,   63,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   45,   46,   68,   81,   80,    0,   79,   78,
-        0,   74,    0,    0,   73,   70,    0,    0,   58,   64,
-       61,   65,   59,   69,   69,   26,   69,   69,   69,   10,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   27,   69,
-
-       27,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   29,   69,   29,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   27,   69,
-       69,   69,   69,   69,   29,   69,   69,   69,   69,   69,
-       69,   69,   69,    0,   82,    0,   77,    0,   83,   73,
-        0,    0,   75,   71,    1,    5,    1,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       50,   69,   69,   69,   69,   69,   39,   69,   69,   69,
-
-       69,   69,   69,   69,   69,   69,    7,   69,    6,   69,
-       28,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,    8,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,    1,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,    0,   76,   72,   69,   69,   69,
-       69,   69,   19,   69,   69,   69,   69,   69,   69,   69,
-       11,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   40,   69,   69,   69,   69,   69,   69,   69,
-
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   32,   69,   69,   69,   69,   33,   69,   36,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,    9,   69,   69,   69,
-       37,   69,   69,   69,   17,   17,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   34,   69,   69,   69,   69,
-       69,   44,   69,   69,   69,   69,   69,   69,   35,   69,
-       69,   69,   69,   69,   47,   69,   69,   31,   69,   69,
-       69,   69,   69,   69,   17,   69,   69,   69,   69,   69,
-
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   43,   54,   69,   69,   69,   69,   25,   69,   69,
-       41,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   18,   69,   30,   49,   69,   69,   30,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,    3,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   38,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,    2,   69,
-
-       69,   69,   69,   69,   69,   69,   69,   69,   42,   69,
-       69,   69,   52,   69,   69,   48,   69,   69,   69,   69,
-       69,   69,   69,    4,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   12,   69,   69,   69,   13,   69,
-       69,   69,   55,   21,   69,   69,   69,   69,   69,   69,
-       69,   69,   23,   69,   69,   69,   69,   16,   69,   69,
-
-       69,   69,   69,   69,   69,   69,   51,   69,   69,   69,
-       69,   69,   69,   24,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   69,   69,   69,   22,   20,   69,
-       69,   53,   69,   69,   69,   69,   69,   69,   69,   69,
-       69,   69,   69,   69,   15,   69,   69,   69,   69,   14,
-       69,   69,   56,    0
+        0,    0,   88,   86,   83,   82,   68,   86,   69,   68,
+       68,   72,   59,   64,   62,   65,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   47,   48,   70,   83,   82,    0,   81,   80,
+        0,   76,    0,    0,   75,   72,    0,    0,   60,   66,
+       63,   67,   61,   71,   71,   27,   71,   71,   71,   10,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   28,   71,
+
+       28,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   30,   71,   30,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       28,   71,   71,   71,   71,   71,   30,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,    0,   84,    0,   79,
+        0,   85,   75,    0,    0,   77,   73,    1,    5,    1,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   52,   71,   71,   71,   71,   71,   41,
+
+       71,   71,   71,   71,   71,   71,   71,   71,   71,    7,
+       71,    6,   71,   29,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+        8,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,    1,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+        0,   78,   74,   71,   71,   71,   71,   71,   20,   71,
+       71,   71,   71,   71,   71,   71,   11,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   42,   71,
+
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   33,   71,   71,
+       71,   71,   34,   71,   38,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,    9,   71,   71,   71,   39,
+       71,   71,   71,   18,   18,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   35,   71,   71,   71,   71,   71,
+       46,   71,   71,   71,   71,   71,   71,   36,   71,   71,
+       71,   71,   71,   49,   71,   71,   71,   32,   71,   71,
+
+       71,   71,   71,   71,   71,   18,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   45,   56,   71,   71,   71,   71,   26,
+       71,   71,   43,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   19,   71,   31,   51,   71,   71,
+       31,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,    3,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   40,   71,
+
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,    2,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   44,   71,   71,   71,
+       54,   71,   71,   50,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,    4,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   37,   37,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   37,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   12,   71,
+
+       71,   71,   13,   71,   71,   71,   57,   22,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   24,
+       71,   71,   71,   71,   17,   71,   71,   71,   71,   71,
+       71,   71,   71,   53,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   25,   71,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
+       23,   21,   71,   71,   55,   71,   71,   71,   71,   71,
+       71,   71,   71,   71,   71,   71,   71,   71,   16,   71,
+       71,   15,   71,   71,   71,   71,   14,   71,   71,   58,
+        0
+
     } ;
 
-static yyconst int yy_ec[256] =
+static yyconst YY_CHAR yy_ec[256] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
@@ -423,7 +521,7 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst int yy_meta[69] =
+static yyconst YY_CHAR yy_meta[69] =
     {   0,
         1,    1,    2,    1,    1,    1,    1,    1,    1,    3,
         3,    1,    1,    1,    1,    3,    3,    3,    3,    3,
@@ -434,159 +532,169 @@ static yyconst int yy_meta[69] =
         3,    3,    3,    3,    3,    1,    1,    1
     } ;
 
-static yyconst short int yy_base[660] =
+static yyconst flex_uint16_t yy_base[697] =
     {   0,
-        0,    0,  777,  778,  774,    0,  778,   66,  768,   62,
-      765,   66,  778,   65,  778,   69,   56,   30,   61,  753,
+        0,    0,  816,  817,  813,    0,  817,   66,  807,   62,
+      804,   66,  817,   65,  817,   69,   56,   30,   61,  792,
         0,   65,   54,   76,   70,   83,  104,   75,   96,   88,
-      109,  114,  119,  743,   87,  106,  104,  706,   92,  113,
-      712,  726,  713,  720,  125,  710,  109,  122,   47,  715,
-      714,  707,  778,  778,  778,  760,    0,  135,  778,  778,
-      758,  169,  175,  757,  173,  186,  181,  732,  778,  778,
-      778,  778,  778,    0,  739,    0,  735,  710,  706,    0,
-      126,  718,  736,  143,  691,  707,  729,  722,  175,  718,
-      731,  693,  689,  714,  687,  705,  702,  678,  710,  161,
-
-      683,  716,  716,  687,  695,  700,  703,  667,  672,  674,
-      693,  667,  706,  683,  689,  681,  662,  688,  690,  697,
-      691,  668,  663,  688,  698,  680,  183,  659,  164,  694,
-      694,  681,  672,  664,  675,  685,  657,  670,  644,  655,
-      651,  157,  638,  654,  644,  640,  639,  632,  638,  644,
-      627,  632,  634,  628,  645,  626,  636,  631,  630,  170,
-      639,  634,  622,  676,  778,  197,  215,  675,  778,  218,
-      224,  226,  229,  650,  634,    0,  633,  658,  639,  643,
-      651,  627,  610,  613,  620,  642,  631,  637,  628,  634,
-        0,  601,  606,  623,  597,  633,    0,  605,  635,  643,
-
-      616,  641,  604,  615,  610,  588,    0,  625,    0,  597,
-        0,  612,  628,  623,  626,  594,  624,  604,  615,  610,
-      586,  582,  614,  615,  612,  599,  607,    0,  609,  581,
-      577,  579,  598,  589,  603,  602,  561,  604,  586,  560,
-      575,  574,  573,  571,  554,  557,  564,  550,  555,  547,
-      556,  559,  545,  555,  560,  555,  551,  547,  552,  548,
-      550,  536,  537,  552,  231,  233,  778,  577,  576,  562,
-      566,  554,    0,  533,  536,  526,  556,  564,  564,  562,
-        0,  534,  549,  522,  549,  522,  543,  533,  558,  531,
-      514,  529,    0,  528,  549,  521,  551,  544,  532,  515,
-
-      505,  534,  531,  525,  523,  498,  496,  538,  529,  538,
-      517,    0,  519,  506,  492,  529,    0,  511,    0,  529,
-      526,  498,  528,  527,  499,  486,  489,  479,  491,  480,
-      481,  477,  492,  486,  483,  473,  470,  468,  483,  469,
-      479,  482,  502,  474,  498,  492,    0,  469,  464,  498,
-        0,  483,  483,  457,  490,  462,  490,  462,  468,  472,
-      481,  470,  464,  475,  474,    0,  468,  480,  459,  451,
-      457,    0,  480,  455,  465,  453,  437,  458,    0,  464,
-      471,  468,  429,  439,    0,  471,  460,    0,  463,  435,
-      434,  431,  426,  422,  428,  429,  435,  420,  426,  432,
-
-      431,  415,  411,  421,  420,  446,  418,  437,  443,  409,
-      414,    0,    0,  420,  419,  431,  404,    0,  433,  441,
-        0,  440,  430,  418,  392,  422,  418,  425,  391,  423,
-      417,  416,    0,  415,  420,    0,  410,  409,    0,  383,
-      413,  397,  416,  388,  387,  380,  385,  391,  377,  379,
-      369,  371,  376,  371,  368,  376,  391,  365,  400,  379,
-      371,  377,  393,  392,  394,  366,  384,  386,  385,  355,
-      375,  349,  375,    0,  377,  350,  378,  368,  342,  372,
-      377,  370,  343,    0,  377,  364,  338,  337,  345,  351,
-      340,  342,  334,  329,  332,  326,  330,  327,    0,  342,
-
-      345,  340,  343,  350,  323,  336,  335,  352,    0,  324,
-      354,  326,  330,  347,  319,    0,  334,  308,  338,  346,
-      329,  303,  345,    0,  320,  298,  304,  317,  307,  310,
-      305,  295,  293,  215,  330,  228,  302,  327,  299,  315,
-      314,  318,  291,  312,  286,  306,  313,  286,  320,  292,
-      296,  303,  305,  278,  305,   63,  283,  281,  272,  275,
-      271,  273,  280,  269,  285,  301,  303,  257,  271,  273,
-      290,  263,  297,  269,    0,  273,  272,  289,    0,  279,
-      253,  279,    0,    0,  275,  243,  257,  259,  250,  257,
-      261,  244,    0,  281,  271,  252,  243,    0,  262,  236,
-
-      270,  269,  273,  250,  249,  254,    0,  242,  233,  227,
-      234,  243,  255,    0,  228,  248,  222,  250,  223,   37,
-      119,  133,  140,  122,  146,  154,  160,    0,    0,  193,
-      168,    0,  216,  191,  225,  198,  194,  222,  197,  230,
-      204,  237,  202,  207,    0,  230,  205,  231,  207,    0,
-      225,  235,    0,  778,  266,  269,  265,  272,  275
+      109,  114,  119,  782,  121,   80,  104,  745,   92,  116,
+      751,  765,  752,  759,  125,  749,  112,  126,   47,  754,
+      135,  747,  817,  817,  817,  800,    0,  135,  817,  817,
+      798,  169,  177,  797,  180,  184,  191,  772,  817,  817,
+      817,  817,  817,    0,  779,    0,  775,  750,  746,    0,
+      126,  758,  776,  149,  731,  747,  769,  762,  166,  758,
+      771,  733,  729,  754,  727,  745,  742,  718,  750,  166,
+
+      723,  756,  756,  727,  735,  740,  743,  707,  712,  714,
+      733,  707,  746,  723,  729,  721,  702,  728,  730,  737,
+      731,  708,  703,  728,  738,  720,  193,  699,  161,  734,
+      734,  721,  712,  704,  715,  710,  724,  683,  695,  708,
+      682,  693,  689,  166,  676,  692,  682,  678,  677,  670,
+      676,  682,  665,  670,  672,  666,  683,  664,  674,  669,
+      668,  169,  677,  659,  671,  659,  713,  817,  219,  222,
+      712,  817,  224,  230,  228,  232,  687,  671,    0,  670,
+      695,  676,  680,  688,  664,  647,  650,  657,  679,  668,
+      674,  665,  671,    0,  638,  643,  660,  634,  670,    0,
+
+      642,  672,  680,  653,  678,  641,  652,  647,  625,    0,
+      662,    0,  634,    0,  649,  665,  660,  663,  631,  661,
+      641,  652,  647,  623,  619,  651,  652,  649,  636,  644,
+        0,  646,  618,  614,  616,  635,  626,  640,  639,  598,
+      641,  638,  622,  609,  595,  610,  609,  608,  606,  589,
+      592,  599,  585,  590,  582,  591,  594,  580,  590,  595,
+      590,  586,  582,  587,  583,  585,  571,  585,  571,  586,
+      235,  237,  817,  611,  610,  596,  600,  588,    0,  567,
+      570,  560,  590,  598,  598,  596,    0,  568,  583,  556,
+      583,  556,  577,  567,  592,  565,  548,  563,    0,  562,
+
+      583,  555,  585,  578,  566,  549,  539,  568,  565,  559,
+      557,  532,  530,  572,  563,  572,  551,    0,  553,  540,
+      526,  563,    0,  545,    0,  563,  557,  559,  528,  530,
+      560,  559,  531,  518,  521,  511,  523,  512,  513,  509,
+      524,  518,  515,  505,  502,  500,  515,  501,  508,  510,
+      513,  533,  505,  529,  523,    0,  500,  495,  529,    0,
+      514,  514,  488,  521,  493,  521,  493,  499,  503,  512,
+      501,  495,  506,  505,    0,  499,  511,  490,  482,  488,
+        0,  511,  486,  496,  484,  468,  489,    0,  495,  502,
+      499,  460,  470,    0,  502,  491,  489,    0,  462,  492,
+
+      464,  463,  460,  455,  451,  457,  458,  464,  449,  455,
+      461,  460,  444,  440,  450,  445,  448,  474,  446,  465,
+      471,  437,  442,    0,    0,  448,  447,  459,  432,    0,
+      461,  469,    0,  468,  458,  446,  420,  450,  446,  453,
+      419,  451,  445,  444,    0,  443,  448,    0,  438,  437,
+        0,  411,  441,  425,  442,  414,  442,  414,  413,  406,
+      411,  417,  403,  405,  395,  397,  402,  397,  394,  400,
+      401,  416,  390,  425,  404,  396,  402,  418,  417,  419,
+      391,  409,  411,  410,  380,  400,  374,  400,    0,  402,
+      375,  403,  393,  367,  397,  402,  395,  368,    0,  402,
+
+      388,  362,  387,  361,  360,  368,  374,  363,  365,  357,
+      352,  355,  349,  353,  349,  349,    0,  364,  367,  362,
+      365,  372,  345,  358,  357,  374,    0,  346,  376,  348,
+      352,  369,  341,    0,  356,  330,  360,  368,  351,  325,
+      367,  349,  323,    0,  340,  318,  324,  337,  327,  330,
+      325,  315,  313,  313,  232,  349,  234,  321,  346,  318,
+      334,  333,  337,  310,  331,  305,  325,  332,  305,  339,
+      311,  315,  322,  324,  297,  324,  310,  309,   63,  300,
+      298,  289,  292,  288,  290,  297,  286,  300,  301,  317,
+      319,  273,  287,  289,  306,  279,  313,  285,    0,  289,
+
+      288,  305,    0,  295,  269,  295,    0,    0,  291,  299,
+      298,  257,  271,  273,  264,  271,   33,  100,  110,    0,
+      161,  170,  160,  154,    0,  177,  157,  194,  200,  230,
+      210,  211,  218,    0,  225,  200,  210,  203,  199,  208,
+      219,  206,  234,    0,  209,  231,  207,  237,  212,  231,
+      248,  249,  241,  252,  226,  223,  220,  224,  229,  231,
+        0,    0,  259,  233,    0,  255,  230,  264,  259,  234,
+      239,  235,  237,  264,  239,  271,  245,  278,    0,  243,
+      248,    0,  271,  246,  272,  248,    0,  266,  276,    0,
+      817,  305,  308,  304,  311,  314
+
     } ;
 
-static yyconst short int yy_def[660] =
+static yyconst flex_int16_t yy_def[697] =
     {   0,
-      654,    1,  654,  654,  654,  655,  654,  656,  654,  654,
-      654,  654,  654,  654,  654,  654,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  654,  654,  654,  654,  655,  656,  654,  654,
-      658,  654,  654,  659,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  658,  654,  654,  654,  659,  654,  654,
-      654,  654,  654,  654,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  654,  654,  654,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,    0,  654,  654,  654,  654,  654
+      691,    1,  691,  691,  691,  692,  691,  693,  691,  691,
+      691,  691,  691,  691,  691,  691,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  691,  691,  691,  691,  692,  693,  691,  691,
+      695,  691,  691,  696,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  695,  691,  691,  691,
+      696,  691,  691,  691,  691,  691,  691,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      691,  691,  691,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
+        0,  691,  691,  691,  691,  691
+
     } ;
 
-static yyconst short int yy_nxt[847] =
+static yyconst flex_uint16_t yy_nxt[886] =
     {   0,
         4,    5,    6,    7,    8,    7,    9,   10,   11,   12,
        12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
@@ -595,95 +703,99 @@ static yyconst short int yy_nxt[847] =
        21,   21,   37,   38,   39,   21,   21,   40,   41,   42,
        43,   21,   44,   45,   46,   47,   21,   48,   49,   50,
        21,   21,   51,   52,   21,   53,   54,   55,   59,   80,
-       60,   62,   62,   65,  632,   66,   66,   69,   70,   71,
+       60,   62,   62,   65,  640,   66,   66,   69,   70,   71,
        88,   63,   72,   73,   75,   67,   94,   81,   89,   76,
-       82,   96,   77,  159,   80,   97,   83,   90,   99,   91,
+       82,   96,   77,  161,   80,   97,   83,   90,   99,   91,
 
-      100,   68,  102,  118,  111,  103,  586,  160,   63,  136,
+      100,   68,  102,  118,  111,  103,  612,  162,   63,  140,
        78,   95,   67,   84,   76,   92,   85,   79,   98,  105,
-      119,   86,   93,  106,  101,  587,  113,  107,  114,  104,
-      112,  115,  120,  124,  130,  138,  137,   59,  121,   60,
-      125,  131,  132,  633,  142,  178,  108,  143,  126,  127,
-      109,  133,  144,  116,  110,  179,  117,  634,  140,  122,
-      128,  139,   76,  145,  123,  141,  155,  151,  134,  156,
-      146,  152,  157,  635,  129,  153,  628,  158,   62,   62,
-      166,  166,  170,  170,  167,  167,  172,  172,   63,  182,
-      173,  173,  171,   65,  188,   66,   66,  200,  183,  226,
-
-      227,  189,  201,  244,  629,   67,  167,  167,  231,  636,
-      228,  637,  245,  229,  260,   63,  638,  228,  639,  171,
-      232,   68,  202,  228,  167,  167,  261,  170,  170,  265,
-      265,  565,   67,  266,  266,  173,  173,  171,  173,  173,
-      266,  266,  266,  266,  568,  640,  641,  642,  643,  644,
-      645,  645,  566,  646,  647,  648,  645,  649,  650,  650,
-      651,  650,  652,  653,  171,  569,   57,   74,   57,   58,
-       58,   58,  164,  164,  164,  168,  168,  168,  631,  630,
-      629,  629,  628,  628,  627,  626,  625,  614,  624,  623,
-      622,  621,  620,  619,  618,  617,  616,  614,  615,  614,
-
-      613,  612,  611,  610,  598,  609,  608,  593,  607,  606,
-      605,  604,  603,  602,  601,  600,  599,  598,  598,  597,
-      596,  593,  595,  594,  593,  584,  592,  579,  591,  575,
-      590,  589,  588,  585,  584,  584,  583,  582,  581,  580,
-      579,  579,  578,  577,  576,  575,  575,  574,  573,  572,
-      571,  570,  567,  564,  563,  562,  561,  560,  559,  558,
-      557,  556,  555,  554,  553,  552,  551,  550,  549,  548,
-      547,  546,  545,  544,  543,  542,  541,  540,  539,  538,
-      537,  536,  535,  534,  524,  533,  532,  531,  530,  529,
-      528,  527,  526,  525,  499,  524,  524,  523,  522,  521,
-
-      520,  519,  518,  517,  516,  515,  514,  513,  512,  511,
-      510,  509,  509,  508,  507,  506,  505,  504,  503,  502,
-      501,  500,  499,  499,  498,  497,  496,  495,  474,  494,
-      493,  492,  491,  490,  489,  488,  487,  486,  485,  484,
-      483,  482,  481,  480,  479,  478,  477,  476,  474,  475,
-      474,  473,  472,  471,  470,  469,  468,  467,  466,  465,
-      464,  463,  462,  461,  460,  459,  458,  457,  456,  455,
-      439,  433,  454,  453,  452,  451,  450,  418,  449,  448,
-      447,  446,  445,  444,  443,  442,  441,  440,  439,  438,
-      437,  436,  435,  433,  434,  433,  432,  431,  430,  429,
-
-      428,  427,  426,  425,  424,  423,  422,  421,  420,  419,
-      418,  418,  417,  416,  415,  414,  413,  412,  411,  410,
-      409,  408,  407,  406,  405,  388,  404,  403,  402,  401,
-      400,  399,  366,  398,  397,  396,  395,  394,  347,  393,
-      392,  391,  390,  389,  388,  388,  387,  386,  385,  384,
-      383,  382,  381,  380,  379,  378,  377,  376,  375,  374,
-      373,  372,  371,  370,  369,  368,  367,  366,  366,  365,
-      364,  363,  362,  361,  360,  359,  358,  357,  356,  355,
-      354,  353,  352,  351,  350,  347,  349,  348,  347,  346,
-      345,  344,  343,  342,  341,  317,  340,  312,  339,  338,
-
-      337,  336,  335,  334,  333,  332,  331,  330,  281,  329,
-      273,  328,  327,  326,  325,  324,  323,  322,  321,  320,
-      317,  319,  318,  317,  316,  315,  312,  314,  313,  312,
-      311,  310,  309,  308,  307,  306,  305,  304,  303,  302,
-      301,  300,  299,  298,  297,  296,  295,  294,  293,  292,
-      291,  290,  289,  288,  287,  286,  285,  284,  283,  281,
-      282,  281,  280,  279,  278,  277,  273,  276,  275,  274,
-      273,  272,  271,  270,  269,  268,  267,  169,  165,  264,
-      263,  262,  259,  258,  257,  256,  255,  211,  209,  254,
-      207,  253,  252,  251,  250,  249,  248,  247,  246,  176,
-
-      243,  242,  241,  240,  239,  238,  237,  236,  235,  234,
-      233,  230,  225,  224,  223,  222,  221,  220,  219,  218,
-      217,  216,  215,  214,  213,  212,  211,  211,  209,  210,
-      207,  209,  208,  207,  206,  205,  204,  203,  199,  198,
-      197,  196,  195,  194,  193,  192,  191,  190,  187,  186,
-      185,  184,  181,  180,  176,  177,  176,  175,  174,  169,
-      165,   56,  163,  162,  161,  154,  150,  149,  148,  147,
-       80,  135,   87,   64,   61,   56,  654,    3,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654
+      119,   86,   93,  106,  101,  613,  113,  107,  114,  104,
+      112,  115,  120,  124,  130,  141,  136,   59,  121,   60,
+      125,  131,  132,  137,  144,  181,  108,  145,  126,  127,
+      109,  133,  146,  116,  110,  182,  117,  641,  142,  122,
+      128,  642,   76,  138,  123,  143,  147,  153,  134,  157,
+      139,  154,  158,  148,  129,  155,  159,  164,   62,   62,
+      643,  160,  169,  169,  165,  191,  170,  170,   63,  173,
+      173,   65,  192,   66,   66,  185,  175,  175,  644,  174,
+
+      176,  176,  203,   67,  186,  234,  645,  204,  644,  229,
+      230,  646,  249,  265,  231,   63,  647,  235,  648,   68,
+      231,  250,  231,  232,  649,  266,  174,  205,  170,  170,
+       67,  170,  170,  173,  173,  271,  271,  176,  176,  272,
+      272,  176,  176,  174,  272,  272,  272,  272,  589,  650,
+      592,  651,  652,  653,  654,  655,  656,  644,  657,  658,
+      659,  660,  661,  661,  662,  662,  663,  664,  665,  590,
+      174,  593,  666,  667,  668,  669,  670,  661,  662,  671,
+      672,  673,  674,  675,  676,  677,  678,  679,  679,  680,
+      681,  679,  682,  682,  683,  684,  685,  682,  686,  687,
+
+      687,  688,  687,  689,  690,   57,   74,   57,   58,   58,
+       58,  167,  167,  167,  171,  171,  171,  639,  625,  638,
+      637,  620,  636,  635,  634,  633,  632,  631,  630,  629,
+      628,  627,  626,  625,  625,  624,  623,  620,  622,  621,
+      620,  619,  608,  618,  603,  617,  599,  616,  615,  614,
+      611,  610,  609,  608,  608,  607,  606,  605,  604,  603,
+      603,  602,  601,  600,  599,  599,  598,  597,  596,  595,
+      594,  591,  588,  587,  586,  585,  584,  583,  582,  581,
+      580,  579,  578,  577,  576,  575,  574,  573,  572,  571,
+      570,  569,  568,  567,  566,  565,  564,  563,  562,  561,
+
+      560,  559,  558,  557,  556,  555,  544,  554,  553,  552,
+      551,  550,  549,  548,  547,  546,  545,  517,  544,  544,
+      543,  542,  541,  540,  539,  538,  537,  536,  535,  534,
+      533,  532,  531,  530,  529,  528,  527,  527,  526,  525,
+      524,  523,  522,  521,  520,  519,  518,  517,  517,  516,
+      515,  514,  513,  512,  489,  511,  510,  509,  508,  507,
+      506,  505,  504,  503,  502,  501,  500,  499,  498,  497,
+      496,  495,  494,  493,  492,  491,  489,  490,  489,  488,
+      487,  486,  485,  484,  483,  482,  481,  480,  479,  478,
+      477,  476,  475,  474,  473,  472,  471,  470,  469,  451,
+
+      445,  468,  467,  466,  465,  464,  430,  463,  462,  461,
+      460,  459,  458,  457,  456,  455,  454,  453,  452,  451,
+      450,  449,  448,  447,  445,  446,  445,  444,  443,  442,
+      441,  440,  439,  438,  437,  436,  435,  434,  433,  432,
+      431,  430,  430,  429,  428,  427,  426,  425,  424,  423,
+      422,  421,  420,  419,  418,  417,  398,  416,  415,  414,
+      413,  412,  411,  410,  375,  409,  408,  407,  406,  405,
+      356,  404,  403,  402,  401,  400,  398,  399,  398,  397,
+      396,  395,  394,  393,  392,  391,  390,  389,  388,  387,
+      386,  385,  384,  383,  382,  381,  380,  379,  378,  377,
+
+      376,  375,  375,  374,  373,  372,  371,  370,  369,  368,
+      367,  366,  365,  364,  363,  362,  361,  360,  359,  356,
+      358,  357,  356,  355,  354,  353,  352,  351,  350,  349,
+      323,  348,  318,  347,  346,  345,  344,  343,  342,  341,
+      340,  339,  338,  287,  337,  279,  336,  335,  334,  333,
+      332,  331,  330,  329,  328,  327,  326,  323,  325,  324,
+      323,  322,  321,  318,  320,  319,  318,  317,  316,  315,
+      314,  313,  312,  311,  310,  309,  308,  307,  306,  305,
+      304,  303,  302,  301,  300,  299,  298,  297,  296,  295,
+      294,  293,  292,  291,  290,  289,  287,  288,  287,  286,
+
+      285,  284,  283,  279,  282,  281,  280,  279,  278,  277,
+      276,  275,  274,  273,  172,  168,  270,  269,  268,  267,
+      264,  263,  262,  261,  260,  214,  212,  259,  210,  258,
+      257,  256,  255,  254,  253,  252,  251,  179,  248,  247,
+      246,  245,  244,  243,  242,  241,  240,  239,  238,  237,
+      236,  233,  228,  227,  226,  225,  224,  223,  222,  221,
+      220,  219,  218,  217,  216,  215,  214,  214,  212,  213,
+      210,  212,  211,  210,  209,  208,  207,  206,  202,  201,
+      200,  199,  198,  197,  196,  195,  194,  193,  190,  189,
+      188,  187,  184,  183,  179,  180,  179,  178,  177,  172,
+
+      168,   56,  166,  163,  156,  152,  151,  150,  149,   80,
+      135,   87,   64,   61,   56,  691,    3,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691
     } ;
 
-static yyconst short int yy_chk[847] =
+static yyconst flex_int16_t yy_chk[886] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -692,115 +804,135 @@ static yyconst short int yy_chk[847] =
         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,    8,   18,
-        8,   10,   10,   12,  620,   12,   12,   14,   14,   14,
+        8,   10,   10,   12,  617,   12,   12,   14,   14,   14,
        22,   10,   16,   16,   17,   12,   23,   19,   22,   17,
        19,   24,   17,   49,   18,   24,   19,   22,   25,   22,
 
-       25,   12,   26,   30,   28,   26,  556,   49,   10,   35,
+       25,   12,   26,   30,   28,   26,  579,   49,   10,   36,
        17,   23,   12,   19,   17,   22,   19,   17,   24,   27,
-       30,   19,   22,   27,   25,  556,   29,   27,   29,   26,
+       30,   19,   22,   27,   25,  579,   29,   27,   29,   26,
        28,   29,   31,   32,   33,   36,   35,   58,   31,   58,
-       32,   33,   33,  621,   39,   81,   27,   39,   32,   32,
-       27,   33,   39,   29,   27,   81,   29,  622,   37,   31,
-       32,   36,   37,   40,   31,   37,   47,   45,   33,   47,
-       40,   45,   48,  623,   32,   45,  624,   48,   62,   62,
-       63,   63,   65,   65,   63,   63,   67,   67,   62,   84,
-       67,   67,   65,   66,   89,   66,   66,  100,   84,  127,
-
-      127,   89,  100,  142,  625,   66,  166,  166,  129,  626,
-      127,  627,  142,  127,  160,   62,  630,  129,  631,   65,
-      129,   66,  100,  160,  167,  167,  160,  170,  170,  171,
-      171,  534,   66,  171,  171,  172,  172,  170,  173,  173,
-      265,  265,  266,  266,  536,  633,  634,  635,  636,  637,
-      638,  639,  534,  640,  641,  642,  643,  644,  646,  647,
-      648,  649,  651,  652,  170,  536,  655,  657,  655,  656,
-      656,  656,  658,  658,  658,  659,  659,  659,  619,  618,
-      617,  616,  615,  613,  612,  611,  610,  609,  608,  606,
-      605,  604,  603,  602,  601,  600,  599,  597,  596,  595,
-
-      594,  592,  591,  590,  589,  588,  587,  586,  585,  582,
-      581,  580,  578,  577,  576,  574,  573,  572,  571,  570,
-      569,  568,  567,  566,  565,  564,  563,  562,  561,  560,
-      559,  558,  557,  555,  554,  553,  552,  551,  550,  549,
-      548,  547,  546,  545,  544,  543,  542,  541,  540,  539,
-      538,  537,  535,  533,  532,  531,  530,  529,  528,  527,
-      526,  525,  523,  522,  521,  520,  519,  518,  517,  515,
-      514,  513,  512,  511,  510,  508,  507,  506,  505,  504,
-      503,  502,  501,  500,  498,  497,  496,  495,  494,  493,
-      492,  491,  490,  489,  488,  487,  486,  485,  483,  482,
-
-      481,  480,  479,  478,  477,  476,  475,  473,  472,  471,
+       32,   33,   33,   35,   39,   81,   27,   39,   32,   32,
+       27,   33,   39,   29,   27,   81,   29,  618,   37,   31,
+       32,  619,   37,   35,   31,   37,   40,   45,   33,   47,
+       35,   45,   47,   40,   32,   45,   48,   51,   62,   62,
+      621,   48,   63,   63,   51,   89,   63,   63,   62,   65,
+       65,   66,   89,   66,   66,   84,   67,   67,  622,   65,
+
+       67,   67,  100,   66,   84,  129,  623,  100,  624,  127,
+      127,  626,  144,  162,  129,   62,  627,  129,  628,   66,
+      127,  144,  162,  127,  629,  162,   65,  100,  169,  169,
+       66,  170,  170,  173,  173,  174,  174,  175,  175,  174,
+      174,  176,  176,  173,  271,  271,  272,  272,  555,  630,
+      557,  631,  632,  633,  635,  636,  637,  638,  639,  640,
+      641,  642,  643,  645,  646,  647,  648,  649,  650,  555,
+      173,  557,  651,  652,  653,  654,  655,  656,  657,  658,
+      659,  660,  663,  664,  666,  667,  668,  669,  670,  671,
+      672,  673,  674,  675,  676,  677,  678,  680,  681,  683,
+
+      684,  685,  686,  688,  689,  692,  694,  692,  693,  693,
+      693,  695,  695,  695,  696,  696,  696,  616,  615,  614,
+      613,  612,  611,  610,  609,  606,  605,  604,  602,  601,
+      600,  598,  597,  596,  595,  594,  593,  592,  591,  590,
+      589,  588,  587,  586,  585,  584,  583,  582,  581,  580,
+      578,  577,  576,  575,  574,  573,  572,  571,  570,  569,
+      568,  567,  566,  565,  564,  563,  562,  561,  560,  559,
+      558,  556,  554,  553,  552,  551,  550,  549,  548,  547,
+      546,  545,  543,  542,  541,  540,  539,  538,  537,  536,
+      535,  533,  532,  531,  530,  529,  528,  526,  525,  524,
+
+      523,  522,  521,  520,  519,  518,  516,  515,  514,  513,
+      512,  511,  510,  509,  508,  507,  506,  505,  504,  503,
+      502,  501,  500,  498,  497,  496,  495,  494,  493,  492,
+      491,  490,  488,  487,  486,  485,  484,  483,  482,  481,
+      480,  479,  478,  477,  476,  475,  474,  473,  472,  471,
       470,  469,  468,  467,  466,  465,  464,  463,  462,  461,
-      460,  459,  458,  457,  456,  455,  454,  453,  452,  451,
-      450,  449,  448,  447,  446,  445,  444,  443,  442,  441,
-      440,  438,  437,  435,  434,  432,  431,  430,  429,  428,
-      427,  426,  425,  424,  423,  422,  420,  419,  417,  416,
-      415,  414,  411,  410,  409,  408,  407,  406,  405,  404,
-      403,  402,  401,  400,  399,  398,  397,  396,  395,  394,
-      393,  392,  391,  390,  389,  387,  386,  384,  383,  382,
-      381,  380,  378,  377,  376,  375,  374,  373,  371,  370,
-
-      369,  368,  367,  365,  364,  363,  362,  361,  360,  359,
-      358,  357,  356,  355,  354,  353,  352,  350,  349,  348,
+      460,  459,  458,  457,  456,  455,  454,  453,  452,  450,
+      449,  447,  446,  444,  443,  442,  441,  440,  439,  438,
+      437,  436,  435,  434,  432,  431,  429,  428,  427,  426,
+      423,  422,  421,  420,  419,  418,  417,  416,  415,  414,
+
+      413,  412,  411,  410,  409,  408,  407,  406,  405,  404,
+      403,  402,  401,  400,  399,  397,  396,  395,  393,  392,
+      391,  390,  389,  387,  386,  385,  384,  383,  382,  380,
+      379,  378,  377,  376,  374,  373,  372,  371,  370,  369,
+      368,  367,  366,  365,  364,  363,  362,  361,  359,  358,
+      357,  355,  354,  353,  352,  351,  350,  349,  348,  347,
       346,  345,  344,  343,  342,  341,  340,  339,  338,  337,
       336,  335,  334,  333,  332,  331,  330,  329,  328,  327,
-      326,  325,  324,  323,  322,  321,  320,  318,  316,  315,
-      314,  313,  311,  310,  309,  308,  307,  306,  305,  304,
-      303,  302,  301,  300,  299,  298,  297,  296,  295,  294,
-      292,  291,  290,  289,  288,  287,  286,  285,  284,  283,
-      282,  280,  279,  278,  277,  276,  275,  274,  272,  271,
-      270,  269,  268,  264,  263,  262,  261,  260,  259,  258,
+      326,  324,  322,  321,  320,  319,  317,  316,  315,  314,
+      313,  312,  311,  310,  309,  308,  307,  306,  305,  304,
 
+      303,  302,  301,  300,  298,  297,  296,  295,  294,  293,
+      292,  291,  290,  289,  288,  286,  285,  284,  283,  282,
+      281,  280,  278,  277,  276,  275,  274,  270,  269,  268,
+      267,  266,  265,  264,  263,  262,  261,  260,  259,  258,
       257,  256,  255,  254,  253,  252,  251,  250,  249,  248,
       247,  246,  245,  244,  243,  242,  241,  240,  239,  238,
-      237,  236,  235,  234,  233,  232,  231,  230,  229,  227,
+      237,  236,  235,  234,  233,  232,  230,  229,  228,  227,
       226,  225,  224,  223,  222,  221,  220,  219,  218,  217,
-      216,  215,  214,  213,  212,  210,  208,  206,  205,  204,
-      203,  202,  201,  200,  199,  198,  196,  195,  194,  193,
-      192,  190,  189,  188,  187,  186,  185,  184,  183,  182,
-      181,  180,  179,  178,  177,  175,  174,  168,  164,  163,
-      162,  161,  159,  158,  157,  156,  155,  154,  153,  152,
-      151,  150,  149,  148,  147,  146,  145,  144,  143,  141,
+      216,  215,  213,  211,  209,  208,  207,  206,  205,  204,
+      203,  202,  201,  199,  198,  197,  196,  195,  193,  192,
 
+      191,  190,  189,  188,  187,  186,  185,  184,  183,  182,
+      181,  180,  178,  177,  171,  167,  166,  165,  164,  163,
+      161,  160,  159,  158,  157,  156,  155,  154,  153,  152,
+      151,  150,  149,  148,  147,  146,  145,  143,  142,  141,
       140,  139,  138,  137,  136,  135,  134,  133,  132,  131,
       130,  128,  126,  125,  124,  123,  122,  121,  120,  119,
       118,  117,  116,  115,  114,  113,  112,  111,  110,  109,
       108,  107,  106,  105,  104,  103,  102,  101,   99,   98,
        97,   96,   95,   94,   93,   92,   91,   90,   88,   87,
        86,   85,   83,   82,   79,   78,   77,   75,   68,   64,
-       61,   56,   52,   51,   50,   46,   44,   43,   42,   41,
-       38,   34,   20,   11,    9,    5,    3,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654
+
+       61,   56,   52,   50,   46,   44,   43,   42,   41,   38,
+       34,   20,   11,    9,    5,    3,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691,  691,  691,  691,  691,  691,
+      691,  691,  691,  691,  691
     } ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
 
+extern int FtaParser_flex_debug;
+int FtaParser_flex_debug = 0;
+
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
  */
 #define REJECT reject_used_but_not_detected
 static int yy_more_flag = 0;
 static int yy_more_len = 0;
-#define yymore() (yy_more_flag = 1)
-#define YY_MORE_ADJ yy_more_len
+#define yymore() ((yy_more_flag) = 1)
+#define YY_MORE_ADJ (yy_more_len)
 #define YY_RESTORE_YY_MORE_OFFSET
-char *yytext;
+char *FtaParsertext;
 #line 1 "fta.l"
-#define INITIAL 0
+/* ------------------------------------------------
+Copyright 2020 AT&T Intellectual Property
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ ------------------------------------------- */
 /*
        MUST COMPILE WITH
                flex -PFtaParser -oftalexer.cc fta.l
        (or equivalent).
 */     
-#line 9 "fta.l"
+#line 24 "fta.l"
 /*
  * AT&T lex can't handle this lexer due to lex bugs.  It works with flex
  * 2.3.7, pclex 2.0.5, and MKS lex 3.1a.
@@ -823,14 +955,14 @@ char *yytext;
 #include <string.h>
 
 
-//             Prevent flex from defining yywrap as extern "C" 
+//             Prevent flex from defining FtaParserwrap as extern "C" 
 
 #define YY_SKIP_YYWRAP
 
-/*             No lex lib, supply the yywrap fcn. that normally resides there
+/*             No lex lib, supply the FtaParserwrap fcn. that normally resides there
 */
 
-int FtaParserwrap(){return(1);}
+//int FtaParserwrap(){return(1);}
 
 extern int FtaParserdebug;
 
@@ -877,7 +1009,52 @@ void FtaParsererror(char *s){
 #define YY_INPUT(b, r, ms) (r = my_FtaParser_yyinput(b,ms))
 
 /* MKS needs the next line to increase the NFA table */
-#line 881 "ftalexer.cc"
+#line 1013 "ftalexer.cc"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int FtaParserlex_destroy (void );
+
+int FtaParserget_debug (void );
+
+void FtaParserset_debug (int debug_flag  );
+
+YY_EXTRA_TYPE FtaParserget_extra (void );
+
+void FtaParserset_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *FtaParserget_in (void );
+
+void FtaParserset_in  (FILE * _in_str  );
+
+FILE *FtaParserget_out (void );
+
+void FtaParserset_out  (FILE * _out_str  );
+
+yy_size_t FtaParserget_leng (void );
+
+char *FtaParserget_text (void );
+
+int FtaParserget_lineno (void );
+
+void FtaParserset_lineno (int _line_number  );
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -885,79 +1062,52 @@ void FtaParsererror(char *s){
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
+extern "C" int FtaParserwrap (void );
 #else
-extern int yywrap YY_PROTO(( void ));
+extern int FtaParserwrap (void );
 #endif
 #endif
 
 #ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+    
+    static void yyunput (int c,char *buf_ptr  );
+    
 #endif
 
 #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 ));
-#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 ));
-#endif
 
+#ifdef __cplusplus
+static int yyinput (void );
 #else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
+static int input (void );
 #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. */
 #ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
 #define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
 #endif
 
 /* 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().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( FtaParsertext, FtaParserleng, 1, FtaParserout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -965,21 +1115,35 @@ 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 ) \
+                            (c = getc( FtaParserin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
                if ( c == '\n' ) \
                        buf[n++] = (char) c; \
-               if ( c == EOF && ferror( yyin ) ) \
+               if ( c == EOF && ferror( FtaParserin ) ) \
                        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, FtaParserin))==0 && ferror(FtaParserin)) \
+                       { \
+                       if( errno != EINTR) \
+                               { \
+                               YY_FATAL_ERROR( "input in flex scanner failed" ); \
+                               break; \
+                               } \
+                       errno=0; \
+                       clearerr(FtaParserin); \
+                       } \
+               }\
+\
+
 #endif
 
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
@@ -1000,14 +1164,20 @@ 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 FtaParserlex (void);
+
+#define YY_DECL int FtaParserlex (void)
+#endif /* !YY_DECL */
 
-/* Code executed at the beginning of each rule, after yytext and yyleng
+/* Code executed at the beginning of each rule, after FtaParsertext and FtaParserleng
  * have been set up.
  */
 #ifndef YY_USER_ACTION
@@ -1016,19 +1186,48 @@ YY_MALLOC_DECL
 
 /* Code executed at the end of each rule. */
 #ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
 #endif
 
 #define YY_RULE_SETUP \
        YY_USER_ACTION
 
+/** The main scanner function which does all the work.
+ */
 YY_DECL
-       {
-       register yy_state_type yy_current_state;
-       register char *yy_cp = NULL, *yy_bp = NULL;
-       register int yy_act;
+{
+       yy_state_type yy_current_state;
+       char *yy_cp, *yy_bp;
+       int yy_act;
+    
+       if ( !(yy_init) )
+               {
+               (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+               YY_USER_INIT;
+#endif
+
+               if ( ! (yy_start) )
+                       (yy_start) = 1; /* first start state */
+
+               if ( ! FtaParserin )
+                       FtaParserin = stdin;
+
+               if ( ! FtaParserout )
+                       FtaParserout = stdout;
+
+               if ( ! YY_CURRENT_BUFFER ) {
+                       FtaParserensure_buffer_stack ();
+                       YY_CURRENT_BUFFER_LVALUE =
+                               FtaParser_create_buffer(FtaParserin,YY_BUF_SIZE );
+               }
+
+               FtaParser_load_buffer_state( );
+               }
 
-#line 89 "fta.l"
+       {
+#line 104 "fta.l"
 
 
        /* literal keyword tokens */
@@ -1047,457 +1246,441 @@ YY_DECL
 
  /*            Query keywords          */
 
-#line 1051 "ftalexer.cc"
-
-       if ( yy_init )
-               {
-               yy_init = 0;
-
-#ifdef YY_USER_INIT
-               YY_USER_INIT;
-#endif
-
-               if ( ! yy_start )
-                       yy_start = 1;   /* first start state */
-
-               if ( ! yyin )
-                       yyin = stdin;
-
-               if ( ! yyout )
-                       yyout = stdout;
-
-               if ( ! yy_current_buffer )
-                       yy_current_buffer =
-                               yy_create_buffer( yyin, YY_BUF_SIZE );
-
-               yy_load_buffer_state();
-               }
+#line 1250 "ftalexer.cc"
 
-       while ( 1 )             /* loops until end-of-file is reached */
+       while ( /*CONSTCOND*/1 )                /* loops until end-of-file is reached */
                {
-               yy_more_len = 0;
-               if ( yy_more_flag )
+               (yy_more_len) = 0;
+               if ( (yy_more_flag) )
                        {
-                       yy_more_len = yy_c_buf_p - yytext_ptr;
-                       yy_more_flag = 0;
+                       (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
+                       (yy_more_flag) = 0;
                        }
-               yy_cp = yy_c_buf_p;
+               yy_cp = (yy_c_buf_p);
 
-               /* Support of yytext. */
-               *yy_cp = yy_hold_char;
+               /* Support of FtaParsertext. */
+               *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_match:
                do
                        {
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+                       YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
                        if ( yy_accept[yy_current_state] )
                                {
-                               yy_last_accepting_state = yy_current_state;
-                               yy_last_accepting_cpos = yy_cp;
+                               (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 >= 655 )
+                               if ( yy_current_state >= 692 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_base[yy_current_state] != 778 );
+               while ( yy_base[yy_current_state] != 817 );
 
 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_cp = (yy_last_accepting_cpos);
+                       yy_current_state = (yy_last_accepting_state);
                        yy_act = yy_accept[yy_current_state];
                        }
 
                YY_DO_BEFORE_ACTION;
 
-
 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;
+                       *yy_cp = (yy_hold_char);
+                       yy_cp = (yy_last_accepting_cpos);
+                       yy_current_state = (yy_last_accepting_state);
                        goto yy_find_action;
 
 case 1:
 YY_RULE_SETUP
-#line 107 "fta.l"
+#line 122 "fta.l"
 { flex_fta_ch+=FtaParserleng; return AND; }
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 108 "fta.l"
+#line 123 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("AND_AGGR"); return AGGR; }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 109 "fta.l"
+#line 124 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("OR_AGGR"); return AGGR; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 110 "fta.l"
+#line 125 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("XOR_AGGR"); return AGGR; }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 111 "fta.l"
+#line 126 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("AVG"); return AGGR; }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 112 "fta.l"
+#line 127 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("MIN"); return AGGR; }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 113 "fta.l"
+#line 128 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("MAX"); return AGGR; }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 114 "fta.l"
+#line 129 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("SUM"); return AGGR; }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 115 "fta.l"
+#line 130 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup("COUNT"); return AGGR; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 116 "fta.l"
+#line 131 "fta.l"
 { flex_fta_ch+=FtaParserleng; return BY; }
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 117 "fta.l"
+#line 132 "fta.l"
 { flex_fta_ch+=FtaParserleng; return FROM; }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 118 "fta.l"
+#line 133 "fta.l"
 { flex_fta_ch+=FtaParserleng; return INNER_JOIN; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 119 "fta.l"
+#line 134 "fta.l"
 { flex_fta_ch+=FtaParserleng; return OUTER_JOIN; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 120 "fta.l"
+#line 135 "fta.l"
 { flex_fta_ch+=FtaParserleng; return RIGHT_OUTER_JOIN; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 121 "fta.l"
+#line 136 "fta.l"
 { flex_fta_ch+=FtaParserleng; return LEFT_OUTER_JOIN; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 122 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return FILTER_JOIN; }
+#line 137 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return WATCHLIST_JOIN; }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 123 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return GROUP; }
+#line 138 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return FILTER_JOIN; }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 124 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return ROLLUP; }
+#line 139 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return GROUP; }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 125 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return CUBE; }
+#line 140 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return ROLLUP; }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 126 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return GROUPING_SETS; }
+#line 141 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return CUBE; }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 127 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return SUPERGROUP; }
+#line 142 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return GROUPING_SETS; }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 128 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return CLEANING_WHEN; }
+#line 143 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return SUPERGROUP; }
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 129 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return CLEANING_BY; }
+#line 144 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return CLEANING_WHEN; }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 130 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return CLOSING_WHEN; }
+#line 145 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return CLEANING_BY; }
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 131 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return HAVING; }
+#line 146 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return CLOSING_WHEN; }
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 132 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return AS; }
+#line 147 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return HAVING; }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 133 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return IN; }
+#line 148 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return AS; }
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 134 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return NOT; }
+#line 149 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return IN; }
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 135 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return OR; }
+#line 150 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return NOT; }
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 137 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return SELECT; }
+#line 151 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return OR; }
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 138 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return WHERE; }
+#line 153 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return SELECT; }
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 139 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return SUCH;}
+#line 154 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return WHERE; }
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 140 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return THAT;}
+#line 155 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return SUCH;}
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 141 "fta.l"
-{flex_fta_ch+=FtaParserleng; return MERGE;}
+#line 156 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return THAT;}
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 142 "fta.l"
-{flex_fta_ch+=FtaParserleng; return SLACK;}
+#line 157 "fta.l"
+{flex_fta_ch+=FtaParserleng; return MERGE;}
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 144 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return TRUE_V;}
+#line 158 "fta.l"
+{flex_fta_ch+=FtaParserleng; return SLACK;}
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 145 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return FALSE_V;}
+#line 159 "fta.l"
+{flex_fta_ch+=FtaParserleng; return WATCHLIST;}
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 146 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return TIMEVAL_L;}
+#line 161 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return TRUE_V;}
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 147 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return HEX_L;}
+#line 162 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return FALSE_V;}
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 148 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return LHEX_L;}
+#line 163 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return TIMEVAL_L;}
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 149 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return IP_L;}
+#line 164 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return HEX_L;}
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 150 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return IPV6_L;}
+#line 165 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return LHEX_L;}
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 152 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return DEFINE_SEC;}
+#line 166 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return IP_L;}
        YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 153 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return PARAM_SEC;}
+#line 167 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return IPV6_L;}
        YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 155 "fta.l"
-{flex_fta_ch+=FtaParserleng; return LEFTBRACE;}
+#line 169 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return DEFINE_SEC;}
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 156 "fta.l"
+#line 170 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return PARAM_SEC;}
+       YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 172 "fta.l"
+{flex_fta_ch+=FtaParserleng; return LEFTBRACE;}
+       YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 173 "fta.l"
 {flex_fta_ch+=FtaParserleng; return RIGHTBRACE;}
        YY_BREAK
 /*
                Table definition keywords
  */            
-case 47:
+case 49:
 YY_RULE_SETUP
-#line 161 "fta.l"
+#line 178 "fta.l"
 { flex_fta_ch+=FtaParserleng; return TABLE; }
        YY_BREAK
-case 48:
+case 50:
 YY_RULE_SETUP
-#line 162 "fta.l"
+#line 179 "fta.l"
 { flex_fta_ch+=FtaParserleng; return PROTOCOL; }
        YY_BREAK
-case 49:
+case 51:
 YY_RULE_SETUP
-#line 163 "fta.l"
+#line 180 "fta.l"
 { flex_fta_ch+=FtaParserleng; return STREAM; }
        YY_BREAK
-case 50:
+case 52:
 YY_RULE_SETUP
-#line 164 "fta.l"
+#line 181 "fta.l"
 { flex_fta_ch+=FtaParserleng; return FTA; }
        YY_BREAK
-case 51:
+case 53:
 YY_RULE_SETUP
-#line 165 "fta.l"
+#line 182 "fta.l"
 { flex_fta_ch+=FtaParserleng; return UNPACK_FCNS; }
        YY_BREAK
-case 52:
+case 54:
 YY_RULE_SETUP
-#line 167 "fta.l"
+#line 184 "fta.l"
 { flex_fta_ch+=FtaParserleng; return OPERATOR; }
        YY_BREAK
-case 53:
+case 55:
 YY_RULE_SETUP
-#line 168 "fta.l"
+#line 185 "fta.l"
 { flex_fta_ch+=FtaParserleng; return OPERATOR_VIEW; }
        YY_BREAK
-case 54:
+case 56:
 YY_RULE_SETUP
-#line 169 "fta.l"
+#line 186 "fta.l"
 { flex_fta_ch+=FtaParserleng; return FIELDS; }
        YY_BREAK
-case 55:
+case 57:
 YY_RULE_SETUP
-#line 170 "fta.l"
+#line 187 "fta.l"
 { flex_fta_ch+=FtaParserleng; return SUBQUERIES; }
        YY_BREAK
-case 56:
+case 58:
 YY_RULE_SETUP
-#line 171 "fta.l"
+#line 188 "fta.l"
 { flex_fta_ch+=FtaParserleng; return SELECTION_PUSHDOWN; }
        YY_BREAK
-case 57:
+case 59:
 YY_RULE_SETUP
-#line 172 "fta.l"
+#line 189 "fta.l"
 {flex_fta_ch+=FtaParserleng; return SEMICOLON;}
        YY_BREAK
 /* punctuation */
-case 58:
-#line 177 "fta.l"
-case 59:
-YY_RULE_SETUP
-#line 177 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext); return SHIFT_OP; }
-       YY_BREAK
 case 60:
-#line 180 "fta.l"
+#line 194 "fta.l"
 case 61:
-#line 181 "fta.l"
+YY_RULE_SETUP
+#line 194 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext); return SHIFT_OP; }
+       YY_BREAK
 case 62:
-#line 182 "fta.l"
+#line 197 "fta.l"
 case 63:
-#line 183 "fta.l"
+#line 198 "fta.l"
 case 64:
-#line 184 "fta.l"
+#line 199 "fta.l"
 case 65:
-YY_RULE_SETUP
-#line 184 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext); return COMPARISON; }
-       YY_BREAK
+#line 200 "fta.l"
 case 66:
-YY_RULE_SETUP
-#line 186 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return yytext[0]; }
-       YY_BREAK
+#line 201 "fta.l"
 case 67:
 YY_RULE_SETUP
-#line 187 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return yytext[0]; }
+#line 201 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext); return COMPARISON; }
        YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 188 "fta.l"
-{ flex_fta_ch+=FtaParserleng; return yytext[0]; }
+#line 203 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return FtaParsertext[0]; }
        YY_BREAK
-/* names */
 case 69:
 YY_RULE_SETUP
-#line 192 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext); return NAME; }
+#line 204 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return FtaParsertext[0]; }
        YY_BREAK
-/* numbers */
 case 70:
-#line 197 "fta.l"
+YY_RULE_SETUP
+#line 205 "fta.l"
+{ flex_fta_ch+=FtaParserleng; return FtaParsertext[0]; }
+       YY_BREAK
+/* names */
 case 71:
 YY_RULE_SETUP
-#line 197 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext);  return INTNUM; }
+#line 209 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext); return NAME; }
        YY_BREAK
+/* numbers */
 case 72:
+#line 214 "fta.l"
+case 73:
 YY_RULE_SETUP
-#line 199 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext);  return LONGINTNUM; }
+#line 214 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext);  return INTNUM; }
        YY_BREAK
-case 73:
-#line 202 "fta.l"
 case 74:
-#line 203 "fta.l"
+YY_RULE_SETUP
+#line 216 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext);  return LONGINTNUM; }
+       YY_BREAK
 case 75:
-#line 204 "fta.l"
+#line 219 "fta.l"
 case 76:
-#line 205 "fta.l"
+#line 220 "fta.l"
 case 77:
+#line 221 "fta.l"
+case 78:
+#line 222 "fta.l"
+case 79:
 YY_RULE_SETUP
-#line 205 "fta.l"
-{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(yytext); return APPROXNUM; }
+#line 222 "fta.l"
+{ flex_fta_ch+=FtaParserleng; FtaParserlval.strval = strdup(FtaParsertext); return APPROXNUM; }
        YY_BREAK
 /* strings */
-case 78:
+case 80:
 YY_RULE_SETUP
-#line 209 "fta.l"
+#line 226 "fta.l"
 {
                
                int c;
@@ -1515,84 +1698,86 @@ YY_RULE_SETUP
                        yymore();
        }
        YY_BREAK
-case 79:
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
-yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
+case 81:
+*yy_cp = (yy_hold_char); /* undo effects of setting up FtaParsertext */
+(yy_c_buf_p) = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up FtaParsertext again */
 YY_RULE_SETUP
-#line 226 "fta.l"
+#line 243 "fta.l"
 { flex_fta_ch+=FtaParserleng; FtaParsererror("Unterminated string"); }
        YY_BREAK
 /*                                                                                                                     */
 /*             Newline : advance the error reporting line number       */
 /*             and grab the next line into flex_fta_linebuf                    */
 /*                                                                                                                     */
-case 80:
+case 82:
+/* rule 82 can match eol */
 YY_RULE_SETUP
-#line 233 "fta.l"
+#line 250 "fta.l"
 {flex_fta_ch=0; flex_fta_lineno++;
                           strcpy(flex_fta_linebuf,FtaParsertext+1);
                           yyless(1);
                           }
        YY_BREAK
-case 81:
+case 83:
 YY_RULE_SETUP
-#line 238 "fta.l"
+#line 255 "fta.l"
 {flex_fta_ch+=FtaParserleng; } /* white space */
        YY_BREAK
-case 82:
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
-yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
+case 84:
+*yy_cp = (yy_hold_char); /* undo effects of setting up FtaParsertext */
+(yy_c_buf_p) = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up FtaParsertext again */
 YY_RULE_SETUP
-#line 240 "fta.l"
+#line 257 "fta.l"
 {flex_fta_ch+=FtaParserleng; };        /* comment */
        YY_BREAK
-case 83:
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
-yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
+case 85:
+*yy_cp = (yy_hold_char); /* undo effects of setting up FtaParsertext */
+(yy_c_buf_p) = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up FtaParsertext again */
 YY_RULE_SETUP
-#line 241 "fta.l"
+#line 258 "fta.l"
 {flex_fta_ch+=FtaParserleng; };        /* comment */
        YY_BREAK
-case 84:
+case 86:
+/* rule 86 can match eol */
 YY_RULE_SETUP
-#line 243 "fta.l"
-{flex_fta_ch+=FtaParserleng; fprintf(stderr,"Warning: unknown token (ignored)\n");  FtaParsererror(yytext);}
+#line 260 "fta.l"
+{flex_fta_ch+=FtaParserleng; fprintf(stderr,"Warning: unknown token (ignored)\n");  FtaParsererror(FtaParsertext);}
        YY_BREAK
-case 85:
+case 87:
 YY_RULE_SETUP
-#line 245 "fta.l"
+#line 262 "fta.l"
 ECHO;
        YY_BREAK
-#line 1570 "ftalexer.cc"
+#line 1755 "ftalexer.cc"
 case YY_STATE_EOF(INITIAL):
        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
+                        * just pointed FtaParserin at a new source and called
+                        * FtaParserlex().  If so, then we have to assure
+                        * 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 = FtaParserin;
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
                        }
 
                /* Note that here we test for yy_c_buf_p "<=" to the position
@@ -1602,13 +1787,13 @@ case YY_STATE_EOF(INITIAL):
                 * 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
@@ -1621,41 +1806,41 @@ case YY_STATE_EOF(INITIAL):
 
                        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 ( FtaParserwrap( ) )
                                        {
                                        /* Note: because we've taken care in
                                         * yy_get_next_buffer() to have set up
-                                        * yytext, we can now set up
+                                        * FtaParsertext, we can now set up
                                         * yy_c_buf_p so that if some total
                                         * hoser (like flex itself) wants to
                                         * call the scanner after we return the
                                         * 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;
@@ -1663,30 +1848,30 @@ case YY_STATE_EOF(INITIAL):
 
                                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;
@@ -1697,8 +1882,8 @@ case YY_STATE_EOF(INITIAL):
                        "fatal flex scanner internal error--no action found" );
        } /* end of action switch */
                } /* end of scanning one token */
-       } /* end of yylex */
-
+       } /* end of user's declarations */
+} /* end of FtaParserlex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1707,21 +1892,20 @@ case YY_STATE_EOF(INITIAL):
  *     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;
-       register int number_to_move, i;
+static int yy_get_next_buffer (void)
+{
+       char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+       char *source = (yytext_ptr);
+       yy_size_t number_to_move, i;
        int 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.
@@ -1741,38 +1925,34 @@ 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 = (yy_size_t) ((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;
+                       yy_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;
+                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
                        int yy_c_buf_p_offset =
-                               (int) (yy_c_buf_p - b->yy_ch_buf);
+                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
                        if ( b->yy_is_our_buffer )
                                {
-                               int new_size = b->yy_buf_size * 2;
+                               yy_size_t new_size = b->yy_buf_size * 2;
 
                                if ( new_size <= 0 )
                                        b->yy_buf_size += b->yy_buf_size / 8;
@@ -1781,8 +1961,7 @@ static int yy_get_next_buffer()
 
                                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 );
+                                       FtaParserrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
                                }
                        else
                                /* Can't grow it, we don't own it. */
@@ -1792,35 +1971,35 @@ static int yy_get_next_buffer()
                                YY_FATAL_ERROR(
                                "fatal error - scanner input buffer overflow" );
 
-                       yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 
-                       num_to_read = yy_current_buffer->yy_buf_size -
+                       num_to_read = YY_CURRENT_BUFFER_LVALUE->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 );
+                       FtaParserrestart(FtaParserin  );
                        }
 
                else
                        {
                        ret_val = EOB_ACT_LAST_MATCH;
-                       yy_current_buffer->yy_buffer_status =
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
                                YY_BUFFER_EOF_PENDING;
                        }
                }
@@ -1828,153 +2007,149 @@ 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;
+       if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) FtaParserrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
 
-       yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+       (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;
 
-       return ret_val;
-       }
+       (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()
-       {
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-
-       yy_current_state = yy_start;
+    static yy_state_type yy_get_previous_state (void)
+{
+       yy_state_type yy_current_state;
+       char *yy_cp;
+    
+       yy_current_state = (yy_start);
 
-       for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+       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);
+               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;
+                       (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 >= 655 )
+                       if ( yy_current_state >= 692 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                }
 
        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 );
  */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+{
+       int yy_is_jam;
+       char *yy_cp = (yy_c_buf_p);
 
-#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
-       {
-       register int yy_is_jam;
-       register char *yy_cp = yy_c_buf_p;
-
-       register YY_CHAR yy_c = 1;
+       YY_CHAR yy_c = 1;
        if ( yy_accept[yy_current_state] )
                {
-               yy_last_accepting_state = yy_current_state;
-               yy_last_accepting_cpos = yy_cp;
+               (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 >= 655 )
+               if ( yy_current_state >= 692 )
                        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 == 654);
-
-       return yy_is_jam ? 0 : yy_current_state;
-       }
+       yy_is_jam = (yy_current_state == 691);
 
+               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;
 
-       /* undo effects of setting up yytext */
-       *yy_cp = yy_hold_char;
+    static void yyunput (int c, char * yy_bp )
+{
+       char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+       /* undo effects of setting up FtaParsertext */
+       *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 char *source =
-                               &yy_current_buffer->yy_ch_buf[number_to_move];
+               yy_size_t number_to_move = (yy_n_chars) + 2;
+               char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+               char *source =
+                               &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;
 
+       (yytext_ptr) = yy_bp;
+       (yy_hold_char) = *yy_cp;
+       (yy_c_buf_p) = yy_cp;
+}
 
-       yytext_ptr = yy_bp;
-       yy_hold_char = *yy_cp;
-       yy_c_buf_p = yy_cp;
-       }
-#endif /* ifndef YY_NO_UNPUT */
-
+#endif
 
 #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;
+                       yy_size_t 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()
@@ -1988,16 +2163,16 @@ static int input()
                                         */
 
                                        /* Reset buffer status. */
-                                       yyrestart( yyin );
+                                       FtaParserrestart(FtaParserin );
 
-                                       /* fall through */
+                                       /*FALLTHROUGH*/
 
                                case EOB_ACT_END_OF_FILE:
                                        {
-                                       if ( yywrap() )
+                                       if ( FtaParserwrap( ) )
                                                return EOF;
 
-                                       if ( ! yy_did_buffer_switch_on_eof )
+                                       if ( ! (yy_did_buffer_switch_on_eof) )
                                                YY_NEW_FILE;
 #ifdef __cplusplus
                                        return yyinput();
@@ -2007,167 +2182,165 @@ 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 FtaParsertext */
+       (yy_hold_char) = *++(yy_c_buf_p);
 
        return c;
-       }
-#endif /* YY_NO_INPUT */
-
-#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 FtaParserrestart  (FILE * input_file )
+{
+    
+       if ( ! YY_CURRENT_BUFFER ){
+        FtaParserensure_buffer_stack ();
+               YY_CURRENT_BUFFER_LVALUE =
+            FtaParser_create_buffer(FtaParserin,YY_BUF_SIZE );
        }
 
+       FtaParser_init_buffer(YY_CURRENT_BUFFER,input_file );
+       FtaParser_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 FtaParser_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+{
+    
+       /* TODO. We should be able to replace this entire function body
+        * with
+        *              FtaParserpop_buffer_state();
+        *              FtaParserpush_buffer_state(new_buffer);
+     */
+       FtaParserensure_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;
+       FtaParser_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
+        * EOF (FtaParserwrap()) processing, but the only time this flag
+        * is looked at is after FtaParserwrap() 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;
-       }
+       (yy_did_buffer_switch_on_eof) = 1;
+}
 
+static void FtaParser_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;
+       FtaParserin = YY_CURRENT_BUFFER_LVALUE->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
-       {
+/** 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 FtaParser_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) FtaParseralloc(sizeof( struct yy_buffer_state )  );
        if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+               YY_FATAL_ERROR( "out of dynamic memory in FtaParser_create_buffer()" );
 
-       b->yy_buf_size = size;
+       b->yy_buf_size = (yy_size_t)size;
 
        /* yy_ch_buf has to be 2 characters longer than the size given because
         * we need to put in 2 end-of-buffer characters.
         */
-       b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+       b->yy_ch_buf = (char *) FtaParseralloc(b->yy_buf_size + 2  );
        if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+               YY_FATAL_ERROR( "out of dynamic memory in FtaParser_create_buffer()" );
 
        b->yy_is_our_buffer = 1;
 
-       yy_init_buffer( b, file );
+       FtaParser_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 FtaParser_create_buffer()
+ * 
+ */
+    void FtaParser_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 );
-       }
+               FtaParserfree((void *) b->yy_ch_buf  );
 
+       FtaParserfree((void *) b  );
+}
 
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a FtaParserrestart() or at EOF.
+ */
+    static void FtaParser_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
-#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
-
-
-       {
-       yy_flush_buffer( b );
+{
+       int oerrno = errno;
+    
+       FtaParser_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 is the current buffer, then FtaParser_init_buffer was _probably_
+     * called from FtaParserrestart() 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;
+}
 
-       {
-       if ( ! b )
+/** 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 FtaParser_flush_buffer (YY_BUFFER_STATE  b )
+{
+       if ( ! b )
                return;
 
        b->yy_n_chars = 0;
@@ -2184,31 +2357,127 @@ 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 )
+               FtaParser_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 FtaParserpush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+       if (new_buffer == NULL)
+               return;
+
+       FtaParserensure_buffer_stack();
+
+       /* This block is copied from FtaParser_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 FtaParser_switch_to_buffer. */
+       FtaParser_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 FtaParserpop_buffer_state (void)
+{
+       if (!YY_CURRENT_BUFFER)
+               return;
+
+       FtaParser_delete_buffer(YY_CURRENT_BUFFER );
+       YY_CURRENT_BUFFER_LVALUE = NULL;
+       if ((yy_buffer_stack_top) > 0)
+               --(yy_buffer_stack_top);
+
+       if (YY_CURRENT_BUFFER) {
+               FtaParser_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 FtaParserensure_buffer_stack (void)
+{
+       yy_size_t 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; /* After all that talk, this was set to 1 anyways... */
+               (yy_buffer_stack) = (struct yy_buffer_state**)FtaParseralloc
+                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in FtaParserensure_buffer_stack()" );
+                                                                 
+               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+                               
+               (yy_buffer_stack_max) = num_to_alloc;
+               (yy_buffer_stack_top) = 0;
+               return;
+       }
 
-#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. */
+               yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+               num_to_alloc = (yy_buffer_stack_max) + grow_size;
+               (yy_buffer_stack) = (struct yy_buffer_state**)FtaParserrealloc
+                                                               ((yy_buffer_stack),
+                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in FtaParserensure_buffer_stack()" );
+
+               /* 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 FtaParser_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) FtaParseralloc(sizeof( struct yy_buffer_state )  );
        if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+               YY_FATAL_ERROR( "out of dynamic memory in FtaParser_scan_buffer()" );
 
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
        b->yy_buf_pos = b->yy_ch_buf = base;
@@ -2220,58 +2489,53 @@ yy_size_t size;
        b->yy_fill_buffer = 0;
        b->yy_buffer_status = YY_BUFFER_NEW;
 
-       yy_switch_to_buffer( b );
+       FtaParser_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
+}
 
+/** Setup the input buffer state to scan a string. The next call to FtaParserlex() will
+ * scan from a @e copy of @a str.
+ * @param yystr 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
+ *       FtaParser_scan_bytes() instead.
+ */
+YY_BUFFER_STATE FtaParser_scan_string (yyconst char * yystr )
+{
+    
+       return FtaParser_scan_bytes(yystr,strlen(yystr) );
+}
 
-#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 the given bytes. The next call to FtaParserlex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * 
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE FtaParser_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
+{
        YY_BUFFER_STATE b;
        char *buf;
        yy_size_t n;
-       int i;
-
+       yy_size_t i;
+    
        /* Get memory for full buffer, including space for trailing EOB's. */
-       n = len + 2;
-       buf = (char *) yy_flex_alloc( n );
+       n = _yybytes_len + 2;
+       buf = (char *) FtaParseralloc(n  );
        if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+               YY_FATAL_ERROR( "out of dynamic memory in FtaParser_scan_bytes()" );
 
-       for ( i = 0; i < len; ++i )
-               buf[i] = bytes[i];
+       for ( i = 0; i < _yybytes_len; ++i )
+               buf[i] = yybytes[i];
 
-       buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
-       b = yy_scan_buffer( buf, n );
+       b = FtaParser_scan_buffer(buf,n );
        if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+               YY_FATAL_ERROR( "bad buffer in FtaParser_scan_bytes()" );
 
        /* It's okay to grow etc. this buffer, and we should throw it
         * away when we're done.
@@ -2279,148 +2543,198 @@ int len;
        b->yy_is_our_buffer = 1;
 
        return b;
-       }
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
 #endif
 
+static void yy_fatal_error (yyconst char* msg )
+{
+                       (void) fprintf( stderr, "%s\n", msg );
+       exit( YY_EXIT_FAILURE );
+}
 
-#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;
+/* Redefine yyless() so it works in section 3 code. */
 
-               yy_start_stack_depth += YY_START_STACK_INCR;
-               new_size = yy_start_stack_depth * sizeof( int );
+#undef yyless
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up FtaParsertext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+               FtaParsertext[FtaParserleng] = (yy_hold_char); \
+               (yy_c_buf_p) = FtaParsertext + yyless_macro_arg; \
+               (yy_hold_char) = *(yy_c_buf_p); \
+               *(yy_c_buf_p) = '\0'; \
+               FtaParserleng = yyless_macro_arg; \
+               } \
+       while ( 0 )
 
-               if ( ! yy_start_stack )
-                       yy_start_stack = (int *) yy_flex_alloc( new_size );
+/* Accessor  methods (get/set functions) to struct members. */
 
-               else
-                       yy_start_stack = (int *) yy_flex_realloc(
-                                       (void *) yy_start_stack, new_size );
+/** Get the current line number.
+ * 
+ */
+int FtaParserget_lineno  (void)
+{
+        
+    return FtaParserlineno;
+}
 
-               if ( ! yy_start_stack )
-                       YY_FATAL_ERROR(
-                       "out of memory expanding start-condition stack" );
-               }
+/** Get the input stream.
+ * 
+ */
+FILE *FtaParserget_in  (void)
+{
+        return FtaParserin;
+}
 
-       yy_start_stack[yy_start_stack_ptr++] = YY_START;
+/** Get the output stream.
+ * 
+ */
+FILE *FtaParserget_out  (void)
+{
+        return FtaParserout;
+}
 
-       BEGIN(new_state);
-       }
-#endif
+/** Get the length of the current token.
+ * 
+ */
+yy_size_t FtaParserget_leng  (void)
+{
+        return FtaParserleng;
+}
 
+/** Get the current token.
+ * 
+ */
 
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
-       {
-       if ( --yy_start_stack_ptr < 0 )
-               YY_FATAL_ERROR( "start-condition stack underflow" );
+char *FtaParserget_text  (void)
+{
+        return FtaParsertext;
+}
 
-       BEGIN(yy_start_stack[yy_start_stack_ptr]);
-       }
-#endif
+/** Set the current line number.
+ * @param _line_number line number
+ * 
+ */
+void FtaParserset_lineno (int  _line_number )
+{
+    
+    FtaParserlineno = _line_number;
+}
 
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ * 
+ * @see FtaParser_switch_to_buffer
+ */
+void FtaParserset_in (FILE *  _in_str )
+{
+        FtaParserin = _in_str ;
+}
 
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
-       {
-       return yy_start_stack[yy_start_stack_ptr - 1];
-       }
-#endif
+void FtaParserset_out (FILE *  _out_str )
+{
+        FtaParserout = _out_str ;
+}
 
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
+int FtaParserget_debug  (void)
+{
+        return FtaParser_flex_debug;
+}
 
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
+void FtaParserset_debug (int  _bdebug )
+{
+        FtaParser_flex_debug = _bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+        /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from FtaParserlex_destroy(), so don't allocate here.
+     */
+
+    (yy_buffer_stack) = 0;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+    (yy_c_buf_p) = (char *) 0;
+    (yy_init) = 0;
+    (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    FtaParserin = stdin;
+    FtaParserout = stdout;
 #else
-static void yy_fatal_error( msg )
-char msg[];
+    FtaParserin = (FILE *) 0;
+    FtaParserout = (FILE *) 0;
 #endif
-       {
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
-       }
 
+    /* For future reference: Set errno on error, since we are called by
+     * FtaParserlex_init()
+     */
+    return 0;
+}
 
+/* FtaParserlex_destroy is for both reentrant and non-reentrant scanners. */
+int FtaParserlex_destroy  (void)
+{
+    
+    /* Pop the buffer stack, destroying each element. */
+       while(YY_CURRENT_BUFFER){
+               FtaParser_delete_buffer(YY_CURRENT_BUFFER  );
+               YY_CURRENT_BUFFER_LVALUE = NULL;
+               FtaParserpop_buffer_state();
+       }
 
-/* Redefine yyless() so it works in section 3 code. */
+       /* Destroy the stack itself. */
+       FtaParserfree((yy_buffer_stack) );
+       (yy_buffer_stack) = NULL;
 
-#undef yyless
-#define yyless(n) \
-       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; \
-               } \
-       while ( 0 )
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * FtaParserlex() is called, initialization will occur. */
+    yy_init_globals( );
 
+    return 0;
+}
 
-/* Internal utility routines. */
+/*
+ * 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
-       {
-       register int i;
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+               
+       int 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
-       {
-       register int n;
+static int yy_flex_strlen (yyconst char * s )
+{
+       int n;
        for ( n = 0; s[n]; ++n )
                ;
 
        return n;
-       }
+}
 #endif
 
+void *FtaParseralloc (yy_size_t  size )
+{
+                       return (void *) malloc( size );
+}
 
-#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
-       {
-       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 *FtaParserrealloc  (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
@@ -2429,26 +2743,17 @@ 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 FtaParserfree (void * ptr )
+{
+                       free( (char *) ptr );   /* see FtaParserrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 262 "fta.l"
 
-#if YY_MAIN
-int main()
-       {
-       yylex();
-       return 0;
-       }
-#endif
-#line 245 "fta.l"
 
 
 int my_FtaParser_yyinput(char *buf, int max_size){
@@ -2503,3 +2808,4 @@ void FtaParser_setstringinput(char *s){
                
 
 
+
index aea03a8..55227b1 100644 (file)
@@ -169,6 +169,36 @@ string generate_fj_struct_name(string node_name){
        return(ret);
 }
 
+string generate_watchlist_element_name(string node_name){
+       string ret = normalize_name(node_name);
+       if(ret == ""){
+               ret = "default";
+       }
+       ret += "__wl_elem";
+
+       return(ret);
+}
+
+string generate_watchlist_struct_name(string node_name){
+       string ret = normalize_name(node_name);
+       if(ret == ""){
+               ret = "default";
+       }
+       ret += "__wl_struct";
+
+       return(ret);
+}
+
+string generate_watchlist_name(string node_name){
+       string ret = normalize_name(node_name);
+       if(ret == ""){
+               ret = "default";
+       }
+       ret += "__wl";
+
+       return(ret);
+}
+
 string generate_unpack_code(int tblref, int schref, string field, table_list *schema, string node_name, string end_goto = string("end")){
        string ret;
        if(! packed_return){
@@ -246,14 +276,178 @@ string generate_fj_struct(filter_join_qpn *fs, string node_name ){
   return(ret);
 }
 
+string generate_watchlist_structs(string node_name, table_def *tbl,
+               std::string filename, int refresh_interval){
+       string ret;
 
+       ret += "struct "+generate_watchlist_element_name(node_name)+"{\n";
+       vector<field_entry *> fields = tbl->get_fields();
+       for(int f=0;f<fields.size();++f){
+               data_type dt(fields[f]->get_type());
+               ret += "\t"+dt.make_cvar(fields[f]->get_name())+";\n";
+       }
+       ret += "\tgs_uint64_t hashval;\n";
+       ret += "\tstruct "+generate_watchlist_element_name(node_name)+" *next;\n";
+       ret += "};\n\n";
 
+       ret += "char *"+generate_watchlist_name(node_name)+"__fstr = \""+filename+"\";\n";
+       ret += "struct "+generate_watchlist_struct_name(node_name)+"{\n";
+       ret += "\tstruct "+ generate_watchlist_element_name(node_name)+" **ht;\n";
+       ret += "\tgs_uint32_t ht_size;\n";
+       ret += "\tgs_uint32_t n_elem;\n";
+       ret += "\tgs_uint32_t refresh_interval;\n";
+       ret += "\ttime_t next_refresh;\n";
+       ret += "\ttime_t last_mtime;\n";        
+       ret += "\tchar *filename;\n";
+       ret += "} "+generate_watchlist_name(node_name)+" = { NULL, 0, 0, "+std::to_string(refresh_interval)+", 0, 0, NULL};\n\n";
+
+       return ret;
+}
 
+string generate_watchlist_load(string node_name, table_def *tbl, vector<string> keys){
+       string ret;
+       string tgt = generate_watchlist_name(node_name);
+       vector<field_entry *> fields = tbl->get_fields();
+
+       ret += "void reload_watchlist__"+node_name+"(){\n";
+       ret += "\tgs_uint32_t i;\n";
+       ret += "\tstruct "+generate_watchlist_element_name(node_name)+" *ptr = NULL;\n";
+       ret += "\tstruct "+generate_watchlist_element_name(node_name)+" *next = NULL;\n";
+       ret += "\tFILE *fl;\n";
+       ret += "\tchar buf[10000];\n";
+       ret += "\tgs_uint32_t buflen = 10000;\n";
+       ret += "\tchar *flds["+std::to_string(fields.size())+"];\n";
+       ret += "\tgs_uint32_t pos, f, linelen, malformed;\n";
+       ret += "\tgs_uint32_t n_malformed, short_lines, toolong_lines, ok;\n";
+       ret += "\tgs_uint64_t hash, bucket;\n";
+       ret += "\tstruct "+generate_watchlist_element_name(node_name)+" *rec;\n\n";
+
+       ret += "//  make sure watchlist file has changed since the last time we loaded it\n";
+    ret += "\tstruct stat file_stat;\n";
+    ret += "\tint err = stat(" + tgt + ".filename, &file_stat);\n";
+    ret += "\tif (err) {\n";
+    ret += "\t\tgslog(LOG_INFO,\"Warning, unable to stat() watchlist file %s to reload " + node_name + ", continue using old version\\n\", " + tgt + ".filename);\n";
+    ret += "\t\treturn;\n";
+    ret += "\t}\n";
+       ret += "\tif (file_stat.st_mtime <= " + tgt + ".last_mtime && file_stat.st_ctime <= " + tgt + ".last_mtime)     // watchlist file hasn't changed since last time\n";
+       ret += "\t\treturn;\n";
+       ret += "\t" + tgt + ".last_mtime = (file_stat.st_mtime>file_stat.st_ctime)?file_stat.st_mtime:file_stat.st_ctime;\n\n";
+
+       ret += "//  Delete old entries.\n";
+       ret += "\tfor(i=0;i<"+tgt+".ht_size;++i){\n";
+       ret += "\t\tptr="+tgt+".ht[i];\n";
+       ret += "\t\twhile(ptr!=NULL){\n";
+       for(int f=0;f<fields.size();++f){
+               data_type dt(fields[f]->get_type());
+               if(dt.is_buffer_type()){
+                       ret += "\t\t\t"+dt.get_buffer_destroy()+"(&(ptr->"+fields[f]->get_name()+"));\n";
+               }
+       }
+       ret += "\t\t\tnext = ptr->next;\n";
+       ret += "\t\t\tfree(ptr);\n";
+       ret += "\t\t\tptr = next;\n";
+       ret += "\t\t}\n";
+       ret += "\t}\n";
+       ret += "\n// prepare new table. \n";
+       ret += "\tif("+tgt+".n_elem > "+tgt+".ht_size || "+tgt+".ht_size==0){\n";
+       ret += "\t\tif("+tgt+".ht)\n";
+       ret += "\t\t\tfree("+tgt+".ht);\n";
+       ret += "\t\tif("+tgt+".ht_size == 0)\n";
+       ret += "\t\t\t"+tgt+".ht_size = 100000;\n";
+       ret += "\t\telse\n";    
+       ret += "\t\t\t"+tgt+".ht_size = "+tgt+".n_elem;\n";
+       ret += "\t\t"+tgt+".ht = (struct "+generate_watchlist_element_name(node_name)+" **)malloc("+tgt+".ht_size * sizeof(struct "+generate_watchlist_element_name(node_name)+" *));\n";
+       ret += "\t}\n";
+       ret += "\tfor(i=0;i<"+tgt+".ht_size;++i){\n";
+       ret += "\t\t"+tgt+".ht[i] = NULL;\n";
+       ret += "\t}\n";
+       ret += "\n// load new table\n";
+       ret += "\t"+tgt+".n_elem = 0;\n";
+       ret += "\tfl = fopen("+tgt+".filename, \"r\");\n";
+       ret += "\tif(fl==NULL){\n";
+       ret += "\t\tgslog(LOG_INFO,\"Warning, can't open file %s for watchlist "+node_name+"\\n\","+tgt+".filename);\n";
+       ret += "\t\treturn;\n";
+       ret += "\t}\n";
+       ret += "\tmalformed = 0;\n";
+       ret += "\tshort_lines = 0;\n";
+       ret += "\ttoolong_lines = 0;\n";
+       ret += "\twhile(fgets(buf, buflen, fl) != NULL){\n";
+       ret += "\t\tlinelen = strlen(buf);\n";
+       ret += "\t\tbuf[linelen-1]='\\0';       // strip off trailing newline\n";
+       ret += "\t\tlinelen--;\n";
+
+       ret += "\t\tpos=0;\n";
+       ret += "\t\tmalformed=0;\n";
+       ret += "\t\tok=1;\n";
+       ret += "\t\tflds[0] = buf;\n";
+       ret += "\t\tfor(f=1;pos < linelen && f<"+std::to_string(fields.size())+";++f){\n";
+       ret += "\t\t\tfor(;pos < linelen && buf[pos]!=',' && buf[pos]!='\\n';++pos);\n";
+       ret += "\t\t\tif(pos >= linelen){\n";
+       ret += "\t\t\t\tmalformed = 1;\n";
+       ret += "\t\t\t\tbreak;\n";
+       ret += "\t\t\t}\n";
+       ret += "\t\t\tbuf[pos]='\\0';\n";
+       ret += "\t\t\tpos++;\n";
+       ret += "\t\t\tflds[f]=buf+pos;\n";
+       ret += "\t\t}\n";
+       ret += "\t\tif(malformed){\n";
+       ret += "\t\t\tok=0;\n";
+       ret += "\t\t\tn_malformed++;\n";
+       ret += "\t\t}\n";
+       ret += "\t\tif(f<"+std::to_string(fields.size())+"){\n";
+       ret += "\t\t\tok=0;\n";
+       ret += "\t\t\tshort_lines++;\n";
+       ret += "\t\t}\n";
+       ret += "\t\tif(pos && (pos<linelen)){\n";
+       ret += "\t\t\tok=0;\n";
+       ret += "\t\t\ttoolong_lines++;\n";
+       ret += "\t\t}\n";
+       ret += "\t\tif(f>="+std::to_string(fields.size())+"){\n";
+       ret += "\t\t\trec = (struct "+generate_watchlist_element_name(node_name)+" *)malloc(sizeof(struct "+generate_watchlist_element_name(node_name)+"));\n";
+//             Extract fields
+       for(int f=0;f<fields.size();++f){
+               data_type dt(fields[f]->get_type());
+               ret += "\t\t\t"+dt.get_wl_extract_fcn()+"(flds["+std::to_string(f)+"], &(rec->"+fields[f]->get_name()+"));\n";
+       }
+//             Compute the hash value
+       ret += "\t\t\thash=0;\n";
+       for(int k=0;k<keys.size();++k){
+               string key_fld = keys[k];
+               int f;
+               for(f=0;f<fields.size();++f){
+                       if(fields[f]->get_name() == key_fld)
+                               break;
+               }
+               data_type dt(fields[f]->get_type());
+
+               ret +=
+"\t\t\thash ^= (("+hash_nums[f%NRANDS]+" * lfta_"+
+                       dt.get_type_str()+"_to_hash(rec->"+fields[f]->get_name()+")));\n";
+               }
+       ret += "\t\t\tbucket = (hash>>32) \% "+tgt+".ht_size;\n";
+       ret += "\t\t\trec->hashval = hash;\n";
+       ret += "\t\t\trec->next = "+tgt+".ht[bucket];\n";
+       ret += "\t\t\t"+tgt+".ht[bucket] = rec;\n";
+       ret += "\t\t\t"+tgt+".n_elem++;\n";
+
+       ret += "\t\t}\n";
+       ret += "\t}\n";
+       ret += "\tif(n_malformed+toolong_lines > 0){\n";
+       ret += "\t\tgslog(LOG_INFO,\"Errors reading data for watchlist "+node_name+" from file %s: malformed=%d, too short=%d, too long=%d\\n\","+tgt+".filename, malformed, short_lines, toolong_lines);\n";
+       ret += "\t}\n";
+       ret += "}\n\n";
+
+       return ret;
+}
+
+
+
+               
 string generate_fta_struct(string node_name, gb_table *gb_tbl,
                aggregate_table *aggr_tbl, param_table *param_tbl,
                cplx_lit_table *complex_literals,
                vector<handle_param_tbl_entry *> &param_handle_table,
-               bool is_aggr_query, bool is_fj, bool uses_bloom,
+               bool is_aggr_query, bool is_fj, bool is_wj, bool uses_bloom,
                table_list *schema){
 
        string ret = "struct " + generate_fta_name(node_name) + "{\n";
@@ -337,6 +531,12 @@ string generate_fta_struct(string node_name, gb_table *gb_tbl,
 
        }
 
+// --------------------------------------------
+//             watchlist-join specific
+       if(is_wj){
+               ret += "\ttime_t ux_time;\n";
+       }
+
 //--------------------------------------------------------
 //                     Common fields
 
@@ -1174,6 +1374,7 @@ string generate_preamble(table_list *schema, //map<string,string> &int_fcn_defs,
        ret += "#include<stdio.h>\n";
        ret += "#include <limits.h>\n";
        ret += "#include <float.h>\n";
+       ret += "#include <sys/stat.h>\n";
        ret += "#include \"rdtsc.h\"\n";
        ret += "#endif\n";
 
@@ -1766,7 +1967,7 @@ string generate_fta_control(string node_name, table_list *schema, bool is_aggr_q
        return(ret);
 }
 
-string generate_fta_clock(string node_name, table_list *schema, unsigned time_corr, bool is_aggr_query){
+string generate_fta_clock(string node_name, table_list *schema, unsigned time_corr, bool is_aggr_query, bool advance_uxtime){
        string ret="static gs_retval_t clock_fta_"+node_name+"(struct FTA *f){\n";
        ret += "\tstruct "+generate_fta_name(node_name)+" * t = (struct ";
                ret += generate_fta_name(node_name)+" *) f;\n\n";
@@ -1879,6 +2080,11 @@ string generate_fta_clock(string node_name, table_list *schema, unsigned time_co
                }
        }
 
+
+       if(advance_uxtime){
+               ret += "\tt->ux_time = time(&(t->ux_time));\n";
+       }
+
        // for aggregation lftas we need to check if the time was advanced beyond the current epoch
        if (is_aggr_query) {
 
@@ -2284,6 +2490,7 @@ string ret;
        return ret;
 }
 
+//     TODO Ensure that postfilter predicates are being generated
 string generate_fj_accept_body(filter_join_qpn *fs, string node_name,col_id_set &unpacked_cids,ext_fcn_list *Ext_fcns, table_list *schema){
 
 int p,s,w;
@@ -2587,14 +2794,14 @@ printf("n_bloom=%d, window_len=%d, bloom_width=%s, bf_exp_size=%d, bf_bit_size=%
 
 //             WARNING! the constant 20 below is a wild-ass guess.
        int cheap_rpos;
-       for(cheap_rpos=0;cheap_rpos<r_filt.size() && r_filt[cheap_rpos]->cost <= 20;cheap_rpos++)
+       for(cheap_rpos=0;cheap_rpos<r_filt.size() && r_filt[cheap_rpos]->cost <= 20;cheap_rpos++);
 
 //             Test the cheap filters on R.
   if(cheap_rpos >0){
 
 //             Now generate the predicates.
        for(w=0;w<cheap_rpos;++w){
-               sprintf(tmpstr,"//\t\tPredicate clause %d.(cost %d)\n",w,r_filt[w]->cost);
+               sprintf(tmpstr,"//\t\tcheap R predicate clause %d. (cost %d)\n",w,r_filt[w]->cost);
                ret += tmpstr;
 
 //                     Find partial fcns ref'd in this cnf element
@@ -2815,6 +3022,463 @@ printf("n_bloom=%d, window_len=%d, bloom_width=%s, bf_exp_size=%d, bf_bit_size=%
          }
 
 
+//             The size of the tuple is the size of the tuple struct plus the
+//             size of the buffers to be copied in.
+
+         ret+="\ttuple_size = sizeof( struct "+generate_tuple_name(node_name)+")";
+         for(s=0;s<sl_list.size();s++){
+               data_type *sdt = sl_list[s]->get_data_type();
+               if(sdt->is_buffer_type()){
+                       sprintf(tmpstr," + %s(&selvar_%d)", sdt->get_buffer_size().c_str(),s);
+                       ret += tmpstr;
+               }
+         }
+         ret += ";\n";
+
+
+         ret += "\ttuple = allocate_tuple(f, tuple_size );\n";
+         ret += "\tif( tuple == NULL)\n\t\tgoto end;\n";
+
+//                     Test passed, make assignments to the tuple.
+
+         ret += "\ttuple_pos = sizeof( struct "+generate_tuple_name(node_name)+");\n";
+
+//                     Mark tuple as REGULAR_TUPLE
+         ret += "\ttuple->tuple_type = REGULAR_TUPLE;\n";
+
+
+         for(s=0;s<sl_list.size();s++){
+               data_type *sdt = sl_list[s]->get_data_type();
+               if(sdt->is_buffer_type()){
+                       sprintf(tmpstr,"\t%s(&(tuple->tuple_var%d), &selvar_%d, (char *)tuple, ((char *)tuple)+tuple_pos);\n", sdt->get_buffer_tuple_copy().c_str(),s, s);
+                       ret += tmpstr;
+                       sprintf(tmpstr,"\ttuple_pos += %s(&selvar_%d);\n", sdt->get_buffer_size().c_str(), s);
+                       ret += tmpstr;
+               }else{
+                       sprintf(tmpstr,"\ttuple->tuple_var%d = ",s);
+                       ret += tmpstr;
+//                     if(sdt->needs_hn_translation())
+//                             ret += sdt->hton_translation() +"( ";
+                       ret += generate_se_code(sl_list[s],schema);
+//                     if(sdt->needs_hn_translation())
+//                             ret += ") ";
+                       ret += ";\n";
+               }
+         }
+
+//             Generate output.
+
+         ret += "\tpost_tuple(tuple);\n";
+
+//             Increment the counter of posted tuples
+  ret += "\n\t#ifdef LFTA_STATS\n";
+  ret += "\n\tt->out_tuple_cnt++;\n\n";
+  ret+="\t\t\t\tt->out_tuple_sz+=tuple_size;\n";
+  ret += "\t#endif\n\n";
+
+
+       return ret;
+}
+
+
+string generate_wj_accept_body(watch_join_qpn *fs, string node_name,col_id_set &unpacked_cids,ext_fcn_list *Ext_fcns, table_list *schema){
+
+int p,s,w;
+string ret;
+
+
+       string wl_schema = fs->from[1]->get_schema_name();
+       string wl_elem_str = generate_watchlist_element_name(wl_schema);
+       string wl_node_str = generate_watchlist_struct_name(wl_schema);
+       string tgt = generate_watchlist_name(wl_schema);
+
+       ret += "//\n//\t\tGenerate test to update watchtable here\n//\n\n";
+
+
+
+
+
+//     ------------------------------------------------------------
+//             Determine if the R record should be processed.
+
+
+       ret +=
+"//            R (main stream) cheap predicate\n"
+"\n"
+;
+
+//             Unpack r_filt fields
+       vector<cnf_elem *> r_filt = fs->pred_t0;
+       for(w=0;w<r_filt.size();++w){
+               col_id_set this_pred_cids;
+               gather_pr_col_ids(r_filt[w]->pr, this_pred_cids, gb_tbl);
+               for(auto csi=this_pred_cids.begin();csi!=this_pred_cids.end();++csi){
+                       if(unpacked_cids.count( (*csi) ) == 0){
+                               int tblref = (*csi).tblvar_ref;
+                               int schref = (*csi).schema_ref;
+                               string field = (*csi).field;
+                               ret += generate_unpack_code(tblref,schref,field,schema,node_name);
+                               unpacked_cids.insert( (*csi) );
+                       }
+               }
+       }
+
+// Sort R preds based on cost.
+
+       vector<cnf_elem *> tmp_wh;
+       for(w=0;w<r_filt.size();++w){
+               compute_cnf_cost(r_filt[w],Ext_fcns);
+               tmp_wh.push_back(r_filt[w]);
+       }
+       r_filt = tmp_wh;
+
+       sort(r_filt.begin(), r_filt.end(), compare_cnf_cost());
+
+//             WARNING! the constant 20 below is a wild-ass guess.
+       int cheap_rpos;
+       for(cheap_rpos=0;cheap_rpos<r_filt.size() && r_filt[cheap_rpos]->cost <= 20;cheap_rpos++);
+
+//             Test the cheap filters on R.
+  if(cheap_rpos >0){
+
+//             Now generate the predicates.
+       for(w=0;w<cheap_rpos;++w){
+               sprintf(tmpstr,"//\t\tCheap R predicate clause %d.(cost %d)\n",w,r_filt[w]->cost);
+               ret += tmpstr;
+
+//                     Find partial fcns ref'd in this cnf element
+               set<int> pfcn_refs;
+               collect_partial_fcns_pr(r_filt[w]->pr, pfcn_refs);
+//                     Since set<..> is a "Sorted Associative Container",
+//                     we can walk through it in sorted order by walking from
+//                     begin() to end().  (and the partial fcns must be
+//                     evaluated in this order).
+               set<int>::iterator si;
+               for(si=pfcn_refs.begin();si!=pfcn_refs.end();++si){
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               ret += "\tif(fcn_ref_cnt_"+int_to_string((*si))+"==0){\n";
+                       }
+                       if(is_partial_fcn[(*si)]){
+                               ret += "\t"+unpack_partial_fcn(partial_fcns[(*si)], (*si), schema);
+                               ret += "\t\tif(retval) goto end;\n";
+                       }
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               if(!is_partial_fcn[(*si)]){
+                                       ret += "\t\tpartial_fcn_result_"+int_to_string((*si))+"="+generate_cached_fcn(partial_fcns[(*si)],schema)+";\n";
+                               }
+                               ret += "\t\tfcn_ref_cnt_"+int_to_string((*si))+"=1;\n";
+                               ret += "\t}\n";
+                       }
+               }
+
+               ret += "\tif( !("+generate_predicate_code(r_filt[w]->pr,schema)+
+                               ") ) goto end;\n";
+       }
+  }else{
+         ret += "\n\n/*\t\t (no cheap R predicate to test)\t*/\n\n";
+  }
+
+       ret += "\n/*\tPassed the WHERE clause, unpack the hash fields. */\n";
+       map<string, cnf_elem *> h_eq = ((watch_join_qpn *)fs)-> hash_eq;
+       vector<string> kflds = ((watch_join_qpn *)fs)->key_flds;
+       for(w=0;w<kflds.size();++w){
+               string kfld = kflds[w];
+               col_id_set this_pred_cids;
+               gather_pr_col_ids(h_eq[kfld]->pr, this_pred_cids, gb_tbl);
+               for(auto csi=this_pred_cids.begin();csi!=this_pred_cids.end();++csi){
+                       if(unpacked_cids.count( (*csi) ) == 0){
+                               int tblref = (*csi).tblvar_ref;
+                               int schref = (*csi).schema_ref;
+                               string field = (*csi).field;
+                               if(tblref==0) // LHS from packet, don't unpack the RHS
+                                       ret += generate_unpack_code(tblref,schref,field,schema,node_name);
+                               unpacked_cids.insert( (*csi) );
+                       }
+               }
+       }
+
+
+       ret += "\n//    Do the join\n\n";
+       ret += "\n//            (ensure that the watchtable is fresh)\n";
+       ret += "\tif(t->ux_time >= "+tgt+".next_refresh){\n";
+       ret += "\t\treload_watchlist__"+wl_schema+"();\n";
+       ret += "\t\t"+tgt+".next_refresh = t->ux_time+"+tgt+".refresh_interval;\n";
+       ret += "\t}\n\n";
+
+
+       for(p=0;p<fs->key_flds.size();++p){
+               string kfld = fs->key_flds[p];
+               ret += "\tr_equijoin_"+kfld+" = "+generate_se_code(fs->hash_eq[kfld]->pr->get_left_se(),schema)+";\n";
+       }
+
+
+//                     Passed the cheap pred, now test the join with S.
+       ret += "\tbucket=0;\n";
+       ret += "\thash=0;\n";
+       for(p=0;p<fs->key_flds.size();++p){
+               string kfld = fs->key_flds[p];
+               ret +=
+"              hash ^= (("+hash_nums[p%NRANDS]+" * lfta_"+
+       fs->hash_eq[kfld]->pr->get_left_se()->get_data_type()->get_type_str()+
+       +"_to_hash(r_equijoin_"+kfld+")));\n";
+       }
+       ret += "\t\tbucket = (hash>>32) \% "+tgt+".ht_size;\n";
+
+       ret += "\t\trec = "+tgt+".ht[bucket];\n";
+       ret += "\t\twhile(rec!=NULL){\n";
+       ret += "\t\t\tif(hash==rec->hashval){\n";
+       ret += "\t\t\t\tif(";
+       for(p=0;p<fs->key_flds.size();++p){
+               string kfld = fs->key_flds[p];
+               if(p>0) ret += " && ";
+               data_type *hdt = fs->hash_eq[kfld]->pr->get_right_se()->get_data_type();
+               string lhs_op = "r_equijoin_"+kfld;
+               string rhs_op = "rec->"+kfld;
+               ret += generate_equality_test(lhs_op,rhs_op,hdt);
+       }
+       ret += ")\n";
+       ret += "\t\t\t\t\tbreak;\n";
+       ret += "\t\t\t}\n";
+       ret += "\t\t\trec=rec->next;\n";
+       ret += "\t\t}\n";
+       ret += "\t\tif(rec==NULL)\n";
+       ret += "\t\t\tgoto end;\n";
+               
+       ret += "\n/*\tPassed the hash lookup clause, unpack the other predicate fields. */\n";
+       for(w=0;w<where.size();++w){
+               col_id_set this_pred_cids;
+               gather_pr_col_ids(where[w]->pr, this_pred_cids, gb_tbl);
+               for(auto csi=this_pred_cids.begin();csi!=this_pred_cids.end();++csi){
+                       if(unpacked_cids.count( (*csi) ) == 0){
+                               int tblref = (*csi).tblvar_ref;
+                               int schref = (*csi).schema_ref;
+                               string field = (*csi).field;
+                               if(tblref==0) // LHS from packet
+                                       ret += generate_unpack_code(tblref,schref,field,schema,node_name);
+                               else    // RHS from hash bucket
+                                       ret += "\tunpack_var_"+field+"_1 = rec->"+field+";\n";
+                               unpacked_cids.insert( (*csi) );
+                       }
+               }
+       }
+
+
+//             Test the expensive filters on R.
+//                     TODO Should merge this with other predicates and eval in order
+//                             of cost - see the fj code.
+//                     TODO join and postfilter predicates haven't been costed yet.
+  if(cheap_rpos < r_filt.size()){
+
+//             Now generate the predicates.
+       for(w=cheap_rpos;w<r_filt.size();++w){
+               sprintf(tmpstr,"//\t\tExpensive R predicate clause %d.(cost %d)\n",w,r_filt[w]->cost);
+               ret += tmpstr;
+
+//                     Find partial fcns ref'd in this cnf element
+               set<int> pfcn_refs;
+               collect_partial_fcns_pr(r_filt[w]->pr, pfcn_refs);
+//                     Since set<..> is a "Sorted Associative Container",
+//                     we can walk through it in sorted order by walking from
+//                     begin() to end().  (and the partial fcns must be
+//                     evaluated in this order).
+               set<int>::iterator si;
+               for(si=pfcn_refs.begin();si!=pfcn_refs.end();++si){
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               ret += "\tif(fcn_ref_cnt_"+int_to_string((*si))+"==0){\n";
+                       }
+                       if(is_partial_fcn[(*si)]){
+                               ret += "\t"+unpack_partial_fcn(partial_fcns[(*si)], (*si), schema);
+                               ret += "\t\tif(retval) goto end;\n";
+                       }
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               if(!is_partial_fcn[(*si)]){
+                                       ret += "\t\tpartial_fcn_result_"+int_to_string((*si))+"="+generate_cached_fcn(partial_fcns[(*si)],schema)+";\n";
+                               }
+                               ret += "\t\tfcn_ref_cnt_"+int_to_string((*si))+"=1;\n";
+                               ret += "\t}\n";
+                       }
+               }
+
+               ret += "\tif( !("+generate_predicate_code(r_filt[w]->pr,schema)+
+                               ") ) goto end;\n";
+       }
+  }else{
+         ret += "\n\n/*\t\t (no expensive R predicate to test)\t*/\n\n";
+  }
+
+//             TODO sort the additional predicates by cost
+
+//             S-only
+       for(w=0;w<fs->pred_t1.size();++w){
+               sprintf(tmpstr,"//\t\tS Predicate clause %d.(cost %d)\n",w,fs->pred_t1[w]->cost);
+               ret += tmpstr;
+
+//                     Find partial fcns ref'd in this cnf element
+               set<int> pfcn_refs;
+               collect_partial_fcns_pr(fs->pred_t1[w]->pr, pfcn_refs);
+//                     Since set<..> is a "Sorted Associative Container",
+//                     we can walk through it in sorted order by walking from
+//                     begin() to end().  (and the partial fcns must be
+//                     evaluated in this order).
+               set<int>::iterator si;
+               for(si=pfcn_refs.begin();si!=pfcn_refs.end();++si){
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               ret += "\tif(fcn_ref_cnt_"+int_to_string((*si))+"==0){\n";
+                       }
+                       if(is_partial_fcn[(*si)]){
+                               ret += "\t"+unpack_partial_fcn(partial_fcns[(*si)], (*si), schema);
+                               ret += "\t\tif(retval) goto end;\n";
+                       }
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               if(!is_partial_fcn[(*si)]){
+                                       ret += "\t\tpartial_fcn_result_"+int_to_string((*si))+"="+generate_cached_fcn(partial_fcns[(*si)],schema)+";\n";
+                               }
+                               ret += "\t\tfcn_ref_cnt_"+int_to_string((*si))+"=1;\n";
+                               ret += "\t}\n";
+                       }
+               }
+
+               ret += "\tif( !("+generate_predicate_code(fs->pred_t1[w]->pr,schema)+
+                               ") ) goto end;\n";
+       }
+
+//             non hash-eq join 
+       for(w=0;w<fs->join_filter.size();++w){
+               sprintf(tmpstr,"//\t\tJoin Predicate clause %d.(cost %d)\n",w,fs->join_filter[w]->cost);
+               ret += tmpstr;
+
+//                     Find partial fcns ref'd in this cnf element
+               set<int> pfcn_refs;
+               collect_partial_fcns_pr(fs->join_filter[w]->pr, pfcn_refs);
+//                     Since set<..> is a "Sorted Associative Container",
+//                     we can walk through it in sorted order by walking from
+//                     begin() to end().  (and the partial fcns must be
+//                     evaluated in this order).
+               set<int>::iterator si;
+               for(si=pfcn_refs.begin();si!=pfcn_refs.end();++si){
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               ret += "\tif(fcn_ref_cnt_"+int_to_string((*si))+"==0){\n";
+                       }
+                       if(is_partial_fcn[(*si)]){
+                               ret += "\t"+unpack_partial_fcn(partial_fcns[(*si)], (*si), schema);
+                               ret += "\t\tif(retval) goto end;\n";
+                       }
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               if(!is_partial_fcn[(*si)]){
+                                       ret += "\t\tpartial_fcn_result_"+int_to_string((*si))+"="+generate_cached_fcn(partial_fcns[(*si)],schema)+";\n";
+                               }
+                               ret += "\t\tfcn_ref_cnt_"+int_to_string((*si))+"=1;\n";
+                               ret += "\t}\n";
+                       }
+               }
+
+               ret += "\tif( !("+generate_predicate_code(fs->join_filter[w]->pr,schema)+
+                               ") ) goto end;\n";
+       }
+
+//             postfilter
+       for(w=0;w<fs->postfilter.size();++w){
+               sprintf(tmpstr,"//\t\tpostfilter Predicate clause %d.(cost %d)\n",w,fs->postfilter[w]->cost);
+               ret += tmpstr;
+
+//                     Find partial fcns ref'd in this cnf element
+               set<int> pfcn_refs;
+               collect_partial_fcns_pr(fs->postfilter[w]->pr, pfcn_refs);
+//                     Since set<..> is a "Sorted Associative Container",
+//                     we can walk through it in sorted order by walking from
+//                     begin() to end().  (and the partial fcns must be
+//                     evaluated in this order).
+               set<int>::iterator si;
+               for(si=pfcn_refs.begin();si!=pfcn_refs.end();++si){
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               ret += "\tif(fcn_ref_cnt_"+int_to_string((*si))+"==0){\n";
+                       }
+                       if(is_partial_fcn[(*si)]){
+                               ret += "\t"+unpack_partial_fcn(partial_fcns[(*si)], (*si), schema);
+                               ret += "\t\tif(retval) goto end;\n";
+                       }
+                       if(fcn_ref_cnt[(*si)] > 1){
+                               if(!is_partial_fcn[(*si)]){
+                                       ret += "\t\tpartial_fcn_result_"+int_to_string((*si))+"="+generate_cached_fcn(partial_fcns[(*si)],schema)+";\n";
+                               }
+                               ret += "\t\tfcn_ref_cnt_"+int_to_string((*si))+"=1;\n";
+                               ret += "\t}\n";
+                       }
+               }
+
+               ret += "\tif( !("+generate_predicate_code(fs->postfilter[w]->pr,schema)+
+                               ") ) goto end;\n";
+       }
+
+
+
+///////////////                        post the tuple
+
+//                     test passed : create the tuple, then assign to it.
+         ret += "/*\t\tCreate and post the tuple\t*/\n";
+
+//             Unpack R fields
+       for(s=0;s<sl_list.size();++s){
+               col_id_set this_se_cids;
+               gather_se_col_ids(sl_list[s], this_se_cids, gb_tbl);
+               for(auto csi=this_se_cids.begin();csi!=this_se_cids.end();++csi){
+                       if(unpacked_cids.count( (*csi) ) == 0){
+                               int tblref = (*csi).tblvar_ref;
+                               int schref = (*csi).schema_ref;
+                               string field = (*csi).field;
+                               if(tblref==0) // LHS from packet
+                                       ret += generate_unpack_code(tblref,schref,field,schema,node_name);
+                               else    // RHS from hash bucket
+                                       ret += "\tunpack_var_"+field+"_1 = rec->"+field+";\n";
+                               unpacked_cids.insert( (*csi) );
+                       }
+               }
+       }
+
+
+//                     Unpack partial fcns ref'd by the select clause.
+//                     Its a kind of a WHERE clause ...
+  for(p=sl_fcns_start;p<sl_fcns_end;p++){
+       if(fcn_ref_cnt[p] > 1){
+               ret += "\tif(fcn_ref_cnt_"+int_to_string(p)+"==0){\n";
+       }
+       if(is_partial_fcn[p]){
+               ret += unpack_partial_fcn(partial_fcns[p], p, schema);
+               ret += "\tif(retval) goto end;\n";
+       }
+       if(fcn_ref_cnt[p] > 1){
+               if(!is_partial_fcn[p]){
+                       ret += "\t\tpartial_fcn_result_"+int_to_string(p)+"="+generate_cached_fcn(partial_fcns[p],schema)+";\n";
+               }
+               ret += "\t\tfcn_ref_cnt_"+int_to_string(p)+"=1;\n";
+               ret += "\t}\n";
+       }
+  }
+
+  // increment the counter of accepted tuples
+  ret += "\n\t#ifdef LFTA_STATS\n";
+  ret += "\n\tt->accepted_tuple_cnt++;\n\n";
+  ret += "\t#endif\n\n";
+
+//                     First, compute the size of the tuple.
+
+//                     Unpack any BUFFER type selections into temporaries
+//                     so that I can compute their size and not have
+//                     to recompute their value during tuple packing.
+//                     I can use regular assignment here because
+//                     these temporaries are non-persistent.
+
+         for(s=0;s<sl_list.size();s++){
+               data_type *sdt = sl_list[s]->get_data_type();
+               if(sdt->is_buffer_type()){
+                       sprintf(tmpstr,"\tselvar_%d = ",s);
+                       ret += tmpstr;
+                       ret += generate_se_code(sl_list[s],schema);
+                       ret += ";\n";
+               }
+         }
+
+
 //             The size of the tuple is the size of the tuple struct plus the
 //             size of the buffers to be copied in.
 
@@ -3056,7 +3720,7 @@ printf("sgah_qpn name is %s, disorder is %d\n",fs->node_name.c_str(),((sgah_qpn
 
 
 
-string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ext_fcn_list *Ext_fcns, bool is_aggr_query, bool is_fj, set<unsigned int> &s_pids){
+string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ext_fcn_list *Ext_fcns, bool is_aggr_query, bool is_fj, bool is_wj, set<unsigned int> &s_pids){
 
        string ret="static gs_retval_t accept_packet_"+node_name+
                "(struct FTA *f, FTAID * ftaid, void *pkt, gs_int32_t sz){\n";
@@ -3084,9 +3748,9 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
   }
 
   for(w=0;w<where.size();++w){
-       if(is_fj || s_pids.count(w) == 0)
+       if(is_wj || is_fj || s_pids.count(w) == 0)
                gather_pr_col_ids(where[w]->pr,cid_set, gb_tbl);
-       }
+  }
   for(s=0;s<sl_list.size();s++){
        gather_se_col_ids(sl_list[s],cid_set, gb_tbl);
   }
@@ -3201,12 +3865,32 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
   }
 
 
+  if(fs->node_type() == "watch_join"){
+       watch_join_qpn *wlq = (watch_join_qpn *)fs;
+       ret += "/*\t\tJoin fields\t*/\n";
+       for(int k=0;k<wlq->key_flds.size(); ++k){
+               string kfld = wlq->key_flds[k];
+               ret += "\t"+wlq->hash_eq[kfld]->pr->get_right_se()->get_data_type()->get_cvar_type()+" s_equijoin_"+kfld+";\n";
+               ret += "\t"+wlq->hash_eq[kfld]->pr->get_left_se()->get_data_type()->get_cvar_type()+" r_equijoin_"+kfld+";\n";
+         }
+       ret +=
+"  /*          Variables for wl join table     */ \n"
+"\tunsigned int i, bucket;\n"
+"\tunsigned long long int hash; \n";
+       string wl_schema = wlq->from[1]->get_schema_name();
+       string wl_elem_str = generate_watchlist_element_name(wl_schema);
+       ret += "\tstruct "+wl_elem_str+" *rec = NULL;\n";
+"\n"
+;
+  }
+
+
 //             Variables needed to store selected attributes of BUFFER type
 //             temporarily, in order to compute their size for storage
 //             in an output tuple.
 
   string select_var_defs = "";
-  for(s=0;s<sl_list.size();s++){
+  for(int s=0;s<sl_list.size();s++){
        data_type *sdt = sl_list[s]->get_data_type();
        if(sdt->is_buffer_type()){
          sprintf(tmpstr,"\t%s selvar_%d;\n",sdt->get_cvar_type().c_str(),s);
@@ -3306,7 +3990,7 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
 
   vector<cnf_elem *> filter = fs->get_filter_clause();
 //             Test the filter predicate (some query types have additional preds).
-  if(filter.size() > 0){
+  if(filter.size() > 0 && !is_wj){     // watchlist join does specialized processing
 
 //             Sort by evaluation cost.
 //             First, estimate evaluation costs
@@ -3379,7 +4063,7 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
   if(is_fj){
        ret += "\n/*\tPassed the WHERE clause, unpack the hash fields. */\n";
        vector<cnf_elem *> h_eq = ((filter_join_qpn *)fs)-> hash_eq;
-               for(w=0;w<h_eq.size();++w){
+       for(w=0;w<h_eq.size();++w){
                col_id_set this_pred_cids;
                gather_pr_col_ids(h_eq[w]->pr, this_pred_cids, gb_tbl);
                for(csi=this_pred_cids.begin();csi!=this_pred_cids.end();++csi){
@@ -3392,6 +4076,26 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
                        }
                }
        }
+  }else if(is_wj){             // STOPPED HERE move this to wj main body
+/*
+       ret += "\n//\tPassed the WHERE clause, unpack the hash fields. \n";
+       map<string, cnf_elem *> h_eq = ((watch_join_qpn *)fs)-> hash_eq;
+       vector<string> kflds = ((watch_join_qpn *)fs)->key_flds;
+       for(w=0;w<kflds.size();++w){
+               string kfld = kflds[w];
+               col_id_set this_pred_cids;
+               gather_pr_col_ids(h_eq[kfld]->pr, this_pred_cids, gb_tbl);
+               for(csi=this_pred_cids.begin();csi!=this_pred_cids.end();++csi){
+                       if(unpacked_cids.count( (*csi) ) == 0){
+                               int tblref = (*csi).tblvar_ref;
+                               int schref = (*csi).schema_ref;
+                               string field = (*csi).field;
+                               ret += generate_unpack_code(tblref,schref,field,schema,node_name);
+                               unpacked_cids.insert( (*csi) );
+                       }
+               }
+       }
+*/
   }else{
          ret += "\n/*\tPassed the WHERE clause, unpack the rest of the accessed fields. */\n";
 
@@ -3411,12 +4115,17 @@ string generate_fta_accept(qp_node *fs, string node_name, table_list *schema, ex
 //////////////////     After this, the query types
 //////////////////     are processed differently.
 
-  if(!is_aggr_query && !is_fj)
+  if(!is_aggr_query && !is_fj & !is_wj)
        ret += generate_sel_accept_body(fs, node_name, schema);
   else if(is_aggr_query)
        ret += generate_aggr_accept_body(fs, node_name, schema, temporal_flush);
-  else
-       ret += generate_fj_accept_body((filter_join_qpn *)fs, node_name, unpacked_cids, Ext_fcns, schema);
+  else{
+       if(is_fj)
+               ret += generate_fj_accept_body((filter_join_qpn *)fs, node_name, unpacked_cids, Ext_fcns, schema);
+       else
+               ret += generate_wj_accept_body((watch_join_qpn *)fs, node_name, unpacked_cids, Ext_fcns, schema);
+  }
+       
 
 
 //             Finish up.
@@ -3733,6 +4442,8 @@ string generate_lfta_block(qp_node *fs, table_list *schema, int gid,
        param_handle_table = fs->get_handle_param_tbl(Ext_fcns);
        string node_name = fs->get_node_name();
     bool is_fj = false, uses_bloom = false;
+       bool is_wj = false;
+       bool is_watch_tbl = false;
 
 
        if(fs->node_type() == "spx_qpn"){
@@ -3764,6 +4475,25 @@ string generate_lfta_block(qp_node *fs, table_list *schema, int gid,
                uses_bloom = fj_node->use_bloom;
                gb_tbl = NULL;
                aggr_tbl = NULL;
+       }else
+       if(fs->node_type() == "watch_join"){
+               is_aggr_query = false;
+        is_wj = true;
+               watch_join_qpn *wl_node = (watch_join_qpn *)fs;
+               sl_list = wl_node->get_select_se_list();
+               where = wl_node->get_where_clause();
+               gb_tbl = NULL;
+               aggr_tbl = NULL;
+       }else
+       if(fs->node_type() == "watch_tbl_qpn"){
+               is_aggr_query = false;
+        is_watch_tbl = true;
+               vector<scalarexp_t *> empty_sl_list;
+               vector<cnf_elem *> empty_where;
+               sl_list = empty_sl_list;
+               where = empty_where;
+               gb_tbl = NULL;
+               aggr_tbl = NULL;
        } else {
                fprintf(stderr,"INTERNAL ERROR, unrecognized node type %s in generate_lfta_block\n", fs->node_type().c_str());
                exit(1);
@@ -3856,36 +4586,44 @@ string generate_lfta_block(qp_node *fs, table_list *schema, int gid,
 /////////////////////////////////////////////////////
 //                     Common stuff unpacked, do some generation
 
+
        if(is_aggr_query)
          retval += generate_aggr_struct(node_name, gb_tbl, aggr_tbl);
        if(is_fj)
                retval += generate_fj_struct((filter_join_qpn *)fs, node_name);
-
-       retval += generate_fta_struct(node_name, gb_tbl, aggr_tbl, param_tbl, complex_literals, param_handle_table, is_aggr_query, is_fj, uses_bloom, schema);
-       retval += generate_tuple_struct(node_name, sl_list) ;
-
-       if(is_aggr_query)
-               retval += generate_fta_flush(node_name, schema, Ext_fcns) ;
-       if(param_tbl->size() > 0)
-               retval += generate_fta_load_params(node_name) ;
-       retval += generate_fta_free(node_name, is_aggr_query) ;
-       retval +=  generate_fta_control(node_name, schema, is_aggr_query) ;
-       retval +=  generate_fta_accept(fs, node_name, schema, Ext_fcns, is_aggr_query, is_fj, s_pids) ;
-
+       if(is_watch_tbl){
+               retval += "\n\n// watchtable code here \n\n";
+               watch_tbl_qpn *wl_node = (watch_tbl_qpn *)fs;
+               retval += generate_watchlist_structs(node_name, wl_node->table_layout, wl_node->filename, wl_node->refresh_interval);
+               retval += generate_watchlist_load(node_name, wl_node->table_layout, wl_node->key_flds);
+       }
+       
+       if(! is_watch_tbl){
+               retval += generate_fta_struct(node_name, gb_tbl, aggr_tbl, param_tbl, complex_literals, param_handle_table, is_aggr_query, is_fj, is_wj, uses_bloom, schema);
+               retval += generate_tuple_struct(node_name, sl_list) ;
+
+               if(is_aggr_query)
+                       retval += generate_fta_flush(node_name, schema, Ext_fcns) ;
+               if(param_tbl->size() > 0)
+                       retval += generate_fta_load_params(node_name) ;
+               retval += generate_fta_free(node_name, is_aggr_query) ;
+               retval +=  generate_fta_control(node_name, schema, is_aggr_query) ;
+               retval +=  generate_fta_accept(fs, node_name, schema, Ext_fcns, is_aggr_query, is_fj, is_wj, s_pids) ;
 
        /* extract the value of Time_Correlation from interface definition */
-       int e,v;
-       string es;
-       unsigned time_corr;
-       vector<tablevar_t *> tvec =  fs->get_input_tbls();
-       vector<string> time_corr_vec = ifdb->get_iface_vals(tvec[0]->get_machine(), tvec[0]->get_interface(),"Time_Correlation",e,es);
-       if (time_corr_vec.empty())
-               time_corr = DEFAULT_TIME_CORR;
-       else
-               time_corr = atoi(time_corr_vec[0].c_str());
+               int e,v;
+               string es;
+               unsigned time_corr;
+               vector<tablevar_t *> tvec =  fs->get_input_tbls();
+               vector<string> time_corr_vec = ifdb->get_iface_vals(tvec[0]->get_machine(), tvec[0]->get_interface(),"Time_Correlation",e,es);
+               if (time_corr_vec.empty())
+                       time_corr = DEFAULT_TIME_CORR;
+               else
+                       time_corr = atoi(time_corr_vec[0].c_str());
 
-       retval.append( generate_fta_clock(node_name, schema, time_corr, is_aggr_query) );
-       retval.append( generate_fta_alloc(fs, node_name, schema, is_aggr_query, is_fj, uses_bloom) );
+               retval.append( generate_fta_clock(node_name, schema, time_corr, is_aggr_query, is_wj) );
+               retval.append( generate_fta_alloc(fs, node_name, schema, is_aggr_query, is_fj, uses_bloom) );
+       }
 
   return(retval);
 }
@@ -3898,6 +4636,11 @@ int compute_snap_len(qp_node *fs, table_list *schema){
        gb_tbl = NULL;
        sl_list.clear(); where.clear();
 
+       
+       if(fs->node_type() == "watch_tbl_qpn"){
+               return -1;
+       }
+
        if(fs->node_type() == "spx_qpn"){
                spx_qpn *spx_node = (spx_qpn *)fs;
                sl_list = spx_node->get_select_se_list();
@@ -3913,6 +4656,11 @@ int compute_snap_len(qp_node *fs, table_list *schema){
                filter_join_qpn *fj_node = (filter_join_qpn *)fs;
                sl_list = fj_node->get_select_se_list();
                where = fj_node->get_where_clause();
+       }
+       else if(fs->node_type() == "watch_join"){
+               watch_join_qpn *fj_node = (watch_join_qpn *)fs;
+               sl_list = fj_node->get_select_se_list();
+               where = fj_node->get_where_clause();
        } else{
                fprintf(stderr,"INTERNAL ERROR, node type %s not recognized in compute_snap_len\n",fs->node_type().c_str());
                exit(1);
index a1dbe4e..875247f 100644 (file)
@@ -32,6 +32,11 @@ std::string generate_lfta_prefilter_struct(col_id_set &temp_cids, table_list *Sc
 
 int compute_snap_len(qp_node *fs, table_list *schema);
 
+std::string generate_watchlist_element_name(std::string node_name);
+std::string generate_watchlist_struct_name(std::string node_name);
+std::string generate_watchlist_name(std::string node_name);
+
+
 
 #endif
 
index 3b20af3..94c2469 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------
-Copyright 2014 AT&T Intellectual Property
+Copyright 2020 AT&T Intellectual Property
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
@@ -693,6 +693,7 @@ public:
 #define LEFT_OUTER_JOIN_PROPERTY 1
 #define RIGHT_OUTER_JOIN_PROPERTY 2
 #define OUTER_JOIN_PROPERTY 3
+#define WATCHLIST_JOIN_PROPERTY 3
 #define FILTER_JOIN_PROPERTY 4
 
 //             tablevar_list_t is the list of tablevars in a FROM clause
@@ -1709,6 +1710,7 @@ public:
 
 #define SELECT_QUERY 1
 #define MERGE_QUERY 2
+#define WATCHLIST_QUERY 3
 
 class table_exp_t{
 public:
@@ -1726,6 +1728,9 @@ public:
   std::vector<colref_t *> mergevars;           // merge colrefs.
   std::vector<colref_t *> supergb;     // supergroup.
   scalarexp_t *slack;                          // merge slack
+
+  field_entry_list * fel;                      //  List of watchlist fields
+
   bool exernal_visible;                                // true iff. it can be subscribed to.
   int lineno, charno;
 
@@ -1773,6 +1778,25 @@ public:
                return ret;
        }
 
+//             For externally-defined watchlist
+       static table_exp_t *make_watchlist_tbl(field_entry_list *fel_){
+               table_exp_t *ret = new table_exp_t();
+               ret->query_type = WATCHLIST_QUERY;
+               ret->fel = fel_;
+               ret->sl=NULL;
+               ret->fm= new tablevar_list_t(); // generic analyses need the fm clause
+               ret->wh=NULL;
+               ret->hv=NULL;
+               ret->cleaning_when=NULL;
+               ret->cleaning_by=NULL;
+               ret->closing_when=NULL;
+               ret->slack=NULL;
+               ret->exernal_visible = true;
+               ret->lineno = flex_fta_lineno; ret->charno = flex_fta_ch;
+       };
+
+
+
        table_exp_t(){
                fm = NULL; sl = NULL; wh=NULL; hv=NULL;
                slack = NULL;
index 7931b84..4d2f38f 100644 (file)
@@ -496,8 +496,11 @@ string table_def::to_string(){
        case OPERATOR_VIEW_SCHEMA:
                retval += "OPERATOR_VIEW ";
                break;
+       case WATCHLIST_SCHEMA:
+               retval += "WATCHLIST ";
+               break;
        default:
-               retval = "ERROR UNKNOWN TABLE TYPE ";
+               retval = "ERROR UNKNOWN TABLE TYPE ("+std::to_string(schema_type)+")";
                break;
        }
 
index 45366a5..763ebd5 100644 (file)
@@ -316,6 +316,8 @@ struct query_list_t;
 #define STREAM_SCHEMA 2
 #define OPERATOR_VIEW_SCHEMA 3
 #define UNPACK_FCNS_SCHEMA 4
+#define WATCHLIST_SCHEMA 5
+
 
 //                     Represent a STREAM, PROTOCOL, OPERATOR_VIEW, or UNPACK_FCN list.
 
@@ -332,6 +334,7 @@ private:
        param_list *op_properties;
        std::vector<subquery_spec *> qspec_list;
        param_list *selpush;
+       std::vector<std::string> key_flds;      // keys of a watchlist
 
 public:
 //             for unpacking function group specs.
@@ -418,6 +421,13 @@ public:
                return op_properties->val_of(s);
        };
 
+       void set_keys(const std::vector<std::string> &kf){
+               key_flds = kf;
+       }
+       std::vector<std::string> get_keys(){
+               return key_flds;
+       }
+
 //             Used in generating the LFTA prefilter
        std::string get_field_basetable(std::string f);
 
@@ -452,6 +462,10 @@ public:
                schema_type = tmp_sch;
                return ret;
        }
+
+       bool is_stream(){
+               return(schema_type == PROTOCOL_SCHEMA || schema_type == STREAM_SCHEMA || schema_type == OPERATOR_VIEW_SCHEMA);
+       }
 };
 
 
@@ -555,6 +569,10 @@ public:
                return(tbl_list[t]->get_schema_id());
        };
 
+       bool is_stream(int t){
+               return tbl_list[t]->is_stream();
+       }
+
        std::string get_op_prop(int t, std::string s){
                return(tbl_list[t]->get_op_prop(s));
        };
index e3ce4be..512299f 100644 (file)
@@ -98,6 +98,66 @@ mrg_qpn::mrg_qpn(filter_join_qpn *spx, std::string n_name, std::vector<std::stri
 }
 
 
+mrg_qpn::mrg_qpn(watch_join_qpn *spx, std::string n_name, std::vector<std::string> &sources, std::vector<std::pair<std::string, std::string> > &ifaces, ifq_t *ifdb){
+               param_tbl = spx->param_tbl;
+               int i;
+               node_name = n_name;
+               field_entry_list *fel = new field_entry_list();
+               merge_fieldpos = -1;
+
+               disorder = 1;
+
+               for(i=0;i<spx->select_list.size();++i){
+                       data_type *dt = spx->select_list[i]->se->get_data_type()->duplicate();
+                       if(dt->is_temporal()){
+                               if(merge_fieldpos < 0){
+                                       merge_fieldpos = i;
+                               }else{
+                                       fprintf(stderr,"Warning: Merge subquery %s found two temporal fields (%s, %s), using %s\n", n_name.c_str(), spx->select_list[merge_fieldpos]->name.c_str(), spx->select_list[i]->name.c_str(), spx->select_list[merge_fieldpos]->name.c_str() );
+                                       dt->reset_temporal();
+                               }
+                       }
+
+                       field_entry *fe = dt->make_field_entry(spx->select_list[i]->name);
+                       fel->append_field(fe);
+                       delete dt;
+               }
+               if(merge_fieldpos<0){
+                       fprintf(stderr,"ERROR, no temporal attribute for merge subquery %s\n",n_name.c_str());
+                               exit(1);
+               }
+               table_layout = new table_def( n_name.c_str(), NULL, NULL, fel, STREAM_SCHEMA);
+
+//                             NEED TO HANDLE USER_SPECIFIED SLACK
+               this->resolve_slack(spx->select_list[merge_fieldpos]->se,
+                               spx->select_list[merge_fieldpos]->name, ifaces, ifdb,NULL);
+//     if(this->slack == NULL)
+//             fprintf(stderr,"Zero slack.\n");
+//     else
+//             fprintf(stderr,"slack is %s\n",slack->to_string().c_str());
+
+               for(i=0;i<sources.size();i++){
+                       std::string rvar = "_m"+int_to_string(i);
+                       mvars.push_back(new colref_t(rvar.c_str(), spx->select_list[merge_fieldpos]->name.c_str()));
+                       mvars[i]->set_tablevar_ref(i);
+                       fm.push_back(new tablevar_t(sources[i].c_str()));
+                       fm[i]->set_range_var(rvar);
+               }
+
+               param_tbl = new param_table();
+               std::vector<std::string> param_names = spx->param_tbl->get_param_names();
+               int pi;
+               for(pi=0;pi<param_names.size();pi++){
+                       data_type *dt = spx->param_tbl->get_data_type(param_names[pi]);
+                       param_tbl->add_param(param_names[pi],dt->duplicate(),
+                                                       spx->param_tbl->handle_access(param_names[pi]));
+               }
+               definitions = spx->definitions;
+
+}
+
+
+
 
 //             This function translates an analyzed parse tree
 //             into one or more query nodes (qp_node).
@@ -121,6 +181,16 @@ vector<qp_node *> create_query_nodes(query_summary_class *qs,table_list *Schema)
 //                     into the qp_node constructors,
 //                     and have this code focus on building the query plan tree.
 
+//             Watchlist node
+       if(qs->query_type == WATCHLIST_QUERY){
+               watch_tbl_qpn *watchnode = new watch_tbl_qpn(qs, Schema);
+
+//                     Done
+               plan_root = watchnode;
+               local_plan.push_back(watchnode);
+       }
+
+
 //             MERGE node
        if(qs->query_type == MERGE_QUERY){
                mrg_qpn *merge_node = new mrg_qpn(qs,Schema);
@@ -159,7 +229,9 @@ printf("\n");
 */
 
 
-       } else{
+       } 
+       
+       if(qs->query_type == SELECT_QUERY){
 
 //             Select / Aggregation / Join
          if(qs->gb_tbl->size() == 0 && qs->aggr_tbl->size() == 0){
@@ -175,9 +247,15 @@ printf("\n");
                                plan_root = join_node;
                                local_plan.push_back(join_node);
                        }else{
-                               join_eq_hash_qpn *join_node = new join_eq_hash_qpn(qs,Schema);
-                               plan_root = join_node;
-                               local_plan.push_back(join_node);
+                               if(qs->fta_tree->get_from()->get_properties() == WATCHLIST_JOIN_PROPERTY){
+                                       watch_join_qpn *join_node = new watch_join_qpn(qs,Schema);
+                                       plan_root = join_node;
+                                       local_plan.push_back(join_node);
+                               }else{
+                                       join_eq_hash_qpn *join_node = new join_eq_hash_qpn(qs,Schema);
+                                       plan_root = join_node;
+                                       local_plan.push_back(join_node);
+                               }
                        }
                }
          }else{
@@ -2077,6 +2155,20 @@ string sgahcwcb_qpn::to_query_string(){
        return(ret);
 }
 
+string watch_tbl_qpn::to_query_string(){
+       string ret;
+//     ret += "DEFINE {\n";
+//     ret += "\tfilename='"+filename+";\n";
+//     ret += "\trefresh_interval="+to_string(refresh_interval)+";\n}\n";
+       ret += "WATCHLIST FIELDS {\n";
+       std::vector<field_entry *> fields = table_layout->get_fields();
+       for(int f=0;f<fields.size();++f){
+               ret += fields[f]->to_string()+"\n";
+       }
+       ret += "}\n";
+
+       return ret;
+}
 
 string mrg_qpn::to_query_string(){
 
@@ -2181,6 +2273,42 @@ string filter_join_qpn::to_query_string(){
        return(ret);
 }
 
+string watch_join_qpn::to_query_string(){
+
+       string ret = "Select ";
+       int s;
+       for(s=0;s<select_list.size();s++){
+               if(s>0) ret+=", ";
+               ret += se_to_query_string(select_list[s]->se, NULL);
+               if(select_list[s]->name != "") ret += " AS "+select_list[s]->name;
+       }
+       ret += "\n";
+
+//                     NOTE: assuming binary join.
+       ret += "WATCHLIST_JOIN ";
+
+       ret += "From ";
+       int f;
+       for(f=0;f<from.size();++f){
+               if(f>0) ret+=", ";
+               ret += from[f]->to_string();
+       }
+       ret += "\n";
+
+       if(where.size() > 0){
+               ret += "Where ";
+               int w;
+               for(w=0;w<where.size();w++){
+                       if(w>0) ret += " AND ";
+                       ret += "(" + pred_to_query_str(where[w]->pr,NULL) + ")";
+               }
+               ret += "\n";
+       }
+
+       return(ret);
+}
+
+
 
 // -----------------------------------------------------------------
 //             Query node subclass specific processing.
@@ -2390,6 +2518,18 @@ void mrg_qpn::resolve_slack(scalarexp_t *t_se, string fname, vector<pair<string,
 //------------------------------------------------------------------
 //             split a node to extract LFTA components.
 
+vector<qp_node *> watch_tbl_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_list *Schema, int &hfta_returned, ifq_t *ifdb, int n_virtual_ifaces, int hfta_parallelism, int hfta_idx){
+       // nothing to do, nothing to split, return copy of self.
+
+       hfta_returned = 0;
+
+       vector<qp_node *> ret_vec;
+
+       ret_vec.push_back(this);
+       return(ret_vec);
+
+}
+
 
 vector<qp_node *> mrg_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_list *Schema, int &hfta_returned, ifq_t *ifdb, int n_virtual_ifaces, int hfta_parallelism, int hfta_idx){
        // nothing to do, nothing to split, return copy of self.
@@ -2429,7 +2569,7 @@ vector<qp_node *> filter_join_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, ta
        vector<string> sel_names;
        vector<pair<string,string> > ifaces = get_ifaces(from[0], ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
        if (ifaces.empty()) {
-               fprintf(stderr,"INTERNAL ERROR in filter_join_qpn::split_node_for_fta - empty interface set\n");
+               fprintf(stderr,"INTERNAL ERROR in filter_join_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
                exit(1);
        }
 
@@ -2481,35 +2621,35 @@ vector<qp_node *> filter_join_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, ta
                        }
 
                        for(p=0;p<shared_pred.size();p++){
-                               predicate_t *new_pr = dup_pr(where[p]->pr, NULL);
+                               predicate_t *new_pr = dup_pr(shared_pred[p]->pr, NULL);
                                cnf_elem *new_cnf = new cnf_elem(new_pr);
                                analyze_cnf(new_cnf);
                                fta_node->shared_pred.push_back(new_cnf);
                                fta_node->where.push_back(new_cnf);
                        }
                        for(p=0;p<pred_t0.size();p++){
-                               predicate_t *new_pr = dup_pr(where[p]->pr, NULL);
+                               predicate_t *new_pr = dup_pr(pred_t0[p]->pr, NULL);
                                cnf_elem *new_cnf = new cnf_elem(new_pr);
                                analyze_cnf(new_cnf);
                                fta_node->pred_t0.push_back(new_cnf);
                                fta_node->where.push_back(new_cnf);
                        }
                        for(p=0;p<pred_t1.size();p++){
-                               predicate_t *new_pr = dup_pr(where[p]->pr, NULL);
+                               predicate_t *new_pr = dup_pr(pred_t1[p]->pr, NULL);
                                cnf_elem *new_cnf = new cnf_elem(new_pr);
                                analyze_cnf(new_cnf);
                                fta_node->pred_t1.push_back(new_cnf);
                                fta_node->where.push_back(new_cnf);
                        }
                        for(p=0;p<hash_eq.size();p++){
-                               predicate_t *new_pr = dup_pr(where[p]->pr, NULL);
+                               predicate_t *new_pr = dup_pr(hash_eq[p]->pr, NULL);
                                cnf_elem *new_cnf = new cnf_elem(new_pr);
                                analyze_cnf(new_cnf);
                                fta_node->hash_eq.push_back(new_cnf);
                                fta_node->where.push_back(new_cnf);
                        }
                        for(p=0;p<postfilter.size();p++){
-                               predicate_t *new_pr = dup_pr(where[p]->pr, NULL);
+                               predicate_t *new_pr = dup_pr(postfilter[p]->pr, NULL);
                                cnf_elem *new_cnf = new cnf_elem(new_pr);
                                analyze_cnf(new_cnf);
                                fta_node->postfilter.push_back(new_cnf);
@@ -2543,6 +2683,155 @@ vector<qp_node *> filter_join_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, ta
 
 }
 
+
+
+
+
+vector<qp_node *> watch_join_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_list *Schema, int &hfta_returned, ifq_t *ifdb, int n_virtual_ifaces, int hfta_parallelism, int hfta_idx){
+       vector<qp_node *> ret_vec;
+
+//             First check if the query can be pushed to the FTA.
+       bool fta_ok = true;
+       int s;
+       for(s=0;s<select_list.size();s++){
+               fta_ok &= check_fta_forbidden_se(select_list[s]->se,NULL, Ext_fcns);
+       }
+       int p;
+       for(p=0;p<where.size();p++){
+               fta_ok &= check_fta_forbidden_pr(where[p]->pr,NULL, Ext_fcns);
+       }
+
+       if(!fta_ok){
+               fprintf(stderr,"ERROR, watchlist join %s is fta-unsafe.\n",node_name.c_str());
+               exit(1);
+       }
+
+//             Can it be done in a single lfta?
+//                     Get the set of interfaces it accesses.
+       int ierr;
+       int si;
+       vector<string> sel_names;
+       vector<pair<string,string> > ifaces = get_ifaces(from[0], ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
+       if (ifaces.empty()) {
+               fprintf(stderr,"INTERNAL ERROR in filter_join_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
+               exit(1);
+       }
+
+       if(ifaces.size() == 1){
+//                             Single interface, no need to merge.
+               hfta_returned = 0;
+               ret_vec.push_back(this);
+
+//     Treat the range vars a bit differently, the 2nd is reading from a _local_ watchlist.
+               from[0]->set_machine(ifaces[0].first);
+               from[0]->set_interface(ifaces[0].second);
+               from[0]->set_ifq(false);
+
+               from[1]->set_machine(ifaces[0].first);
+               from[1]->set_interface("_local_");
+               from[1]->set_ifq(false);
+
+               return(ret_vec);
+       }else{
+//                             Multiple interfaces, generate the interface-specific queries plus
+//                             the merge.
+               hfta_returned = 1;
+
+               vector<string> sel_names;
+               for(si=0;si<ifaces.size();++si){
+                       watch_join_qpn *fta_node = new watch_join_qpn();
+
+//                     Name the fta
+                       if(ifaces.size()==1)
+                               fta_node->set_node_name( node_name );
+                       else{
+                               string new_name =  "_"+node_name+"_"+ifaces[si].first+"_"+ifaces[si].second;
+                               untaboo(new_name);
+                               fta_node->set_node_name(new_name);
+                       }
+                       sel_names.push_back(fta_node->get_node_name());
+
+//                     Assign the table
+                       int f;
+                       for(f=0;f<from.size();f++){
+                               fta_node->from.push_back(from[f]->duplicate());
+                               fta_node->from[f]->set_machine(ifaces[si].first);
+                               if(f==0)
+                                       fta_node->from[f]->set_interface(ifaces[si].second);
+                               else
+                                       fta_node->from[f]->set_interface("_local_");
+                               fta_node->from[f]->set_ifq(false);
+                       }
+
+                       for(s=0;s<select_list.size();s++){
+                               fta_node->select_list.push_back( dup_select(select_list[s], NULL) );
+                       }
+
+                       for(p=0;p<pred_t0.size();p++){
+                               predicate_t *new_pr = dup_pr(pred_t0[p]->pr, NULL);
+                               cnf_elem *new_cnf = new cnf_elem(new_pr);
+                               analyze_cnf(new_cnf);
+                               fta_node->pred_t0.push_back(new_cnf);
+                               fta_node->where.push_back(new_cnf);
+                       }
+                       for(p=0;p<pred_t1.size();p++){
+                               predicate_t *new_pr = dup_pr(pred_t1[p]->pr, NULL);
+                               cnf_elem *new_cnf = new cnf_elem(new_pr);
+                               analyze_cnf(new_cnf);
+                               fta_node->pred_t1.push_back(new_cnf);
+                               fta_node->where.push_back(new_cnf);
+                       }
+                       for(p=0;p<key_flds.size();p++){ // we've checked that all keys are covered
+                               string k = key_flds[p];
+                               predicate_t *new_pr = dup_pr(hash_eq[k]->pr, NULL);
+                               cnf_elem *new_cnf = new cnf_elem(new_pr);
+                               analyze_cnf(new_cnf);
+                               fta_node->hash_eq[k] = new_cnf;
+                               fta_node->where.push_back(new_cnf);
+                       }
+                       for(p=0;p<join_filter.size();p++){
+                               predicate_t *new_pr = dup_pr(join_filter[p]->pr, NULL);
+                               cnf_elem *new_cnf = new cnf_elem(new_pr);
+                               analyze_cnf(new_cnf);
+                               fta_node->postfilter.push_back(new_cnf);
+                               fta_node->where.push_back(new_cnf);
+                       }
+                       for(p=0;p<postfilter.size();p++){
+                               predicate_t *new_pr = dup_pr(postfilter[p]->pr, NULL);
+                               cnf_elem *new_cnf = new cnf_elem(new_pr);
+                               analyze_cnf(new_cnf);
+                               fta_node->postfilter.push_back(new_cnf);
+                               fta_node->where.push_back(new_cnf);
+                       }
+                       fta_node->key_flds = key_flds;
+
+//                     Xfer all of the parameters.
+//                     Use existing handle annotations.
+                       vector<string> param_names = param_tbl->get_param_names();
+                       int pi;
+                       for(pi=0;pi<param_names.size();pi++){
+                               data_type *dt = param_tbl->get_data_type(param_names[pi]);
+                               fta_node->param_tbl->add_param(param_names[pi],dt->duplicate(),
+                                                                       param_tbl->handle_access(param_names[pi]));
+                       }
+                       fta_node->definitions = definitions;
+                       if(fta_node->resolve_if_params(ifdb, this->err_str)){
+                               this->error_code = 3;
+                               return ret_vec;
+                       }
+
+                       ret_vec.push_back(fta_node);
+               }
+
+               mrg_qpn *mrg_node = new mrg_qpn((watch_join_qpn *)ret_vec[0],
+                        node_name,  sel_names,ifaces, ifdb);
+               ret_vec.push_back(mrg_node);
+
+               return(ret_vec);
+       }
+
+}
+
 //             Use to search for unresolved interface param refs in an hfta.
 
 int spx_qpn::count_ifp_refs(set<string> &ifpnames){
@@ -2606,6 +2895,10 @@ int rsgah_qpn::count_ifp_refs(set<string> &ifpnames){
        return ret;
 }
 
+int watch_tbl_qpn::count_ifp_refs(set<string> &ifpnames){
+       return 0;
+}
+
 int mrg_qpn::count_ifp_refs(set<string> &ifpnames){
        return 0;
 }
@@ -2638,6 +2931,17 @@ int filter_join_qpn::count_ifp_refs(set<string> &ifpnames){
        return ret;
 }
 
+int watch_join_qpn::count_ifp_refs(set<string> &ifpnames){
+       int ret = 0;
+       int i;
+       for(i=0;i<select_list.size();++i)
+               ret += count_se_ifp_refs(select_list[i]->se,ifpnames);
+       for(i=0;i<where.size();++i)
+               ret += count_pr_ifp_refs(where[i]->pr,ifpnames);
+       return ret;
+}
+
+
 
 //             Resolve interface params to string literals
 int filter_join_qpn::resolve_if_params( ifq_t *ifdb, string &err){
@@ -2654,6 +2958,20 @@ int filter_join_qpn::resolve_if_params( ifq_t *ifdb, string &err){
        return ret;
 }
 
+int watch_join_qpn::resolve_if_params( ifq_t *ifdb, string &err){
+       int ret = 0;
+       int i;
+       string ifname = from[0]->get_interface();
+       string ifmach = from[0]->get_machine();
+       for(i=0;i<select_list.size();++i)
+               if( resolve_se_ifp_refs(select_list[i]->se,ifmach, ifname, ifdb, err) )
+                       ret = 1;
+       for(i=0;i<where.size();++i)
+               if( resolve_pr_ifp_refs(where[i]->pr,ifmach, ifname, ifdb, err))
+                       ret = 1;
+       return ret;
+}
+
 
 int spx_qpn::resolve_if_params( ifq_t *ifdb, string &err){
        int ret = 0;
@@ -2784,7 +3102,7 @@ vector<qp_node *> spx_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_list
        vector<string> sel_names;
        vector<pair<string,string> > ifaces = get_ifaces(table_name, ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
        if (ifaces.empty()) {
-               fprintf(stderr,"INTERNAL ERROR in spx_qpn::split_node_for_fta - empty interface set\n");
+               fprintf(stderr,"INTERNAL ERROR in spx_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
                exit(1);
        }
 
@@ -3138,7 +3456,7 @@ vector<qp_node *> rsgah_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_li
        vector<string> sel_names;
        vector<pair<string,string> > ifaces = get_ifaces(table_name, ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
        if (ifaces.empty()) {
-               fprintf(stderr,"INTERNAL ERROR in rsgah_qpn::split_node_for_fta - empty interface set\n");
+               fprintf(stderr,"INTERNAL ERROR in rsgah_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
                exit(1);
        }
 
@@ -3805,7 +4123,7 @@ vector<qp_node *> sgah_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, table_lis
        vector<string> sel_names;
        vector<pair<string,string> > ifaces = get_ifaces(table_name, ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
        if (ifaces.empty()) {
-               fprintf(stderr,"INTERNAL ERROR in sgah_qpn::split_node_for_fta - empty interface set\n");
+               fprintf(stderr,"INTERNAL ERROR in sgah_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
                exit(1);
        }
 
@@ -4735,7 +5053,7 @@ vector<qp_node *> join_eq_hash_qpn::split_node_for_fta(ext_fcn_list *Ext_fcns, t
                        spx_qpn *c_node = child_vec[f];
                        vector<pair<string, string> > ifaces = get_ifaces(c_node->table_name, ifdb, n_virtual_ifaces, hfta_parallelism, hfta_idx);
                        if (ifaces.empty()) {
-                               fprintf(stderr,"INTERNAL ERROR in join_eq_hash_qpn::split_node_for_fta - empty interface set\n");
+                               fprintf(stderr,"INTERNAL ERROR in join_eq_hash_qpn::split_node_for_fta - empty interface set, node is %s\n", node_name.c_str());
                                exit(1);
                        }
 
@@ -5002,6 +5320,21 @@ vector<table_exp_t *> filter_join_qpn::extract_opview(table_list *Schema,  vecto
     return(ret);
 }
 
+vector<table_exp_t *> watch_join_qpn::extract_opview(table_list *Schema,  vector<query_node *> &qnodes, opview_set &opviews, string rootnm, string silo_name){
+       vector<table_exp_t *> ret;
+       int retval = process_opview(from[0],0,node_name,
+                                                               Schema,qnodes,opviews,ret, rootnm, silo_name);
+       if(retval) exit(1);
+    return(ret);
+}
+
+
+
+vector<table_exp_t *> watch_tbl_qpn::extract_opview(table_list *Schema,  vector<query_node *> &qnodes, opview_set &opviews, string rootnm, string silo_name){
+       vector<table_exp_t *> ret;
+       return ret;             // nothing to process
+}
+
 
 
 //////////////////////////////////////////////////////////////////
@@ -5017,6 +5350,10 @@ table_def *mrg_qpn::get_fields(){
        return(table_layout);
 }
 
+table_def *watch_tbl_qpn::get_fields(){
+       return(table_layout);
+}
+
 
 table_def *spx_qpn::get_fields(){
        return(create_attributes(node_name, select_list));
@@ -5038,6 +5375,9 @@ table_def *filter_join_qpn::get_fields(){
        return(create_attributes(node_name, select_list));
 }
 
+table_def *watch_join_qpn::get_fields(){
+       return(create_attributes(node_name, select_list));
+}
 
 table_def *join_eq_hash_qpn::get_fields(){
        int i, h, s, t;
@@ -5202,6 +5542,11 @@ vector<string> rsgah_qpn::get_tbl_keys(vector<string> &partial_keys){
                return(fm);
        }
 
+       vector<tablevar_t *> watch_tbl_qpn::get_input_tbls(){
+               vector<tablevar_t *> ret;
+               return(ret);
+       }
+
        vector<tablevar_t *> mrg_qpn::get_input_tbls(){
                return(fm);
        }
@@ -5234,6 +5579,10 @@ vector<string> rsgah_qpn::get_tbl_keys(vector<string> &partial_keys){
                return(from);
        }
 
+       vector<tablevar_t *> watch_join_qpn::get_input_tbls(){
+               return(from);
+       }
+
 //-----------------------------------------------------------------
 //                     get output tables
 
@@ -5245,6 +5594,11 @@ vector<string> rsgah_qpn::get_tbl_keys(vector<string> &partial_keys){
                return(retval);
        }
 
+       vector<tablevar_t *> watch_tbl_qpn::get_output_tbls(){
+               vector<tablevar_t *> retval(1,new tablevar_t(node_name.c_str()));
+               return(retval);
+       }
+
        vector<tablevar_t *> mrg_qpn::get_output_tbls(){
                vector<tablevar_t *> retval(1,new tablevar_t(node_name.c_str()));
                return(retval);
@@ -5281,6 +5635,12 @@ vector<string> rsgah_qpn::get_tbl_keys(vector<string> &partial_keys){
        }
 
 
+       vector<tablevar_t *> watch_join_qpn::get_output_tbls(){
+               vector<tablevar_t *> retval(1,new tablevar_t(node_name.c_str()));
+               return(retval);
+       }
+
+
 
 //-----------------------------------------------------------------
 //                     Bind to schema
@@ -5378,6 +5738,30 @@ col_id_set filter_join_qpn::get_colrefs(bool ext_fcns_only,table_list *Schema){
        return tmp_cset;
 }
 
+col_id_set watch_join_qpn::get_colrefs(bool ext_fcns_only,table_list *Schema){
+       col_id_set retval, tmp_cset;
+       int p;
+       for(p=0;p<where.size();++p){
+               gather_pr_col_ids(where[p]->pr, tmp_cset, NULL);
+       }
+       int s;
+       for(s=0;s<select_list.size();++s){
+               gather_se_col_ids(select_list[s]->se, tmp_cset, NULL);
+       }
+       col_id_set::iterator  cisi;
+       if(ext_fcns_only){
+               for(cisi=tmp_cset.begin();cisi!=tmp_cset.end();++cisi){
+                       field_entry *fe = Schema->get_field((*cisi).schema_ref, (*cisi).field);
+                       if(fe->get_unpack_fcns().size()>0)
+                               retval.insert((*cisi));
+               }
+               return retval;
+       }
+
+       return tmp_cset;
+}
+
+
 
 
 //             Associate colrefs in SEs with this schema.
@@ -5437,6 +5821,35 @@ void filter_join_qpn::bind_to_schema(table_list *Schema){
 
 }
 
+void watch_join_qpn::bind_to_schema(table_list *Schema){
+//                     Bind the tablevars in the From clause to the Schema
+//                     (it might have changed from analysis time)
+       int f;
+       for(f=0;f<from.size();++f){
+               string snm = from[f]->get_schema_name();
+               int tbl_ref = Schema->get_table_ref(snm);
+               if(tbl_ref >= 0)
+               from[f]->set_schema_ref(tbl_ref);
+       }
+
+//                     Bind all SEs to this schema
+       tablevar_list_t fm(from);
+
+       int p;
+       for(p=0;p<where.size();++p){
+               bind_to_schema_pr(where[p]->pr, &fm, Schema);
+       }
+       int s;
+       for(s=0;s<select_list.size();++s){
+               bind_to_schema_se(select_list[s]->se, &fm, Schema);
+       }
+
+//             Collect set of tuples referenced in this HFTA
+//             input, internal, or output.
+
+}
+
+
 
 
 
@@ -5624,6 +6037,10 @@ void sgahcwcb_qpn::bind_to_schema(table_list *Schema){
 //-----------------------------------------------------------------
 //             get_cplx_lit_tbl
 
+cplx_lit_table *watch_tbl_qpn::get_cplx_lit_tbl(ext_fcn_list *Ext_fcns){
+       return(new cplx_lit_table());
+}
+
 cplx_lit_table *mrg_qpn::get_cplx_lit_tbl(ext_fcn_list *Ext_fcns){
        return(new cplx_lit_table());
 }
@@ -5771,12 +6188,32 @@ cplx_lit_table *filter_join_qpn::get_cplx_lit_tbl(ext_fcn_list *Ext_fcns){
        return(complex_literals);
 }
 
+cplx_lit_table *watch_join_qpn::get_cplx_lit_tbl(ext_fcn_list *Ext_fcns){
+       int i;
+       cplx_lit_table *complex_literals = new cplx_lit_table();
+
+       for(i=0;i<select_list.size();i++){
+               find_complex_literal_se(select_list[i]->se, Ext_fcns, complex_literals);
+       }
+       for(i=0;i<where.size();++i){
+               find_complex_literal_pr(where[i]->pr,Ext_fcns, complex_literals);
+       }
+
+       return(complex_literals);
+}
+
+
 
 
 
 //-----------------------------------------------------------------
 //             get_handle_param_tbl
 
+vector<handle_param_tbl_entry *> watch_tbl_qpn::get_handle_param_tbl(ext_fcn_list *Ext_fcns){
+    vector<handle_param_tbl_entry *> retval;
+       return(retval);
+}
+
 vector<handle_param_tbl_entry *> mrg_qpn::get_handle_param_tbl(ext_fcn_list *Ext_fcns){
     vector<handle_param_tbl_entry *> retval;
        return(retval);
@@ -5928,6 +6365,22 @@ vector<handle_param_tbl_entry *> filter_join_qpn::get_handle_param_tbl(ext_fcn_l
        return(retval);
 }
 
+vector<handle_param_tbl_entry *> watch_join_qpn::get_handle_param_tbl(ext_fcn_list *Ext_fcns){
+       int i;
+    vector<handle_param_tbl_entry *> retval;
+
+       for(i=0;i<select_list.size();i++){
+               find_param_handles_se(select_list[i]->se, Ext_fcns, retval);
+       }
+       for(i=0;i<where.size();++i){
+               find_param_handles_pr(where[i]->pr,Ext_fcns, retval);
+       }
+
+       return(retval);
+}
+
+
+
 ///////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////
 ///            Functions for operator output rates estimations
@@ -5960,6 +6413,12 @@ double sgahcwcb_qpn::get_rate_estimate() {
        return SGAHCWCB_SELECTIVITY * DEFAULT_INTERFACE_RATE;
 }
 
+double watch_tbl_qpn::get_rate_estimate() {
+
+       // dummy method for now
+       return DEFAULT_INTERFACE_RATE;
+}
+
 double mrg_qpn::get_rate_estimate() {
 
        // dummy method for now
@@ -9876,6 +10335,23 @@ string mrg_qpn::generate_operator(int i, string params){
        );
 }
 
+////////////////////////////////////////////////
+///            WATCHLIST_TBL operator
+///            WATCHLIST_TBL functor
+////////////////////////////////////////////
+
+string watch_tbl_qpn::generate_functor_name(){
+       return("watch_tbl_functor_" + normalize_name(this->get_node_name()));
+}
+
+string watch_tbl_qpn::generate_functor(table_list *schema, ext_fcn_list *Ext_fcns, vector<bool> &needs_xform){
+
+       return("ERROR_WATCH_TBL_FUNCTOR_NOT_YET_IMPLEMENTED");
+}
+
+string watch_tbl_qpn::generate_operator(int i, string params){
+       return("ERROR_WATCH_TBL_FUNCTOR_NOT_YET_IMPLEMENTED");
+}
 
 /////////////////////////////////////////////////////////
 //////                 JOIN_EQ_HASH functor
@@ -13521,6 +13997,29 @@ void filter_join_qpn::create_protocol_se(vector<qp_node *> q_sources, table_list
        }
 }
 
+void watch_join_qpn::create_protocol_se(vector<qp_node *> q_sources, table_list *Schema){
+       int i;
+       vector<map<string, scalarexp_t *> *> src_vec;
+
+       for(i=0;i<q_sources.size();i++){
+               if(q_sources[i] != NULL)
+                       src_vec.push_back(q_sources[i]->get_protocol_se());
+               else
+                       src_vec.push_back(NULL);
+       }
+
+       for(i=0;i<select_list.size();i++){
+               protocol_map[select_list[i]->name] = resolve_protocol_se(select_list[i]->se,src_vec,NULL,Schema);
+       }
+
+       for(i=0;i<key_flds.size();i++){
+               string kfld = key_flds[i];
+               hash_src_l.push_back(resolve_protocol_se(hash_eq[kfld]->pr->get_left_se(),src_vec,NULL,Schema));
+               hash_src_r.push_back(resolve_protocol_se(hash_eq[kfld]->pr->get_right_se(),src_vec,NULL,Schema));
+       }
+}
+
+
 void sgah_qpn::create_protocol_se(vector<qp_node *> q_sources, table_list *Schema){
        int i;
        vector<map<string, scalarexp_t *> *> src_vec;
@@ -13620,3 +14119,8 @@ void mrg_qpn::create_protocol_se(vector<qp_node *> q_sources, table_list *Schema
                        protocol_map[fld_nm] = NULL;
        }
 }
+
+void watch_tbl_qpn::create_protocol_se(vector<qp_node *> q_sources, table_list *Schema){
+       return;
+}
+
index 8ba08a4..ec782e0 100644 (file)
@@ -87,7 +87,9 @@ struct query_node{
                mangler="";
 
                tablevar_list_t *fm = parse_tree->get_from();
-               refd_tbls =  fm->get_table_names();
+               if(fm!=NULL){
+                       refd_tbls =  fm->get_table_names();
+               }
 
                params  = pt->query_params;
        };
@@ -296,7 +298,7 @@ public:
 
 //                     The "where" clause is a pre-filter
   virtual  std::vector<cnf_elem *> get_where_clause() = 0;
-//                     To be more explicit, use get_filter_preds
+//                     To be more explicit, use get_filter_preds, this is used to compute the prefilter
   virtual  std::vector<cnf_elem *> get_filter_clause() = 0;
 
 //             Add an extra predicate.  Currently only used for LFTAs.
@@ -402,6 +404,7 @@ public:
 //                             embedded in them.  Would it make sense
 //                             to grab the whole table list?
                tablevar_list_t *fm = qs->fta_tree->get_from();
+               
                std::vector<tablevar_t *> tbl_vec = fm->get_table_list();
                if(tbl_vec.size() != 1){
                        char tmpstr[200];
@@ -411,6 +414,12 @@ public:
                }
                table_name = (tbl_vec[0]);
 
+               int t = tbl_vec[0]->get_schema_ref();
+               if(! Schema->is_stream(t)){
+                       err_str += "ERROR in query "+node_name+", the source "+table_name->get_schema_name()+" is not a stream.\n";
+                       error_code = 1;
+               }
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 
@@ -564,6 +573,13 @@ public:
                }
                table_name = (tbl_vec[0]);
 
+               int t = tbl_vec[0]->get_schema_ref();
+               if(! Schema->is_stream(t)){
+                       err_str += "ERROR in query "+node_name+", the source "+table_name->get_schema_name()+" is not a stream.\n";
+                       error_code = 1;
+               }
+
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 
@@ -754,6 +770,12 @@ public:
                }
                table_name = (tbl_vec[0]);
 
+               int t = tbl_vec[0]->get_schema_ref();
+               if(! Schema->is_stream(t)){
+                       err_str += "ERROR in query "+node_name+", the source "+table_name->get_schema_name()+" is not a stream.\n";
+                       error_code = 1;
+               }
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 
@@ -828,8 +850,158 @@ public:
 };
 
 
+
+//             Watchlist - from a table read from an external source.
+
+class watch_tbl_qpn: public qp_node{
+public:
+       table_def *table_layout;                                // the output schema
+       std::vector<std::string> key_flds;
+
+//             Parameters related to loading the table
+       std::string filename;
+       int refresh_interval;
+
+       
+       void append_to_where(cnf_elem *c){
+               fprintf(stderr, "ERROR, append_to_where called on watch_tbl_qpn, not supported, query %s.\n",  node_name.c_str());
+               exit(1);
+       }
+
+       std::string node_type(){return("watch_tbl_qpn");        };
+    bool makes_transform(){return false;};
+       std::vector<std::string> external_libs(){
+               std::vector<std::string> ret;
+               return ret;
+       }
+
+       void bind_to_schema(table_list *Schema){}
+       col_id_set get_colrefs(bool ext_fcns_only,table_list *Schema){
+               col_id_set ret;
+               return ret;
+       }
+
+       std::string to_query_string();
+       std::string generate_functor(table_list *schema, ext_fcn_list *Ext_fcns, std::vector<bool> &needs_xform);
+       std::string generate_functor_name();
+       std::string generate_operator(int i, std::string params);
+       std::string get_include_file(){
+               return("#include <watchlist_tbl.h>\n");
+       };
+
+       cplx_lit_table *get_cplx_lit_tbl(ext_fcn_list *Ext_fcns);
+    std::vector<handle_param_tbl_entry *> get_handle_param_tbl(ext_fcn_list *Ext_fcns);
+
+       table_def *get_fields();
+       std::vector<string> get_tbl_keys(std::vector<std::string> &partial_keys){
+               return key_flds;
+       }
+
+       std::vector<tablevar_t *> get_input_tbls();
+       std::vector<tablevar_t *> get_output_tbls();
+
+       std::vector<qp_node *> split_node_for_fta(ext_fcn_list *Ext_fcns, table_list *Schema, int &hfta_returned, ifq_t *ifdb, int n_virtual_ifaces, int hfta_parallelism, int hfta_idx);
+       virtual std::vector<table_exp_t *> extract_opview(table_list *Schema, std::vector<query_node *> &qnodes,  opview_set &opviews, std::string rootnm, std::string silo_nm);
+//             Ensure that any refs to interface params have been split away.
+       int count_ifp_refs(std::set<std::string> &ifpnames);
+
+//                     No predicates, return an empty clause
+    std::vector<cnf_elem *> get_where_clause(){
+                std::vector<cnf_elem *> t;
+               return(t);
+       };
+    std::vector<cnf_elem *> get_filter_clause(){
+               return get_where_clause();
+       }
+
+       watch_tbl_qpn(){
+       };
+
+       watch_tbl_qpn(query_summary_class *qs,table_list *Schema){
+               node_name=qs->query_name;
+               param_tbl = qs->param_tbl;
+               definitions = qs->definitions;
+               
+               
+//                     Populate the schema
+               table_layout = new table_def(
+                       node_name.c_str(), NULL, NULL,  qs->fta_tree->fel, WATCHLIST_SCHEMA
+               );
+
+//                     Find the keys
+               std::vector<field_entry *> flds = qs->fta_tree->fel->get_list();
+               for(int f=0;f<flds.size();++f){
+                       if(flds[f]->get_modifier_list()->contains_key("key") ||
+                               flds[f]->get_modifier_list()->contains_key("Key") ||
+                               flds[f]->get_modifier_list()->contains_key("KEY") ){
+                                       key_flds.push_back(flds[f]->get_name());
+                       }
+               }
+               if(key_flds.size()==0){
+                       fprintf(stderr,"Error, no key fields defined for table watchlist %s\n",node_name.c_str());
+                       exit(1);
+               }
+
+               table_layout->set_keys(key_flds);       // communicate keys to consumers
+
+//                     Get loading parameters
+               if(definitions.count("filename")>0){
+                       filename = definitions["filename"];
+               }else{
+                       fprintf(stderr, "Error, no filename for source data defined for table watchlist %s\n",node_name.c_str());
+                       exit(1);
+               }
+               if(definitions.count("refresh_interval")>0){
+                       refresh_interval = atoi(definitions["refresh_interval"].c_str());
+                       if(refresh_interval <= 0){
+                               fprintf(stderr, "Error, the refresh_interval (%s) of table watchlist %s must be a positive non-zero integer.\n",definitions["refresh_interval"].c_str(), node_name.c_str());
+                               exit(1);
+                       }
+               }else{
+                       fprintf(stderr, "Error, no refresh_interval defined for table watchlist %s\n",node_name.c_str());
+                       exit(1);
+               }
+
+       }
+
+       qp_node *make_copy(std::string suffix){
+               watch_tbl_qpn *ret = new watch_tbl_qpn();
+               ret->filename = filename;
+               ret->refresh_interval = refresh_interval;
+               ret->key_flds = key_flds;
+
+               ret->param_tbl = new param_table();
+               std::vector<std::string> param_names = param_tbl->get_param_names();
+               int pi;
+               for(pi=0;pi<param_names.size();pi++){
+                       data_type *dt = param_tbl->get_data_type(param_names[pi]);
+                       ret->param_tbl->add_param(param_names[pi],dt->duplicate(),
+                                                       param_tbl->handle_access(param_names[pi]));
+               }
+               ret->definitions = definitions;
+
+               ret->node_name = node_name + suffix;
+               ret->table_layout = table_layout->make_shallow_copy(ret->node_name);
+
+               return ret;
+       };
+
+       // the following method is used for distributed query optimization
+       double get_rate_estimate();
+
+       void create_protocol_se(vector<qp_node *> q_sources, table_list *Schema);
+       
+
+};
+
+
+
+
+
+
 //             forward reference
 class filter_join_qpn;
+class watch_join_qpn;
 
 
 //             (temporal) Merge query plan node.
@@ -939,6 +1111,14 @@ public:
                        exit(1);
                }
 
+               for(int f=0;f<fm.size();++f){
+                       int t=fm[f]->get_schema_ref();
+                       if(! Schema->is_stream(t)){
+                               err_str += "ERROR in query "+node_name+", the source "+fm[f]->get_schema_name()+" is not a stream.\n";
+                               error_code = 1;
+                       }
+               }
+
 //                             Get the parameters
                param_tbl = qs->param_tbl;
 
@@ -1098,6 +1278,10 @@ printf("\n");
 
        mrg_qpn(filter_join_qpn *spx, std::string n_name, std::vector<std::string> &sources, std::vector<std::pair<std::string, std::string> > &ifaces, ifq_t *ifdb);
 
+//                     Merge watch_join LFTAs.
+
+       mrg_qpn(watch_join_qpn *spx, std::string n_name, std::vector<std::string> &sources, std::vector<std::pair<std::string, std::string> > &ifaces, ifq_t *ifdb);
+
 //                     Merge selection LFTAs.
 
        mrg_qpn(spx_qpn *spx, std::string n_name, std::vector<std::string> &sources, std::vector<std::pair<std::string, std::string> > &ifaces, ifq_t *ifdb){
@@ -1417,6 +1601,15 @@ public:
                        error_code = 1;
                }
 
+               for(int f=0;f<from.size();++f){
+                       int t=from[f]->get_schema_ref();
+                       if(! Schema->is_stream(t)){
+                               err_str += "ERROR in query "+node_name+", the source "+from[f]->get_schema_name()+" is not a stream.\n";
+                               error_code = 1;
+                       }
+               }
+
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 
@@ -1643,6 +1836,15 @@ public:
                        error_code = 1;
                }
 
+               for(int f=0;f<from.size();++f){
+                       int t=from[f]->get_schema_ref();
+                       if(! Schema->is_stream(t)){
+                               err_str += "ERROR in query "+node_name+", the source "+from[f]->get_schema_name()+" is not a stream.\n";
+                               error_code = 1;
+                       }
+               }
+
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 //                             Verify that only t0 is referenced.
@@ -1778,6 +1980,237 @@ public:
 };
 
 
+
+//     TODO : put tests on other operators to ensure they dont' read from a watchlist
+//     TODO : register with : is_partn_compatible pushdown_partn_operator is_pushdown_compatible pushdown_operator ?
+class watch_join_qpn: public qp_node{
+public:
+       std::vector<tablevar_t *> from;                                 //      Source tables
+       std::vector<select_element *> select_list;      //      Select list
+       std::vector<cnf_elem *> pred_t0;                        // main (R) preds
+       std::vector<cnf_elem *> pred_t1;                        // watchlist-only (S) preds (?)
+       std::map<std::string, cnf_elem *> hash_eq;      // predicates on S hash keys
+       std::vector<cnf_elem *> join_filter;            // ref's R, S, but not a hash
+       std::vector<cnf_elem *> postfilter;                     // ref's no table.
+
+       std::vector<std::string> key_flds;
+
+       std::vector<cnf_elem *> where;                          // all the filters
+                                                                                               // useful for summary analysis
+
+       std::vector<scalarexp_t *> hash_src_r, hash_src_l;
+       std::vector<scalarexp_t *> get_hash_r(){return hash_src_r;}
+       std::vector<scalarexp_t *> get_hash_l(){return hash_src_l;}
+
+
+
+       std::string node_type(){return("watch_join");   };
+    bool makes_transform(){return true;};
+       std::vector<std::string> external_libs(){
+               std::vector<std::string> ret;
+               return ret;
+       }
+
+       void bind_to_schema(table_list *Schema);
+       col_id_set get_colrefs(bool ext_fcns_only,table_list *Schema);
+
+       std::string to_query_string();
+       std::string generate_functor(table_list *schema, ext_fcn_list *Ext_fcns, std::vector<bool> &needs_xform){
+               fprintf(stderr,"INTERNAL ERROR, watch_join_qpn::generate_functor called\n");
+               exit(1);
+       }
+       std::string generate_functor_name(){
+               fprintf(stderr,"INTERNAL ERROR, watch_join_qpn::generate_functor_name called\n");
+               exit(1);
+       }
+       std::string generate_operator(int i, std::string params){
+               fprintf(stderr,"INTERNAL ERROR, watch_join_qpn::generate_operator called\n");
+               exit(1);
+       }
+       std::string get_include_file(){return("#include <watchlist_operator.h>\n");};
+
+    std::vector<select_element *> get_select_list(){return select_list;};
+    std::vector<scalarexp_t *> get_select_se_list(){
+               std::vector<scalarexp_t *> ret;
+               int i;
+               for(i=0;i<select_list.size();++i) ret.push_back(select_list[i]->se);
+               return ret;
+       };
+//                     Used for LFTA only
+       void append_to_where(cnf_elem *c){
+               where.push_back(c);
+       }
+
+    std::vector<cnf_elem *> get_where_clause(){return where;}
+
+    std::vector<cnf_elem *> get_filter_clause(){return pred_t0;}
+
+       cplx_lit_table *get_cplx_lit_tbl(ext_fcn_list *Ext_fcns);
+    std::vector<handle_param_tbl_entry *> get_handle_param_tbl(ext_fcn_list *Ext_fcns);
+
+       table_def *get_fields();
+//             It should be feasible to find keys in a watchlist join
+       std::vector<string> get_tbl_keys(std::vector<std::string> &partial_keys){
+               std::vector<string> ret;
+               return ret;
+       }
+
+       std::vector<tablevar_t *> get_input_tbls();
+       std::vector<tablevar_t *> get_output_tbls();
+
+       std::vector<qp_node *> split_node_for_fta(ext_fcn_list *Ext_fcns, table_list *Schema, int &hfta_returned, ifq_t *ifdb, int n_virtual_ifaces, int hfta_parallelism, int hfta_idx);
+       int resolve_if_params(ifq_t *ifdb, std::string &err);
+
+       virtual std::vector<table_exp_t *> extract_opview(table_list *Schema, std::vector<query_node *> &qnodes,  opview_set &opviews, std::string rootnm, std::string silo_nm);
+//             Ensure that any refs to interface params have been split away.
+       int count_ifp_refs(std::set<std::string> &ifpnames);
+
+//             CONSTRUCTOR
+       watch_join_qpn(){
+       };
+       watch_join_qpn(query_summary_class *qs,table_list *Schema){
+               int i,w;
+//                             Get the table name.
+//                             NOTE the colrefs have the table ref (an int)
+//                             embedded in them.  Would it make sense
+//                             to grab the whole table list?
+               from = qs->fta_tree->get_from()->get_table_list();
+               if(from.size() != 2){
+                       char tmpstr[200];
+                       sprintf(tmpstr,"ERROR building filter_join_qpn node: query defined over %lu tables, but joins must be between two sources.\n",from.size() );
+                       err_str += tmpstr;
+                       error_code = 1;
+               }
+
+               int t = from[0]->get_schema_ref();
+               if(Schema->get_schema_type(t) != PROTOCOL_SCHEMA){
+                       err_str += "ERROR in query "+node_name+", the LHS of the join must be a PROTOCOL\n";
+                       error_code = 1;
+               }
+               t = from[1]->get_schema_ref();
+               if(Schema->get_schema_type(t) != WATCHLIST_SCHEMA){
+                       err_str += "ERROR in query "+node_name+", the RHS of the join must be a WATCHLIST\n";
+                       error_code = 1;
+               }
+               key_flds = Schema->get_table(t)->get_keys();
+
+
+//                             Get the select list.
+               select_list = qs->fta_tree->get_sl_vec();
+
+//                             Get the selection predicate.
+               where = qs->wh_cnf;
+               std::vector<cnf_elem *> t0_only, t1_only;
+               for(w=0;w<where.size();++w){
+                       analyze_cnf(where[w]);
+                       std::vector<int> pred_tbls;
+                       get_tablevar_ref_pr(where[w]->pr,pred_tbls);
+//                             Collect the list of preds by src var,
+//                             extract the shared preds later.
+                       if(pred_tbls.size()==1){
+                               if(pred_tbls[0] == 0){
+                                       pred_t0.push_back(where[w]);
+                               }else{
+                                       pred_t1.push_back(where[w]);
+                               }
+                               continue;
+                       }
+//                             refs nothing -- might be sampling, do it as postfilter.
+                       if(pred_tbls.size()==0){
+                               postfilter.push_back(where[w]);
+                               continue;
+                       }
+
+//             Must reference both
+//                             See if it can be a hash predicate.
+                       if(where[w]->is_atom && where[w]->eq_pred){
+                               std::vector<int> sel_tbls, ser_tbls;
+                               get_tablevar_ref_se(where[w]->pr->get_left_se(),sel_tbls);
+                               get_tablevar_ref_se(where[w]->pr->get_right_se(),ser_tbls);
+                               if(sel_tbls.size()==1 && ser_tbls.size()==1 && sel_tbls[0] != ser_tbls[0]){
+//                                             make channel 0 SE on LHS.
+                                       if(sel_tbls[0] != 0)
+                                               where[w]->swap_scalar_operands();
+
+//             Must be simple (a colref) on the RHS
+                                               if(where[w]->r_simple){
+                                                       string rcol = where[w]->pr->get_right_se()->get_colref()->get_field();
+                                                       if(std::find(key_flds.begin(), key_flds.end(), rcol) != key_flds.end()){
+                                                               hash_eq[rcol] = where[w];
+
+                                                               data_type *dtl=where[w]->pr->get_left_se()->get_data_type();
+                                                               data_type *dtr=where[w]->pr->get_right_se()->get_data_type();
+                                                               if( (dtl->is_increasing() && dtr->is_increasing()) || (dtl->is_decreasing() && dtr->is_decreasing()) )
+                                                                       err_str += "Warning, a watchlist join should not have join predicates on temporal fields, query "+node_name+".\n";
+                                                       continue;
+                                               }
+                                       }
+                               }
+                       }
+//                             All tests failed, fallback is join_filter.
+                       join_filter.push_back(where[w]);
+               }
+
+               if(key_flds.size() > hash_eq.size()){
+                       err_str += "Error, in query "+node_name+" the watchlist join does not cover all fields in the watchlist with an equality predicate.  Missing fields are";
+                       for(int k=0;k<key_flds.size();++k){
+                               if(hash_eq.count(key_flds[k]) < 1){
+                                       err_str += " "+key_flds[k];
+                               }
+                       }
+                       err_str += ".\n";
+                       error_code = 5;
+               }
+                                       
+
+//                             Get the parameters
+               param_tbl = qs->param_tbl;
+               definitions = qs->definitions;
+
+       };
+
+       // the following method is used for distributed query optimization
+       double get_rate_estimate();
+
+
+       qp_node* make_copy(std::string suffix){
+               watch_join_qpn *ret = new watch_join_qpn();
+
+               ret->param_tbl = new param_table();
+               std::vector<std::string> param_names = param_tbl->get_param_names();
+               int pi;
+               for(pi=0;pi<param_names.size();pi++){
+                       data_type *dt = param_tbl->get_data_type(param_names[pi]);
+                       ret->param_tbl->add_param(param_names[pi],dt->duplicate(),
+                                                       param_tbl->handle_access(param_names[pi]));
+               }
+               ret->definitions = definitions;
+
+               ret->node_name = node_name + suffix;
+
+               // make shallow copy of all fields
+               ret->where = where;
+               ret->from = from;
+               ret->select_list = select_list;
+               ret->key_flds = key_flds;
+               ret->pred_t0 = pred_t0;
+               ret->pred_t1 = pred_t1;
+               ret->join_filter = join_filter;
+               ret->postfilter = postfilter;
+               ret->hash_eq = hash_eq;
+               ret->hash_src_r = hash_src_r;
+               ret->hash_src_l = hash_src_l;
+
+               return ret;
+       };
+
+       void create_protocol_se(vector<qp_node *> q_sources, table_list *Schema);
+
+};
+
+
+
+
 enum output_file_type_enum {regular, gzip, bzip};
 
 class output_file_qpn: public qp_node{
@@ -1886,6 +2319,18 @@ public:
                hfta_query_name = qn;
                eat_input = ei;
 
+//                     TODO stream checking, but it requires passing Schema to output_file_qpn
+/*
+               for(int f=0;f<fm.size();++f){
+                       int t=fm[f]->get_schema_ref();
+                       if(! Schema->is_stream(t)){
+                               err_str += "ERROR in query "+node_name+", the source "+from[f]->get_schema_name()+" is not a stream.\n";
+                               error_code = 1;
+                       }
+               }
+*/
+
+
                do_gzip = false;
                compression_type = regular;
                if(ospec->operator_type == "zfile")
@@ -2064,6 +2509,13 @@ public:
                }
                table_name = (tbl_vec[0]);
 
+               int t = tbl_vec[0]->get_schema_ref();
+               if(! Schema->is_stream(t)){
+                       err_str += "ERROR in query "+node_name+", the source "+table_name->get_schema_name()+" is not a stream.\n";
+                       error_code = 1;
+               }
+
+
 //                             Get the select list.
                select_list = qs->fta_tree->get_sl_vec();
 
@@ -2155,5 +2607,4 @@ void untaboo(string &s);
 table_def *create_attributes(string tname, vector<select_element *> &select_list);
 
 
-
 #endif
index 9d12cb0..faa1ea3 100644 (file)
@@ -284,7 +284,8 @@ bool stream_query::generate_linkage(){
                                qhead = n;
                        }
                  }
-                 if(query_plan[n]->n_predecessors() < query_plan[n]->get_input_tbls().size()){
+// does the query node read a source, or is it a source?
+                 if(query_plan[n]->n_predecessors() < query_plan[n]->get_input_tbls().size() || query_plan[n]->get_input_tbls().size() == 0){
                        qtail.push_back(n);
                  }
                }
@@ -1956,6 +1957,10 @@ void get_prefilter_temporal_cids(std::vector<stream_query *> lfta_list, col_id_s
                        ci.load_from_colref(fj_node->temporal_var);
                        temp_cids.insert(ci);
                }
+               if(lfta_list[s]->query_plan[0]->node_type() == "watch_join"){
+                       watch_join_qpn *wj_node = (watch_join_qpn *)lfta_list[s]->query_plan[0];
+                       sl_list = wj_node->get_select_se_list();
+               }
 
                for(sl=0;sl<sl_list.size();sl++){
                        data_type *sdt = sl_list[sl]->get_data_type();
index 41df197..b6855ff 100644 (file)
@@ -164,7 +164,7 @@ int main(int argc, char **argv){
 
   set<int>::iterator si;
 
-  vector<string> query_names;                  // for lfta.c registration
+  vector<string> registration_query_names;                     // for lfta.c registration
   map<string, vector<int> > mach_query_names;  // list queries of machine
   vector<int> snap_lengths;                            // for lfta.c registration
   vector<string> interface_names;                      // for lfta.c registration
@@ -633,24 +633,31 @@ int main(int argc, char **argv){
   map<string, string> lfta_prefilter_val;
 
   string lfta_header =
-"#include <limits.h>\n\n"
+"#include <limits.h>\n"
 "#include \"rts.h\"\n"
 "#include \"fta.h\"\n"
 "#include \"lapp.h\"\n"
-"#include \"rts_udaf.h\"\n\n"
+"#include \"rts_udaf.h\"\n"
+"#include<stdio.h>\n"
+"#include <float.h>\n"
+"#include \"rdtsc.h\"\n"
+"#include \"watchlist.h\"\n\n"
+
 ;
 // Get any locally defined parsing headers
     glob_t glob_result;
     memset(&glob_result, 0, sizeof(glob_result));
 
-    // do the glob operation
+    // do the glob operation TODO should be from GSROOT
     int return_value = glob("../../include/lfta/local/*h", GLOB_TILDE, NULL, &glob_result);
        if(return_value == 0){
+               lfta_header += "\n";
        for(size_t i = 0; i < glob_result.gl_pathc; ++i) {
                        char *flds[1000];
                        int nflds = split_string(glob_result.gl_pathv[i],'/',flds,1000);
-                       lfta_header += "#include \"local/"+string(flds[nflds-1])+"\"\n\n";
+                       lfta_header += "#include \"local/"+string(flds[nflds-1])+"\"\n";
        }
+               lfta_header += "\n";
        }else{
                fprintf(stderr,"Warning, glob on ../../include/lfta/local/*h failed.\n");
        }
@@ -1895,8 +1902,16 @@ for(q=0;q<hfta_sets.size();++q){
           if(lfta_names.count(split_queries[l]->query_name) == 0){
 //                             Grab the lfta for global optimization.
                vector<tablevar_t *> tvec =  split_queries[l]->query_plan[0]->get_input_tbls();
-               string liface = tvec[0]->get_interface();       // iface queries have been resolved
-               string lmach = tvec[0]->get_machine();
+               string liface = "_local_";
+//             string lmach = "";
+               string lmach = hostname;
+               if(tvec.size()>0){
+                       liface = tvec[0]->get_interface();      // iface queries have been resolved
+                       lmach = tvec[0]->get_machine();
+               } // else{
+                       interface_names.push_back(liface);
+                       machine_names.push_back(lmach);
+//             }
 
                vector<predicate_t *> schemaid_preds;
                for(int irv=0;irv<tvec.size();++irv){
@@ -1906,8 +1921,9 @@ for(q=0;q<hfta_sets.size();++q){
                        int schema_ref = tvec[irv]->get_schema_ref();
                        if (lmach == "")
                                lmach = hostname;
-                       interface_names.push_back(liface);
-                       machine_names.push_back(lmach);
+//                     interface_names.push_back(liface);
+//                     machine_names.push_back(lmach);
+
 //printf("Machine is %s\n",lmach.c_str());
 
 //                             Check if a schemaId constraint needs to be inserted.
@@ -1922,7 +1938,10 @@ for(q=0;q<hfta_sets.size();++q){
                                fprintf(stderr,"Error looking up the interface %s on host %s: %s\n",liface.c_str(), lmach.c_str(), if_error.c_str());
                                exit(1);
                        }       
-                       if(iface->has_multiple_schemas()){
+
+
+                       if(tvec[irv]->get_interface() != "_local_"){
+                        if(iface->has_multiple_schemas()){
                                if(schema_id<0){        // invalid schema_id
                                        fprintf(stderr,"Error, schema %s has no schema_id, but is sourced from multi-schema interface %s (ref'd in query %s)\n", schema_name.c_str(), liface.c_str(), split_queries[0]->query_name.c_str());
                                        exit(1);
@@ -1945,7 +1964,7 @@ for(q=0;q<hfta_sets.size();++q){
                                                exit(1);
                                        }
                                }
-                       }else{  // single-schema interface
+                        }else{ // single-schema interface
                                schema_id = -1; // don't generate schema_id predicate
                                vector<string> iface_schemas = iface->get_property("Schemas");
                                if(iface_schemas.size()>0 && find(iface_schemas.begin(), iface_schemas.end(), schema_name) == iface_schemas.end()){
@@ -1956,7 +1975,10 @@ for(q=0;q<hfta_sets.size();++q){
                                        fprintf(stderr, "ERROR, interface %s is a single-schema interface, but has %d elements in its Schemas list.\n", liface.c_str(), (int)iface_schemas.size());
                                        exit(1);
                                }
-                       }                       
+                        }                      
+                       }else{
+                               schema_id = -1;
+                       }
 
 // If we need to check the schema_id, insert a predicate into the lfta.
 //      TODO not just schema_id, the full all_schema_ids set.
@@ -1983,7 +2005,8 @@ for(q=0;q<hfta_sets.size();++q){
 // cnf built, now insert it.
                                split_queries[l]->query_plan[0]->append_to_where(clist[0]);
 
-// Specialized processing ... currently filter join
+// Specialized processing 
+//             filter join, get two schemaid preds
                                string node_type = split_queries[l]->query_plan[0]->node_type();
                                if(node_type == "filter_join"){
                                        filter_join_qpn *fj = (filter_join_qpn *)split_queries[l]->query_plan[0];
@@ -1994,10 +2017,18 @@ for(q=0;q<hfta_sets.size();++q){
                                        }
                                        schemaid_preds.push_back(schid_pr);
                                }
+//             watchlist join, get the first schemaid pred
+                               if(node_type == "watch_join"){
+                                       watch_join_qpn *fj = (watch_join_qpn *)split_queries[l]->query_plan[0];
+                                       if(irv==0){
+                                               fj->pred_t0.push_back(clist[0]);
+                                               schemaid_preds.push_back(schid_pr);
+                                       }
+                               }
                        }
                }
 // Specialized processing, currently filter join.
-               if(schemaid_preds.size()>0){
+               if(schemaid_preds.size()>1){
                        string node_type = split_queries[l]->query_plan[0]->node_type();
                        if(node_type == "filter_join"){
                                filter_join_qpn *fj = (filter_join_qpn *)split_queries[l]->query_plan[0];
@@ -2056,8 +2087,12 @@ for(q=0;q<hfta_sets.size();++q){
 */
 
                snap_lengths.push_back(compute_snap_len(split_queries[l]->query_plan[0], Schema));
-               query_names.push_back(split_queries[l]->query_name);
-               mach_query_names[lmach].push_back(query_names.size()-1);
+
+// TODO NOTE : I'd like it to be the case that registration_query_names
+//     are the queries to be registered for subsciption.
+//     but there is some complex bookkeeping here.
+               registration_query_names.push_back(split_queries[l]->query_name);
+               mach_query_names[lmach].push_back(registration_query_names.size()-1);
 //                     NOTE: I will assume a 1-1 correspondance between
 //                     mach_query_names[lmach] and lfta_mach_lists[lmach]
 //                     where mach_query_names[lmach][i] contains the index into
@@ -2191,7 +2226,7 @@ if (partitioned_mode) {
 }
 
 
-print_hftas("preopt_hfta_info.txt", hfta_list, lfta_names, query_names, interface_names);
+print_hftas("preopt_hfta_info.txt", hfta_list, lfta_names, registration_query_names, interface_names);
 
 int num_hfta = hfta_list.size();
 for(i=0; i < hfta_list.size(); ++i){
@@ -2204,7 +2239,7 @@ for(i=num_hfta; i < hfta_list.size(); ++i){
                Schema->append_table(td);
 }
 
-print_hftas("postopt_hfta_info.txt", hfta_list, lfta_names, query_names, interface_names);
+print_hftas("postopt_hfta_info.txt", hfta_list, lfta_names, registration_query_names, interface_names);
 
 
 
@@ -2341,7 +2376,7 @@ for(i=0;i<hfta_list.size();++i){          // query also has an HFTA component
                                missing_keys.push_back(hfta_keys[ki]);
                  }
                  if(missing_keys.size()>0){
-                       fprintf(stderr, "Error, HFTA stream %s has keys defined which aren't in the outputg:", hfta_list[i]->get_output_tabledef()->get_tbl_name().c_str());
+                       fprintf(stderr, "Error, HFTA stream %s has keys defined which aren't in the output:", hfta_list[i]->get_output_tabledef()->get_tbl_name().c_str());
                        for(int hi=0; hi<missing_keys.size(); ++hi){
                                fprintf(stderr," %s", missing_keys[hi].c_str());
                        }
@@ -2463,7 +2498,10 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                int li;
                for(li=0;li<mach_lftas.size();++li){
                        vector<tablevar_t *> tvec =  mach_lftas[li]->query_plan[0]->get_input_tbls();
-                       string lfta_iface = tvec[0]->get_interface();
+                       string lfta_iface = "_local_";
+                       if(tvec.size()>0){
+                               string lfta_iface = tvec[0]->get_interface();
+                       }
                        lfta_iface_lists[lfta_iface].push_back(mach_lftas[li]);
                }
 
@@ -2524,7 +2562,10 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                                                         // for fta_init
                for(li=0;li<mach_lftas.size();++li){
                        vector<tablevar_t *> tvec =  mach_lftas[li]->query_plan[0]->get_input_tbls();
-                       string lfta_iface = tvec[0]->get_interface();
+                       string lfta_iface = "_local_";
+                       if(tvec.size()>0){
+                               lfta_iface = tvec[0]->get_interface();
+                       }
                        lfta_iface_lists[lfta_iface].push_back(mach_lftas[li]);
                        lfta_iface_qname_ix[lfta_iface].push_back(mach_query_names[lmach][li]);
                }
@@ -2535,11 +2576,14 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
 //     But this is defunct code for gs-lite
                for(li=0;li<mach_lftas.size();++li){
                  vector<tablevar_t *> tvec =  mach_lftas[li]->query_plan[0]->get_input_tbls();
-                 string liface = tvec[0]->get_interface();
+                 string liface = "_local_";
+                 if(tvec.size()>0){
+                        liface = tvec[0]->get_interface();
+                 }
                  vector<string> iface_codegen_type = ifaces_db->get_iface_vals(lmach,liface,"iface_codegen_type",erri,err_str);
                  if(iface_codegen_type.size()){
                        if(npdb->get_nic_prop_val(iface_codegen_type[0],"Return",erri) == "Packed"){
-                         packed_return = true;
+                       packed_return = true;
                        }
                  }
                }
@@ -2670,7 +2714,10 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                        lfta_val[lmach] += "\t} else if (!strcmp(iface_name, \"" + *sir + "\")) {\n";
 
                // iterate through interface properties
-               vector<string> iface_properties = ifaces_db->get_iface_properties(lmach,*sir,erri,err_str);
+               vector<string> iface_properties;
+               if(*sir!="_local_"){    // dummy watchlist interface, don't process.
+                       iface_properties = ifaces_db->get_iface_properties(lmach,*sir,erri,err_str);
+               }
                if (erri) {
                        fprintf(stderr,"ERROR cannot retrieve interface properties for %s.%s, %s\n",lmach.c_str(), sir->c_str(), err_str.c_str());
                        exit(1);
@@ -2707,11 +2754,25 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
          lfta_val[lmach] += "// list of FTAs clearinghouse expects to register themselves\n";
          lfta_val[lmach] += "const gs_sp_t fta_names[] = {";
 
-         for (i = 0; i < query_names.size(); ++i) {
-                  if (i)
-                         lfta_val[lmach] += ", ";
-                  lfta_val[lmach] += "\"" + query_names[i] + "\"";
+         bool first = true;
+         for(auto mvsi=lfta_iface_lists.begin(); mvsi!=lfta_iface_lists.end(); ++mvsi){
+               string liface = (*mvsi).first;
+               if(liface != "_local_"){        // these don't register themselves
+                       vector<stream_query *> lfta_list = (*mvsi).second;
+                       for(i=0;i<lfta_list.size();i++){
+                               int mi = lfta_iface_qname_ix[liface][i];
+                               if(first) first = false;
+                               else      lfta_val[lmach] += ", ";
+                               lfta_val[lmach] += "\"" + registration_query_names[mi] + "\"";
+                       }
+               }
          }
+//       for (i = 0; i < registration_query_names.size(); ++i) {
+//                if (i)
+//                       lfta_val[lmach] += ", ";
+//                lfta_val[lmach] += "\"" + registration_query_names[i] + "\"";
+//       }
+
          for (i = 0; i < hfta_list.size(); ++i) {
                   lfta_val[lmach] += ", \"" + hfta_list[i]->query_name + "\"";
          }
@@ -2723,6 +2784,7 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
 //     set the prefilter function accordingly.
 //     see the example in demo/err2
          lfta_val[lmach] += "void fta_init(gs_sp_t device){\n";
+         lfta_val[lmach] += "//        note: the last parameter in fta_register is the prefilter signature\n";
 
 //       for(i=0;i<mach_query_names[lmach].size();i++)
 //             int mi = mach_query_names[lmach][i];
@@ -2734,6 +2796,13 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                for(i=0;i<lfta_list.size();i++){
                        stream_query *lfta_sq = lfta_list[i];
                        int mi = lfta_iface_qname_ix[liface][i];
+
+                       if(liface == "_local_"){
+//  Don't register an init function, do the init code inline
+                               lfta_val[lmach] += "// initialization code for "+registration_query_names[mi]+";\n";
+                               lfta_val[lmach] += "\t"+generate_watchlist_name(registration_query_names[mi])+".filename = "+generate_watchlist_name(registration_query_names[mi])+"__fstr;\n";
+                               continue;
+                       }
                
                        fprintf(stderr,"interface %s, LFTA %d, snap length is %d\n",liface.c_str(),mi,snap_lengths[mi]);
 
@@ -2741,7 +2810,7 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                        if(interface_names[mi]!="")
                                this_iface = '"'+interface_names[mi]+'"';
                        lfta_val[lmach] += "\tif(!strcmp(device,"+this_iface+"))\n";
-               lfta_val[lmach] += "\t\tfta_register(\""+query_names[mi]+"\", " + (lfta_reuse_options[mi]?"1":"0") + ", ";
+               lfta_val[lmach] += "\t\tfta_register(\""+registration_query_names[mi]+"\", " + (lfta_reuse_options[mi]?"1":"0") + ", ";
 //             if(interface_names[mi]=="")
 //                             lfta_val[lmach]+="DEFAULTDEV";
 //             else
@@ -2749,8 +2818,8 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                        lfta_val[lmach] += this_iface;
 
 
-               lfta_val[lmach] += ", "+generate_alloc_name(query_names[mi])
-                       +"\n#ifndef LFTA_IN_NIC\n\t,"+generate_schema_string_name(query_names[mi])
+               lfta_val[lmach] += ", "+generate_alloc_name(registration_query_names[mi])
+                       +"\n#ifndef LFTA_IN_NIC\n\t,"+generate_schema_string_name(registration_query_names[mi])
                        +"\n#endif\n";
                                sprintf(tmpstr,",%d",snap_lengths[mi]);
                        lfta_val[lmach] += tmpstr;
@@ -2812,7 +2881,7 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
 
 //                     NOTE : I'm assuming that visible lftas do not start with _fta.
 //                             -- will fail for non-visible simple selection queries.
-               if(field_verifier != NULL && query_names[mi].substr(0,1) != "_"){
+               if(field_verifier != NULL && registration_query_names[mi].substr(0,1) != "_"){
                        string warning_str;
                        if(lfta_comment == "")
                                warning_str += "\tcomment not found.\n";
@@ -2829,26 +2898,30 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e
                        }
                        if(warning_str != "")
                                fprintf(stderr,"Warning, in LFTA stream %s:\n%s",
-                                       query_names[mi].c_str(),warning_str.c_str());
+                                       registration_query_names[mi].c_str(),warning_str.c_str());
                }
 
 
 //                     Create qtree output
-               fprintf(qtree_output,"\t<LFTA name='%s' >\n",query_names[mi].c_str());
-                  if(lfta_comment != "")
-                        fprintf(qtree_output,"\t\t<Description value='%s' />\n",lfta_comment.c_str());
-                  if(lfta_title != "")
-                        fprintf(qtree_output,"\t\t<Title value='%s' />\n",lfta_title.c_str());
-                  if(lfta_namespace != "")
-                        fprintf(qtree_output,"\t\t<Namespace value='%s' />\n",lfta_namespace.c_str());
-                  if(lfta_ht_size != "")
-                        fprintf(qtree_output,"\t\t<HtSize value='%s' />\n",lfta_ht_size.c_str());
+               fprintf(qtree_output,"\t<LFTA name='%s' >\n",registration_query_names[mi].c_str());
+        if(lfta_comment != "")
+              fprintf(qtree_output,"\t\t<Description value='%s' />\n",lfta_comment.c_str());
+        if(lfta_title != "")
+              fprintf(qtree_output,"\t\t<Title value='%s' />\n",lfta_title.c_str());
+        if(lfta_namespace != "")
+              fprintf(qtree_output,"\t\t<Namespace value='%s' />\n",lfta_namespace.c_str());
+        if(lfta_ht_size != "")
+              fprintf(qtree_output,"\t\t<HtSize value='%s' />\n",lfta_ht_size.c_str());
                if(lmach != "")
                  fprintf(qtree_output,"\t\t<Host value='%s' />\n",lmach.c_str());
                else
                  fprintf(qtree_output,"\t\t<Host value='%s' />\n",hostname.c_str());
                fprintf(qtree_output,"\t\t<Interface  value='%s' />\n",interface_names[mi].c_str());
-               fprintf(qtree_output,"\t\t<ReadsFrom value='%s' />\n",interface_names[mi].c_str());
+               std::vector<tablevar_t *> itbls = lfta_sq->get_input_tables();
+               for(int t=0;t<itbls.size();++t){
+                       fprintf(qtree_output,"\t\t<ReadsFrom value='%s' />\n",itbls[t]->get_schema_name().c_str());
+               }
+//             fprintf(qtree_output,"\t\t<ReadsFrom value='%s' />\n",interface_names[mi].c_str());
                fprintf(qtree_output,"\t\t<Rate value='100' />\n");
                fprintf(qtree_output,"\t\t<LivenessTimeout value='%d' />\n", lfta_liveness_timeouts[mi]);
 //                             write info about fields to qtree.xml
@@ -2996,6 +3069,8 @@ void generate_makefile(vector<string> &input_file_names, int nfiles,
 //             for an interface type
 
        bool use_proto = false;
+       bool use_bsa = false;
+       bool use_kafka = false;
        int erri;
        string err_str;
        for(ssi=ifaces.begin();ssi!=ifaces.end();++ssi){
@@ -3006,6 +3081,18 @@ void generate_makefile(vector<string> &input_file_names, int nfiles,
                                use_proto = true;
                        }
                }
+               ift = ifdb->get_iface_vals(ifmachines[ifnm],ifnm, "BSA", erri, err_str);
+               for(int ift_i=0;ift_i<ift.size();ift_i++){
+                       if(ift[ift_i] == "TRUE" || ift[ift_i] == "True" || ift[ift_i] == "true"){       
+                               use_bsa = true;
+                       }
+               }
+               ift = ifdb->get_iface_vals(ifmachines[ifnm],ifnm, "KAFKA", erri, err_str);
+               for(int ift_i=0;ift_i<ift.size();ift_i++){
+                       if(ift[ift_i] == "TRUE" || ift[ift_i] == "True" || ift[ift_i] == "true"){       
+                               use_kafka = true;
+                       }
+               }
        }
 
        fprintf(outfl,
@@ -3035,6 +3122,10 @@ void generate_makefile(vector<string> &input_file_names, int nfiles,
                fprintf(outfl, " -ldll -ldl ");
        if(use_proto)
                fprintf(outfl, " -L/usr/local/lib/ -lprotobuf-c ");
+       if(use_bsa)
+               fprintf(outfl, " -lbsa_stream ");
+       if(use_kafka)
+               fprintf(outfl, " -lrdkafka ");
        fprintf(outfl," -lgscpaux");
 #ifdef GCOV
        fprintf(outfl," -fprofile-arcs");
@@ -3117,6 +3208,9 @@ void generate_makefile(vector<string> &input_file_names, int nfiles,
 //     string err_str;
        for(ssi=ifaces.begin();ssi!=ifaces.end();++ssi){
                string ifnm = (*ssi);
+               // suppress internal _local_ interface
+               if (ifnm == "_local_")
+                       continue;
                fprintf(outfl, "%s ",ifnm.c_str());
                vector<string> ifv = ifdb->get_iface_vals(ifmachines[ifnm],ifnm, "Command", erri, err_str);
                for(j=0;j<ifv.size();++j)
index 04f5c86..9772ec0 100644 (file)
@@ -1901,3 +1901,34 @@ string data_type::get_max_literal() {
 
 }
 
+string data_type::get_wl_extract_fcn() {
+       switch(type){
+       case int_t:
+               return("wl_csv_int");
+       case bool_t:
+               return("wl_csv_bool");
+       case u_short_t:
+       case u_int_t:
+               return("wl_csv_uint");
+       case ip_t:
+               return("wl_csv_ip");
+       case u_llong_t:
+               return("wl_csv_ullong");
+       case llong_t:
+               return("wl_csv_llong");
+       case floating_t:
+               return("wl_csv_float");
+       case timeval_t:
+               return("ERROR_TIMEVAL_T_EXTRACTION_NOT_SUPPORTED");
+       case ipv6_t:
+               return("wl_csv_ipv6");
+       case v_str_t:
+       case fstring_t:
+               return("wl_csv_string");
+       default:
+               return("ERROR: Unknown type in data_type::get_wl_extract_fcn\n");
+       }
+
+}
+
+
index 2f73026..f136ae9 100644 (file)
@@ -155,6 +155,9 @@ bool equal(data_type *o);
   std::string get_min_literal();
   std::string get_max_literal();
 
+//     char* to X functions
+  std::string get_wl_extract_fcn();
+
 
 };
 
index ab94a01..ccae6e3 100644 (file)
@@ -92,6 +92,39 @@ void hfta_vstr_replace(vstring *dst, vstring *src){
        hfta_vstr_assign_with_copy(dst,src);
 }
 
+#define HFTA_VSTR_LHASHFUNC_PRIME 12916008961267169387ull
+gs_uint64_t hfta_vstr_long_hashfunc(const vstring *s) {
+       gs_uint64_t hash_code;
+       gs_int32_t n_steps;
+       gs_int32_t substr_len;
+       gs_int32_t j, k;
+       gs_uint64_t sub_hash;
+       gs_sp_t sv;
+
+       sv=(gs_sp_t)(s->offset);
+       hash_code = 0;
+       n_steps = s->length / 4;
+       if(4*n_steps < s->length) n_steps++;
+
+       for (j = 0; j <  n_steps; j++) {
+               if(4*(j+1) < s->length) substr_len = 4;
+               else                  substr_len = s->length - 4*j;
+
+               sub_hash = 0;
+               for(k=0;k<4;k++){
+                 if(k < substr_len)
+                       sub_hash = (sub_hash << 4) + *sv;
+                 else
+                       sub_hash = (sub_hash << 4);
+                 sv++;
+               }
+
+               hash_code = (sub_hash + hash_code * HFTA_VSTR_LHASHFUNC_PRIME);
+       }
+
+       return(hash_code);
+}
+
 #define HFTA_VSTR_HASHFUNC_PRIME 2995999
 gs_uint32_t hfta_vstr_hashfunc(const vstring *s) {
        gs_uint32_t hash_code;
@@ -101,7 +134,6 @@ gs_uint32_t hfta_vstr_hashfunc(const vstring *s) {
        gs_uint32_t k, sub_hash;
        gs_sp_t sv;
 
-
        sv=(gs_sp_t)(s->offset);
        hash_code = 0;
        n_steps = s->length / 4;
@@ -126,6 +158,7 @@ gs_uint32_t hfta_vstr_hashfunc(const vstring *s) {
        return(hash_code);
 }
 
+
 //     return negative if s1 < s2, 0 if s1==s2, positive if s1>s2
 gs_retval_t hfta_vstr_compare(const vstring * s1, const vstring * s2) {
        gs_int32_t minlen,cmp_ret;
index aa44d24..1366cef 100644 (file)
@@ -274,6 +274,7 @@ gs_float_t extr_avg_fcn(vstring *v){
 //             FIRST aggregate
 // hfta only
 
+// uint
 void FIRST_HFTA_AGGR_INIT_(gs_uint32_t* scratch) {
        *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
 }
@@ -287,6 +288,22 @@ void FIRST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
 }
 void FIRST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { }
 
+// int
+
+void FIRST_HFTA_AGGR_INIT_(gs_int32_t* scratch) {
+       *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
+}
+void FIRST_HFTA_AGGR_REINIT_(gs_int32_t* scratch) { }
+void FIRST_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
+       if (*scratch == UINT_MAX)
+               *scratch = val;
+}
+void FIRST_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
+       *res = *scratch;
+}
+void FIRST_HFTA_AGGR_DESTROY_(gs_int32_t* scratch) { }
+
+// ullong
 void FIRST_HFTA_AGGR_INIT_(gs_uint64_t* scratch) {
        *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
 }
@@ -300,89 +317,100 @@ void FIRST_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
 }
 void FIRST_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
 
-
-
-void FIRST_ULL_HFTA_AGGR_INIT_(gs_uint64_t* scratch) {
+// llong
+void FIRST_HFTA_AGGR_INIT_(gs_int64_t* scratch) {
        *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
 }
-
-void FIRST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
-
-void FIRST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
+void FIRST_HFTA_AGGR_REINIT_(gs_int64_t* scratch) { }
+void FIRST_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
        if (*scratch == UINT_MAX)
                *scratch = val;
 }
-
-void FIRST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
+void FIRST_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
        *res = *scratch;
 }
+void FIRST_HFTA_AGGR_DESTROY_(gs_int64_t* scratch) { }
 
-void FIRST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
-
-
-void FIRST_STR_HFTA_AGGR_INIT_(vstring* scratch) {
+// string
+void FIRST_HFTA_AGGR_INIT_(vstring* scratch) {
        scratch->offset= 0;
 }
-
-void FIRST_STR_HFTA_AGGR_REINIT_(vstring* scratch) { }
-
-void FIRST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
+void FIRST_HFTA_AGGR_REINIT_(vstring* scratch) { }
+void FIRST_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
        if (!scratch->offset) {
     scratch->length = val->length;
     scratch->offset = val->offset;
     scratch->reserved = SHALLOW_COPY;
        }
 }
-
-void FIRST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
+void FIRST_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
        *res = *scratch;
 }
-
-void FIRST_STR_HFTA_AGGR_DESTROY_(vstring* scratch) { }
+void FIRST_HFTA_AGGR_DESTROY_(vstring* scratch) { }
 
 // hfta/lfta split
 
+// uint
 void FIRST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch) {
        *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
 }
-
 void FIRST_hfta_HFTA_AGGR_REINIT_(gs_uint32_t* scratch) { }
-
 void FIRST_hfta_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) {
        if (*scratch == UINT_MAX)
                *scratch = val;
 }
-
 void FIRST_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
        *res = *scratch;
 }
-
 void FIRST_hfta_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { }
 
-void FIRST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch) {
+// int
+void FIRST_INT_hfta_HFTA_AGGR_INIT_(gs_int32_t* scratch) {
        *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
 }
+void FIRST_INT_hfta_HFTA_AGGR_REINIT_(gs_int32_t* scratch) { }
+void FIRST_INT_hfta_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
+       if (*scratch == UINT_MAX)
+               *scratch = val;
+}
+void FIRST_INT_hfta_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
+       *res = *scratch;
+}
+void FIRST_INT_hfta_HFTA_AGGR_DESTROY_(gs_int32_t* scratch) { }
 
+// ullong
+void FIRST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch) {
+       *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
+}
 void FIRST_ULL_hfta_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
-
 void FIRST_ULL_hfta_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
        if (*scratch == UINT_MAX)
                *scratch = val;
 }
-
 void FIRST_ULL_hfta_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
        *res = *scratch;
 }
-
 void FIRST_ULL_hfta_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
 
+// llong
+void FIRST_LL_hfta_HFTA_AGGR_INIT_(gs_int64_t* scratch) {
+       *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
+}
+void FIRST_LL_hfta_HFTA_AGGR_REINIT_(gs_int64_t* scratch) { }
+void FIRST_LL_hfta_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
+       if (*scratch == UINT_MAX)
+               *scratch = val;
+}
+void FIRST_LL_hfta_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
+       *res = *scratch;
+}
+void FIRST_LL_hfta_HFTA_AGGR_DESTROY_(gs_int64_t* scratch) { }
 
+// string
 void FIRST_STR_hfta_HFTA_AGGR_INIT_(vstring* scratch) {
        scratch->offset= 0;
 }
-
 void FIRST_STR_hfta_HFTA_AGGR_REINIT_(vstring* scratch) { }
-
 void FIRST_STR_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
        if (!scratch->offset) {
     scratch->length = val->length;
@@ -390,11 +418,9 @@ void FIRST_STR_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
     scratch->reserved = SHALLOW_COPY;
        }
 }
-
 void FIRST_STR_hfta_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
        *res = *scratch;
 }
-
 void FIRST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch) { }
 
 
@@ -403,6 +429,7 @@ void FIRST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch) { }
 
 // hfta only
 
+// uint
 void LAST_HFTA_AGGR_INIT_(gs_uint32_t* scratch) { }
 void LAST_HFTA_AGGR_REINIT_(gs_uint32_t* scratch) { }
 void LAST_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) {
@@ -413,102 +440,228 @@ void LAST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
 }
 void LAST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { }
 
-
-void LAST_HFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
-void LAST_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
-void LAST_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
+// int
+void LAST_HFTA_AGGR_INIT_(gs_int32_t* scratch) { }
+void LAST_HFTA_AGGR_REINIT_(gs_int32_t* scratch) { }
+void LAST_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
        *scratch = val;
 }
-void LAST_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
+void LAST_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
        *res = *scratch;
 }
-void LAST_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
+void LAST_HFTA_AGGR_DESTROY_(gs_int32_t* scratch) { }
 
-
-
-void LAST_ULLHFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
-
-void LAST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
-
-void LAST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
+// llong
+void LAST_HFTA_AGGR_INIT_(gs_int64_t* scratch) { }
+void LAST_HFTA_AGGR_REINIT_(gs_int64_t* scratch) { }
+void LAST_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
        *scratch = val;
 }
-
-void LAST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
+void LAST_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
        *res = *scratch;
 }
+void LAST_HFTA_AGGR_DESTROY_(gs_int64_t* scratch) { }
 
-void LAST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
 
+// ullong
+void LAST_HFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
+void LAST_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
+void LAST_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
+       *scratch = val;
+}
+void LAST_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
+       *res = *scratch;
+}
+void LAST_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
 
-void LAST_STR_HFTA_AGGR_INIT_(vstring* scratch) {
+// string
+void LAST_HFTA_AGGR_INIT_(vstring* scratch) {
        scratch->offset= 0;
 }
-
-void LAST_STR_HFTA_AGGR_REINIT_(vstring* scratch) { }
-
-void LAST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
+void LAST_HFTA_AGGR_REINIT_(vstring* scratch) { }
+void LAST_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
        scratch->length = val->length;
   scratch->offset = val->offset;
   scratch->reserved = SHALLOW_COPY;
 }
-
-void LAST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
+void LAST_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
        *res = *scratch;
 }
-
-void LAST_STR_HFTA_AGGR_DESTROY_(vstring* scratch) { }
+void LAST_HFTA_AGGR_DESTROY_(vstring* scratch) { }
 
 // hfta/lfta split
 
 void LAST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch) { }
-
 void LAST_hfta_HFTA_AGGR_REINIT_(gs_uint32_t* scratch) { }
-
 void LAST_hfta_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) {
        *scratch = val;
 }
-
 void LAST_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
        *res = *scratch;
 }
-
 void LAST_hfta_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { }
 
-void LAST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
+void LAST_INT_hfta_HFTA_AGGR_INIT_(gs_int32_t* scratch) { }
+void LAST_INT_hfta_HFTA_AGGR_REINIT_(gs_int32_t* scratch) { }
+void LAST_INT_hfta_HFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
+       *scratch = val;
+}
+void LAST_INT_hfta_HFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
+       *res = *scratch;
+}
+void LAST_INT_hfta_HFTA_AGGR_DESTROY_(gs_int32_t* scratch) { }
 
+void LAST_ULL_hfta_HFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
 void LAST_ULL_hfta_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { }
-
 void LAST_ULL_hfta_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
        *scratch = val;
 }
-
 void LAST_ULL_hfta_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
        *res = *scratch;
 }
-
 void LAST_ULL_hfta_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { }
 
+void LAST_LL_hfta_HFTA_AGGR_INIT_(gs_int64_t* scratch) { }
+void LAST_LL_hfta_HFTA_AGGR_REINIT_(gs_int64_t* scratch) { }
+void LAST_LL_hfta_HFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
+       *scratch = val;
+}
+void LAST_LL_hfta_HFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
+       *res = *scratch;
+}
+void LAST_LL_hfta_HFTA_AGGR_DESTROY_(gs_int64_t* scratch) { }
+
 
 void LAST_STR_hfta_HFTA_AGGR_INIT_(vstring* scratch) {
        scratch->offset= 0;
 }
-
 void LAST_STR_hfta_HFTA_AGGR_REINIT_(vstring* scratch) { }
-
 void LAST_STR_hfta_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) {
        scratch->length = val->length;
   scratch->offset = val->offset;
   scratch->reserved = SHALLOW_COPY;
 }
-
 void LAST_STR_hfta_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) {
        *res = *scratch;
 }
-
 void LAST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch) { }
 
 
+////////////////////////////////////////////////////////////
+//             count different (# of times the value is different than the previous)
+
+struct count_diff_scratch{
+       gs_uint32_t count;
+       union{
+               gs_uint32_t ui;
+               gs_int32_t i;
+               gs_uint64_t ul;
+               gs_int64_t l;
+       } r;
+};
+
+//////////  HFTA only
+
+// uint32
+void count_diff_HFTA_AGGR_INIT_(gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       scratch->count = 0;
+       scratch->r.ul = 0;
+}
+void count_diff_HFTA_AGGR_REINIT_(gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       scratch->count = 0;
+}
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint32_t val){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       if(scratch->count==0 || scratch->r.ui != val)
+               scratch->count++;
+       scratch->r.ui = val;
+}
+void count_diff_HFTA_AGGR_OUTPUT_(gs_uint32_t *res, gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       *res = scratch->count;
+}
+void count_diff_HFTA_AGGR_DESTROY_(gs_sp_t s){ }
+
+// int32
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t s, gs_int32_t val){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       if(scratch->count==0 || scratch->r.i != val)
+               scratch->count++;
+       scratch->r.i = val;
+}
+
+// uint64
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint64_t val){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       if(scratch->count==0 || scratch->r.ul != val)
+               scratch->count++;
+       scratch->r.ul = val;
+}
+
+// int64
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t s, gs_int64_t val){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       if(scratch->count==0 || scratch->r.l != val)
+               scratch->count++;
+       scratch->r.l = val;
+}
+
+// vstring
+void count_diff_HFTA_AGGR_UPDATE_(gs_sp_t s, vstring* val){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       gs_uint64_t hashval = hfta_vstr_long_hashfunc(val);
+       if(scratch->count==0 || scratch->r.l != hashval)
+               scratch->count++;
+       scratch->r.l = hashval;
+}
+
+////////// HFTA / LFTA split
+
+struct lfta_count_diff_scratch{
+       gs_uint32_t count;
+       union{
+               gs_uint32_t ui;
+               gs_int32_t i;
+               gs_uint64_t ul;
+               gs_int64_t l;
+       } first;
+       union{
+               gs_uint32_t ui;
+               gs_int32_t i;
+               gs_uint64_t ul;
+               gs_int64_t l;
+       } last;
+};
+
+
+void count_diff_hfta_HFTA_AGGR_INIT_(gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       scratch->count = 0;
+       scratch->r.ul = 0;
+}
+void count_diff_hfta_HFTA_AGGR_REINIT_(gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       scratch->count = 0;
+       scratch->r.ul = 0;
+}
+void count_diff_hfta_HFTA_AGGR_UPDATE_(gs_sp_t s, vstring *v){
+       lfta_count_diff_scratch *val = (lfta_count_diff_scratch *)v;
+       count_diff_scratch *scratch = (count_diff_scratch *)(v->offset);
+       scratch->count += val->count - 1;
+       if(scratch->r.l != val->first.l)
+               scratch->count++;
+       scratch->r.l = val->last.l;
+}
+void count_diff_hfta_HFTA_AGGR_OUTPUT_(gs_uint32_t *res, gs_sp_t s){
+       count_diff_scratch *scratch = (count_diff_scratch *)s;
+       *res = (scratch->count)+1;
+}
+void count_diff_hfta_HFTA_AGGR_DESTROY_(gs_sp_t scratch){ }
+       
+
+
 /////////////////////////////////////////////////////////
 //             running_array_aggr aggregate
 
index 7cad1b4..460cd3f 100644 (file)
@@ -99,8 +99,11 @@ gs_retval_t moving_sum_lfta_LFTA_AGGR_DESTROY_(gs_sp_t b){
 /////////////////////////////////////////////////////////
 //             FIRST and LAST aggregates
 
+///////////////// FIRST
+
+// uint
 void FIRST_lfta_LFTA_AGGR_INIT_(gs_uint32_t* scratch) {
-       *scratch = UINT_MAX;            // we will encode uninitialized value of UINT_MAX
+       *scratch = UINT_MAX;    // we will encode uninitialized value of UINT_MAX
        return;
 }
 
@@ -109,96 +112,136 @@ void FIRST_lfta_LFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) {
                *scratch = val;
        return;
 }
-
 gs_retval_t FIRST_lfta_LFTA_AGGR_FLUSHME_( gs_uint32_t* scratch) { return 0; }
-
 void FIRST_lfta_LFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
        *res = *scratch;
 }
-
 void FIRST_lfta_LFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { return; }
 
+// int
+void FIRST_INT_lfta_LFTA_AGGR_INIT_(gs_int32_t* scratch) {
+       *scratch = INT_MAX;     // we will encode uninitialized value of ULLONG_MAX
+       return;
+}
+void FIRST_INT_lfta_LFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
+       if (*scratch == INT_MAX)
+               *scratch = val;
+       return;
+}
+gs_retval_t FIRST_INT_lfta_LFTA_AGGR_FLUSHME_( gs_int32_t* scratch) { return 0; }
+void FIRST_INT_lfta_LFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
+       *res = *scratch;
+}
+void FIRST_INT_lfta_LFTA_AGGR_DESTROY_(gs_int32_t* scratch) { return; }
+
+// ullong
 void FIRST_ULL_lfta_LFTA_AGGR_INIT_(gs_uint64_t* scratch) {
        *scratch = ULLONG_MAX;          // we will encode uninitialized value of ULLONG_MAX
        return;
 }
-
 void FIRST_ULL_lfta_LFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
        if (*scratch == ULLONG_MAX)
                *scratch = val;
        return;
 }
-
 gs_retval_t FIRST_ULL_lfta_LFTA_AGGR_FLUSHME_( gs_uint64_t* scratch) { return 0; }
-
 void FIRST_ULL_lfta_LFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
        *res = *scratch;
 }
-
 void FIRST_ULL_lfta_LFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { return; }
 
+// llong
+void FIRST_LL_lfta_LFTA_AGGR_INIT_(gs_int64_t* scratch) {
+       *scratch = LLONG_MAX;           // we will encode uninitialized value of ULLONG_MAX
+       return;
+}
+void FIRST_LL_lfta_LFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
+       if (*scratch == LLONG_MAX)
+               *scratch = val;
+       return;
+}
+gs_retval_t FIRST_LL_lfta_LFTA_AGGR_FLUSHME_( gs_int64_t* scratch) { return 0; }
+void FIRST_LL_lfta_LFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
+       *res = *scratch;
+}
+void FIRST_LL_lfta_LFTA_AGGR_DESTROY_(gs_int64_t* scratch) { return; }
 
-
+// string
 void FIRST_STR_lfta_LFTA_AGGR_INIT_(struct gs_string* scratch) {
        scratch->data = NULL;
        return;
 }
-
 void FIRST_STR_lfta_LFTA_AGGR_UPDATE_(struct gs_string* scratch, struct gs_string* val) {
        if (!scratch->data) {
                str_assign_with_copy(NULL, scratch, val);
        }
        return;
 }
-
 gs_retval_t FIRST_STR_lfta_LFTA_AGGR_FLUSHME_(struct gs_string* scratch) { return 0; }
-
 void FIRST_STR_lfta_LFTA_AGGR_OUTPUT_(struct gs_string* res, struct gs_string* scratch) {
        *res = *scratch;
 }
-
 void FIRST_STR_lfta_LFTA_AGGR_DESTROY_(struct gs_string* scratch) { 
        if (scratch->data) 
                fta_free(NULL, scratch->data);
 }
 
-void LAST_lfta_LFTA_AGGR_INIT_(gs_uint32_t* scratch) { }
+///////////////// LAST
 
+// uint
+void LAST_lfta_LFTA_AGGR_INIT_(gs_uint32_t* scratch) { }
 void LAST_lfta_LFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) {
        *scratch = val;
        return;
 }
-
 gs_retval_t LAST_lfta_LFTA_AGGR_FLUSHME_( gs_uint32_t* scratch) { return 0; }
 
 void LAST_lfta_LFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) {
        *res = *scratch;
 }
-
 void LAST_lfta_LFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { return; }
 
-void LAST_ULL_lfta_LFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
+// int
+void LAST_INT_lfta_LFTA_AGGR_INIT_(gs_int32_t* scratch) { }
+void LAST_INT_lfta_LFTA_AGGR_UPDATE_(gs_int32_t* scratch, gs_int32_t val) {
+       *scratch = val;
+       return;
+}
+gs_retval_t LAST_INT_lfta_LFTA_AGGR_FLUSHME_( gs_int32_t* scratch) { return 0; }
+void LAST_INT_lfta_LFTA_AGGR_OUTPUT_(gs_int32_t* res, gs_int32_t* scratch) {
+       *res = *scratch;
+}
+void LAST_INT_lfta_LFTA_AGGR_DESTROY_(gs_int32_t* scratch) { return; }
 
+// ullong
+void LAST_ULL_lfta_LFTA_AGGR_INIT_(gs_uint64_t* scratch) { }
 void LAST_ULL_lfta_LFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) {
        *scratch = val;
        return;
 }
-
 gs_retval_t LAST_ULL_lfta_LFTA_AGGR_FLUSHME_( gs_uint64_t* scratch) { return 0; }
-
 void LAST_ULL_lfta_LFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) {
        *res = *scratch;
 }
-
 void LAST_ULL_lfta_LFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { return; }
 
+// llong
+void LAST_LL_lfta_LFTA_AGGR_INIT_(gs_int64_t* scratch) { }
+void LAST_LL_lfta_LFTA_AGGR_UPDATE_(gs_int64_t* scratch, gs_int64_t val) {
+       *scratch = val;
+       return;
+}
+gs_retval_t LAST_LL_lfta_LFTA_AGGR_FLUSHME_( gs_int64_t* scratch) { return 0; }
+void LAST_LL_lfta_LFTA_AGGR_OUTPUT_(gs_int64_t* res, gs_int64_t* scratch) {
+       *res = *scratch;
+}
+void LAST_LL_lfta_LFTA_AGGR_DESTROY_(gs_int64_t* scratch) { return; }
 
-
+// string
 void LAST_STR_lfta_LFTA_AGGR_INIT_(struct gs_string* scratch) {
        scratch->data = NULL;
        return;
 }
-
 void LAST_STR_lfta_LFTA_AGGR_UPDATE_(struct gs_string* scratch, struct gs_string* val) {
        if (!scratch->data) {
                str_assign_with_copy(NULL, scratch, val);
@@ -210,7 +253,6 @@ void LAST_STR_lfta_LFTA_AGGR_UPDATE_(struct gs_string* scratch, struct gs_string
        }
        return;
 }
-
 gs_retval_t LAST_STR_lfta_LFTA_AGGR_FLUSHME_(struct gs_string* scratch) { return 0; }
 
 void LAST_STR_lfta_LFTA_AGGR_OUTPUT_(struct gs_string* res, struct gs_string* scratch) {
@@ -222,6 +264,192 @@ void LAST_STR_lfta_LFTA_AGGR_DESTROY_(struct gs_string* scratch) {
                fta_free(NULL, scratch->data);
 }
 
+////////////////////////////////////////////////////////
+//     count_diff aggregate
+struct lfta_count_diff_scratch{
+       gs_uint32_t count;
+       union{
+               gs_uint32_t ui;
+               gs_int32_t i;
+               gs_uint64_t ul;
+               gs_int64_t l;
+       } first;
+       union{
+               gs_uint32_t ui;
+               gs_int32_t i;
+               gs_uint64_t ul;
+               gs_int64_t l;
+       } last;
+};
+
+//     unsigned int
+void count_diff_lfta_ui_LFTA_AGGR_INIT_(gs_sp_t s) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       scratch->count = 0;
+       scratch->first.l = 0;
+       scratch->last.l = 0;
+}
+void count_diff_lfta_ui_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint32_t val) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       if(scratch->count==0){
+               scratch->count = 1;
+               scratch->first.ui = val;
+       }else{
+               if(scratch->last.ui != val)
+                       scratch->count++;
+       }
+       scratch->last.ui = val;
+}
+void count_diff_lfta_ui_LFTA_AGGR_OUTPUT_(struct gs_string * res, gs_sp_t scratch) {
+       res->data = (gs_sp_t)scratch;
+       res->length = sizeof(struct lfta_count_diff_scratch);
+       res->owner = NULL;
+}
+void count_diff_lfta_ui_LFTA_AGGR_DESTROY_(gs_sp_t s) { }
+
+gs_retval_t count_diff_lfta_ui_LFTA_AGGR_FLUSHME_(gs_sp_t s) {
+       return 0;
+}
+
+//     int
+void count_diff_lfta_i_LFTA_AGGR_INIT_(gs_sp_t s) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       scratch->count = 0;
+       scratch->first.l = 0;
+       scratch->last.l = 0;
+}
+void count_diff_lfta_i_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_int32_t val) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       if(scratch->count==0){
+               scratch->count = 1;
+               scratch->first.i = val;
+       }else{
+               if(scratch->last.i != val)
+                       scratch->count++;
+       }
+       scratch->last.i = val;
+}
+void count_diff_lfta_i_LFTA_AGGR_OUTPUT_(struct gs_string * res, gs_sp_t scratch) {
+       res->data = (gs_sp_t)scratch;
+       res->length = sizeof(struct lfta_count_diff_scratch);
+       res->owner = NULL;
+}
+void count_diff_lfta_i_LFTA_AGGR_DESTROY_(gs_sp_t s) { }
+gs_retval_t count_diff_lfta_i_LFTA_AGGR_FLUSHME_(gs_sp_t s) {
+       return 0;
+}
+
+//     unsigned long long int
+void count_diff_lfta_ul_LFTA_AGGR_INIT_(gs_sp_t s) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       scratch->count = 0;
+       scratch->first.l = 0;
+       scratch->last.l = 0;
+}
+void count_diff_lfta_ul_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_uint64_t val) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       if(scratch->count==0){
+               scratch->count = 1;
+               scratch->first.ul = val;
+       }else{
+               if(scratch->last.ul != val)
+                       scratch->count++;
+       }
+       scratch->last.ul = val;
+}
+void count_diff_lfta_ul_LFTA_AGGR_OUTPUT_(struct gs_string * res, gs_sp_t scratch) {
+       res->data = (gs_sp_t)scratch;
+       res->length = sizeof(struct lfta_count_diff_scratch);
+       res->owner = NULL;
+}
+void count_diff_lfta_ul_LFTA_AGGR_DESTROY_(gs_sp_t s) { }
+gs_retval_t count_diff_lfta_ul_LFTA_AGGR_FLUSHME_(gs_sp_t s) {
+       return 0;
+}
+
+//     long long int
+void count_diff_lfta_l_LFTA_AGGR_INIT_(gs_sp_t s) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       scratch->count = 0;
+       scratch->first.l = 0;
+       scratch->last.l = 0;
+}
+void count_diff_lfta_l_LFTA_AGGR_UPDATE_(gs_sp_t s, gs_int64_t val) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       if(scratch->count==0){
+               scratch->count = 1;
+               scratch->first.l = val;
+       }else{
+               if(scratch->last.l != val)
+                       scratch->count++;
+       }
+       scratch->last.l = val;
+}
+void count_diff_lfta_l_LFTA_AGGR_OUTPUT_(struct gs_string* res, gs_sp_t scratch) {
+       res->data = (gs_sp_t)scratch;
+       res->length = sizeof(struct lfta_count_diff_scratch);
+       res->owner = NULL;
+}
+void count_diff_lfta_l_LFTA_AGGR_DESTROY_(gs_sp_t s) { }
+gs_retval_t count_diff_lfta_l_LFTA_AGGR_FLUSHME_(gs_sp_t s) {
+       return 0;
+}
+
+//     string
+
+static gs_uint64_t local_hash_string(struct gs_string *x){
+       gs_uint32_t i;
+       gs_uint64_t ret=0,tmp_sum = 0;
+       for(i=0;i<x->length;++i){
+               tmp_sum |= (x->data[i]) << (8*(i%4));
+               if((i%4) == 3){
+                       ret = tmp_sum + 12916008961267169387ull * ret;
+                       tmp_sum = 0;
+               }
+       }
+       if((i%4)!=0) ret = tmp_sum + 12916008961267169387ull * ret;
+       return(ret);
+}
+
+
+void count_diff_lfta_s_LFTA_AGGR_INIT_(gs_sp_t s) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       scratch->count = 0;
+       scratch->first.ul = 0;
+       scratch->last.ul = 0;
+}
+void count_diff_lfta_s_LFTA_AGGR_UPDATE_(gs_sp_t s, struct gs_string* val) {
+       struct lfta_count_diff_scratch* scratch = (struct lfta_count_diff_scratch*)s;
+       gs_uint64_t hashval;
+       hashval = local_hash_string(val);
+       if(scratch->count==0){
+               scratch->count = 1;
+               scratch->first.ul = hashval;
+       }else{
+               if(scratch->last.ul != hashval)
+                       scratch->count++;
+       }
+       scratch->last.ul = hashval;
+}
+void count_diff_lfta_s_LFTA_AGGR_OUTPUT_(struct gs_string* res, gs_sp_t scratch) {
+       res->data = (gs_sp_t)scratch;
+       res->length = sizeof(struct lfta_count_diff_scratch);
+       res->owner = NULL;
+}
+void count_diff_lfta_s_LFTA_AGGR_DESTROY_(gs_sp_t s) { }
+gs_retval_t count_diff_lfta_s_LFTA_AGGR_FLUSHME_(gs_sp_t s) {
+       return 0;
+}
+
+
+
+
+
+
+       
+
+
+
 
 /////////////////////////////////////////////////////////
 //             running_array_aggr aggregate
index fbd67e3..7f3dae2 100644 (file)
@@ -158,16 +158,24 @@ int main(int argc, char* argv[]) {
     gs_uint32_t tip1,tip2,tip3,tip4;
     gs_sp_t instance_name;
 
+       char sep_str[2];
+
     gs_uint32_t tlimit = 0;     // time limit in seconds
     time_t start_time, curr_time;
+
+       sep_str[0] = '|';
+       sep_str[1] = '\0';
     
        gsopenlog(argv[0]);
 
     // by default the output will go to stdout
     outf = stdout;
     
-    while ((ch = getopt(argc, argv, "l:p:r:veXD")) != -1) {
+    while ((ch = getopt(argc, argv, "l:p:r:sveXD")) != -1) {
         switch (ch) {
+            case 's':
+                sep_str[0]=',';
+                break;
             case 'r':
                 bufsz=atoi(optarg);
                 break;
@@ -438,7 +446,8 @@ int main(int argc, char* argv[]) {
                         linebuf[0]=0;
                         break;
                 }
-                if (y<numberoffields-1) snprintf(&linebuf[strlen(linebuf)],MAXLINE,"|");
+//                if (y<numberoffields-1) snprintf(&linebuf[strlen(linebuf)],MAXLINE,"|");
+                if (y<numberoffields-1) snprintf(&linebuf[strlen(linebuf)],MAXLINE,sep_str);
                 emit_line();
             }
             snprintf(linebuf,MAXLINE,"\n");