diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/v-mp.lua | 174 | ||||
-rw-r--r-- | tex/context/base/v-mp.mkiv | 68 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 |
5 files changed, 245 insertions, 3 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 42d506e11..3e94f0982 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.11.26 21:21} +\newcontextversion{2010.11.26 22:03} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 11e0e02e1..8a349be10 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.11.26 21:21} +\edef\contextversion{2010.11.26 22:03} %D For those who want to use this: diff --git a/tex/context/base/v-mp.lua b/tex/context/base/v-mp.lua new file mode 100644 index 000000000..5e7f68712 --- /dev/null +++ b/tex/context/base/v-mp.lua @@ -0,0 +1,174 @@ +if not modules then modules = { } end modules ['v-mp'] = { + version = 1.001, + comment = "companion to v-mp.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns + +local primitives = table.tohash { + 'charcode', 'day', 'linecap', 'linejoin', 'miterlimit', 'month', 'pausing', + 'prologues', 'showstopping', 'time', 'tracingcapsules', 'tracingchoices', + 'tracingcommands', 'tracingequations', 'tracinglostchars', + 'tracingmacros', 'tracingonline', 'tracingoutput', 'tracingrestores', + 'tracingspecs', 'tracingstats', 'tracingtitles', 'truecorners', + 'warningcheck', 'year', 'mpprocset', + 'false', 'nullpicture', 'pencircle', 'true', + 'and', 'angle', 'arclength', 'arctime', 'ASCII', 'bluepart', 'boolean', 'bot', + 'char', 'color', 'cosd', 'cycle', 'decimal', 'directiontime', 'floor', 'fontsize', + 'greenpart', 'hex', 'infont', 'intersectiontimes', 'known', 'length', 'llcorner', + 'lrcorner', 'makepath', 'makepen', 'mexp', 'mlog', 'normaldeviate', 'not', + 'numeric', 'oct', 'odd', 'or', 'path', 'pair', 'pen', 'penoffset', 'picture', 'point', + 'postcontrol', 'precontrol', 'redpart', 'reverse', 'rotated', 'scaled', + 'shifted', 'sind', 'slanted', 'sqrt', 'str', 'string', 'subpath', 'substring', + 'transform', 'transformed', 'ulcorner', 'uniformdeviate', 'unknown', + 'urcorner', 'xpart', 'xscaled', 'xxpart', 'xypart', 'ypart', 'yscaled', 'yxpart', + 'yypart', 'zscaled', + 'addto', 'clip', 'input', 'interim', 'let', 'newinternal', 'save', 'setbounds', + 'shipout', 'show', 'showdependencies', 'showtoken', 'showvariable', + 'special', + 'begingroup', 'endgroup', 'of', 'curl', 'tension', 'and', 'controls', + 'reflectedabout', 'rotatedaround', 'interpath', 'on', 'off', 'beginfig', + 'endfig', 'def', 'vardef', 'enddef', 'epxr', 'suffix', 'text', 'primary', 'secondary', + 'tertiary', 'primarydef', 'secondarydef', 'tertiarydef', 'top', 'bottom', + 'ulft', 'urt', 'llft', 'lrt', 'randomseed', 'also', 'contour', 'doublepath', + 'withcolor', 'withpen', 'dashed', 'if', 'else', 'elseif', 'fi', 'for', 'endfor', 'forever', 'exitif', + 'forsuffixes', 'downto', 'upto', 'step', 'until', + 'charlist', 'extensible', 'fontdimen', 'headerbyte', 'kern', 'ligtable', + 'boundarychar', 'chardp', 'charext', 'charht', 'charic', 'charwd', 'designsize', + 'fontmaking', 'charexists', + 'cullit', 'currenttransform', 'gfcorners', 'grayfont', 'hround', + 'imagerules', 'lowres_fix', 'nodisplays', 'notransforms', 'openit', + 'displaying', 'currentwindow', 'screen_rows', 'screen_cols', + 'pixels_per_inch', 'cull', 'display', 'openwindow', 'numspecial', + 'totalweight', 'autorounding', 'fillin', 'proofing', 'tracingpens', + 'xoffset', 'chardx', 'granularity', 'smoothing', 'turningcheck', 'yoffset', + 'chardy', 'hppp', 'tracingedges', 'vppp', + 'extra_beginfig', 'extra_endfig', 'mpxbreak', + 'end', 'btex', 'etex', 'verbatimtex' +} + +local plain = table.tohash { + 'ahangle', 'ahlength', 'bboxmargin', 'defaultpen', 'defaultscale', + 'labeloffset', 'background', 'currentpen', 'currentpicture', 'cuttings', + 'defaultfont', 'extra_beginfig', 'extra_endfig', + 'beveled', 'black', 'blue', 'bp', 'butt', 'cc', 'cm', 'dd', 'ditto', 'down', 'epsilon', + 'evenly', 'fullcircle', 'green', 'halfcircle', 'identity', 'in', 'infinity', 'left', + 'mitered', 'mm', 'origin', 'pensquare', 'pt', 'quartercircle', 'red', 'right', + 'rounded', 'squared', 'unitsquare', 'up', 'white', 'withdots', + 'abs', 'bbox', 'ceiling', 'center', 'cutafter', 'cutbefore', 'dir', + 'directionpoint', 'div', 'dotprod', 'intersectionpoint', 'inverse', 'mod', 'lft', + 'round', 'rt', 'unitvector', 'whatever', + 'cutdraw', 'draw', 'drawarrow', 'drawdblarrow', 'fill', 'filldraw', 'drawdot', + 'loggingall', 'pickup', 'tracingall', 'tracingnone', 'undraw', 'unfill', + 'unfilldraw', + 'buildcycle', 'dashpattern', 'decr', 'dotlabel', 'dotlabels', 'drawoptions', + 'incr', 'label', 'labels', 'max', 'min', 'thelabel', 'z', + 'beginchar', 'blacker', 'capsule_end', 'change_width', + 'define_blacker_pixels', 'define_corrected_pixels', + 'define_good_x_pixels', 'define_good_y_pixels', + 'define_horizontal_corrected_pixels', 'define_pixels', + 'define_whole_blacker_pixels', 'define_whole_pixels', + 'define_whole_vertical_blacker_pixels', + 'define_whole_vertical_pixels', 'endchar', 'extra_beginchar', + 'extra_endchar', 'extra_setup', 'font_coding_scheme', + 'font_extra_space' +} + +local metafun = table.tohash { + 'unitcircle', 'fulldiamond', 'unitdiamond', + 'halfcircle', 'quartercircle', + 'llcircle', 'lrcircle', 'urcircle', 'ulcircle', + 'tcircle', 'bcircle', 'lcircle', 'rcircle', + 'lltriangle', 'lrtriangle', 'urtriangle', 'ultriangle', + 'smoothed', 'cornered', 'superellipsed', 'randomized', 'squeezed', + 'punked', 'curved', 'unspiked', 'simplified', 'blownup', 'stretched', + 'paralled', 'enlonged', 'shortened', + 'enlarged', 'leftenlarged', 'topenlarged', 'rightenlarged', 'bottomenlarged', + 'llenlarged', 'lrenlarged', 'urenlarged', 'ulenlarged', + 'llmoved', 'lrmoved', 'urmoved', 'ulmoved', + 'boundingbox', 'innerboundingbox', 'outerboundingbox', + 'bottomboundary', 'leftboundary', 'topboundary', 'rightboundary', + 'xsized', 'ysized', 'xysized', + 'cmyk', 'transparent', 'withshade', 'spotcolor', + 'drawfill', 'undrawfill', + 'inverted', 'uncolored', 'softened', 'grayed', + 'textext', 'graphictext', + 'loadfigure', 'externalfigure' +} + +local context = context +local verbatim = context.verbatim +local makepattern = visualizers.makepattern + +local MetapostSnippet = context.MetapostSnippet +local startMetapostSnippet = context.startMetapostSnippet +local stopMetapostSnippet = context.stopMetapostSnippet + +local MetapostSnippetConstructor = verbatim.MetapostSnippetConstructor +local MetapostSnippetBoundary = verbatim.MetapostSnippetBoundary +local MetapostSnippetSpecial = verbatim.MetapostSnippetSpecial +local MetapostSnippetComment = verbatim.MetapostSnippetComment +local MetapostSnippetNamePrimitive = verbatim.MetapostSnippetNamePrimitive +local MetapostSnippetNamePlain = verbatim.MetapostSnippetNamePlain +local MetapostSnippetNameMetafun = verbatim.MetapostSnippetNameMetafun +local MetapostSnippetName = verbatim.MetapostSnippetName + +local function visualizename(s) + if primitives[s] then + MetapostSnippetNamePrimitive(s) + elseif plain[s] then + MetapostSnippetNamePlain(s) + elseif metafun[s] then + MetapostSnippetNameMetafun(s) + else + MetapostSnippetName(s) + end +end + +local handler = visualizers.newhandler { + startinline = function() MetapostSnippet(false,"{") end, + stopinline = function() context("}") end, + startdisplay = function() startMetapostSnippet() end, + stopdisplay = function() stopMetapostSnippet() end , + constructor = function(s) MetapostSnippetConstructor(s) end, + boundary = function(s) MetapostSnippetBoundary(s) end, + special = function(s) MetapostSnippetSpecial(s) end, + comment = function(s) MetapostSnippetComment(s) end, + name = visualizename, +} + +local comment = S("%") +local name = (patterns.letter + S("_"))^1 +local constructor = S("$@#") +local boundary = S('()[]:=<>;"') +local special = S("-+/*|`!?^&%.,") + +local grammar = visualizers.newgrammar("default", { "visualizer", + + comment = makepattern(handler,"comment",comment) + * (V("space") + V("content"))^0, + dstring = makepattern(handler,"special",patterns.dquote) + * makepattern(handler,"default",patterns.nodquote) + * makepattern(handler,"special",patterns.dquote), + name = makepattern(handler,"name",name), + constructor = makepattern(handler,"constructor",constructor), + boundary = makepattern(handler,"boundary",boundary), + special = makepattern(handler,"special",special), + + pattern = + V("comment") + V("dstring") + V("name") + V("constructor") + V("boundary") + V("special") + + V("newline") * V("emptyline")^0 * V("beginline") + + V("space") + + V("default"), + + visualizer = + V("pattern")^1 + +} ) + +local parser = P(grammar) + +visualizers.register("mp", { parser = parser, handler = handler, grammar = grammar } ) diff --git a/tex/context/base/v-mp.mkiv b/tex/context/base/v-mp.mkiv new file mode 100644 index 000000000..57a7aeba7 --- /dev/null +++ b/tex/context/base/v-mp.mkiv @@ -0,0 +1,68 @@ +%D \module +%D [ file=v-mp, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=\METAPOST, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{v-mp.lua}{1.001} + +\unprotect + +\definestartstop + [MetapostSnippet] + [DefaultSnippet] + +\definestartstop + [MetapostSnippetName] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [MetapostSnippetNamePrimitive] + [\c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetNamePlain] + [\c!color=darkblue, + \c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetNameMetafun] + [\c!color=darkred, + \c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetConstructor] + [\c!color=darkred, + \c!style=boldface] + +\definestartstop + [MetapostSnippetBoundary] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [MetapostSnippetSpecial] + [\c!color=darkyellow, + \c!style=boldface] + +\definestartstop + [MetapostSnippetComment] + [\c!color=darkyellow, + \c!style=boldface] + +\definetyping + [MP] + [\c!option=mp] + +\protect \endinput diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index b50799488..7bda5cade 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/26/10 21:21:25 +-- merge date : 11/26/10 22:03:31 do -- begin closure to overcome local limits and interference |