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
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
|
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Examples — pplib 0.1 documentation</title>
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="pplib 1.x" href="ppapi-1.x.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="ppapi-1.x.html" title="pplib 1.x"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="pplib.html">pplib 0.1 documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="pplib.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Examples</a><ul>
<li><a class="reference internal" href="#example-1">Example 1</a></li>
<li><a class="reference internal" href="#example-2">Example 2</a></li>
<li><a class="reference internal" href="#example-3">Example 3</a></li>
<li><a class="reference internal" href="#ppapi-h">ppapi.h</a></li>
</ul>
</li>
<li><a class="reference internal" href="#changes">Changes</a><ul>
<li><a class="reference internal" href="#v0-97">v0.97</a></li>
<li><a class="reference internal" href="#v0-98">v0.98</a></li>
<li><a class="reference internal" href="#v0-99">v0.99</a></li>
<li><a class="reference internal" href="#v1-00">v1.00</a></li>
<li><a class="reference internal" href="#v1-01">v1.01</a></li>
<li><a class="reference internal" href="#v1-02">v1.02</a></li>
<li><a class="reference internal" href="#v1-03">v1.03</a></li>
<li><a class="reference internal" href="#v1-04">v1.04</a></li>
<li><a class="reference internal" href="#v1-05">v1.05</a></li>
<li><a class="reference internal" href="#v2-00">v2.00</a></li>
<li><a class="reference internal" href="#v2-01">v2.01</a></li>
<li><a class="reference internal" href="#v2-02">v2.02</a></li>
<li><a class="reference internal" href="#v2-03">v2.03</a></li>
<li><a class="reference internal" href="#v2-04">v2.04</a></li>
<li><a class="reference internal" href="#v2-05">v2.05</a></li>
</ul>
</li>
<li><a class="reference internal" href="#todo">TODO</a></li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="ppapi-1.x.html"
title="previous chapter"><code class="docutils literal notranslate"><span class="pre">pplib</span></code> 1.x</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ppcode.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="examples">
<h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h1>
<div class="section" id="example-1">
<h2>Example 1<a class="headerlink" href="#example-1" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
<span class="c1">#include <stdio.h></span>
<span class="c1">#include "ppapi.h"</span>
<span class="c1">#include "util/utiliof.h"</span>
<span class="n">static</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">sizenum</span> <span class="p">(</span><span class="n">size_t</span> <span class="n">s</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">static</span> <span class="n">char</span> <span class="n">buffer</span><span class="p">[</span><span class="mi">32</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="n">s</span> <span class="o"><</span> <span class="mi">1000</span><span class="p">)</span>
<span class="n">sprintf</span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span> <span class="s2">"</span><span class="si">%u</span><span class="s2">B"</span><span class="p">,</span> <span class="p">(</span><span class="n">unsigned</span><span class="p">)</span><span class="n">s</span><span class="p">);</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">s</span> <span class="o"><</span> <span class="mi">1000000</span><span class="p">)</span>
<span class="n">sprintf</span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span> <span class="s2">"</span><span class="si">%.2f</span><span class="s2">kB"</span><span class="p">,</span> <span class="p">(</span><span class="n">double</span><span class="p">)(</span><span class="n">s</span><span class="p">)</span> <span class="o">/</span> <span class="mi">1000</span><span class="p">);</span>
<span class="k">else</span>
<span class="n">sprintf</span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span> <span class="s2">"</span><span class="si">%.2f</span><span class="s2">MB"</span><span class="p">,</span> <span class="p">(</span><span class="n">double</span><span class="p">)(</span><span class="n">s</span><span class="p">)</span> <span class="o">/</span> <span class="mi">1000000</span><span class="p">);</span>
<span class="k">return</span> <span class="n">buffer</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">static</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">crypt_info</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">switch</span> <span class="p">(</span><span class="n">ppdoc_crypt_status</span><span class="p">(</span><span class="n">pdf</span><span class="p">))</span>
<span class="p">{</span>
<span class="n">case</span> <span class="n">PPCRYPT_NONE</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">"none"</span><span class="p">;</span>
<span class="n">case</span> <span class="n">PPCRYPT_DONE</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">"empty password"</span><span class="p">;</span>
<span class="n">case</span> <span class="n">PPCRYPT_PASS</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">"nonempty password"</span><span class="p">;</span>
<span class="n">default</span><span class="p">:</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="s2">"this shouldn't happen"</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">static</span> <span class="n">void</span> <span class="n">print_info</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">ppdict</span> <span class="o">*</span><span class="n">info</span><span class="p">;</span>
<span class="n">ppstring</span> <span class="o">*</span><span class="n">creator</span><span class="p">,</span> <span class="o">*</span><span class="n">producer</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">memused</span><span class="p">,</span> <span class="n">memwaste</span><span class="p">;</span>
<span class="k">if</span> <span class="p">((</span><span class="n">info</span> <span class="o">=</span> <span class="n">ppdoc_info</span><span class="p">(</span><span class="n">pdf</span><span class="p">))</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">if</span> <span class="p">((</span><span class="n">creator</span> <span class="o">=</span> <span class="n">ppdict_rget_string</span><span class="p">(</span><span class="n">info</span><span class="p">,</span> <span class="s2">"Creator"</span><span class="p">))</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">)</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" creator: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">ppstring_decoded_data</span><span class="p">(</span><span class="n">creator</span><span class="p">));</span>
<span class="k">if</span> <span class="p">((</span><span class="n">producer</span> <span class="o">=</span> <span class="n">ppdict_rget_string</span><span class="p">(</span><span class="n">info</span><span class="p">,</span> <span class="s2">"Producer"</span><span class="p">))</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">)</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" producer: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">ppstring_decoded_data</span><span class="p">(</span><span class="n">producer</span><span class="p">));</span>
<span class="p">}</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" version: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">ppdoc_version_string</span><span class="p">(</span><span class="n">pdf</span><span class="p">));</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" protection: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">crypt_info</span><span class="p">(</span><span class="n">pdf</span><span class="p">));</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" filesize: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">sizenum</span><span class="p">(</span><span class="n">ppdoc_file_size</span><span class="p">(</span><span class="n">pdf</span><span class="p">)));</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" objects: </span><span class="si">%lu</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="p">(</span><span class="n">unsigned</span> <span class="n">long</span><span class="p">)</span><span class="n">ppdoc_objects</span><span class="p">(</span><span class="n">pdf</span><span class="p">));</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" pagecount: </span><span class="si">%lu</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="p">(</span><span class="n">unsigned</span> <span class="n">long</span><span class="p">)</span><span class="n">ppdoc_page_count</span><span class="p">(</span><span class="n">pdf</span><span class="p">));</span>
<span class="n">memused</span> <span class="o">=</span> <span class="n">ppdoc_memory</span><span class="p">(</span><span class="n">pdf</span><span class="p">,</span> <span class="o">&</span><span class="n">memwaste</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" memused: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">sizenum</span><span class="p">(</span><span class="n">memused</span><span class="p">));</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">" memwaste: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">sizenum</span><span class="p">(</span><span class="n">memwaste</span><span class="p">));</span>
<span class="p">}</span>
<span class="n">static</span> <span class="nb">int</span> <span class="n">usage</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">argv0</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"pplib "</span> <span class="n">pplib_version</span> <span class="s2">", "</span> <span class="n">pplib_author</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"usage: </span><span class="si">%s</span><span class="s2"> file1.pdf file2.pdf ...</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">argv0</span><span class="p">);</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="nb">int</span> <span class="n">main</span> <span class="p">(</span><span class="nb">int</span> <span class="n">argc</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">filepath</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">a</span><span class="p">;</span>
<span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">;</span>
<span class="n">const</span> <span class="n">void</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o"><</span> <span class="mi">2</span><span class="p">)</span>
<span class="k">return</span> <span class="n">usage</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">a</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">a</span> <span class="o"><</span> <span class="n">argc</span><span class="p">;</span> <span class="o">++</span><span class="n">a</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">filepath</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="n">a</span><span class="p">];</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"loading </span><span class="si">%s</span><span class="s2">... "</span><span class="p">,</span> <span class="n">filepath</span><span class="p">);</span>
<span class="n">pdf</span> <span class="o">=</span> <span class="n">ppdoc_load</span><span class="p">(</span><span class="n">filepath</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">pdf</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"failed</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"done.</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">print_info</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">ppdoc_free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">now</span> <span class="n">loading</span> <span class="kn">from</span> <span class="nn">memory</span> <span class="n">buffer</span> <span class="o">*/</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"loading </span><span class="si">%s</span><span class="s2"> from mem buffer... "</span><span class="p">,</span> <span class="n">filepath</span><span class="p">);</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">iof_copy_file_data</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">data</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">pdf</span> <span class="o">=</span> <span class="n">ppdoc_mem</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">pdf</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"failed</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"done.</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="o">//</span><span class="n">print_info</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">ppdoc_free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="example-2">
<h2>Example 2<a class="headerlink" href="#example-2" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
<span class="c1">#include <stdio.h></span>
<span class="c1">#include <assert.h></span>
<span class="c1">#include "ppapi.h"</span>
<span class="o">/*</span>
<span class="n">static</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">get_file_name</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">path</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">fn</span><span class="p">,</span> <span class="o">*</span><span class="n">p</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="n">fn</span> <span class="o">=</span> <span class="n">p</span> <span class="o">=</span> <span class="n">path</span><span class="p">;</span> <span class="o">*</span><span class="n">p</span> <span class="o">!=</span> <span class="s1">'</span><span class="se">\0</span><span class="s1">'</span><span class="p">;</span> <span class="o">++</span><span class="n">p</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="o">*</span><span class="n">p</span> <span class="o">==</span> <span class="s1">'</span><span class="se">\\</span><span class="s1">'</span> <span class="o">||</span> <span class="o">*</span><span class="n">p</span> <span class="o">==</span> <span class="s1">'/'</span><span class="p">)</span>
<span class="n">fn</span> <span class="o">=</span> <span class="n">p</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
<span class="k">return</span> <span class="n">fn</span><span class="p">;</span>
<span class="p">}</span>
<span class="o">*/</span>
<span class="n">static</span> <span class="n">void</span> <span class="n">box_info</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="n">pagedict</span><span class="p">,</span> <span class="n">FILE</span> <span class="o">*</span><span class="n">fh</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">boxes</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"MediaBox"</span><span class="p">,</span> <span class="s2">"CropBox"</span><span class="p">,</span> <span class="s2">"BleedBox"</span><span class="p">,</span> <span class="s2">"TrimBox"</span><span class="p">,</span> <span class="s2">"ArtBox"</span><span class="p">};</span>
<span class="n">pprect</span> <span class="n">rect</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">i</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">sizeof</span><span class="p">(</span><span class="n">boxes</span><span class="p">)</span> <span class="o">/</span> <span class="n">sizeof</span><span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="p">);</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">ppdict_get_box</span><span class="p">(</span><span class="n">pagedict</span><span class="p">,</span> <span class="n">boxes</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="o">&</span><span class="n">rect</span><span class="p">))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">fh</span><span class="p">,</span> <span class="s2">"</span><span class="si">%%%%</span><span class="s2"> </span><span class="si">%s</span><span class="s2"> [</span><span class="si">%f</span><span class="s2"> </span><span class="si">%f</span><span class="s2"> </span><span class="si">%f</span><span class="s2"> </span><span class="si">%f</span><span class="s2">]</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">boxes</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">rect</span><span class="o">.</span><span class="n">lx</span><span class="p">,</span> <span class="n">rect</span><span class="o">.</span><span class="n">ly</span><span class="p">,</span> <span class="n">rect</span><span class="o">.</span><span class="n">rx</span><span class="p">,</span> <span class="n">rect</span><span class="o">.</span><span class="n">ry</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">static</span> <span class="nb">int</span> <span class="n">usage</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">argv0</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"pplib "</span> <span class="n">pplib_version</span> <span class="s2">", "</span> <span class="n">pplib_author</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"usage: </span><span class="si">%s</span><span class="s2"> file1.pdf file2.pdf ...</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">argv0</span><span class="p">);</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">static</span> <span class="n">void</span> <span class="n">log_callback</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">message</span><span class="p">,</span> <span class="n">void</span> <span class="o">*</span><span class="n">alien</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">fprintf</span><span class="p">((</span><span class="n">FILE</span> <span class="o">*</span><span class="p">)</span><span class="n">alien</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">ooops: </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">message</span><span class="p">);</span>
<span class="p">}</span>
<span class="nb">int</span> <span class="n">main</span> <span class="p">(</span><span class="nb">int</span> <span class="n">argc</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">filepath</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">a</span><span class="p">;</span>
<span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">;</span>
<span class="n">ppref</span> <span class="o">*</span><span class="n">pageref</span><span class="p">;</span>
<span class="n">ppdict</span> <span class="o">*</span><span class="n">pagedict</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">pageno</span><span class="p">;</span>
<span class="n">char</span> <span class="n">outname</span><span class="p">[</span><span class="mi">1024</span><span class="p">];</span>
<span class="n">FILE</span> <span class="o">*</span><span class="n">fh</span><span class="p">;</span>
<span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">;</span>
<span class="n">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">;</span>
<span class="n">ppobj</span> <span class="o">*</span><span class="n">obj</span><span class="p">;</span>
<span class="n">ppname</span> <span class="o">*</span><span class="n">op</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">operators</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o"><</span> <span class="mi">2</span><span class="p">)</span>
<span class="k">return</span> <span class="n">usage</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
<span class="n">ppstream_init_buffers</span><span class="p">();</span>
<span class="n">pplog_callback</span><span class="p">(</span><span class="n">log_callback</span><span class="p">,</span> <span class="n">stderr</span><span class="p">);</span>
<span class="n">context</span> <span class="o">=</span> <span class="n">ppcontext_new</span><span class="p">();</span>
<span class="k">for</span> <span class="p">(</span><span class="n">a</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">a</span> <span class="o"><</span> <span class="n">argc</span><span class="p">;</span> <span class="o">++</span><span class="n">a</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">filepath</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="n">a</span><span class="p">];</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"loading </span><span class="si">%s</span><span class="s2">... "</span><span class="p">,</span> <span class="n">filepath</span><span class="p">);</span>
<span class="n">pdf</span> <span class="o">=</span> <span class="n">ppdoc_load</span><span class="p">(</span><span class="n">filepath</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">pdf</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"failed</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"done.</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">switch</span> <span class="p">(</span><span class="n">ppdoc_crypt_status</span><span class="p">(</span><span class="n">pdf</span><span class="p">))</span>
<span class="p">{</span>
<span class="n">case</span> <span class="n">PPCRYPT_NONE</span><span class="p">:</span>
<span class="n">case</span> <span class="n">PPCRYPT_DONE</span><span class="p">:</span>
<span class="k">break</span><span class="p">;</span>
<span class="n">case</span> <span class="n">PPCRYPT_PASS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">ppdoc_crypt_pass</span><span class="p">(</span><span class="n">pdf</span><span class="p">,</span> <span class="s2">"dummy"</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">NULL</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="n">PPCRYPT_DONE</span> <span class="o">||</span> <span class="n">ppdoc_crypt_pass</span><span class="p">(</span><span class="n">pdf</span><span class="p">,</span> <span class="n">NULL</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="s2">"dummy"</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="o">==</span> <span class="n">PPCRYPT_DONE</span><span class="p">)</span>
<span class="k">break</span><span class="p">;</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"sorry, password needed</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">ppdoc_free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="n">case</span> <span class="n">PPCRYPT_FAIL</span><span class="p">:</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"sorry, encryption failed</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">ppdoc_free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">sprintf</span><span class="p">(</span><span class="n">outname</span><span class="p">,</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">.out"</span><span class="p">,</span> <span class="n">filepath</span><span class="p">);</span>
<span class="n">fh</span> <span class="o">=</span> <span class="n">fopen</span><span class="p">(</span><span class="n">outname</span><span class="p">,</span> <span class="s2">"wb"</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">fh</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s2">"can't open </span><span class="si">%s</span><span class="s2"> for writing</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">outname</span><span class="p">);</span>
<span class="k">continue</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">for</span> <span class="p">(</span><span class="n">pageref</span> <span class="o">=</span> <span class="n">ppdoc_first_page</span><span class="p">(</span><span class="n">pdf</span><span class="p">),</span> <span class="n">pageno</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="n">pageref</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">;</span>
<span class="n">pageref</span> <span class="o">=</span> <span class="n">ppdoc_next_page</span><span class="p">(</span><span class="n">pdf</span><span class="p">),</span> <span class="o">++</span><span class="n">pageno</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">pagedict</span> <span class="o">=</span> <span class="n">pageref</span><span class="o">-></span><span class="nb">object</span><span class="o">.</span><span class="n">dict</span><span class="p">;</span>
<span class="o">/*</span> <span class="n">decompress</span> <span class="n">contents</span> <span class="n">data</span> <span class="o">*/</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">fh</span><span class="p">,</span> <span class="s2">"</span><span class="si">%%%%</span><span class="s2"> PAGE </span><span class="si">%d</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">pageno</span><span class="p">);</span>
<span class="n">box_info</span><span class="p">(</span><span class="n">pagedict</span><span class="p">,</span> <span class="n">fh</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">stream</span> <span class="o">=</span> <span class="n">ppcontents_first</span><span class="p">(</span><span class="n">pagedict</span><span class="p">);</span>
<span class="n">stream</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">;</span>
<span class="n">stream</span> <span class="o">=</span> <span class="n">ppcontents_next</span><span class="p">(</span><span class="n">pagedict</span><span class="p">,</span> <span class="n">stream</span><span class="p">))</span>
<span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="n">ppstream_first</span><span class="p">(</span><span class="n">stream</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="n">data</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">;</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">ppstream_next</span><span class="p">(</span><span class="n">stream</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">))</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">fh</span><span class="p">);</span>
<span class="n">ppstream_done</span><span class="p">(</span><span class="n">stream</span><span class="p">);</span>
<span class="p">}</span>
<span class="o">/*</span> <span class="n">now</span> <span class="n">parse</span> <span class="n">contents</span> <span class="o">*/</span>
<span class="k">for</span> <span class="p">(</span><span class="n">stream</span> <span class="o">=</span> <span class="n">ppcontents_first</span><span class="p">(</span><span class="n">pagedict</span><span class="p">);</span>
<span class="n">stream</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">;</span>
<span class="n">stream</span> <span class="o">=</span> <span class="n">ppcontents_next</span><span class="p">(</span><span class="n">pagedict</span><span class="p">,</span> <span class="n">stream</span><span class="p">))</span>
<span class="p">{</span>
<span class="n">operators</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="n">obj</span> <span class="o">=</span> <span class="n">ppcontents_first_op</span><span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">stream</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">,</span> <span class="o">&</span><span class="n">op</span><span class="p">);</span>
<span class="n">obj</span> <span class="o">!=</span> <span class="n">NULL</span><span class="p">;</span>
<span class="n">obj</span> <span class="o">=</span> <span class="n">ppcontents_next_op</span><span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">stream</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">,</span> <span class="o">&</span><span class="n">op</span><span class="p">))</span>
<span class="o">++</span><span class="n">operators</span><span class="p">;</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">fh</span><span class="p">,</span> <span class="s2">"</span><span class="si">%%%%</span><span class="s2"> OPERATORS count </span><span class="si">%lu</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="p">(</span><span class="n">unsigned</span> <span class="n">long</span><span class="p">)</span><span class="n">operators</span><span class="p">);</span>
<span class="n">ppstream_done</span><span class="p">(</span><span class="n">stream</span><span class="p">);</span>
<span class="o">//</span><span class="n">obj</span> <span class="o">=</span> <span class="n">ppcontents_parse</span><span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">stream</span><span class="p">,</span> <span class="o">&</span><span class="n">size</span><span class="p">);</span>
<span class="o">//</span><span class="n">fprintf</span><span class="p">(</span><span class="n">fh</span><span class="p">,</span> <span class="s2">"</span><span class="si">%%%%</span><span class="s2"> items count </span><span class="si">%lu</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="p">(</span><span class="n">unsigned</span> <span class="n">long</span><span class="p">)</span><span class="n">size</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">fh</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">ppcontext_done</span><span class="p">(</span><span class="n">context</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">fclose</span><span class="p">(</span><span class="n">fh</span><span class="p">);</span>
<span class="n">ppdoc_free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">ppcontext_free</span><span class="p">(</span><span class="n">context</span><span class="p">);</span>
<span class="n">ppstream_free_buffers</span><span class="p">();</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="example-3">
<h2>Example 3<a class="headerlink" href="#example-3" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
#include <stdio.h>
//#include "ppapi.h"
#include "pplib.h"
#include "assert.h"
static int usage (const char *argv0)
{
printf("pplib " pplib_version ", " pplib_author "\n");
printf("usage: %s file1.pdf file2.pdf ...\n", argv0);
return 0;
}
static void print_result_filter (ppstream *stream, int decode)
{
ppstream_filter info;
size_t i;
ppstream_filter_info(stream, &info, decode);
printf(" when %s: /Filter [", decode ? "uncompressed" : "compressed");
for (i = 0; i < info.count; ++i)
printf(" /%s", ppstream_filter_name[info.filters[i]]);
printf(" ]");
if (info.params != NULL)
{
printf(" /DecodeParms [");
for (i = 0; i < info.count; ++i)
printf(" %s", info.params[i] != NULL ? "<<...>>" : "null");
printf(" ]");
}
printf("\n");
}
static void print_stream_info (ppref *ref, ppstream *stream)
{
size_t length;
printf("object %lu %lu R\n", (unsigned long)ref->number, (unsigned long)ref->version);
if (stream->flags & PPSTREAM_FILTER)
printf(" filtered ");
else
printf(" plain ");
if (stream->flags & PPSTREAM_IMAGE)
printf("image ");
else
printf("stream ");
if (stream->flags & PPSTREAM_ENCRYPTED)
printf("encrypted ");
if (stream->flags & PPSTREAM_NOT_SUPPORTED)
printf("invalid ");
if (!ppdict_rget_uint(stream->dict, "Length", &length))
length = 0;
assert(stream->length == length);
printf("length %lu (/Length %lu)\n", (unsigned long)stream->length, (unsigned long)length);
print_result_filter(stream, 0);
print_result_filter(stream, 1);
}
static void check_stream_chunks (ppstream *stream)
{
size_t sum, size;
uint8_t *data;
const int decode[2] = {0, 1};
int d;
for (d = 0; d < 2; ++d)
{
for (sum = 0, data = ppstream_first(stream, &size, decode[d]); data != NULL; data = ppstream_next(stream, &size))
sum += size;
ppstream_done(stream);
ppstream_all(stream, &size, decode[d]);
ppstream_done(stream);
assert(sum == size);
printf(" %s chunks size [%lu]\n", (decode[d] ? "decoded" : "raw"), (unsigned long)size);
}
}
#define USE_BUFFERS_POOL 1
int main (int argc, const char **argv)
{
const char *filepath;
int a;
ppdoc *pdf;
ppxref *xref;
ppxsec *xsec;
size_t xi;
ppuint refnum;
ppref *ref;
if (argc < 2)
return usage(argv[0]);
if (USE_BUFFERS_POOL)
ppstream_init_buffers();
for (a = 1; a < argc; ++a)
{
filepath = argv[a];
printf("loading %s... ", filepath);
pdf = ppdoc_load(filepath);
if (pdf == NULL)
{
printf("failed\n");
continue;
}
printf("done.\n");
for (xref = ppdoc_xref(pdf); xref != NULL; xref = ppxref_prev(xref))
{
for (xi = 0, xsec = xref->sects; xi < xref->size; ++xi, ++xsec)
{
for (refnum = xsec->first, ref = xsec->refs; refnum <= xsec->last; ++refnum, ++ref)
{
if (ref->object.type != PPSTREAM)
continue;
print_stream_info(ref, ref->object.stream);
check_stream_chunks(ref->object.stream);
}
}
}
ppdoc_free(pdf);
}
if (USE_BUFFERS_POOL)
ppstream_free_buffers();
return 0;
}
</pre></div>
</div>
</div>
<div class="section" id="ppapi-h">
<h2>ppapi.h<a class="headerlink" href="#ppapi-h" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
<span class="c1">#ifndef PP_API_H</span>
<span class="c1">#define PP_API_H</span>
<span class="c1">#include <stdint.h></span>
<span class="c1">#include <stddef.h></span>
<span class="c1">#include <string.h></span>
<span class="c1">#include "ppconf.h"</span>
<span class="c1">#define pplib_version "v2.05 less toxic i hope"</span>
<span class="c1">#define pplib_author "p.jackowski@gust.org.pl"</span>
<span class="o">/*</span> <span class="n">types</span> <span class="o">*/</span>
<span class="n">typedef</span> <span class="n">int64_t</span> <span class="n">ppint</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">size_t</span> <span class="n">ppuint</span><span class="p">;</span> <span class="o">//</span> <span class="n">machine</span> <span class="n">word</span>
<span class="n">typedef</span> <span class="n">char</span> <span class="n">ppbyte</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">double</span> <span class="n">ppnum</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppname</span> <span class="n">ppname</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppstring</span> <span class="n">ppstring</span><span class="p">;</span>
<span class="n">struct</span> <span class="n">ppname</span> <span class="p">{</span>
<span class="n">ppbyte</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="n">ppname</span> <span class="o">*</span><span class="n">alterego</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">flags</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">struct</span> <span class="n">ppstring</span> <span class="p">{</span>
<span class="n">ppbyte</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="n">ppstring</span> <span class="o">*</span><span class="n">alterego</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">flags</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppobj</span> <span class="n">ppobj</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppref</span> <span class="n">ppref</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppobj</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="p">}</span> <span class="n">pparray</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppobj</span> <span class="o">*</span><span class="n">data</span><span class="p">;</span>
<span class="n">ppname</span> <span class="o">**</span><span class="n">keys</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">size</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ppdict</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">enum</span> <span class="p">{</span>
<span class="n">PPSTREAM_BASE16</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">PPSTREAM_BASE85</span><span class="p">,</span>
<span class="n">PPSTREAM_RUNLENGTH</span><span class="p">,</span>
<span class="n">PPSTREAM_FLATE</span><span class="p">,</span>
<span class="n">PPSTREAM_LZW</span><span class="p">,</span>
<span class="n">PPSTREAM_CCITT</span><span class="p">,</span>
<span class="n">PPSTREAM_DCT</span><span class="p">,</span>
<span class="n">PPSTREAM_JBIG2</span><span class="p">,</span>
<span class="n">PPSTREAM_JPX</span><span class="p">,</span>
<span class="n">PPSTREAM_CRYPT</span>
<span class="p">}</span> <span class="n">ppstreamtp</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppstreamtp</span> <span class="o">*</span><span class="n">filters</span><span class="p">;</span>
<span class="n">ppdict</span> <span class="o">**</span><span class="n">params</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">count</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ppstream_filter</span><span class="p">;</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">;</span>
<span class="n">void</span> <span class="o">*</span><span class="nb">input</span><span class="p">,</span> <span class="o">*</span><span class="n">I</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">offset</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">length</span><span class="p">;</span>
<span class="n">ppstream_filter</span> <span class="nb">filter</span><span class="p">;</span>
<span class="n">ppobj</span> <span class="o">*</span><span class="n">filespec</span><span class="p">;</span>
<span class="n">ppstring</span> <span class="o">*</span><span class="n">cryptkey</span><span class="p">;</span>
<span class="nb">int</span> <span class="n">flags</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ppstream</span><span class="p">;</span>
<span class="n">PPDEF</span> <span class="n">extern</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">ppstream_filter_name</span><span class="p">[];</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppstream_filter_type</span> <span class="p">(</span><span class="n">ppname</span> <span class="o">*</span><span class="n">filtername</span><span class="p">,</span> <span class="n">ppstreamtp</span> <span class="o">*</span><span class="n">filtertype</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppstream_filter_info</span> <span class="p">(</span><span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">ppstream_filter</span> <span class="o">*</span><span class="n">info</span><span class="p">,</span> <span class="nb">int</span> <span class="n">decode</span><span class="p">);</span>
<span class="c1">#define PPSTREAM_FILTER (1<<0)</span>
<span class="c1">#define PPSTREAM_IMAGE (1<<1)</span>
<span class="c1">#define PPSTREAM_ENCRYPTED_AES (1<<2)</span>
<span class="c1">#define PPSTREAM_ENCRYPTED_RC4 (1<<3)</span>
<span class="c1">#define PPSTREAM_ENCRYPTED (PPSTREAM_ENCRYPTED_AES|PPSTREAM_ENCRYPTED_RC4)</span>
<span class="c1">#define PPSTREAM_ENCRYPTED_OWN (1<<4)</span>
<span class="c1">#define PPSTREAM_NOT_SUPPORTED (1<<6)</span>
<span class="c1">#define ppstream_compressed(stream) ((stream)->flags & (PPSTREAM_FILTER|PPSTREAM_IMAGE))</span>
<span class="c1">#define ppstream_filtered(stream) ((stream)->flags & PPSTREAM_FILTER)</span>
<span class="c1">#define ppstream_image(stream) ((stream)->flags & PPSTREAM_IMAGE)</span>
<span class="c1">#define ppstream_encrypted(stream) ((stream)->flags & PPSTREAM_ENCRYPTED)</span>
<span class="n">typedef</span> <span class="n">enum</span> <span class="p">{</span>
<span class="n">PPNONE</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">PPNULL</span><span class="p">,</span>
<span class="n">PPBOOL</span><span class="p">,</span>
<span class="n">PPINT</span><span class="p">,</span>
<span class="n">PPNUM</span><span class="p">,</span>
<span class="n">PPNAME</span><span class="p">,</span>
<span class="n">PPSTRING</span><span class="p">,</span>
<span class="n">PPARRAY</span><span class="p">,</span>
<span class="n">PPDICT</span><span class="p">,</span>
<span class="n">PPSTREAM</span><span class="p">,</span>
<span class="n">PPREF</span>
<span class="p">}</span> <span class="n">ppobjtp</span><span class="p">;</span>
<span class="n">PPDEF</span> <span class="n">extern</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">ppobj_kind</span><span class="p">[];</span>
<span class="n">struct</span> <span class="n">ppobj</span> <span class="p">{</span>
<span class="n">union</span> <span class="p">{</span>
<span class="n">ppint</span> <span class="n">integer</span><span class="p">;</span>
<span class="n">ppnum</span> <span class="n">number</span><span class="p">;</span>
<span class="n">ppname</span> <span class="o">*</span><span class="n">name</span><span class="p">;</span>
<span class="n">ppstring</span> <span class="o">*</span><span class="n">string</span><span class="p">;</span>
<span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">;</span>
<span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">;</span>
<span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">;</span>
<span class="n">ppref</span> <span class="o">*</span><span class="n">ref</span><span class="p">;</span>
<span class="n">void</span> <span class="o">*</span><span class="nb">any</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">ppobjtp</span> <span class="nb">type</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppxref</span> <span class="n">ppxref</span><span class="p">;</span>
<span class="n">struct</span> <span class="n">ppref</span> <span class="p">{</span>
<span class="n">ppobj</span> <span class="nb">object</span><span class="p">;</span>
<span class="n">ppuint</span> <span class="n">number</span><span class="p">,</span> <span class="n">version</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">offset</span><span class="p">;</span>
<span class="n">size_t</span> <span class="n">length</span><span class="p">;</span>
<span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppdoc</span> <span class="n">ppdoc</span><span class="p">;</span>
<span class="o">/*</span> <span class="nb">object</span> <span class="o">*/</span>
<span class="c1">#define ppobj_get_null(o) ((o)->type == PPNULL ? 1 : 0)</span>
<span class="c1">#define ppobj_get_bool(o, v) ((o)->type == PPBOOL ? ((v = ((o)->integer != 0)), 1) : 0)</span>
<span class="c1">#define ppobj_get_int(o, v) ((o)->type == PPINT ? ((v = (o)->integer), 1) : 0)</span>
<span class="c1">#define ppobj_get_uint(o, v) ((o)->type == PPINT && (o)->integer >= 0 ? ((v = (ppuint)((o)->integer)), 1) : 0)</span>
<span class="c1">#define ppobj_get_num(o, v) ((o)->type == PPNUM ? ((v = (o)->number), 1) : (((o)->type == PPINT ? ((v = (ppnum)((o)->integer)), 1) : 0)))</span>
<span class="c1">#define ppobj_get_name(o) ((o)->type == PPNAME ? (o)->name : NULL)</span>
<span class="c1">#define ppobj_get_string(o) ((o)->type == PPSTRING ? (o)->string : NULL)</span>
<span class="c1">#define ppobj_get_array(o) ((o)->type == PPARRAY ? (o)->array : NULL)</span>
<span class="c1">#define ppobj_get_dict(o) ((o)->type == PPDICT ? (o)->dict : NULL)</span>
<span class="c1">#define ppobj_get_stream(o) ((o)->type == PPSTREAM ? (o)->stream : NULL)</span>
<span class="c1">#define ppobj_get_ref(o) ((o)->type == PPREF ? (o)->ref : NULL)</span>
<span class="c1">#define ppobj_rget_obj(o) ((o)->type == PPREF ? ppref_obj((o)->ref) : o)</span>
<span class="c1">#define ppobj_rget_null(o) ((o)->type == PPNULL ? 1 : ((o)->type == PPREF ? ppobj_get_null(ppref_obj((o)->ref)) : 0))</span>
<span class="c1">#define ppobj_rget_bool(o, v) ((o)->type == PPBOOL ? ((v = ((o)->integer != 0)), 1) : ((o)->type == PPREF ? ppobj_get_bool(ppref_obj((o)->ref), v) : 0))</span>
<span class="c1">#define ppobj_rget_int(o, v) ((o)->type == PPINT ? ((v = (o)->integer), 1) : ((o)->type == PPREF ? ppobj_get_int(ppref_obj((o)->ref), v) : 0))</span>
<span class="c1">#define ppobj_rget_uint(o, v) ((o)->type == PPINT && (o)->integer >= 0 ? ((v = (ppuint)((o)->integer)), 1) : ((o)->type == PPREF ? ppobj_get_uint(ppref_obj((o)->ref), v) : 0))</span>
<span class="c1">#define ppobj_rget_num(o, v) ((o)->type == PPNUM ? ((v = (o)->number), 1) : (((o)->type == PPINT ? ((v = (ppnum)((o)->integer)), 1) : ((o)->type == PPREF ? ppobj_get_num(ppref_obj((o)->ref), v) : 0))))</span>
<span class="c1">#define ppobj_rget_name(o) ((o)->type == PPNAME ? (o)->name : ((o)->type == PPREF ? ppobj_get_name(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_rget_string(o) ((o)->type == PPSTRING ? (o)->string : ((o)->type == PPREF ? ppobj_get_string(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_rget_array(o) ((o)->type == PPARRAY ? (o)->array : ((o)->type == PPREF ? ppobj_get_array(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_rget_dict(o) ((o)->type == PPDICT ? (o)->dict : ((o)->type == PPREF ? ppobj_get_dict(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_rget_stream(o) ((o)->type == PPSTREAM ? (o)->stream : ((o)->type == PPREF ? ppobj_get_stream(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_rget_ref(o) ((o)->type == PPREF ? (o)->ref : ((o)->type == PPREF ? ppobj_get_ref(ppref_obj((o)->ref)) : NULL))</span>
<span class="c1">#define ppobj_get_bool_value(o) ((o)->type == PPBOOL ? ((o)->integer != 0) : 0)</span>
<span class="c1">#define ppobj_get_int_value(o) ((o)->type == PPINT ? (o)->integer : 0)</span>
<span class="c1">#define ppobj_get_num_value(o) ((o)->type == PPNUM ? (o)->number : ((o)->type == PPINT ? (ppnum)((o)->integer) : 0.0))</span>
<span class="o">/*</span> <span class="n">name</span> <span class="o">*/</span>
<span class="c1">#define ppname_is(name, s) (memcmp((name)->data, s, sizeof("" s) - 1) == 0)</span>
<span class="c1">#define ppname_eq(name, n) (memcmp((name)->data, s, (name)->size) == 0)</span>
<span class="c1">#define ppname_size(name) ((name)->size)</span>
<span class="c1">#define ppname_exec(name) ((name)->flags & PPNAME_EXEC)</span>
<span class="c1">#define ppname_data(name) ((name)->data)</span>
<span class="c1">#define PPNAME_ENCODED (1 << 0)</span>
<span class="c1">#define PPNAME_DECODED (1 << 1)</span>
<span class="c1">#define PPNAME_EXEC (1 << 1)</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">ppname_decoded</span> <span class="p">(</span><span class="n">ppname</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">ppname_encoded</span> <span class="p">(</span><span class="n">ppname</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppbyte</span> <span class="o">*</span> <span class="n">ppname_decoded_data</span> <span class="p">(</span><span class="n">ppname</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppbyte</span> <span class="o">*</span> <span class="n">ppname_encoded_data</span> <span class="p">(</span><span class="n">ppname</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">string</span> <span class="o">*/</span>
<span class="c1">#define ppstring_size(string) ((string)->size)</span>
<span class="c1">#define ppstring_data(string) ((string)->data)</span>
<span class="c1">#define PPSTRING_ENCODED (1 << 0)</span>
<span class="c1">#define PPSTRING_DECODED (1 << 1)</span>
<span class="o">//</span><span class="c1">#define PPSTRING_EXEC (1 << 2) // postscript only</span>
<span class="c1">#define PPSTRING_PLAIN 0</span>
<span class="c1">#define PPSTRING_BASE16 (1 << 3)</span>
<span class="c1">#define PPSTRING_BASE85 (1 << 4)</span>
<span class="c1">#define PPSTRING_UTF16BE (1 << 5)</span>
<span class="c1">#define PPSTRING_UTF16LE (1 << 6)</span>
<span class="c1">#define ppstring_type(string) ((string)->flags & (PPSTRING_BASE16|PPSTRING_BASE85))</span>
<span class="c1">#define ppstring_hex(string) ((string)->flags & PPSTRING_BASE16)</span>
<span class="c1">#define ppstring_utf(string) ((string)->flags & (PPSTRING_UTF16BE|PPSTRING_UTF16LE))</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">ppstring_decoded</span> <span class="p">(</span><span class="n">ppstring</span> <span class="o">*</span><span class="n">string</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">ppstring_encoded</span> <span class="p">(</span><span class="n">ppstring</span> <span class="o">*</span><span class="n">string</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppbyte</span> <span class="o">*</span> <span class="n">ppstring_decoded_data</span> <span class="p">(</span><span class="n">ppstring</span> <span class="o">*</span><span class="n">string</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppbyte</span> <span class="o">*</span> <span class="n">ppstring_encoded_data</span> <span class="p">(</span><span class="n">ppstring</span> <span class="o">*</span><span class="n">string</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">array</span> <span class="o">*/</span>
<span class="c1">#define pparray_size(array) ((array)->size)</span>
<span class="c1">#define pparray_at(array, index) ((array)->data + index)</span>
<span class="c1">#define pparray_first(array, index, obj) ((index) = 0, (obj) = pparray_at(array, 0))</span>
<span class="c1">#define pparray_next(index, obj) (++(index), ++(obj))</span>
<span class="c1">#define pparray_get(array, index) (index < (array)->size ? pparray_at(array, index) : NULL)</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">pparray_get_obj</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_get_bool</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="nb">int</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_get_int</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_get_uint</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppuint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_get_num</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppnum</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">pparray_get_name</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">pparray_get_string</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pparray</span> <span class="o">*</span> <span class="n">pparray_get_array</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">pparray_get_dict</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="o">//</span><span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">pparray_get_stream</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">pparray_get_ref</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">pparray_rget_obj</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_rget_bool</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="nb">int</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_rget_int</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_rget_uint</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppuint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pparray_rget_num</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">,</span> <span class="n">ppnum</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">pparray_rget_name</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">pparray_rget_string</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pparray</span> <span class="o">*</span> <span class="n">pparray_rget_array</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">pparray_rget_dict</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">pparray_rget_stream</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">pparray_rget_ref</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">index</span><span class="p">);</span>
<span class="o">/*</span> <span class="nb">dict</span> <span class="o">*/</span>
<span class="c1">#define ppdict_size(dict) ((dict)->size)</span>
<span class="c1">#define ppdict_at(dict, index) ((dict)->data + index)</span>
<span class="c1">#define ppdict_key(dict, index) ((dict)->keys[index])</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">ppdict_get_obj</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_get_bool</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="nb">int</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_get_int</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_get_uint</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppuint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_get_num</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppnum</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">ppdict_get_name</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">ppdict_get_string</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pparray</span> <span class="o">*</span> <span class="n">ppdict_get_array</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">ppdict_get_dict</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="o">//</span><span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">ppdict_get_stream</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppdict_get_ref</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">ppdict_rget_obj</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_rget_bool</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="nb">int</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_rget_int</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_rget_uint</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppuint</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdict_rget_num</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppnum</span> <span class="o">*</span><span class="n">v</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppname</span> <span class="o">*</span> <span class="n">ppdict_rget_name</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstring</span> <span class="o">*</span> <span class="n">ppdict_rget_string</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pparray</span> <span class="o">*</span> <span class="n">ppdict_rget_array</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">ppdict_rget_dict</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">ppdict_rget_stream</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppdict_rget_ref</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">);</span>
<span class="c1">#define ppdict_first(dict, pkey, obj) (pkey = (dict)->keys, obj = (dict)->data)</span>
<span class="c1">#define ppdict_next(pkey, obj) (++(pkey), ++(obj))</span>
<span class="o">/*</span> <span class="n">stream</span> <span class="o">*/</span>
<span class="c1">#define ppstream_dict(stream) ((stream)->dict)</span>
<span class="n">PPAPI</span> <span class="n">uint8_t</span> <span class="o">*</span> <span class="n">ppstream_first</span> <span class="p">(</span><span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">size</span><span class="p">,</span> <span class="nb">int</span> <span class="n">decode</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">uint8_t</span> <span class="o">*</span> <span class="n">ppstream_next</span> <span class="p">(</span><span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">size</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">uint8_t</span> <span class="o">*</span> <span class="n">ppstream_all</span> <span class="p">(</span><span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">size</span><span class="p">,</span> <span class="nb">int</span> <span class="n">decode</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppstream_done</span> <span class="p">(</span><span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppstream_init_buffers</span> <span class="p">(</span><span class="n">void</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppstream_free_buffers</span> <span class="p">(</span><span class="n">void</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">ref</span> <span class="o">*/</span>
<span class="c1">#define ppref_obj(ref) (&(ref)->object)</span>
<span class="o">/*</span> <span class="n">xref</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">ppxref</span> <span class="o">*</span> <span class="n">ppdoc_xref</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppxref</span> <span class="o">*</span> <span class="n">ppxref_prev</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">ppxref_trailer</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">ppxref_catalog</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdict</span> <span class="o">*</span> <span class="n">ppxref_info</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppxref_pages</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppxref_find</span> <span class="p">(</span><span class="n">ppxref</span> <span class="o">*</span><span class="n">xref</span><span class="p">,</span> <span class="n">ppuint</span> <span class="n">refnumber</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">doc</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">ppdoc</span> <span class="o">*</span> <span class="n">ppdoc_load</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">filename</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppdoc</span> <span class="o">*</span> <span class="n">ppdoc_filehandle</span> <span class="p">(</span><span class="n">FILE</span> <span class="o">*</span><span class="n">file</span><span class="p">,</span> <span class="nb">int</span> <span class="n">closefile</span><span class="p">);</span>
<span class="c1">#define ppdoc_file(file) ppdoc_filehandle(file, 1)</span>
<span class="n">PPAPI</span> <span class="n">ppdoc</span> <span class="o">*</span> <span class="n">ppdoc_mem</span> <span class="p">(</span><span class="n">const</span> <span class="n">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">size</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppdoc_free</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="c1">#define ppdoc_trailer(pdf) ppxref_trailer(ppdoc_xref(pdf))</span>
<span class="c1">#define ppdoc_catalog(pdf) ppxref_catalog(ppdoc_xref(pdf))</span>
<span class="c1">#define ppdoc_info(pdf) ppxref_info(ppdoc_xref(pdf))</span>
<span class="c1">#define ppdoc_pages(pdf) ppxref_pages(ppdoc_xref(pdf))</span>
<span class="n">PPAPI</span> <span class="n">ppuint</span> <span class="n">ppdoc_page_count</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppdoc_page</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">,</span> <span class="n">ppuint</span> <span class="n">index</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppdoc_first_page</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppref</span> <span class="o">*</span> <span class="n">ppdoc_next_page</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">ppcontents_first</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppstream</span> <span class="o">*</span> <span class="n">ppcontents_next</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">crypt</span> <span class="o">*/</span>
<span class="n">typedef</span> <span class="n">enum</span> <span class="p">{</span>
<span class="n">PPCRYPT_NONE</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">PPCRYPT_DONE</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<span class="n">PPCRYPT_FAIL</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
<span class="n">PPCRYPT_PASS</span> <span class="o">=</span> <span class="o">-</span><span class="mi">2</span>
<span class="p">}</span> <span class="n">ppcrypt_status</span><span class="p">;</span>
<span class="n">PPAPI</span> <span class="n">ppcrypt_status</span> <span class="n">ppdoc_crypt_status</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppcrypt_status</span> <span class="n">ppdoc_crypt_pass</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">,</span> <span class="n">const</span> <span class="n">void</span> <span class="o">*</span><span class="n">userpass</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">userpasslength</span><span class="p">,</span> <span class="n">const</span> <span class="n">void</span> <span class="o">*</span><span class="n">ownerpass</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">ownerpasslength</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">permission</span> <span class="n">flags</span><span class="p">,</span> <span class="n">effect</span> <span class="ow">in</span> <span class="n">Acrobat</span> <span class="n">File</span> <span class="o">-></span> <span class="n">Properties</span> <span class="o">-></span> <span class="n">Security</span> <span class="n">tab</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">ppint</span> <span class="n">ppdoc_permissions</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="c1">#define PPDOC_ALLOW_PRINT (1<<2) // printing</span>
<span class="c1">#define PPDOC_ALLOW_MODIFY (1<<3) // filling form fields, signing, creating template pages</span>
<span class="c1">#define PPDOC_ALLOW_COPY (1<<4) // copying, copying for accessibility</span>
<span class="c1">#define PPDOC_ALLOW_ANNOTS (1<<5) // filling form fields, copying, signing</span>
<span class="c1">#define PPDOC_ALLOW_EXTRACT (1<<9) // contents copying for accessibility</span>
<span class="c1">#define PPDOC_ALLOW_ASSEMBLY (1<<10) // (no effect)</span>
<span class="c1">#define PPDOC_ALLOW_PRINT_HIRES (1<<11) // (no effect)</span>
<span class="o">/*</span> <span class="n">context</span> <span class="o">*/</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="n">ppcontext</span> <span class="n">ppcontext</span><span class="p">;</span>
<span class="n">PPAPI</span> <span class="n">ppcontext</span> <span class="o">*</span> <span class="n">ppcontext_new</span> <span class="p">(</span><span class="n">void</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppcontext_done</span> <span class="p">(</span><span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">ppcontext_free</span> <span class="p">(</span><span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">contents</span> <span class="n">parser</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">ppcontents_first_op</span> <span class="p">(</span><span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">,</span> <span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">psize</span><span class="p">,</span> <span class="n">ppname</span> <span class="o">**</span><span class="n">pname</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">ppcontents_next_op</span> <span class="p">(</span><span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">,</span> <span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">psize</span><span class="p">,</span> <span class="n">ppname</span> <span class="o">**</span><span class="n">pname</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppobj</span> <span class="o">*</span> <span class="n">ppcontents_parse</span> <span class="p">(</span><span class="n">ppcontext</span> <span class="o">*</span><span class="n">context</span><span class="p">,</span> <span class="n">ppstream</span> <span class="o">*</span><span class="n">stream</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">psize</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">boxes</span> <span class="ow">and</span> <span class="n">transforms</span> <span class="o">*/</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppnum</span> <span class="n">lx</span><span class="p">,</span> <span class="n">ly</span><span class="p">,</span> <span class="n">rx</span><span class="p">,</span> <span class="n">ry</span><span class="p">;</span>
<span class="p">}</span> <span class="n">pprect</span><span class="p">;</span>
<span class="n">PPAPI</span> <span class="n">pprect</span> <span class="o">*</span> <span class="n">pparray_to_rect</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">pprect</span> <span class="o">*</span><span class="n">rect</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pprect</span> <span class="o">*</span> <span class="n">ppdict_get_rect</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">pprect</span> <span class="o">*</span><span class="n">rect</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">pprect</span> <span class="o">*</span> <span class="n">ppdict_get_box</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">pprect</span> <span class="o">*</span><span class="n">rect</span><span class="p">);</span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span>
<span class="n">ppnum</span> <span class="n">xx</span><span class="p">,</span> <span class="n">xy</span><span class="p">,</span> <span class="n">yx</span><span class="p">,</span> <span class="n">yy</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ppmatrix</span><span class="p">;</span>
<span class="n">PPAPI</span> <span class="n">ppmatrix</span> <span class="o">*</span> <span class="n">pparray_to_matrix</span> <span class="p">(</span><span class="n">pparray</span> <span class="o">*</span><span class="n">array</span><span class="p">,</span> <span class="n">ppmatrix</span> <span class="o">*</span><span class="n">matrix</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppmatrix</span> <span class="o">*</span> <span class="n">ppdict_get_matrix</span> <span class="p">(</span><span class="n">ppdict</span> <span class="o">*</span><span class="nb">dict</span><span class="p">,</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="n">ppmatrix</span> <span class="o">*</span><span class="n">matrix</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">logger</span> <span class="o">*/</span>
<span class="n">typedef</span> <span class="n">void</span> <span class="p">(</span><span class="o">*</span><span class="n">pplogger_callback</span><span class="p">)</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">message</span><span class="p">,</span> <span class="n">void</span> <span class="o">*</span><span class="n">alien</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">void</span> <span class="n">pplog_callback</span> <span class="p">(</span><span class="n">pplogger_callback</span> <span class="n">logger</span><span class="p">,</span> <span class="n">void</span> <span class="o">*</span><span class="n">alien</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">pplog_prefix</span> <span class="p">(</span><span class="n">const</span> <span class="n">char</span> <span class="o">*</span><span class="n">prefix</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">version</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">const</span> <span class="n">char</span> <span class="o">*</span> <span class="n">ppdoc_version_string</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="nb">int</span> <span class="n">ppdoc_version_number</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">,</span> <span class="nb">int</span> <span class="o">*</span><span class="n">minor</span><span class="p">);</span>
<span class="o">/*</span> <span class="n">doc</span> <span class="n">info</span> <span class="o">*/</span>
<span class="n">PPAPI</span> <span class="n">size_t</span> <span class="n">ppdoc_file_size</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">ppuint</span> <span class="n">ppdoc_objects</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">);</span>
<span class="n">PPAPI</span> <span class="n">size_t</span> <span class="n">ppdoc_memory</span> <span class="p">(</span><span class="n">ppdoc</span> <span class="o">*</span><span class="n">pdf</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">waste</span><span class="p">);</span>
<span class="c1">#endif</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="changes">
<h1>Changes<a class="headerlink" href="#changes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="v0-97">
<h2>v0.97<a class="headerlink" href="#v0-97" title="Permalink to this headline">¶</a></h2>
<p>First release integrated with luatex sources, plus portability changes from Luigi.</p>
</div>
<div class="section" id="v0-98">
<h2>v0.98<a class="headerlink" href="#v0-98" title="Permalink to this headline">¶</a></h2>
<p>Changed references resolving in case of incremental updates; tech notes ppxref_find() in ppxref.c.</p>
</div>
<div class="section" id="v0-99">
<h2>v0.99<a class="headerlink" href="#v0-99" title="Permalink to this headline">¶</a></h2>
<p>Fixed streams handling; null characters should NOT be gobbled after “stream” keyword</p>
</div>
<div class="section" id="v1-00">
<h2>v1.00<a class="headerlink" href="#v1-00" title="Permalink to this headline">¶</a></h2>
<p>Fixed streams handling (Luigi); object streams updated before other streams
Revised streams handling, ppstream API extended</p>
</div>
<div class="section" id="v1-01">
<h2>v1.01<a class="headerlink" href="#v1-01" title="Permalink to this headline">¶</a></h2>
<p>Fixed names handling (thanks Hans); digits after ‘#’ weren’t skipped</p>
</div>
<div class="section" id="v1-02">
<h2>v1.02<a class="headerlink" href="#v1-02" title="Permalink to this headline">¶</a></h2>
<p>Fixed page finder (thanks Luigi)</p>
</div>
<div class="section" id="v1-03">
<h2>v1.03<a class="headerlink" href="#v1-03" title="Permalink to this headline">¶</a></h2>
<p>Fixed TIFF predictor (thanks folks)</p>
</div>
<div class="section" id="v1-04">
<h2>v1.04<a class="headerlink" href="#v1-04" title="Permalink to this headline">¶</a></h2>
<p>Fixed TIFF predictor for ARM</p>
</div>
<div class="section" id="v1-05">
<h2>v1.05<a class="headerlink" href="#v1-05" title="Permalink to this headline">¶</a></h2>
<p>Attempt to fix parsing inline images crap</p>
</div>
<div class="section" id="v2-00">
<h2>v2.00<a class="headerlink" href="#v2-00" title="Permalink to this headline">¶</a></h2>
<p>Deep rework on allocators.
Deep rework on strings and names.</p>
</div>
<div class="section" id="v2-01">
<h2>v2.01<a class="headerlink" href="#v2-01" title="Permalink to this headline">¶</a></h2>
<p>Fixed invalid stream buffer handling; <code class="docutils literal notranslate"><span class="pre">iof_discard()</span></code> no longer reclaims the source (<code class="docutils literal notranslate"><span class="pre">filter->next</span></code>) filter.
Sanity alignment adjustments in <code class="docutils literal notranslate"><span class="pre">iof_heap</span></code>.</p>
</div>
<div class="section" id="v2-02">
<h2>v2.02<a class="headerlink" href="#v2-02" title="Permalink to this headline">¶</a></h2>
<p>Fixed incorrect encoding of strings alterego with octal escaping, thanks Luigi.
On Hans request added <code class="docutils literal notranslate"><span class="pre">ppdoc_filehandle()</span></code> function and <code class="docutils literal notranslate"><span class="pre">ppdoc_file()</span></code> macro for loading ppdoc from <code class="docutils literal notranslate"><span class="pre">FILE</span> <span class="pre">*</span></code>.</p>
</div>
<div class="section" id="v2-03">
<h2>v2.03<a class="headerlink" href="#v2-03" title="Permalink to this headline">¶</a></h2>
<p>Fixed alloc/free of <code class="docutils literal notranslate"><span class="pre">ppdoc</span></code> heap; <code class="docutils literal notranslate"><span class="pre">ppdoc</span></code> is now mallocated, no longer taken from its own heap. Again, thanks Luigi.
Fixed warnings about dereferencing type-puned pointers, and some others.</p>
</div>
<div class="section" id="v2-04">
<h2>v2.04<a class="headerlink" href="#v2-04" title="Permalink to this headline">¶</a></h2>
<p>Byte lookups for names/strings loaders are now int8_t, as char might be signed.
ppdoc_first_page() / ppdoc_next_page() iterator now handles a case when /Kids array is empty.
Fixed generating keys for encrypted streams; ppstring_internal() returns the string of the proper size.
More stream tests in pptest3.c.
Some rework on md5 and sha2.</p>
</div>
<div class="section" id="v2-05">
<h2>v2.05<a class="headerlink" href="#v2-05" title="Permalink to this headline">¶</a></h2>
<p>uint8_t instead of ppbyte in internals; ppbyte intent is “the most natural 8-bit integer”, so it is ‘char’,
but internally we almost always need uint8_t (char may be signed or not..)</p>
</div>
</div>
<div class="section" id="todo">
<h1>TODO<a class="headerlink" href="#todo" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li>external streams (egzotic)</li>
</ul>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="ppapi-1.x.html" title="pplib 1.x"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="pplib.html">pplib 0.1 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2019, p.jackowski@gust.org.pl.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
</div>
</body>
</html>
|