summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc/constants.tlu
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/scripts/texdoc/constants.tlu')
-rw-r--r--Master/texmf/scripts/texdoc/constants.tlu70
1 files changed, 37 insertions, 33 deletions
diff --git a/Master/texmf/scripts/texdoc/constants.tlu b/Master/texmf/scripts/texdoc/constants.tlu
index a8c107034cc..0a24aded4bd 100644
--- a/Master/texmf/scripts/texdoc/constants.tlu
+++ b/Master/texmf/scripts/texdoc/constants.tlu
@@ -1,36 +1,34 @@
--- Global "constants" for texdoc.
---[[
-Copyright 2008, 2009 Manuel Pégourié-Gonnard
-Distributed under the terms of the GNU GPL version 3 or later.
-See texdoc.tlu for details.
---]]
-
--- Load a private environment.
--- A name 'foo' defined here will be globally visible as 'C.foo', see EOF.
-local L = {}
-load_env(L, {
- 'setmetatable', 'arg',
-})
+-- constants.tlu: global "constants" for texdoc.
+--
+-- Manuel Pégourié-Gonnard, GPLv3, see texdoclib.tlu for details
+
+-- use an empty environment that will become texdoc_env.C (see EOF)
+local constants = {}
+local kpse = kpse
+local setfenv = setfenv
+local texdoc_env = getfenv()
+setfenv(1, constants)
+
+-- BEGIN constants
-- progname and version
-fullname = arg[0]
+fullname = kpse.find_file('texdoc/texdoclib', 'lua')
progname = 'texdoc'
-version = '0.80'
+version = '0.81'
-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
usage_msg = [[
-Usage: texdoc [OPTION]... [NAME]...
+Usage: texdoc [OPTION]... NAME...
+ or: texdoc ACTION
Try to find appropriate TeX documentation for the specified NAME(s).
-With no NAME, print information about texdoc (--help, --version, --files).
+Alternatively, perform the given ACTION and exit.
Current settings:
- -h, --help Print this help message.
- -V, --version Print the version number.
- -f, --files Print the list of configuration files used.
-
+Actions:
+Options:
-w, --view Use view mode: start a viewer. (default)
-m, --mixed Use mixed mode (view or list).
-l, --list Use list mode: show a list of results.
@@ -42,12 +40,19 @@ Current settings:
-q, --quiet Suppress warnings and most error messages.
-v, --verbose Print additional information (eg, viewer command).
- -d, --debug[=list] Print debug info for selected items (default: all).
+ -d, --debug[=list] Activate debug output (restricted to list).
Environment: PAGER, BROWSER, PDFVIEWER, PSVIEWER, DVIVIEWER.
Files: <texmf>/texdoc/texdoc.cnf, see output of the --files option.
-Homepage: http://tug.org/texdoc/
-Manual: displayed by `texdoc texdoc'.]]
+Report bugs to <texdoc@tug.org>.
+Full manual available via `texdoc texdoc'.]]
+
+copyright_msg = [[
+Copyright (C) 2008-2011 Manuel P'egouri'e-Gonnard.
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.]]
+
+actions_ph = 'Actions:\n'
usage_settings_ph = 'Current settings:' -- keep ../doc/texdoc wrapper in sync!
usage_settings = {
@@ -62,7 +67,6 @@ known_options = {
'mode',
'interact_switch',
'machine_switch',
- 'alias_switch',
'ext_list',
'basename_list',
'badext_list',
@@ -96,10 +100,6 @@ min_verbosity='0'
max_verbosity='3'
def_verbosity='2'
-exit_ok = 0
-exit_error = 1 -- apparently hard-coded in Lua
-exit_usage = 2
-
known_debugs = {
version = {},
files = {},
@@ -112,18 +112,22 @@ known_debugs = {
-- various cache or non-cache files
cache_name = 'texdoc/cache-tlpdb.lua' -- relative to TEXMFVAR
-data_meta_name = 'Data.meta.lua'
-data_tlpdb_name = 'Data.tlpdb.lua'
+data_tlpdb_name = 'texdoc/Data.tlpdb.lua'
place_holder = '%%s' -- used for viewer commands
--- Make global C a read-only proxy to the local environment.
+-- END constants
+
+-- get our previous environment back
+setfenv(1, texdoc_env)
+
+-- Make global C a read-only proxy to the local <constants>.
-- Note this is not deep read-only: C.known_debugs is read-only, but
-- C.known_debugs.version isn't, for instance.
assert(next(C) == nil,
'Internal error: table of constants should be empty at this point')
setmetatable(C, {
- __index = L,
+ __index = constants,
__newindew = function ()
error('Internal error: attempt to modify a constant.')
end