ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Procházka Lukáš" <lpr@pontex.cz>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: Problem \input a file (lastest minimals)
Date: Sun, 28 Nov 2010 23:44:17 +0100	[thread overview]
Message-ID: <op.vmwjjztw8lgizc@lk-2008-nbk> (raw)
In-Reply-To: <A9EBDE65-530D-4B0B-8304-9E6C06F9E62C@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]

I patched the 'regi-ini.lua' by your purpose:

---

function regimes.process(s)
     --return translate(s,regimes.currentregime)
print("111", regimes)
print("222", regimes.translate)
     return regimes.translate(s,regimes.currentregime)
end

---

But I'm still getting the same error message! I still have "! LuaTeX error ...TeXt/tex/texmf-context/tex/context/base/regi-ini.lua:100: attempt to call global 'translate' (a nil value).", although I added two "print(...)" before "return regimes...".

The line in the error message is the same: 100 - although the code is shifted three lines bellow.

And - no "111" or "222" appears in the scope during the error message.

- Isn't it weird?

Is there something more I should do? E.g. to delete a Lua cache manually (what dirs/files exactly in this case?).

I also run the "mtxrun --generate" but without success.

You can check the regi-ini.lua attached - it is originally placed in "c:\ConTeXt\tex\texmf-context\tex\context\base\regi-ini.lua".

Lukas


On Sun, 28 Nov 2010 19:08:56 +0100, Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:

>
> Am 28.11.2010 um 18:52 schrieb Procházka Lukáš:
>
>> Hello,
>>
>> I have a problem to \input a file [in the same directory as the main file is].
>>
>> This problem started appearing with the latest minimals (updated today evening) and there was no such a problem before.
>
> regi-ini.lua
>
>   function regimes.process(s)
> -     return translate(s,regimes.currentregime)
> +     return regimes.translate(s,regimes.currentregime)
>   end
>
> The \input command in ConTeXt has no braces, it’s
>
>    \input <file>
>
> or for files with spaces
>
>    \input "<file with spaces>"
>
> Wolfgang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>

[-- Attachment #2: regi-ini.lua --]
[-- Type: application/octet-stream, Size: 3400 bytes --]

if not modules then modules = { } end modules ['regi-ini'] = {
    version   = 1.001,
    comment   = "companion to regi-ini.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

local utf = unicode.utf8
local char, utfchar, gsub = string.char, utf.char, string.gsub

--[[ldx--
<p>Regimes take care of converting the input characters into
<l n='utf'/> sequences. The conversion tables are loaded at
runtime.</p>
--ldx]]--

regimes          = regimes or { }
local regimes    = regimes

regimes.data     = regimes.data or { }
local data       = regimes.data

regimes.utf      = regimes.utf or { }

regimes.synonyms = regimes.synonyms or { }
local synonyms   = regimes.synonyms

if storage then
    storage.register("regimes/synonyms", synonyms, "regimes.synonyms")
else
    regimes.synonyms = { }
end

-- setmetatable(regimes.data,_empty_table_)

regimes.currentregime = "utf"

--[[ldx--
<p>We will hook regime handling code into the input methods.</p>
--ldx]]--

function regimes.number(n)
    if type(n) == "string" then return tonumber(n,16) else return n end
end

function regimes.setsynonym(synonym,target)
    synonyms[synonym] = target
end

function regimes.truename(regime)
    context((regime and synonyms[synonym] or regime) or regimes.currentregime)
end

function regimes.load(regime)
    regime = synonyms[regime] or regime
    if not data[regime] then
        environment.loadluafile("regi-"..regime, 1.001)
        if data[regime] then
            regimes.utf[regime] = { }
            for k,v in next, data[regime] do
                regimes.utf[regime][char(k)] = utfchar(v)
            end
        end
    end
end

function regimes.translate(line,regime)
    regime = synonyms[regime] or regime
    if regime and line then
        local rur = regimes.utf[regime]
        if rur then
            return (gsub(line,"(.)",rur)) -- () redundant
        end
    end
    return line
end

-- function regimes.enable(regime)
--     regime = synonyms[regime] or regime
--     if data[regime] then
--         regimes.currentregime = regime
--         local translate = regimes.translate
--         resolvers.filters.install('input',function(s)
--             return translate(s,regime)
--         end)
--     else
--         regimes.disable()
--     end
-- end
--
-- function regimes.disable()
--     regimes.currentregime = "utf"
--     resolvers.filters.install('input',nil)
-- end

local sequencers = utilities.sequencers

function regimes.process(s)
    --return translate(s,regimes.currentregime)
print("111", regimes)
print("222", regimes.translate)
    return regimes.translate(s,regimes.currentregime)
end

function regimes.enable(regime)
    regime = synonyms[regime] or regime
    if data[regime] then
        regimes.currentregime = regime
        sequencers.enableaction(resolvers.openers.textfileactions,"regimes.process")
    else
        sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")
    end
end

function regimes.disable()
    regimes.currentregime = "utf"
    sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")
end

utilities.sequencers.prependaction(resolvers.openers.textfileactions,"system","regimes.process")
utilities.sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")

[-- Attachment #3: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2010-11-28 22:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28 17:52 Procházka Lukáš
2010-11-28 18:08 ` Wolfgang Schuster
2010-11-28 18:20   ` Hans Hagen
2010-11-28 22:44   ` Procházka Lukáš [this message]
2010-11-29 14:13     ` Procházka Lukáš Ing. - Pontex s. r. o.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.vmwjjztw8lgizc@lk-2008-nbk \
    --to=lpr@pontex.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).