Changeset: b8033478f04a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8033478f04a
Modified Files:
gdk/Makefile.ag
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bbp.c
gdk/gdk_delta.c
gdk/gdk_delta.h
gdk/gdk_delta.mx
gdk/gdk_heap.c
gdk/gdk_heap.mx
gdk/gdk_posix.c
gdk/gdk_posix.h
gdk/gdk_storage.c
gdk/gdk_system.c
gdk/gdk_system.h
gdk/gdk_tm.c
gdk/gdk_utils.c
gdk/gdk_utils.h
gdk/gdk_utils.mx
Branch: headless
Log Message:
Converted gdk_{heap,delta,utils}.
diffs (truncated from 4368 to 300 lines):
diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -40,9 +40,9 @@
gdk_scanselect_defs_var.mx \
gdk_scanselect.mx gdk_batop.mx \
gdk_search.mx gdk_tm.c gdk_align.mx gdk_bbp.c \
- gdk_heap.mx gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
+ gdk_heap.c gdk_setop.mx gdk_utils.c gdk_atoms.mx \
gdk_qsort.mx gdk_ssort.mx gdk_storage.c gdk_bat.mx \
- gdk_delta.mx gdk_relop.mx gdk_system.c gdk_value.mx \
+ gdk_delta.c gdk_relop.mx gdk_system.c gdk_value.mx \
gdk_rangejoin.mx \
gdk_posix.c gdk_logger.mx bat.feps bat1.feps bat2.feps \
libbat.rc
@@ -53,4 +53,4 @@
$(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS)
}
-EXTRA_DIST = gdk.h gdk_bbp.h gdk_posix.h gdk_storage.h gdk_system.h gdk_tm.h
+EXTRA_DIST = gdk.h gdk_bbp.h gdk_delta.h gdk_posix.h gdk_storage.h
gdk_system.h gdk_tm.h gdk_utils.h
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -451,7 +451,7 @@
#endif
/*
- *
+ *
* GDK session handling
* --------------------
*
@@ -461,14 +461,14 @@
* @item int
* @tab GDKexit (int status)
* @end multitable
- *
+ *
* The session is bracketed by @%GDKinit@ and @%GDKexit@. Initialization
involves
* setting up the administration for database access, such as memory allocation
* for the database buffer pool.
* During the exit phase any pending transaction is aborted and the database is
* freed for access by other users.
* A zero is returned upon encountering an erroneous situation.
- *
+ *
* Definitions
* -----------
*
@@ -588,7 +588,7 @@
#define FATALcheck(tst, msg) if (tst) GDKfatal(msg);
#define ERRORcheck(tst, msg) if (tst) { GDKerror(msg); return 0; }
#define WARNcheck(tst, msg) if (tst) GDKwarning(msg)
-#define BATcheck(tst, msg) \
+#define COLcheck(tst, msg) \
if (tst == NULL) { \
if (strchr(msg, ':')) \
GDKerror("%s.\n",msg); \
@@ -615,21 +615,15 @@
#define BATcompatible(P1,P2) { \
ERRORcheck(P1 == NULL, "BATcompatible: COL required\n"); \
ERRORcheck(P2 == NULL, "BATcompatible: COL required\n"); \
- if (TYPEerror(BAThtype(P1),BAThtype(P2)) || \
- TYPEerror(BATttype(P1),BATttype(P2))) \
+ if (TYPEerror(COLtype(P1),COLtype(P2))) \
{ \
GDKerror("Incompatible operands.\n"); \
return 0; \
} \
- if (BAThtype(P1) != BAThtype(P2) && \
- ATOMtype((P1)->htype) != ATOMtype((P2)->htype)) { \
+ if (COLtype(P1) != COLtype(P2) && \
+ ATOMtype((P1)->type) != ATOMtype((P2)->type)) { \
CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as %s.\n", \
- ATOMname(BAThtype(P2)), ATOMname(BAThtype(P1))); \
- } \
- if (BATttype(P1) != BATttype(P2) && \
- ATOMtype((P1)->ttype) != ATOMtype((P2)->ttype)) { \
- CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as %s.\n", \
- ATOMname(BATttype(P2)), ATOMname(BATttype(P1))); \
+ ATOMname(COLtype(P2)), ATOMname(COLtype(P1))); \
} \
}
@@ -659,24 +653,24 @@
} Hash;
/*
- *
+ *
* Binary Association Tables
* -------------------------
*
* Having gone to the previous preliminary definitions, we will
* now introduce the structure of Binary Association Tables (BATs)
* in detail. They are the basic storage unit on which GDK is modelled.
- *
+ *
* The BAT holds an unlimited number of binary associations, called
* BUNs (@strong{Binary UNits}). The two attributes of a BUN are called
* @strong{head} (left) and @strong{tail} (right) in the remainder of this
* document.
- *
+ *
* @c image{http://monetdb.cwi.nl/projects/monetdb-mk/imgs/bat1,,,,feps}
- *
+ *
* The above figure shows what a BAT looks like. It consists of two
* columns, called head and tail, such that we have always binary tuples
- * (BUNs). The overlooking structure is the @strong{BAT record}.
+ * (BUNs). The overlooking structure is the @strong{BAT record}.
* It points to a heap structure called the @strong{BUN heap}.
* This heap contains the atomic values inside the two columns. If they
* are fixed-sized atoms, these atoms reside directly in the BUN heap. If
@@ -686,7 +680,7 @@
* referred to as @strong{Head Heap}s and @strong{Tail Heap}s). The BUN heap
then
* contains integer byte-offsets (fixed-sized, of course) into a head-
* or tail-heap.
- *
+ *
* The BUN heap contains a contiguous range of BUNs. It starts after
* the @strong{first} pointer, and finishes at the end in the @strong{free}
* area of the BUN. All BUNs after the @strong{inserted} pointer have been
@@ -694,7 +688,7 @@
* abort). All BUNs between the @strong{deleted} pointer and the @strong{first}
* have been deleted in this transaction (and will be reinserted at a
* transaction abort).
- *
+ *
* @-
* --
*
@@ -702,14 +696,14 @@
* may change between successive library routine invocations. Therefore, one
* should avoid keeping references into the BAT storage area for long
* periods.
- *
+ *
* Passing values between the library routines and the enclosing C
* program is primarily through value pointers of type @%ptr@. Pointers
* into the BAT storage area should only be used for retrieval. Direct
* updates of data stored in a BAT is forbidden. The user should adhere
* to the interface conventions to guarantee the integrity rules and to
* maintain the (hidden) auxiliary search structures.
- *
+ *
* GDK variant record type
* -----------------------
*
@@ -718,7 +712,7 @@
* be represented as a pointer of memory in pval or as a string, which
* is basically the same. In such cases the @%len@ field indicates
* the size of this piece of memory.
- *
+ *
*/
typedef struct {
bat id;
@@ -814,25 +808,25 @@
* Hash thash; // linear chained hash table on tail
* } BAT;
* @end verbatim
- *
+ *
* The internal structure of the @strong{BAT} record is in fact much more
complex,
* but GDK programmers should refrain of making use of that.
- *
+ *
* The reason for this complex structure is
* to allow for a BAT to exist in two incarnations at the time: the
* @emph{normal view} and the @emph{reversed view}. Each bat @emph{b} has a
* BATmirror(@emph{b}) which has the negative @strong{cacheid} of b in the
BBP.
- *
+ *
* Since we don't want to pay cost to keep both views in line with each other
* under BAT updates, we work with shared pieces of memory between
* the two views. An update to one will thus automatically update the other.
* In the same line, we allow @strong{synchronized BATs} (BATs with identical
* head columns, and marked as such in the @strong{BAT Alignment} interface)
now to
* be clustered horizontally.
- *
+ *
* @c image{http://monetdb.cwi.nl/projects/monetdb-mk/imgs/bat2,,,,feps}
* @
- *
+ *
*/
typedef struct PROPrec {
@@ -909,7 +903,7 @@
typedef int (*GDKfcn) ();
/*
- *
+ *
* Heap Management
* ---------------
*
@@ -941,7 +935,7 @@
* @tab
* HEAPwarm (Heap *h);
* @end multitable
- *
+ *
* @
* These routines should be used to alloc free or extend heaps;
* they isolate you from the different ways heaps can be accessed.
@@ -967,7 +961,7 @@
* Heaps are used in BATs to store data for variable-size atoms.
* The implementor must manage malloc()/free() functionality for
* atoms in this heap. A standard implementation is provided here.
- *
+ *
* @table @code
* @item void
* HEAP_initialize (Heap* h, size_t nbytes, size_t nprivate, int align )
@@ -984,7 +978,7 @@
* @item void
* HEAP_check (Heap* h)
* @end table
- *
+ *
* The heap space starts with a private space that is left untouched by
* the normal chunk allocation. You can use this private space e.g. to
* store the root of an rtree
@@ -1032,12 +1026,12 @@
*
* @multitable @columnfractions 0.08 0.7
* @item @code{BAT* }
- * @tab BATnew (int headtype, int tailtype, BUN cap)
+ * @tab COLnew (int headtype, int tailtype, BUN cap)
* @item @code{BAT* }
* @tab BATextend (BAT *b, BUN newcap)
* @end multitable
* @
- * A temporary BAT is instantiated using @%BATnew@ with the type aliases of
+ * A temporary BAT is instantiated using @%COLnew@ with the type aliases of
* the required binary association. The aliases include the built-in
* types, such as @%TYPE_int@....@%TYPE_ptr@, and the atomic types introduced
* by the user. The initial capacity to be accommodated within a BAT is
@@ -1046,7 +1040,7 @@
* Failure to create the BAT results in a NULL pointer.
* @
* The routine @%BATclone@ creates an empty BAT storage area with the
properties
- * inherited from its argument.
+ * inherited from its argument.
*/
#define BATDELETE (-9999)
@@ -1062,9 +1056,9 @@
gdk_export void BATsetdims(COL *b);
/*
- *
- *
- *
+ *
+ *
+ *
* BUN manipulation
* ----------------
*
@@ -1132,7 +1126,7 @@
* and second value in an association, respectively. 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.
@@ -1252,7 +1246,7 @@
GDKerror("bunfastins: bat too large\n"); \
goto bunins_failed; \
} \
- if (_p + 1 > BATcapacity(b)) { \
+ if (_p + 1 > COLcapacity(b)) { \
if (BATextend((b), BATgrows(b)) == NULL) \
goto bunins_failed; \
} \
@@ -1303,7 +1297,7 @@
}
#define BUNfndSTD(p,bi,v) ((p) = BUNfnd(bi.b,v))
-#define BATtype(b) ((b)->type == TYPE_void && (b)->seqbase == oid_nil ?\
+#define COLtype(b) ((b)->type == TYPE_void && (b)->seqbase == oid_nil ?\
TYPE_void : ATOMtype((b)->type))
#define BATstore(b) (BATdense(b) ? TYPE_void : (b)->type)
#define base(b) ((b)->vheap->base)
@@ -1399,7 +1393,7 @@
#endif
/*
- *
+ *
* BAT properties
* --------------
*
@@ -1409,13 +1403,13 @@
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list