summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
blob: 7229bc36d580bb907e78d7a938ba89148fa7fa25 (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
%--------------------------------------------
% $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