Changeset: 1db75f363d6d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1db75f363d6d Modified Files: geom/monetdb5/geom.mal monetdb5/mal/mal_parser.c monetdb5/modules/atoms/color.mal monetdb5/modules/atoms/inet.mal monetdb5/modules/atoms/json.mal monetdb5/modules/atoms/mtime.mal monetdb5/modules/atoms/url.mal monetdb5/modules/atoms/uuid.mal monetdb5/modules/atoms/xml.mal testing/malcheck.py Branch: geo Log Message:
Merge with default branch. diffs (truncated from 461 to 300 lines): diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal --- a/geom/monetdb5/geom.mal +++ b/geom/monetdb5/geom.mal @@ -7,11 +7,11 @@ # @' overwrite lng needed for fixed size! Sizes are fixed in geom.prelude atom mbr:lng; -command tostr() :str address mbrTOSTR; -command fromstr() :mbr address mbrFROMSTR; -command hash() :int address mbrHASH; -command null() :int address mbrNULL; -command cmp() :int address mbrCOMP; +command tostr() address mbrTOSTR; +command fromstr() address mbrFROMSTR; +command hash() address mbrHASH; +command null() address mbrNULL; +command cmp() address mbrCOMP; command read() address mbrREAD; command write() address mbrWRITE; @@ -19,32 +19,32 @@ command write() address mbrWRITE; atom wkb; -command tostr() :str address wkbTOSTR; -command fromstr() :wkb address wkbFROMSTR; -command hash() :int address wkbHASH; -command null() :int address wkbNULL; -command cmp() :int address wkbCOMP; #used in selections +command tostr() address wkbTOSTR; +command fromstr() address wkbFROMSTR; +command hash() address wkbHASH; +command null() address wkbNULL; +command cmp() address wkbCOMP; #used in selections command read() address wkbREAD; #read from log command write() address wkbWRITE; #write on log -command put() :int address wkbPUT; #put in heap -command del() :int address wkbDEL; #delete from heap -command length() :int address wkbLENGTH; -command heap() :int address wkbHEAP; #create heap +command put() address wkbPUT; #put in heap +command del() address wkbDEL; #delete from heap +command length() address wkbLENGTH; +command heap() address wkbHEAP; #create heap #command wkb{unsafe}(v:str) :wkb address wkbFromString; atom wkba; -command tostr() :str address wkbaTOSTR; -command fromstr() :wkba address wkbaFROMSTR; -command null() :int address wkbaNULL; -command hash() :int address wkbaHASH; -command cmp() :int address wkbaCOMP; #used in selections +command tostr() address wkbaTOSTR; +command fromstr() address wkbaFROMSTR; +command null() address wkbaNULL; +command hash() address wkbaHASH; +command cmp() address wkbaCOMP; #used in selections command read() address wkbaREAD; #read from log command write() address wkbaWRITE; #write on log -command put() :int address wkbaPUT; #put in heap -command del() :int address wkbaDEL; #delete from heap -command length() :int address wkbaLENGTH; -command heap() :int address wkbaHEAP; #create heap +command put() address wkbaPUT; #put in heap +command del() address wkbaDEL; #delete from heap +command length() address wkbaLENGTH; +command heap() address wkbaHEAP; #create heap module geom; diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -629,7 +629,7 @@ handleInts: * The type variable are defined within the context of a function * scope. * Additional information, such as a repetition factor, - * encoding tables, or type dependency should be modelled as properties. + * encoding tables, or type dependency should be modeled as properties. */ static int typeAlias(Client cntxt, int tpe) diff --git a/monetdb5/modules/atoms/color.mal b/monetdb5/modules/atoms/color.mal --- a/monetdb5/modules/atoms/color.mal +++ b/monetdb5/modules/atoms/color.mal @@ -8,8 +8,8 @@ module color; atom color:int; -command tostr():str address color_tostr; -command fromstr():color address color_fromstr; +command tostr() address color_tostr; +command fromstr() address color_fromstr; command str(s:color):str address CLRstr diff --git a/monetdb5/modules/atoms/inet.mal b/monetdb5/modules/atoms/inet.mal --- a/monetdb5/modules/atoms/inet.mal +++ b/monetdb5/modules/atoms/inet.mal @@ -6,9 +6,9 @@ atom inet:lng; -command null() :inet +command null() address INETnull; -command cmp() :int +command cmp() address INETcompare; command fromstr() address INETfromString diff --git a/monetdb5/modules/atoms/json.mal b/monetdb5/modules/atoms/json.mal --- a/monetdb5/modules/atoms/json.mal +++ b/monetdb5/modules/atoms/json.mal @@ -6,11 +6,11 @@ atom json:str; -command fromstr():json +command fromstr() address JSONfromString comment "Validate a string to be JSON compliant. A NOOP if valid json, NULL otherwise."; -command tostr():str +command tostr() address JSONtoString comment "Convert JSON to its string equivalent. Dealing with escape characters"; diff --git a/monetdb5/modules/atoms/mtime.mal b/monetdb5/modules/atoms/mtime.mal --- a/monetdb5/modules/atoms/mtime.mal +++ b/monetdb5/modules/atoms/mtime.mal @@ -40,9 +40,9 @@ command date(s:date):date address MTIMEdate_date comment "Noop routine."; -command fromstr() :date +command fromstr() address date_fromstr; -command tostr() :str +command tostr() address date_tostr; @@ -106,9 +106,9 @@ comment "Equality of two dates"; # SEP = '.' or ':' # @end verbatim atom daytime :int; -command fromstr():daytime +command fromstr() address daytime_tz_fromstr; -command tostr():str +command tostr() address daytime_tostr; @@ -180,10 +180,10 @@ comment "Equality of two daytimes"; # timezone. The default local timezone is just GMT+00, but it can be set # arbitrarily. atom timestamp :lng; -command fromstr():timestamp +command fromstr() address timestamp_fromstr; -command tostr():str +command tostr() address timestamp_tostr; command unix_epoch{unsafe}():timestamp @@ -296,9 +296,9 @@ comment "Equality of two timestamps"; # Other values of the rule parameters on creating a timezone will produce a # nil-timezone. atom timezone :lng; -command fromstr():timezone +command fromstr() address tzone_fromstr; -command tostr():str +command tostr() address tzone_tostr; command str(z:timezone):str address MTIMEtzone_tostr; @@ -309,9 +309,9 @@ address MTIMEtimestamp comment "Utility function to create a timestamp from a number of seconds since the Unix epoch"; atom zrule :int; -command fromstr():zrule +command fromstr() address rule_fromstr; -command tostr():str +command tostr() address rule_tostr; command define(m:int,d:int,w:int,h:int,min:int):zrule address MTIMEruleDef0 diff --git a/monetdb5/modules/atoms/url.mal b/monetdb5/modules/atoms/url.mal --- a/monetdb5/modules/atoms/url.mal +++ b/monetdb5/modules/atoms/url.mal @@ -89,10 +89,10 @@ command new(prot:str, host:str, fnme:str address URLnew3 comment "Construct URL from protocol, host,and file"; -command fromstr() :url +command fromstr() address URLfromString comment "Convert a string to an url. "; -command tostr() :str +command tostr() address URLtoString comment "Convert url to string equivalent"; diff --git a/monetdb5/modules/atoms/uuid.mal b/monetdb5/modules/atoms/uuid.mal --- a/monetdb5/modules/atoms/uuid.mal +++ b/monetdb5/modules/atoms/uuid.mal @@ -1,13 +1,13 @@ atom uuid; # the atom functions -command cmp() :int address UUIDcompare; -command fromstr() :uuid address UUIDfromString; -command hash() :int address UUIDhash; -command null() :uuid address UUIDnull; -command read() :uuid address UUIDread; -command tostr() :str address UUIDtoString; -command write() :int address UUIDwrite; +command cmp() address UUIDcompare; +command fromstr() address UUIDfromString; +command hash() address UUIDhash; +command null() address UUIDnull; +command read() address UUIDread; +command tostr() address UUIDtoString; +command write() address UUIDwrite; # fix up the rest of the atom definition command prelude():void address UUIDprelude; diff --git a/monetdb5/modules/atoms/xml.mal b/monetdb5/modules/atoms/xml.mal --- a/monetdb5/modules/atoms/xml.mal +++ b/monetdb5/modules/atoms/xml.mal @@ -6,11 +6,11 @@ atom xml :str; -command fromstr():xml +command fromstr() address XMLfromString comment "Convert a string to an xml."; -command tostr():str +command tostr() address XMLtoString comment "Convert xml to string equivalent"; diff --git a/testing/malcheck.py b/testing/malcheck.py --- a/testing/malcheck.py +++ b/testing/malcheck.py @@ -13,15 +13,18 @@ comreg = re.compile(r'\bcommand\s+' + ma # recognize MAL "pattern" declarations patreg = re.compile(r'\bpattern\s+' + malfre + r'\(\s*(?P<args>[^()]*)\)\s*(?P<rets>\([^()]*\)|:\s*bat\[[^]]*\](?:\.\.\.)?|:\s*[a-zA-Z_][a-zA-Z_0-9]*(?:\.\.\.)?|)\s+' + addrre + r'\b') +atmreg = re.compile(r'\batom\s+(?P<atom>[a-zA-Z_][a-zA-Z0-9_]*)(?:\s*[:=]\s*(?P<base>[a-zA-Z_][a-zA-Z0-9_]*))?\s*;') + treg = re.compile(r':\s*(bat\[[^]]*\]|[a-zA-Z_][a-zA-Z_0-9]*)') expre = re.compile(r'\b[a-zA-Z_0-9]+export\s+(?P<decl>[^;]*;)', re.MULTILINE) nmere = re.compile(r'\b(?P<name>[a-zA-Z_][a-zA-Z_0-9]*)\s*[[(;]') -freg = re.compile(r'str (?P<name>\w+)\((?P<args>[^()]*)\)') +freg = re.compile(r'(?P<rtype>\w+(?:\s*\*)*)\s*\b(?P<name>\w+)\((?P<args>[^()]*)\)') creg = re.compile(r'\bconst\b') sreg = re.compile(r'\bchar\s*\*') areg = re.compile(r'\w+') +argreg = re.compile(r'\s*\w+$') mappings = { 'zrule': 'rule', @@ -37,6 +40,25 @@ mappings = { cmappings = { 'sqlblob': 'blob', } +atomfunctypes = { + # MAL name: (return type, (argument...)) + # where each argument is (type, const) + 'cmp': ('int', (('void *', True), ('void *', True))), + 'del': ('void', (('Heap *', False), ('var_t *', False))), + 'fix': ('int', (('void *', True),)), + 'fromstr': ('int', (('char *', True), ('int *', False), ('ptr *', False))), + 'hash': ('BUN', (('void *', True),)), + 'heap': ('void', (('Heap *', False), ('size_t', False))), + 'length': ('int', (('void *', False),)), + 'nequal': ('int', (('void *', True), ('void *', True))), + 'null': ('void *', (('void', False),)), + 'put': ('var_t', (('Heap *', False), ('var_t *', False), ('void *', True))), + 'read': ('void *', (('void *', False), ('stream *', False), ('size_t', False))), + 'storage': ('long', (('void', False),)), + 'tostr': ('int', (('str *', False), ('int *', False), ('void *', True))), + 'unfix': ('int', (('void *', True),)), + 'write': ('int', (('void *', True), ('stream *', False), ('size_t', False))), + } defre = re.compile(r'^[ \t]*#[ \t]*define[ \t]+(?P<name>[a-zA-Z_][a-zA-Z0-9_]*)\((?P<args>[a-zA-Z0-9_, \t]*)\)[ \t]*(?P<def>.*)$', re.MULTILINE) @@ -44,64 +66,72 @@ cldef = re.compile(r'^[ \t]*#', re.MULTI _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list