summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx48
1 files changed, 42 insertions, 6 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx
index d6f05251cfd..a5e2b797ffa 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx
@@ -41,7 +41,7 @@
% }^^A
% }
%
-% \date{Released 2018-10-19}
+% \date{Released 2018-10-26}
%
% \maketitle
%
@@ -125,15 +125,23 @@
%
% \begin{function}{l3kernel.charcat}
% \begin{syntax}
-% |l3kernel.charcat||(|\meta{charcode}, \meta{catcode}|)|
+% |l3kernel.charcat(|\meta{charcode}, \meta{catcode}|)|
% \end{syntax}
% Constructs a character of \meta{charcode} and \meta{catcode} and returns
% the result to \TeX{}.
% \end{function}
%
+% \begin{function}{l3kernel.elapsedtime}
+% \begin{syntax}
+% |l3kernel.elapsedtime()|
+% \end{syntax}
+% Returns the time in \meta{scaled seconds} since the start of the \TeX{} run
+% or since |l3kernel.resettimer| was issued.
+% \end{function}
+%
% \begin{function}{l3kernel.filemdfivesum}
% \begin{syntax}
-% |l3kernel.filemdfivesum||(|\meta{file}|)|
+% |l3kernel.filemdfivesum(|\meta{file}|)|
% \end{syntax}
% Returns the of the MD5 sum of the file contents read as bytes; note that
% the result will depend on the nature of the line endings used in the file,
@@ -143,7 +151,7 @@
%
% \begin{function}{l3kernel.filemoddate}
% \begin{syntax}
-% |l3kernel.filemoddate||(|\meta{file}|)|
+% |l3kernel.filemoddate(|\meta{file}|)|
% \end{syntax}
% Returns the of the date/time of last modification of the \meta{file} in the
% format
@@ -158,15 +166,22 @@
%
% \begin{function}{l3kernel.filesize}
% \begin{syntax}
-% |l3kernel.filesize||(|\meta{file}|)|
+% |l3kernel.filesize(|\meta{file}|)|
% \end{syntax}
% Returns the size of the \meta{file} in bytes. If the \meta{file} is not
% found, nothing is returned with \emph{no error raised}.
% \end{function}
%
+% \begin{function}{l3kernel.resettimer}
+% \begin{syntax}
+% |l3kernel.resettimer()|
+% \end{syntax}
+% Resets the timer used by |l3kernel.elapsetime|.
+% \end{function}
+%
% \begin{function}{l3kernel.strcmp}
% \begin{syntax}
-% |l3kernel.strcmp||(|\meta{str one}, \meta{str two}|)|
+% |l3kernel.strcmp(|\meta{str one}, \meta{str two}|)|
% \end{syntax}
% Compares the two strings and returns |0| to \TeX{}
% if the two are identical.
@@ -322,6 +337,7 @@ local kpse_find = kpse.find_file
local lfs_attr = lfs.attributes
local md5_sum = md5.sum
local open = io.open
+local os_clock = os.clock
local os_date = os.date
local setcatcode = tex.setcatcode
local str_format = string.format
@@ -357,6 +373,26 @@ l3kernel.charcat = charcat
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{l3kernel.elapsedtime, l3kernel.resettimer}
+% Simple timing set up: give the result from the system clock in scaled
+% seconds.
+% \begin{macrocode}
+local base_time = 0
+local function elapsedtime()
+ local val = (os_clock() - base_time) * 65536 + 0.5
+ if val > 2147483647 then
+ val = 2147483647
+ end
+ write(format("%d",val))
+end
+l3kernel.elapsedtime = elapsedtime
+local function resettimer()
+ base_time = 0
+end
+l3kernel.resettimer = resettimer
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{l3kernel.filemdfivesum}
% Read an entire file and hash it: the hash function itself is a built-in.
% As Lua is byte-based there is no work needed here in terms of UTF-8