Changeset: 6f928f8584a5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6f928f8584a5
Modified Files:
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_atoms.h
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_calc.c
        gdk/gdk_cand.c
        gdk/gdk_cross.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_imprints.c
        gdk/gdk_join.c
        gdk/gdk_orderidx.c
        gdk/gdk_project.c
        gdk/gdk_sample.c
        gdk/gdk_unique.c
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/kernel/batcolor.c
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/mal/manifold.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/UDF/pyapi/conversion.c
Branch: linear-hashing
Log Message:

Merge with default branch.


diffs (truncated from 3531 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -537,8 +537,6 @@ typedef size_t BUN;
 #endif
 #define BUN_MAX (BUN_NONE - 1) /* maximum allowed size of a BAT */
 
-#include "gdk_atoms.h"
-
 /*
  * @- Checking and Error definitions:
  */
@@ -927,206 +925,6 @@ gdk_export gdk_return BATextend(BAT *b, 
 /* internal */
 gdk_export uint8_t ATOMelmshift(int sz);
 
-/*
- * @- BUN manipulation
- * @multitable @columnfractions 0.08 0.7
- * @item BAT*
- * @tab BATappend (BAT *b, BAT *n, BAT *s, bool force)
- * @item BAT*
- * @tab BUNappend (BAT *b, ptr right, bool force)
- * @item BAT*
- * @tab BUNreplace (BAT *b, oid left, ptr right, bool force)
- * @item int
- * @tab BUNfnd (BAT *b, ptr tail)
- * @item BUN
- * @tab BUNlocate (BAT *b, ptr head, ptr tail)
- * @item ptr
- * @tab BUNtail (BAT *b, BUN p)
- * @end multitable
- *
- * The BATs contain a number of fixed-sized slots to store the binary
- * associations.  These slots are called BUNs or BAT units. A BUN
- * variable is a pointer into the storage area of the BAT, but it has
- * limited validity. After a BAT modification, previously obtained
- * BUNs may no longer reside at the same location.
- *
- * The association list does not contain holes.  This density permits
- * users to quickly access successive elements without the need to
- * test the items for validity. Moreover, it simplifies transport to
- * disk and other systems. The negative effect is that the user should
- * be aware of the evolving nature of the sequence, which may require
- * copying the BAT first.
- *
- * The update operations come in two flavors: BUNappend and
- * BUNreplace.  The batch version of BUNappend is BATappend.
- *
- * The routine BUNfnd provides fast access to a single BUN providing a
- * value for the tail of the binary association.
- *
- * The routine BUNtail returns a pointer to the second value in an
- * association.  To guard against side effects on the BAT, one should
- * normally copy this value into a scratch variable for further
- * processing.
- *
- * Behind the interface we use several macros to access the BUN fixed
- * part and the variable part. The BUN operators always require a BAT
- * pointer and BUN identifier.
- * @itemize
- * @item
- * BATttype(b) finds out the type of a BAT.
- * @item
- * BUNlast(b) returns the BUN pointer directly after the last BUN
- * in the BAT.
- * @end itemize
- */
-/* NOTE: `p' is evaluated after a possible upgrade of the heap */
-#if SIZEOF_VAR_T == 8
-#define Tputvalue(b, p, v, copyall)                                    \
-       do {                                                            \
-               if ((b)->tvarsized && (b)->ttype) {                     \
-                       var_t _d;                                       \
-                       void *_ptr;                                     \
-                       ATOMputVAR((b)->ttype, (b)->tvheap, &_d, v);    \
-                       if ((b)->twidth < SIZEOF_VAR_T &&               \
-                           ((b)->twidth <= 2 ? _d - GDK_VAROFFSET : _d) >= 
((size_t) 1 << (8 * (b)->twidth))) { \
-                               /* doesn't fit in current heap, upgrade it */ \
-                               if (GDKupgradevarheap((b), _d, (copyall), 
(b)->batRestricted == BAT_READ) != GDK_SUCCEED) \
-                                       goto bunins_failed;             \
-                       }                                               \
-                       _ptr = (p);                                     \
-                       switch ((b)->twidth) {                          \
-                       case 1:                                         \
-                               * (uint8_t *) _ptr = (uint8_t) (_d - 
GDK_VAROFFSET); \
-                               break;                                  \
-                       case 2:                                         \
-                               * (uint16_t *) _ptr = (uint16_t) (_d - 
GDK_VAROFFSET); \
-                               break;                                  \
-                       case 4:                                         \
-                               * (uint32_t *) _ptr = (uint32_t) _d;    \
-                               break;                                  \
-                       case 8:                                         \
-                               * (var_t *) _ptr = _d;                  \
-                               break;                                  \
-                       }                                               \
-               } else {                                                \
-                       ATOMputFIX((b)->ttype, (p), v);                 \
-               }                                                       \
-       } while (false)
-#else
-#define Tputvalue(b, p, v, copyall)                                    \
-       do {                                                            \
-               if ((b)->tvarsized && (b)->ttype) {                     \
-                       var_t _d;                                       \
-                       void *_ptr;                                     \
-                       ATOMputVAR((b)->ttype, (b)->tvheap, &_d, v);    \
-                       if ((b)->twidth < SIZEOF_VAR_T &&               \
-                           ((b)->twidth <= 2 ? _d - GDK_VAROFFSET : _d) >= 
((size_t) 1 << (8 * (b)->twidth))) { \
-                               /* doesn't fit in current heap, upgrade it */ \
-                               if (GDKupgradevarheap((b), _d, (copyall), 
(b)->batRestricted == BAT_READ) != GDK_SUCCEED) \
-                                       goto bunins_failed;             \
-                       }                                               \
-                       _ptr = (p);                                     \
-                       switch ((b)->twidth) {                          \
-                       case 1:                                         \
-                               * (uint8_t *) _ptr = (uint8_t) (_d - 
GDK_VAROFFSET); \
-                               break;                                  \
-                       case 2:                                         \
-                               * (uint16_t *) _ptr = (uint16_t) (_d - 
GDK_VAROFFSET); \
-                               break;                                  \
-                       case 4:                                         \
-                               * (var_t *) _ptr = _d;                  \
-                               break;                                  \
-                       }                                               \
-               } else {                                                \
-                       ATOMputFIX((b)->ttype, (p), v);                 \
-               }                                                       \
-       } while (false)
-#endif
-#define tfastins_nocheck(b, p, v, s)                           \
-       do {                                                    \
-               (b)->theap.free += (s);                         \
-               Tputvalue((b), Tloc((b), (p)), (v), false);     \
-       } while (false)
-
-#define bunfastapp_nocheck(b, p, v, ts)                \
-       do {                                    \
-               tfastins_nocheck(b, p, v, ts);  \
-               (b)->batCount++;                \
-       } while (false)
-
-#define bunfastapp(b, v)                                               \
-       do {                                                            \
-               if (BATcount(b) >= BATcapacity(b)) {                            
\
-                       if (BATcount(b) == BUN_MAX) {                   \
-                               GDKerror("bunfastapp: too many elements to 
accomodate (" BUNFMT ")\n", BUN_MAX); \
-                               goto bunins_failed;                     \
-                       }                                               \
-                       if (BATextend((b), BATgrows(b)) != GDK_SUCCEED) \
-                               goto bunins_failed;                     \
-               }                                                       \
-               bunfastapp_nocheck(b, (b)->batCount, v, Tsize(b));      \
-       } while (false)
-
-#define bunfastappTYPE(TYPE, b, v)                                     \
-       do {                                                            \
-               if (BATcount(b) >= BATcapacity(b)) {                    \
-                       if (BATcount(b) == BUN_MAX) {   \
-                               GDKerror("bunfastapp: too many elements to 
accomodate (" BUNFMT ")\n", BUN_MAX); \
-                               goto bunins_failed;                     \
-                       }                                               \
-                       if (BATextend((b), BATgrows(b)) != GDK_SUCCEED) \
-                               goto bunins_failed;                     \
-               }                                                       \
-               (b)->theap.free += sizeof(TYPE);                        \
-               ((TYPE *) (b)->theap.base)[(b)->batCount++] = * (const TYPE *) 
(v); \
-       } while (false)
-
-#define tfastins_nocheckVAR(b, p, v, s)                                        
\
-       do {                                                            \
-               var_t _d;                                               \
-               (b)->theap.free += (s);                                 \
-               ATOMputVAR((b)->ttype, (b)->tvheap, &_d, v);            \
-               if ((b)->twidth < SIZEOF_VAR_T &&                       \
-                   ((b)->twidth <= 2 ? _d - GDK_VAROFFSET : _d) >= ((size_t) 1 
<< (8 * (b)->twidth))) { \
-                       /* doesn't fit in current heap, upgrade it */   \
-                       if (GDKupgradevarheap((b), _d, false, 
(b)->batRestricted == BAT_READ) != GDK_SUCCEED) \
-                               goto bunins_failed;                     \
-               }                                                       \
-               switch ((b)->twidth) {                                  \
-               case 1:                                                 \
-                       ((uint8_t *) (b)->theap.base)[p] = (uint8_t) (_d - 
GDK_VAROFFSET); \
-                       break;                                          \
-               case 2:                                                 \
-                       ((uint16_t *) (b)->theap.base)[p] = (uint16_t) (_d - 
GDK_VAROFFSET); \
-                       break;                                          \
-               case 4:                                                 \
-                       ((uint32_t *) (b)->theap.base)[p] = (uint32_t) _d; \
-                       break;                                          \
-               case 8:         /* superfluous on 32-bit archs */       \
-                       ((uint64_t *) (b)->theap.base)[p] = (uint64_t) _d; \
-                       break;                                          \
-               }                                                       \
-       } while (false)
-
-#define bunfastapp_nocheckVAR(b, p, v, ts)             \
-       do {                                            \
-               tfastins_nocheckVAR(b, p, v, ts);       \
-               (b)->batCount++;                        \
-       } while (false)
-
-#define bunfastappVAR(b, v)                                            \
-       do {                                                            \
-               if ((b)->batCount >= BATcapacity(b)) {                  \
-                       if ((b)->batCount == BUN_MAX || BATcount(b) == BUN_MAX) 
{ \
-                               GDKerror("bunfastapp: too many elements to 
accomodate (" BUNFMT ")\n", BUN_MAX); \
-                               goto bunins_failed;                     \
-                       }                                               \
-                       if (BATextend((b), BATgrows(b)) != GDK_SUCCEED) \
-                               goto bunins_failed;                     \
-               }                                                       \
-               bunfastapp_nocheckVAR(b, (b)->batCount, v, Tsize(b));   \
-       } while (false)
-
 gdk_export gdk_return GDKupgradevarheap(BAT *b, var_t v, bool copyall, bool 
mayshare)
        __attribute__((__warn_unused_result__));
 gdk_export gdk_return BUNappend(BAT *b, const void *right, bool force)
@@ -1200,6 +998,205 @@ typedef var_t stridx_t;
 
 #define BATcount(b)    ((b)->batCount)
 
+/*
+ * @+ GDK Extensibility
+ * GDK can be extended with new atoms, search accelerators and storage
+ * modes.
+ *
+ * @- Atomic Type Descriptors
+ * The atomic types over which the binary associations are maintained
+ * are described by an atom descriptor.
+ *  @multitable @columnfractions 0.08 0.7
+ * @item void
+ * @tab ATOMallocate    (str   nme);
+ * @item int
+ * @tab ATOMindex       (char *nme);
+ * @item int
+ * @tab ATOMdump        ();
+ * @item void
+ * @tab ATOMdelete      (int id);
+ * @item str
+ * @tab ATOMname        (int id);
+ * @item unsigned int
+ * @tab ATOMsize        (int id);
+ * @item int
+ * @tab ATOMvarsized    (int id);
+ * @item ptr
+ * @tab ATOMnilptr      (int id);
+ * @item ssize_t
+ * @tab ATOMfromstr     (int id, str s, size_t* len, ptr* v_dst);
+ * @item ssize_t
+ * @tab ATOMtostr       (int id, str s, size_t* len, ptr* v_dst);
+ * @item hash_t
+ * @tab ATOMhash        (int id, ptr val, in mask);
+ * @item int
+ * @tab ATOMcmp         (int id, ptr val_1, ptr val_2);
+ * @item int
+ * @tab ATOMfix         (int id, ptr v);
+ * @item int
+ * @tab ATOMunfix       (int id, ptr v);
+ * @item int
+ * @tab ATOMheap        (int id, Heap *hp, size_t cap);
+ * @item int
+ * @tab ATOMput         (int id, Heap *hp, BUN pos_dst, ptr val_src);
+ * @item int
+ * @tab ATOMdel         (int id, Heap *hp, BUN v_src);
+ * @item size_t
+ * @tab ATOMlen         (int id, ptr val);
+ * @item ptr
+ * @tab ATOMnil         (int id);
+ * @item ssize_t
+ * @tab ATOMformat      (int id, ptr val, char** buf);
+ * @item int
+ * @tab ATOMprint       (int id, ptr val, stream *fd);
+ * @item ptr
+ * @tab ATOMdup         (int id, ptr val );
+ * @end multitable
+ *
+ * @- Atom Definition
+ * User defined atomic types can be added to a running system with the
+ * following interface:.
+ *
+ * @itemize
+ * @item @emph{ATOMallocate()} registers a new atom definition if
+ * there is no atom registered yet under that name.
+ *
+ * @item @emph{ATOMdelete()} unregisters an atom definition.
+ *
+ * @item @emph{ATOMindex()} looks up the atom descriptor with a certain name.
+ * @end itemize
+ *
+ * @- Atom Manipulation
+ *
+ * @itemize
+ * @item The @emph{ATOMname()} operation retrieves the name of an atom
+ * using its id.
+ *
+ * @item The @emph{ATOMsize()} operation returns the atoms fixed size.
+ *
+ * @item The @emph{ATOMnilptr()} operation returns a pointer to the
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to