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

-- Kind of obsolete ... old school directions.

local implement   = interfaces.implement
local scankeyword = tokens.scanners.keyword
local scaninteger = tokens.scanners.integer

local settextdir  = tex.settextdir
local setlinedir  = tex.setlinedir
local setpardir   = tex.setpardir
local setboxdir   = tex.setboxdir

local gettextdir  = tex.gettextdir
local getlinedir  = tex.getlinedir
local getpardir   = tex.getpardir
local getboxdir   = tex.getboxdir

local none_code   = tokens.values.none

local context     = context

local function scandir()
    if scankeyword("tlt") then
        return 0
    elseif scankeyword("trt") then
        return 1
    else
        return 0
    end
end

local function showdir(d)
    context(d == 1 and "TRT" or "LTL")
    return none_code
end

implement {
    name    = "textdir",
    public  = true,
    usage   = "value",
    actions = function(what)
        if what == "value" then
            showdir(gettextdir())
        else
            settextdir(scandir())
        end
    end
}

implement {
    name    = "linedir",
    public  = true,
    usage   = "value",
    actions = function(what)
        if what == "value" then
            return showdir(getlinedir())
        else
            setlinedir(scandir())
        end
    end
}

implement {
    name    = "pardir",
    public  = true,
    usage   = "value",
    actions = function(what)
        if what == "value" then
            return showdir(getpardir())
        else
            setpardir(scandir())
        end
    end
}

implement {
    name    = "boxdir",
    public  = true,
    usage   = "value",
    actions = function(what)
        local n = scaninteger()
        if what == "value" then
            return showdir(getboxdir(n))
        else
            setboxdir(n,scandir())
        end
    end
}
