Changeset: e70c94861a34 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e70c94861a34 Added Files: monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/mtime.h monetdb5/modules/atoms/mtime.mal Removed Files: monetdb5/modules/atoms/mtime.mx Modified Files: monetdb5/modules/atoms/Makefile.ag Branch: default Log Message:
Converted mtime.mx to .c/.h/.mal. This was done rather simplistically by just using cleaned up versions of the expanded files. diffs (truncated from 4167 to 300 lines): diff --git a/monetdb5/modules/atoms/Makefile.ag b/monetdb5/modules/atoms/Makefile.ag --- a/monetdb5/modules/atoms/Makefile.ag +++ b/monetdb5/modules/atoms/Makefile.ag @@ -30,7 +30,7 @@ lib_atoms = { color.c color.h \ identifier.c identifier.h \ inet.c inet.h \ - mtime.mx \ + mtime.c mtime.h \ streams.c streams.h \ str.c str.h \ url.c url.h \ @@ -50,8 +50,8 @@ headers_mal = { str.mal \ url.mal \ xml.mal \ - mtime.mx + mtime.mal } EXTRA_DIST_DIR = Tests -EXTRA_DIST = blob.mal color.mal identifier.mal inet.mal xml.mal xml.sql batxml.sql str.mal batxml.mal url.mal streams.mal +EXTRA_DIST = blob.mal color.mal identifier.mal inet.mal xml.mal xml.sql batxml.sql str.mal batxml.mal url.mal streams.mal mtime.mal diff --git a/monetdb5/modules/atoms/mtime.mx b/monetdb5/modules/atoms/mtime.c rename from monetdb5/modules/atoms/mtime.mx rename to monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.mx +++ b/monetdb5/modules/atoms/mtime.c @@ -1,25 +1,22 @@ -@/ -The contents of this file are subject to the MonetDB Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://www.monetdb.org/Legal/MonetDBLicense - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is the MonetDB Database System. - -The Initial Developer of the Original Code is CWI. -Portions created by CWI are Copyright (C) 1997-July 2008 CWI. -Copyright August 2008-2012 MonetDB B.V. -All Rights Reserved. -@ - -@f mtime - -@c +/* + * The contents of this file are subject to the MonetDB Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.monetdb.org/Legal/MonetDBLicense + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is the MonetDB Database System. + * + * The Initial Developer of the Original Code is CWI. + * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. + * Copyright August 2008-2012 MonetDB B.V. + * All Rights Reserved. + */ + /* * @t New Temporal Module * @a Peter Boncz, Martin van Dinther @@ -201,744 +198,10 @@ All Rights Reserved. * * @+ Time/date comparison */ -@= compareGrp -command ==(v:@1,w:@1):bit -address MTIME@1_EQ -comment "Equality of two @1s"; -command !=(v:@1,w:@1):bit -address MTIME@1_NEQ -comment "Equality of two @1s"; -command <(v:@1,w:@1):bit -address MTIME@1_LT -comment "Equality of two @1s"; -command <=(v:@1,w:@1):bit -address MTIME@1_LE -comment "Equality of two @1s"; -command >(v:@1,w:@1):bit -address MTIME@1_GT -comment "Equality of two @1s"; -command >=(v:@1,w:@1):bit -address MTIME@1_GE -comment "Equality of two @1s"; -command isnil(v:@1):bit -address MTIME@1_isnil -comment "Nil test for @1 value"; - -module mtime; -command calc.==(v:@1,w:@1):bit -address MTIME@1_EQ -comment "Equality of two @1s"; -command calc.!=(v:@1,w:@1):bit -address MTIME@1_NEQ -comment "Equality of two @1s"; -command calc.<(v:@1,w:@1):bit -address MTIME@1_LT -comment "Equality of two @1s"; -command calc.<=(v:@1,w:@1):bit -address MTIME@1_LE -comment "Equality of two @1s"; -command calc.>(v:@1,w:@1):bit -address MTIME@1_GT -comment "Equality of two @1s"; -command calc.>=(v:@1,w:@1):bit -address MTIME@1_GE -comment "Equality of two @1s"; -command calc.isnil(v:@1):bit -address MTIME@1_isnil -comment "Nil test for @1 value"; -command calc.min(v:@1,w:@1):@1 -address MTIME@1_min -comment "Minimum test for @1 value"; -command calc.max(v:@1,w:@1):@1 -address MTIME@1_max -comment "Maximum test for @1 value"; -command calc.min_no_nil(v:@1,w:@1):@1 -address MTIME@1_min_no_nil -comment "Minimum test for @1 value"; -command calc.max_no_nil(v:@1,w:@1):@1 -address MTIME@1_max_no_nil -comment "Maximum test for @1 value"; -@ -@mal - -# @+ Date atom -# Monet atoms can have multiple @emph{parse formats}. One of these formats is -# chosen as the @emph{print format}. -# -# To facilitate date descriptions, many formats are supported when parsing -# date atoms from a string, as described by the below grammar. -# -# @verbatim -# print format: INT_YEAR '-' INT_MONTH '-' INT_DAY -# parse format: INT_YEAR SEP1 INT_MONTH SEP1 INT_DAY -# or: INT_YEAR SEP2 STR_MONTH SEP2 INT_DAY -# or: STR_MONTH ' '+ INT_DAY ',' ' '* INT_YEAR -# -# with: INT_YEAR = integer between -5867411 and 5867411 -# INT_DAY = integer between 1 and 31 -# INT_MONTH = integer between 1 and 12 -# STR_MONTH = 'JANUARY' or 'FEBRUARY' or 'MARCH' or 'APRIL' or 'MAY' -# or 'JUNE' or 'JULI' or 'AUGUST' or 'SEPTEMBER' or 'OCTOBER' -# or 'NOVEMBER' or 'DECEMBER' (lowercase characters, and/or -# only the first three characters are also allowed) -# SEP1 = '-' or '/' or '\' or (' ')+ -# SEP2 = SEP1 or '' -# @end verbatim -# -# Printing a date uses the 1999-01-31 format, as this is both language neutral -# and the lexicographical string ordering of this representation respects the -# actual date ordering. -# -# Other print formats can be achieved by writing a customized MIL procedure -# that extracts year, month and day from a date as integers and formats those -# in a string. -atom date :int; -command date(s:date):date -address MTIMEdate_date -comment "Noop routine."; - -command fromstr() :date -address date_fromstr; -command tostr() :str -address date_tostr; - -@:compareGrp(date)@ -# @+ Daytime atom -# A valid time of day to the detail of milliseconds, like 23:59:59:000 -# -# @verbatim -# print format: HOUR ':' MIN ':' SEC '.' MSEC -# parse format: HOUR ':' MIN ':' SEC SEP MSEC -# or: HOUR ':' MIN ':' SEC -# or: HOUR ':' MIN -# -# with: HOUR = integer between 0 and 23 -# MIN = integer between 0 and 59 -# SEC = integer between 0 and 59 (default = 0) -# MSEC = integer between 0 and 999 (default = 0) -# SEP = '.' or ':' -# @end verbatim -atom daytime :int; -command fromstr():daytime -address daytime_tz_fromstr; -command tostr():str -address daytime_tostr; - -@:compareGrp(daytime)@ - -# @+ Timestamp -# An absolute point of time, as formed by the combination of a date a daytime in GMT -# e.g. 1999-01-31@@23:59:59:000. GMT is the universal time at the Greenwich meridian, -# without any daylight savings time (DST). As such GMT times are 'absolute' (continuous, -# without hour jumps as in DST), so accurate time difference computations can be performed. -# -# @verbatim -# print format: DATE ' ' DAYTIME -# parse format: DATE ' ' DAYTIME ['GMT' ZONE ] -# -# with: DATE = a valid parse format of the date atom (as decribed earlier) -# DAYTIME = a valid parse format of the daytime atom (as decribed earlier) -# ZONE = ('+'|'-') HOUR ':' MIN [ 'DST' ] -# @end verbatim -# -# Though internally timestamps are stored in GMT, the printing and parsing of -# timestamps is relative to the local timezone. That is, timestamps are -# printed without GMT part, meaning that the time is relative to the local -# timezone. Also, if a timestamp is parsed from a string that does not have -# an explicit GMT specifier, it is taken to be a timestamp in the local -# timezone. The default local timezone is just GMT+00, but it can be set -# arbitrarily. -atom timestamp :lng; -command fromstr():timestamp -address timestamp_fromstr; - -command tostr():str -address timestamp_tostr; - -command unix_epoch{unsafe}():timestamp -address MTIMEunix_epoch -comment "The Unix epoch time (00:00:00 UTC on January 1, 1970)"; -command epoch{unsafe}():timestamp -address MTIMEepoch -comment "unix-time (epoch) support: seconds since the Unix epoch"; -command epoch(t:timestamp):int -address MTIMEepoch2int -comment "unix-time (epoch) support: seconds since epoch"; -command epoch(t:int):timestamp -address MTIMEtimestamp -comment "convert seconds since epoch into a timestamp"; - -@:compareGrp(timestamp)@ - -# When creating a timestamp from a date and daytime, a timezone should be specified -# (if timezone is omitted, the local timezone is assumed). If a timezone is specified, -# it is used to convert the date and time in that timezone to GMT, which is the internal -# timestamp representation. One problem here is that the first hour after DST -# has ended (some Sunday night in autumn, generally), the time is set back one hour, so -# the same times occur twice. Hence two translations to a timestamp are possible for -# such date and time combinations. In those case, we act as if it was the first -# occurrence (still within DST). -# -# @+ tzone -# A timezone determines a @emph{time offset} from GMT with format -# [-] HOUR ':' MINUTES, with HOUR between [0:23] and MINUTES between [0:59]. -# -# Possibly, @emph{Daylight Savings Time} (DST) is in force in a timezone, which means that -# between a start and an end date, the clock is set back @b{one hour}. The start and -# end date of DST are determined by a @emph{rule}. These rules (similar to the -# Java Timezone class) are made up of 4 parameters: a month @b{M}, a day number in the -# month @b{D}, a day-of-week (monday,..,sunday) denoted @b{W}, and a daytime @b{T} -# (only to the minute detail). -# -# Depending of the values of these parameters, five kinds of rules can be made -# (similar to the Java TimeZone class): -# -# @itemize @bullet -# @item first @b{D}th weekday @b{W} from start of month @b{M}. -# iff @b{D} in [1,..,5], @b{W} in [1,..,7] -# -# @item last @b{D}th weekday @b{W} from end of month @b{M}. -# iff @b{D} in [-5,..,-1], @b{W} in [1,..,7] -# -# @item first weekday @b{W} in month @b{M} after exact @b{D}th day of month. -# iff @b{D} in [1,..,31], @b{W} in [-7,..,-1] -# -# @item last weekday @b{W} in month @b{M} before exact @b{D}th day of month. -# iff @b{D} in [-31,..,-1], @b{W} in [-7,..,-1] -# -# @item exact @b{D}th day of month @b{M}. -# iff @b{D} in [1,..,31], @b{W}=0; -# @end itemize -# -# The parameters @b{M} is a month number between 1 and 12, and @b{T} is a time -# to the minute detail just like the time offset of the timezone. -# -# Other values of the rule parameters on creating a timezone will produce a -# nil-timezone. -atom timezone :lng; -command fromstr():timezone -address tzone_fromstr; -command tostr():str -address tzone_tostr; -command str():str -address MTIMEtzone_tostr; -command timestamp(s:str):timestamp -address MTIMEtimestamp_fromstr; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list