⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 batmtime.c

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 C
📖 第 1 页 / 共 3 页
字号:
#line 57 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#include "mal_config.h"#include <gdk.h>#include "ctype.h"#include "mal_exception.h"#include "mtime.h"#include "batmtime.h"#define prepareOperand(X,Y,Z) \	if( (X= BATdescriptor(*Y)) == NULL ) \		throw(MAL, "batstr." Z, "Cannot access descriptor");#define prepareOperand2(X,Y,A,B,Z) \	if( (X= BATdescriptor(*Y)) == NULL ) \		throw(MAL, "batstr." Z, "Cannot access descriptor"); \	if( (A= BATdescriptor(*B)) == NULL ){\		BBPreleaseref(X->batCacheid); \		throw(MAL, "batstr."Z, "Cannot access descriptor"); \	}#define prepareResult(X,Y,T,Z) \	X= BATnew(Y->htype,T,BATcount(Y)); \	if( Y->htype== TYPE_void) \		BATseqbase(X, Y->hseqbase); \	if( X == NULL){ \		BBPreleaseref(Y->batCacheid); \		throw(MAL, "batstr." Z, "no space available "); \	} \	X->hsorted=Y->hsorted; \	X->tsorted=0; #define prepareResult2(X,Y,A,T,Z) \	X= BATnew(Y->htype,T,BATcount(Y)); \	if( Y->htype== TYPE_void) \		BATseqbase(X, Y->hseqbase); \	if( X == NULL){ \		BBPreleaseref(Y->batCacheid); \		BBPreleaseref(A->batCacheid); \		throw(MAL, "batstr." Z, "no space available "); \	} \	X->hsorted=Y->hsorted; \	X->tsorted=0; #define finalizeResult(X,Y,Z) \	if (!((Y)->batDirty&2)) (Y) = BATsetaccess((Y), BAT_READ); \	*X = (Y)->batCacheid; \	BBPkeepref(*(X));\	BBPreleaseref(Z->batCacheid);#line 206 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 184 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_EQ(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.==");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.==");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.EQ","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_EQ(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_EQcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;	bit *a;	size_t xx;	prepareOperand(left,l,"batcalc.==");	prepareResult(bn,left,TYPE_bit,"batcalc.==");	if( BUNsize(left) != sizeof(daytime))		throw(MAL, "batmtime.EQ","Unexpected input type");	p = BUNtail(left,BUNfirst(left));	q = BUNtail(left,BUNlast(left));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	while(p<q) {		MTIMEdaytime_EQ(a++, (daytime*)p, cst);		p+= xx;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}#line 184 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_NEQ(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.!=");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.!=");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.NEQ","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_NEQ(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_NEQcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;	bit *a;	size_t xx;	prepareOperand(left,l,"batcalc.!=");	prepareResult(bn,left,TYPE_bit,"batcalc.!=");	if( BUNsize(left) != sizeof(daytime))		throw(MAL, "batmtime.NEQ","Unexpected input type");	p = BUNtail(left,BUNfirst(left));	q = BUNtail(left,BUNlast(left));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	while(p<q) {		MTIMEdaytime_NEQ(a++, (daytime*)p, cst);		p+= xx;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}#line 185 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_LT(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.<");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.<");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.LT","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_LT(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_LTcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;	bit *a;	size_t xx;	prepareOperand(left,l,"batcalc.<");	prepareResult(bn,left,TYPE_bit,"batcalc.<");	if( BUNsize(left) != sizeof(daytime))		throw(MAL, "batmtime.LT","Unexpected input type");	p = BUNtail(left,BUNfirst(left));	q = BUNtail(left,BUNlast(left));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	while(p<q) {		MTIMEdaytime_LT(a++, (daytime*)p, cst);		p+= xx;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}#line 186 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_LE(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.<=");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.<=");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.LE","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_LE(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_LEcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;	bit *a;	size_t xx;	prepareOperand(left,l,"batcalc.<=");	prepareResult(bn,left,TYPE_bit,"batcalc.<=");	if( BUNsize(left) != sizeof(daytime))		throw(MAL, "batmtime.LE","Unexpected input type");	p = BUNtail(left,BUNfirst(left));	q = BUNtail(left,BUNlast(left));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	while(p<q) {		MTIMEdaytime_LE(a++, (daytime*)p, cst);		p+= xx;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}#line 187 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_GT(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.>");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.>");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.GT","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_GT(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_GTcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;	bit *a;	size_t xx;	prepareOperand(left,l,"batcalc.>");	prepareResult(bn,left,TYPE_bit,"batcalc.>");	if( BUNsize(left) != sizeof(daytime))		throw(MAL, "batmtime.GT","Unexpected input type");	p = BUNtail(left,BUNfirst(left));	q = BUNtail(left,BUNlast(left));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	while(p<q) {		MTIMEdaytime_GT(a++, (daytime*)p, cst);		p+= xx;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}#line 188 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"#line 113 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"str MTIMEdaytimebat_GE(int *ret, int *l, int *r){   BAT *bn, *left, *right;	BUN o,p,q;	bit *a;	size_t xx,yy;	prepareOperand2(left,l,right,r,"batcalc.>=");	#line 105 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	if( BATcount(left) != BATcount(right) )	throw(MAL, "batcalc.CMDcomparedaytime", "requires bats of identical size");#line 120 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batmtime.mx"	prepareResult2(bn,left,right,TYPE_bit,"batcalc.>=");	if( BUNsize(left) != sizeof(daytime) || BUNsize(right)!= sizeof(daytime) ){		BBPreleaseref(right->batCacheid);		BBPreleaseref(left->batCacheid);		BBPreleaseref(bn->batCacheid);		throw(MAL, "batmtime.GE","Unexpected input type");	}	o = BUNtail(left,BUNfirst(left));	p = BUNtail(right,BUNfirst(right));	q = BUNtail(right,BUNlast(right));	a = (bit*)BUNtail(bn, BUNfirst(bn));	xx= BUNsize(left);	yy= BUNsize(right);	while(p<q) {		MTIMEdaytime_GE(a++, (daytime*)o, (daytime*)p);		o+= xx;		p+= yy;	}	BATsetcount(bn, BATcount(left)); 	bn->batBuns->free = ((char *)a) - bn->batBuns->base;	BBPreleaseref(right->batCacheid);	finalizeResult(ret,bn,left);	return MAL_SUCCEED;}str MTIMEdaytimebat_GEcst(int *ret, int *l, daytime *cst){   BAT *bn, *left;	BUN p,q;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -