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

📄 no.156.mal

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MAL
字号:
# 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:         156\n");#	io.print("# >Category:       Mserver\n");#	io.print("# >Synopsis:       multiplex bug\n");#	io.print("# >Confidential:   no\n");#	io.print("# >Severity:       critical\n");#	io.print("# >Priority:       high\n");#	io.print("# >Responsible:    boncz (Peter Boncz)\n");#	io.print("# >State:          open\n");#	io.print("# >Class:          sw-bug\n");#	io.print("# >Submitter-Id:   unknown\n");#	io.print("# >Arrival-Date:   Mon Jun  8 14:53:01 1998\n");#	io.print("# >Originator:     windhouw@cwi.nl\n");#	io.print("# >Organization:\n");#	io.print("# CWI\n");#	io.print("# >Release:        980101\n");#	io.print("# >Environment:\n");#	io.print("# SunOS5.6\n");#	io.print("# >Description:\n");#	io.print("# Hoi,\n");#	io.print("# \n");#	io.print("# the following error occurs when I'm using the multiplex operation:\n");#	io.print("# > GDKmalloc called with size 0\n");#	io.print("# And the server is gone.\n");#	io.print("# This happens when I've a multiplex operation in a inner loop. The second time\n");#	io.print("# the loop comes to the inner loop, the multiplex operator recieves different data (garbage).\n");#	io.print("# In mine orginal code there was an own module command as multiplex operation and there I\n");#	io.print("# printed the recieved input values. These were really different in the second loop.\n");#	io.print("# \n");#	io.print("# Example script:\n");#	io.print("# \n");#	io.print("# 8<----\n");#	io.print("# PROC extractBit(any theBitsets,any theBit,any theStr,any loop) : void {\n");#	io.print("#         VAR res;\n");#	io.print("#         IF (loop = false) {\n");#	io.print("# printf(\"!Before multiplex operation\\n\");\n");#	io.print("#                 res := [*](theBitsets,theBit);\n");#	io.print("# printf(\"!After multiplex operation\\n\");\n");#	io.print("#         } ELSE {\n");#	io.print("#                 res := bbp.new(theBitsets.htype,int);\n");#	io.print("#                 theBitsets@batloop {\n");#	io.print("#                         VAR b := $t*theBit;\n");#	io.print("#                         res.insert($h,b);\n");#	io.print("#                 }\n");#	io.print("#         }\n");#	io.print("#         printf(\"%s keer\\n\",theStr);\n");#	io.print("#         res.print;\n");#	io.print("# }\n");#	io.print("# \n");#	io.print("# PROC bitsetHist(any theEnum,any theBitsets,any loop) : void {\n");#	io.print("#         theEnum@batloop {\n");#	io.print("#                 VAR c := extractBit(theBitsets,$h,$t,false);\n");#	io.print("#         }\n");#	io.print("# }\n");#	io.print("# \n");#	io.print("# VAR enum := bbp.new(int,str);\n");#	io.print("# enum.insert(0,\"nul\");\n");#	io.print("# enum.insert(1,\"een\");\n");#	io.print("# enum.insert(2,\"twee\");\n");#	io.print("# enum.insert(3,\"drie\");\n");#	io.print("# enum.insert(4,\"vier\");\n");#	io.print("# enum.insert(5,\"vijf\");\n");#	io.print("# enum.print;\n");#	io.print("# \n");#	io.print("# VAR bitsets := bbp.new(oid,int);\n");#	io.print("# bitsets.insert(oid(1),2);\n");#	io.print("# bitsets.insert(oid(2),4);\n");#	io.print("# bitsets.print;\n");#	io.print("# \n");#	io.print("# bitsetHist(enum,bitsets);\n");#	io.print("# 8<----\n");#	io.print("# \n");#	io.print("# Output with multiplex operation\n");#	io.print("# \n");#	io.print("# 8<----\n");#	io.print("# # Monet Database Server V4.0 (SunOS5.6) of Wed Jun  3 16:07:27 MET DST 1998\n");#	io.print("# # Copyright (c) 1993-1998, CWI & SION. All rights reserved.\n");#	io.print("# \n");#	io.print("# loaded;\n");#	io.print("# #---------------------------------#\n");#	io.print("# # module        | usage_count     #\n");#	io.print("# #---------------------------------#\n");#	io.print("# [ \"kernel\",       1               ]\n");#	io.print("# [ \"arith\",        1               ]\n");#	io.print("# [ \"bat\",          1               ]\n");#	io.print("# [ \"algebra\",      1               ]\n");#	io.print("# [ \"sys\",          1               ]\n");#	io.print("# [ \"trans\",        1               ]\n");#	io.print("# \n");#	io.print("# Try: modules;                - for other modules.\n");#	io.print("#      ls;                     - for persistent bat listing.\n");#	io.print("#      sigs(\"<module>\")        - for available commands per module.\n");#	io.print("#      help(\"<command>\")       - for help one-liner for a command.\n");#	io.print("# \n");#	io.print("# #You are system administrator (adm)!\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_23  #\n");#	io.print("# # (int)   (str)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 0,      \"nul\"   ]\n");#	io.print("# [ 1,      \"een\"   ]\n");#	io.print("# [ 2,      \"twee\"  ]\n");#	io.print("# [ 3,      \"drie\"  ]\n");#	io.print("# [ 4,      \"vier\"  ]\n");#	io.print("# [ 5,      \"vijf\"  ]\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_24  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    2       ]\n");#	io.print("# [ 2@0,    4       ]\n");#	io.print("# !Before multiplex operation\n");#	io.print("# !After multiplex operation\n");#	io.print("# nul keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    0       ]\n");#	io.print("# [ 2@0,    0       ]\n");#	io.print("# !Before multiplex operation\n");#	io.print("# GDKmalloc called with size 0\n");#	io.print("# 8<----\n");#	io.print("# \n");#	io.print("# Output with batloop\n");#	io.print("# \n");#	io.print("# 8<----\n");#	io.print("# # Monet Database Server V4.0 (SunOS5.6) of Wed Jun  3 16:07:27 MET DST 1998\n");#	io.print("# # Copyright (c) 1993-1998, CWI & SION. All rights reserved.\n");#	io.print("# \n");#	io.print("# loaded;\n");#	io.print("# #---------------------------------#\n");#	io.print("# # module        | usage_count     #\n");#	io.print("# #---------------------------------#\n");#	io.print("# [ \"kernel\",       1               ]\n");#	io.print("# [ \"arith\",        1               ]\n");#	io.print("# [ \"bat\",          1               ]\n");#	io.print("# [ \"algebra\",      1               ]\n");#	io.print("# [ \"sys\",          1               ]\n");#	io.print("# [ \"trans\",        1               ]\n");#	io.print("# \n");#	io.print("# Try: modules;                - for other modules.\n");#	io.print("#      ls;                     - for persistent bat listing.\n");#	io.print("#      sigs(\"<module>\")        - for available commands per module.\n");#	io.print("#      help(\"<command>\")       - for help one-liner for a command.\n");#	io.print("# \n");#	io.print("# #You are system administrator (adm)!\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_23  #\n");#	io.print("# # (int)   (str)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 0,      \"nul\"   ]\n");#	io.print("# [ 1,      \"een\"   ]\n");#	io.print("# [ 2,      \"twee\"  ]\n");#	io.print("# [ 3,      \"drie\"  ]\n");#	io.print("# [ 4,      \"vier\"  ]\n");#	io.print("# [ 5,      \"vijf\"  ]\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_24  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    2       ]\n");#	io.print("# [ 2@0,    4       ]\n");#	io.print("# nul keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    0       ]\n");#	io.print("# [ 2@0,    0       ]\n");#	io.print("# een keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    2       ]\n");#	io.print("# [ 2@0,    4       ]\n");#	io.print("# twee keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    4       ]\n");#	io.print("# [ 2@0,    8       ]\n");#	io.print("# drie keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    6       ]\n");#	io.print("# [ 2@0,    12      ]\n");#	io.print("# vier keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    8       ]\n");#	io.print("# [ 2@0,    16      ]\n");#	io.print("# vijf keer\n");#	io.print("# #-----------------#\n");#	io.print("# # BAT:    tmp_46  #\n");#	io.print("# # (oid)   (int)   #\n");#	io.print("# #-----------------#\n");#	io.print("# [ 1@0,    10      ]\n");#	io.print("# [ 2@0,    20      ]\n");#	io.print("setoid(oid(20000000));");	aa_a := calc.oid(20000000);	ba_a := setoid(aa_a);#	io.print("PROC extractBit(any theBitsets,any theBit,any theStr,any loop) : void {");function extractBit(theBitsets:any$1, theBit:any$2, theStr:any$3, loop:any$4):void;#	io.print("        IF (loop = false) {");barrier	ca_a := ==(loop,false);#	io.print("printf(\"!Before multiplex operation\\n\");");	da_a := printf("!Before multiplex operation\n");#	io.print("                res := [*](theBitsets,theBit);");	res := multiplex.tactics("*",theBitsets,theBit);#	io.print("printf(\"!After multiplex operation\\n\");");	ea_a := printf("!After multiplex operation\n");#	io.print("        } ELSE {");exit	ca_a;barrier	fa_a := not(ca_a);#	io.print("                res := bbp.new(theBitsets.htype(),int);");	ga_a := getHeadType(theBitsets);	res := bbp.new(ga_a,nil:int);#	io.print("                theBitsets@batloop() {");barrier	(ha_a,ha_aH,ha_aT) := newIterator(theBitsets);#	io.print("                        VAR b := $t*theBit;");	b := *(ha_aT,theBit);#	io.print("                        res.insert($h,b);");	ia_a := bat.insert(res,ha_aH,b);redo	(ha_a,ha_aH,ha_aT) := hasMoreElements(theBitsets);exit	(ha_a,ha_aH,ha_aT) ;exit	fa_a;#	io.print("        printf(\"%s keer\\n\",theStr);");	ja_a := printf("%s keer\n",theStr);#	io.print("        res.print();");	ka_a := bat.print(res);end extractBit;#	io.print("PROC bitsetHist(any theEnum,any theBitsets,any loop) : void {");function bitsetHist(theEnum:any$1, theBitsets:any$2, loop:any$3):void;#	io.print("        theEnum@batloop() {");barrier	(la_a,la_aH,la_aT) := newIterator(theEnum);#	io.print("                VAR c := extractBit(theBitsets,$h,$t,loop);");	c := extractBit(theBitsets,la_aH,la_aT,loop);redo	(la_a,la_aH,la_aT) := hasMoreElements(theEnum);exit	(la_a,la_aH,la_aT) ;end bitsetHist;#	io.print("VAR enum := bbp.new(int,str);");	enum := bbp.new(nil:int,nil:str);#	io.print("enum.insert(0,\"nul\");");	ma_a := bat.insert(enum,0,"nul");#	io.print("enum.insert(1,\"een\");");	na_a := bat.insert(enum,1,"een");#	io.print("enum.insert(2,\"twee\");");	oa_a := bat.insert(enum,2,"twee");#	io.print("enum.insert(3,\"drie\");");	pa_a := bat.insert(enum,3,"drie");#	io.print("enum.insert(4,\"vier\");");	qa_a := bat.insert(enum,4,"vier");#	io.print("enum.insert(5,\"vijf\");");	ra_a := bat.insert(enum,5,"vijf");#	io.print("enum.print();");	sa_a := bat.print(enum);#	io.print("VAR bitsets := bbp.new(oid,int);");	bitsets := bbp.new(nil:oid,nil:int);#	io.print("bitsets.insert(oid(1),2);");	ta_a := calc.oid(1);	ua_a := bat.insert(bitsets,ta_a,2);#	io.print("bitsets.insert(oid(2),4);");	va_a := calc.oid(2);	wa_a := bat.insert(bitsets,va_a,4);#	io.print("bitsets.print();");	xa_a := bat.print(bitsets);#	io.print("# with batloop\n");	ya_a := bitsetHist(enum,bitsets,true);#	io.print("# with multiplex\n");	ab_a := bitsetHist(enum,bitsets,false);#	io.print("quit();");	bb_a := clients.quit();#Identifer 'htype' mapped to 'getHeadType'

⌨️ 快捷键说明

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