%D \module
%D   [       file=mult-prm,
%D        version=2011.09.18, % actually older
%D          title=\CONTEXT\ Multilingual Macros,
%D       subtitle=Primitives,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is therefore
%C copyrighted by \PRAGMA. See mreadme.pdf for details.

%D This file is only a helper for generating files that can be used in an
%D editor for syntax highlighting.

% local all = table.load("mult-prm.lua")
% local tex = table.tohash(all.tex)
% for k, v in next, all do
%     if k ~= "tex" then
%         local h = table.tohash(v)
%         for k, v in next, h do
%             tex[k] = nil
%         end
%         all[k] = table.sortedkeys(h)
%     end
% end
% all.tex = table.sortedkeys(tex)
% print((string.gsub(table.serialize(all,true),' "','\n  "')))

\startluacode

    context.starttext()

    local missing = {
        tex = {
            -- todo: differenced between luatex and luametatex
        },
        etex = {
            -- todo: differenced between luatex and luametatex
        },
        luatex = {
            -- todo: differenced between luatex and luametatex
            "lastchkinteger",
            "ifchkinteger",
        },
        pdftex = { -- maybe not complete
            "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing",
            "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit",
            "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate",
            "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode",
            "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink",
            "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand",
            "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma",
            "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin",
            "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename",
            "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor",
            "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts",
            "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate",
            "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink",
            "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages",
            "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral",
            "pdfmapfile", "pdfmapline", "pdfmajorversion", "pdfminorversion", "pdfnames",
            "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfrecompress",
            "pdfobjcompresslevel", "pdfoutline", "pdfoutput", "pdfpageattr",
            "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources",
            "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode",
            "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen",
            "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage",
            "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos",
            "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread",
            "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner",
            "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin",
            "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate",
            "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr",
            "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage",
            "pdfomitcidset", "pdfomitcharset", "pdfomitinfodict",
        },
        aleph = { -- we don't bother
            "Alephminorversion", "Alephrevision", "Alephversion",
        },
        omega = { -- we don't bother
            "Omegaminorversion", "Omegarevision", "Omegaversion",
        },
        xetex = { -- we don't bother
            "XeTeXversion",
        },
     -- plain = {
     --     "TeX",
     --     "bgroup", "egroup", "endgraf", "space", "empty", "null",
     --     "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newhelp", "newread", "newwrite", "newfam", "newlanguage", "newinsert", "newif",
     --     "maxdimen", "magstephalf", "magstep",
     --     "frenchspacing", "nonfrenchspacing", "normalbaselines", "obeylines", "obeyspaces", "raggedright", "ttraggedright",
     --     "thinspace", "negthinspace", "enspace", "enskip", "quad", "qquad",
     --     "smallskip", "medskip", "bigskip", "removelastskip", "topglue", "vglue", "hglue",
     --     "break", "nobreak", "allowbreak", "filbreak", "goodbreak", "smallbreak", "medbreak", "bigbreak",
     --     "line", "leftline", "rightline", "centerline", "rlap", "llap", "underbar", "strutbox", "strut",
     --     "cases", "matrix", "pmatrix", "bordermatrix", "eqalign", "displaylines", "eqalignno", "leqalignno",
     --     "pageno", "folio", "tracingall", "showhyphens", "fmtname", "fmtversion",
     --     "hphantom", "vphantom", "phantom", "smash",
     -- },
    }

    local primitives = {
        tex    = table.sorted( table.merged( missing.tex   , tex.extraprimitives("core","tex") ) ),
        etex   = table.sorted( table.merged( missing.etex  , tex.extraprimitives("etex") ) ),
        pdftex = table.sorted( table.merged( missing.pdftex, { } ) ),
        luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives("luatex","luametatex") ) ),
        aleph  = table.sorted( table.merged( missing.aleph , { } ) ),
        omega  = table.sorted( table.merged( missing.omega , { } ) ),
        xetex  = table.sorted( table.merged( missing.xetex , { } ) ),
    }

 -- table.remove(primitives.tex,1) -- get rid of \-

    io.savedata("mult-prm.lua",table.serialize(primitives,true,{ reduce = true, inline = false }))

    context.stoptext()

\stopluacode
