📄 bat5.c
字号:
HASHinfo(bn, b->hhash, "hhash->"); } if (b->thash) { HASHinfo(bn, b->thash, "thash->"); } return GDK_SUCCEED;}#define ROUND_UP(x,y) ((y)*(((x)+(y)-1)/(y)))intCMDbatsize(lng *tot, BAT *b){ size_t blksize = MT_pagesize(); size_t size = ROUND_UP(sizeof(BATstore), blksize); if (!VIEWparent(b)) { size_t cnt = BATcapacity(b); size += ROUND_UP(b->batBuns->size, blksize); if (b->hheap) size += ROUND_UP(b->hheap->size, blksize); if (b->theap) size += ROUND_UP(b->theap->size, blksize); if (b->hhash) size += ROUND_UP(sizeof(hash_t) * cnt, blksize); if (b->thash) size += ROUND_UP(sizeof(hash_t) * cnt, blksize); } *tot = size; return GDK_SUCCEED;}intCMDbatsize_str(lng *tot, str batname){ bat bid = BBPindex(batname); BAT *b = bid ? (BAT *) BBPgetdesc(bid) : NULL; if (b == NULL) { GDKerror("CMDbatsize_str: %s no such bat.\n", batname); return GDK_FAIL; } return CMDbatsize(tot, b);}#line 1391 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"intCMDsynced(bit *ret, BAT *b1, BAT *b2){ *ret = ALIGNsynced(b1, b2) ? 1 : 0; return GDK_SUCCEED;}#line 1400 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"intCMDroles(BAT **r, BAT *b, str hname, str tname){ BATroles(*r = b, hname, tname); BBPfix(b->batCacheid); return GDK_SUCCEED;}intCMDcol_name(BAT **r, BAT *b, str tname){ BATcol_name(*r = b, tname); BBPfix(b->batCacheid); return GDK_SUCCEED;}intCMDrename(bit *retval, BAT *b, str s){ int ret; int c; char *t = s; for ( ; (c = *t) != 0; t++) { if (c != '_' && !GDKisalnum(c)) { GDKerror("CMDrename: identifier expected: %s\n", s); return GDK_FAIL; } } ret = BATname(b, s); *retval = FALSE; if (ret == 1) { GDKerror("CMDrename: identifier expected: %s\n", s); return GDK_FAIL; } else if (ret == BBPRENAME_ILLEGAL) { GDKerror("CMDrename: illegal temporary name: '%s'\n", s); return GDK_FAIL; } else if (ret == BBPRENAME_LONG) { GDKerror("CMDrename: name too long: '%s'\n", s); return GDK_FAIL; } else if (ret != BBPRENAME_ALREADY) { *retval = TRUE; } return GDK_SUCCEED;}intCMDname(str *retval, BAT *b){ *retval = GDKstrdup(BBPname(b->batCacheid)); return GDK_SUCCEED;}intCMDunload(bit *res, str input){ bat bid = ABS(BBPindex(input)); *res = FALSE; if (bid > 0) { BAT *b; BBPfix(bid); b = BBP_cache(bid); if (b) { if (b->batPersistence == SESSION) BATmode(b, TRANSIENT); BBPcold(bid); /* will trigger unload of also persistent bats */ } *res = BBPunfix(bid) == 0; } return GDK_SUCCEED;}intCMDhot(str input){ BBPhot(BBPindex(input)); return GDK_SUCCEED;}intCMDcold(str input){ BBPcold(BBPindex(input)); return GDK_SUCCEED;}intCMDheat(int *res, str input){ int bid = BBPindex(input); if (bid) { *res = BBP_lastused(bid) & 0x7fffffff; } return GDK_SUCCEED;}intCMDsave(bit *res, str input){ bat bid = BBPindex(input); BAT *b; *res = FALSE; if (bid) { BBPfix(bid); b = BBP_cache(bid); if (b && BATdirty(b)) { if (BBPsave(b) == 0) *res = TRUE; } BBPunfix(bid); } return GDK_SUCCEED;}#line 1535 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"intCMDmmap(BAT **r, BAT *b, int *bns, int *hhp, int *thp){ #line 1521 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if (b->batBuns) { int mode = (b->batBuns)->storage; if (mode == STORE_MMAP && (b->batBuns)->filename == NULL) mode = STORE_MEM; if (mode == STORE_PRIV) mode = STORE_MMAP; if (*bns == int_nil || *bns == mode) { *bns = -1; } }}#line 1538 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 1521 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if (b->hheap) { int mode = (b->hheap)->storage; if (mode == STORE_MMAP && (b->hheap)->filename == NULL) mode = STORE_MEM; if (mode == STORE_PRIV) mode = STORE_MMAP; if (*hhp == int_nil || *hhp == mode) { *hhp = -1; } }}#line 1539 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 1521 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if (b->theap) { int mode = (b->theap)->storage; if (mode == STORE_MMAP && (b->theap)->filename == NULL) mode = STORE_MEM; if (mode == STORE_PRIV) mode = STORE_MMAP; if (*thp == int_nil || *thp == mode) { *thp = -1; } }}#line 1540 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" if (BATmmap(*r = b, *bns, *hhp, *thp) == 0) { BBPfix(b->batCacheid); return GDK_SUCCEED; } return GDK_FAIL;}intCMDmadvise(BAT **r, BAT *b, int *bns, int *hhp, int *thp){ BBPfix(b->batCacheid); return BATmadvise(*r = b, (*bns == int_nil) ? -1 : *bns, (*hhp == int_nil) ? -1 : *hhp, (*thp == int_nil) ? -1 : *thp) ? GDK_FAIL : GDK_SUCCEED;}/* ITERATIONS ARE DEFINED ELSEWHERE */intCMDget_seqbase(oid *o, BAT *b){ *o = b->hseqbase; return GDK_SUCCEED;}intCMDset_seqbase(BAT **r, BAT *b, oid *o){ BATseqbase(*r = b, *o); BBPfix(b->batCacheid); return GDK_SUCCEED;}#line 1581 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"char *BKCnewBATint(int *res, int *ht, int *tt, int *cap){ BAT *b; if( *ht == TYPE_oid){ int tpe= TYPE_void; if (CMDnew(&b, &tpe, tt, cap) == GDK_SUCCEED) { oid o= 0; BATseqbase(b, o); *res = b->batCacheid; BBPkeepref(*res); return MAL_SUCCEED; } } else if (CMDnew(&b, ht, tt, cap) == GDK_SUCCEED) { *res = b->batCacheid; BBPkeepref(*res); return MAL_SUCCEED; } throw(MAL, "bat.new", "GDKerror in BAT construction");}strBKCnewBATlng(int *res, int *ht, int *tt, lng *cap){ BAT *b; if( *ht == TYPE_oid){ int tpe= TYPE_void; if (CMDnew_lng(&b, &tpe, tt, cap) == GDK_SUCCEED) { oid o=0; BATseqbase(b, o); *res = b->batCacheid; BBPkeepref(*res); return MAL_SUCCEED; } } else if (CMDnew_lng(&b, ht, tt, cap) == GDK_SUCCEED) { *res = b->batCacheid; BBPkeepref(*res); return MAL_SUCCEED; } throw(MAL, "bat.new", "GDKerror in BAT construction");}strBKCnewBat(int *res, int *ht, int *tt){ lng cap = 0; return BKCnewBATlng(res, ht, tt, &cap);}strBKCreverse(int *ret, int *bid){ BAT *b, *bn = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.reverse", "Cannot access descriptor"); } CMDreverse(&bn, b); BBPreleaseref(b->batCacheid); if (bn) { *ret = bn->batCacheid; BBPkeepref(bn->batCacheid); return MAL_SUCCEED; } throw(MAL, "bat.reverse", "GDKerror");}strBKCmirror(int *ret, int *bid){ BAT *b, *bn = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.mirror", "Cannot access descriptor"); } if (CMDmirror(&bn, b) == GDK_SUCCEED) { *ret = bn->batCacheid; BBPkeepref(*ret); BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } *ret = 0; BBPreleaseref(b->batCacheid); throw(MAL, "bat.mirror", "GDKerror");}strBKCconvert(int *ret, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.convert", "Cannot access descriptor"); } if (BATconvert(b, CONV_HTON) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.convert", "Failed"); } *ret = b->batCacheid; BBPkeepref(*ret); return MAL_SUCCEED;}strBKCrevert(int *ret, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.revert", "Cannot access descriptor"); } if (BATrevert(b) != NULL) { *ret = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.revert", "GDKerror");}strBKCorder(int *ret, int *bid){ BAT *b; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.order", "Cannot access descriptor"); } if (BATorder(b) != NULL) { *ret = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.order", "GDKerror");}strBKCorder_rev(int *ret, int *bid){ BAT *b; (void) ret; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.order_rev", "Cannot access descriptor"); } if (BATorder_rev(b) != NULL) { *ret = b->batCacheid; BBPkeepref(b->batCacheid); return MAL_SUCCEED; } BBPreleaseref(b->batCacheid); throw(MAL, "bat.order", "GDKerror");}#line 1757 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"char *BKCinsert_void_bun(int *r, int *bid, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1766 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNappend(b, t,FALSE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCinsert_bun(int *r, int *bid, ptr h, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}#line 1781 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1782 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNins(b, h, t,FALSE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCinsert_bun_force(int *r, int *bid, ptr h, ptr t, bit *force){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}#line 1797 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1798 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNins(b, h, t, *force); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCinsert_bun_oid_any(int *r, int *bid, ptr h, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } /* tail is not(!) a string */ BUNins(b, h, t,FALSE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCinsert_bun_int_int(int *r, int *bid, int *h, int *t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } BUNins(b, h, t,FALSE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}char *BKCinsert_bun_oid_str(int *r, int *bid, ptr h, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { if(t== 0 || *(str*)t==0) t = (str)str_nil; else t = *(str *)t; }}#line 1840 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx" BUNins(b, h, t,FALSE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED;}strBKCinsert_bat(int *r, int *bid, int *sid){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.insert", "Cannot access descriptor"); } if (BATins(b, s,FALSE) == NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.insert", "Failed"); } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED;}strBKCinsert_bat_force(int *r, int *bid, int *sid, bit *force){ BAT *b, *s; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.insert", "Cannot access descriptor"); } if ((s = BATdescriptor(*sid)) == NULL) { BBPreleaseref(b->batCacheid); throw(MAL, "bat.insert", "Cannot access descriptor"); } if (BATins(b, s, *force) == NULL) { BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); throw(MAL, "bat.insert", "Failed"); } BBPreleaseref(b->batCacheid); BBPreleaseref(s->batCacheid); return MAL_SUCCEED;}strBKCreplace_bun(int *r, int *bid, ptr h, ptr t){ BAT *b; (void) r; if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bat.replace", "Cannot access descriptor"); } #line 41 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"{ if( b->htype >= TYPE_str && ATOMstorage(b->htype) >= TYPE_str) { if(h== 0 || *(str*)h==0) h = (str)str_nil; else h = *(str *)h; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -