From 08ba638847461b32675823280b8f14cd17d99860 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 30 Nov 2019 22:17:47 +0000 Subject: magicnum (30nov19) git-svn-id: svn://tug.org/texlive/trunk@52983 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/magicnum/magicnum.lua | 244 ++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 Master/texmf-dist/scripts/magicnum/magicnum.lua (limited to 'Master/texmf-dist/scripts/magicnum') diff --git a/Master/texmf-dist/scripts/magicnum/magicnum.lua b/Master/texmf-dist/scripts/magicnum/magicnum.lua new file mode 100644 index 00000000000..66a577573c2 --- /dev/null +++ b/Master/texmf-dist/scripts/magicnum/magicnum.lua @@ -0,0 +1,244 @@ +-- +-- This is file `magicnum.lua', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- magicnum.dtx (with options: `lua') +-- +-- This is a generated file. +-- +-- Project: magicnum +-- Version: 2019/11/29 v1.7 +-- +-- Copyright (C) +-- 2007, 2009-2011 Heiko Oberdiek +-- 2016-2019 Oberdiek Package Support Group +-- +-- This work may be distributed and/or modified under the +-- conditions of the LaTeX Project Public License, either +-- version 1.3c of this license or (at your option) any later +-- version. This version of this license is in +-- https://www.latex-project.org/lppl/lppl-1-3c.txt +-- and the latest version of this license is in +-- https://www.latex-project.org/lppl.txt +-- and version 1.3 or later is part of all distributions of +-- LaTeX version 2005/12/01 or later. +-- +-- This work has the LPPL maintenance status "maintained". +-- +-- The Current Maintainers of this work are +-- Heiko Oberdiek and the Oberdiek Package Support Group +-- https://github.com/ho-tex/magicnum/issues +-- +-- +-- The Base Interpreter refers to any `TeX-Format', +-- because some files are installed in TDS:tex/generic//. +-- +-- This work consists of the main source file magicnum.dtx +-- and the derived files +-- magicnum.sty, magicnum.pdf, magicnum.txt, magicnum.lua. +-- +oberdiek = oberdiek or {} +local magicnum = oberdiek.magicnum or {} +oberdiek.magicnum = magicnum +function magicnum.getversion() + tex.write("2019/11/29 v1.7") +end +local data = { + ["tex.catcode"] = { + [0] = "escape", + [1] = "begingroup", + [2] = "endgroup", + [3] = "math", + [4] = "align", + [5] = "eol", + [6] = "parameter", + [7] = "superscript", + [8] = "subscript", + [9] = "ignore", + [10] = "space", + [11] = "letter", + [12] = "other", + [13] = "active", + [14] = "comment", + [15] = "invalid", + ["active"] = 13, + ["align"] = 4, + ["begingroup"] = 1, + ["comment"] = 14, + ["endgroup"] = 2, + ["eol"] = 5, + ["escape"] = 0, + ["ignore"] = 9, + ["invalid"] = 15, + ["letter"] = 11, + ["math"] = 3, + ["other"] = 12, + ["parameter"] = 6, + ["space"] = 10, + ["subscript"] = 8, + ["superscript"] = 7 + }, + ["etex.grouptype"] = { + [0] = "bottomlevel", + [1] = "simple", + [2] = "hbox", + [3] = "adjustedhbox", + [4] = "vbox", + [5] = "align", + [6] = "noalign", + [8] = "output", + [9] = "math", + [10] = "disc", + [11] = "insert", + [12] = "vcenter", + [13] = "mathchoice", + [14] = "semisimple", + [15] = "mathshift", + [16] = "mathleft", + ["adjustedhbox"] = 3, + ["align"] = 5, + ["bottomlevel"] = 0, + ["disc"] = 10, + ["hbox"] = 2, + ["insert"] = 11, + ["math"] = 9, + ["mathchoice"] = 13, + ["mathleft"] = 16, + ["mathshift"] = 15, + ["noalign"] = 6, + ["output"] = 8, + ["semisimple"] = 14, + ["simple"] = 1, + ["vbox"] = 4, + ["vcenter"] = 12 + }, + ["etex.iftype"] = { + [0] = "none", + [1] = "char", + [2] = "cat", + [3] = "num", + [4] = "dim", + [5] = "odd", + [6] = "vmode", + [7] = "hmode", + [8] = "mmode", + [9] = "inner", + [10] = "void", + [11] = "hbox", + [12] = "vbox", + [13] = "x", + [14] = "eof", + [15] = "true", + [16] = "false", + [17] = "case", + [18] = "defined", + [19] = "csname", + [20] = "fontchar", + ["case"] = 17, + ["cat"] = 2, + ["char"] = 1, + ["csname"] = 19, + ["defined"] = 18, + ["dim"] = 4, + ["eof"] = 14, + ["false"] = 16, + ["fontchar"] = 20, + ["hbox"] = 11, + ["hmode"] = 7, + ["inner"] = 9, + ["mmode"] = 8, + ["none"] = 0, + ["num"] = 3, + ["odd"] = 5, + ["true"] = 15, + ["vbox"] = 12, + ["vmode"] = 6, + ["void"] = 10, + ["x"] = 13 + }, + ["etex.nodetype"] = { + [-1] = "none", + [0] = "char", + [1] = "hlist", + [2] = "vlist", + [3] = "rule", + [4] = "ins", + [5] = "mark", + [6] = "adjust", + [7] = "ligature", + [8] = "disc", + [9] = "whatsit", + [10] = "math", + [11] = "glue", + [12] = "kern", + [13] = "penalty", + [14] = "unset", + [15] = "maths", + ["adjust"] = 6, + ["char"] = 0, + ["disc"] = 8, + ["glue"] = 11, + ["hlist"] = 1, + ["ins"] = 4, + ["kern"] = 12, + ["ligature"] = 7, + ["mark"] = 5, + ["math"] = 10, + ["maths"] = 15, + ["none"] = -1, + ["penalty"] = 13, + ["rule"] = 3, + ["unset"] = 14, + ["vlist"] = 2, + ["whatsit"] = 9 + }, + ["etex.interactionmode"] = { + [0] = "batch", + [1] = "nonstop", + [2] = "scroll", + [3] = "errorstop", + ["batch"] = 0, + ["errorstop"] = 3, + ["nonstop"] = 1, + ["scroll"] = 2 + }, + ["luatex.pdfliteral.mode"] = { + [0] = "setorigin", + [1] = "page", + [2] = "direct", + ["direct"] = 2, + ["page"] = 1, + ["setorigin"] = 0 + } +} +function magicnum.get(name) + local startpos, endpos, category, entry = + string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$") + if not entry then + return + end + local node = data[category] + if not node then + return + end + local num = tonumber(entry) + local value + if num then + value = node[num] + if not value then + return + end + else + value = node[entry] + if not value then + return + end + value = "" .. value + end + tex.write(value) +end + +-- +-- End of File `magicnum.lua'. -- cgit v1.2.3