m-pstricks.mkiv /size: 2414 b    last modification: 2021-10-28 13:51
1%D \module
2%D   [       file=m-pstricks,
3%D        version=2010.03.14,
4%D          title=\CONTEXT\ Extra Modules,
5%D       subtitle=\PSTRICKS\ Connections,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D We don't support \PSTRICKS\ in \LMTX. In \MKIV\ it was already doen by calling
15%D \PDFTEX\ and going the \POSTSCRIPT\ route. We could actually support it sort of
16%D integrated if it were just graphics but I suppose fonts will make it a mess not
17%D worth the trouble. One can always use \MKII\ directly if needed to make graphics
18%D that get included as \PDF.
19
20\ifcase\contextlmtxmode \else
21    \writestatus{modules}{the PStricks graphic system is not supported in LMTX}
22    \expandafter \endinput
23\fi
24
25\registerctxluafile{m-pstricks}{}
26
27\unprotect
28
29% best we can make a special colors module
30%
31% \let\@unused\plussixteen
32% \let\alloc@ \gobblefivearguments
33%
34% \def\loadpstrickscolors#1%
35%   {\pushmacro\dodefinecolor
36%    \pushmacro\dodefinepalet
37%    \pushmacro\dodefinecolorgroup
38%    \def\dodefinecolor[##1][##2]%
39%      {\doifassignmentelse{##2}
40%         {\getparameters[pstricks][r=0,g=0,b=0,##2]%
41%          \expanded{\newrgbcolor{##1}{{\pstricksr} {\pstricksg} {\pstricksb}}}}%
42%         {}}%
43%    \def\dodefinepalet     [##1][##2]{}%
44%    \def\dodefinecolorgroup[##1][##2][##3]{}%
45%    \writestatus{pstricks}{loading colors from #1}%
46%    \input #1 \relax
47%    \popmacro\dodefinecolorgroup
48%    \popmacro\dodefinepalet
49%    \popmacro\dodefinecolor}
50%
51% \input multido  \relax
52% \input pstricks \relax
53% \input pst-plot \relax
54%
55% \loadpstrickscolors{colo-rgb}
56
57\definebuffer[PSTRICKS]
58
59\unexpanded\def\processPSTRICKS      {\ctxlua{moduledata.pstricks.process(\thebuffernumber{PSTRICKS})}}
60\unexpanded\def\usePSTRICKSmodule[#1]{\ctxlua{moduledata.pstricks.usemodule("#1")}}
61\unexpanded\def\setPSTRICKS        #1{\setbuffer[def-\thebuffernumber{PSTRICKS}]#1\endbuffer}
62
63\let\stopPSTRICKS\processPSTRICKS
64
65%D \starttyping
66%D \usemodule[pstricks]
67%D \usePSTRICKSmodule[pst-barcode]
68%D
69%D \startPSTRICKS
70%D     \pspicture(-4mm,-1mm)(38mm,26mm)
71%D         \psbarcode{9781860742712}{includetext guardwhitespace}{ean13}%
72%D     \endpspicture
73%D \stopPSTRICKS
74%D \stoptyping
75
76\protect \endinput
77