Changeset: d028d36eb3e9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d028d36eb3e9
Added Files:
        gdk/gdk.h
Removed Files:
        gdk/gdk.mx
Modified Files:
        configure.ag
        gdk/Makefile.ag
Branch: default
Log Message:

Merge with Apr2012 branch.


diffs (286 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -28,7 +28,7 @@ AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 dnl use tar-ustar since we have long (longer than 99 characters) file names
 AM_INIT_AUTOMAKE([tar-ustar no-dist-gzip dist-bzip2])
-AC_CONFIG_SRCDIR([gdk/gdk.mx])
+AC_CONFIG_SRCDIR([gdk/gdk.h])
 AM_CONFIG_HEADER([monetdb_config.h])
 AC_SUBST([CONFIG_H], [monetdb_config.h])
 
diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -34,7 +34,7 @@ lib_gdk = {
                gdk_scanselect_defs_str.mx \
                gdk_scanselect_defs_fix.mx \
                gdk_scanselect_defs_var.mx \
-               gdk_scanselect.mx gdk.mx gdk_batop.mx \
+               gdk_scanselect.mx gdk.h gdk_batop.mx \
                gdk_search.mx gdk_tm.c gdk_align.c gdk_bbp.mx \
                gdk_heap.c gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
                gdk_qsort.mx gdk_ssort.mx gdk_storage.c gdk_bat.mx \
diff --git a/gdk/gdk.mx b/gdk/gdk.h
rename from gdk/gdk.mx
rename to gdk/gdk.h
--- a/gdk/gdk.mx
+++ b/gdk/gdk.h
@@ -1,25 +1,22 @@
-@/
-The contents of this file are subject to the MonetDB Public License
-Version 1.1 (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.monetdb.org/Legal/MonetDBLicense
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (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.monetdb.org/Legal/MonetDBLicense
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2012 MonetDB B.V.
+ * All Rights Reserved.
+ */
 
-Software distributed under the License is distributed on an "AS IS"
-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-License for the specific language governing rights and limitations
-under the License.
-
-The Original Code is the MonetDB Database System.
-
-The Initial Developer of the Original Code is CWI.
-Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
-Copyright August 2008-2012 MonetDB B.V.
-All Rights Reserved.
-@
-
-@f gdk
-
-@h
 /*
  * @t The Goblin Database Kernel
  * @v Version 3.05
@@ -828,13 +825,13 @@ typedef struct {
        bte type;               /* type id. */
        bte shift;              /* log2 of bunwidth */
        bit sorted;             /* 0=false, 1=true; */
-       unsigned int 
+       unsigned int
         varsized:1,            /* varsized(>0) or fixedsized(0). */
         key:2,                 /* duplicates allowed? */
-        dense:1,               
+        dense:1,
         nonil:1,               /* nonil isn't propchecked yet */
         nil:1,                 /* nil is set when we found one nil (propcheck) 
*/
-        unused:2; 
+        unused:2;
        oid align;              /* OID for sync alignment */
        BUN nosorted_rev;       /* position that proves sorted_rev==FALSE */
        BUN nokey[2];           /* positions that prove key ==FALSE */
@@ -1418,7 +1415,7 @@ gdk_export BUN BUNfnd(BAT *b, ptr left);
  * storage space, but could tolerate more padding).  It would mostly
  * work, only the sort routine and strPut/strLocate (which do not see
  * the BAT header) extra parameters would be needed in their APIs.
- */ 
+ */
 typedef unsigned short stridx_t;
 #define SIZEOF_STRIDX_T SIZEOF_SHORT
 #define GDK_VARSHIFT 3
@@ -1456,7 +1453,7 @@ typedef var_t stridx_t; /* TODO: should 
 #define BUNtail(bi,p)  ((bi).b->tvarsized?BUNtvar(bi,p):BUNtloc(bi,p))
 
 static inline BATiter
-bat_iterator(BAT *b) 
+bat_iterator(BAT *b)
 {
        BATiter bi;
 
@@ -1764,8 +1761,8 @@ gdk_export int BATordered_rev(BAT *b);
 gdk_export BAT *BATssort(BAT *b);
 gdk_export BAT *BATssort_rev(BAT *b);
 
-gdk_export void GDKqsort(void *h, void *t, void *base, size_t n, int hs, int 
ts, int tpe); 
-gdk_export void GDKqsort_rev(void *h, void *t, void *base, size_t n, int hs, 
int ts, int tpe); 
+gdk_export void GDKqsort(void *h, void *t, void *base, size_t n, int hs, int 
ts, int tpe);
+gdk_export void GDKqsort_rev(void *h, void *t, void *base, size_t n, int hs, 
int ts, int tpe);
 
 #define BAThordered(b) (((b)->htype == TYPE_void)?GDK_SORTED:(b)->hsorted)
 #define BATtordered(b) (((b)->ttype == TYPE_void)?GDK_SORTED:(b)->tsorted)
@@ -2539,8 +2536,8 @@ static inline char *
 Hpos(BATiter *bi, BUN p)
 {
        bi->hvid = bi->b->hseqbase;
-       if (bi->hvid != oid_nil) 
-               bi->hvid += p - BUNfirst(bi->b); 
+       if (bi->hvid != oid_nil)
+               bi->hvid += p - BUNfirst(bi->b);
        return (char*)&bi->hvid;
 }
 
@@ -2548,8 +2545,8 @@ static inline char *
 Tpos(BATiter *bi, BUN p)
 {
        bi->tvid = bi->b->tseqbase;
-       if (bi->tvid != oid_nil) 
-               bi->tvid += p - BUNfirst(bi->b); 
+       if (bi->tvid != oid_nil)
+               bi->tvid += p - BUNfirst(bi->b);
        return (char*)&bi->tvid;
 }
 
@@ -2994,43 +2991,40 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
  * (HASHlooploc) or variable-sized (HASHloopvar).
  */
 #define HASHlooploc(bi, h, hb, v)                              \
-       for (hb = (h)->hash[HASHprobe((h), v)];                 \
+       for (hb = (h)->hash[HASHprobe(h, v)];                   \
             hb != BUN_NONE;                                    \
             hb = (h)->link[hb])                                \
                if (ATOMcmp(h->type, v, BUNhloc(bi, hb)) == 0)
 #define HASHloopvar(bi, h, hb, v)                              \
-       for (hb = (h)->hash[HASHprobe((h), v)];                 \
+       for (hb = (h)->hash[HASHprobe(h, v)];                   \
             hb != BUN_NONE;                                    \
             hb = (h)->link[hb])                                \
                if (ATOMcmp(h->type, v, BUNhvar(bi, hb)) == 0)
 
-@:hashloop(bit,bte,simple,bte,hloc)@
-@:hashloop(bte,bte,simple,bte,hloc)@
-@:hashloop(sht,sht,simple,sht,hloc)@
-@:hashloop(int,int,simple,int,hloc)@
+#define HASHloop_TYPE(bi, h, hb, v, TYPE)                      \
+       for (hb = (h)->hash[hash_##TYPE(h, v)];                 \
+            hb != BUN_NONE;                                    \
+            hb = (h)->link[hb])                                \
+               if (simple_EQ(v, BUNhloc(bi, hb), TYPE))
 
-@:hashloop(oid,oid,simple,oid,hloc)@
-@:hashloop(wrd,wrd,simple,wrd,hloc)@
-@:hashloop(bat,int,simple,int,hloc)@
+#define HASHloop_bit(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, bte)
+#define HASHloop_bte(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, bte)
+#define HASHloop_sht(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, sht)
+#define HASHloop_int(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, int)
+#define HASHloop_wrd(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, wrd)
+#define HASHloop_lng(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, lng)
+#define HASHloop_oid(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, oid)
+#define HASHloop_bat(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, bat)
+#define HASHloop_flt(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, flt)
+#define HASHloop_dbl(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, dbl)
+#define HASHloop_ptr(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, ptr)
 
-#if SIZEOF_VOID_P == SIZEOF_INT
-@:hashloop(ptr,int,simple,int,hloc)@
-#else /* SIZEOF_VOID_P == SIZEOF_LNG */
-@:hashloop(ptr,lng,simple,lng,hloc)@
-#endif
-@:hashloop(flt,int,simple,int,hloc)@
-@:hashloop(lng,lng,simple,lng,hloc)@
-@:hashloop(dbl,lng,simple,lng,hloc)@
-@:hashloop(any,any,atom,(bi).b->htype,head)@
+#define HASHloop_any(bi, h, hb, v)                             \
+       for (hb = (h)->hash[hash_any(h, v)];                    \
+            hb != BUN_NONE;                                    \
+            hb = (h)->link[hb])                                \
+               if (atom_EQ(v, BUNhead(bi, hb), (bi).b->htype))
 
-@= hashloop
-#define HASHloop_@1(bi, h, hb, v)                      \
-       for (hb = (h)->hash[hash_@2((h), v)];           \
-            hb != BUN_NONE;                            \
-            hb = (h)->link[hb])                        \
-               if (@3_EQ(v, BUN@5(bi, hb), @4))
-@
-@h
 /*
  * @- loop over a BAT with ordered tail
  * Here we loop over a BAT with an ordered tail column (see for instance
@@ -3050,48 +3044,57 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
                  p < q;                                                \
                  p++)
 
-@:sortloop(bte,bte,bte,simple,&bte_nil)@
-@:sortloop(sht,sht,sht,simple,&sht_nil)@
-@:sortloop(int,int,int,simple,&int_nil)@
-@:sortloop(flt,flt,flt,simple,&flt_nil)@
-@:sortloop(lng,lng,lng,simple,&lng_nil)@
-@:sortloop(dbl,dbl,dbl,simple,&dbl_nil)@
-@:sortloop(loc,loc,(b)->ttype,atom,ATOMnilptr((b)->ttype))@
-@:sortloop(var,var,(b)->ttype,atom,ATOMnilptr((b)->ttype))@
-
-@= sortloop
-#define SORTloop_@1(b,p,q,tl,th)                                       \
+#define SORTloop_TYPE(b, p, q, tl, th, TYPE)                           \
        if (!(BATtordered(b) & 1))                                      \
-               GDKerror("SORTloop_@1: BAT not sorted.\n");             \
-       else for (p = @4_EQ(tl, @5, @3) ? BUNfirst(b) : SORTfndfirst_@2(b, tl), 
\
-                 q = @4_EQ(th, @5, @3) ? BUNfirst(b) : SORTfndlast_@2(b, th); \
+               GDKerror("SORTloop_" #TYPE ": BAT not sorted.\n");      \
+       else for (p = simple_EQ(tl, &TYPE##_nil, TYPE) ? BUNfirst(b) : 
SORTfndfirst_##TYPE(b, tl), \
+                 q = simple_EQ(th, &TYPE##_nil, TYPE) ? BUNfirst(b) : 
SORTfndlast_##TYPE(b, th); \
                  p < q;                                                \
                  p++)
-@
-@h
+
+#define SORTloop_bte(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, bte)
+#define SORTloop_sht(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, sht)
+#define SORTloop_int(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, int)
+#define SORTloop_lng(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, lng)
+#define SORTloop_flt(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, flt)
+#define SORTloop_dbl(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, dbl)
+#define SORTloop_oid(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, oid)
+#define SORTloop_wrd(b, p, q, tl, th)  SORTloop_TYPE(b, p, q, tl, th, wrd)
+
+#define SORTloop_loc(b,p,q,tl,th)                                      \
+       if (!(BATtordered(b) & 1))                                      \
+               GDKerror("SORTloop_loc: BAT not sorted.\n");            \
+       else for (p = atom_EQ(tl, ATOMnilptr((b)->ttype), (b)->ttype) ? 
BUNfirst(b) : SORTfndfirst_loc(b, tl), \
+                         q = atom_EQ(th, ATOMnilptr((b)->ttype), (b)->ttype) ? 
BUNfirst(b) : SORTfndlast_loc(b, th); \
+                 p < q;                                                \
+                 p++)
+
+#define SORTloop_var(b,p,q,tl,th)                                      \
+       if (!(BATtordered(b) & 1))                                      \
+               GDKerror("SORTloop_var: BAT not sorted.\n");            \
+       else for (p = atom_EQ(tl, ATOMnilptr((b)->ttype), (b)->ttype) ? 
BUNfirst(b) : SORTfndfirst_var(b, tl), \
+                         q = atom_EQ(th, ATOMnilptr((b)->ttype), (b)->ttype) ? 
BUNfirst(b) : SORTfndlast_var(b, th); \
+                 p < q;                                                \
+                 p++)
 
 /* OIDDEPEND */
 #if SIZEOF_OID == SIZEOF_INT
 #define SORTfnd_oid(b,v)       SORTfnd_int(b,v)
 #define SORTfndfirst_oid(b,v)  SORTfndfirst_int(b,v)
 #define SORTfndlast_oid(b,v)   SORTfndlast_int(b,v)
-@:sortloop(oid,int,oid,simple,&oid_nil)@
 #else
 #define SORTfnd_oid(b,v)       SORTfnd_lng(b,v)
 #define SORTfndfirst_oid(b,v)  SORTfndfirst_lng(b,v)
 #define SORTfndlast_oid(b,v)   SORTfndlast_lng(b,v)
-@:sortloop(oid,lng,oid,simple,&oid_nil)@
 #endif
 #if SIZEOF_WRD == SIZEOF_INT
 #define SORTfnd_wrd(b,v)       SORTfnd_int(b,v)
 #define SORTfndfirst_wrd(b,v)  SORTfndfirst_int(b,v)
 #define SORTfndlast_wrd(b,v)   SORTfndlast_int(b,v)
-@:sortloop(wrd,int,wrd,simple,&wrd_nil)@
 #else
 #define SORTfnd_wrd(b,v)       SORTfnd_lng(b,v)
 #define SORTfndfirst_wrd(b,v)  SORTfndfirst_lng(b,v)
 #define SORTfndlast_wrd(b,v)   SORTfndlast_lng(b,v)
-@:sortloop(wrd,lng,wrd,simple,&wrd_nil)@
 #endif
 #define SORTloop_bit(b,p,q,tl,th) SORTloop_bte(b,p,q,tl,th)
 
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to