From 822d6299d6c28fe3780ff40831ec5c00c60133f5 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 1 Jun 2019 22:12:48 +0200 Subject: 2019-06-01 19:20:00 --- scripts/context/lua/mtx-unicode.lua | 25 +++++++++++++++++++------ scripts/context/lua/mtxrun.lua | 21 +++++++++++++++------ scripts/context/stubs/mswin/mtxrun.lua | 21 +++++++++++++++------ scripts/context/stubs/unix/mtxrun | 21 +++++++++++++++------ scripts/context/stubs/win64/mtxrun.lua | 21 +++++++++++++++------ 5 files changed, 79 insertions(+), 30 deletions(-) (limited to 'scripts') diff --git a/scripts/context/lua/mtx-unicode.lua b/scripts/context/lua/mtx-unicode.lua index fd6576646..85860ddfd 100644 --- a/scripts/context/lua/mtx-unicode.lua +++ b/scripts/context/lua/mtx-unicode.lua @@ -57,11 +57,11 @@ if not modules then modules = { } end modules ['mtx-unicode'] = { -- curl -o unicodedata.txt http://www.unicode.org/Public/UNIDATA/UnicodeData.txt -- curl -o unihan.zip http://www.unicode.org/Public/UNIDATA/Unihan.zip -- --- curl -o emoji-data.txt http://unicode.org/Public/emoji/11.0/emoji-data.txt --- curl -o emoji-sequences.txt http://unicode.org/Public/emoji/11.0/emoji-sequences.txt --- curl -o emoji-variation-sequences.txt http://unicode.org/Public/emoji/11.0/emoji-variation-sequences.txt --- curl -o emoji-zwj-sequences.txt http://unicode.org/Public/emoji/11.0/emoji-zwj-sequences.txt --- curl -o emoji-test.txt http://unicode.org/Public/emoji/11.0/emoji-test.txt +-- curl -o emoji-data.txt http://unicode.org/Public/emoji/12.0/emoji-data.txt +-- curl -o emoji-sequences.txt http://unicode.org/Public/emoji/12.0/emoji-sequences.txt +-- curl -o emoji-variation-sequences.txt http://unicode.org/Public/emoji/12.0/emoji-variation-sequences.txt +-- curl -o emoji-zwj-sequences.txt http://unicode.org/Public/emoji/12.0/emoji-zwj-sequences.txt +-- curl -o emoji-test.txt http://unicode.org/Public/emoji/12.0/emoji-test.txt -- -- todo: -- @@ -526,10 +526,21 @@ function scripts.unicode.load() end end +-- local variants_emoji={ +-- [0xFE0E]="text style", +-- [0xFE0F]="emoji style", +-- } +-- +-- local variants_forms={ +-- [0xFE00]="corner-justified form", +-- [0xFE01]="centered form", +-- } + function scripts.unicode.save(filename) if preamble then local data = table.serialize(characters.data,"characters.data", { hexify = true, noquotes = true }) data = gsub(data,"%{%s+%[0xFE0E%]=\"text style\",%s+%[0xFE0F%]=\"emoji style\",%s+%}","variants_emoji") + data = gsub(data,"%{%s+%[0xFE00%]=\"corner%-justified form\",%s+%[0xFE01%]=\"centered form\",%s+%}","variants_forms") io.savedata(filename,preamble .. data) end end @@ -722,8 +733,10 @@ else scripts.unicode.extras() scripts.unicode.save("char-def-new.lua") scripts.unicode.emoji("char-emj-new.lua") + report("saved file %a","char-def-new.lua") + report("saved file %a (current 12.0, check for updates, see above!)","char-emj-new.lua") else report("nothing to do") end - report("stop working on %a, output char-def-new.lua\n",lfs.currentdir()) + report("stop working on %a\n",lfs.currentdir()) end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 89e23d8ae..f7e67d91e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -25910,7 +25910,7 @@ local helpinfo = [[ run an mtx script (lua prefered method) (), no script gives list - run code passed on the commandline (between quotes) + run code passed on the commandline (between quotes) (=loop) (exit|quit aborts) run a script or program (texmfstart method) () resolve prefixed arguments run internally (using preloaded libs) @@ -26581,16 +26581,22 @@ function runners.associate(filename) end function runners.evaluate(code,filename) -- for Luigi + local environment = table.setmetatableindex(_G) if code == "loop" then while true do - io.write("> ") + io.write("lua > ") local code = io.read() - if code ~= "" then + if code == "quit" or code == "exit" then + break + elseif code ~= "" then local temp = string.match(code,"^= (.*)$") if temp then - code = "print("..temp..")" + code = "inspect("..temp..")" + end + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) end - local compiled, message = loadstring(code) if type(compiled) ~= "function" then io.write("! " .. (message or code).."\n") else @@ -26603,7 +26609,10 @@ function runners.evaluate(code,filename) -- for Luigi code = filename end if code ~= "" then - local compiled, message = loadstring(code) + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) + end if type(compiled) ~= "function" then io.write("invalid lua code: " .. (message or code)) return diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 89e23d8ae..f7e67d91e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -25910,7 +25910,7 @@ local helpinfo = [[ run an mtx script (lua prefered method) (), no script gives list - run code passed on the commandline (between quotes) + run code passed on the commandline (between quotes) (=loop) (exit|quit aborts) run a script or program (texmfstart method) () resolve prefixed arguments run internally (using preloaded libs) @@ -26581,16 +26581,22 @@ function runners.associate(filename) end function runners.evaluate(code,filename) -- for Luigi + local environment = table.setmetatableindex(_G) if code == "loop" then while true do - io.write("> ") + io.write("lua > ") local code = io.read() - if code ~= "" then + if code == "quit" or code == "exit" then + break + elseif code ~= "" then local temp = string.match(code,"^= (.*)$") if temp then - code = "print("..temp..")" + code = "inspect("..temp..")" + end + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) end - local compiled, message = loadstring(code) if type(compiled) ~= "function" then io.write("! " .. (message or code).."\n") else @@ -26603,7 +26609,10 @@ function runners.evaluate(code,filename) -- for Luigi code = filename end if code ~= "" then - local compiled, message = loadstring(code) + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) + end if type(compiled) ~= "function" then io.write("invalid lua code: " .. (message or code)) return diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 89e23d8ae..f7e67d91e 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -25910,7 +25910,7 @@ local helpinfo = [[ run an mtx script (lua prefered method) (), no script gives list - run code passed on the commandline (between quotes) + run code passed on the commandline (between quotes) (=loop) (exit|quit aborts) run a script or program (texmfstart method) () resolve prefixed arguments run internally (using preloaded libs) @@ -26581,16 +26581,22 @@ function runners.associate(filename) end function runners.evaluate(code,filename) -- for Luigi + local environment = table.setmetatableindex(_G) if code == "loop" then while true do - io.write("> ") + io.write("lua > ") local code = io.read() - if code ~= "" then + if code == "quit" or code == "exit" then + break + elseif code ~= "" then local temp = string.match(code,"^= (.*)$") if temp then - code = "print("..temp..")" + code = "inspect("..temp..")" + end + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) end - local compiled, message = loadstring(code) if type(compiled) ~= "function" then io.write("! " .. (message or code).."\n") else @@ -26603,7 +26609,10 @@ function runners.evaluate(code,filename) -- for Luigi code = filename end if code ~= "" then - local compiled, message = loadstring(code) + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) + end if type(compiled) ~= "function" then io.write("invalid lua code: " .. (message or code)) return diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 89e23d8ae..f7e67d91e 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -25910,7 +25910,7 @@ local helpinfo = [[ run an mtx script (lua prefered method) (), no script gives list - run code passed on the commandline (between quotes) + run code passed on the commandline (between quotes) (=loop) (exit|quit aborts) run a script or program (texmfstart method) () resolve prefixed arguments run internally (using preloaded libs) @@ -26581,16 +26581,22 @@ function runners.associate(filename) end function runners.evaluate(code,filename) -- for Luigi + local environment = table.setmetatableindex(_G) if code == "loop" then while true do - io.write("> ") + io.write("lua > ") local code = io.read() - if code ~= "" then + if code == "quit" or code == "exit" then + break + elseif code ~= "" then local temp = string.match(code,"^= (.*)$") if temp then - code = "print("..temp..")" + code = "inspect("..temp..")" + end + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) end - local compiled, message = loadstring(code) if type(compiled) ~= "function" then io.write("! " .. (message or code).."\n") else @@ -26603,7 +26609,10 @@ function runners.evaluate(code,filename) -- for Luigi code = filename end if code ~= "" then - local compiled, message = loadstring(code) + local compiled, message = load(code,"console","t",environment) + if type(compiled) ~= "function" then + compiled = load("inspect("..code..")","console","t",environment) + end if type(compiled) ~= "function" then io.write("invalid lua code: " .. (message or code)) return -- cgit v1.2.3