diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4103 -> 4113 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/core-con.lua | 21 | ||||
-rw-r--r-- | tex/context/base/l-os.lua | 57 | ||||
-rw-r--r-- | tex/context/base/math-noa.lua | 1 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24754 -> 24754 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/context/base/type-imp-hgz.mkiv | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
10 files changed, 67 insertions, 22 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c397f51f8..fec4739ad 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.09.18 19:57} +\newcontextversion{2013.09.19 09:20} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex b7288b53d..edd770ee2 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index ff39412f0..fde3ea3ab 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.09.18 19:57} +\edef\contextversion{2013.09.19 09:20} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index cb284b9a7..315a34f39 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -216,27 +216,14 @@ function commands.Character (n) context(chr (n,upper_offset)) end function commands.characters(n) context(chrs(n,lower_offset)) end function commands.Characters(n) context(chrs(n,upper_offset)) end -local days = { - [false] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - [true] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -} - -local function weekday(day,month,year) - return date("%w",time{year=year,month=month,day=day}) + 1 -end - -local function isleapyear(year) - return (year % 400 == 0) or ((year % 100 ~= 0) and (year % 4 == 0)) -end +local weekday = os.weekday -- moved to l-os +local isleapyear = os.isleapyear -- moved to l-os +local nofdays = os.nofdays -- moved to l-os local function leapyear(year) return isleapyear(year) and 1 or 0 end -local function nofdays(year,month) - return days[isleapyear(year)][month] -end - local function textime() return tonumber(date("%H")) * 60 + tonumber(date("%M")) end @@ -254,7 +241,7 @@ converters.nofdays = nofdays converters.textime = textime function commands.weekday (day,month,year) context(weekday (day,month,year)) end -function commands.leapyear(year) context(leapyear(year)) end -- rather useless +function commands.leapyear(year) context(leapyear(year)) end -- rather useless, only for ifcase function commands.nofdays (year,month) context(nofdays (year,month)) end function commands.year () context(date("%Y")) end diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 8bfcf786c..7f3fd7caf 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -492,3 +492,60 @@ end -- print(os.which("inkscape")) -- print(os.which("gs.exe")) -- print(os.which("ps2pdf")) + +-- These are moved from core-con.lua (as I needed them elsewhere). + +local function isleapyear(year) + return (year % 400 == 0) or ((year % 100 ~= 0) and (year % 4 == 0)) +end + +os.isleapyear = isleapyear + +-- nicer: +-- +-- local days = { +-- [false] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, +-- [true] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +-- } +-- +-- local function nofdays(year,month) +-- return days[isleapyear(year)][month] +-- return month == 2 and isleapyear(year) and 29 or days[month] +-- end +-- +-- more efficient: + +local days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + +local function nofdays(year,month) + if not month then + return isleapyear(year) and 365 or 364 + else + return month == 2 and isleapyear(year) and 29 or days[month] + end +end + +os.nofdays = nofdays + +function os.weekday(day,month,year) + return date("%w",time { year = year, month = month, day = day }) + 1 +end + +function os.validdate(year,month,day) + -- we assume that all three values are set + -- year is always ok, even if lua has a 1970 time limit + if month < 1 then + month = 1 + elseif month > 12 then + month = 12 + end + if day < 1 then + day = 1 + else + local max = nofdays(year,month) + if day > max then + day = max + end + end + return year, month, day +end diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index cd0115c47..f72f568d4 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -124,6 +124,7 @@ local right_fence_code = 3 local function process(start,what,n,parent) if n then n = n + 1 else n = 0 end + local prev = nil while start do local id = start.id if trace_processing then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 0555d1048..22d672c62 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 2bdae9389..bc318b8ed 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.09.18 19:57 MKIV beta fmt: 2013.9.18 int: english/english +ConTeXt ver: 2013.09.19 09:20 MKIV beta fmt: 2013.9.19 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/type-imp-hgz.mkiv b/tex/context/base/type-imp-hgz.mkiv index a3c2a7841..091adeb2d 100644 --- a/tex/context/base/type-imp-hgz.mkiv +++ b/tex/context/base/type-imp-hgz.mkiv @@ -1 +1 @@ -\input type-ghz.mkiv \endinput % can be file synonym +\input type-imp-ghz.mkiv \endinput % can be file synonym diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 190afa692..f8e3e802e 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/18/13 19:57:11 +-- merge date : 09/19/13 09:20:57 do -- begin closure to overcome local limits and interference |