summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-con.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2007-08-07 01:37:00 +0200
committerHans Hagen <pragma@wxs.nl>2007-08-07 01:37:00 +0200
commitaacdde41ef02392949aee16b2e428a8913d27efe (patch)
tree1ca125418e41b0335ee115a24cf27acb8fa7eae9 /tex/context/base/syst-con.lua
parentdbcaab8b8f76309b9fc4e05bf8a42f6b56e61893 (diff)
downloadcontext-aacdde41ef02392949aee16b2e428a8913d27efe.tar.gz
stable 2007.08.07 01:37
Diffstat (limited to 'tex/context/base/syst-con.lua')
-rw-r--r--tex/context/base/syst-con.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tex/context/base/syst-con.lua b/tex/context/base/syst-con.lua
new file mode 100644
index 000000000..273bc5b5c
--- /dev/null
+++ b/tex/context/base/syst-con.lua
@@ -0,0 +1,30 @@
+-- filename : syst-con.lua
+-- comment : companion to syst-con.tex (in ConTeXt)
+-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
+-- copyright: PRAGMA ADE / ConTeXt Development Team
+-- license : see context related readme files
+
+-- remark : compact version
+
+if not versions then versions = { } end versions['syst-con'] = 1.001
+if not convert then convert = { } end
+
+-- For raw 8 bit characters, the offset is 0x110000 (bottom of plane 18)
+-- at the top of luatex's char range but outside the unicode range.
+
+function convert.lchexnumber (n) tex.sprint(string.format("%x" ,n)) end
+function convert.uchexnumber (n) tex.sprint(string.format("%X" ,n)) end
+function convert.lchexnumbers (n) tex.sprint(string.format("%02x",n)) end
+function convert.uchexnumbers (n) tex.sprint(string.format("%02X",n)) end
+function convert.octnumber (n) tex.sprint(string.format("%03o",n)) end
+function convert.hexstringtonumber(n) tex.sprint(tonumber(n,16)) end
+function convert.octstringtonumber(n) tex.sprint(tonumber(n, 8)) end
+function convert.rawcharacter (n) tex.sprint(unicode.utf8.char(0x110000+n)) end
+
+do
+ local char = unicode.utf8.char
+ local flush = tex.sprint
+
+ function convert.rawcharacter(n) flush(char(0x110000+n)) end
+
+end