Changeset: cbfc16d3655a for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cbfc16d3655a Modified Files: monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/batstr.c Branch: default Log Message:
Merge with Feb2013 branch. diffs (truncated from 1023 to 300 lines): diff --git a/monetdb5/modules/kernel/batcolor.c b/monetdb5/modules/kernel/batcolor.c --- a/monetdb5/modules/kernel/batcolor.c +++ b/monetdb5/modules/kernel/batcolor.c @@ -3,14 +3,14 @@ * 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-2013 MonetDB B.V. @@ -34,65 +34,65 @@ #include "monetdb_config.h" #include "batcolor.h" -#define prepareOperand(X,Y,Z) \ - if( (X= BATdescriptor(*Y)) == NULL ) \ +#define prepareOperand(X,Y,Z) \ + if( (X= BATdescriptor(*Y)) == NULL ) \ throw(MAL, "batstr." Z, RUNTIME_OBJECT_MISSING); -#define prepareOperand2(X,Y,A,B,Z) \ - if( (X= BATdescriptor(*Y)) == NULL ) \ - throw(MAL, "batstr." Z, RUNTIME_OBJECT_MISSING); \ - if( (A= BATdescriptor(*B)) == NULL ){\ - BBPreleaseref(X->batCacheid); \ - throw(MAL, "batstr."Z, RUNTIME_OBJECT_MISSING); \ +#define prepareOperand2(X,Y,A,B,Z) \ + if( (X= BATdescriptor(*Y)) == NULL ) \ + throw(MAL, "batstr." Z, RUNTIME_OBJECT_MISSING); \ + if( (A= BATdescriptor(*B)) == NULL ){ \ + BBPreleaseref(X->batCacheid); \ + throw(MAL, "batstr."Z, RUNTIME_OBJECT_MISSING); \ } -#define prepareResult(X,Y,T,Z) \ - X= BATnew(Y->htype,T,BATcount(Y)); \ - if( X == NULL){ \ - BBPreleaseref(Y->batCacheid); \ - throw(MAL, "batstr." Z, MAL_MALLOC_FAIL); \ - } \ - if( Y->htype== TYPE_void) \ - BATseqbase(X, Y->hseqbase); \ - X->hsorted=Y->hsorted; \ - X->hrevsorted=Y->hrevsorted; \ - X->tsorted=0; \ - X->trevsorted=0; -#define finalizeResult(X,Y,Z) \ - if (!((Y)->batDirty&2)) (Y) = BATsetaccess((Y), BAT_READ); \ - *X = (Y)->batCacheid; \ - BBPkeepref(*(X));\ +#define prepareResult(X,Y,T,Z) \ + X= BATnew(Y->htype,T,BATcount(Y)); \ + if( X == NULL){ \ + BBPreleaseref(Y->batCacheid); \ + throw(MAL, "batstr." Z, MAL_MALLOC_FAIL); \ + } \ + if( Y->htype== TYPE_void) \ + BATseqbase(X, Y->hseqbase); \ + X->hsorted=Y->hsorted; \ + X->hrevsorted=Y->hrevsorted; \ + X->tsorted=0; \ + X->trevsorted=0; +#define finalizeResult(X,Y,Z) \ + if (!((Y)->batDirty&2)) (Y) = BATsetaccess((Y), BAT_READ); \ + *X = (Y)->batCacheid; \ + BBPkeepref(*(X)); \ BBPreleaseref(Z->batCacheid); -#define BATwalk(X1,X2,X3,X4)\ -str CLRbat##X1(int *ret, int *l)\ -{ \ - BATiter bi;\ - BAT *bn, *b;\ - BUN p,q;\ - X3 *x;\ - X4 y, *yp = &y;\ -\ - prepareOperand(b,l,"##X1");\ - prepareResult(bn,b,getTypeIndex("##X4",-1,TYPE_int),"##X1");\ -\ - bi = bat_iterator(b);\ -\ - BATloop(b, p, q) {\ - ptr h = BUNhead(bi,p);\ - x= (X3 *) BUNtail(bi,p);\ - if (x== 0 || *x == X3##_nil) {\ - y = (X4)X4##_nil;\ - bn->T->nonil = 0;\ - } else \ - X2(yp,x);\ - bunfastins(bn, h, yp);\ - }\ - bn->H->nonil = b->H->nonil;\ - finalizeResult(ret,bn,b);\ - return MAL_SUCCEED;\ -bunins_failed:\ - BBPreleaseref(b->batCacheid);\ - BBPreleaseref(bn->batCacheid);\ - throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation");\ +#define BATwalk(X1,X2,X3,X4) \ +str CLRbat##X1(int *ret, int *l) \ +{ \ + BATiter bi; \ + BAT *bn, *b; \ + BUN p,q; \ + X3 *x; \ + X4 y, *yp = &y; \ + \ + prepareOperand(b,l,#X1); \ + prepareResult(bn,b,getTypeIndex(#X4,-1,TYPE_int),#X1); \ + \ + bi = bat_iterator(b); \ + \ + BATloop(b, p, q) { \ + ptr h = BUNhead(bi,p); \ + x= (X3 *) BUNtail(bi,p); \ + if (x== 0 || *x == X3##_nil) { \ + y = (X4)X4##_nil; \ + bn->T->nonil = 0; \ + } else \ + X2(yp,x); \ + bunfastins(bn, h, yp); \ + } \ + bn->H->nonil = b->H->nonil; \ + finalizeResult(ret,bn,b); \ + return MAL_SUCCEED; \ +bunins_failed: \ + BBPreleaseref(b->batCacheid); \ + BBPreleaseref(bn->batCacheid); \ + throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation"); \ } BATwalk(Color,CLRcolor,str,color) @@ -114,53 +114,53 @@ BATwalk(Luminance,CLRluminance,color,int BATwalk(Cr,CLRcr,color,int) BATwalk(Cb,CLRcb,color,int) -#define BATwalk3(X1,X2,X3,X4)\ -str CLRbat##X1(int *ret, int *l, int *bid2, int *bid3)\ -{ \ - BATiter bi, b2i, b3i;\ - BAT *bn, *b2,*b3, *b;\ - BUN p,q,p2,p3;\ - X3 *x, *x2, *x3;\ - X4 y, *yp = &y;\ -\ - prepareOperand(b,l,"##X1");\ - b2= BATdescriptor(*bid2);\ - if(b2== NULL) \ - throw(MAL, "batcolor.##X1",RUNTIME_OBJECT_MISSING);\ - b3= BATdescriptor(*bid3);\ - if(b3== NULL) \ - throw(MAL, "batcolor.##X1",RUNTIME_OBJECT_MISSING);\ - prepareResult(bn,b,getTypeIndex("##X4",-1,TYPE_int),"##X1");\ -\ - bi = bat_iterator(b);\ - b2i = bat_iterator(b2);\ - b3i = bat_iterator(b3);\ -\ - p2= BUNfirst(b2);\ - p3= BUNfirst(b3);\ - BATloop(b, p, q) {\ - ptr h = BUNhead(bi,p);\ - x= (X3 *) BUNtail(bi,p);\ - x2= (X3 *) BUNtail(b2i,p);\ - x3= (X3 *) BUNtail(b3i,p);\ - if (x== 0 || *x == X3##_nil ||\ - x2== 0 || *x2 == X3##_nil ||\ - x3== 0 || *x3 == X3##_nil) {\ - y = X4##_nil;\ - bn->T->nonil = 0;\ - } else \ - X2(yp,x,x2,x3);\ - bunfastins(bn, h, yp);\ - p2++;\ - p3++;\ - }\ - bn->H->nonil = b->H->nonil;\ - finalizeResult(ret,bn,b);\ - return MAL_SUCCEED;\ -bunins_failed:\ - BBPreleaseref(b->batCacheid);\ - BBPreleaseref(bn->batCacheid);\ - throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation");\ +#define BATwalk3(X1,X2,X3,X4) \ +str CLRbat##X1(int *ret, int *l, int *bid2, int *bid3) \ +{ \ + BATiter bi, b2i, b3i; \ + BAT *bn, *b2,*b3, *b; \ + BUN p,q,p2,p3; \ + X3 *x, *x2, *x3; \ + X4 y, *yp = &y; \ + \ + prepareOperand(b,l,#X1); \ + b2= BATdescriptor(*bid2); \ + if(b2== NULL) \ + throw(MAL, "batcolor." #X1,RUNTIME_OBJECT_MISSING); \ + b3= BATdescriptor(*bid3); \ + if(b3== NULL) \ + throw(MAL, "batcolor." #X1,RUNTIME_OBJECT_MISSING); \ + prepareResult(bn,b,getTypeIndex(#X4,-1,TYPE_int),#X1); \ + \ + bi = bat_iterator(b); \ + b2i = bat_iterator(b2); \ + b3i = bat_iterator(b3); \ + \ + p2= BUNfirst(b2); \ + p3= BUNfirst(b3); \ + BATloop(b, p, q) { \ + ptr h = BUNhead(bi,p); \ + x= (X3 *) BUNtail(bi,p); \ + x2= (X3 *) BUNtail(b2i,p); \ + x3= (X3 *) BUNtail(b3i,p); \ + if (x== 0 || *x == X3##_nil || \ + x2== 0 || *x2 == X3##_nil || \ + x3== 0 || *x3 == X3##_nil) { \ + y = X4##_nil; \ + bn->T->nonil = 0; \ + } else \ + X2(yp,x,x2,x3); \ + bunfastins(bn, h, yp); \ + p2++; \ + p3++; \ + } \ + bn->H->nonil = b->H->nonil; \ + finalizeResult(ret,bn,b); \ + return MAL_SUCCEED; \ +bunins_failed: \ + BBPreleaseref(b->batCacheid); \ + BBPreleaseref(bn->batCacheid); \ + throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation"); \ } BATwalk3(Hsv,CLRhsv,flt,color) diff --git a/monetdb5/modules/kernel/batmmath.c b/monetdb5/modules/kernel/batmmath.c --- a/monetdb5/modules/kernel/batmmath.c +++ b/monetdb5/modules/kernel/batmmath.c @@ -3,14 +3,14 @@ * 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-2013 MonetDB B.V. @@ -44,85 +44,85 @@ bn->T->nonil = b->T->nonil; -#define scienceFcnImpl(X1,X2,X3)\ -str CMDscience_bat_##X2##_##X1(int *ret, int *bid)\ -{\ - BAT *b,*bn;\ - X2 *o, *p, *q;\ - if ((b = BATdescriptor(*bid)) == NULL) {\ - throw(MAL, "##X2", RUNTIME_OBJECT_MISSING);\ - }\ - voidresultBAT(TYPE_##X2,"batcalc.##X1"); \ - o = (X2*) Tloc(bn, BUNfirst(bn));\ - p = (X2*) Tloc(b, BUNfirst(b));\ - q = (X2*) Tloc(b, BUNlast(b));\ -\ - if (b->T->nonil){\ - for(;p<q; o++, p++)\ - *o = X1##X3(*p);\ - } else\ - for(;p<q; o++, p++){\ - *o = *p == X2##_nil? X2##_nil: X1##X3(*p);\ - }\ - BATsetcount(bn, BATcount(b));\ - bn->tsorted = 0;\ - bn->trevsorted = 0;\ - BATkey(BATmirror(bn),0); \ +#define scienceFcnImpl(X1,X2,X3) \ +str CMDscience_bat_##X2##_##X1(int *ret, int *bid) \ +{ \ + BAT *b,*bn; \ + X2 *o, *p, *q; \ + if ((b = BATdescriptor(*bid)) == NULL) { \ + throw(MAL, #X2, RUNTIME_OBJECT_MISSING); \ + } \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list