summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-07-10 00:15:07 +0000
committerKarl Berry <karl@freefriends.org>2010-07-10 00:15:07 +0000
commitf5eb2610b3c023c57ae8b6816558d4e6a3c33455 (patch)
treea975e79ce406a22451b755ef4214466af69c83d0 /Master
parent1046dadf55dc14a285c03628230c033a16a4d0f2 (diff)
lualibs update (28jun10)
git-svn-id: svn://tug.org/texlive/trunk@19328 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/lualibs/NEWS6
-rw-r--r--Master/texmf-dist/doc/luatex/lualibs/lualibs.pdfbin157457 -> 128285 bytes
-rw-r--r--Master/texmf-dist/source/luatex/lualibs/lualibs.dtx313
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs.lua177
4 files changed, 84 insertions, 412 deletions
diff --git a/Master/texmf-dist/doc/luatex/lualibs/NEWS b/Master/texmf-dist/doc/luatex/lualibs/NEWS
index ca750399fef..bbda49de97f 100644
--- a/Master/texmf-dist/doc/luatex/lualibs/NEWS
+++ b/Master/texmf-dist/doc/luatex/lualibs/NEWS
@@ -1,4 +1,10 @@
History of the lualibs package
+2010/06/28 v0.95
+ * don't use kpse.set_program_name(), people loading lualibs with texlua
+ should set it themselves, to avoid possible clashes
+ * drop deprecated functions and aliases
+ * update the documentation
+
2010/05/28 v0.94
* sync with ConTeXt beta 2010.05.20, adding new functions used
by luaotfload
diff --git a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
index 48874276651..007236c0692 100644
--- a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
+++ b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
index 23a5f1c2502..c9e7c804562 100644
--- a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
+++ b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
@@ -33,7 +33,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: lualibs 2010/05/21 v0.94 Lua additional functions.}
+\Msg{* Package: lualibs 2010/06/28 v0.95 Lua additional functions.}
\Msg{************************************************************************}
\keepsilent
@@ -90,7 +90,7 @@ and the derived file lualibs.lua.
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{lualibs.drv}
- [2010/05/21 v0.94 Lua additional functions.]
+ [2010/06/28 v0.95 Lua additional functions.]
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
@@ -120,7 +120,7 @@ and the derived file lualibs.lua.
% \GetFileInfo{lualibs.drv}
%
% \title{The \textsf{lualibs} package}
-% \date{2010/05/21 v0.94}
+% \date{2010/06/28 v0.95}
% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}}
%
% \maketitle
@@ -133,33 +133,25 @@ and the derived file lualibs.lua.
%
% \section{Overview}
%
-% Lua is a very minimal language, and it does not have a lot of built-in
-% functions. Some functions will certainly be needed by a lot of packages.
-% Instead of making each of them implement these functions, the aim of this
-% package is to provide a standard set of functions. All functions are taken
-% from Con\TeX t libraries.
+% Lua is a very minimal language, and it does not have a minimal standard
+% library. The aim of this package is to provide an extended standard library,
+% to be used by various Lua\TeX\ packages. The code is specific to Lua\TeX\
+% and depends on Lua\TeX\ functions and modules not available in regular lua.
%
-% There are some differences with the Con\TeX t funtions though, especially on
-% names: for example the \texttt{file.*} funtions are renamed in
-% \texttt{fpath.*}. It seems more logical as they deal with file paths, not
-% files. Also the \texttt{file.is\_readable} and \texttt{file.is\_writable}
-% are renamed \texttt{lfs.is\_readable} and \texttt{lfs.is\_writable}.
+% \noindent The code is derived from Con\TeX t libraries.
%
-% If you use a function you think is missing in this file, please tell the
-% maintainer.
+% \section{Usage}
%
-% \texttt{Warning:} Even if the names will certainly remain the same, some
-% implementations may differ, and some functions might appear or dissapear. As
-% Lua\TeX\ is not stable, this file is not neither.
+% You can either load the \texttt{lualibs} module, which will load all other
+% modules, provided by this package: |require("lualibs")|, or explicitly
+% load the modules you need, e.g.: |require("lualibs-table")|, please note that
+% some modules depend on others.
%
-% All functions are described in this document, but the one of the functions
-% you'll use most will certainly be \texttt{table.serialize} (also named
-% \texttt{table.tostring}) that takes a table and returns an intented string
-% describing the table. It describes the table so that Lua\TeX\ can read it
-% again as a table. You can do a lot of things with this functions, like
-% printing a table for debugging, or saving a table into a file. Functions are
-% also converted into bytecode to be saved.
+% \noindent If your code is running under \textsf{texlua}, you will need to
+% initialize \textsf{kpse} library so that |require()| can find files under
+% TEXMF tree: |kpse.set_program_name("luatex")|.
%
+% \pagebreak
% \section{\texttt{lualibs.lua}}
%
% \iffalse
@@ -169,255 +161,44 @@ and the derived file lualibs.lua.
% \begin{macrocode}
module('lualibs', package.seeall)
-do
- local lualibs_module = {
- name = "lualibs",
- version = 0.94,
- date = "2010/05/21",
- description = "Lua additional functions.",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "See ConTeXt's mreadme.pdf for the license",
- }
- if luatexbase and luatexbase.provides_module then
- luatexbase.provides_module(lualibs_module)
- end
-end
-% \end{macrocode}
-% Initialize \textsf{Kpathsea} library, so that |require()| will use it to
-% locate modules.
-% \begin{macrocode}
-
-kpse.set_program_name("luatex")
-
-% \end{macrocode}
-% We could load the modules with |require|, but this works only from version
-% 0.44, and doesn't work in Debian, so we simply use |dofile|.
-% \begin{macrocode}
-
-local function load_lualibs_module(filename)
- local path = kpse.find_file(filename)
- if not path then
- texio.write_nl(string.format("lualibs: error: cannot find file %s", filename))
- return
- end
- texio.write_nl('log', string.format("lualibs: loading file %s", path))
- --if (tex and tex.luatexversion and tex.luatexversion > 44)
- -- or (status and status.luatex_version and status.luatex_version > 44) then
- -- require(filename)
- --else
- dofile(path)
- --end
-end
-
-load_lualibs_module("lualibs-string.lua")
-load_lualibs_module("lualibs-lpeg.lua")
-load_lualibs_module("lualibs-boolean.lua")
-load_lualibs_module("lualibs-number.lua")
-load_lualibs_module("lualibs-math.lua")
-load_lualibs_module("lualibs-table.lua")
-load_lualibs_module("lualibs-aux.lua")
-load_lualibs_module("lualibs-io.lua")
-load_lualibs_module("lualibs-os.lua")
-load_lualibs_module("lualibs-file.lua")
-load_lualibs_module("lualibs-md5.lua")
-load_lualibs_module("lualibs-dir.lua")
-load_lualibs_module("lualibs-unicode.lua")
-load_lualibs_module("lualibs-utils.lua")
-load_lualibs_module("lualibs-dimen.lua")
-load_lualibs_module("lualibs-url.lua")
-load_lualibs_module("lualibs-set.lua")
-load_lualibs_module("lualibs-dimen.lua")
-
-% \end{macrocode}
-% Aliases for backward compatibility.
-% \begin{macrocode}
-
-fpath = file
-fpath.split = file.split_path
-lfs.is_readable = file.is_readable
-lfs.is_writable = file.is_writable
-
-% \end{macrocode}
-% Functions no longer provided by Con\TeX t module.
-%
-% \begin{macro}{string:stripspaces}
-%
-% A function to strip the spaces at the beginning and at the end of a
-% string.
-%
-% \begin{macrocode}
-
-function string:stripspaces()
- return (self:gsub("^%s*(.-)%s*$", "%1"))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{lpeg.space and lpeg.newline}
-%
-% Two small helpers for \texttt{lpeg}, that will certainly be widely used:
-% spaces and newlines.
-%
-% \begin{macrocode}
-
-lpeg.space = lpeg.S(" \t\f\v")
-lpeg.newline = lpeg.P("\r\n") + lpeg.P("\r") +lpeg.P("\n")
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.contains value}
-%
-% A function returning true if the value \texttt{val} is in the table
-% \texttt{t}.
-%
-% \begin{macrocode}
-
-function table.contains_value(t, val)
- if t then
- for k, v in pairs(t) do
- if v==val then
- return true
- end
- end
- end
- return false
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.contains key}
-%
-% A function returning true if the key \texttt{key} is in the table
-% \texttt{t}
-%
-% \begin{macrocode}
-
-function table.contains_key(t, key)
- if t then
- for k, v in pairs(t) do
- if k==key then
- return true
- end
- end
- end
- return false
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.value position}
-%
-% A function returning the position of a value in a table. This will be
-% important to be able to remove a value.
-%
-% \begin{macrocode}
-
-function table.value_position(t, val)
- if t then
- local i=1
- for k, v in pairs(t) do
- if v==val then
- return i
- end
- i=i+1
- end
- end
- return 0
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.key position}
-%
-% A function returning the position of a key in a table.
-%
-% \begin{macrocode}
-
-function table.key_position(t, key)
- if t then
- local i=1
- for k,v in pairs(t) do
- if k==key then
- return i
- end
- i = i+1
- end
- end
- return -1
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.remove key}
-%
-% Removing a key from a table.
-%
-% \begin{macrocode}
-
-function table.remove_key(t, k)
- local p = table.key_position(t,k)
- if p ~= -1 then
- table.remove(t, table.key_position(t,k))
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.normalize sep}
-%
-% A function to change directory separators to canonical ones (\texttt{/}).
-%
-% \begin{macrocode}
-
-function fpath.normalize_sep(str)
- return str:gsub("\\", "/")
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.localize sep}
-%
-% A function changing directory separators into local ones (\texttt{/} on
-% Unix, |\| on Windows).
-%
-% \begin{macrocode}
+local lualibs_module = {
+ name = "lualibs",
+ version = 0.95,
+ date = "2010/06/28",
+ description = "Lua additional functions.",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "See ConTeXt's mreadme.pdf for the license",
+}
-function fpath.localize_sep(str)
- if os.type == 'windows' or os.type == 'msdos' then
- return str:gsub("/", "\\")
- else
- return str:gsub("\\", "/")
- end
+if luatexbase and luatexbase.provides_module then
+ luatexbase.provides_module(lualibs_module)
end
-
% \end{macrocode}
%
-% \end{macro}
-% \begin{macro}{table.starts at}
-%
-% No idea what it was used for, but Hans depricated it with the comment
-% \textit{obsolete, not nice anyway}, just restore it here until we have a
-% process to deprecate unused functions like this.
+% Load the modules.
%
% \begin{macrocode}
-
-function table.starts_at(t)
- return ipairs(t,1)(t,0)
-end
-
+require("lualibs-string")
+require("lualibs-lpeg")
+require("lualibs-boolean")
+require("lualibs-number")
+require("lualibs-math")
+require("lualibs-table")
+require("lualibs-aux")
+require("lualibs-io")
+require("lualibs-os")
+require("lualibs-file")
+require("lualibs-md5")
+require("lualibs-dir")
+require("lualibs-unicode")
+require("lualibs-utils")
+require("lualibs-dimen")
+require("lualibs-url")
+require("lualibs-set")
+require("lualibs-dimen")
% \end{macrocode}
%
-% \end{macro}
-%
% \iffalse
%</lua>
% \fi
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
index a9df528d668..15915bc7a1d 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
@@ -16,151 +16,36 @@
--
module('lualibs', package.seeall)
-do
- local lualibs_module = {
- name = "lualibs",
- version = 0.94,
- date = "2010/05/21",
- description = "Lua additional functions.",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "See ConTeXt's mreadme.pdf for the license",
- }
- if luatexbase and luatexbase.provides_module then
- luatexbase.provides_module(lualibs_module)
- end
-end
-
-kpse.set_program_name("luatex")
-
-
-local function load_lualibs_module(filename)
- local path = kpse.find_file(filename)
- if not path then
- texio.write_nl(string.format("lualibs: error: cannot find file %s", filename))
- return
- end
- texio.write_nl('log', string.format("lualibs: loading file %s", path))
- --if (tex and tex.luatexversion and tex.luatexversion > 44)
- -- or (status and status.luatex_version and status.luatex_version > 44) then
- -- require(filename)
- --else
- dofile(path)
- --end
-end
-
-load_lualibs_module("lualibs-string.lua")
-load_lualibs_module("lualibs-lpeg.lua")
-load_lualibs_module("lualibs-boolean.lua")
-load_lualibs_module("lualibs-number.lua")
-load_lualibs_module("lualibs-math.lua")
-load_lualibs_module("lualibs-table.lua")
-load_lualibs_module("lualibs-aux.lua")
-load_lualibs_module("lualibs-io.lua")
-load_lualibs_module("lualibs-os.lua")
-load_lualibs_module("lualibs-file.lua")
-load_lualibs_module("lualibs-md5.lua")
-load_lualibs_module("lualibs-dir.lua")
-load_lualibs_module("lualibs-unicode.lua")
-load_lualibs_module("lualibs-utils.lua")
-load_lualibs_module("lualibs-dimen.lua")
-load_lualibs_module("lualibs-url.lua")
-load_lualibs_module("lualibs-set.lua")
-load_lualibs_module("lualibs-dimen.lua")
-
-
-fpath = file
-fpath.split = file.split_path
-lfs.is_readable = file.is_readable
-lfs.is_writable = file.is_writable
-
-
-function string:stripspaces()
- return (self:gsub("^%s*(.-)%s*$", "%1"))
-end
-
-
-lpeg.space = lpeg.S(" \t\f\v")
-lpeg.newline = lpeg.P("\r\n") + lpeg.P("\r") +lpeg.P("\n")
-
-
-function table.contains_value(t, val)
- if t then
- for k, v in pairs(t) do
- if v==val then
- return true
- end
- end
- end
- return false
-end
-
-
-function table.contains_key(t, key)
- if t then
- for k, v in pairs(t) do
- if k==key then
- return true
- end
- end
- end
- return false
-end
-
-
-function table.value_position(t, val)
- if t then
- local i=1
- for k, v in pairs(t) do
- if v==val then
- return i
- end
- i=i+1
- end
- end
- return 0
-end
-
-
-function table.key_position(t, key)
- if t then
- local i=1
- for k,v in pairs(t) do
- if k==key then
- return i
- end
- i = i+1
- end
- end
- return -1
-end
-
-
-function table.remove_key(t, k)
- local p = table.key_position(t,k)
- if p ~= -1 then
- table.remove(t, table.key_position(t,k))
- end
-end
-
-
-function fpath.normalize_sep(str)
- return str:gsub("\\", "/")
-end
-
-
-function fpath.localize_sep(str)
- if os.type == 'windows' or os.type == 'msdos' then
- return str:gsub("/", "\\")
- else
- return str:gsub("\\", "/")
- end
-end
-
-
-function table.starts_at(t)
- return ipairs(t,1)(t,0)
-end
-
+local lualibs_module = {
+ name = "lualibs",
+ version = 0.95,
+ date = "2010/06/28",
+ description = "Lua additional functions.",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "See ConTeXt's mreadme.pdf for the license",
+}
+
+if luatexbase and luatexbase.provides_module then
+ luatexbase.provides_module(lualibs_module)
+end
+require("lualibs-string")
+require("lualibs-lpeg")
+require("lualibs-boolean")
+require("lualibs-number")
+require("lualibs-math")
+require("lualibs-table")
+require("lualibs-aux")
+require("lualibs-io")
+require("lualibs-os")
+require("lualibs-file")
+require("lualibs-md5")
+require("lualibs-dir")
+require("lualibs-unicode")
+require("lualibs-utils")
+require("lualibs-dimen")
+require("lualibs-url")
+require("lualibs-set")
+require("lualibs-dimen")
--
-- End of File `lualibs.lua'.