📄 batcolor.c
字号:
#line 101 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#include "mal_config.h"#include <gdk.h>#include <string.h>#include <mal.h>#include <color.h>#include "mal_exception.h"#ifdef WIN32#ifndef LIBBATCOLOR#define batcolor_export extern __declspec(dllimport)#else#define batcolor_export extern __declspec(dllexport)#endif#else#define batcolor_export extern#endif#ifdef HAVE_LANGINFO_H#include <langinfo.h>#endif#ifdef HAVE_ICONV_H#include <iconv.h>#endif#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 finalizeResult(X,Y,Z) \ if (!((Y)->batDirty&2)) (Y) = BATsetaccess((Y), BAT_READ); \ *X = (Y)->batCacheid; \ BBPkeepref(*(X));\ BBPreleaseref(Z->batCacheid);#line 179 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatColor(int *ret, int *l);str CLRbatColor(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; str *x; color y, *yp = &y; prepareOperand(b,l,"Color"); prepareResult(bn,b,getTypeIndex("color",-1,TYPE_int),"Color"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (str *) BUNtail(b,p); if(x== 0 || *x == str_nil) y = (color)color_nil; else CLRcolor(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 179 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatStr(int *ret, int *l);str CLRbatStr(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; str y, *yp = &y; prepareOperand(b,l,"Str"); prepareResult(bn,b,getTypeIndex("str",-1,TYPE_int),"Str"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (str)str_nil; else CLRstr(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 180 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatRed(int *ret, int *l);str CLRbatRed(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; int y, *yp = &y; prepareOperand(b,l,"Red"); prepareResult(bn,b,getTypeIndex("int",-1,TYPE_int),"Red"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (int)int_nil; else CLRred(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 182 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatGreen(int *ret, int *l);str CLRbatGreen(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; int y, *yp = &y; prepareOperand(b,l,"Green"); prepareResult(bn,b,getTypeIndex("int",-1,TYPE_int),"Green"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (int)int_nil; else CLRgreen(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 183 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatBlue(int *ret, int *l);str CLRbatBlue(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; int y, *yp = &y; prepareOperand(b,l,"Blue"); prepareResult(bn,b,getTypeIndex("int",-1,TYPE_int),"Blue"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (int)int_nil; else CLRblue(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 184 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatHue(int *ret, int *l);str CLRbatHue(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; flt y, *yp = &y; prepareOperand(b,l,"Hue"); prepareResult(bn,b,getTypeIndex("flt",-1,TYPE_int),"Hue"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (flt)flt_nil; else CLRhue(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 186 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatSaturation(int *ret, int *l);str CLRbatSaturation(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; flt y, *yp = &y; prepareOperand(b,l,"Saturation"); prepareResult(bn,b,getTypeIndex("flt",-1,TYPE_int),"Saturation"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (flt)flt_nil; else CLRsaturation(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 187 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatValue(int *ret, int *l);str CLRbatValue(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; flt y, *yp = &y; prepareOperand(b,l,"Value"); prepareResult(bn,b,getTypeIndex("flt",-1,TYPE_int),"Value"); BATloopFast(b, p, q, xx) { ptr h = BUNhead(b,p); x= (color *) BUNtail(b,p); if(x== 0 || *x == color_nil) y = (flt)flt_nil; else CLRvalue(yp,x); bunfastins(bn, h, yp); } finalizeResult(ret,bn,b); return MAL_SUCCEED;bunins_failed: BBPreleaseref(b->batCacheid); BBPreleaseref(bn->batCacheid); throw(MAL, "batstr.==", "bunins failed");}#line 188 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"#line 151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/batcolor.mx"batcolor_export str CLRbatHueInt(int *ret, int *l);str CLRbatHueInt(int *ret, int *l){ BAT *bn, *b; BUN p,q; int xx; color *x; int y, *yp = &y; prepareOperand(b,l,"HueInt"); prepareResult(bn,b,getTypeIndex("int",-1,TYPE_int),"HueInt");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -