Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
-- heads6.lua: override the dednat5-ish heads with dednat6-ish ones.
-- This file:
-- http://angg.twu.net/dednat6/heads6.lua
-- http://angg.twu.net/dednat6/heads6.lua.html
--  (find-angg        "dednat6/heads6.lua")
--
-- Temporary!!!!!!!! See:
-- (find-dn6 "process.lua")
-- (find-dn6 "process.lua" "main-loop")
-- (find-dn6 "process.lua"   "lua-head")
-- (find-dn6 "diagforth.lua" "diag-head")
-- (find-dn6 "treehead.lua"  "tree-head")
-- (find-dn6 "begriff.lua"   "begriff_head")
-- heads = heads or {}
-- heads["%"] = nil

-- «.registerhead»	(to "registerhead")
-- «.abbrev-head»	(to "abbrev-head")
-- «.lua-head»		(to "lua-head")
-- «.luarect-head»	(to "luarect-head")
-- «.tree-head»		(to "tree-head")
-- «.diag-head»		(to "diag-head")
-- «.zrect-head»	(to "zrect-head")
-- «.heads-test»	(to "heads-test")



-- «registerhead» (to ".registerhead")
-- (find-dn6grep "grep -nH -e registerhead *.lua")
-- (find-dn6 "process.lua" "registerhead")
-- (find-dn6 "texfile.lua" "Texfile")
-- (find-dn6 "texfile.lua" "Texfile" "process1 =")

-- Replaces this: (find-dn6 "process.lua" "registerhead")
heads = {}
registerhead = function (headstr)
    return function (head)
        head.headstr = headstr
        heads[headstr] = head
      end
  end
registerhead "" {}

-- «abbrev-head» (to ".abbrev-head")
-- (find-dn6 "process.lua" "abbrev-head")
registerhead "%:*" {
  name="abbrev",
  action = function ()
      local abbrev, expansion = linestr:match("^%%:*(.-)*(.-)*")
      assert(abbrev)
      addabbrev(abbrev, expansion)
    end,
}

-- «lua-head» (to ".lua-head")
-- (find-dn6 "process.lua" "lua-head")
registerhead "%L" {
  name   = "lua",
  action = function ()
      local i,j,lualines = tf:getblock()
      local chunkname = tf.name..":%L:"..i
      local luacode = table.concat(lualines, "\n")
      assert(loadstring(luacode, chunkname))()
    end,
}

-- «zrect-head» (to ".zrect-head")
-- (find-dn6 "zrect.lua" "zrectdefs_get")
-- (find-dn6 "zrect.lua" "zrectdefs_get" "zrectdefs_get =")
-- Old, obsolete
registerhead "%R" {
  name  ="zrect",
  action = function ()
      local i,j,lines = tf:getblock()
      zrectdefs_get(lines, 1, #lines)
    end,
}

-- «luarect-head» (to ".luarect-head")
-- See: (find-dn6 "luarects.lua" "luarecteval")
-- New
registerhead "%R" {
  name   = "luarect",
  action = function ()
      local i,j,luarectlines = tf:getblock()
      local chunkname = tf.name..":%R:"..i
      local luacode = luarectexpand(luarectlines)
      print(luacode)    -- verbose
      assert(loadstring(luacode, chunkname))()
    end,
}

-- «tree-head» (to ".tree-head")
-- (find-dn6 "treehead.lua" "tree-head")
registerhead "%:" {
  name   = "tree",
  action = function ()
      nline = tf.nline
      allsegments[nline] = tosegments(linestr, nline)
      for _,seg in ipairs(allsegments[nline]) do
        local name = seg.t:match("^%^(.*)")
        if name then
          output(seg:rootnode():totreenode():TeX_deftree(name))
        end
      end
    end,
}

-- «diag-head» (to ".diag-head")
-- (find-dn6 "diagforth.lua" "diag-head")
registerhead "%D" {
  name = "diag",
  action = function ()
      dxyrun(untabify(linestr), 3)
    end,
}




-- «heads-test» (to ".heads-test")
-- See: (find-dn6 "texfile.lua" "texfiletest")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "texfile.lua"
dofile "luarects.lua"
texfiletest()
add [[%L print(2, ]]
add [[%L       22)]]
pu()
add [[%R a = 2/a b \ ]]
add [[%R      \ c d/ ]]
pu()
= a

* (ex "heads-0")

--]==]





--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "heads6.lua"
= mytabletostring(heads)

--]]



-- Local Variables:
-- coding: raw-text-unix
-- End: