summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-env.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/util-env.lua')
-rw-r--r--tex/context/base/mkiv/util-env.lua86
1 files changed, 44 insertions, 42 deletions
diff --git a/tex/context/base/mkiv/util-env.lua b/tex/context/base/mkiv/util-env.lua
index 0b832e72e..064bd513a 100644
--- a/tex/context/base/mkiv/util-env.lua
+++ b/tex/context/base/mkiv/util-env.lua
@@ -17,56 +17,58 @@ local environment = environment
-- locales are a useless feature in and even dangerous for luatex
-os.setlocale(nil,nil) -- setlocale("all","C")
+local setlocale = os.setlocale
-function os.setlocale()
- -- no way you can mess with it
-end
+setlocale(nil,nil) -- setlocale("all","C")
--- do
---
--- local setlocale = os.setlocale
---
--- function os.resetlocale()
--- setlocale(nil,nil)
--- end
---
--- function os.pushlocale(l,...)
--- insert(stack, {
--- collate = setlocale(nil,"collate"),
--- ctype = setlocale(nil,"ctype"),
--- monetary = setlocale(nil,"monetary"),
--- numeric = setlocale(nil,"numeric"),
--- time = setlocale(nil,"time"),
--- })
--- if l then
--- setlocale(l,...)
--- else
--- setlocale(status.lc_collate ,"collate"),
--- setlocale(status.lc_ctype ,"ctype"),
--- setlocale(status.lc_monetary,"monetary"),
--- setlocale(status.lc_numeric ,"numeric"),
--- setlocale(status.lc_time ,"time"),
--- end
--- end
+-- function os.resetlocale()
+-- setlocale(nil,nil)
+-- end
--
--- function os.poplocale(...)
--- local l = remove(stack)
--- if l then
--- setlocale(unpack(l))
--- else
--- resetlocale()
--- end
+-- function os.pushlocale(l,...)
+-- insert(stack, {
+-- collate = setlocale(nil,"collate"),
+-- ctype = setlocale(nil,"ctype"),
+-- monetary = setlocale(nil,"monetary"),
+-- numeric = setlocale(nil,"numeric"),
+-- time = setlocale(nil,"time"),
+-- })
+-- if l then
+-- setlocale(l,...)
+-- else
+-- setlocale(status.lc_collate ,"collate"),
+-- setlocale(status.lc_ctype ,"ctype"),
+-- setlocale(status.lc_monetary,"monetary"),
+-- setlocale(status.lc_numeric ,"numeric"),
+-- setlocale(status.lc_time ,"time"),
-- end
+-- end
--
--- function os.setlocale()
--- -- no way you can mess with it, use push/pop
+-- function os.poplocale()
+-- local l = remove(stack)
+-- if l then
+-- setlocale(unpack(l))
+-- else
+-- resetlocale()
-- end
---
--- setlocale(nil,nil) -- setlocale("all","C")
---
-- end
+local report = logs.reporter("system")
+
+function os.setlocale(a,b)
+ if a or b then
+ if report then
+ report()
+ report("You're messing with os.locale in a supposedly locale neutral enviroment. From")
+ report("now on are on your own and without support. Crashes or unexpected side effects")
+ report("can happen but don't bother the luatex and context developer team with it.")
+ report()
+ report = nil
+ end
+ setlocale(a,b)
+ end
+end
+
-- dirty tricks (we will replace the texlua call by luatex --luaonly)
local validengines = allocate {