summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
blob: df3f66d0dd75b89b34aad9befcb81fe265260f7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
%--------------------------------------------
% $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
\countdef\counter=0
\catcode`\^^00=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1
\catcode`\^^01=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1
\catcode`\^^02=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1
\catcode`\^^03=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1
\catcode`\^^04=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1
\catcode`\^^05=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1
\catcode`\^^06=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1
\catcode`\^^07=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1
\catcode`\^^08=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1
\begingroup
\catcode`\^^09=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1
\begingroup
\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1
\begingroup
\catcode`\^^0b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1
\catcode`\^^0c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1
\begingroup
\catcode`\^^0d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1
\catcode`\^^0e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1
\catcode`\^^0f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1
\catcode`\^^10=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1
\catcode`\^^11=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1
\catcode`\^^12=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1
\catcode`\^^13=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1
\catcode`\^^14=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1
\catcode`\^^15=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1
\catcode`\^^16=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1
\catcode`\^^17=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1
\catcode`\^^18=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1
\catcode`\^^19=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1
\catcode`\^^1a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1
\catcode`\^^1b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1
\catcode`\^^1c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1
\catcode`\^^1d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1
\catcode`\^^1e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1
\catcode`\^^1f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1
\begingroup
\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1
\catcode`\^^21=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1
\catcode`\^^22=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1
\catcode`\^^23=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1
\catcode`\^^24=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1
\catcode`\^^25=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1
\catcode`\^^26=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1
\catcode`\^^27=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1
\catcode`\^^28=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1
\catcode`\^^29=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1
\catcode`\^^2a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1
\catcode`\^^2b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1
\catcode`\^^2c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1
\catcode`\^^2d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1
\catcode`\^^2e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1
\catcode`\^^2f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1
\begingroup
\catcode`\^^30=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1
\begingroup
\catcode`\^^31=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1
\begingroup
\catcode`\^^32=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1
\begingroup
\catcode`\^^33=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1
\begingroup
\catcode`\^^34=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1
\begingroup
\catcode`\^^35=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1
\begingroup
\catcode`\^^36=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1
\begingroup
\catcode`\^^37=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1
\begingroup
\catcode`\^^38=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1
\begingroup
\catcode`\^^39=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1
\catcode`\^^3a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1
\catcode`\^^3b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1
\catcode`\^^3c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1
\begingroup
\catcode`\^^3d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1
\catcode`\^^3e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1
\catcode`\^^3f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1
\catcode`\^^40=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1
\catcode`\^^41=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1
\catcode`\^^42=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1
\catcode`\^^43=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1
\catcode`\^^44=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1
\catcode`\^^45=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1
\catcode`\^^46=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1
\catcode`\^^47=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1
\catcode`\^^48=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1
\catcode`\^^49=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1
\catcode`\^^4a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1
\catcode`\^^4b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1
\catcode`\^^4c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1
\catcode`\^^4d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1
\catcode`\^^4e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1
\catcode`\^^4f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1
\catcode`\^^50=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1
\catcode`\^^51=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1
\catcode`\^^52=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1
\catcode`\^^53=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1
\catcode`\^^54=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1
\catcode`\^^55=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1
\catcode`\^^56=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1
\catcode`\^^57=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1
\catcode`\^^58=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1
\catcode`\^^59=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1
\catcode`\^^5a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1
\catcode`\^^5b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1
\begingroup
\catcode`\|=0
\catcode`\\=11	|expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1
\catcode`\^^5d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1
\begingroup
\catcode`\^^5e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1
\catcode`\^^5f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1
\begingroup
\catcode`\^^60=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1
\catcode`\^^61=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1
\catcode`\^^62=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1
\catcode`\^^63=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1
\catcode`\^^64=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1
\catcode`\^^65=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1
\catcode`\^^66=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1
\catcode`\^^67=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1
\catcode`\^^68=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1
\catcode`\^^69=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1
\catcode`\^^6a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1
\catcode`\^^6b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1
\catcode`\^^6c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1
\catcode`\^^6d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1
\catcode`\^^6e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1
\catcode`\^^6f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1
\catcode`\^^70=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1
\catcode`\^^71=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1
\catcode`\^^72=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1
\catcode`\^^73=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1
\catcode`\^^74=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1
\catcode`\^^75=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1
\catcode`\^^76=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1
\catcode`\^^77=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1
\catcode`\^^78=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1
\catcode`\^^79=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1
\catcode`\^^7a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1
\begingroup
\catcode`\q=1
\catcode`\^^7b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1
\catcode`\^^7c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1
\begingroup
\catcode`\q=2
\catcode`\^^7d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1
\catcode`\^^7e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1
\catcode`\^^7f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1
\catcode`\^^80=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1
\catcode`\^^81=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1
\catcode`\^^82=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1
\catcode`\^^83=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1
\catcode`\^^84=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1
\catcode`\^^85=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1
\catcode`\^^86=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1
\catcode`\^^87=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1
\catcode`\^^88=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1
\catcode`\^^89=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1
\catcode`\^^8a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1
\catcode`\^^8b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1
\catcode`\^^8c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1
\catcode`\^^8d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1
\catcode`\^^8e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1
\catcode`\^^8f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1
\catcode`\^^90=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1
\catcode`\^^91=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1
\catcode`\^^92=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1
\catcode`\^^93=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1
\catcode`\^^94=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1
\catcode`\^^95=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1
\catcode`\^^96=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1
\catcode`\^^97=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1
\catcode`\^^98=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1
\catcode`\^^99=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1
\catcode`\^^9a=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1
\catcode`\^^9b=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1
\catcode`\^^9c=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1
\catcode`\^^9d=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1
\catcode`\^^9e=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1
\catcode`\^^9f=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1
\catcode`\^^a0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1
\catcode`\^^a1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1
\catcode`\^^a2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1
\catcode`\^^a3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1
\catcode`\^^a4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1
\catcode`\^^a5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1
\catcode`\^^a6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1
\catcode`\^^a7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1
\catcode`\^^a8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1
\catcode`\^^a9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1
\catcode`\^^aa=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1
\catcode`\^^ab=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1
\catcode`\^^ac=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1
\catcode`\^^ad=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1
\catcode`\^^ae=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1
\catcode`\^^af=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1
\catcode`\^^b0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1
\catcode`\^^b1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1
\catcode`\^^b2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1
\catcode`\^^b3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1
\catcode`\^^b4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1
\catcode`\^^b5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1
\catcode`\^^b6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1
\catcode`\^^b7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1
\catcode`\^^b8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1
\catcode`\^^b9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1
\catcode`\^^ba=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1
\catcode`\^^bb=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1
\catcode`\^^bc=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1
\catcode`\^^bd=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1
\catcode`\^^be=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1
\catcode`\^^bf=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1
\catcode`\^^c0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1
\catcode`\^^c1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1
\catcode`\^^c2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1
\catcode`\^^c3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1
\catcode`\^^c4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1
\catcode`\^^c5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1
\catcode`\^^c6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1
\catcode`\^^c7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1
\catcode`\^^c8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1
\catcode`\^^c9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1
\catcode`\^^ca=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1
\catcode`\^^cb=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1
\catcode`\^^cc=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1
\catcode`\^^cd=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1
\catcode`\^^ce=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1
\catcode`\^^cf=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1
\catcode`\^^d0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1
\catcode`\^^d1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1
\catcode`\^^d2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1
\catcode`\^^d3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1
\catcode`\^^d4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1
\catcode`\^^d5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1
\catcode`\^^d6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1
\catcode`\^^d7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1
\catcode`\^^d8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1
\catcode`\^^d9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1
\catcode`\^^da=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1
\catcode`\^^db=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1
\catcode`\^^dc=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1
\catcode`\^^dd=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1
\catcode`\^^de=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1
\catcode`\^^df=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1
\catcode`\^^e0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1
\catcode`\^^e1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1
\catcode`\^^e2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1
\catcode`\^^e3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1
\catcode`\^^e4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1
\catcode`\^^e5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1
\catcode`\^^e6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1
\catcode`\^^e7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1
\catcode`\^^e8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1
\catcode`\^^e9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1
\catcode`\^^ea=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1
\catcode`\^^eb=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1
\catcode`\^^ec=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1
\catcode`\^^ed=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1
\catcode`\^^ee=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1
\catcode`\^^ef=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1
\catcode`\^^f0=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1
\catcode`\^^f1=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1
\catcode`\^^f2=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1
\catcode`\^^f3=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1
\catcode`\^^f4=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1
\catcode`\^^f5=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1
\catcode`\^^f6=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1
\catcode`\^^f7=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1
\catcode`\^^f8=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1
\catcode`\^^f9=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1
\catcode`\^^fa=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1
\catcode`\^^fb=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1
\catcode`\^^fc=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1
\catcode`\^^fd=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1
\catcode`\^^fe=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1
\catcode`\^^ff=11	\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1
\ifnum\counter=256
\else
	\pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.}
\fi
\endgroup

% Returns a single character, which has the
% binary ASCII code '#1', with catcode 11.
%
% #1 (expands to) a number between 0 and 255 (inclusive).
%
% @see \pgfplotsgetchar Note that \pgfplotsgetchar is more powerful,
% but can't be used inside of \edef (it is not expandable) whereas
% \pgfplotscharno is.
\def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}%

% Defines \pgfplotsretval to be the ASCII character for #1, with
% catcode 11.
%
% #1: either a number between 0 and 255 (inclusive) or a description
% of the character.
%
% Examples:
% \pgfplotsgetchar{35}
% \pgfplotsgetchar{`\#}   % code for '#'
% \pgfplotsgetchar{`\^^M} % Newline
% \pgfplotsgetchar{`\^^ff}% 255
%
% @see \pgfplotscharno
\def\pgfplotsgetchar#1{%
	\begingroup
	\count0=#1\relax
	\edef\pgfplotsretval{\csname pgfp@bin@\the\count0 \endcsname}%
	\pgfmath@smuggleone\pgfplotsretval
	\endgroup
}%

\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