diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-07 00:05:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-07 00:05:31 +0000 |
commit | 2158de31131a763ee431c227b7c626795f296a23 (patch) | |
tree | 893ab979701d3eeb27c941554a9dd96c462e7946 | |
parent | 774025cbedaa9c8ae614a5b84ff567051ada84a8 (diff) |
install authorindex as script
git-svn-id: svn://tug.org/texlive/trunk@18790 c570f23f-e606-0410-a88d-b1316a301751
26 files changed, 1196 insertions, 28 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index a5a8675fad4..84c7eae8b36 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -28,6 +28,7 @@ nobase_dist_script_SCRIPTS = \ accfonts/mkt1font \ accfonts/vpl2ovp \ accfonts/vpl2vpl \ + authorindex/authorindex \ bengali/ebong.py \ bibexport/bibexport.sh \ bundledoc/arlatex \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index da23cb75ad4..e3afcbaa939 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -177,6 +177,7 @@ nobase_dist_script_SCRIPTS = \ accfonts/mkt1font \ accfonts/vpl2ovp \ accfonts/vpl2vpl \ + authorindex/authorindex \ bengali/ebong.py \ bibexport/bibexport.sh \ bundledoc/arlatex \ diff --git a/Master/texmf-dist/doc/latex/authorindex/authorindex b/Build/source/texk/texlive/linked_scripts/authorindex/authorindex index 6c154a080e9..6c154a080e9 100644 --- a/Master/texmf-dist/doc/latex/authorindex/authorindex +++ b/Build/source/texk/texlive/linked_scripts/authorindex/authorindex diff --git a/Master/bin/alpha-linux/authorindex b/Master/bin/alpha-linux/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/alpha-linux/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/authorindex b/Master/bin/amd64-freebsd/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/amd64-freebsd/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/authorindex b/Master/bin/amd64-kfreebsd/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/amd64-kfreebsd/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/authorindex b/Master/bin/i386-cygwin/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-cygwin/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/authorindex b/Master/bin/i386-freebsd/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-freebsd/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/authorindex b/Master/bin/i386-kfreebsd/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-kfreebsd/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-linux/authorindex b/Master/bin/i386-linux/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-linux/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/authorindex b/Master/bin/i386-netbsd/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-netbsd/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/i386-solaris/authorindex b/Master/bin/i386-solaris/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/i386-solaris/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/mips-irix/authorindex b/Master/bin/mips-irix/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/mips-irix/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/powerpc-aix/authorindex b/Master/bin/powerpc-aix/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/powerpc-aix/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/authorindex b/Master/bin/powerpc-linux/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/powerpc-linux/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/sparc-linux/authorindex b/Master/bin/sparc-linux/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/sparc-linux/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/authorindex b/Master/bin/sparc-solaris/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/sparc-solaris/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/universal-darwin/authorindex b/Master/bin/universal-darwin/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/universal-darwin/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/win32/authorindex.exe b/Master/bin/win32/authorindex.exe new file mode 100755 index 00000000000..890ec97f3fb --- /dev/null +++ b/Master/bin/win32/authorindex.exe @@ -0,0 +1,572 @@ +
+-- $Id: runscript.tlu 18711 2010-06-04 00:03:13Z trzeciak $
+
+local svnrevision = string.match("$Revision: 18711 $", "%d+") or "0"
+local svndate = string.match("$Date: 2010-06-04 02:03:13 +0200 (Fri, 04 Jun 2010) $", "[-%d]+") or "2009-12-04"
+local bannerstr = "runscript wrapper utility (rev. " ..
+ svnrevision .. ", " .. svndate .. ")\n" ..
+ "usage: runscript script-name [arguments]\n" ..
+ "try -help [-v] for more information"
+
+local helpstr = [[
+
+ Script wrappers in TeX Live on Windows
+
+ Rationale
+
+ Wrappers enable use of scripts on Windows as regular programs.
+ They are also required for some binary programs to set up the
+ right environment for them.
+
+ Batch scripts can be used for wrapping but they are not as universal
+ as binaries (there are some odd cases where they don't work) and
+ it is hard to make them robust and secure. Compiled binary wrappers
+ don't suffer from these problems but they are harder to write, debug
+ and maintain in comparison to scripts. For these reasons a hybrid
+ approach is taken that combines a binary stub with a launcher script.
+
+ Adding wrappers for user scripts
+
+ The script wrapping machinery is not limited to scripts shipped with
+ TeX Live. You can also use it for script programs from manually
+ installed packages, which should minimize the problems when using
+ them with TeX Live.
+
+ First, make sure that there is an interpreter program available on
+ your system for the script you want to use. Interpreters for Perl
+ and Lua are bundled with TeX Live, all others have to be installed
+ independently. Lua scripts are the most efficient to run, so if you
+ consider writing a new script, that would be the recommended choice.
+
+ The following script types and their file extensions are currently
+ supported and searched in that order:
+
+ Lua (.tlu;.texlua;.lua) -- included
+ Perl (.pl) -- included
+ Ruby (.rb) -- requires installation
+ Python (.py) -- requires installation
+ Tcl (.tcl) -- requires installation
+ Java (.jar) -- requires installation
+ VBScript (.vbs) -- part of Windows
+ JScript (.js) -- part of Windows
+ Batch (.bat;.cmd) -- part of Windows
+
+ Finally, Unix-style extensionless scripts are searched as last and
+ the interpreter program is established based on the she-bang (#!)
+ specification on the very first line of the script. This can be
+ an arbitrary program but it must be present on the search path.
+
+ Next, the script program needs to be installed somewhere below the
+ 'scripts' directory under one of the TEXMF trees (consult the
+ documentation or texmf/web2c/texmf.cnf file for a list). You may
+ need to update the file search database afterwards with:
+
+ mktexlsr [TEXMFDIR]
+
+ It is also possible to use scripts that are outside of TEXMF hierarchy
+ by adjusting TEXMFSCRIPTS environment or kpathsea variable, see
+ kpathsea documentation for more information on setting its variables.
+
+ Test if the script can be located with:
+
+ kpsewhich --format=texmfscripts <script-name>.<ext>
+
+ This should output the full path to the script if everything is
+ properly installed and configured. If this test is successful,
+ the script can be run immediately with:
+
+ runscript <script-name> [script arguments]
+
+ If you prefer to call the script program simply by its name, copy
+ and rename bin/win32/runscript.exe to <script-name>.exe and put it
+ in bin/win32/ directory of your TeX Live installation or, if you
+ don't have the write permissions there, somewhere else on the search
+ path.]]
+
+local docstr = [[
+
+ Wrapper structure
+
+ Wrappers consist of small binary stubs and a common texlua script.
+ The binary stubs are all the same, just different names (but CLI
+ and GUI stubs differ, see below, and GUI stubs are actually all
+ different due to different embedded icons).
+
+ The job of the binary stub is twofold: (a) call the texlua launcher
+ script 'runscript.tlu' from the same directory (or more precisely
+ from the directory containing 'runscript.dll') and (b) pass to it
+ argv[0] and the unparsed argument string as the last two arguments
+ (after adding a sentinel argument, which ends with a new line
+ character). Arbitrary C strings can be passed, because the script
+ is executed by linking with luatex.dll and calling the lua
+ interpreter internally rather than by spawning a new process.
+
+ There are two flavours of the binary stub: one for CLI programs
+ and another one for GUI programs. The GUI variant does not open
+ a console window nor does it block the command prompt if started
+ from there. It also uses a dialog box to display an error message
+ in addition to outputting to stderr.
+
+ The stubs are further split into a common DLL and EXE proxies
+ to it. This is for maintenance reasons - updates can be done by
+ replacement of a single DLL rather than all binary stubs.
+
+ The launcher script knows, which variant has been used to invoke it
+ based on the sentinel argument. The lack of this argument means
+ that it was invoked in a standard way, i.e. through texlua.exe.
+
+ All the hard work of locating a script/program to execute happens
+ in the launcher script. The located script/program is always
+ executed directly by spawning its interpreter (or binary) in a new
+ process. The system shell (cmd.exe) is never called (except for
+ batch scripts, of course). If the located script happens to be
+ a (tex)lua script, it is loaded and called internally from within
+ this script, i.e. no new process is spawned. Execution is done
+ using a protected call, so any compile or runtime errors are catched.
+
+ Source files
+
+ runscript.tlu launcher script for locating and dispatching
+ target scripts/programs
+ runscript_dll.c common DLL part of the binary stubs; locates and
+ calls the launcher script
+ runscript_exe.c EXE proxy to the common DLL for CLI mode stubs
+ wrunscript_exe.c EXE proxy to the common DLL for GUI mode stubs
+
+ Compilation of binaries (requires luatex.dll in the same directory)
+
+ with gcc (size optimized):
+
+ gcc -Os -s -shared -o runscript.dll runscript_dll.c -L./ -lluatex
+ gcc -Os -s -o runscript.exe runscript_exe.c -L./ -lrunscript
+ gcc -mwindows -Os -s -o wrunscript.exe wrunscript_exe.c -L./ -lrunscript
+
+ with tcc (extra small size):
+
+ tiny_impdef luatex.dll
+ tcc -shared -o runscript.dll runscript_dll.c luatex.def
+ tcc -o runscript.exe runscript_exe.c runscript.def
+ tcc -o wrunscript.exe wrunscript_exe.c runscript.def
+
+ License
+
+ Originally written in 2009 by Tomasz M. Trzeciak, Public Domain.
+
+ Prior work:
+ 'tl-w32-wrapper.texlua' by Reinhard Kotucha and Norbert Preining.
+ 'tl-w32-wrapper.cmd' by Tomasz M. Trzeciak.
+
+ Changelog
+
+ 2009/12/04
+ - initial version
+ 2009/12/15
+ - minor fixes for path & extension list parsing
+ 2010/01/09
+ - added support for GUI mode stubs
+ 2010/02/28
+ - enable GUI mode stubs for dviout, psv and texworks;
+ - added generic handling of sys programs
+ - added restricted repstopdf to alias_table
+ 2010/03/13
+ - added 'readme.txt' and changelog
+ - added support and docs for calling user added scripts;
+ (use path of 'runscript.dll' instead of .exe stub to
+ locate 'runscript.tlu' script)
+ - limit search for shell_escape_commands to system trees
+ - added function for creating directory hierarchy
+ - fixed directory creation for dviout & texworks aliases
+ - fixed arg[0] of repstopdf & rpdfcrop
+ 2010/03/28
+ - restructured docs, added --help and --version options
+ (available only when invoked under 'runscript' name)
+ - use TEXMF_RESTRICTED_SCRIPTS kpse var for searching
+ shell_escape_commands
+ - changed command validation to handle a list of commands
+ - prepend GUI mode command(s) to the command list
+ - added support for .tcl scripts
+ 2010/03/31
+ - fixed fatal bug in extention_map definition for GUI mode
+ 2010/04/15
+ - encapsulated main chunk in a function to execute with
+ pcall for more robustness and better error catching
+ - added texdoctk to scripts4tlperl table
+ - added tlgs and tlperl to alias_table; callable as e.g.:
+ runscript tlperl ...
+ - doc tweaks
+ 2010/04/22
+ - ensure only backslash is used in USERPROFILE variable
+ (Adobe Reader crash case)
+ - fixed argument processing for direct execution under texlua
+ - more doc tweaks
+ 2010/05/30
+ - Windows XP or newer required to run TeXworks
+ 2010/06/04
+ - added support for Perl scripts starting with eval-exec-perl
+ construct in place of she-bang (#!)
+]]
+
+-- HELPER SUBROUTINES --
+
+-- quotes string with spaces
+local function _q(str)
+ str = string.gsub(str, '"', '') -- disallow embedded double quotes
+ return string.find(str, "%s") and '"'..str..'"' or str
+end
+
+-- checks if path is absolute (but not if it actually exists)
+local function is_abs_path(fpath)
+ return string.find(fpath, '^[a-zA-Z]:[/\\]') and true or false
+end
+
+-- prepends directories to path if they are not already there
+local function prepend_path(path, ...)
+ local pathcmp = string.lower(string.gsub(path, '/', '\\'))..';'
+ for k = 1, select('#', ...) do
+ local dir = string.lower(string.gsub(select(k, ...), '/', '\\'))..';'
+ if not string.find(pathcmp, dir, 1, true) then path = dir..path end
+ end
+ return path
+end
+
+-- searches the PATH for a file
+local function search_path(fname, PATH, PATHEXT)
+ if string.find(fname, '[/\\]') then
+ return nil, "directory part not allowed for PATH search: "..fname
+ end
+ PATH = PATH or os.getenv('PATH')
+ PATHEXT = PATHEXT or '\0' -- '\0' for no extension
+ for dir in string.gmatch(PATH, '[^;]+') do
+ local dirsep = (string.find(dir, '\\') and '\\' or '/')
+ for ext in string.gmatch(PATHEXT, '[^;]+') do
+ local f = dir..dirsep..fname..ext
+ if lfs.isfile(f) then return f, ext end
+ end
+ end
+ return nil, "file or program not on PATH: "..fname
+end
+
+-- locates texmfscript to execute
+local function find_texmfscript(progname, ext_list)
+ for ext in string.gmatch(ext_list, '[^;]+') do
+ local progfullname = kpse.find_file(progname..ext, 'texmfscripts')
+ if progfullname then return progfullname, ext end
+ end
+ return nil, "no appropriate script or program found: "..progname
+end
+
+-- converts the #! line to arg table
+-- used for scripts w/o extension
+-- only the two most common cases are considered:
+-- #! /path/to/command [options]
+-- #! /usr/bin/env command [options]
+-- ([options] after the command are retained as well)
+local function shebang_to_argv(progfullname)
+ local fid, errmsg = io.open(progfullname, 'r')
+ if not fid then return nil, errmsg end
+ local fstln = fid:read('*line')
+ fid:close()
+ if string.find(fstln, "eval.*exit.*exec.*perl") then
+ -- special case of Perl's time-honoured "totally devious construct":
+ -- eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ return {"perl"}
+ elseif (string.sub(fstln, 1, 2) ~= '#!') then
+ return nil, "don't know how to execute script: "..progfullname
+ end
+ local argv = string.explode( string.sub(fstln, 3) ) -- split on spaces
+ argv[1] = string.match(argv[1], '[^/]+$')
+ if (argv[1] == 'env') then table.remove(argv, 1) end
+ return argv
+end
+
+-- checks if command exists on the path and returns its full path
+local function check_command(cmdlist, PATH)
+ for cmd in string.gmatch(cmdlist, '%S+') do
+ local cmdext = cmd..(string.find(cmd, '%.[^\\/.]*$') and '' or '.exe')
+ local fullcmd = is_abs_path(cmdext) and lfs.isfile(cmdext) and
+ cmdext or search_path(cmdext, PATH)
+ if fullcmd then
+ return fullcmd, cmd
+ end
+ end
+ return nil, 'program not found (not part of TeX Live): '..cmdlist
+end
+
+-- creates directory or directory hierarchy
+local function mkdir_plus(dir)
+ if lfs.mkdir(dir) then
+ return true
+ end
+ -- try with system's mkdir in case we need to create intermediate dirs too
+ local ret = os.spawn({[0]=search_path("cmd.exe"),
+ string.format('cmd.exe /x /c mkdir "%s"', dir)})
+ if ret == 0 then
+ return true
+ else
+ return nil, "cannot create directory: " .. dir
+ end
+end
+
+-- MAIN_CHUNK -- encapsulated in a function for more robust execution with pcall
+
+local function MAIN_CHUNK()
+
+local guimode = false
+local argline = ''
+-- check for the sentinel argment coming from the .exe stub
+if arg[#arg-2] and ( string.sub(arg[#arg-2], -1) == '\n' ) then
+ -- argv[0] and unparsed argument line are passed
+ -- from the .exe stub as the two last arguments
+ -- pop them up from the arg table
+ argline = table.remove(arg) -- pop unparsed arguments
+ arg[0] = table.remove(arg) -- pop C stub's argv[0]
+ guimode = (table.remove(arg) == 'GUI_MODE\n') -- pop sentinel argument
+else
+ -- we must be called as: texlua runscript.tlu progname ...
+ -- this is treated the same as: runscript[.exe] progname ...
+ -- we don't have the unparsed arument line in this case, so construct one
+ for k = #arg, 1, -1 do argline = _q(arg[k]) .. ' ' .. argline end
+end
+
+-- special behaviour when called under 'runscript' name
+
+-- ( lower arg[0] : get file name part : remove extension ) == 'runscript'
+if (string.lower(arg[0]):match('[^\\/]+$'):gsub('%.[^.]*$', '') == 'runscript') then
+ -- we are called as: runscript progname ...
+ -- or as: runscript --help|-h|--version ...
+ -- handle options first (only --help and --version)
+ local opt = { h = false, help = false, v = false, version = false }
+ local param, k
+ while true do
+ -- remove the first argument from the arg table and from the argline string
+ -- (this argument should have no embedded spaces!)
+ param = table.remove(arg, 1)
+ if not param then break end
+ argline = string.gsub(argline, '^%S+%s*', '')
+ param, k = string.lower(param):gsub('^%-%-?', '')
+ -- if an option was given
+ if (k > 0) then
+ if opt[param] == nil then
+ error("unknown option: "..param.."\n"..bannerstr)
+ end
+ opt[param] = true
+ else
+ break
+ end
+ end
+ if opt.help or opt.h then
+ print(helpstr)
+ if opt.v then print(docstr) end
+ os.exit(0)
+ elseif opt.version or opt.v then
+ print(bannerstr)
+ os.exit(0)
+ end
+ -- make sure we a new arg[0] is given and proceed
+ arg[0] = assert(param, "not enough arguments!\n"..bannerstr)
+end
+
+-- kpse and environment set-up
+
+-- program name
+local progname, k = string.lower(arg[0]):match('[^\\/]+$'):gsub('%.[^.]*$', ''):gsub('%-sys$', '')
+local sysprog = (k > 0) -- sys type program/script (there was -sys suffix removed)
+if (progname == 'runscript') then -- prevent recursive calls to this script
+ error("oops! wrapping the wrapper?")
+end
+-- init kpathsea
+local k = -1
+while arg[k-1] do k = k - 1 end -- in case of a call: luatex --luaonly ...
+local lua_binary = arg[k]
+kpse.set_program_name(lua_binary, progname)
+-- various dir-vars
+local TEXDIR = kpse.var_value('SELFAUTOPARENT')
+print('TEXDIR', TEXDIR)
+local BINDIR = kpse.var_value('SELFAUTOLOC')
+local PATH = os.getenv('PATH') or ''
+-- perl stuff
+local scripts4tlperl = {
+ texdoctk = true,
+ updmap = true,
+ ['updmap-sys'] = true,
+}
+local PERLEXE = search_path('perl.exe', PATH)
+if not PERLEXE or guimode or scripts4tlperl[progname] then
+ PERLEXE = TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
+ os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib')--[[
+ local PERL5SHELL = os.getenv('COMSPEC')
+ PERL5SHELL = string.gsub(PERL5SHELL, '\\', '\\\\')
+ PERL5SHELL = string.gsub(PERL5SHELL, ' ', '\\ ')
+ os.setenv('PERL5SHELL', PERL5SHELL..' /x /c')--]]
+ PATH = prepend_path(PATH, TEXDIR..'/tlpkg/tlperl/bin')
+end
+-- gs stuff
+os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib;'..TEXDIR..'/tlpkg/tlgs/fonts')
+os.setenv('GS_DLL', TEXDIR..'/tlpkg/tlgs/bin/gsdll32.dll')
+-- path
+PATH = prepend_path(PATH, TEXDIR..'/tlpkg/tlgs/bin', BINDIR)
+os.setenv('PATH', PATH);
+-- sys stuff
+if sysprog then
+ os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
+ os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
+end
+-- restricted programs
+local shell_escape_commands = string.lower(kpse.var_value('shell_escape_commands'))
+if string.find(','..shell_escape_commands..',', ','..progname..',', 1, true) then
+ -- limit search path to the restricted (system) trees
+ -- (not really necessary for entries in the alias_table,
+ -- because they are not searched for with kpathsea)
+ os.setenv('TEXMFSCRIPTS', kpse.var_value('TEXMF_RESTRICTED_SCRIPTS'))
+end
+-- Adobe Reader crash case: make sure USERPROFILE is not "slashed"
+os.setenv("USERPROFILE", os.getenv("USERPROFILE"):gsub('/', '\\'))
+
+-- alias table (programs with special needs)
+
+local alias_table = {--[[
+ ['fmtutil-sys'] = {[0]=BINDIR..'/fmtutil.exe', 'fmtutil-sys', argline},
+ ['updmap-sys'] = {[0]=PERLEXE, 'perl',
+ _q(TEXDIR..'/texmf/scripts/tetex/updmap.pl'), argline},--]]
+ asy =
+ function ()
+ -- TODO: check if ASYMPTOTE_GS requires quoting of names with spaces
+ --os.setenv('ASYMPTOTE_GS', _q(TEXDIR..'/tlpkg/tlgs/bin/gswin32c.exe'))
+ os.setenv('ASYMPTOTE_GS', 'gswin32c.exe')
+ os.setenv('CYGWIN', 'nodosfilewarning')
+ return {[0]=TEXDIR..'/tlpkg/asymptote/asy.exe', 'asy', argline}
+ end,
+ --dvigif = {[0]=BINDIR..'/dvipng.exe', 'dvigif', argline},
+ dviout =
+ function ()
+ local fontsdir = kpse.var_value('TEXMFVAR') .. '/fonts'
+ if (lfs.attributes(fontsdir, 'mode') ~= 'directory') then
+ assert(mkdir_plus(fontsdir))
+ end
+ local tfmpath = kpse.show_path('tfm')
+ tfmpath = string.gsub(tfmpath, '!!', '')
+ tfmpath = string.gsub(tfmpath, '/', '\\')
+ local texrt = {}
+ for d in string.gmatch(tfmpath, '([^;]+\\fonts)\\tfm[^;]*') do
+ if (lfs.attributes(d, 'mode') == 'directory') then
+ table.insert(texrt, d)
+ end
+ end
+ local dvioutpar = [[-NULL -dpi=600 "-gen=']] .. string.gsub(TEXDIR, '/', '\\') .. [[\tlpkg\dviout\gen_pk'" ]] ..
+ [["-TEXPK=^r\pk\\^s.^dpk;^r\tfm\\^s^tfm;^r\vf\\^s.vf;^r\ovf\\^s.ovf;^r\tfm\\^s.tfm" "-TEXROOT=']] ..
+ table.concat(texrt, ';') .. [['"]]
+ return {[0]=TEXDIR..'/tlpkg/dviout/dviout.exe', 'dviout', dvioutpar, argline}
+ end,
+ psv = {[0]=TEXDIR..'/tlpkg/tlpsv/gswxlua.exe', 'gswxlua',
+ '-l', _q(TEXDIR..'/tlpkg/tlpsv/psv.wx.lua'),
+ '-p', _q(TEXDIR..'/tlpkg/tlpsv/psv_view.ps'), '-sINPUT='..argline},
+ repstopdf = {[0]=PERLEXE, 'perl',
+ _q(TEXDIR..'/texmf-dist/scripts/epstopdf/epstopdf.pl'),
+ '--restricted', argline},
+ rpdfcrop = {[0]=PERLEXE, 'perl',
+ _q(TEXDIR..'/texmf-dist/scripts/pdfcrop/pdfcrop.pl'),
+ '--restricted', argline},
+ sam2p = {[0]=TEXDIR..'/tlpkg/sam2p/sam2p.exe', 'sam2p', argline},
+ texworks =
+ function ()
+ local winver = tonumber(string.match(os.uname().version, '%D*(%d+\.?%d*)'))
+ assert(winver >= 5.01, "Windows XP or newer required to run TeXworks")
+ local TW_LIBPATH = kpse.var_value('TW_LIBPATH') or
+ kpse.var_value('TEXMFCONFIG')..'/texworks'
+ local TW_INIPATH = kpse.var_value('TW_INIPATH') or TW_LIBPATH
+ os.setenv('TW_LIBPATH', TW_LIBPATH)
+ os.setenv('TW_INIPATH', TW_INIPATH)
+ if (TW_INIPATH and lfs.attributes(TW_INIPATH, 'mode') ~= 'directory') then
+ assert(mkdir_plus(TW_INIPATH))
+ end
+ return {[0]=TEXDIR..'/tlpkg/texworks/texworks.exe', 'texworks', argline}
+ end,
+ tlgs = {[0]=TEXDIR..'/tlpkg/tlgs/bin/gswin32c.exe', 'gswin32c', argline},
+ tlperl = {[0]=PERLEXE, 'perl', argline},
+}
+
+-- extension to interpeter mapping
+
+-- the extension is mapped to argv table
+-- the command to execute is given as the first element of the table
+-- (it can be a whitespace separated list of names to try)
+local extension_map = {
+ ['.bat'] = {'cmd', '/c', 'call'},
+ ['.jar'] = {'java.exe', '-jar'},
+ ['.pl' ] = {'perl.exe'},
+ ['.py' ] = {'python.exe'},
+ ['.rb' ] = {'ruby.exe'},
+ ['.tcl'] = {'tclsh.exe tclsh85.exe tclsh84.exe'},
+ ['.vbs'] = {'cscript.exe', '-nologo'},
+}
+if guimode then
+ -- for GUI mode wrappers we try GUI mode interpeters where possible
+ extension_map['.jar'][1] = 'javaw.exe ' .. extension_map['.jar'][1]
+ extension_map['.pl' ][1] = 'wperl.exe ' .. extension_map['.pl' ][1]
+ extension_map['.py' ][1] = 'pythonw.exe ' .. extension_map['.py' ][1]
+ extension_map['.py' ][1] = 'rubyw.exe ' .. extension_map['.py' ][1]
+ extension_map['.tcl'][1] = 'wish.exe wish85.exe wish84.exe ' .. extension_map['.tcl'][1]
+ extension_map['.vbs'][1] = 'wscript.exe ' .. extension_map['.vbs'][1]
+end
+extension_map['.cmd'] = extension_map['.bat']
+extension_map['.js'] = extension_map['.vbs']
+
+-- set up argv table
+
+local program = alias_table[progname]
+if program then -- special case (alias)
+ if (type(program) == 'function') then
+ program = program()
+ end
+else -- general case (no alias)
+ local progfullname, ext = search_path(progname, BINDIR, ".tlu;.bat;.cmd")
+ if not progfullname then
+ progfullname, ext = assert(find_texmfscript(progname,
+ ".tlu;.texlua;.lua;.pl;.rb;.py;.tcl;.jar;.vbs;.js;.bat;.cmd;\0"))
+ end
+ if (ext == '.lua') or (ext == '.tlu') or (ext == '.texlua') then
+ -- lua script
+ arg[0] = progfullname
+ program = progfullname
+ else
+ program = extension_map[ext] or assert(shebang_to_argv(progfullname))
+ table.insert(program, _q(progfullname))
+ table.insert(program, argline)
+ if not program[0] then
+ program[0], program[1] = assert(check_command(program[1], PATH))
+ end
+ end
+end
+
+-- run the program/script
+
+if (type(program) == 'table') then
+ local ret = assert(os.spawn(program))
+ if ret ~= 0 then
+ local dbginfo = debug.getinfo(1) + local errormsg = string.format("%s:%d: command failed with exit code %d:\n%s",
+ dbginfo.short_src, dbginfo.currentline - 2, ret, table.concat(program, ' ') )
+ os.setenv('RUNSCRIPT_ERROR_MESSAGE', errormsg) + io.stderr:write(errormsg, '\n') + end
+ os.exit(ret)
+elseif (type(program) == 'string') then
+ dofile(program)
+else
+ error("unexpected argument type: " .. type(program))
+end
+
+end -- MAIN_CHUNK
+
+-- execute MAIN_CHUNK with pcall to catch any runtime errors
+
+local success, errormsg = pcall(MAIN_CHUNK)
+if not success then
+ os.setenv('RUNSCRIPT_ERROR_MESSAGE', errormsg)
+ error(errormsg)
+end
+
+-- about RUNSCRIPT_ERROR_MESSAGE environment variable:
+-- it stores an error message that is catched and displayed
+-- in a message box on the C side at process exit
+-- (currently used only by gui mode stubs)
diff --git a/Master/bin/x86_64-darwin/authorindex b/Master/bin/x86_64-darwin/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/x86_64-darwin/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/authorindex b/Master/bin/x86_64-linux/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/x86_64-linux/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/authorindex b/Master/bin/x86_64-solaris/authorindex new file mode 120000 index 00000000000..5de9c49daa9 --- /dev/null +++ b/Master/bin/x86_64-solaris/authorindex @@ -0,0 +1 @@ +../../texmf-dist/scripts/authorindex/authorindex
\ No newline at end of file diff --git a/Master/texmf-dist/scripts/authorindex/authorindex b/Master/texmf-dist/scripts/authorindex/authorindex new file mode 100755 index 00000000000..6c154a080e9 --- /dev/null +++ b/Master/texmf-dist/scripts/authorindex/authorindex @@ -0,0 +1,586 @@ +#!/usr/bin/env perl +# This file is part of the authorindex package for LaTeX + BibTeX. +# Version: 10. August 2008 + +use warnings 'all'; +use strict; + +# configuration: apart from the command to invoke perl above you might want to +# change: + +my $bstenv="BSTINPUTS"; # Environment Variable holding .bst search path +my $bibenv="BIBINPUTS"; # Env Variable holding search path for BibTeX databases +my $tmp="_autidx_"; # Name base for temporary files +my $cwdpath="."; # Directory where files are generated +my $pathsep=($^O eq "MSWin32") ? ';' : ":"; # Seperator between paths in a list + +# This script takes LaTeX .aux files as input. It extracts all citations made +# with page number information. These, together with the bibliography data base +# extracted from the input and a .bst file are processed by bibtex to get a +# file that associates each citation label with corresponding authors. Together +# with the knowledge of which work is cited on which page, this is used to +# compute which author is cited on which page. This information is written to +# the output in form suitable to be included in a LaTeX document. +# Alternatively, the script can also extract the label that appears in the +# references for each work instead of the pages. Also, output for further +# processing by makeindex can be generated instead of a 'ready' LaTeX file. + +# examine command line for options + +my %opt; # hash to contain options found +use Getopt::Std; +getopts('dhikpr',\%opt); + +# handle -h option: a short description of the script. + +exists $opt{'h'} && die <<END; +Usage: $0 [-d] [-h] [-i] [-k] [-p] [-r] [filename ...] + +-d generate additional statistical information as comments +-i generate file (with extension .ain) suitable as input for makeindex +-k keep auxiliary bibliography style file $tmp.bst after script finishes +-h print this help and exit +-r suppresses automatic inclusion of .aux generated by \\include-ed files +-p send result to standard output + +Any number of file names can be given. If none is given, input is read from +standard input. Otherwise, all files specified are read, after the extension +.aux has been appended to their name where necessary. +END + +# Make sure that all input files get .aux extension. + +grep(s/$/\.aux/,grep(!/\.aux$/,@ARGV)); +my @SAVEARGV=@ARGV; + +my $usenum=0; # default: put page numbers into index +my $PageTypeOrder="rRnAa"; # default order of number types +my $altedit="'skip\$"; # no editors if no authors present +my $addedit="'skip\$"; # no editors if authors present + +my $citationcount=0; # used for statistics +my $workscount=0; +my $explicits=0; +my $authorcount=0; + +my $miniindex=0; # flag: is 1 if mini-index is requested +my $nocompress=0; # flag: is 1 if page range compression is prohibited + +my @bib; # collect .bib-file names +my %biboccured; # collect .bib-file names +my %pnlist; # collect occuring pages/bib.numbers as keys of hash + +my $editors=0; # number: 0 no editors; 1 editors if no authors + # 2: editors whenever present +my $nameformat=""; # string to format/sort names +my $maxnames=999; # max. number of author names per entry +my $truncnames=999; # how many authors to take if max number is exceeded +my $labeltype="labels"; # wether bibliography labels or pages are indexed + +my %Lab2Pag; # for each label gives array of pages where work cited +my %Lab2Num; # for each label give its bibliography number +my %Lab2Bib; # ditto, but for occurrence in bibliography +my %Aut2Pag; # for each author gives array of pages cited/in bilio. +my %Aut2Bib; # ditto, but only occurrence in bibliography +my %Aut2Lab; # list of BibTeX entry labels an author occurs in +my %Aut2First; # list of all 1st authors to which author was coauthor +my %LeadAutPag; # author -> hash marking pages with work author is 1st + +my %printname; # sort-key -> printed representation of author +my %plainname; # sort-key -> author name + +my %PageTypeOrder; # Page type code -> number giving relative order +my %PageOrder; # page string -> array used to sort pages + +my $see=""; # string to separate other and first author, or undef. +my $bst=""; # name of BibTeX program to extract author names +my $output=""; # name of file to which author index is written +my $twoabbrev=""; # string to append to page for 2 subsequent pages +my $also=""; # string to cross-refer to first authors +my $alsosep=""; # seperator for referenced first authors + +my $useaibibcite; # flag: watch for \aibibcite, but not for \bibcite. + +# scan input files and +# - build the file later to be processed by BibTeX, +# - generate a temporary bibtex database of the explicit author names given, +# - assemble for each citation the page where it was referenced and +# - look for data base specification, output file name, and so on. + +open(AUXFILE,">$tmp.aux") || die "Can't open temporary file $tmp.aux\n"; +open(BIBFILE,">$tmp.bib") || die "Can't open temporary file $tmp.bib\n"; + +while(<>){ + if(/^\\citationpage\{\s*([^{ ]+)\s*\}\{(.+)\}$/){ + $citationcount++; # used for statistics only. + $workscount++ unless ($1 eq '*') or (exists $Lab2Pag{$1}) + or (exists $Lab2Bib{$1}) or (exists $Lab2Num{$1}); + $pnlist{$2}=""; + push @{$Lab2Pag{$1}},$2; + print AUXFILE "\\citation{$1}\n"; + }elsif(/^\\aibibcite\{([^{]+)\}\{(.+)\}$/){ + $workscount++ unless ($1 eq '*') or (exists $Lab2Pag{$1}) + or (exists $Lab2Bib{$1}) or (exists $Lab2Num{$1}); + $pnlist{$2}=""; + push @{$Lab2Num{$1}},$2; + print AUXFILE "\\citation{$1}\n" if $usenum; + # using \aibibcite implies we want to ignore \bibcite. For this to + # work, in the .aux files, the first \aibibcite must appear before any + # \bibcite. + $useaibibcite="yes"; + }elsif(/^\\bibcite\{([^{]+)\}\{(.+)\}$/){ + unless($useaibibcite){ + $workscount++ unless ($1 eq '*') or (exists $Lab2Pag{$1}) + or (exists $Lab2Bib{$1}) or (exists $Lab2Num{$1}); + $pnlist{$2}=""; + push @{$Lab2Num{$1}},$2; + print AUXFILE "\\citation{$1}\n" if $usenum; + } + }elsif(/^\\bibpage\{([^{]+)\}\{(.+)\}$/){ + $workscount++ unless (exists $Lab2Pag{$1}) + or (exists $Lab2Bib{$1}) or (exists $Lab2Num{$1}); + $pnlist{$2}=""; + push @{$Lab2Bib{$1}},$2; + print AUXFILE "\\citation{$1}\n"; + }elsif(/^\\aiexplicit\{(.+)\}\{(.+)\}$/ and !$usenum){ + # above: page number might not contain '}{' + print BIBFILE "\@MISC{$tmp$explicits,author=\"$1\"}\n"; + $pnlist{$2}=""; + push @{$Lab2Pag{"$tmp$explicits"}},$2; + print AUXFILE "\\citation{$tmp$explicits}\n"; + $explicits++; + }elsif(/^\\bibdata\{(.+)\}$/){ + # keep the order of data base files, but remove duplicates; + # BibTeX complains about them. + my $bibdb; + for $bibdb (split(",",$1)){ + push @bib, $bibdb unless $biboccured{$bibdb}; + $biboccured{$bibdb}=1; + } + }elsif(/^\\aistyle\{(.+)\}$/){ + warn "Multiple \\authorindexstyle\n" if $bst && ($bst ne $1); + $bst=$1; + }elsif(/^\\aioptions\{(.*)\}$/){ + ($editors,$nameformat,$maxnames,$truncnames,$labeltype)=split /\|/,$1; + $usenum|=($labeltype eq "labels"); + if($editors>0){ + $altedit="{ peditor format }"; + $addedit=$altedit if $editors==2; + } + }elsif(/^\\aifilename\{(.+)\}$/){ + warn "Warning: Multiple authorindices\n" if $output; + $output=$1; + }elsif(/^\\\@input\{(.+)\}$/){ + push(@ARGV,$1) unless exists $opt{'r'}; + }elsif(/^\\pagetypeorder\{([rRaAn]+)\}$/){ + $PageTypeOrder=$1; + }elsif(/^\\aiseestring\{(.+)\}$/){ + $see=$1; + }elsif(/^\\aialsostrings\{(.+)\}\{(.+)\}$/){ + $also=$1; + $alsosep=$2; + }elsif(/^\\aitwostring\{(.+)\}$/){ + $twoabbrev=$1; + }elsif(/^\\aiinbibflag$/){ + $miniindex=1; + }elsif(/^\\ainocompressflag$/){ + $nocompress=1; + } +} + +close BIBFILE; + +# output can go to stdout or a filename found in the input files. + +$output || die "You have to include .aux file produced by .tex file containing \\begin{document}\nin the argument list and you have to \\usepackage{authorindex}!\n"; +$output="-" if exists $opt{'p'}; + +# We need at least one BibTeX database + +push @bib, $tmp if($explicits); + +my $bibfiles=join(",",@bib) + || die "You must specify at least one BibTeX database\n"; +print AUXFILE "\\bibdata{$bibfiles}\n"; + +$see && $also && die "\\aisee and \\aialso are mutually exlusive!\n"; + +# if the user hasn't explicitly given a .bst style for formatting author names, +# we generate our own based on the style options found in the input files. + +unless($bst){ + my @nameformat=split /;/,$nameformat; + my ($printkey,$namefmtcmd)=("cite\$ write\$ termline\n",""); + for (@nameformat){ + my ($namerep,$sortrep)=split /:/; + $sortrep=$namerep unless $sortrep; + $namefmtcmd.= + "duplicate\$ names swap\$ \"$namerep\" format.name\$ " . + "write\$ termline\n" . + "duplicate\$ names swap\$ \"$sortrep\" format.name\$ " . + "purify\$ \"u\" change.case\$ write\$ termline\n$printkey"; + $printkey="termline\n"; + } + + $ENV{$bstenv}="$cwdpath$pathsep" . (exists $ENV{$bstenv} ? $ENV{$bstenv} : ""); + $bst=$tmp; + open(BSTFILE,">$bst.bst") || die "Can't open $bst.bst\n"; + print BSTFILE <<END; # Now comes the BibTeX programm inlined... +% Temporary file generated by $0 +entry{author editor authauthor autheditor}{}{} +strings{names} integers{numnames} +function{prefersecond} % return second argument if non-empty +{ duplicate\$ empty\$ % return first argument otherwise + 'skip\$ %' + { swap\$ } + if\$ + pop\$ +} +function{pauthor}{ author authauthor prefersecond } +function{peditor}{ editor autheditor prefersecond } +function{termline}{ newline\$ "%" write\$ newline\$ } +function{format} +{ duplicate\$ empty\$ % field present? + { pop\$ } % no: do nothing but cleanup + { duplicate\$ 'names := %'memorise namelist in variable "names" + num.names\$ duplicate\$ + #$maxnames > % too many names in list? + { pop\$ #$truncnames } % yes, truncate. + 'skip\$ %' no, keep them all + if\$ + 'numnames := %'save number of names + #0 % start index + { duplicate\$ numnames < } % test for "while\$" + { #1 + % next name + duplicate\$ names swap\$ % get name list and index + "{ll}" format.name\$ % format curr. name + "others" = % et al part? + 'skip\$ %' yes, do not output + { $namefmtcmd } % no: format all + if\$ + } while\$ pop\$ % loop until index is 0 + } + if\$ +} +function{default.type}{pauthor format pauthor empty\$ $altedit $addedit if\$ } +function{article}{default.type} function{book}{default.type} +function{booklet}{default.type} function{inbook}{default.type} +function{incollection}{default.type} function{inproceedings}{default.type} +function{conference}{default.type} function{manual}{default.type} +function{mastersthesis}{default.type} function{misc}{default.type} +function{phdthesis}{default.type} function{proceedings}{default.type} +function{techreport}{default.type} function{unpublished}{default.type} +read iterate{call.type\$} +END + # ... and here comes perl again. + close BSTFILE; +} + +# Now we have decided on our .bst file and can finish the temporary .aux file +# we prepared for BibTeX. + +print AUXFILE "\\bibstyle{$bst}\n"; +close AUXFILE; + +# if we have written to the temporary database, make sure BibTeX can find it. + +$ENV{$bibenv}="$cwdpath$pathsep" . (exists $ENV{$bibenv} ? $ENV{$bibenv} : "") if $explicits; + +# We now give BibTeX all the citation labels. In return we get a file whose +# lines in turn contain an author name and a label of a work of that author. +# The format the author names are given are determined by the BibTeX style file +# $bst.bst. + +print STDERR `bibtex $tmp`; +die "BibTeX error. Aborting leaving all temporary files $tmp.*\n" if $?; + +# if things went well, we can delete all these temporary files made for BibTeX. +# The generated .bst file is kept if the user wishes so (-k option). + +unlink "$bst.bst" if ($bst eq $tmp && !(exists $opt{'k'})); +unlink "$tmp.aux","$tmp.bib"; + +# Decide wether pages or citation labels go to the index + +my %Lab2Ent=%Lab2Pag; +if($usenum){ + %Lab2Ent=%Lab2Num; + %Lab2Bib=(); +}else{ + %Lab2Num=(); +} + +# We have now labels associated with page numbers and labels associated with +# author names (in the file generated by the BibTeX run). Now we can bring +# together the previous two main steps and compute for each author the pages +# where she is cited. In draft mode, we also remember for each author the +# labels of her works and the pages where these works are cited. + +my ($firstauthor,$firstsortname,$Lab,$PrevLab)=("","","",""); +open(BIBFILE,"$tmp.bbl") || die "Can't open $tmp.bbl\n"; +my $author; +while($author=&readtosep()){ + map s/[\[\]]//g, $author; + my $sortname=&readtosep(); + my $LabOrEmpty=&readtosep(); + if($LabOrEmpty){ + $PrevLab=$Lab; + $Lab=$LabOrEmpty; + } + my $printname=$author; + if($Lab ne $PrevLab){ + @{$LeadAutPag{$author}}{@{$Lab2Ent{$Lab}}}="" if exists $Lab2Ent{$Lab}; + @{$LeadAutPag{$author}}{@{$Lab2Ent{'*'}}}="" if exists $Lab2Ent{'*'}; + @{$LeadAutPag{$author}}{@{$Lab2Bib{$Lab}}}="" if exists $Lab2Bib{$Lab}; + $firstauthor=$author; + $firstsortname=$sortname; + }else{ + ${$Aut2First{$sortname}}{$firstsortname}=""; + if($see){ + $printname="{$author}$see\\aifirst{$firstauthor}"; + $sortname="$sortname$see$firstsortname"; + } + } + @{$Aut2Pag{$printname}}{@{$Lab2Ent{$Lab}}}="" if exists $Lab2Ent{$Lab}; + @{$Aut2Pag{$printname}}{@{$Lab2Ent{'*'}}}="" if exists $Lab2Ent{'*'}; + @{$Aut2Pag{$printname}}{@{$Lab2Bib{$Lab}}}="" if exists $Lab2Bib{$Lab}; + @{$Aut2Bib{$printname}}{@{$Lab2Bib{$Lab}}}="" if exists $Lab2Bib{$Lab}; + push @{$Aut2Lab{$printname}},$Lab if (exists $opt{'d'}) and $LabOrEmpty; + $printname{$sortname}=$printname; + $plainname{$sortname}=$author; +} +close BIBFILE; +unlink "$tmp.blg","$tmp.bbl"; + +# Last not least, output the results, properly sorted if needed. + +open(AIFILE,">$output") || die "Can't create author index file $output\n"; + +# convert page type order into numerical values +my ($i,$page); +$PageTypeOrder{$i}=length($PageTypeOrder) while($i=chop $PageTypeOrder); +# create table that relates page to page order info +for $page (keys %pnlist){ + $PageOrder{$page}=&parse_pagenumber($page); +} + +if($also){ + my $coauthorname; + for $coauthorname (keys %Aut2First){ + my @namelist; + my $sortname; + for $sortname (sort keys %{$Aut2First{$coauthorname}}){ + push @namelist, $printname{$sortname}; + } + # we rely on the fact that " " is alphabetically first, so that + # $justbehind will end up directly after $coauthorname + my $justbehind=$coauthorname." "; + my $pseudoname=$also.join($alsosep, @namelist); + $printname{$justbehind}=$pseudoname; + $plainname{$justbehind}=$pseudoname; + } +} + +if(exists $opt{'i'}){ + # generate file for makeindex: leave the work for makeindex. + my $name; + for $name (keys %printname){ + my $author=$printname{$name}; + my $page; + for $page (keys %{$Aut2Pag{$author}}){ + print AIFILE "\\indexentry{$name\@$author}{$page}\n"; + } + } +}else{ + # sort result, throw away duplicate page numbers and generate LaTeX file. + print AIFILE "\\begin{theauthorindex}\n"; + my ($prevfirstchar,$prevplain,$name)=("","",""); + for $name (sort keys %printname){ + my $thisfirstchar=substr($name,0,1); + if($thisfirstchar ne $prevfirstchar){ + print AIFILE "\\indexspace\n" if $prevfirstchar; + $prevfirstchar=$thisfirstchar; + } + my $author=$printname{$name}; + my $plain=$plainname{$name}; + my $rep=$author; + if($Aut2Lab{$author}){ + print AIFILE "% @{$Aut2Lab{$author}}\n" if(exists $opt{'d'}); + $rep=($plain eq $prevplain) ? "\\airep$author" : "\\aitop$author" + if $plain ne $author; + $prevplain=$plain; + $authorcount++; + } + print AIFILE "\\item[$rep]"; + $Aut2Bib{$author}={} unless exists $Aut2Bib{$author}; + $LeadAutPag{$author}={} unless exists $LeadAutPag{$author}; + my %b2p=%{$Aut2Bib{$author}}; + my %lp=%{$LeadAutPag{$author}}; + my %pagerep; + my $page; + for $page (keys %{$Aut2Pag{$author}}){ + my $prep=$page; + $prep="\\aifirstpage{$prep}" if exists $lp{$page}; + $prep="\\aibibpage{$prep}" if exists $b2p{$page}; + $pagerep{$page}=$prep; + } + my $res=&compressed_pages($Aut2Pag{$author},\%pagerep); + print AIFILE " \\aipages{$res}\n"; + } + print AIFILE "\\end{theauthorindex}\n"; + if(exists $opt{'d'}){ # in draft mode, include some statistics + print AIFILE "%\n% $citationcount citations "; + print AIFILE "of $workscount distinct works\n"; + print AIFILE "% $explicits times \\aimention\n" if $explicits; + print AIFILE "% $authorcount different authors\n"; + } +} +close AIFILE; + +# merge mini indices into the .bbl-Files if it was requested. + +if($miniindex){ + map s/aux$/bbl/,@SAVEARGV; + my $file; + for $file (@SAVEARGV){ + open(BBLINPUT,$file) || next; + open(BBLHELP,">$tmp.bbl") || die "Can't create temp file $tmp.bbl\n"; + my $currlabel=""; + while(<BBLINPUT>){ + if(/\\bibitem(\[.*\])*\{(.*)\}|\\end\{thebibliography\}/){ + if($currlabel){ + my $pagelist=&pages_for_label($currlabel); + print BBLHELP "\\bibindex{$pagelist}\n"; + } + $currlabel=$2; + print BBLHELP "$_"; + }elsif(/\\bibindex\{(.*)\}/){ + if($currlabel){ + my $pagelist=&pages_for_label($currlabel); + print BBLHELP "$`\\bibindex{$pagelist}$'"; + } + $currlabel=""; + }else{ + print BBLHELP "$_" if "$_" ne "\n"; + } + } + close BBLHELP; + close BBLINPUT; + rename "$tmp.bbl","$file" || die "Can't replace old $file\n"; + } +} + +# auxiliary functions + +# convert roman numeral string to integer + +sub romanvalue +{ + local($_)=shift; tr/IVXLCDM/ivxlcdm/; + my %romandigits = ("i", 1, "v", 5, "x", 10, "l", 50, + "c", 100, "d", 500, "m", 1000); + my ($i,$sum,$prev)=("",0,1); + while($i=chop){ + my $this=$romandigits{$i}; + $sum=$sum+(($this<$prev) ? -$this : $this); + $prev=$this; + } + return $sum; +} + +# convert letter to numeric value + +sub alphavalue +{ + local($_)=@_; tr/A-Z/a-z/; + return ord($_)-ord("a"); +} + +# split page number in components and replace each component by a number for +# the page type and the page number as an integer. + +sub parse_pagenumber +{ + local($_)=@_; + my $res=""; + while($_){ + s/^[^\\A-Za-z0-9]*//; + if(exists $PageTypeOrder{'n'} && s/(^\d+)//){ + $res.="$PageTypeOrder{'n'}".sprintf "%0.6d",$1; + }elsif(exists $PageTypeOrder{'R'} && + s/^\\uppercase\s*\{([ivxlcdm]+)\}//){ + $res.="$PageTypeOrder{'R'}".sprintf "%0.4d",&romanvalue($1); + }elsif(exists $PageTypeOrder{'R'} && s/(^[IVXLCDM]+)//){ + $res.="$PageTypeOrder{'R'}".sprintf "%0.4d",&romanvalue($1); + }elsif(exists $PageTypeOrder{'A'} && s/(^[A-Z])//){ + $res.="$PageTypeOrder{'A'}".sprintf "%0.2d",&alphavalue($1); + }elsif(exists $PageTypeOrder{'r'} && s/(^[ivxlcdm]+)//){ + $res.="$PageTypeOrder{'r'}".sprintf "%0.4d",&romanvalue($1); + }elsif(exists $PageTypeOrder{'a'} && s/(^[a-z])//){ + $res.="$PageTypeOrder{'a'}".sprintf "%0.2d",&alphavalue($1); + }else{ + s/^.//; + } + } + return $res; +} + +# test wether 2 pages are subsequent + +sub a_follows_b +{ + my ($i,$j)=@PageOrder{@_}; + $i++; + return($i eq $j); +} + +# make a sorted, maybe compressed, list of pages + +sub compressed_pages +{ + my ($A,$B)=@_; + my %pages=%{$A}; + my %pagerep=%{$B}; + my ($prevpage,$pendrep,$res,$pagepending,$page)=("","","","",""); + for $page (sort { $PageOrder{$a} cmp $PageOrder{$b} } keys %pages){ + # handle compression of page ranges. At the moment, we + # also compress ranges that might be displayed in different faces + my $pagerep=(exists $pagerep{$page}) ? $pagerep{$page} : $page; + if($prevpage){ + if(!$nocompress and &a_follows_b($prevpage,$page)){ + $pendrep=$pagepending ? "--$pagerep" + : ($twoabbrev ? "$twoabbrev" : ", $pagerep"); + $pagepending=1; + }else{ + $res.=($pagepending ? "$pendrep" : "").", $pagerep"; + $pagepending=0; + } + }else{ + $res.="$pagerep"; + } + $prevpage=$page; + } + $res.="$pendrep" if $pagepending; + return $res; +} + +sub pages_for_label +{ + my ($label)=@_; + if(exists $Lab2Pag{$label}){ + my (%pages,%empty); + @pages{@{$Lab2Pag{$label}}}=""; + return &compressed_pages(\%pages,\%empty); + } + return ""; +} + +sub readtosep +{ + my $sum=""; + while(<BIBFILE>){ + return $sum if(/^%$/); + chop; s/%$//; + $sum.=$_; + } +} diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index ec19b0516c3..1802bd10612 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1614,6 +1614,7 @@ $standardxmt='\.xmt'; %specialscripts = ( 'a2ping' => '\.pl$', 'accfonts' => 'mkt1font|vpl2', + 'authorindex' => 'authorindex$', 'bibexport' => 'bibexport\.sh$', 'bundledoc' => '(arlatex|bundledoc)$', 'de-macro' => 'de-macro', diff --git a/Master/tlpkg/tlpsrc/context.tlpsrc b/Master/tlpkg/tlpsrc/context.tlpsrc index 734ea7486ec..dfe6845cf1b 100644 --- a/Master/tlpkg/tlpsrc/context.tlpsrc +++ b/Master/tlpkg/tlpsrc/context.tlpsrc @@ -1,5 +1,7 @@ # In order to be able to make formats, we need -# metapost, pdftex and xetex +# metapost, pdftex and xetex. Explicit dependencies in this package are +# repeated in scheme-context, since package-to-package dependencies +# can't be relied upon. depend metapost depend pdftex depend xetex @@ -23,29 +23,16 @@ Public domain. TeX Live TODO: 2009: (What is status of these?) -- Vista/W7: - . provide a link in the start menu "TeX Live Manager GUI Admin Mode" +- Vista/W7: provide a link in the start menu "TeX Live Manager GUI Admin Mode" - fix w32 tar.exe to unpack long long file names (context.doc.tar.xz) -- add luatex-plain.mem generation per elie, plus - luamplib, loaotfload, luatextra, luainputenc from elie - plus hans's stuff for luatex. -- review comments in context.tlpsrc. -- move pkfix-helper, purifyeps, pdfcrop, fragmaster, bin-pdftools, others? from - binextra to a collection-pdftools? some other name? - - The above things have to me moved over by moving: tlpkg/TeXLive, - texmf/scripts/texlive, install-tl, tlpkg/installer, and carefully syncing - the tlpkg/tlpsrc directories. Unfortunately a simple svn merge will not - work, or better I do not trust it. - 1. Package updates ================== Please see http://www.tug.org/texlive/pkgupdate.html. -And check/fix multiple files with the same name, especially with +Check/fix multiple files with the same name, especially with different sizes and not under /source/ or /doc/ or /tex4ht/ -- kpse will -find one version at random. +find one version at random. Do not add to the problem. 1a. add more packages @@ -66,19 +53,13 @@ etoolbox.pdf from CTAN is incorrectly guessed by svn to be text, thus the result is corrupted when checked in. So did: svn propset svn:mime-type application/octet-stream \ /home/texlive/karl/Master/texmf-dist/doc/latex/etoolbox/etoolbox.pdf -but of course somewhere in ctan2tl should check for this. And we should -check nightly that all pdf files can be read by pdffonts; or maybe on commit. +but of course somewhere in ctan2tl should check for this. We should make the cooked tree start at the top, not in Master, so we can autocommit the linked_scripts updates. check all die messages for "sorry". -.tds.zip should run through jimh's checker before we believe it. - -authorindex - the perl file "authorindex" must be moved to source/latex/authorindex - %moreclean rerun every package listed in this hash to be sure changes around 24dec07 haven't broken things. be careful. @@ -96,10 +77,6 @@ run tlpkg-ctan-check --check check all mentioned in staw msg on tldev, 23 Apr 2008 23:56:50. -magyar: should be included in babel but is lacking a dtx, see -http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel/4018 -If not, should be removed cause duplicates magyar.ldf. - beebe needs tons of work eulervm vs. euler vs. new euler ... no eulervm.pdf logic/gn-logic14 conflicts with logic font @@ -256,3 +233,13 @@ iso: optimize image, http://www.tina-vision.net/tina-knoppix/remastering.html sigh: lm vs. ec, 3jun06/stubner.gz msg announce: slashdot.org, freshmeat.net, prweb.com, prnewswire.com ? + +WON'T DO: +--------- +.tds.zip should run through jimh's checker before we believe it. +But unfortunately we can't do this because Jim's stuff is Python-based +and has too many library dependencies. + +magyar: should be included in babel but is lacking a dtx, see +http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel/4018 +Up to author(s). |