summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex802
1 files changed, 802 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
new file mode 100644
index 00000000000..7229bc36d58
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
@@ -0,0 +1,802 @@
+%--------------------------------------------
+% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/util/pgfplotsbinary.code.tex,v 1.13 2009/07/21 18:18:48 ludewich Exp $
+%
+% Package pgfplots
+%
+% Provides a user-friendly interface to create function plots (normal
+% plots, semi-logplots and double-logplots).
+%
+% It is based on Till Tantau's PGF package.
+%
+% Copyright 2007/2008 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%--------------------------------------------
+
+% This file provides a self-contained package which does only need
+% pgfkeys.
+%
+% It provides a method to convert TeX numbers (integers and
+% dimensions) into binary format (macros with catcode 11 or 12).
+%
+
+\edef\pgfplotsbinaryatcode{\the\catcode`\@ }
+\catcode`\@=11
+
+\begingroup
+% prepare ONE-BYTE conversion [0-255] -> binary character:
+\count0=0
+\catcode`\^^00=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^00}\advance\count0 by1
+\catcode`\^^01=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^01}\advance\count0 by1
+\catcode`\^^02=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^02}\advance\count0 by1
+\catcode`\^^03=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^03}\advance\count0 by1
+\catcode`\^^04=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^04}\advance\count0 by1
+\catcode`\^^05=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^05}\advance\count0 by1
+\catcode`\^^06=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^06}\advance\count0 by1
+\catcode`\^^07=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^07}\advance\count0 by1
+\catcode`\^^08=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^08}\advance\count0 by1
+\begingroup
+\catcode`\^^09=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^09}\endgroup\advance\count0 by1
+\begingroup
+\catcode`\^^0a=12\expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0a}\endgroup\advance\count0 by1
+\begingroup
+\catcode`\^^0b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0b}\endgroup\advance\count0 by1
+\catcode`\^^0c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0c}\advance\count0 by1
+\begingroup
+\catcode`\^^0d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0d}\endgroup\advance\count0 by1
+\catcode`\^^0e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0e}\advance\count0 by1
+\catcode`\^^0f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0f}\advance\count0 by1
+\catcode`\^^10=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^10}\advance\count0 by1
+\catcode`\^^11=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^11}\advance\count0 by1
+\catcode`\^^12=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^12}\advance\count0 by1
+\catcode`\^^13=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^13}\advance\count0 by1
+\catcode`\^^14=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^14}\advance\count0 by1
+\catcode`\^^15=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^15}\advance\count0 by1
+\catcode`\^^16=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^16}\advance\count0 by1
+\catcode`\^^17=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^17}\advance\count0 by1
+\catcode`\^^18=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^18}\advance\count0 by1
+\catcode`\^^19=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^19}\advance\count0 by1
+\catcode`\^^1a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1a}\advance\count0 by1
+\catcode`\^^1b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1b}\advance\count0 by1
+\catcode`\^^1c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1c}\advance\count0 by1
+\catcode`\^^1d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1d}\advance\count0 by1
+\catcode`\^^1e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1e}\advance\count0 by1
+\catcode`\^^1f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1f}\advance\count0 by1
+\begingroup
+\catcode`\^^20=12^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\count0^^I\endcsname{^^20}\endgroup\advance\count0 by1
+\catcode`\^^21=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^21}\advance\count0 by1
+\catcode`\^^22=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^22}\advance\count0 by1
+\catcode`\^^23=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^23}\advance\count0 by1
+\catcode`\^^24=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^24}\advance\count0 by1
+\catcode`\^^25=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^25}\advance\count0 by1
+\catcode`\^^26=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^26}\advance\count0 by1
+\catcode`\^^27=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^27}\advance\count0 by1
+\catcode`\^^28=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^28}\advance\count0 by1
+\catcode`\^^29=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^29}\advance\count0 by1
+\catcode`\^^2a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2a}\advance\count0 by1
+\catcode`\^^2b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2b}\advance\count0 by1
+\catcode`\^^2c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2c}\advance\count0 by1
+\catcode`\^^2d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2d}\advance\count0 by1
+\catcode`\^^2e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2e}\advance\count0 by1
+\catcode`\^^2f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2f}\advance\count0 by1
+\catcode`\^^30=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^30}\advance\count0 by1
+\catcode`\^^31=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^31}\advance\count0 by1
+\catcode`\^^32=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^32}\advance\count0 by1
+\catcode`\^^33=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^33}\advance\count0 by1
+\catcode`\^^34=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^34}\advance\count0 by1
+\catcode`\^^35=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^35}\advance\count0 by1
+\catcode`\^^36=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^36}\advance\count0 by1
+\catcode`\^^37=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^37}\advance\count0 by1
+\catcode`\^^38=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^38}\advance\count0 by1
+\catcode`\^^39=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^39}\advance\count0 by1
+\catcode`\^^3a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3a}\advance\count0 by1
+\catcode`\^^3b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3b}\advance\count0 by1
+\catcode`\^^3c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3c}\advance\count0 by1
+\catcode`\^^3d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3d}\advance\count0 by1
+\catcode`\^^3e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3e}\advance\count0 by1
+\catcode`\^^3f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3f}\advance\count0 by1
+\catcode`\^^40=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^40}\advance\count0 by1
+\catcode`\^^41=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^41}\advance\count0 by1
+\catcode`\^^42=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^42}\advance\count0 by1
+\catcode`\^^43=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^43}\advance\count0 by1
+\catcode`\^^44=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^44}\advance\count0 by1
+\catcode`\^^45=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^45}\advance\count0 by1
+\catcode`\^^46=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^46}\advance\count0 by1
+\catcode`\^^47=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^47}\advance\count0 by1
+\catcode`\^^48=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^48}\advance\count0 by1
+\catcode`\^^49=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^49}\advance\count0 by1
+\catcode`\^^4a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4a}\advance\count0 by1
+\catcode`\^^4b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4b}\advance\count0 by1
+\catcode`\^^4c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4c}\advance\count0 by1
+\catcode`\^^4d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4d}\advance\count0 by1
+\catcode`\^^4e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4e}\advance\count0 by1
+\catcode`\^^4f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4f}\advance\count0 by1
+\catcode`\^^50=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^50}\advance\count0 by1
+\catcode`\^^51=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^51}\advance\count0 by1
+\catcode`\^^52=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^52}\advance\count0 by1
+\catcode`\^^53=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^53}\advance\count0 by1
+\catcode`\^^54=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^54}\advance\count0 by1
+\catcode`\^^55=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^55}\advance\count0 by1
+\catcode`\^^56=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^56}\advance\count0 by1
+\catcode`\^^57=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^57}\advance\count0 by1
+\catcode`\^^58=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^58}\advance\count0 by1
+\catcode`\^^59=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^59}\advance\count0 by1
+\catcode`\^^5a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5a}\advance\count0 by1
+\catcode`\^^5b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5b}\advance\count0 by1
+\begingroup
+\catcode`\|=0
+\catcode`\\=12 |expandafter|xdef|csname pgfp@bin@|the|count0 |endcsname{^^5c}|endgroup\advance\count0 by1
+\catcode`\^^5d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5d}\advance\count0 by1
+\begingroup
+\catcode`\^^5e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^}\endgroup\advance\count0 by1
+\catcode`\^^5f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5f}\advance\count0 by1
+\catcode`\^^60=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^60}\advance\count0 by1
+\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^61}\advance\count0 by1
+\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^62}\advance\count0 by1
+\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^63}\advance\count0 by1
+\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^64}\advance\count0 by1
+\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^65}\advance\count0 by1
+\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^66}\advance\count0 by1
+\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^67}\advance\count0 by1
+\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^68}\advance\count0 by1
+\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^69}\advance\count0 by1
+\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6a}\advance\count0 by1
+\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6b}\advance\count0 by1
+\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6c}\advance\count0 by1
+\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6d}\advance\count0 by1
+\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6e}\advance\count0 by1
+\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6f}\advance\count0 by1
+\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^70}\advance\count0 by1
+\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^71}\advance\count0 by1
+\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^72}\advance\count0 by1
+\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^73}\advance\count0 by1
+\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^74}\advance\count0 by1
+\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^75}\advance\count0 by1
+\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^76}\advance\count0 by1
+\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^77}\advance\count0 by1
+\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^78}\advance\count0 by1
+\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^79}\advance\count0 by1
+\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7a}\advance\count0 by1
+\begingroup
+\catcode`\q=1
+\catcode`\^^7b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname q^^7b}\endgroup\advance\count0 by1
+\catcode`\^^7c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7c}\advance\count0 by1
+\begingroup
+\catcode`\q=2
+\catcode`\^^7d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7dq\endgroup\advance\count0 by1
+\catcode`\^^7e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7e}\advance\count0 by1
+\catcode`\^^7f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7f}\advance\count0 by1
+\catcode`\^^80=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^80}\advance\count0 by1
+\catcode`\^^81=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^81}\advance\count0 by1
+\catcode`\^^82=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^82}\advance\count0 by1
+\catcode`\^^83=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^83}\advance\count0 by1
+\catcode`\^^84=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^84}\advance\count0 by1
+\catcode`\^^85=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^85}\advance\count0 by1
+\catcode`\^^86=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^86}\advance\count0 by1
+\catcode`\^^87=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^87}\advance\count0 by1
+\catcode`\^^88=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^88}\advance\count0 by1
+\catcode`\^^89=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^89}\advance\count0 by1
+\catcode`\^^8a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8a}\advance\count0 by1
+\catcode`\^^8b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8b}\advance\count0 by1
+\catcode`\^^8c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8c}\advance\count0 by1
+\catcode`\^^8d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8d}\advance\count0 by1
+\catcode`\^^8e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8e}\advance\count0 by1
+\catcode`\^^8f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8f}\advance\count0 by1
+\catcode`\^^90=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^90}\advance\count0 by1
+\catcode`\^^91=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^91}\advance\count0 by1
+\catcode`\^^92=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^92}\advance\count0 by1
+\catcode`\^^93=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^93}\advance\count0 by1
+\catcode`\^^94=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^94}\advance\count0 by1
+\catcode`\^^95=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^95}\advance\count0 by1
+\catcode`\^^96=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^96}\advance\count0 by1
+\catcode`\^^97=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^97}\advance\count0 by1
+\catcode`\^^98=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^98}\advance\count0 by1
+\catcode`\^^99=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^99}\advance\count0 by1
+\catcode`\^^9a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9a}\advance\count0 by1
+\catcode`\^^9b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9b}\advance\count0 by1
+\catcode`\^^9c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9c}\advance\count0 by1
+\catcode`\^^9d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9d}\advance\count0 by1
+\catcode`\^^9e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9e}\advance\count0 by1
+\catcode`\^^9f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9f}\advance\count0 by1
+\catcode`\^^a0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a0}\advance\count0 by1
+\catcode`\^^a1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a1}\advance\count0 by1
+\catcode`\^^a2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a2}\advance\count0 by1
+\catcode`\^^a3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a3}\advance\count0 by1
+\catcode`\^^a4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a4}\advance\count0 by1
+\catcode`\^^a5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a5}\advance\count0 by1
+\catcode`\^^a6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a6}\advance\count0 by1
+\catcode`\^^a7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a7}\advance\count0 by1
+\catcode`\^^a8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a8}\advance\count0 by1
+\catcode`\^^a9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a9}\advance\count0 by1
+\catcode`\^^aa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^aa}\advance\count0 by1
+\catcode`\^^ab=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ab}\advance\count0 by1
+\catcode`\^^ac=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ac}\advance\count0 by1
+\catcode`\^^ad=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ad}\advance\count0 by1
+\catcode`\^^ae=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ae}\advance\count0 by1
+\catcode`\^^af=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^af}\advance\count0 by1
+\catcode`\^^b0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b0}\advance\count0 by1
+\catcode`\^^b1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b1}\advance\count0 by1
+\catcode`\^^b2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b2}\advance\count0 by1
+\catcode`\^^b3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b3}\advance\count0 by1
+\catcode`\^^b4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b4}\advance\count0 by1
+\catcode`\^^b5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b5}\advance\count0 by1
+\catcode`\^^b6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b6}\advance\count0 by1
+\catcode`\^^b7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b7}\advance\count0 by1
+\catcode`\^^b8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b8}\advance\count0 by1
+\catcode`\^^b9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b9}\advance\count0 by1
+\catcode`\^^ba=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ba}\advance\count0 by1
+\catcode`\^^bb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bb}\advance\count0 by1
+\catcode`\^^bc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bc}\advance\count0 by1
+\catcode`\^^bd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bd}\advance\count0 by1
+\catcode`\^^be=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^be}\advance\count0 by1
+\catcode`\^^bf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bf}\advance\count0 by1
+\catcode`\^^c0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c0}\advance\count0 by1
+\catcode`\^^c1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c1}\advance\count0 by1
+\catcode`\^^c2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c2}\advance\count0 by1
+\catcode`\^^c3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c3}\advance\count0 by1
+\catcode`\^^c4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c4}\advance\count0 by1
+\catcode`\^^c5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c5}\advance\count0 by1
+\catcode`\^^c6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c6}\advance\count0 by1
+\catcode`\^^c7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c7}\advance\count0 by1
+\catcode`\^^c8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c8}\advance\count0 by1
+\catcode`\^^c9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c9}\advance\count0 by1
+\catcode`\^^ca=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ca}\advance\count0 by1
+\catcode`\^^cb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cb}\advance\count0 by1
+\catcode`\^^cc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cc}\advance\count0 by1
+\catcode`\^^cd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cd}\advance\count0 by1
+\catcode`\^^ce=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ce}\advance\count0 by1
+\catcode`\^^cf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cf}\advance\count0 by1
+\catcode`\^^d0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d0}\advance\count0 by1
+\catcode`\^^d1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d1}\advance\count0 by1
+\catcode`\^^d2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d2}\advance\count0 by1
+\catcode`\^^d3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d3}\advance\count0 by1
+\catcode`\^^d4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d4}\advance\count0 by1
+\catcode`\^^d5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d5}\advance\count0 by1
+\catcode`\^^d6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d6}\advance\count0 by1
+\catcode`\^^d7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d7}\advance\count0 by1
+\catcode`\^^d8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d8}\advance\count0 by1
+\catcode`\^^d9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d9}\advance\count0 by1
+\catcode`\^^da=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^da}\advance\count0 by1
+\catcode`\^^db=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^db}\advance\count0 by1
+\catcode`\^^dc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dc}\advance\count0 by1
+\catcode`\^^dd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dd}\advance\count0 by1
+\catcode`\^^de=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^de}\advance\count0 by1
+\catcode`\^^df=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^df}\advance\count0 by1
+\catcode`\^^e0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e0}\advance\count0 by1
+\catcode`\^^e1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e1}\advance\count0 by1
+\catcode`\^^e2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e2}\advance\count0 by1
+\catcode`\^^e3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e3}\advance\count0 by1
+\catcode`\^^e4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e4}\advance\count0 by1
+\catcode`\^^e5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e5}\advance\count0 by1
+\catcode`\^^e6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e6}\advance\count0 by1
+\catcode`\^^e7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e7}\advance\count0 by1
+\catcode`\^^e8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e8}\advance\count0 by1
+\catcode`\^^e9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e9}\advance\count0 by1
+\catcode`\^^ea=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ea}\advance\count0 by1
+\catcode`\^^eb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^eb}\advance\count0 by1
+\catcode`\^^ec=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ec}\advance\count0 by1
+\catcode`\^^ed=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ed}\advance\count0 by1
+\catcode`\^^ee=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ee}\advance\count0 by1
+\catcode`\^^ef=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ef}\advance\count0 by1
+\catcode`\^^f0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f0}\advance\count0 by1
+\catcode`\^^f1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f1}\advance\count0 by1
+\catcode`\^^f2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f2}\advance\count0 by1
+\catcode`\^^f3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f3}\advance\count0 by1
+\catcode`\^^f4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f4}\advance\count0 by1
+\catcode`\^^f5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f5}\advance\count0 by1
+\catcode`\^^f6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f6}\advance\count0 by1
+\catcode`\^^f7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f7}\advance\count0 by1
+\catcode`\^^f8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f8}\advance\count0 by1
+\catcode`\^^f9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f9}\advance\count0 by1
+\catcode`\^^fa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fa}\advance\count0 by1
+\catcode`\^^fb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fb}\advance\count0 by1
+\catcode`\^^fc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fc}\advance\count0 by1
+\catcode`\^^fd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fd}\advance\count0 by1
+\catcode`\^^fe=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fe}\advance\count0 by1
+\catcode`\^^ff=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ff}\advance\count0 by1
+\ifnum\count0=256
+\else
+ \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\count0\space bytes initialised.}
+\fi
+\endgroup
+
+% Returns a single character (with catcode 11 or 12), which has the
+% binary code '#1'.
+%
+% #1 is a number between 0 and 255 (inclusive).
+\def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}%
+
+
+\def\pgfplotsbinary@apphighorderbytes@BIGENDIAN#1{\xdef\pgfplotsbinaryresult{#1\pgfplotsbinaryresult}}%
+\def\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN#1{\xdef\pgfplotsbinaryresult{\pgfplotsbinaryresult#1}}%
+
+\def\pgfplotsbinaryencode@badic@unsigned@PAD@LITTLEENDIAN{%
+ % pad with zeros:
+ \ifcase\c@pgfplotsbin@byteno
+ % ok.
+ \or
+ % one byte missing.
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ % two bytes missing.
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
+ \else
+ \pgfplots@error{Sorry, I can't process byte no \the\c@pgfplotsbin@byteno... you may need to change bytes=\pgfplotsbinary@bytes.}%
+ \fi
+}%
+\def\pgfplotsbinaryencode@badic@unsigned@PAD@BIGENDIAN{%
+ % pad with zeros:
+ \ifcase\c@pgfplotsbin@byteno
+ % ok.
+ \or
+ % one byte missing.
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST}%
+ \or
+ % two bytes missing.
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \or
+ \pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \else
+ \pgfplots@error{Sorry, I can't process byte no \the\c@pgfplotsbin@byteno... you may need to change bytes=\pgfplotsbinary@bytes.}%
+ \fi
+}%
+
+\expandafter\def\csname pgfplotsbinarysetbytes@1\endcsname{%
+ \def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 127 }%
+ \def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
+ % warning: \pgfplotsbinary@bytes is NOT necessarily 1 (ASCII
+ % encoding features)
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ \divide\c@pgfplotsbin@input by16909320 % ~= (2^31-1) / (2^(8*1-1) -1)
+ }%
+}%
+\expandafter\def\csname pgfplotsbinarysetbytes@2\endcsname{%
+ \def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 32767 }%
+ \def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ \divide\c@pgfplotsbin@input by65538 % ~= (2^31-1) / (2^(8*2-1) -1)
+ }%
+}%
+\expandafter\def\csname pgfplotsbinarysetbytes@3\endcsname{%
+ \def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 8388607 }%
+ \def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ \divide\c@pgfplotsbin@input by256 % ~= (2^31-1) / (2^(8*3-1) -1)
+ }%
+}%
+\expandafter\def\csname pgfplotsbinarysetbytes@4\endcsname{%
+ \def\pgfplotsbinary@add@signed@largest@absolute{%
+ \advance\c@pgfplotsbin@input by 2147483647 % this is the *absolute* largest int that TeX can handle.
+ }%
+ \def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ }%
+}%
+\def\pgfplotsbinarysetbytes@@{%
+ \def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ \pgfplots@error{Sorry, but I can't perform \string\pgfplotsbinaryencodesignedmaplinearly\space for bytes=\pgfplotsbinary@bytes\space yet... bytes=4 is the maximum.}%
+ }%
+ \def\pgfplotsbinary@add@signed@largest@absolute{
+ \advance\c@pgfplotsbin@input by 2147483647
+ }%
+}%
+\expandafter\let\csname pgfplotsbinary@bytes@5\endcsname=\pgfplotsbinarysetbytes@@
+\expandafter\let\csname pgfplotsbinary@bytes@6\endcsname=\pgfplotsbinarysetbytes@@
+\expandafter\let\csname pgfplotsbinary@bytes@7\endcsname=\pgfplotsbinarysetbytes@@
+\expandafter\let\csname pgfplotsbinary@bytes@8\endcsname=\pgfplotsbinarysetbytes@@
+
+\pgfqkeys{/pgfplots/bin}{%
+ % ordering not yet implemented; uses always BIG ENDIAN.
+ ordering/.is choice,%
+ ordering/big endian/.code={%
+ \def\pgfplotsbinary@byteorder{0}%
+ \let\pgfplotsbinary@apphighorderbytes=\pgfplotsbinary@apphighorderbytes@BIGENDIAN
+ \let\pgfplotsbinaryencode@badic@unsigned@PAD=\pgfplotsbinaryencode@badic@unsigned@PAD@BIGENDIAN
+ },%
+ ordering/net/.style={/pgfplots/bin/ordering/big endian},%
+ ordering/little endian/.code={%
+ \def\pgfplotsbinary@byteorder{1}%
+ \let\pgfplotsbinary@apphighorderbytes=\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN
+ \let\pgfplotsbinaryencode@badic@unsigned@PAD=\pgfplotsbinaryencode@badic@unsigned@PAD@LITTLEENDIAN
+ },
+ ordering/big endian,%
+ %
+ % The standard method - it results in binary encoded numbers.
+ binary encoding/.code={%
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@0\endcsname
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@128\endcsname
+ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
+ \def\pgfplotsbinary@basis{256}%
+ \let\pgfplotsbinary@hook=\relax
+ \def\pgfplotsbinary@hook@signed@linearmap{%
+ \ifnum\c@pgfplotsbin@byteno=0
+ \advance\c@pgfplotsbin@input by128
+ \ifnum\c@pgfplotsbin@input>255
+ \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \fi
+ \fi
+ }%
+ \def\pgfplotsbinarysetbytes##1{%
+ \pgfutil@ifundefined{pgfplotsbinarysetbytes@##1}{%
+ \pgfplots@error{Sorry, I can't write binary output with '##1' bytes yet...}%
+ }{%
+ \edef\pgfplotsbinary@bytes{##1}%
+ \csname pgfplotsbinarysetbytes@##1\endcsname
+ }%
+ }%
+ },%
+ %
+ % This applies 'binary encoding' and encodes the resulting bytes
+ % in Hex. It corresponds to the ASCIIHexEncode in postscript or
+ % pdf.
+ % Please note that 'bytes' sets the number of binary bytes - the
+ % actual encoding length is exactly twice as large.
+ ASCIIHexEncode/.code={%
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@48\endcsname
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@56\endcsname
+ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
+ \pgfkeysalso{/pgfplots/bin/ordering/big endian}%
+ \def\pgfplotsbinary@basis{16}%
+ \def\pgfplotsbinary@hook@hex{%
+ \ifnum\c@pgfplotsbin@input<10
+ \advance\c@pgfplotsbin@input by48
+ \else
+ \advance\c@pgfplotsbin@input by55
+ \fi
+ }%
+ \let\pgfplotsbinary@hook=\pgfplotsbinary@hook@hex
+ \def\pgfplotsbinary@hook@signed@linearmap{%
+ \ifnum\c@pgfplotsbin@byteno=0
+ \advance\c@pgfplotsbin@input by8
+ \ifnum\c@pgfplotsbin@input>16
+ \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \fi
+ \fi
+ \pgfplotsbinary@hook@hex
+ }%
+ \def\pgfplotsbinarysetbytes##1{%
+ \pgfutil@ifundefined{pgfplotsbinarysetbytes@##1}{%
+ \pgfplots@error{Sorry, I can't write binary output with '##1' bytes yet...}%
+ }{%
+ \csname pgfplotsbinarysetbytes@##1\endcsname
+ \begingroup
+ \count0=##1\relax
+ \multiply\count0 by2
+ \xdef\pgfplotsbinary@glob@TMP{\the\count0 }%
+ \endgroup
+ \let\pgfplotsbinary@bytes=\pgfplotsbinary@glob@TMP
+ }%
+ }%
+ },%
+ %
+ %
+ % This applies 'binary encoding' and encodes the resulting bytes
+ % using a base 85 encoding. It corresponds to the ASCII85Encode in postscript or
+ % pdf.
+ % Handle this method with care - it works just for ONE number, not for a stream of
+ % numbers as in pdf. Therefore, it might not be useful at all.
+ % Please note that 'bytes' will be ignored; ASCII85Encode assumes
+ % 4 binary bytes and uses 5 bytes to encode them.
+ %
+ % @ATTENTION bytes is ALWAYS 4, regardless of the setting of
+ % 'bytes'!
+ ASCII85Encode/.code={%
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@33\endcsname
+ \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@42\endcsname
+ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
+ \pgfkeysalso{/pgfplots/bin/ordering/big endian}%
+ \edef\pgfplotsbinary@ASCII@specialzero{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
+ \expandafter\def\expandafter\pgfplotsbinaryencode@badic@unsigned@PAD\expandafter{%
+ \pgfplotsbinaryencode@badic@unsigned@PAD
+ \ifx\pgfplotsbinaryresult\pgfplotsbinary@ASCII@specialzero
+ % PDF standard: 0 is encoded as 'z':
+ \gdef\pgfplotsbinaryresult{z}%
+ \fi
+ }%
+ \def\pgfplotsbinary@basis{85}%
+ \def\pgfplotsbinary@hook{%
+ \advance\c@pgfplotsbin@input by33
+ }%
+ \def\pgfplotsbinary@hook@signed@linearmap{%
+ \advance\c@pgfplotsbin@input by33
+ \ifnum\c@pgfplotsbin@byteno=0
+ \advance\c@pgfplotsbin@input by42
+ \ifnum\c@pgfplotsbin@input>85
+ \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \fi
+ \fi
+ }%
+ % I know, that does only work efficiently if bytes=4 for every
+ % encoded number.
+ \def\pgfplotsbinarysetbytes##1{%
+ \def\pgfplotsbinary@bytes{5}%
+ \csname pgfplotsbinarysetbytes@4\endcsname
+ }%
+ \pgfplotsbinarysetbytes4%
+ },%
+ binary encoding,%
+ %
+ bytes/.code={\pgfplotsbinarysetbytes{#1}},%
+ bytes=4,
+ %
+ % Irreversibly change to VERBATIM output for debugging:
+ debug mode/.code={%
+ \let\pgfplotsbinary@apphighorderbytes@ORIG=\pgfplotsbinary@apphighorderbytes
+ \def\pgfplotsbinary@ZERO{[Pad-0]}%
+ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
+ \def\pgfplotsbinary@ZERO@LINEARMAP{[Pad-128]}%
+ \def\pgfplotsbinary@apphighorderbytes##1{%
+ \pgfutil@ifnextchar\csname{%
+ \pgfplotsbinary@apphighorderbytes@DEBUG@csname
+ }{%
+ \pgfplotsbinary@apphighorderbytes@DEBUG@normal
+ }%
+ ##1\relax
+ }%
+ },%
+ % Write pdf objects in binary form. This does only work with
+ % pdftex, and its output is only useful in conjunction with
+ % \pdfcompresslevel=0
+ % and a text editor.
+ % Usage:
+ % \pgfkeys{/pgfplots/bin/debug to pdf={\pgfplotsbinaryencodeunsigned}{1,2,3,...,16}}
+ %
+ % works only with pdftex
+ debug to pdf/.code 2 args={%
+ \foreach \num in {#2} {%
+ #1{\num}%
+ \immediate \pdfobj stream attr {
+ /Decimal \num\space
+ /Routine (\string#1)
+ } {%
+ \pgfplotsbinaryresult
+ }%
+ }%
+ },%
+}
+
+
+
+\def\pgfplotsbinary@apphighorderbytes@DEBUG@csname \csname pgfp@bin@#1\endcsname\relax{%
+ \pgfplotsbinary@apphighorderbytes@ORIG{[#1]}%
+}%
+\def\pgfplotsbinary@apphighorderbytes@DEBUG@normal#1\relax{%
+ \pgfplotsbinary@apphighorderbytes@ORIG{#1}%
+}%
+
+%\pgfkeys{/pgfplots/bin/debug mode}
+
+
+\countdef\c@pgfplotsbin@input=0
+\countdef\c@pgfplotsbin@tmpa=1
+\countdef\c@pgfplotsbin@tmpb=2
+\countdef\c@pgfplotsbin@byteno=3
+\countdef\c@pgfplotsbin@basis=4
+\def\pgfplotsbinaryempty{}
+
+%--------------------------------------------------
+% input: unsigned int x, b, n;
+% output: unsigned int y[n];
+% for (i=0; i<n; i++) y[i] = 0;
+% i=0;
+% while (x > 0)
+% { y[i] = x % b; /* entspricht x mod b */
+% x = x / b; /* ganzzahlige Division */
+% i++;
+% }
+%--------------------------------------------------
+% with x = #1
+% b = basis
+% will store stuff into \pgfplotsbinaryresult in binary format
+%
+% PRECONDITION:
+% - \pgfplotsbinaryresult= empty!
+% - \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes
+\def\pgfplotsbinaryencode@badic@unsigned@{%
+ \ifnum\c@pgfplotsbin@input>0
+ \c@pgfplotsbin@tmpa=\c@pgfplotsbin@input
+ \divide\c@pgfplotsbin@tmpa by\c@pgfplotsbin@basis\relax
+ \c@pgfplotsbin@tmpb=\c@pgfplotsbin@tmpa\relax
+ \multiply\c@pgfplotsbin@tmpa by\c@pgfplotsbin@basis\relax
+ \advance\c@pgfplotsbin@input by -\c@pgfplotsbin@tmpa\relax
+ \advance\c@pgfplotsbin@byteno by-1
+ \pgfplotsbinary@hook% hooks for modifications.
+ \pgfplotsbinary@apphighorderbytes{\csname pgfp@bin@\the\c@pgfplotsbin@input\endcsname}%
+ \c@pgfplotsbin@input=\c@pgfplotsbin@tmpb
+%\message{RESULT SO FAR byte no \the\c@pgfplotsbin@byteno: \pgfplotsbinaryresult}%
+ \expandafter\pgfplotsbinaryencode@badic@unsigned@
+ \else
+ \pgfplotsbinaryencode@badic@unsigned@PAD
+%\message{RESULT SO FAR byte no \the\c@pgfplotsbin@byteno: \pgfplotsbinaryresult}%
+ \fi
+}%
+
+
+% Defines \pgfplotsbinaryresult to be the binary representation of an
+% unsigned integer.
+%
+% The representation will use unsigned dual number representation.
+%
+% The assignment to \pgfplotsbinaryresult will be globally.
+% #1: an unsigned integer. It won't be transformed in any way, so make
+% sure it fits into the configured number of bytes. It is an error if
+% the number is too large or too small. Please note that only unsigned
+% numbers are supported with this method.
+%
+% FIXME : fix > 2^30
+\def\pgfplotsbinaryencodeunsigned#1{%
+ \begingroup
+ \global\let\pgfplotsbinaryresult=\pgfplotsbinaryempty
+ \c@pgfplotsbin@input=#1 %
+ \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
+ \c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
+ \pgfplotsbinaryencode@badic@unsigned@%
+ \endgroup
+}%
+
+% An implementation for signed integers which maps the signed integer linearly into
+% the unsigned data range before it proceeds.
+%
+% The idea is thus, to first introduce a linear mapping
+%
+% phi : [- smallest_possible, +largest_possible ] -> [0, 256^bytes-1 ]
+%
+% A signed integer in TeX is in [ - (2^31-1), 2^31-1 ].
+% Thus, we should map
+%
+% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^32-1 ].
+%
+% A simpler case is to employ the symmetry in TeX's registers and
+% leave one out, i.e. to map to 2^32-2:
+%
+% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^32-2 ].
+%
+% Then,
+%
+% phi(x) = ( x + 2^31 -1 ) / (2^31-1 + 2^31-1) * (2^32-2) = x+ 2^31-1.
+%
+% The same map phi(x) = x + 2^31 -1 with target space [0, 2^32-1 ]
+% could be realized with the input space [- (2^31-1), 2^31 ].
+%
+% I am using this encoding procedure, phi(x) = x + 2^31 -1.
+%
+% As a consequence, the binary pattern FF FF FF FF does never occur as
+% result of the mapping.
+%
+% To invert the mapping (i.e. to decode the result), set up the unique
+% linear map
+%
+% psi : [ 0, 2^32-1 ] -> [ -(2^31-1), 2^31 ].
+%
+% Then, psi( phi(x) ) = x and the decoding procedure is correct.
+%
+% This doesn't need TeX register arithmetics on the whole range.
+%
+% REMARK: the whole operation does also work if bytes<4 (i.e. we have
+% less than 32 bits in the target range). In this case, the mapping is
+% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^{8*bytes}-1 ]
+% and a further, *lossy* quantization still will be applied. The
+% quantization step is an integer division performed in signed number
+% arithmetics (i.e. it is symmetric around 0).
+\def\pgfplotsbinaryencodesignedmaplinearly#1{%
+ \begingroup
+ \global\let\pgfplotsbinaryresult=\pgfplotsbinaryempty
+ \c@pgfplotsbin@input=#1 %
+ \pgfplotsbinaryencodesignedmaplinearly@prepare
+ \ifnum\c@pgfplotsbin@input<0
+ % compute + 2^31 - 1
+ \pgfplotsbinary@add@signed@largest@absolute
+ \else
+ % change zero padding such that positive numbers
+ % get the EFFECT of + 2^31.
+ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO@LINEARMAP
+ \let\pgfplotsbinary@hook=\pgfplotsbinary@hook@signed@linearmap
+ % and compute the -1 explicitly here:
+ \advance\c@pgfplotsbin@input by-1
+ \fi
+ \pgfplotsbinaryencode@badic@unsigned@%
+ \endgroup
+}%
+
+% Encodes a dimen (like 1pt or \dimen0) in binary form.
+%
+% The encoding works by mapping #1 linearly into the allowed integer
+% range using a quantization technique to respect the (possibly)
+% restricted number of bytes.
+%
+% The implementation is fast and uses only integer arithmetics.
+% It relies on \pgfplotsbinaryencodesignedmaplinearly and a scale.
+%
+% So, what we do is to setup a linear map into binary range with k
+% bytes. The range of a TeX dimen is precisely (in units of pt)
+% [ -(2^30-1) / 2^16, (2^30 -1) / 2^16 ] = [-16383.99998, 16383.99998]
+%
+% Thus, for an input dimen x, we set up the mapping
+% phi(x) = 2^16 * x * 2
+% which maps
+% phi: [ -(2^30-1) / 2^16, (2^30-1) / 2^16 ] -> [-(2^31 -2), 2^31-2].
+%
+% I simply use the \pgfplotsbinaryencodesignedmaplinearly to process
+% this further. To simplify the computation, I simply compute
+% phi_signed( phi(x) ),
+% where phi_signed denotes an application of
+% \pgfplotsbinaryencodesignedmaplinearly:
+% phi_signed( y ) = y +2^31 -1,
+% phi_signed( phi(x) ) = 2^16 * 2 * x + 2^31 - 1.
+% This is NOT a linear map to [0,2^32-1] as promised.
+% But, we can setup an inverse transformation PHI (which is linear) anyway
+% such that
+% PHI( phi_signed(phi(x)) ) = x
+% and that's all I want. Do do that, we use the unique linear decoder map
+% PHI : [ 0,2^32-1 ] -> [ -16383.999992, 16384 ].
+%
+% This is not exacty the input range of before, but using it results
+% in a proper decoder. The difference is due to the non-unique zero
+% representation in TeX's arithmetics.
+%
+%
+% REMARK: the whole operation does also work if bytes<4 (i.e. we have
+% less than 32 bits in the target range). In this case, a further
+% *lossy* quantization step is applied in phi_signed. The inverse
+% transformations are the same, however. See
+% \pgfplotsbinaryencodesignedmaplinearly for details about the
+% quantization step (or try it out).
+%
+ %
+ %% DEBUG NOTE: This mapping appears to work correctly according to
+ %% my tests.
+ %% For bc -l test codes:
+ %% ibase=16;
+ %% -4000 + 809658FA. / (2^20) * 8000
+\def\pgfplotsbinaryencodedimenmaplinearly#1{%
+ \begingroup
+ \dimen0=#1\relax
+ \c@pgfplotsbin@input=\dimen0
+ \multiply\c@pgfplotsbin@input by2
+%\message{LOWLEVEL ENCODING '\the\c@pgfplotsbin@input' with linear map}%
+ \pgfplotsbinaryencodesignedmaplinearly\c@pgfplotsbin@input
+ \endgroup
+}%
+
+\catcode`\@=\pgfplotsbinaryatcode
+\endinput