Changeset: 404850c2bfee for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=404850c2bfee
Modified Files:
monetdb5/modules/kernel/column.c.mx
monetdb5/modules/kernel/column.h.mx
monetdb5/modules/kernel/column.mal.mx
Branch: headless
Log Message:
Conversion of bat5->column
Cleanup of the old bat 5 interface. All m4 specific commands are dropped.
diffs (truncated from 3458 to 300 lines):
diff --git a/monetdb5/modules/kernel/column.c.mx
b/monetdb5/modules/kernel/column.c.mx
--- a/monetdb5/modules/kernel/column.c.mx
+++ b/monetdb5/modules/kernel/column.c.mx
@@ -23,406 +23,18 @@
#include "monetdb_config.h"
#include "column.h"
#include "mal_exception.h"
-@-
-@= batconvert
- (BAT@2type(@1) == TYPE_bat)?(ptr)&((BAT*)@2)->batCacheid:(ptr)@2
-@+ Information Functions
-@c
-
-int
-CMDreverse(BAT **ret, BAT *b)
+static COL *
+lock_desc(int bid)
{
- *ret = BATmirror(b);
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDmirror(BAT **ret, BAT *b)
-{
- BAT *v = *ret = VIEWcombine(b);
-
- if (b->restricted == COL_WRITE) {
- *ret = COLcopy(v, v->htype, v->ttype, FALSE);
- CBPreclaim(v);
- }
- return (*ret) ? GDK_SUCCEED : GDK_FAIL;
-}
-
-int
-CMDsorder(BAT **ret, BAT *b)
-{
- if (COLsorder(*ret = b) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDsorder_rev(BAT **ret, BAT *b)
-{
- if (COLsorder_rev(*ret = b) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDinsert_bun(BAT **r, BAT *b, ptr h, ptr t)
-{
- if (BUNins(*r = b, @:batconvert(b,h)@, @:batconvert(b,t)@,FALSE) ==
NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDinsert_bat(BAT **r, BAT *b, BAT *s)
-{
- if (BATins(*r = b, s, FALSE) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-
-int
-CMDreplace_bat(BAT **r, BAT *b, BAT *s)
-{
- if (COLreplace(*r = b, s, 0) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDreplace_bat_force(BAT **r, BAT *b, BAT *s, bit *force)
-{
- if (COLreplace(*r = b, s, *force) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDdelete_bun(BAT **r, BAT *b, ptr h, ptr t)
-{
- if (BUNdel(*r = b, h, t, FALSE) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDdelete_head(BAT **r, BAT *b, ptr h)
-{
- if (BUNdel(*r = b, @:batconvert(b,h)@, FALSE) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-CMDdelete_all(BAT **r, BAT *b)
-{
- if (COLclear(*r = b) == NULL)
- return GDK_FAIL;
- CBPfix(b->batCacheid);
- return GDK_SUCCEED;
-}
-
-
-@-
-The next collection of operators fill a hole in the MonetDB kernel libraries.
-It provide handy operations on void-BATs.
-@c
-int
-bun_inplace(BAT **res, BAT *b, oid *id, ptr val )
-{
- int ret = void_inplace(b,*id,val,FALSE);
- *res = b;
- CBPfix(b->batCacheid);
- return ret;
-}
-
-int
-bun_inplace_force(BAT **res, BAT *b, oid *id, ptr val, bit *force )
-{
- int ret = void_inplace(b,*id,val,*force);
- *res = b;
- CBPfix(b->batCacheid);
- return ret;
-}
-
-int
-bat_inplace(BAT **res, BAT *o, BAT *d)
-{
- *res = o;
- if (void_replace_bat(o, d, FALSE) == BUN_NONE)
- return GDK_FAIL;
- CBPfix(o->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-bat_inplace_force(BAT **res, BAT *o, BAT *d, bit *force)
-{
- *res = o;
- if (void_replace_bat(o, d, *force) == BUN_NONE)
- return GDK_FAIL;
- CBPfix(o->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-BATappend_force(BAT **res, BAT *i, BAT *u, bit *force)
-{
- if (!BATappend(i, u, *force))
- return GDK_FAIL;
- *res = i;
- CBPfix(i->batCacheid);
- return GDK_SUCCEED;
-}
-
-int
-BUNappend_force(BAT **res, BAT *i, ptr t, bit *force)
-{
- *res = BUNappend(i, @:batconvert(i,t)@, *force);
- if (*res) {
- CBPfix((*res)->batCacheid);
- return GDK_SUCCEED;
- }
- return GDK_FAIL;
-}
-
-static BAT *
-lock_desc(bat bid)
-{
- CBPfix(bid);
- return (BAT *) CBPgetdesc(bid);
+ CBPkeepref(bid);
+ return (COL *) CBPgetdesc(bid);
}
static void
-unlock_desc(bat bid)
+unlock_desc(int bid)
{
- CBPunfix(bid);
-}
-
-int
-CMDcapacity(lng *res, int *bid)
-{
- if (CBPcheck((bat) *bid, "CMDcapacity")) {
- BAT *b = lock_desc((bat) *bid);
-
- if (b == NULL) {
- *res = lng_nil;
- } else {
- *res = (lng) COLcapacity(b);
- }
- unlock_desc(*bid);
- }
- return GDK_SUCCEED;
-}
-
-int
-CMDhead(str *res, int *bid)
-{
- if (CBPcheck((bat) *bid, "CMDhead")) {
- str ret = (str)str_nil;
- BAT *b = lock_desc((bat) *bid);
-
- if (b) {
- ret = *bid > 0 ? ATOMname(b->htype) :
ATOMname(b->ttype);
- }
- *res = GDKstrdup(ret);
- unlock_desc(*bid);
- } else {
- *res = GDKstrdup(str_nil);
- }
- return GDK_SUCCEED;
-}
-
-int
-CMDhead_bat(str *res, BAT *b)
-{
- return CMDhead(res, &b->batCacheid);
-}
-
-int
-CMDhtype(int *res, int *bid)
-{
- int ret = int_nil;
- if (CBPcheck((bat) *bid, "CMDhtype")) {
- BAT *b = lock_desc((bat) *bid);
- if (b) {
- ret = *bid > 0 ? b->htype : b->ttype;
- }
- unlock_desc(*bid);
- } *res = ret;
- return GDK_SUCCEED;
-
-}
-
-int
-CMDhtype_bat(int *res, BAT *b)
-{
- *res = b->htype;
- return GDK_SUCCEED;
-}
-
-int
-CMDtail(str *res, int *bid)
-{
- if (CBPcheck((bat) *bid, "CMDtail")) {
- str ret = (str)str_nil;
- BAT *b = lock_desc((bat) *bid);
-
- if (b) {
- ret = *bid > 0 ? ATOMname(b->ttype) :
ATOMname(b->htype);
- }
- *res = GDKstrdup(ret);
- unlock_desc(*bid);
- } else {
- *res = GDKstrdup(str_nil);
- }
- return GDK_SUCCEED;
-}
-
-int
-CMDtail_bat(str *res, BAT *b)
-{
- return CMDtail(res, &b->batCacheid);
-}
-
-int
-CMDttype(int *res, int *bid)
-{
- int ret = int_nil;
- if (CBPcheck((bat) *bid, "CMDttype")) {
- BAT *b = lock_desc((bat) *bid);
- if (b) {
- ret = *bid > 0 ? b->ttype : b->htype;
- }
- unlock_desc(*bid);
- } *res = ret;
- return GDK_SUCCEED;
-}
-
-int
-CMDttype_bat(int *res, BAT *b)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list