File: plplot_thin.ads

package info (click to toggle)
plplot 5.10.0%2Bdfsg2-0.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 25,792 kB
  • ctags: 13,517
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,208; makefile: 210; lisp: 75; sed: 25; fortran: 7
file content (2024 lines) | stat: -rw-r--r-- 70,852 bytes parent folder | download | duplicates (2)
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
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
-- $Id: plplot_thin.ads 12862 2013-12-13 10:18:08Z jbauck $

-- Thin Ada binding to PLplot

-- Copyright (C) 2006-2013 Jerry Bauck

-- This file is part of PLplot.

-- PLplot is free software; you can redistribute it and/or modify
-- it under the terms of the GNU Library General Public License as published
-- by the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.

-- PLplot is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Library General Public License for more details.

-- You should have received a copy of the GNU Library General Public License
-- along with PLplot; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

--------------------------------------------------------------------------------

-- SOME NOTES ABOUT THE ADA BINDINGS (JB)
-- Some C-arguments of the form PLINT *a are supposed to point at 8-bit unsigned chars
-- and are said to carry information out of the function, according to the PLplot docs.
-- I hope that this is wrong and that they are really PLINTs like the API says.
-- I converted these as a : out PLINT. These are the only *-ed quantities that I set to "outs".

-- I made the final arg in plscmap1l, alt_hue_path, an array of PLBOOLs, not an in out 
-- parameter; impossible to tell from C syntax which is intended, but I think 
-- this is right.

with
    Interfaces.C,
    Interfaces.C.Strings,
    Interfaces.C.Pointers,
    PLplot_Auxiliary,
    System,
    Ada.Text_IO,
    Ada.Strings.Bounded,
    Ada.Strings.Unbounded;
use
    Interfaces.C,
    Interfaces.C.Strings,
    PLplot_Auxiliary,
    Ada.Text_IO,
    Ada.Strings.Bounded,
    Ada.Strings.Unbounded;

package PLplot_Thin is
    subtype PLINT  is Integer;
    subtype PLFLT  is Long_Float;
    PLfalse : constant Integer := 0;
    PLtrue  : constant Integer := 1;
    subtype PLBOOL is Integer range PLfalse..PLtrue;
    type PLUNICODE is mod 2**32;

    type Boolean_Array_1D is array (Integer range <>) of Boolean;
    type Integer_Array_1D is array (Integer range <>) of Integer;

    subtype PL_Integer_Array  is Integer_Array_1D;
    subtype PL_Float_Array    is Real_Vector;
    subtype PL_Float_Array_2D is Real_Matrix;
    type PL_Bool_Array        is array (Integer range <>) of PLBOOL;
    subtype PLPointer         is System.Address; -- non-specific pointer to something
            
    -- Types to pass 2D arrays (matrix) defined in Ada.Numerics.Generic_Real_Arrays
    -- (and its instances) to C functions. Have only Long_Float capability for now.
    type Long_Float_Pointer is access all Long_Float;
    type Long_Float_Pointer_Array is array (Integer range <>) of aliased Long_Float_Pointer;


--------------------------------------------------------------------------------
-- Utility for passing matrices to C                                          --
--------------------------------------------------------------------------------

    function Matrix_To_Pointers(x : Real_Matrix) return Long_Float_Pointer_Array;


--------------------------------------------------------------------------------
-- Transpose a Matrix.                                                        --
--------------------------------------------------------------------------------

    function PL_Transpose(A : Real_Matrix) return Real_Matrix;


--------------------------------------------------------------------------------
-- PLplot-specific things                                                     --
--------------------------------------------------------------------------------

    -- Make a string and array therefore for stripchart legends that is compatible with 
    -- the C code of plstripc which creates a strip chart. The C code will accept 
    -- any length of string and each of the four strings can be different lengths.
    -- These types are a bit of a hack whereby each of the legend strings is the 
    -- same length, so that they can be accessed as an array. They are Max_Stripchart_Label_Length 
    -- characters long here including a null terminator; I suppose any length 
    -- will work since the stripchart program doesn't seem to mind. The user 
    -- will probably never see this type since he is allowed to set up the 
    -- legend strings as an array of unbounded strings. Only in preparing to 
    -- call the underlying C are the fixed-length strings used. If the user 
    -- specifies unbounded legend strings that are longer than allowed here, 
    -- they are truncated to meet the required length. Although that length 
    -- is now Max_Stripchart_Label_Length, it should be OK to make it 
    -- longer or shorter simply by changing the following line, since everything
    -- else (truncation, conversion to C-style) works automatically.
    -- The current implementation uses char_array for the strings and uses
    -- System.Address as the pointer which are assigned to an array of type 
    -- PL_Stripchart_String_Array (see plstripc). I think it is also possible 
    -- to subtype String and use access variables assigned to an array of 
    -- suitable access types.
    -- One very important note is that in forming the C string, the null 
    -- terminator will normally come in the middle of the array, right after
    -- the "significant" part of the string. This is handled in plstripc.
    Max_Stripchart_Label_Length : constant Integer := 100;
    subtype PL_Stripchart_String is 
        Interfaces.C.char_array(0 .. size_t(Max_Stripchart_Label_Length));
    type PL_Stripchart_String_Array is array (1 .. 4) of PLpointer;
    C_Stripchart_String_Array : array(1 .. 4) of PL_Stripchart_String;


    -- Make a string and array therefore for plot (not stripchart) legends that 
    -- is compatible with the C code of pllegend. This is modelled on the way
    -- that legends for stripcharts are handled except there, the maximum 
    -- number of legends was four and here we don't know until runtime what the
    -- maximum number of legends will be. The user will have to define this is
    -- his code; see e.g. Example 4.
    Max_Legend_Label_Length : constant Integer := 100;
    subtype PL_Legend_String is 
        Interfaces.C.char_array(0 .. size_t(Max_Legend_Label_Length));
    type PL_Legend_String_Array is array (Integer range <>) of PLpointer;

                        
    -- Access-to-procedure type for Draw_Vector_Plot and its kin.
    type Transformation_Procedure_Pointer_Type is access 
        procedure (x, y : PLFLT; tx, ty : out PLFLT; pltr_data : PLpointer);
    pragma Convention (Convention => C, Entity => Transformation_Procedure_Pointer_Type);
    
    
    -- Access-to-procedure to e.g. to plfill, used by plshade, plshade1, plshades.
    -- Needs C calling convention because it is passed eventually to plfill aka 
    -- c_plfill in plplot.h. plfill is said in the documentation to be possibly 
    -- supplemented in the future. 
    type Fill_Procedure_Pointer_Type is access
        procedure(length : Integer; x, y : Real_Vector);
    pragma Convention(Convention => C, Entity => Fill_Procedure_Pointer_Type);
        

    -- Access-to-function type for Shade_Regions (aka plshades).
    -- Returns 1 if point is to be plotted, 0 if not.
    type Mask_Function_Pointer_Type is access
        function (x, y : PLFLT) return Integer;
    pragma Convention(Convention => C, Entity => Mask_Function_Pointer_Type);

    -- Make a constrained array for use by plmap (Draw_Map) and 
    -- plmeridians (Draw_Latitude_Longitude). The reason that this is necessary 
    -- is that the callback structure for those routines requires that a C 
    -- subprogram calls an Ada subroutine *with an unconstrained array*. This 
    -- seems to be unique in the PLplot bindings. For a discussion of this, see 
    -- http://groups.google.com/group/comp.lang.ada/browse_thread/thread/0e5a3abec221df39?hl=en#
    -- If the user needs to have a larger array, it will require making this 
    -- array longer, but we try to anticipate the most extreme situation here 
    -- without being too wasteful. Note that the user will typically use only a 
    -- portion of the array, beginning at index 0.
    subtype Map_Form_Constrained_Array is Real_Vector(0 .. 2000);

    -- Access-to-procedure type for plotting map outlines (continents).
    -- Length_Of_x is x'Length or y'Length; this is the easiest way to match the 
    -- C formal arguments.
    type Map_Form_Function_Pointer_Type is access
        procedure (Length_Of_x : Integer; x, y : in out Map_Form_Constrained_Array);
    pragma Convention(Convention => C, Entity => Map_Form_Function_Pointer_Type);

    -- Access-to-function type for making contour plots from irregularly 
    -- spaced data which is stored in a 2D array accessed by a single pointer.
    -- Examples of such functions are in plplot.h and are called plf2eval, 
    -- plf2eval2, plf2evalr.
    type Function_Evaluator_Pointer_Type is access
        function (ix, iy : PLINT; Irregular_Data : PLpointer) return PLFLT;
    pragma Convention(Convention => C, Entity => Function_Evaluator_Pointer_Type);
    
    
    -- Fixed-length string for use with custom label procedures 
    -- in Custom_Label_Procedure_Pointer_Type, and plslabelfunc (Set_Custom_Label).
    -- This length, 0 .. 40, is hardwired in the PLplot C code; this type will
    -- fail if that length is ever changed.
    Max_Label_String_Length : constant Integer := 40;
    subtype Label_String_Type is Interfaces.C.char_array (0 .. size_t(Max_Label_String_Length));

    -- Access-to-function type for making custom labels such as with plslabelfunc.
    type Custom_Label_Procedure_Pointer_Type is access
        procedure 
           (axis    : Integer;
            a_value : PLFLT;
            label   : out Label_String_Type;
            length  : size_t;
            data    : PLPointer);
    pragma Convention(Convention => C, Entity => Custom_Label_Procedure_Pointer_Type);

    -- Access-to-procedure type for setting a global custom coordinate tranformation.
    type Coordinate_Transform_Procedure_Pointer_Type is access
        procedure 
           (x_In, y_In                   : PLFLT; 
            x_Transformed, y_Transformed : out PLFLT;
            data                         : PLpointer);
    pragma Convention(Convention => C, Entity => Coordinate_Transform_Procedure_Pointer_Type);


--------------------------------------------------------------------------------
-- Argument parsing things                                                    --
--------------------------------------------------------------------------------

    Gnat_argc : aliased Integer;
    pragma Import (C, Gnat_argc);

    Gnat_argv : System.Address; -- Just get the base address to argv, like C
    pragma Import (C, Gnat_argv);


--------------------------------------------------------------------------------
-- More PLplot-specific things                                                --
--------------------------------------------------------------------------------

    -- Switches for escape function call. 
    -- Some of these are obsolete but are retained in order to process
    -- old metafiles 

    PLESC_SET_RGB         : constant Integer := 1;	-- obsolete 
    PLESC_ALLOC_NCOL      : constant Integer := 2;	-- obsolete 
    PLESC_SET_LPB         : constant Integer := 3;	-- obsolete 
    PLESC_EXPOSE          : constant Integer := 4;	-- handle window expose 
    PLESC_RESIZE          : constant Integer := 5;	-- handle window resize 
    PLESC_REDRAW          : constant Integer := 6;	-- handle window redraw 
    PLESC_TEXT            : constant Integer := 7;	-- switch to text screen 
    PLESC_GRAPH           : constant Integer := 8;	-- switch to graphics screen 
    PLESC_FILL            : constant Integer := 9;	-- fill polygon 
    PLESC_DI              : constant Integer := 10;	-- handle DI command 
    PLESC_FLUSH           : constant Integer := 11;	-- flush output 
    PLESC_EH              : constant Integer := 12; -- handle Window events 
    PLESC_GETC            : constant Integer := 13;	-- get cursor position 
    PLESC_SWIN            : constant Integer := 14;	-- set window parameters 
    PLESC_DOUBLEBUFFERING : constant Integer := 15;	-- configure double buffering 
    PLESC_XORMOD          : constant Integer := 16;	-- set xor mode 
    PLESC_SET_COMPRESSION : constant Integer := 17;	-- AFR: set compression 
    PLESC_CLEAR           : constant Integer := 18; -- RL: clear graphics region 
    PLESC_DASH            : constant Integer := 19;	-- RL: draw dashed line 
    PLESC_HAS_TEXT        : constant Integer := 20;	-- driver draws text 
    PLESC_IMAGE           : constant Integer := 21;	-- handle image 
    PLESC_IMAGEOPS        : constant Integer := 22; -- plimage related operations 
    PLESC_PL2DEVCOL       : constant Integer := 23;	-- convert PLColor to device color 
    PLESC_DEV2PLCOL       : constant Integer := 24;	-- convert device color to PLColor 
    PLESC_SETBGFG         : constant Integer := 25;	-- set BG, FG colors 
    PLESC_DEVINIT         : constant Integer := 26;	-- alternate device initialization 

    -- image operations 
    ZEROW2B : constant Integer := 1;
    ZEROW2D : constant Integer := 2;
    ONEW2B  : constant Integer := 3;
    ONEW2D  : constant Integer := 4;

    -- Window parameter tags 

    PLSWIN_DEVICE : constant Integer := 1; -- device coordinates 
    PLSWIN_WORLD  : constant Integer := 2; -- world coordinates 

    -- Axis label tags
    PL_X_AXIS : constant Integer := 1; -- The x-axis
    PL_Y_AXIS : constant Integer := 2; -- The y-axis
    PL_Z_AXIS : constant Integer := 3; -- The z-axis

    -- PLplot Option table & support constants 

    -- Option-specific settings 

    PL_OPT_ENABLED   : constant Integer := 16#0001#; -- Obsolete 
    PL_OPT_ARG       : constant Integer := 16#0002#; -- Option has an argment 
    PL_OPT_NODELETE  : constant Integer := 16#0004#; -- Don't delete after processing 
    PL_OPT_INVISIBLE : constant Integer := 16#0008#; -- Make invisible 
    PL_OPT_DISABLED  : constant Integer := 16#0010#; -- Processing is disabled 

    -- Option-processing settings -- mutually exclusive 

    PL_OPT_FUNC   : constant Integer := 16#0100#; -- Call handler function 
    PL_OPT_BOOL   : constant Integer := 16#0200#; -- Set *var = 1 
    PL_OPT_INT    : constant Integer := 16#0400#; -- Set *var = atoi(optarg) 
    PL_OPT_FLOAT  : constant Integer := 16#0800#; -- Set *var = atof(optarg) 
    PL_OPT_STRING : constant Integer := 16#1000#; -- Set var = optarg 

    -- Global mode settings 
    -- These override per-option settings 
    
    type Parse_Mode_Type is range 16#0000# .. 16#0001# + 16#0002# + 16#0004# + 
        16#0008# + 16#0010# + 16#0020# + 16#0040# + 16#0080#;
    
    PL_PARSE_PARTIAL   : constant Parse_Mode_Type := 16#0000#; -- For backward compatibility 
    PL_PARSE_FULL      : constant Parse_Mode_Type := 16#0001#; -- Process fully & exit if error 
    PL_PARSE_QUIET     : constant Parse_Mode_Type := 16#0002#; -- Don't issue messages 
    PL_PARSE_NODELETE  : constant Parse_Mode_Type := 16#0004#; -- Don't delete options after processing 
    PL_PARSE_SHOWALL   : constant Parse_Mode_Type := 16#0008#; -- Show invisible options 
    PL_PARSE_OVERRIDE  : constant Parse_Mode_Type := 16#0010#; -- Obsolete 
    PL_PARSE_NOPROGRAM : constant Parse_Mode_Type := 16#0020#; -- Program name NOT in *argv[0].. 
    PL_PARSE_NODASH    : constant Parse_Mode_Type := 16#0040#; -- Set if leading dash NOT required 
    PL_PARSE_SKIP      : constant Parse_Mode_Type := 16#0080#; -- Skip over unrecognized args 

    -- FCI (font characterization integer) related constants. 
    PL_FCI_MARK                : constant Integer := 16#10000000#;
    PL_FCI_IMPOSSIBLE          : constant Integer := 16#00000000#;
    PL_FCI_HEXDIGIT_MASK       : constant Integer := 16#f#;
    PL_FCI_HEXPOWER_MASK       : constant Integer := 16#7#;
    PL_FCI_HEXPOWER_IMPOSSIBLE : constant Integer := 16#f#;
    -- These define hexpower values corresponding to each font attribute. 
    PL_FCI_FAMILY : constant Integer := 16#0#;
    PL_FCI_STYLE  : constant Integer := 16#1#;
    PL_FCI_WEIGHT : constant Integer := 16#2#;
    -- These are legal values for font family attribute 
    PL_FCI_SANS   : constant Integer := 16#0#;
    PL_FCI_SERIF  : constant Integer := 16#1#;
    PL_FCI_MONO   : constant Integer := 16#2#;
    PL_FCI_SCRIPT : constant Integer := 16#3#;
    PL_FCI_SYMBOL : constant Integer := 16#4#;
    -- These are legal values for font style attribute 
    PL_FCI_UPRIGHT : constant Integer := 16#0#;
    PL_FCI_ITALIC  : constant Integer := 16#1#;
    PL_FCI_OBLIQUE : constant Integer := 16#2#;
    -- These are legal values for font weight attribute 
    PL_FCI_MEDIUM : constant Integer := 16#0#;
    PL_FCI_BOLD   : constant Integer := 16#1#;

    -- fix this
    --type PLOptionTable is
    --    record
    --        opt : char_array;
    --        int  (*handler)	(char *, char *, void *);
    --        void *client_data;
    --        void *var;
    --        mode : long;
    --        syntax : char_array;
    --        desc : char_array;
    --    end record;

    -- PLplot Graphics Input structure 


    PL_MAXKEY : constant Integer := 16;
    
    type PLGraphicsIn is
        record
            Event_Type : Integer; -- of event (CURRENTLY UNUSED)
            state      : unsigned; -- key or button mask 
            keysym     : unsigned; -- key selected 
            button     : unsigned; -- mouse button selected 
            subwindow  : PLINT;    -- subwindow (alias subpage, alias subplot) number 
            T_String   : String(1 .. PL_MAXKEY);
            pX, pY     : integer;  -- absolute device coordinates of pointer 
            dX, dY     : PLFLT;    -- relative device coordinates of pointer 
            wX, wY     : PLFLT;    -- world coordinates of pointer 
        end record;


    -- Structure for describing the plot window 

    PL_MAXWINDOWS : constant Integer := 64;	-- Max number of windows/page tracked 

    type PLWindow is
        record
            dxmi, dxma, dymi, dyma : PLFLT;	-- min, max window rel dev coords 
            wxmi, wxma, wymi, wyma : PLFLT;	-- min, max window world coords 
        end record;

    -- Structure for doing display-oriented operations via escape commands 
    -- May add other attributes in time 

    type PLDisplay is
        record
            x, y          : unsigned; -- upper left hand corner 
            width, height : unsigned; -- window dimensions 
        end record;

    -- Macro used (in some cases) to ignore value of argument 
    -- I don't plan on changing the value so you can hard-code it 

    -- Long_Float for Ada binding. Used with plsdidev which requires Long_Float. 
    -- C doesn't care if it is an integer, apparently converting it to a float.
    PL_NOTSET : constant Long_Float := -42.0;

    -- See plcont.c for examples of the following 


    -- PLfGrid is for passing (as a pointer to the first element) an arbitrarily
    -- dimensioned array.  The grid dimensions MUST be stored, with a maximum of 3
    -- dimensions assumed for now.
     

    -- fix this  I don't think Ada needs this. If otherwise, set an object of 
    -- type PLpointer to the 'Address attribute of the array.
    -- type PLfGrid is
    --    record
    --        f          : PL_Float_Array;
    --        nx, ny, nz : PLINT;
    --    end record;

    --
    -- PLfGrid2 is for passing (as an array of pointers) a 2d function array.  The
    -- grid dimensions are passed for possible bounds checking.
     

    -- fix this  I don't think Ada needs this since we use the procedure
    -- Matrix_To_Pointers.
    -- type PLfGrid2 is
    --    record
    --        f      : PL_Float_Array;
    --        nx, ny : PLINt;
    --    end record;

    --
    -- NOTE: a PLfGrid3 is a good idea here but there is no way to exploit it yet
    -- so I'll leave it out for now.
     

    -- PLcGrid is for passing (as a pointer to the first element) arbitrarily
    -- dimensioned coordinate transformation arrays.  The grid dimensions MUST be
    -- stored, with a maximum of 3 dimensions assumed for now.

    -- This variant record emulates PLcGrid. Use it in plvect, plcont, plfcont, 
    -- plshade, c_plshade1, c_plshades, plfshade, plf2eval2, plf2eval, plf2evalr, 
    -- PLcGrid and Ada counterparts thereof.
    type Transformation_Data_Type (x_Last, y_Last, z_Last : Natural) is
        record
            xg : PL_Float_Array(0 .. x_Last);
            yg : PL_Float_Array(0 .. y_Last);
            zg : PL_Float_Array(0 .. z_Last);
            nx : Natural := x_Last + 1;
            ny : Natural := y_Last + 1;
            nz : Natural := z_Last + 1;
        end record;

    -- PLcGrid2 is for passing (as arrays of pointers) 2d coordinate
    -- transformation arrays.  The grid dimensions are passed for possible bounds
    -- checking.
          
    -- This variant record emulates PLcGrid2.
    type Transformation_Data_Type_2 (x_Last, y_Last : Natural) is
        record
            xg : PL_Float_Array_2D(0 .. x_Last, 0 .. y_Last);
            yg : PL_Float_Array_2D(0 .. x_Last, 0 .. y_Last);
            zg : PL_Float_Array_2D(0 .. x_Last, 0 .. y_Last);
            nx : Natural := x_Last + 1;
            ny : Natural := y_Last + 1;
        end record;


    --NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet
    --so I'll leave it out for now.
     

    -- PLColor is the usual way to pass an rgb color value. 
    -- fix this
    -- This can't be converted to Ada without knowing what "name" is used for.
    -- There is nothing in the documentation about this structure nor is it used 
    -- in any of the examples.
    --type PLColor is
    --    record
    --        r : unsigned_char; -- red fix this surely these can be mod 2**3
    --        g : unsigned_char; -- green
    --        b : unsigned_char; -- blue
    --        name : char_array;
    --    end record;

    -- PLControlPt is how cmap1 control points are represented. 

    type PLControlPt is
        record
            h   : PLFLT;   -- hue 
            l   : PLFLT;   -- lightness 
            s   : PLFLT;   -- saturation 
            p   : PLFLT;   -- position 
            alt_hue_path : Integer; -- if set, interpolate through h=0 
        end record;

    -- A PLBufferingCB is a control block for interacting with devices
    -- that support double buffering. 

    type PLBufferingCB is
        record
            cmd    : PLINT;
            result : PLINT;
        end record;

    PLESC_DOUBLEBUFFERING_ENABLE  : constant Integer := 1;
    PLESC_DOUBLEBUFFERING_DISABLE : constant Integer := 2;
    PLESC_DOUBLEBUFFERING_QUERY   : constant Integer := 3;


--------------------------------------------------------------------------
--       Function Prototypes                                            --
--------------------------------------------------------------------------

    -- set the format of the contour labels 

    procedure
    pl_setcontlabelformat(lexp : PLINT; sigdig : PLINT);
    pragma Import(C, pl_setcontlabelformat, "c_pl_setcontlabelformat");


    -- set offset and spacing of contour labels 

    procedure
    pl_setcontlabelparam(offset : PLFLT; size : PLFLT; spacing : PLFLT; active : PLINT);
    pragma Import(C, pl_setcontlabelparam, "c_pl_setcontlabelparam");


    -- Advance to subpage "page", or to the next one if "page" = 0. 

    procedure
    pladv(page : PLINT);
    pragma Import(C, pladv, "c_pladv");


    -- Plot an arc.
    procedure
    plarc(x : PLFLT; y : PLFLT; a : PLFLT; b : PLFLT; angle1 : PLFLT; angle2 : PLFLT; rotate : PLFLT; fill : PLBOOL);
    pragma Import(C, plarc, "c_plarc");


    -- simple arrow plotter. 

    procedure
    plvect(u : Long_Float_Pointer_Array; v : Long_Float_Pointer_Array; 
        nx : PLINT; ny : PLINT; scale : PLFLT;
        pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plvect, "c_plvect");


    -- Set arrow style for vector plots.

    procedure
    plsvect(arrowx : PL_Float_Array; arrowy : PL_Float_Array; npts : PLINT; fill : PLINT);
    pragma Import(C, plsvect, "c_plsvect");
    
    
-- Ada hack to accomodate the C API that allows this call in C
-- plsvect( NULL, NULL, 0, 0 );
-- to reset the arrow style to a default value.
   
procedure
plsvectdefault(arrowx : PLPointer; arrowy : PLPointer; npts : PLINT; fill : PLINT);
pragma Import(C, plsvectdefault, "c_plsvect");



    -- This functions similarly to plbox() except that the origin of the axes 
    -- is placed at the user-specified point (x0, y0). 

    procedure
    plaxes(x0 : PLFLT; y0 : PLFLT; xopt : char_array; xtick : PLFLT; nxsub : PLINT;
         yopt : char_array; ytick : PLFLT; nysub : PLINT);
    pragma Import(C, plaxes, "c_plaxes");


    -- Plot a histogram using x to store data values and y to store frequencies 

    -- Flags for the opt argument in plbin
    PL_Bin_Default  : constant Integer := 0;
    PL_Bin_Centred  : constant Integer := 1;
    PL_Bin_Noexpand : constant Integer := 2;
    PL_Bin_Noempty  : constant Integer := 4;
    
    procedure
    plbin(nbin : PLINT; x : PL_Float_Array; y : PL_Float_Array; center : PLINT);
    pragma Import(C, plbin, "c_plbin");


    -- Calculate broken-down time from continuous time for current stream.
    procedure
    plbtime(year, month, day, hour, min : out PLINT;
        sec : out PLFLT; ctime : PLFLT);
    pragma Import(C, plbtime, "c_plbtime");


    -- Start new page.  Should only be used with pleop(). 

    procedure
    plbop;
    pragma Import(C, plbop, "c_plbop");


    -- This draws a box around the current viewport. 

    procedure
    plbox(xopt : char_array; xtick : PLFLT; nxsub : PLINT;
        yopt : char_array; ytick : PLFLT; nysub : PLINT);
    pragma Import(C, plbox, "c_plbox");


    -- This is the 3-d analogue of plbox(). 

    procedure
    plbox3(xopt : char_array; xlabel : char_array; xtick : PLFLT; nsubx : PLINT;
           yopt : char_array; ylabel : char_array; ytick : PLFLT; nsuby : PLINT;
           zopt : char_array; zlabel : char_array; ztick : PLFLT; nsubz : PLINT);
    pragma Import(C, plbox3, "c_plbox3");


    -- Calculate world coordinates and subpage from relative device coordinates. 

    procedure
    plcalc_world(rx : PLFLT; ry : PLFLT; wx : out PLFLT; wy : out PLFLT; window : out PLINT);
    pragma Import(C, plcalc_world, "c_plcalc_world");


    -- Clear current subpage. 

    procedure
    plclear;
    pragma Import(C, plclear, "c_plclear");


    -- Set color, map 0.  Argument is integer between 0 and 15. 

    procedure
    plcol0(icol0 : PLINT);
    pragma Import(C, plcol0, "c_plcol0");


    -- Set color, map 1.  Argument is a float between 0. and 1. 

    procedure
    plcol1(col1 : PLFLT);
    pragma Import(C, plcol1, "c_plcol1");


    -- Configure transformation between continuous and broken-down time (and
    -- vice versa) for current stream.
    procedure
    plconfigtime(skale, offset1, offset2 : PLFLT; ccontrol : PLINT;
        ifbtime_offset : PLBOOL; year, month, day, hour, min : PLINT; sec : PLFLT);
    pragma Import(C, plconfigtime, "c_plconfigtime");


    -- Draws a contour plot from data in f(nx,ny).  Is just a front-end to
    -- plfcont, with a particular choice for f2eval and f2eval_data.
 
    procedure
    plcont(z : Long_Float_Pointer_Array; nx, ny : Integer; 
        kx, lx, ky, ly : Integer; clevel : PL_Float_Array; nlevel : Integer; 
        pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plcont, "c_plcont");


    -- Draws a contour plot using the function evaluator f2eval and data stored
    -- by way of the f2eval_data pointer.  This allows arbitrary organizations
    -- of 2d array data to be used.
 
    procedure
    plfcont(f2eval : Function_Evaluator_Pointer_Type;
        Irregular_Data : PLpointer;
        nx, ny : PLINT; 
        kx, lx, ky, ly: PLINT; clevel : PL_Float_Array; nlevel : PLINT;
        pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plfcont, "plfcont");


    -- Copies state parameters from the reference stream to the current stream. 

    procedure
    plcpstrm(iplsr : PLINT; flags : PLINT);
    pragma Import(C, plcpstrm, "c_plcpstrm");


    -- Calculate continuous time from broken-down time for current stream.

    procedure
    plctime(year, month, day, hour, min : PLINT; sec : PLFLT;
        ctime : out PLFLT);
    pragma Import(C, plctime, "c_plctime");


    -- Converts input values from relative device coordinates to relative plot 
    -- coordinates. 

    procedure
    pldid2pc(xmin : PL_Float_Array; ymin : PL_Float_Array; xmax : PL_Float_Array; ymax : PL_Float_Array);
    pragma Import(C, pldid2pc, "pldid2pc");

    -- Converts input values from relative plot coordinates to relative 
    -- device coordinates. 

    procedure
    pldip2dc(xmin : PL_Float_Array; ymin : PL_Float_Array; xmax : PL_Float_Array; ymax : PL_Float_Array);
    pragma Import(C, pldip2dc, "pldip2dc");

    -- End a plotting session for all open streams. 

    procedure
    plend;
    pragma Import(C, plend, "c_plend");


    -- End a plotting session for the current stream only. 

    procedure
    plend1;
    pragma Import(C, plend1, "c_plend1");


    -- Simple interface for defining viewport and window. 

    procedure
    plenv(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT;
        just : PLINT; axis : PLINT);
    pragma Import(C, plenv, "c_plenv");



    -- similar to plenv() above, but in multiplot mode does not advance the subpage,
    -- instead the current subpage is cleared 

    procedure
    plenv0(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT;
        just : PLINT; axis : PLINT);
    pragma Import(C, plenv0, "c_plenv0");


    -- End current page.  Should only be used with plbop(). 

    procedure
    pleop;
    pragma Import(C, pleop, "c_pleop");


    -- Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) 

    procedure
    plerrx(n : PLINT; xmin : PL_Float_Array; xmax : PL_Float_Array; y : PL_Float_Array);
    pragma Import(C, plerrx, "c_plerrx");


    -- Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) 

    procedure
    plerry(n : PLINT; x : PL_Float_Array; ymin : PL_Float_Array; ymax : PL_Float_Array);
    pragma Import(C, plerry, "c_plerry");


    -- Advance to the next family file on the next new page 

    procedure
    plfamadv;
    pragma Import(C, plfamadv, "c_plfamadv");


    -- Pattern fills the polygon bounded by the input points. 

    procedure
    plfill(n : PLINT; x : PL_Float_Array; y : PL_Float_Array);
    pragma Import(C, plfill, "c_plfill");


    -- Pattern fills the 3d polygon bounded by the input points. 

    procedure
    plfill3(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array);
    pragma Import(C, plfill3, "c_plfill3");


    -- Flushes the output stream.  Use sparingly, if at all. 

    procedure
    plflush;
    pragma Import(C, plflush, "c_plflush");


    -- Sets the global font flag to 'ifont'. 

    procedure
    plfont(ifont : PLINT);
    pragma Import(C, plfont, "c_plfont");


    -- Load specified font set. 

    procedure
    plfontld(fnt : PLINT);
    pragma Import(C, plfontld, "c_plfontld");


    -- Get character default height and current (scaled) height 

    procedure
    plgchr(p_def : out PLFLT; p_ht : out PLFLT);
    pragma Import(C, plgchr, "c_plgchr");


    -- Returns 8 bit RGB values for given color from color map 0 

    procedure
    plgcol0(icol0 : PLINT; r : out PLINT; g : out PLINT; b : out PLINT);
    pragma Import(C, plgcol0, "c_plgcol0");
    
    
    -- Returns 8 bit RGB values for given color from color map 0 and alpha value

    procedure
    plgcol0a(icol0 : PLINT; r, g, b: out PLINT; a : out PLFLT);
    pragma Import(C, plgcol0a, "c_plgcol0a");


    -- Returns the background color by 8 bit RGB value 

    procedure
    plgcolbg(r : out PLINT; g : out PLINT; b : out PLINT);
    pragma Import(C, plgcolbg, "c_plgcolbg");


    -- Returns the background color by 8 bit RGB value and alpha value

    procedure
    plgcolbga(r, g, b : out PLINT; a : out PLFLT);
    pragma Import(C, plgcolbga, "c_plgcolbga");


    -- Returns the current compression setting 

    procedure
    plgcompression(compression : out PLINT);
    pragma Import(C, plgcompression, "c_plgcompression");


    -- Get the current device (keyword) name 

    procedure
    plgdev(p_dev : out char_array);
    pragma Import(C, plgdev, "c_plgdev");


    -- Retrieve current window into device space 

    procedure
    plgdidev(p_mar : out PLFLT; p_aspect : out PLFLT; p_jx : out PLFLT; p_jy : out PLFLT);
    pragma Import(C, plgdidev, "c_plgdidev");


    -- Get plot orientation 

    procedure
    plgdiori(p_rot : out PLFLT);
    pragma Import(C, plgdiori, "c_plgdiori");


    -- Retrieve current window into plot space 

    procedure
    plgdiplt(p_xmin : out PLFLT; p_ymin : out PLFLT; p_xmax : out PLFLT; p_ymax : out PLFLT);
    pragma Import(C, plgdiplt, "c_plgdiplt");


    -- Get FCI (font characterization integer) 

    procedure
    plgfci(pfci : out PLUNICODE);
    pragma Import(C, plgfci, "c_plgfci");
    
    
    -- Get family, style and weight of the current font

    procedure
    plgfont(p_family, p_style, p_weight : out PLINT);
    pragma Import(C, plgfont, "c_plgfont");


    -- Get family file parameters 

    procedure
    plgfam(p_fam : out PLINT; p_num : out PLINT; p_bmax : out PLINT);
    pragma Import(C, plgfam, "c_plgfam");


    -- Get the (current) output file name.  Must be preallocated to >80 bytes 

    procedure
    plgfnam(fnam : out char_array);
    pragma Import(C, plgfnam, "c_plgfnam");


    -- Get the (current) run level.  

    procedure
    plglevel(p_level : out PLINT);
    pragma Import(C, plglevel, "c_plglevel");


    -- Get output device parameters. 

    procedure
    plgpage(p_xp : out PLFLT; p_yp : out PLFLT;
          p_xleng : out PLINT; p_yleng : out PLINT; p_xoff : out PLINT; p_yoff : out PLINT);
    pragma Import(C, plgpage, "c_plgpage");


    -- Switches to graphics screen. 

    procedure
    plgra;
    pragma Import(C, plgra, "c_plgra");


    -- Draw gradient in polygon.

    procedure
    plgradient(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; angle : PLFLT);
    pragma Import(C, plgradient, "c_plgradient");


      -- grid irregularly sampled data 
    -- Ada Note: Since z_Gridded is passed as an array of pointers, this is 
    -- effectively the same as pass-by-reference so "in out" is not required for 
    -- the formal argument zg in plgriddata.

    procedure
    plgriddata(x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array; npts : PLINT;
           xg : PL_Float_Array; nptsx : PLINT; yg : PL_Float_Array;  nptsy : PLINT;
           zg : Long_Float_Pointer_Array; grid_type : PLINT; data : PLFLT); --"type" re-named "grid_type" for Ada
    pragma Import(C, plgriddata, "c_plgriddata");


      -- type of gridding algorithm for plgriddata() 

    GRID_CSA    : constant Integer := 1; -- Bivariate Cubic Spline approximation
    GRID_DTLI   : constant Integer := 2; -- Delaunay Triangulation Linear Interpolation
    GRID_NNI    : constant Integer := 3; -- Natural Neighbors Interpolation
    GRID_NNIDW  : constant Integer := 4; -- Nearest Neighbors Inverse Distance Weighted
    GRID_NNLI   : constant Integer := 5; -- Nearest Neighbors Linear Interpolation
    GRID_NNAIDW : constant Integer := 6; -- Nearest Neighbors Around Inverse Distance Weighted

    -- Get subpage boundaries in absolute coordinates 

    procedure
    plgspa(xmin : out PLFLT; xmax : out PLFLT; ymin : out PLFLT; ymax : out PLFLT);
    pragma Import(C, plgspa, "c_plgspa");


    -- Get current stream number. 

    procedure
    plgstrm(p_strm : out PLINT);
    pragma Import(C, plgstrm, "c_plgstrm");


    -- Get the current library version number 

    procedure
    plgver(p_ver : out char_array);
    pragma Import(C, plgver, "c_plgver");


    -- Get viewport boundaries in normalized device coordinates 

    procedure
    plgvpd(p_xmin : out PLFLT; p_xmax : out PLFLT; p_ymin : out PLFLT; p_ymax : out PLFLT);
    pragma Import(C, plgvpd, "c_plgvpd");


    -- Get viewport boundaries in world coordinates 

    procedure
    plgvpw(p_xmin : out PLFLT; p_xmax : out PLFLT; p_ymin : out PLFLT; p_ymax : out PLFLT);
    pragma Import(C, plgvpw, "c_plgvpw");


    -- Get x axis labeling parameters 

    procedure
    plgxax(p_digmax : out PLINT; p_digits : out PLINT);
    pragma Import(C, plgxax, "c_plgxax");


    -- Get y axis labeling parameters 

    procedure
    plgyax(p_digmax : out PLINT; p_digits : out PLINT);
    pragma Import(C, plgyax, "c_plgyax");


    -- Get z axis labeling parameters 

    procedure
    plgzax(p_digmax : out PLINT; p_digits : out PLINT);
    pragma Import(C, plgzax, "c_plgzax");


    -- Draws a histogram of n values of a variable in array data[0..n-1] 

    -- Flags for the opt argument in plhist
    PL_Hist_Default         : constant Integer := 0;
    PL_Hist_Noscaling       : constant Integer := 1;
    PL_Hist_Ignore_Outliers : constant Integer := 2;
    PL_Hist_Noexpand        : constant Integer := 8;
    PL_Hist_Noempty         : constant Integer := 16;

    procedure
    plhist(n : PLINT; data : PL_Float_Array; datmin : PLFLT; datmax : PLFLT;
         nbin : PLINT; oldwin : PLINT);
    pragma Import(C, plhist, "c_plhist");


    -- Set current color (map 0) by hue, lightness, and saturation. 

    -- procedure
    -- plhls(h : PLFLT; l : PLFLT; s : PLFLT);
    -- pragma Import(C, plhls, "c_plhls");


    -- Functions for converting between HLS and RGB color space 

    procedure
    plhlsrgb(h : PLFLT; l : PLFLT; s : PLFLT; p_r : out PLFLT; p_g : out PLFLT; p_b : out PLFLT);
    pragma Import(C, plhlsrgb, "c_plhlsrgb");


    -- Initializes PLplot, using preset or default options 

    procedure
    plinit;
    pragma Import(C, plinit, "c_plinit");


    -- Draws a line segment from (x1, y1) to (x2, y2). 

    procedure
    pljoin(x1 : PLFLT; y1 : PLFLT; x2 : PLFLT; y2 : PLFLT);
    pragma Import(C, pljoin, "c_pljoin");


    -- Simple routine for labelling graphs. 

    procedure
    pllab(xlabel : char_array; ylabel : char_array; tlabel : char_array);
    pragma Import(C, pllab, "c_pllab");


    -- Legend and colorbar position options are chosen by adding their values.
    subtype Legend_Colorbar_Position_Type is Integer range
        1 .. 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128;

    --Flags used for position argument of both pllegend and plcolorbar
    PL_Position_Left     : constant Legend_Colorbar_Position_Type := 1;
    PL_Position_Right    : constant Legend_Colorbar_Position_Type := 2;
    PL_Position_Top      : constant Legend_Colorbar_Position_Type := 4;
    PL_Position_Bottom   : constant Legend_Colorbar_Position_Type := 8;
    PL_Position_Inside   : constant Legend_Colorbar_Position_Type := 16;
    PL_Position_Outside  : constant Legend_Colorbar_Position_Type := 32;
    PL_Position_Viewport : constant Legend_Colorbar_Position_Type := 64;
    PL_Position_Subpage  : constant Legend_Colorbar_Position_Type := 128;

    -- Legend characteristics are chosen by adding flag values.
    subtype Legend_Flag_Type is Integer range 1 .. 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128;

    -- Flags for pllegend
    PL_Legend_None         : constant Legend_Flag_Type := 1;
    PL_Legend_Color_Box    : constant Legend_Flag_Type := 2;
    PL_Legend_Line         : constant Legend_Flag_Type := 4;
    PL_Legend_Symbol       : constant Legend_Flag_Type := 8;
    PL_Legend_Text_Left    : constant Legend_Flag_Type := 16;
    PL_Legend_Background   : constant Legend_Flag_Type := 32;
    PL_Legend_Bounding_Box : constant Legend_Flag_Type := 64;
    PL_Legend_Row_Major    : constant Legend_Flag_Type := 128;

    -- Colorbar characteristics are chosen by adding flag values.
    subtype Colorbar_Flag_Type is Integer range 1 .. 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 
        512 + 1024 + 2048 + 4096 + 8192 + 16384 + 32768 + 65536;

    -- Flags for plcolorbar
    PL_Colorbar_Label_Left    : constant Colorbar_Flag_Type := 1;
    PL_Colorbar_Label_Right   : constant Colorbar_Flag_Type := 2;
    PL_Colorbar_Label_Top     : constant Colorbar_Flag_Type := 4;
    PL_Colorbar_Label_Bottom  : constant Colorbar_Flag_Type := 8;
    PL_Colorbar_Image         : constant Colorbar_Flag_Type := 16;
    PL_Colorbar_Shade         : constant Colorbar_Flag_Type := 32;
    PL_Colorbar_Gradient      : constant Colorbar_Flag_Type := 64;
    PL_Colorbar_Cap_Low       : constant Colorbar_Flag_Type := 256;
    PL_Colorbar_Cap_High      : constant Colorbar_Flag_Type := 512;
    PL_Colorbar_Shade_Label   : constant Colorbar_Flag_Type := 1024;
    PL_Colorbar_Orient_Right  : constant Colorbar_Flag_Type := 2048;
    PL_Colorbar_Orient_Top    : constant Colorbar_Flag_Type := 4096;
    PL_Colorbar_Orient_Left   : constant Colorbar_Flag_Type := 8192;
    PL_Colorbar_Orient_Bottom : constant Colorbar_Flag_Type := 16384;
    PL_Colorbar_Background    : constant Colorbar_Flag_Type := 32768;
    PL_Colorbar_Bounding_Box  : constant Colorbar_Flag_Type := 65536;

     -- Flags for drawing mode
    PL_Drawmode_Unknown : constant Integer := 0;
    PL_Drawmode_Default : constant Integer := 1;
    PL_Drawmode_Replace : constant Integer := 2;
    PL_Drawmode_Xor     : constant Integer := 4;

    -- Routine for drawing discrete line, symbol, or cmap0 legends
    procedure
    pllegend
       (p_legend_width : out PLFLT; p_legend_height : out PLFLT;
        opt : PLINT; plposition : PLINT; x : PLFLT; y : PLFLT; plot_width : PLFLT;
        bg_color : PLINT; bb_color : PLINT; bb_style : PLINT;
        nrow : PLINT; ncolumn : PLINT;
        nlegend : PLINT; opt_array : PL_Integer_Array;
        text_offset : PLFLT; text_scale : PLFLT; text_spacing : PLFLT;
        text_justification : PLFLT;
        text_colors : PL_Integer_Array; -- fixme these are actually colors; map to them in Ada
        text : PL_Legend_String_Array;
        box_colors : PL_Integer_Array; box_patterns : PL_Integer_Array;
        box_scales : PL_Float_Array; box_line_widths : PL_Float_Array;
        line_colors : PL_Integer_Array; line_styles : PL_Integer_Array;
        line_widths : PL_Float_Array;
        symbol_colors : PL_Integer_Array; symbol_scales : PL_Float_Array;
        symbol_numbers : PL_Integer_Array;
        symbols : PL_Legend_String_Array);
    pragma Import(C, pllegend, "c_pllegend");


    -- Routine for drawing continous colour legends
    procedure
    plcolorbar
       (p_colorbar_width : out PLFLT; p_colorbar_height : out PLFLT;
        opt : PLINT; position : PLINT; x : PLFLT; y : PLFLT;
        x_length : PLFLT; y_length : PLFLT;
        bg_color : PLINT; bb_color : PLINT; bb_style : PLINT;
        low_cap_color : PLFLT; high_cap_color : PLFLT;
        cont_color : PLINT; cont_width : PLFLT;
        n_labels : PLINT; label_opts : PL_Integer_Array; labels : PL_Legend_String_Array;
        n_axes : PLINT; axis_opts : PL_Legend_String_Array;
        ticks : PL_Float_Array; sub_ticks : PL_Integer_Array;
        n_values : PL_Integer_Array; values : Long_Float_Pointer_Array);
    pragma Import(C, plcolorbar, "c_plcolorbar");


    -- Sets position of the light source 

    procedure
    pllightsource(x : PLFLT; y : PLFLT; z : PLFLT);
    pragma Import(C, pllightsource, "c_pllightsource");


    -- Draws line segments connecting a series of points. 

    procedure
    plline(n : PLINT; x : PL_Float_Array; y : PL_Float_Array);
    pragma Import(C, plline, "c_plline");


    -- Draws a line in 3 space.  

    procedure
    plline3(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array);
    pragma Import(C, plline3, "c_plline3");


    -- Set line style. 

    procedure
    pllsty(lin : PLINT);
    pragma Import(C, pllsty, "c_pllsty");


    -- plot continental outline in world coordinates 

    procedure
    plmap(mapform : Map_Form_Function_Pointer_Type; Map_Kind_C_String : char_array;
             minlong : PLFLT; maxlong : PLFLT; minlat : PLFLT; maxlat : PLFLT);
    pragma Import(C, plmap, "c_plmap");


    -- Plot the latitudes and longitudes on the background. 

    procedure
    plmeridians(mapform : Map_Form_Function_Pointer_Type;
                   dlong : PLFLT; dlat : PLFLT;
                   minlong : PLFLT; maxlong : PLFLT; minlat : PLFLT; maxlat : PLFLT);
    pragma Import(C, plmeridians, "c_plmeridians");


    -- Plots a mesh representation of the function z(x, y). 

    procedure
    plmesh(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; opt : PLINT);
    pragma Import(C, plmesh, "c_plmesh");


    -- Plots a mesh representation of the function z(x, y) with contour 

    procedure
    plmeshc(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; opt : PLINT;
          clevel : PL_Float_Array; nlevel : PLINT);
    pragma Import(C, plmeshc, "c_plmeshc");


    -- Creates a new stream and makes it the default.  

    procedure
    plmkstrm(p_strm : out PLINT);
    pragma Import(C, plmkstrm, "c_plmkstrm");


    -- Prints out "text" at specified position relative to viewport 

    procedure
    plmtex(side : char_array; disp : PLFLT; pos : PLFLT; just : PLFLT;
         text : char_array);
    pragma Import(C, plmtex, "c_plmtex");


    -- Prints out "text" at specified position relative to viewport (3D)

    procedure
    plmtex3(side : char_array; disp, pos, just : PLFLT; text : char_array);
    pragma Import(C, plmtex3, "c_plmtex3");


    -- Plots a 3-d representation of the function z(x, y). 

    procedure
    plot3d(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array;
         nx : PLINT; ny : PLINT; opt : PLINT; side : PLINT);
    pragma Import(C, plot3d, "c_plot3d");


    -- Plots a 3-d representation of the function z(x, y) with contour. 

    procedure
    plot3dc(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array;
         nx : PLINT; ny : PLINT; opt : PLINT;
         clevel : PL_Float_Array; nlevel : PLINT);
    pragma Import(C, plot3dc, "c_plot3dc");


    -- Plots a 3-d representation of the function z(x, y) with contour and
    -- y index limits. 

    procedure
    plot3dcl(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array;
         nx : PLINT; ny : PLINT; opt : PLINT;
         clevel : PL_Float_Array; nlevel : PLINT; 
         ixstart : PLINT; ixn : PLINT; indexymin : PL_Integer_Array; indexymax : PL_Integer_Array);
    pragma Import(C, plot3dcl, "c_plot3dcl");


    -- definitions for the opt argument in plot3dc() and plsurf3d()
    -- DRAW_LINEX *must* be 1 and DRAW_LINEY *must* be 2, because of legacy code!
    -- fix this Why is there no type declared for these?
    DRAW_LINEX  : constant Integer := 1;   -- draw lines parallel to the X axis
    DRAW_LINEY  : constant Integer := 2;   -- draw lines parallel to the Y axis
    DRAW_LINEXY : constant Integer := 3;   -- draw lines parallel to both the X and Y axis
    MAG_COLOR   : constant Integer := 4;   -- draw the mesh with a color dependent of the magnitude
    BASE_CONT   : constant Integer := 8;   -- draw contour plot at bottom xy plane
    TOP_CONT    : constant Integer := 16;  -- draw contour plot at top xy plane
    SURF_CONT   : constant Integer := 32;  -- draw contour plot at surface
    DRAW_SIDES  : constant Integer := 64;  -- draw sides
    FACETED     : constant Integer := 128; -- draw outline for each square that makes up the surface
    MESH        : constant Integer := 256; -- draw mesh

       --  valid options for plot3dc():
       --
       --  DRAW_SIDES, BASE_CONT, TOP_CONT (not yet),
       --  MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY.
       --
       --  valid options for plsurf3d():
       --
       --  MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES.
   

    -- Set fill pattern directly. 

    procedure
    plpat(nlin : PLINT; inc : PL_Integer_Array; del : PL_Integer_Array);
    pragma Import(C, plpat, "c_plpat");


    -- Draw a line connecting two points, accounting for coordinate transforms.

    procedure
    plpath(n : PLINT; x1 : PLFLT; y1 : PLFLT; x2 : PLFLT; y2 : PLFLT);
    pragma Import(C, plpath, "c_plpath");


    -- Plots array y against x for n points using ASCII code "code".

    procedure
    plpoin(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; code : PLINT);
    pragma Import(C, plpoin, "c_plpoin");


    -- Draws a series of points in 3 space. 

    procedure
    plpoin3(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array; code : PLINT);
    pragma Import(C, plpoin3, "c_plpoin3");


    -- Draws a polygon in 3 space.  

    procedure
    plpoly3(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array; draw : PL_Bool_Array; ifcc : PLBOOL);
    pragma Import(C, plpoly3, "c_plpoly3");


    -- Set the floating point precision (in number of places) in numeric labels. 

    procedure
    plprec(setp : PLINT; prec : PLINT);
    pragma Import(C, plprec, "c_plprec");


    -- Set fill pattern, using one of the predefined patterns.

    procedure
    plpsty(patt : PLINT);
    pragma Import(C, plpsty, "c_plpsty");


    -- Prints out "text" at world cooordinate (x,y). 

    procedure
    plptex(x : PLFLT; y : PLFLT; dx : PLFLT; dy : PLFLT; just : PLFLT; text : char_array);
    pragma Import(C, plptex, "c_plptex");


    -- Prints out "text" at world cooordinate (x,y,z).

    procedure
    plptex3(wx, wy, wz, dx, dy, dz, sx, sy, sz, just : PLFLT; text : char_array);
    pragma Import(C, plptex3, "c_plptex3");


    -- Random number generator based on Mersenne Twister.
    -- Obtain real random number in range [0,1].

    function
    plrandd return PLFLT;
    pragma Import(C, plrandd, "c_plrandd");


    -- Replays contents of plot buffer to current device/file. 

    procedure
    plreplot;
    pragma Import(C, plreplot, "c_plreplot");


    -- Set line color by red, green, blue from  0. to 1. 

    -- procedure
    -- plrgb(r : PLFLT; g : PLFLT; b : PLFLT);
    -- pragma Import(C, plrgb, "c_plrgb");


    -- Set line color by 8 bit RGB values. 

    -- procedure
    -- plrgb1(r : PLINT; g : PLINT; b : PLINT);
    -- pragma Import(C, plrgb1, "c_plrgb1");


    -- Functions for converting between HLS and RGB color space 

    procedure
    plrgbhls(r : PLFLT; g : PLFLT; b : PLFLT; p_h : out PLFLT; p_l : out PLFLT; p_s : out PLFLT);
    pragma Import(C, plrgbhls, "c_plrgbhls");


    -- Set character height. 

    procedure
    plschr(def : PLFLT; scale : PLFLT);
    pragma Import(C, plschr, "c_plschr");


    -- Set color map 0 colors by 8 bit RGB values 

    procedure
    plscmap0(r : PL_Integer_Array; g : PL_Integer_Array; b : PL_Integer_Array; ncol0 : PLINT);
    pragma Import(C, plscmap0, "c_plscmap0");


    -- Set color map 0 colors by 8 bit RGB values and alpha values

    procedure
    plscmap0a(r, g, b : PL_Integer_Array; a : PL_Float_Array; ncol0 : PLINT);
    pragma Import(C, plscmap0a, "c_plscmap0a");


    -- Set number of colors in cmap 0 

    procedure
    plscmap0n(ncol0 : PLINT);
    pragma Import(C, plscmap0n, "c_plscmap0n");


    -- Set color map 1 colors by 8 bit RGB values 

    procedure
    plscmap1(r : PL_Integer_Array; g : PL_Integer_Array; b : PL_Integer_Array; ncol1 : PLINT);
    pragma Import(C, plscmap1, "c_plscmap1");


    -- Set color map 1 colors by 8 bit RGB and alpha values

    procedure
    plscmap1a(r, g, b : PL_Integer_Array; a : PL_Float_Array; ncol1 : PLINT);
    pragma Import(C, plscmap1a, "c_plscmap1a");


    -- Set color map 1 colors using a piece-wise linear relationship between 
    -- intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 

    procedure
    plscmap1l(itype : PLINT; npts : PLINT; intensity : PL_Float_Array;
        coord1 : PL_Float_Array; coord2 : PL_Float_Array; coord3 : PL_Float_Array; 
        alt_hue_path : PL_Bool_Array);
    pragma Import(C, plscmap1l, "c_plscmap1l");


    -- Set color map 1 colors using a piece-wise linear relationship between
    -- intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
    -- Will also linear interpolate alpha values.

    procedure
    plscmap1la(itype : PLINT; npts : PLINT;
        intensity, coord1, coord2, coord3, a : PL_Float_Array; 
        alt_hue_path : PL_Bool_Array);
    pragma Import(C, plscmap1la, "c_plscmap1la");


    -- Set number of colors in cmap 1 

    procedure
    plscmap1n(ncol1 : PLINT);
    pragma Import(C, plscmap1n, "c_plscmap1n");


    -- Set the color map 1 range used in continuous plots.

    procedure
    plscmap1_range(min_color : PLFLT; max_color : PLFLT);
    pragma Import(C, plscmap1_range, "c_plscmap1_range");


    -- Get the color map 1 range used in continuous plots

    procedure
    plgcmap1_range(min_color, max_color : out PLFLT);
    pragma Import(C, plgcmap1_range, "c_plgcmap1_range");


    -- Set a given color from color map 0 by 8 bit RGB value 

    procedure
    plscol0(icol0 : PLINT; r : PLINT; g : PLINT; b : PLINT);
    pragma Import(C, plscol0, "c_plscol0");


    -- Set a given color from color map 0 by 8 bit RGB value and alpha value

    procedure
    plscol0a(icol0 : PLINT; r, g, b : PLINT; a : PLFLT);
    pragma Import(C, plscol0a, "c_plscol0a");


    -- Set the background color by 8 bit RGB value 

    procedure
    plscolbg(r : PLINT; g : PLINT; b : PLINT);
    pragma Import(C, plscolbg, "c_plscolbg");


    -- Set the background color by 8 bit RGB value and alpha value

    procedure
    plscolbga(r, g, b : PLINT; a : PLFLT);
    pragma Import(C, plscolbga, "c_plscolbga");


    -- Used to globally turn color output on/off 

    procedure
    plscolor(color : PLINT);
    pragma Import(C, plscolor, "c_plscolor");


    -- Set the compression level 

    procedure
    plscompression(compression : PLINT);
    pragma Import(C, plscompression, "c_plscompression");


    -- Set the device (keyword) name 

    procedure
    plsdev(devname : char_array);
    pragma Import(C, plsdev, "c_plsdev");


    -- Set window into device space using margin, aspect ratio, and 
    -- justification 

    procedure
    plsdidev(mar : PLFLT; aspect : PLFLT; jx : PLFLT; jy : PLFLT);
    pragma Import(C, plsdidev, "c_plsdidev");


    -- Set up transformation from metafile coordinates. 

    procedure
    plsdimap(dimxmin : PLINT; dimxmax : PLINT; dimymin : PLINT; dimymax : PLINT;
           dimxpmm : PLFLT; dimypmm : PLFLT);
    pragma Import(C, plsdimap, "c_plsdimap");


    -- Set plot orientation, specifying rotation in units of pi/2. 

    procedure
    plsdiori(rot : PLFLT);
    pragma Import(C, plsdiori, "c_plsdiori");


    -- Set window into plot space 

    procedure
    plsdiplt(xmin : PLFLT; ymin : PLFLT; xmax : PLFLT; ymax : PLFLT);
    pragma Import(C, plsdiplt, "c_plsdiplt");


    -- Set window into plot space incrementally (zoom) 

    procedure
    plsdiplz(xmin : PLFLT; ymin : PLFLT; xmax : PLFLT; ymax : PLFLT);
    pragma Import(C, plsdiplz, "c_plsdiplz");


    -- Set seed for internal random number generator

    procedure
    plseed(s : unsigned);
    pragma Import(C, plseed, "c_plseed");


    -- Set the escape character for text strings. 

    procedure
    plsesc(esc : char);
    pragma Import(C, plsesc, "c_plsesc");


    -- Set family file parameters 

    procedure
    plsfam(fam : PLINT; num : PLINT; bmax : PLINT);
    pragma Import(C, plsfam, "c_plsfam");


    -- Set FCI (font characterization integer) 

    procedure
    plsfci(fci : PLUNICODE);
    pragma Import(C, plsfci, "c_plsfci");
    
    
    -- Set the font family, style and weight

    procedure
    plsfont(family, style, weight : PLINT);
    pragma Import(C, plsfont, "c_plsfont");


    -- Set the output file name. 

    procedure
    plsfnam(fnam : char_array);
    pragma Import(C, plsfnam, "c_plsfnam");


    -- Shade region. 

    procedure
    plshade(a : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type;
          left : PLFLT; right : PLFLT; bottom : PLFLT; top : PLFLT;
          shade_min : PLFLT; shade_max : PLFLT;
          sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLFLT;
          min_color : PLINT; min_width : PLFLT;
          max_color : PLINT; max_width : PLFLT;
          fill : Fill_Procedure_Pointer_Type; rectangular : PLINT;
          pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plshade, "c_plshade");


    procedure
    plshade1(a : PL_Float_Array_2D; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type;
          left : PLFLT; right : PLFLT; bottom : PLFLT; top : PLFLT;
          shade_min : PLFLT; shade_max : PLFLT;
          sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLFLT;
          min_color : PLINT; min_width : PLFLT;
          max_color : PLINT; max_width : PLFLT;
          fill : Fill_Procedure_Pointer_Type; rectangular : PLINT;
          pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plshade1, "c_plshade1");


    procedure
    plshades(z : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type;
          xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT;
          clevel : PL_Float_Array; nlevel : PLINT; fill_width : PLFLT;
          cont_color : PLINT; cont_width : PLFLT;
          fill : Fill_Procedure_Pointer_Type; rectangular : PLINT;
          pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer);
    pragma Import(C, plshades, "c_plshades");


-- fix this
--    procedure
--    plfshade(PLFLT (*f2eval) ( : PLINT;  : PLINT; PLPointer),
--         PLPointer f2eval_data,
--         PLFLT (*c2eval) ( : PLINT;  : PLINT; PLPointer),
--         PLPointer c2eval_data,
--         nx : PLINT; ny : PLINT;
--         left : PLFLT; right : PLFLT; bottom : PLFLT; top : PLFLT;
--         shade_min : PLFLT; shade_max : PLFLT;
--         sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLINT;
--         min_color : PLINT; min_width : PLINT;
--         max_color : PLINT; max_width : PLINT;
--         void (*fill) ( : PLINT;  : PL_Float_Array;  : PL_Float_Array), rectangular : PLINT;
--         void (*pltr) ( : PLFLT;  : PLFLT;  : PL_Float_Array;  : PL_Float_Array; PLPointer),
--         PLPointer pltr_data);
--    pragma Import(C, plfshade, "plfshade");


    -- Setup a user-provided custom labeling function.

    procedure
    plslabelfunc(label_func : Custom_Label_Procedure_Pointer_Type; label_data : PLPointer);
    pragma Import(C, plslabelfunc, "c_plslabelfunc");


    -- Set up lengths of major tick marks. 

    procedure
    plsmaj(def : PLFLT; scale : PLFLT);
    pragma Import(C, plsmaj, "c_plsmaj");


    -- Set the memory area to be plotted (with the 'mem' driver) 

    procedure
    plsmem(maxx : PLINT; maxy : PLINT; plotmem : PLPointer);
    pragma Import(C, plsmem, "c_plsmem");


    -- Set up lengths of minor tick marks. 

    procedure
    plsmin(def : PLFLT; scale : PLFLT);
    pragma Import(C, plsmin, "c_plsmin");


    -- Set orientation.  Must be done before calling plinit. 

    procedure
    plsori(ori : PLINT);
    pragma Import(C, plsori, "c_plsori");


    -- Set output device parameters.  Usually ignored by the driver. 

    procedure
    plspage(xp : PLFLT; yp : PLFLT; xleng : PLINT; yleng : PLINT;
          xoff : PLINT; yoff : PLINT);
    pragma Import(C, plspage, "c_plspage");


    -- Set the colors for color table 0 from a cmap0 file.

    procedure
    plspal0(filename : char_array);
    pragma Import(C, plspal0, "c_plspal0");

    
    -- Set the colors for color table 1 from a cmap1 file.
    procedure
    plspal1(filename : char_array; interpolate : PLBOOL);
    pragma Import(C, plspal1, "c_plspal1");


    -- Set the pause (on end-of-page) status 

    procedure
    plspause(pause : PLINT);
    pragma Import(C, plspause, "c_plspause");


    -- Set stream number.  

    procedure
    plsstrm(strm : PLINT);
    pragma Import(C, plsstrm, "c_plsstrm");


    -- Set the number of subwindows in x and y 

    procedure
    plssub(nx : PLINT; ny : PLINT);
    pragma Import(C, plssub, "c_plssub");


    -- Set symbol height. 

    procedure
    plssym(def : PLFLT; scale : PLFLT);
    pragma Import(C, plssym, "c_plssym");


    -- Initialize PLplot, passing in the windows/page settings. 

    procedure
    plstar(nx : PLINT; ny : PLINT);
    pragma Import(C, plstar, "c_plstar");


    -- Initialize PLplot, passing the device name and windows/page settings. 

    procedure
    plstart(devname : char_array; nx : PLINT; ny : PLINT);
    pragma Import(C, plstart, "c_plstart");


    --Set the coordinate transform

    procedure
    plstransform(coordinate_transform : Coordinate_Transform_Procedure_Pointer_Type;
        coordinate_transform_data : PLpointer);
    pragma Import(C, plstransform, "c_plstransform");


    -- Prints out the same string repeatedly at the n points in world
    -- coordinates given by the x and y arrays.  Supersedes plpoin and
    -- plsymbol for the case where text refers to a unicode glyph either
    -- directly as UTF-8 or indirectly via the standard text escape
    -- sequences allowed for PLplot input strings.

    procedure
    plstring(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; cstring : char_array);
    pragma Import(C, plstring, "c_plstring");


    -- Prints out the same string repeatedly at the n points in world
    -- coordinates given by the x, y, and z arrays.  Supersedes plpoin3
    -- for the case where text refers to a unicode glyph either directly
    -- as UTF-8 or indirectly via the standard text escape sequences
    -- allowed for PLplot input strings.

    procedure
    plstring3(n : PLINT; x : PL_Float_Array; y : PL_Float_Array;  
        z : PL_Float_Array; cstring : char_array);
    pragma Import(C, plstring3, "c_plstring3");


    -- Add a point to a stripchart.  

    procedure
    plstripa(id : PLINT; pen : PLINT; x : PLFLT; y : PLFLT);
    pragma Import(C, plstripa, "c_plstripa");


    -- Create 1d stripchart 

    procedure
    plstripc(id : out PLINT; xspec : char_array; yspec : char_array;
        xmin : PLFLT; xmax : PLFLT; xjump : PLFLT; ymin : PLFLT; ymax : PLFLT;
        xlpos : PLFLT; ylpos : PLFLT;
        y_ascl : PLBOOL; acc : PLBOOL;
        colbox : PLINT; collab : PLINT;
        colline : PL_Integer_Array; styline : PL_Integer_Array; legline : PL_Stripchart_String_Array;
        labx : char_array; laby : char_array; labtop : char_array);
    pragma Import(C, plstripc, "c_plstripc");


    -- Deletes and releases memory used by a stripchart.  

    procedure
    plstripd(id : PLINT);
    pragma Import(C, plstripd, "c_plstripd");


    -- plots a 2d image (or a matrix too large for plshade() )

    procedure 
    plimagefr(data : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT;
        xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT; zmin : PLFLT; zmax : PLFLT;
        valuemin :PLFLT; valuemax : PLFLT;
        pltr : Transformation_Procedure_Pointer_Type;
        pltr_data : PLpointer);
    pragma Import(C, plimagefr, "c_plimagefr");


      -- plots a 2d image (or a matrix too large for plshade() ) 

    procedure
    plimage(data : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT;
         xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT; zmin : PLFLT; zmax : PLFLT;
         Dxmin : PLFLT; Dxmax : PLFLT; Dymin : PLFLT; Dymax : PLFLT);
    pragma Import(C, plimage, "c_plimage");

    -- Set up a new line style 

    procedure
    plstyl(nms : PLINT; mark : PL_Integer_Array; space : PL_Integer_Array);
    pragma Import(C, plstyl, "c_plstyl");


    -- Plots the 3d surface representation of the function z(x, y). 

    procedure
    plsurf3d(x : PL_Float_Array; y : PL_Float_Array; z : Long_Float_Pointer_Array; nx : PLINT; ny :  PLINT;
           opt : PLINT; clevel : PL_Float_Array; nlevel : PLINT);
    pragma Import(C, plsurf3d, "c_plsurf3d");


    -- Plots the 3d surface representation of the function z(x, y) with y
    -- index limits. 

    procedure
    plsurf3dl(x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array_2D; nx : PLINT; ny : PLINT;
           opt : PLINT; clevel : PL_Float_Array; nlevel : PLINT;
           ixstart : PLINT; ixn : PLINT; indexymin : out PLINT; indexymax : out PLINT);
    pragma Import(C, plsurf3dl, "c_plsurf3dl");


    -- Sets the edges of the viewport to the specified absolute coordinates 

    procedure
    plsvpa(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT);
    pragma Import(C, plsvpa, "c_plsvpa");


    -- Set x axis labeling parameters 

    procedure
    plsxax(digmax : PLINT; field_digits : PLINT); -- "digits" changed to "field_digits".
    pragma Import(C, plsxax, "c_plsxax");


    -- Set inferior X window 

    procedure
    plsxwin(window_id : PLINT);
    pragma Import(C, plsxwin, "plsxwin");

    -- Set y axis labeling parameters 

    procedure
    plsyax(digmax : PLINT; field_digits : PLINT); -- "digits" changed to "field_digits".
    pragma Import(C, plsyax, "c_plsyax");


    -- Plots array y against x for n points using Hershey symbol "code" 

    procedure
    plsym(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; code : PLINT);
    pragma Import(C, plsym, "c_plsym");


    -- Set z axis labeling parameters 

    procedure
    plszax(digmax : PLINT; field_digits : PLINT); -- "digits" changed to "field_digits".
    pragma Import(C, plszax, "c_plszax");


    -- Switches to text screen. 

    procedure
    pltext;
    pragma Import(C, pltext, "c_pltext");
    

    -- Set the format for date / time labels

    procedure
    pltimefmt(fmt : char_array);
    pragma Import(C, pltimefmt, "c_pltimefmt");


    -- Sets the edges of the viewport with the given aspect ratio, leaving 
    -- room for labels. 

    procedure
    plvasp(aspect : PLFLT);
    pragma Import(C, plvasp, "c_plvasp");


    -- Creates the largest viewport of the specified aspect ratio that fits 
    -- within the specified normalized subpage coordinates. 

    procedure
    plvpas(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT; aspect : PLFLT);
    pragma Import(C, plvpas, "c_plvpas");


    -- Creates a viewport with the specified normalized subpage coordinates. 

    procedure
    plvpor(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT);
    pragma Import(C, plvpor, "c_plvpor");


    -- Defines a "standard" viewport with seven character heights for 
    -- the left margin and four character heights everywhere else. 

    procedure
    plvsta;
    pragma Import(C, plvsta, "c_plvsta");


    -- Set up a window for three-dimensional plotting. 

    procedure
    plw3d(basex : PLFLT; basey : PLFLT; height : PLFLT; xmin0 : PLFLT;
        xmax0 : PLFLT; ymin0 : PLFLT; ymax0 : PLFLT; zmin0 : PLFLT;
        zmax0 : PLFLT; alt : PLFLT; az : PLFLT);
    pragma Import(C, plw3d, "c_plw3d");


    -- Set pen width. 

    procedure
    plwidth(width : PLFLT);
    pragma Import(C, plwidth, "c_plwidth");


    -- Set up world coordinates of the viewport boundaries (2d plots). 

    procedure
    plwind(xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT);
    pragma Import(C, plwind, "c_plwind");


    --  set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device  

    procedure
    plxormod(mode : PLINT; status : out PLINT);
    pragma Import(C, plxormod, "c_plxormod");


--------------------------------------------------------------------------------
--         Functions for use from C or C++ only                               --
--         (Not really ;).                                                    --
--------------------------------------------------------------------------------
-- THESE FUNCTIONS ^^^ ARE NOT IMPLEMENTED FOR THE ADA BINDING
-- EXCEPT FOR THE FOLLOWING.

    -- plparseopts here is an exact copy (exept for the name) of 
    -- Parse_Command_Line_Arguments in the thick binding. The reason for
    -- departing from the usual method of simply pragma Import-ing as in
    -- most or all of the other interfaces to C is because of the need to 
    -- figure out what the command lines arguments are by also pragma 
    -- Import-ing Gnat_Argc and Gnat_Argv. A single-argment version is made 
    -- at the request of the development team rather than the three-argument 
    -- version of the documetation. The caller specifies only the parse mode.
    
    -- Process options list using current options info.
    procedure plparseopts(Mode : Parse_Mode_Type);


    -- This is a three-argument version of plparseopts as indicated in the
    -- documentation.

    -- Process options list using current options info.
    procedure plparseopts
       (Gnat_Argc : Integer;
        Gnat_Argv : System.Address;
        Mode      : Parse_Mode_Type);


    -- Process input strings, treating them as an option and argument pair.
    procedure
    plsetopt(opt, optarg : char_array);
    pragma Import(C, plsetopt, "c_plsetopt");
    

	-- Transformation routines

    -- pltr0, pltr1, and pltr2 had to be re-written in Ada in order to make the 
    -- callback work while also passing the data structure along, e.g. 
    -- pltr_data in the formal names below. The machinery surrounding this idea  
    -- also allows for easy user-defined plot transformation subprograms to be
    -- written.

    -- Identity transformation. Re-write of pltr0 in plcont.c in Ada.
    procedure pltr0
       (x, y      : PLFLT;
        tx, ty    : out PLFLT;
        pltr_data : PLplot_thin.PLpointer);
    pragma Convention (Convention => C, Entity => pltr0);


    -- Re-write of pltr1 in Ada.
    procedure pltr1
       (x, y      : PLFLT;
        tx, ty    : out PLFLT;
        pltr_data : PLplot_thin.PLpointer);
    pragma Convention (Convention => C, Entity => pltr1);


    -- Re-write of pltr2 in Ada.
    -- Does linear interpolation from doubly dimensioned coord arrays
    -- (column dominant, as per normal C 2d arrays).
    procedure pltr2
       (x, y      : PLFLT;
        tx, ty    : out PLFLT;
        pltr_data : PLplot_thin.PLpointer);
    pragma Convention (Convention => C, Entity => pltr2);
    
    
    -- Wait for graphics input event and translate to world coordinates.
    procedure plGetCursor(gin : out PLGraphicsIn);
    pragma Import (C, plGetCursor, "plGetCursor");

end PLplot_Thin;