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

📄 no.148.mal

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MAL
📖 第 1 页 / 共 2 页
字号:
# Monet Mil to Mal compiler# Copyright (c) 2001-2004, CWI. All rights reserved.#Predefined code segment#The compiler can not guarantee an accurate compilation,#because MIL unlike MAL is a dynamically typed language.#A few guidelines to maximize usefullness.#- make the type of variables explicit, in particular 'nil'#- upon advice of M2m to remap identifiers, change it in your program directly#use the "mil_schema" for additional support routines#	io.print("# >Number:         148\n");#	io.print("# >Category:       Module_xtables\n");#	io.print("# >Synopsis:       table() call fails in xtable.mil\n");#	io.print("# >Confidential:   no\n");#	io.print("# >Severity:       serious\n");#	io.print("# >Priority:       medium\n");#	io.print("# >Responsible:    mk (Martin Kersten)\n");#	io.print("# >State:          open\n");#	io.print("# >Class:          sw-bug\n");#	io.print("# >Submitter-Id:   unknown\n");#	io.print("# >Arrival-Date:   Wed Mar 11 14:28:45 1998\n");#	io.print("# >Originator:     manegold@cwi.nl\n");#	io.print("# >Organization:\n");#	io.print("# CWI\n");#	io.print("# >Release:        980101\n");#	io.print("# >Environment:\n");#	io.print("# any\n");#	io.print("# >Description:\n");#	io.print("# 'table(histo, $(3..))` in 'proc xtable_print`  in\n");#	io.print("# 'xtables.mil` (also available as test 'plain/xtables/`)\n");#	io.print("# ends up in an endless loop in the macro 'matchloop`\n");#	io.print("# (src/gdk/gdk_relop.mx) as soon as the first tuple is \n");#	io.print("# printed. 'matchloop` is called as \n");#	io.print("# 'matchloop(hloc,OID,_oid)` in line 1054 of \n");#	io.print("# 'src/gdk/gdk_relop.mx`.\n");#	io.print("# \n");#	io.print("# maybe, this is no bug in module xtables, but somewhere \n");#	io.print("# else, but as it seems to occur only here, I submit \n");#	io.print("# this as an xtables bug report.\n");#	io.print("# \n");#	io.print("# as soon as I got some time, I will try to do some more \n");#	io.print("# debugging.\n");#	io.print("# \n");#	io.print("# \tstefan\n");#	io.print("# \n");#	io.print("# ================\n");#	io.print("# Output\n");#	io.print("# ----------------\n");#	io.print("# [...]\n");#	io.print("# \n");#	io.print("# #You are system administrator (adm)!\n");#	io.print("# \n");#	io.print("# #line 437 \"modules/plain/xtables.mx\"\n");#	io.print("# setoid(oid(20000000));\n");#	io.print("# module(xtables);\n");#	io.print("# \n");#	io.print("# # First some procs for convenience:\n");#	io.print("# # - xtable_print(group[oid,oid], str, attr1[oid,a1], attr2[oid,a2], ...)\n");#	io.print("# #       print group count table \n");#	io.print("# # - xtable_realloc(bat, capacity):  bat\n");#	io.print("# #       allocate more memory and return a copy of a bat\n");#	io.print("# # - xtable_test(str title, bat x, bat y, bat z)\n");#	io.print("# #        major test script on xtable functionality\n");#	io.print("# \n");#	io.print("# proc xtable_print() : void { \n");#	io.print("#         var histo := $1.histogram;\n");#	io.print("#         histo.rename(\"count\");\n");#	io.print("#         printf(\"\\n# %s (ct: %d elts, %d groups, %d bytes)\\n\",\n");#	io.print("#                 $2, $1.count, histo.count, $1.batsize);\n");#	io.print("#         table(histo, $(3..));\n");#	io.print("# }\n");#	io.print("# \n");#	io.print("# proc xtable_realloc(bat b, int cap) : bat { \n");#	io.print("#         bn := bbp.new(b.htype, b.ttype, bat);\n");#	io.print("#         if (b.htype = void) bn.seqbase(b.reverse.fetch(0));\n");#	io.print("#         if (b.ttype = void) bn.seqbase(b.fetch(0));\n");#	io.print("#         bn.insert(b);\n");#	io.print("#         return bn;\n");#	io.print("# }\n");#	io.print("# \n");#	io.print("# proc xtable_test(str title, bat x, bat y, bat z) : bat {\n");#	io.print("#     printf(\"# xtable_test: %s grouping (%d tuples, %d bytes)\\n\\n\",\n");#	io.print("#                 title, x.count, x.batsize + y.batsize + z.batsize);\n");#	io.print("#     x.rename(\"x\"); y.rename(\"y\"); z.rename(\"z\");\n");#	io.print("# \n");#	io.print("#     bat.print(x.slice(0,7),y,z);\n");#	io.print("#     printf(\"synced(x,y) := %s\\n\", synced(x,y).str);\n");#	io.print("#     printf(\"synced(x,z) := %s\\n\", synced(x,z).str);\n");#	io.print("# \n");#	io.print("#     var x1 := CTgroup(x);\n");#	io.print("#     x1.xtable_print(\"CT(x)\", x);\n");#	io.print("# \n");#	io.print("#     var x1y := CTgroup(x1,y);\n");#	io.print("#     x1y.xtable_print(\"CT(x,y)\", x, y);\n");#	io.print("# \n");#	io.print("#     var v :=  y.uselect(dbl(2.0),dbl(3.0));\n");#	io.print("#     var xvy := CTsubgroup(x1,y,v);\n");#	io.print("#     xvy.xtable_print(\"CT(x,y|v)\", x, y);\n");#	io.print("# \n");#	io.print("#     var x1yz := CTgroup(x1y,z);\n");#	io.print("#     x1yz.xtable_print(\"CT(x,y,z)\", x, y, z);\n");#	io.print("# }\n");#	io.print("# \n");#	io.print("# x := bbp.new(oid,chr);\n");#	io.print("# x.insert(1@0,'a');\n");#	io.print("# x.insert(2@0,'a');\n");#	io.print("# x.insert(3@0,'b');\n");#	io.print("# x.insert(4@0,'b');\n");#	io.print("# x.insert(5@0,'b');\n");#	io.print("# x.insert(6@0,'b');\n");#	io.print("# x.insert(7@0,'c');\n");#	io.print("# x.insert(8@0,'c');\n");#	io.print("# \n");#	io.print("# y:= bbp.new(oid,dbl);\n");#	io.print("# y.insert(1@0,dbl(1.0));\n");#	io.print("# y.insert(2@0,dbl(3.0));\n");#	io.print("# y.insert(3@0,dbl(2.0));\n");#	io.print("# y.insert(4@0,dbl(2.0));\n");#	io.print("# y.insert(5@0,dbl(2.0));\n");#	io.print("# y.insert(6@0,dbl(3.0));\n");#	io.print("# y.insert(7@0,dbl(1.0));\n");#	io.print("# y.insert(8@0,dbl(1.0));\n");#	io.print("# \n");#	io.print("# z:= bbp.new(oid,str);\n");#	io.print("# z.insert(1@0,\"c\");\n");#	io.print("# z.insert(2@0,\"a\");\n");#	io.print("# z.insert(3@0,\"b\");\n");#	io.print("# z.insert(4@0,\"c\");\n");#	io.print("# z.insert(5@0,\"a\");\n");#	io.print("# z.insert(6@0,\"a\");\n");#	io.print("# z.insert(7@0,\"c\");\n");#	io.print("# z.insert(8@0,\"a\");\n");#	io.print("# \n");#	io.print("# xtable_test(\"small hash\", x, y, z);\n");#	io.print("# # xtable_test: small hash grouping (8 tuples, 8660 bytes)\n");#	io.print("# \n");#	io.print("# #-----------------------------------------#\n");#	io.print("# # oid   | tmp_30| y             | z       #\n");#	io.print("# #-----------------------------------------#\n");#	io.print("# [ 1@0,    'a',    1.000000,       \"c\"     ]\n");#	io.print("# [ 2@0,    'a',    3.000000,       \"a\"     ]\n");#	io.print("# [ 3@0,    'b',    2.000000,       \"b\"     ]\n");#	io.print("# [ 4@0,    'b',    2.000000,       \"c\"     ]\n");#	io.print("# [ 5@0,    'b',    2.000000,       \"a\"     ]\n");#	io.print("# [ 6@0,    'b',    3.000000,       \"a\"     ]\n");#	io.print("# [ 7@0,    'c',    1.000000,       \"c\"     ]\n");#	io.print("# [ 8@0,    'c',    1.000000,       \"a\"     ]\n");#	io.print("# synced(x,y) := false\n");#	io.print("# synced(x,z) := false\n");#	io.print("# \n");#	io.print("# # CT(x) (ct: 8 elts, 3 groups, 1096 bytes)\n");#	io.print("# #-----------------#\n");#	io.print("# # count | x       #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 2,      'a'     ]\n");#	io.print("# \n");#	io.print("# ================\n");#	io.print("#line 450 \"modules/plain/xtables.mx\"\n");	aa_a := calc.oid(20000000);	ba_a := setoid(aa_a);#	io.print("# First some procs for convenience: \n");#	io.print("# - xtable_print(group[oid,oid], str, attr1[oid,a1], attr2[oid,a2], ...)\n");#	io.print("# \tprint group count table \n");#	io.print("# - xtable_realloc(bat, capacity):  bat\n");#	io.print("#\tallocate more memory and return a copy of a bat\n");#	io.print("# - xtable_test(str title, bat x, bat y, bat z)\n");#	io.print("#\t major test script on xtable functionality\n");#	io.print("proc xtable_print(..any..) : void {");function xtable_print(,xtable_print:any$1...):void;#	io.print("        var histo := $1.histogram();");	ca_a := mil.getVarTemp($1);	histo := histogram(ca_a);#	io.print("                $2, $1.count(), histo.count(), $1.batsize());");	da_a := mil.getVarTemp($2);	ea_a := mil.getVarTemp($1);	fa_a := aggr.count(ea_a);	ga_a := aggr.count(histo);	ha_a := mil.getVarTemp($1);	ia_a := bat.bbpBatSize(ha_a);	ja_a := printf("\n# %s (ct: %d elts, %d groups, %d bytes)\n",da_a,fa_a,ga_a,ia_a);#	io.print("        table(histo.col_name(\"count\"), $(3..));");	ka_a := bat.setColumn(histo,"count");	la_a := mil.getVarTempRange(3);	ma_a := table(ka_a,la_a);end xtable_print;#	io.print("proc xtable_realloc(bat b,int cap) : bat {");function xtable_realloc(b:bat[:any_1,:any_2], cap:int):bat[:any_3,:any_4];#	io.print("        var inf := b.info();");	inf := info(b);#	io.print("        var ht := monet_atomtbl.find(inf.find(\"head\"));");	monet_atomtbl:= mil.take("monet_atomtbl");	na_a := algebra.find(inf,"head");	ht := algebra.find(monet_atomtbl,na_a);#	io.print("        var tt := monet_atomtbl.find(inf.find(\"tail\"));");	oa_a := algebra.find(inf,"tail");	tt := algebra.find(monet_atomtbl,oa_a);#	io.print("        var bn := bbp.new(ht, tt, cap);");	bn := bbp.new(ht,tt,cap);#	io.print("        bn.insert(b);");	pa_a := bat.insert(bn,b);#	io.print("        if (ht = void) bn.seqbase(b.reverse().fetch(0));");barrier	qa_a := ==(ht,nil:oid);	ra_a := bat.reverse(b);	sa_a := fetch(ra_a,0);#	io.print("        if (tt = void) bn.seqbase(b.fetch(0));");exit	qa_a;barrier	ua_a := ==(tt,nil:oid);	va_a := fetch(b,0);#	io.print("        return bn;");exit	ua_a;	return xa_a :=bn;end xtable_realloc;#	io.print("proc xtable_test(str title, bat x, bat y, bat z) : void {");function xtable_test(title:str, x:bat[:any_1,:any_2], y:bat[:any_3,:any_4], z:bat[:any_5,:any_6]):void;#	io.print("                title, x.count(), x.batsize() + y.batsize() + z.batsize());");	ya_a := aggr.count(x);	ab_a := bat.bbpBatSize(y);	bb_a := bat.bbpBatSize(z);	cb_a := bat.bbpBatSize(x);	db_a := +(ab_a,bb_a);	eb_a := +(cb_a,db_a);	fb_a := printf("# xtable_test: %s grouping (%d tuples, %d bytes)\n\n",title,ya_a,eb_a);#	io.print("    x.col_name(\"x\"); y.col_name(\"y\"); z.col_name(\"z\");");	gb_a := bat.setColumn(x,"x");	hb_a := bat.setColumn(y,"y");	ib_a := bat.setColumn(z,"z");#	io.print("    bat.print(x.slice(0,7),y,z);");	jb_a := slice(x,0,7);	kb_a := bat.print(jb_a,y,z);#	io.print("    printf(\"synced(x,y) := %s\\n\", synced(x,y).str());");	lb_a := isSynced(x,y);

⌨️ 快捷键说明

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