File: included_plplot_real_interfaces.f90

package info (click to toggle)
plplot 5.15.0%2Bdfsg2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,004 kB
  • sloc: ansic: 79,703; xml: 28,583; cpp: 20,033; ada: 19,456; tcl: 12,081; f90: 11,431; ml: 7,276; java: 6,863; python: 6,792; sh: 3,274; perl: 828; lisp: 75; makefile: 61; sed: 34; fortran: 6
file content (4364 lines) | stat: -rw-r--r-- 195,053 bytes parent folder | download | duplicates (4)
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
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
    !***********************************************************************
    !  included_plplot_real_interfaces.f90
    !
    !  Copyright (C) 2005-2016  Arjen Markus
    !  Copyright (C) 2006-2018 Alan W. Irwin
    !
    !  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
    !
    !
    !  This file defines the Fortran interfaces for the the subset of the
    !  PLplot API which has at least one real argument.  Keeping this part
    !  of the interface definitions separate allows convenient defining of
    !  these interfaces for both single and double precision real
    !  arguments.  See plplot_bindings.f90 for the definition of the
    !  Fortran interfaces for the remaining part of the PLplot API.
    !
    !***********************************************************************

    private :: matrix_to_c

    ! Private interfaces for wp-precision callbacks

    abstract interface
        subroutine plmapform_proc( x, y )
            import :: wp
            real(kind=wp), dimension(:), intent(inout) :: x, y
        end subroutine plmapform_proc
    end interface
    procedure(plmapform_proc), pointer :: plmapform
    private:: plmapform_proc, plmapform

    abstract interface
        subroutine pllabeler_proc( axis, value, label )
            import :: wp
            integer, intent(in) :: axis
            real(kind=wp), intent(in) :: value
            character(len=*), intent(out) :: label
        end subroutine pllabeler_proc
    end interface
    procedure(pllabeler_proc), pointer :: pllabeler
    private:: pllabeler_proc, pllabeler

    abstract interface
        subroutine pllabeler_proc_data( axis, value, label, data )
            import :: wp, c_ptr
            implicit none
            integer, intent(in) :: axis
            real(kind=wp), intent(in) :: value
            character(len=*), intent(out) :: label
            type(c_ptr), intent(in) :: data
        end subroutine pllabeler_proc_data
    end interface
    procedure(pllabeler_proc_data), pointer :: pllabeler_data
    private:: pllabeler_proc_data, pllabeler_data

    abstract interface
        subroutine pltransform_proc( x, y, tx, ty )
            import :: wp
            implicit none
            real(kind=wp), intent(in) :: x, y
            real(kind=wp), intent(out) :: tx, ty
        end subroutine pltransform_proc
    end interface
    procedure(pltransform_proc), pointer :: pltransform
    private:: pltransform_proc, pltransform

    abstract interface
        subroutine pltransform_proc_data( x, y, tx, ty, data )
            import :: wp, c_ptr
            implicit none
            real(kind=wp), intent(in) :: x, y
            real(kind=wp), intent(out) :: tx, ty
            type(c_ptr), intent(in) :: data
        end subroutine pltransform_proc_data
    end interface
    procedure(pltransform_proc_data), pointer :: pltransform_data
    private:: pltransform_proc_data, pltransform_data

    ! Normally interface blocks describing the C routines that are
    ! called by this Fortran binding are embedded as part of module
    ! procedures, but when more than one module procedure uses such
    ! interface blocks there is a requirement (enforced at least by
    ! the nagfor compiler) that those interface blocks be consistent.
    ! We could comply with that requirement by embedding such multiply
    ! used interface blocks as part of module procedures using
    ! duplicated code, but that is inefficient (in terms of the number
    ! of lines of code to be compiled) and implies a maintenance issue
    ! (to keep that code duplicated whenever there are changes on the
    ! C side).  To deal with those two potential issues we collect
    ! here in alphabetical order all interface blocks describing C
    ! routines that are called directly by more than one module
    ! procedure below.

    interface
        subroutine interface_plcont( z, nx, ny, kx, lx, ky, ly, clevel, nlevel, transform, data ) &
               bind(c,name='c_plcont')
            import :: c_funptr, c_ptr
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny, kx, lx, ky, ly, nlevel
            type(c_ptr), dimension(*), intent(in)  :: z
            real(kind=private_plflt), dimension(*), intent(in) :: clevel
            type(c_ptr), value, intent(in) :: data
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plcont
    end interface
    private :: interface_plcont

    interface
        function interface_plf2evalr( ix, iy, data ) bind(c, name = 'plf2evalr' )
            import :: c_ptr
            import :: private_plint, private_plflt
            implicit none
            real(kind=private_plflt) :: interface_plf2evalr
            integer(kind=private_plint), value, intent(in) :: ix, iy
            type(c_ptr), value, intent(in) :: data
        end function interface_plf2evalr
    end interface
    private :: interface_plf2evalr

    interface
        subroutine interface_plfcont( lookup, grid, nx, ny, kx, lx, ky, ly, clevel, nlevel, transform, data ) &
               bind(c,name='plfcont')
            import :: c_funptr, c_ptr
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny, kx, lx, ky, ly, nlevel
            real(kind=private_plflt), dimension(*), intent(in) :: clevel
            type(c_ptr), value, intent(in) :: grid
            type(c_ptr), value, intent(in) :: data
            interface
                function lookup( ix, iy, data ) bind(c)
                    import :: c_ptr
                    import :: private_plflt, private_plint
                    implicit none
                    real(kind=private_plflt) :: lookup
                    integer(kind=private_plint), value, intent(in) :: ix, iy
                    type(c_ptr), value, intent(in) :: data
                end function lookup
            end interface
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in)  :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plfcont
    end interface
    private :: interface_plfcont

    interface
        subroutine interface_plfill( n, x, y ) bind( c, name='c_plfill')
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: n
            real(kind=private_plflt), dimension(*), intent(in) :: x, y
        end subroutine interface_plfill
    end interface
    private :: interface_plfill

    interface
        subroutine interface_plfvect( lookup, fgrid1, fgrid2, nx, ny, scale, transform, data ) bind(c, name = 'plfvect' )
            import :: c_ptr, c_funptr
            import :: private_plint, private_plflt, PLfGrid, PLcGrid
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny
            type(PLfGrid), intent(in) :: fgrid1, fgrid2
            real(kind=private_plflt), value, intent(in) :: scale
            type(c_ptr), value, intent(in) :: data ! Not used in this case
            interface
                function lookup( ix, iy, data ) bind(c)
                    import :: c_ptr
                    import :: private_plint, private_plflt
                    implicit none
                    real(kind=private_plflt) :: lookup
                    integer(kind=private_plint), value, intent(in) :: ix, iy
                    type(c_ptr), value, intent(in) :: data
                end function lookup
            end interface
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plfvect
    end interface
    private :: interface_plfvect

    interface
        subroutine interface_plimagefr( idata, nx, ny, &
               xmin, xmax, ymin, ymax, &
               zmin, zmax, valuemin, valuemax, transform, data ) bind(c,name='c_plimagefr')
            import :: c_ptr
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
            type(c_ptr), dimension(*), intent(in) :: idata
            type(c_ptr), value, intent(in) :: data
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plimagefr
    end interface
    private :: interface_plimagefr

    interface
        subroutine interface_plimagefr_null( idata, nx, ny, &
               xmin, xmax, ymin, ymax, &
               zmin, zmax, valuemin, valuemax) bind(c,name='plimagefr_null')
            import :: c_ptr
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
            type(c_ptr), dimension(*), intent(in) :: idata
        end subroutine interface_plimagefr_null
    end interface
    private :: interface_plimagefr_null

    interface
        subroutine interface_plmap( proc, name, minx, maxx, miny, maxy ) &
               bind(c, name = 'c_plmap' )
            import :: c_funptr, private_plflt
            implicit none
            type(c_funptr), value, intent(in) :: proc
            character(len=1), dimension(*), intent(in) :: name
            real(kind=private_plflt), value, intent(in) :: minx, maxx, miny, maxy
        end subroutine interface_plmap
    end interface
    private interface_plmap

    interface
        subroutine interface_plmapfill( proc, name, minx, maxx, miny, maxy, plotentries, nplotentries ) &
               bind(c, name = 'c_plmapfill' )
            import :: c_funptr, private_plflt, c_ptr, private_plint
            implicit none
            type(c_funptr), value, intent(in) :: proc
            character(len=1), dimension(*), intent(in) :: name
            real(kind=private_plflt), value, intent(in) :: minx, maxx, miny, maxy
            type(c_ptr), value, intent(in) :: plotentries
            integer(kind=private_plint), value, intent(in) :: nplotentries
        end subroutine interface_plmapfill
    end interface
    private :: interface_plmapfill

    interface
        subroutine interface_plmapline( proc, name, minx, maxx, miny, maxy, plotentries, nplotentries ) &
               bind(c, name = 'c_plmapline' )
            import :: c_funptr, private_plflt, c_ptr, private_plint
            implicit none
            type(c_funptr), value, intent(in) :: proc
            character(len=1), dimension(*), intent(in) :: name
            real(kind=private_plflt), value, intent(in) :: minx, maxx, miny, maxy
            type(c_ptr), value, intent(in) :: plotentries
            integer(kind=private_plint), value, intent(in) :: nplotentries
        end subroutine interface_plmapline
    end interface
    private :: interface_plmapline

    interface
        subroutine interface_plmapstring( proc, name, string, minx, maxx, miny, maxy, plotentries, nplotentries ) &
               bind(c, name = 'c_plmapstring' )
            import :: c_funptr, private_plflt, c_ptr, private_plint
            implicit none
            type(c_funptr), value, intent(in) :: proc
            character(len=1), dimension(*), intent(in) :: name, string
            real(kind=private_plflt), value, intent(in) :: minx, maxx, miny, maxy
            type(c_ptr), value, intent(in) :: plotentries
            integer(kind=private_plint), value, intent(in) :: nplotentries
        end subroutine interface_plmapstring
    end interface
    private :: interface_plmapstring

    interface
        subroutine interface_plmaptex( proc, name, dx, dy, just, text, minx, maxx, miny, maxy, plotentry ) &
               bind(c, name = 'c_plmaptex' )
            import :: c_funptr, private_plflt, c_ptr, private_plint
            implicit none
            type(c_funptr), value, intent(in) :: proc
            character(len=1), dimension(*), intent(in) :: name, text
            real(kind=private_plflt), value, intent(in) :: dx, dy, just, minx, maxx, miny, maxy
            integer(kind=private_plint), value, intent(in) :: plotentry
        end subroutine interface_plmaptex
    end interface
    private :: interface_plmaptex

    interface
        subroutine interface_plmeridians( proc, dlong, dlat, minlong, maxlong, minlat, maxlat ) &
               bind(c, name = 'c_plmeridians' )
            import :: c_funptr, private_plflt
            implicit none
            type(c_funptr), value, intent(in) :: proc
            real(kind=private_plflt), value, intent(in) :: dlong, dlat, minlong, maxlong, minlat, maxlat
        end subroutine interface_plmeridians
    end interface
    private :: interface_plmeridians

    interface
        subroutine interface_plshade( a, nx, ny, defined, xmin, xmax, ymin, ymax, &
               shade_min, shade_max, sh_cmap, sh_color, sh_width, &
               min_color, min_width, max_color, max_width, &
               fill, rectangular, transform, data ) bind(c, name = 'c_plshade' )
            import :: c_ptr, c_funptr, c_null_ptr
            import :: private_plint, private_plbool, private_plflt, PLcGrid
            implicit none
            type(c_ptr), dimension(*), intent(in)  :: a
            integer(kind=private_plint), value, intent(in) :: nx, ny, sh_cmap, min_color, max_color
            integer(kind=private_plbool), value, intent(in) :: rectangular
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
            real(kind=private_plflt), value, intent(in) :: sh_width, min_width, max_width
            real(kind=private_plflt), value, intent(in) :: shade_min, shade_max, sh_color
            type(c_ptr), value, intent(in) :: data
            type(c_ptr), value, intent(in) :: defined ! Not used in this case
            interface
                subroutine fill( n, x, y ) bind(c)
                    import :: private_plint, private_plflt
                    integer(kind=private_plint), value, intent(in) :: n
                    real(kind=private_plflt), dimension(*), intent(in) :: x, y
                end subroutine fill
            end interface
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plshade
    end interface
    private :: interface_plshade

    interface
        subroutine interface_plshade_null( a, nx, ny, defined, xmin, xmax, ymin, ymax, &
               shade_min, shade_max, sh_cmap, sh_color, sh_width, &
               min_color, min_width, max_color, max_width, &
               fill, rectangular) bind(c, name = 'plshade_null' )
            import :: c_ptr, c_funptr, c_null_ptr
            import :: private_plint, private_plbool, private_plflt, PLcGrid
            implicit none
            type(c_ptr), dimension(*), intent(in)  :: a
            integer(kind=private_plint), value, intent(in) :: nx, ny, sh_cmap, min_color, max_color
            integer(kind=private_plbool), value, intent(in) :: rectangular
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
            real(kind=private_plflt), value, intent(in) :: sh_width, min_width, max_width
            real(kind=private_plflt), value, intent(in) :: shade_min, shade_max, sh_color
            type(c_ptr), value, intent(in) :: defined ! Not used in this case
            interface
                subroutine fill( n, x, y ) bind(c)
                    import :: private_plint, private_plflt
                    integer(kind=private_plint), value, intent(in) :: n
                    real(kind=private_plflt), dimension(*), intent(in) :: x, y
                end subroutine fill
            end interface
        end subroutine interface_plshade_null
    end interface
    private :: interface_plshade_null

    interface
        subroutine interface_plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax, &
               clevel, nlevel, fill_width, cont_color, cont_width, &
               fill, rectangular, transform, data ) bind(c, name = 'c_plshades' )
            import :: c_ptr, c_funptr, c_null_ptr
            import :: private_plint, private_plbool, private_plflt, PLcGrid
            implicit none
            type(c_ptr), dimension(*), intent(in)  :: a
            integer(kind=private_plint), value, intent(in) :: nx, ny, cont_color, nlevel
            integer(kind=private_plbool), value, intent(in) :: rectangular
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, fill_width
            real(kind=private_plflt), dimension(*), intent(in) :: clevel
            real(kind=private_plflt), value, intent(in) :: cont_width
            type(c_ptr), value, intent(in) :: data
            type(c_ptr), value, intent(in) :: defined ! Not used in this case
            interface
                subroutine fill( n, x, y ) bind(c)
                    import :: private_plint, private_plflt
                    integer(kind=private_plint), value, intent(in) :: n
                    real(kind=private_plflt), dimension(*), intent(in) :: x, y
                end subroutine fill
            end interface
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
            end interface
        end subroutine interface_plshades
    end interface
    private :: interface_plshades

    interface
        subroutine interface_plshades_null( a, nx, ny, defined, xmin, xmax, ymin, ymax, &
               clevel, nlevel, fill_width, cont_color, cont_width, &
               fill, rectangular ) bind(c, name = 'plshades_null' )
            import :: c_ptr, c_funptr, c_null_ptr
            import :: private_plint, private_plbool, private_plflt, PLcGrid
            implicit none
            type(c_ptr), dimension(*), intent(in)  :: a
            integer(kind=private_plint), value, intent(in) :: nx, ny, cont_color, nlevel
            integer(kind=private_plbool), value, intent(in) :: rectangular
            real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, fill_width
            real(kind=private_plflt), dimension(*), intent(in) :: clevel
            real(kind=private_plflt), value, intent(in) :: cont_width
            type(c_ptr), value, intent(in) :: defined ! Not used in this case
            interface
                subroutine fill( n, x, y ) bind(c)
                    import :: private_plint, private_plflt
                    integer(kind=private_plint), value, intent(in) :: n
                    real(kind=private_plflt), dimension(*), intent(in) :: x, y
                end subroutine fill
            end interface
        end subroutine interface_plshades_null
    end interface
    private :: interface_plshades_null

    interface
        subroutine interface_pltr0( x, y, tx, ty, data ) bind(c, name = 'pltr0' )
            import :: private_plflt, c_ptr
            implicit none
            real(kind=private_plflt), value, intent(in) :: x, y
            real(kind=private_plflt), intent(out) :: tx, ty
            type(c_ptr), value, intent(in) :: data
        end subroutine interface_pltr0
    end interface
    private :: interface_pltr0

    interface
        subroutine interface_pltr1( x, y, tx, ty, data ) bind(c, name = 'pltr1' )
            import :: private_plflt, c_ptr
            implicit none
            real(kind=private_plflt), value, intent(in) :: x, y
            real(kind=private_plflt), intent(out) :: tx, ty
            type(c_ptr), value, intent(in) :: data
        end subroutine interface_pltr1
    end interface
    private :: interface_pltr1

    interface
        subroutine interface_pltr2f( x, y, tx, ty, data ) bind(c, name = 'pltr2f' )
            import :: c_ptr
            import :: private_plflt
            implicit none
            real(kind=private_plflt), value, intent(in) :: x, y
            real(kind=private_plflt), intent(out) :: tx, ty
            type(c_ptr), value, intent(in) :: data
        end subroutine interface_pltr2f
    end interface
    private :: interface_pltr2f

    interface
        subroutine interface_plvect( u, v, nx, ny, scale, transform, data ) bind(c, name = 'c_plvect' )
            import :: c_funptr, c_ptr
            import :: private_plint, private_plflt
            implicit none
            integer(kind=private_plint), value, intent(in) :: nx, ny
            real(kind=private_plflt), value, intent(in) :: scale
            type(c_ptr), dimension(*), intent(in) :: u, v
            type(c_ptr), value, intent(in) :: data
            interface
                subroutine transform( x, y, tx, ty, data ) bind(c)
                    import :: private_plflt
                    import :: c_ptr
                    implicit none
                    real(kind=private_plflt), value, intent(in) :: x, y
                    real(kind=private_plflt), intent(out) :: tx, ty
                    type(c_ptr), value, intent(in) :: data
                end subroutine transform
        end interface
    end subroutine interface_plvect
    end interface
    private :: interface_plvect

    ! Interface blocks for module procedures
    ! These interface blocks are ordered by the names of the module
    ! procedures inside them.  (Recall that the collating sequence has
    ! numbers first, followed by underscores, followed by lower-case
    ! letters.  So "fill3_impl" sorts before "fill_impl".)

    interface pl_setcontlabelparam
        module procedure pl_setcontlabelparam_impl
    end interface pl_setcontlabelparam
    private :: pl_setcontlabelparam_impl

    interface plarc
        module procedure plarc_impl
    end interface plarc
    private :: plarc_impl

    interface plaxes
        module procedure plaxes_impl
    end interface plaxes
    private :: plaxes_impl

    interface plbin
        module procedure plbin_impl
    end interface plbin
    private :: plbin_impl

    interface plbox3
        module procedure plbox3_impl
    end interface plbox3
    private :: plbox3_impl

    interface plbox
        module procedure plbox_impl
    end interface plbox
    private :: plbox_impl

    interface plbtime
        module procedure plbtime_impl
    end interface plbtime
    private :: plbtime_impl

    interface plcalc_world
        module procedure plcalc_world_impl
    end interface plcalc_world
    private :: plcalc_world_impl

    interface plcol1
        module procedure plcol1_impl
    end interface plcol1
    private :: plcol1_impl

    interface plcolorbar
        module procedure plcolorbar_impl
    end interface plcolorbar
    private :: plcolorbar_impl

    interface plconfigtime
        module procedure plconfigtime_impl
    end interface plconfigtime
    private :: plconfigtime_impl

    interface plcont
        module procedure plcont_impl_0
        module procedure plcont_impl_1
        module procedure plcont_impl_2
        module procedure plcont_impl_tr
        module procedure plcont_impl
        module procedure plcont_impl_data
    end interface plcont
    private :: plcont_impl_0
    private :: plcont_impl_1
    private :: plcont_impl_2
    private :: plcont_impl_tr
    private :: plcont_impl
    private :: plcont_impl_data

    interface plctime
        module procedure plctime_impl
    end interface plctime
    private :: plctime_impl

    interface plenv0
        module procedure plenv0_impl
    end interface plenv0
    private :: plenv0_impl

    interface plenv
        module procedure plenv_impl
    end interface plenv
    private :: plenv_impl

    interface plerrx
        module procedure plerrx_impl
    end interface plerrx
    private :: plerrx_impl

    interface plerry
        module procedure plerry_impl
    end interface plerry
    private :: plerry_impl

    interface plfill3
        module procedure plfill3_impl
    end interface plfill3
    private :: plfill3_impl

    interface plfill
        module procedure plfill_impl
    end interface plfill
    private :: plfill_impl

    interface plgchr
        module procedure plgchr_impl
    end interface plgchr
    private :: plgchr_impl

    interface plgcmap1_range
        module procedure plgcmap1_range_impl
    end interface plgcmap1_range
    private :: plgcmap1_range_impl

    interface plgcol0a
        module procedure plgcol0a_impl
    end interface plgcol0a
    private :: plgcol0a_impl

    interface plgcolbga
        module procedure plgcolbga_impl
    end interface plgcolbga
    private :: plgcolbga_impl

    interface plgdidev
        module procedure plgdidev_impl
    end interface plgdidev
    private :: plgdidev_impl

    interface plgdiori
        module procedure plgdiori_impl
    end interface plgdiori
    private :: plgdiori_impl

    interface plgdiplt
        module procedure plgdiplt_impl
    end interface plgdiplt
    private :: plgdiplt_impl

    interface plgpage
        module procedure plgpage_impl
    end interface plgpage
    private :: plgpage_impl

    interface plgradient
        module procedure plgradient_impl
    end interface plgradient
    private :: plgradient_impl

    interface plgriddata
        module procedure plgriddata_impl
    end interface plgriddata
    private :: plgriddata_impl

    interface plgspa
        module procedure plgspa_impl
    end interface plgspa
    private :: plgspa_impl

    interface plgvpd
        module procedure plgvpd_impl
    end interface plgvpd
    private :: plgvpd_impl

    interface plgvpw
        module procedure plgvpw_impl
    end interface plgvpw
    private :: plgvpw_impl

    interface plhist
        module procedure plhist_impl
    end interface plhist
    private :: plhist_impl

    interface plhlsrgb
        module procedure plhlsrgb_impl
    end interface plhlsrgb
    private :: plhlsrgb_impl

    interface plimage
        module procedure plimage_impl
    end interface plimage
    private :: plimage_impl

    interface plimagefr
        module procedure plimagefr_impl_1
        module procedure plimagefr_impl_2
        module procedure plimagefr_impl_null
        module procedure plimagefr_impl_tr
        module procedure plimagefr_impl
        module procedure plimagefr_impl_data
    end interface plimagefr
    private :: plimagefr_impl_1, plimagefr_impl_2, plimagefr_impl_null, plimagefr_impl_tr, plimagefr_impl, plimagefr_impl_data

    interface pljoin
        module procedure pljoin_impl
    end interface pljoin
    private :: pljoin_impl

    interface pllegend
        module procedure pllegend_impl
    end interface pllegend
    private :: pllegend_impl

    interface pllightsource
        module procedure pllightsource_impl
    end interface pllightsource
    private :: pllightsource_impl

    interface plline3
        module procedure plline3_impl
    end interface plline3
    private :: plline3_impl

    interface plline
        module procedure plline_impl
    end interface plline
    private :: plline_impl

    interface plmap
        module procedure plmap_impl
        module procedure plmap_impl_null
    end interface plmap
    private :: plmap_impl
    private :: plmap_impl_null

    interface plmapfill
        module procedure plmapfill_impl
        module procedure plmapfill_impl_null
    end interface plmapfill
    private :: plmapfill_impl
    private :: plmapfill_impl_null

    interface plmapline
        module procedure plmapline_impl
        module procedure plmapline_impl_null
    end interface plmapline
    private :: plmapline_impl
    private :: plmapline_impl_null

    interface plmapstring
        module procedure plmapstring_impl
        module procedure plmapstring_impl_null
    end interface plmapstring
    private :: plmapstring_impl
    private :: plmapstring_impl_null

    interface plmaptex
        module procedure plmaptex_impl
        module procedure plmaptex_impl_null
    end interface plmaptex
    private :: plmaptex_impl
    private :: plmaptex_impl_null

    interface plmeridians
        module procedure plmeridians_impl
        module procedure plmeridians_impl_null
    end interface plmeridians
    private :: plmeridians_impl
    private :: plmeridians_impl_null

    interface plmesh
        module procedure plmesh_impl
    end interface plmesh
    private :: plmesh_impl

    interface plmeshc
        module procedure plmeshc_impl
    end interface plmeshc
    private :: plmeshc_impl

    interface plmtex3
        module procedure plmtex3_impl
    end interface plmtex3
    private :: plmtex3_impl

    interface plmtex
        module procedure plmtex_impl
    end interface plmtex
    private :: plmtex_impl

    interface plot3d
        module procedure plot3d_impl
    end interface plot3d
    private :: plot3d_impl

    interface plot3dc
        module procedure plot3dc_impl
    end interface plot3dc
    private :: plot3dc_impl

    interface plot3dcl
        module procedure plot3dcl_impl
    end interface plot3dcl
    private :: plot3dcl_impl

    interface plpath
        module procedure plpath_impl
    end interface plpath
    private :: plpath_impl

    interface plpoin3
        module procedure plpoin3_impl
    end interface plpoin3
    private :: plpoin3_impl

    interface plpoin
        module procedure plpoin_impl
    end interface plpoin
    private :: plpoin_impl

    interface plpoly3
        module procedure plpoly3_impl
    end interface plpoly3
    private :: plpoly3_impl

    interface plptex3
        module procedure plptex3_impl
    end interface plptex3
    private :: plptex3_impl

    interface plptex
        module procedure plptex_impl
    end interface plptex
    private :: plptex_impl

    interface plrgbhls
        module procedure plrgbhls_impl
    end interface plrgbhls
    private :: plrgbhls_impl

    interface plschr
        module procedure plschr_impl
    end interface plschr
    private :: plschr_impl

    interface plscmap0a
        module procedure plscmap0a_impl
    end interface plscmap0a
    private :: plscmap0a_impl

    interface plscmap1_range
        module procedure plscmap1_range_impl
    end interface plscmap1_range
    private :: plscmap1_range_impl

    interface plscmap1a
        module procedure plscmap1a_impl
    end interface plscmap1a
    private :: plscmap1a_impl

    interface plscmap1l
        module procedure plscmap1l_impl
    end interface plscmap1l
    private :: plscmap1l_impl

    interface plscmap1la
        module procedure plscmap1la_impl
    end interface plscmap1la
    private :: plscmap1la_impl

    interface plscol0a
        module procedure plscol0a_impl
    end interface plscol0a
    private :: plscol0a_impl

    interface plscolbga
        module procedure plscolbga_impl
    end interface plscolbga
    private :: plscolbga_impl

    interface plsdidev
        module procedure plsdidev_impl
    end interface plsdidev
    private :: plsdidev_impl

    interface plsdimap
        module procedure plsdimap_impl
    end interface plsdimap
    private :: plsdimap_impl

    interface plsdiori
        module procedure plsdiori_impl
    end interface plsdiori
    private :: plsdiori_impl

    interface plsdiplt
        module procedure plsdiplt_impl
    end interface plsdiplt
    private :: plsdiplt_impl

    interface plsdiplz
        module procedure plsdiplz_impl
    end interface plsdiplz
    private :: plsdiplz_impl

    interface plshade
        module procedure plshade_impl_0
        module procedure plshade_impl_1
        module procedure plshade_impl_2
        module procedure plshade_impl_tr
        module procedure plshade_impl
        module procedure plshade_impl_data
    end interface plshade
    private :: plshade_impl_0
    private :: plshade_impl_1
    private :: plshade_impl_2
    private :: plshade_impl_tr
    private :: plshade_impl
    private :: plshade_impl_data

    interface plshades
        module procedure plshades_impl_0
        module procedure plshades_impl_1
        module procedure plshades_impl_2
        module procedure plshades_impl_tr
        module procedure plshades_impl
        module procedure plshades_impl_data
    end interface plshades
    private :: plshades_impl_0
    private :: plshades_impl_1
    private :: plshades_impl_2
    private :: plshades_impl_tr
    private :: plshades_impl
    private :: plshades_impl_data

    interface plsmaj
        module procedure plsmaj_impl
    end interface plsmaj
    private :: plsmaj_impl

    interface plsmin
        module procedure plsmin_impl
    end interface plsmin
    private :: plsmin_impl

    interface plspage
        module procedure plspage_impl
    end interface plspage
    private :: plspage_impl

    interface plssym
        module procedure plssym_impl
    end interface plssym
    private :: plssym_impl

    interface plstring3
        module procedure plstring3_impl
    end interface plstring3
    private :: plstring3_impl

    interface plstring
        module procedure plstring_impl
    end interface plstring
    private :: plstring_impl

    interface plstripa
        module procedure plstripa_impl
    end interface plstripa
    private :: plstripa_impl

    interface plstripc
        module procedure plstripc_impl
    end interface plstripc
    private :: plstripc_impl

    interface plsurf3d
        module procedure plsurf3d_impl
    end interface plsurf3d
    private :: plsurf3d_impl

    interface plsurf3dl
        module procedure plsurf3dl_impl
    end interface plsurf3dl
    private :: plsurf3dl_impl

    interface plsvpa
        module procedure plsvpa_impl
    end interface plsvpa
    private :: plsvpa_impl

    ! Another variant defined in the plplot module.
    interface plsvect
        module procedure plsvect_impl
    end interface plsvect
    private :: plsvect_impl

    interface plsym
        module procedure plsym_impl
    end interface plsym
    private :: plsym_impl

    interface plvasp
        module procedure plvasp_impl
    end interface plvasp
    private :: plvasp_impl

    interface plvect
        module procedure plvect_impl_0
        module procedure plvect_impl_1
        module procedure plvect_impl_2
        module procedure plvect_impl_tr
        module procedure plvect_impl
        module procedure plvect_impl_data
    end interface plvect
    private :: plvect_impl_0
    private :: plvect_impl_1
    private :: plvect_impl_2
    private :: plvect_impl_tr
    private :: plvect_impl
    private :: plvect_impl_data

    interface plvpas
        module procedure plvpas_impl
    end interface plvpas
    private :: plvpas_impl

    interface plvpor
        module procedure plvpor_impl
    end interface plvpor
    private :: plvpor_impl

    interface plw3d
        module procedure plw3d_impl
    end interface plw3d
    private :: plw3d_impl

    interface plwidth
        module procedure plwidth_impl
    end interface plwidth
    private :: plwidth_impl

    interface plwind
        module procedure plwind_impl
    end interface plwind
    private :: plwind_impl

contains

    ! Private utility routine that depends on real precision:
    subroutine matrix_to_c( array, carray, caddress )
        real(kind=wp), dimension(:,:), intent(in) :: array
        real(kind=private_plflt), dimension(:,:), allocatable, target, intent(out) :: carray

        type(c_ptr), dimension(:), allocatable, intent(out) :: caddress

        integer :: i_local

        allocate( carray(size(array,2),size(array,1)) )
        allocate( caddress(size(array,1)) )

        carray = transpose( array )

        do i_local = 1,size(array,1)
            caddress(i_local) = c_loc(carray(1,i_local))
        enddo
    end subroutine matrix_to_c

    ! Module procedures:

    subroutine pl_setcontlabelparam_impl( offset, size, spacing, active )
        real(kind=wp), intent(in) :: offset, size, spacing
        integer, intent(in) :: active

        interface
            subroutine interface_pl_setcontlabelparam( offset, size, spacing, active) bind(c,name='c_pl_setcontlabelparam')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: active
                real(kind=private_plflt), value, intent(in) :: offset, size, spacing
            end subroutine interface_pl_setcontlabelparam
        end interface

        call interface_pl_setcontlabelparam( real(offset,kind=private_plflt), real(size,kind=private_plflt), &
               real(spacing,kind=private_plflt), int(active,kind=private_plint) )
    end subroutine pl_setcontlabelparam_impl

    subroutine plarc_impl( x, y, a, b, angle1, angle2, rotate, fill )
        real(kind=wp), intent(in) :: x, y, a, b, angle1, angle2, rotate
        logical, intent(in) :: fill

        interface
            subroutine interface_plarc( x, y, a, b, angle1, angle2, rotate, fill ) bind(c,name='c_plarc')
                import :: private_plbool, private_plflt
                implicit none
                integer(kind=private_plbool), value, intent(in) :: fill
                real(kind=private_plflt), value, intent(in) :: x, y, a, b, angle1, angle2, rotate
            end subroutine interface_plarc
        end interface

        call interface_plarc( real(x,kind=private_plflt), real(y,kind=private_plflt), real(a,kind=private_plflt), &
               real(b,kind=private_plflt), real(angle1,kind=private_plflt), real(angle2,kind=private_plflt), &
               real(rotate,kind=private_plflt), int(merge(1,0,fill),kind=private_plbool) )
    end subroutine plarc_impl

    subroutine plaxes_impl(x0, y0, xopt,xtick,nxsub,yopt,ytick,nysub)
        real(kind=wp), intent(in) :: x0, y0, xtick, ytick
        integer, intent(in) :: nxsub, nysub
        character*(*), intent(in) :: xopt,yopt

        interface
            subroutine interface_plaxes(x0, y0, xopt,xtick,nxsub,yopt,ytick,nysub) bind(c,name='c_plaxes')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: x0, y0, xtick, ytick
                integer(kind=private_plint), value, intent(in) :: nxsub, nysub
                character(len=1), dimension(*), intent(in) :: xopt, yopt
            end subroutine interface_plaxes
        end interface

        call interface_plaxes( &
               real(x0,kind=private_plflt), real(y0,kind=private_plflt), &
               trim(xopt)//c_null_char, real(xtick,kind=private_plflt), int(nxsub,kind=private_plint), &
               trim(yopt)//c_null_char, real(ytick,kind=private_plflt), int(nysub,kind=private_plint) )
    end subroutine plaxes_impl

    subroutine plbin_impl( x, y, center )
        real(kind=wp), dimension(:), intent(in) :: x, y
        integer, intent(in) :: center

        integer(kind=private_plint) :: sz_local

        interface
            subroutine interface_plbin( sz, x, y, center ) bind(c,name='c_plbin')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: sz, center
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
            end subroutine interface_plbin
        end interface

        sz_local = size(x,kind=private_plint)
        if( sz_local /= size(y,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plbin: inconsistent sizes for x and y"
        end if
        call interface_plbin( sz_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               int(center,kind=private_plint) )
    end subroutine plbin_impl

    subroutine plbox3_impl(xopt,xlabel,xtick,nxsub,yopt,ylabel,ytick,nysub, &
           zopt,zlabel,ztick,nzsub)

        real(kind=wp), intent(in) :: xtick, ytick, ztick
        character*(*), intent(in) :: xopt, xlabel, yopt, ylabel, zopt, zlabel
        integer, intent(in) :: nxsub, nysub, nzsub

        interface
            subroutine interface_plbox3(xopt,xlabel,xtick,nxsub,yopt,ylabel,ytick,nysub, &
                   zopt,zlabel,ztick,nzsub) bind(c,name='c_plbox3')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in):: xtick, ytick, ztick
                integer(kind=private_plint), value, intent(in) :: nxsub, nysub, nzsub
                character(len=1), dimension(*), intent(in) :: xopt, yopt, zopt, xlabel, ylabel, zlabel
            end subroutine interface_plbox3
        end interface

        call interface_plbox3( trim(xopt)//c_null_char, trim(xlabel)//c_null_char, real(xtick,kind=private_plflt), &
               int(nxsub,kind=private_plint),                                                      &
               trim(yopt)//c_null_char, trim(ylabel)//c_null_char, real(ytick,kind=private_plflt), &
               int(nysub,kind=private_plint),                                                      &
               trim(zopt)//c_null_char, trim(zlabel)//c_null_char, real(ztick,kind=private_plflt), &
               int(nzsub,kind=private_plint) )
    end subroutine plbox3_impl

    subroutine plbox_impl(xopt,xtick,nxsub,yopt,ytick,nysub)
        real(kind=wp), intent(in) :: xtick, ytick
        integer, intent(in) :: nxsub, nysub
        character*(*), intent(in) :: xopt,yopt

        interface
            subroutine interface_plbox(xopt,xtick,nxsub,yopt,ytick,nysub) bind(c,name='c_plbox')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xtick, ytick
                integer(kind=private_plint), value, intent(in) :: nxsub, nysub
                character(len=1), dimension(*), intent(in) :: xopt, yopt
            end subroutine interface_plbox
        end interface

        call interface_plbox( trim(xopt)//c_null_char, real(xtick,kind=private_plflt), int(nxsub,kind=private_plint), &
               trim(yopt)//c_null_char, real(ytick,kind=private_plflt), int(nysub,kind=private_plint) )
    end subroutine plbox_impl

    subroutine plbtime_impl( year, month, day, hour, min, sec, ctime )
        real(kind=wp), intent(in) :: ctime
        integer, intent(out) :: year, month, day, hour, min
        real(kind=wp), intent(out) :: sec

        integer(kind=private_plint) :: year_out, month_out, day_out, hour_out, min_out
        real(kind=private_plflt) :: sec_out

        interface
            subroutine interface_plbtime( year, month, day, hour, min, sec, ctime ) bind(c,name='c_plbtime')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: ctime
                integer(kind=private_plint), intent(out) :: year, month, day, hour, min
                real(kind=private_plflt), intent(out) :: sec
            end subroutine interface_plbtime
        end interface

        call interface_plbtime( year_out, month_out, day_out, hour_out, min_out, sec_out, real(ctime, kind=private_plflt))
        year = int(year_out)
        month = int(month_out)
        day = int(day_out)
        hour = int(hour_out)
        min = int(min_out)
        sec = real(sec_out, kind=wp)

    end subroutine plbtime_impl

    subroutine plcalc_world_impl( rx, ry, wx, wy, window )
        integer, intent(out) :: window
        real(kind=wp), intent(in) :: rx, ry
        real(kind=wp), intent(out) :: wx, wy

        real(kind=private_plflt) :: wx_out, wy_out
        integer(kind=private_plint) window_out


        interface
            subroutine interface_plcalc_world( rx, ry, wx, wy, window ) bind(c,name='c_plcalc_world')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), intent(out) :: window
                real(kind=private_plflt), value, intent(in) :: rx, ry
                real(kind=private_plflt), intent(out) :: wx, wy
            end subroutine interface_plcalc_world
        end interface

        call interface_plcalc_world( real(rx,kind=private_plflt), real(ry,kind=private_plflt), wx_out, wy_out, window_out )
        window = int(window_out)
        wx = real(wx_out, kind=wp)
        wy = real(wy_out, kind=wp)

    end subroutine plcalc_world_impl

    subroutine plcol1_impl( col )
        real(kind=wp), intent(in) :: col

        interface
            subroutine interface_plcol1( col ) bind(c,name='c_plcol1')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: col
            end subroutine interface_plcol1
        end interface

        call interface_plcol1( real(col,kind=private_plflt) )
    end subroutine plcol1_impl

    subroutine plcolorbar_impl( &
           colorbar_width, colorbar_height, &
           opt, position, x, y, &
           x_length, y_length, bg_color, bb_color, bb_style, &
           low_cap_color, high_cap_color, &
           cont_color, cont_width, &
           label_opts, labels, &
           axis_opts, ticks, sub_ticks, n_values, values )


        real(kind=wp), intent(in) :: x_length, y_length, x, y, low_cap_color, high_cap_color, cont_width
        real(kind=wp), dimension(:, :), intent(in) :: values
        integer, intent(in) :: position, opt, bg_color, bb_color, bb_style, cont_color
        integer, dimension(:), intent(in) :: label_opts, sub_ticks, n_values
        real(kind=wp), dimension(:), intent(in) :: ticks
        character(len=*), dimension(:), intent(in) :: labels, axis_opts
        real(kind=wp), intent(out) :: colorbar_width, colorbar_height

        integer :: n_labels_local, n_axes_local
        real(kind=private_plflt) :: colorbar_width_out, colorbar_height_out
        real(kind=private_plflt), dimension(:,:), allocatable :: values_c_local
        type(c_ptr), dimension(:), allocatable :: values_address_local
        character(len=1), dimension(:,:), allocatable :: cstring_labels_local, cstring_axis_opts_local
        type(c_ptr), dimension(:), allocatable :: cstring_address_labels_local, cstring_address_axis_opts_local

        interface
            subroutine interface_plcolorbar( &
                   colorbar_width, colorbar_height, &
                   opt, position, x, y, &
                   x_length, y_length, bg_color, bb_color, bb_style, &
                   low_cap_color, high_cap_color, &
                   cont_color, cont_width, &
                   n_labels, label_opts, labels, &
                   n_axes, axis_opts, ticks, sub_ticks, n_values, values ) &
                   bind(c,name='c_plcolorbar')

                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none

                real(kind=private_plflt), value, intent(in) :: x_length, y_length, x, y, &
                       low_cap_color, high_cap_color, cont_width
                integer(kind=private_plint), value, intent(in) :: position, opt, bg_color, bb_color, bb_style, cont_color
                integer(kind=private_plint), value, intent(in) :: n_labels, n_axes
                real(kind=private_plflt), dimension(*), intent(in) :: ticks
                integer(kind=private_plint), dimension(*), intent(in) :: label_opts, sub_ticks, n_values
                type(c_ptr), dimension(*), intent(in) :: values

                type(c_ptr), dimension(*), intent(in) :: labels, axis_opts
                real(kind=private_plflt), intent(out) :: colorbar_width, colorbar_height

            end subroutine interface_plcolorbar
        end interface


        ! Determine number of label entries and demand consistent
        ! array sizes.

        n_labels_local = size(label_opts)
        if( n_labels_local /= size(labels) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plcolorbar: inconsistent sizes for the following arrays:"
            write(error_unit, "(a)") "label_opts"
            write(error_unit, "(a)") "labels"
        end if

        n_axes_local = size(axis_opts)
        if( &
               n_axes_local /= size(ticks) .or. &
               n_axes_local /= size(sub_ticks) .or. &
               n_axes_local /= size(n_values) .or. &
               n_axes_local /= size(values,1) &
               ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plcolorbar: inconsistent sizes for the following arrays:"
            write(error_unit, "(a)") "axis_opts"
            write(error_unit, "(a)") "ticks"
            write(error_unit, "(a)") "sub_ticks"
            write(error_unit, "(a)") "n_values"
            write(error_unit, "(a)") "first dimension of values"
        end if

        if(maxval(n_values) > size(values,2) ) then
            write(error_unit, "(a)") "Plplot Fortran Severe Warning: plcolorbar: maximum of n_values > second dimension of values"
            return
        end if

        call matrix_to_c( values, values_c_local, values_address_local )

        call character_array_to_c( cstring_labels_local, cstring_address_labels_local, labels )
        call character_array_to_c( cstring_axis_opts_local, cstring_address_axis_opts_local, axis_opts )

        call interface_plcolorbar( &
               colorbar_width_out, colorbar_height_out, &
               int(opt,kind=private_plint), int(position,kind=private_plint), &
               real(x,kind=private_plflt), real(y,kind=private_plflt), &
               real(x_length,kind=private_plflt), real(y_length,kind=private_plflt), &
               int(bg_color,kind=private_plint), &
               int(bb_color,kind=private_plint), int(bb_style,kind=private_plint), &
               real(low_cap_color,kind=private_plflt), real(high_cap_color,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               int(n_labels_local, kind=private_plint), int(label_opts, kind=private_plint), &
               cstring_address_labels_local, &
               int(n_axes_local, kind=private_plint), &
               cstring_address_axis_opts_local, real(ticks, kind=private_plflt), int(sub_ticks, kind=private_plint), &
               int(n_values, kind=private_plint), values_address_local &
               )
        colorbar_width = real(colorbar_width_out, kind=wp)
        colorbar_height = real(colorbar_height_out, kind=wp)

    end subroutine plcolorbar_impl

    subroutine plconfigtime_impl( scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day, hour, min, sec )
        integer, intent(in) :: ccontrol, year, month, day, hour, min
        logical, intent(in) :: ifbtime_offset
        real(kind=wp), intent(in) :: scale, offset1, offset2, sec

        interface
            subroutine interface_plconfigtime( scale, offset1, offset2, ccontrol, ifbtime_offset, &
                   year, month, day, hour, min, sec) bind(c,name='c_plconfigtime')
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: ccontrol, year, month, day, hour, min
                integer(kind=private_plbool), value, intent(in) :: ifbtime_offset
                real(kind=private_plflt), value, intent(in) :: scale, offset1, offset2, sec
            end subroutine interface_plconfigtime
        end interface

        call interface_plconfigtime( &
               real(scale, kind=private_plflt), real(offset1, kind=private_plflt), real(offset2, kind=private_plflt), &
               int(ccontrol, kind=private_plint), int(merge(1,0,ifbtime_offset),kind=private_plbool), &
               int(year, kind=private_plint), int(month, kind=private_plint), int(day, kind=private_plint), &
               int(hour, kind=private_plint), int(min, kind=private_plint), real(sec, kind=private_plflt) )
    end subroutine plconfigtime_impl

    subroutine plcont_impl_0( z, kx, lx, ky, ly, clevel )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel

        real(kind=private_plflt), dimension(:,:), allocatable, target :: z_in
        type(PLfGrid), target :: fgrid_local

        allocate( z_in(size(z,1),size(z,2)) )
        z_in = z
        fgrid_local%f  = c_loc(z_in)
        fgrid_local%nx = size(z_in,1)
        fgrid_local%ny = size(z_in,2)

        call interface_plfcont( interface_plf2evalr, c_loc(fgrid_local), size(z,1,kind=private_plint), &
               size(z,2,kind=private_plint), kx, lx, ky, ly, real(clevel, kind=private_plflt), &
               size(clevel,kind=private_plint), interface_pltr0, c_null_ptr )
        deallocate(z_in)
    end subroutine plcont_impl_0

    subroutine plcont_impl_1( z, kx, lx, ky, ly, clevel, xg, yg )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel
        real(kind=wp), dimension(:), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: z_in
        real(kind=private_plflt), dimension(:), allocatable, target :: xg_in, yg_in
        type(PLfGrid), target :: fgrid_local
        type(PLcGrid), target :: cgrid_local

        nx_in = size(z,1, kind=private_plint)
        ny_in = size(z,2, kind=private_plint)
        if(nx_in /= size(xg, kind=private_plint) .or. ny_in /= size(yg, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plcont: inconsistent sizes for z, xg, and/or yg"
        end if

        allocate( z_in(nx_in, ny_in) )
        z_in = z
        fgrid_local%f  = c_loc(z_in)
        fgrid_local%nx = nx_in
        fgrid_local%ny = ny_in

        allocate( xg_in(nx_in), yg_in(ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plfcont( interface_plf2evalr, c_loc(fgrid_local), nx_in, ny_in, &
               kx, lx, ky, ly, real(clevel, kind=private_plflt), size(clevel,kind=private_plint), &
               interface_pltr1, c_loc(cgrid_local) )
    end subroutine plcont_impl_1

    subroutine plcont_impl_2( z, kx, lx, ky, ly, clevel, xg, yg )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel
        real(kind=wp), dimension(:,:), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: z_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: xg_in, yg_in
        type(PLfGrid), target :: fgrid_local
        type(PLcGrid), target :: cgrid_local

        nx_in = size(z,1, kind=private_plint)
        ny_in = size(z,2, kind=private_plint)
        if( &
               nx_in /= size(xg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) .or. &
               nx_in /= size(yg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plcont: inconsistent sizes for z, xg and/or yg"
        end if

        allocate( z_in(nx_in, ny_in) )
        z_in = z
        fgrid_local%f  = c_loc(z_in)
        fgrid_local%nx = nx_in
        fgrid_local%ny = ny_in

        allocate( xg_in(nx_in,ny_in), yg_in(nx_in,ny_in) )
        xg_in = xg
        yg_in = yg

        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plfcont( interface_plf2evalr, c_loc(fgrid_local), nx_in, ny_in, &
               kx, lx, ky, ly, real(clevel, kind=private_plflt), size(clevel,kind=private_plint), &
               interface_pltr2f, c_loc(cgrid_local) )
    end subroutine plcont_impl_2

    subroutine plcont_impl_tr( z, kx, lx, ky, ly, clevel, tr )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel
        real(kind=wp), dimension(:), intent(in) :: tr

        real(kind=private_plflt), dimension(6), target :: tr_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: z_in
        type(PLfGrid), target :: fgrid_local

        allocate( z_in(size(z,1),size(z,2)) )
        z_in = z
        fgrid_local%f  = c_loc(z_in)
        fgrid_local%nx = size(z,1)
        fgrid_local%ny = size(z,2)

        tr_in = tr(1:6)

        call interface_plfcont( interface_plf2evalr, c_loc(fgrid_local), size(z,1,kind=private_plint), &
               size(z,2,kind=private_plint), kx, lx, ky, ly, real(clevel, kind=private_plflt), &
               size(clevel,kind=private_plint), plplot_private_pltr, c_loc(tr_in) )
    end subroutine plcont_impl_tr

    subroutine plcont_impl( z, kx, lx, ky, ly, clevel, proc )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel
        procedure(pltransform_proc) :: proc

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform => proc

        call interface_plcont( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), &
               kx, lx, ky, ly, real(clevel, kind=private_plflt), size(clevel,kind=private_plint), &
               pltransformf2c, c_null_ptr )
    end subroutine plcont_impl

    subroutine plcont_impl_data( z, kx, lx, ky, ly, clevel, proc, data )
        integer, intent(in) :: kx, lx, ky, ly
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), dimension(:), intent(in) :: clevel
        procedure(pltransform_proc_data) :: proc
        type(c_ptr), intent(in) :: data

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform_data => proc

        call interface_plcont( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), &
               kx, lx, ky, ly, real(clevel, kind=private_plflt), size(clevel,kind=private_plint), &
               pltransformf2c_data, data )
    end subroutine plcont_impl_data

    subroutine plctime_impl( year, month, day, hour, min, sec, ctime )
        integer, intent(in) :: year, month, day, hour, min
        real(kind=wp), intent(in) :: sec
        real(kind=wp), intent(out) :: ctime

        real(kind=private_plflt) :: ctime_out

        interface
            subroutine interface_plctime( year, month, day, hour, min, sec, ctime ) bind(c,name='c_plctime')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: year, month, day, hour, min
                real(kind=private_plflt), value, intent(in) :: sec
                real(kind=private_plflt), intent(out) :: ctime
            end subroutine interface_plctime
        end interface

        call interface_plctime( &
               int(year, kind=private_plint), int(month, kind=private_plint), int(day, kind=private_plint), &
               int(hour, kind=private_plint), int(min, kind=private_plint), real(sec, kind=private_plflt), ctime_out )
        ! Transform output real values.
        ctime = real(ctime_out, kind=wp)

    end subroutine plctime_impl

    subroutine plenv0_impl( xmin, xmax, ymin, ymax, just, axis )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        integer, intent(in) :: just, axis

        interface
            subroutine interface_plenv0( xmin, xmax, ymin, ymax, just, axis ) bind(c, name='c_plenv0')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
                integer(kind=private_plint), value, intent(in) :: just, axis
            end subroutine interface_plenv0
        end interface

        call interface_plenv0( real(xmin,private_plflt), real(xmax,private_plflt), &
               real(ymin,private_plflt), real(ymax,private_plflt), &
               int(just,private_plint), int(axis,private_plint) )
    end subroutine plenv0_impl

    subroutine plenv_impl( xmin, xmax, ymin, ymax, just, axis )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        integer, intent(in) :: just, axis

        interface
            subroutine interface_plenv( xmin, xmax, ymin, ymax, just, axis ) bind(c, name='c_plenv')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
                integer(kind=private_plint), value, intent(in) :: just, axis
            end subroutine interface_plenv
        end interface

        call interface_plenv( real(xmin,private_plflt), real(xmax,private_plflt), &
               real(ymin,private_plflt), real(ymax,private_plflt), &
               int(just,private_plint), int(axis,private_plint) )
    end subroutine plenv_impl

    subroutine plerrx_impl( xmin, xmax, y )
        real(kind=wp), dimension(:), intent(in) :: xmin, xmax, y

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plerrx( n, xmin, xmax, y ) bind( c, name='c_plerrx')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), dimension(*), intent(in) :: xmin, xmax, y
            end subroutine interface_plerrx
        end interface

        n_local = size(y,kind=private_plint)
        if( n_local /= size(xmin, kind=private_plint) .or. n_local /= size(xmax, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plerrx: inconsistent sizes for xmin, xmax, and/or y"
        end if

        call interface_plerrx( n_local, real(xmin,private_plflt), real(xmax,private_plflt), real(y,private_plflt) )
    end subroutine plerrx_impl

    subroutine plerry_impl( x, ymin, ymax )
        real(kind=wp), dimension(:), intent(in) :: x, ymin, ymax

        integer(kind=private_plint) n_local

        interface
            subroutine interface_plerry( n, x, ymin, ymax ) bind( c, name='c_plerry')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), dimension(*), intent(in) :: x, ymin, ymax
            end subroutine interface_plerry
        end interface

        n_local = size(x,kind=private_plint)
        if( n_local /= size(ymin, kind=private_plint) .or. n_local /= size(ymax, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plerry: inconsistent sizes for x, ymin, and/or ymax"
        end if

        call interface_plerry( n_local, real(x,private_plflt), real(ymin,private_plflt), real(ymax,private_plflt) )
    end subroutine plerry_impl

    subroutine plfill3_impl( x, y, z )
        real(kind=wp), dimension(:), intent(in) :: x, y, z

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plfill3( n, x, y, z ) bind( c, name='c_plfill3')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z
            end subroutine interface_plfill3
        end interface

        n_local = size(x,kind=private_plint)
        if( n_local /= size(y, kind=private_plint) .or. n_local /= size(z, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plfill3: inconsistent sizes for x, y, and/or z"
        end if

        call interface_plfill3( n_local, &
               real(x,private_plflt), real(y,private_plflt) , real(z,private_plflt) )
    end subroutine plfill3_impl

    subroutine plfill_impl( x, y )
        real(kind=wp), dimension(:), intent(in) :: x, y

        integer(kind=private_plint) :: n_local

        n_local = size(x,kind=private_plint)
        if( n_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plfill: inconsistent sizes for x and y"
        end if

        call interface_plfill( n_local, real(x,private_plflt), real(y,private_plflt) )
    end subroutine plfill_impl

    subroutine plgchr_impl( chrdef, chrht )
        real(kind=wp), intent(out) :: chrdef, chrht

        real(kind=private_plflt) :: chrdef_out, chrht_out

        interface
            subroutine interface_plgchr( chrdef, chrht ) bind(c,name='c_plgchr')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: chrdef, chrht
            end subroutine interface_plgchr
        end interface

        call interface_plgchr( chrdef_out, chrht_out )
        chrdef = real(chrdef_out, kind=wp)
        chrht = real(chrht_out, kind=wp)

    end subroutine plgchr_impl

    subroutine plgcmap1_range_impl( min_color, max_color )
        real(kind=wp), intent(out) :: min_color, max_color

        real(kind=private_plflt) :: min_color_out, max_color_out

        interface
            subroutine interface_plgcmap1_range( min_color, max_color ) bind(c,name='c_plgcmap1_range')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: min_color, max_color
            end subroutine interface_plgcmap1_range
        end interface

        call interface_plgcmap1_range( min_color_out, max_color_out )
        min_color = real(min_color_out, kind=wp)
        max_color = real(max_color_out, kind=wp)

    end subroutine plgcmap1_range_impl

    subroutine plgcol0a_impl( icol, r, g, b, a )
        integer, intent(in) :: icol
        integer, intent(out) :: r, g, b
        real(kind=wp), intent(out) :: a

        integer(kind=private_plint) :: r_out, g_out, b_out
        real(kind=private_plflt) :: a_out

        interface
            subroutine interface_plgcol0a( icol, r, g, b, a ) bind(c,name='c_plgcol0a')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: icol
                integer(kind=private_plint), intent(out) :: r, g, b
                real(kind=private_plflt), intent(out) :: a
            end subroutine interface_plgcol0a
        end interface

        call interface_plgcol0a( int(icol,kind=private_plint), r_out, g_out, b_out, a_out )
        r = int(r_out)
        g = int(g_out)
        b = int(b_out)
        a = real(a_out, kind=private_plflt)
    end subroutine plgcol0a_impl

    subroutine plgcolbga_impl( r, g, b, a )
        integer, intent(out) :: r, g, b
        real(kind=wp), intent(out) :: a

        integer(kind=private_plint) :: r_out, g_out, b_out
        real(kind=private_plflt) :: a_out

        interface
            subroutine interface_plgcolbga( r, g, b, a ) bind(c,name='c_plgcolbga')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), intent(out) :: r, g, b
                real(kind=private_plflt), intent(out) :: a
            end subroutine interface_plgcolbga
        end interface

        call interface_plgcolbga( r_out, g_out, b_out, a_out )
        r = int(r_out)
        g = int(g_out)
        b = int(b_out)
        a = real(a_out, kind=private_plflt)
    end subroutine plgcolbga_impl

    subroutine plgdidev_impl( mar, aspect, jx, jy )
        real(kind=wp), intent(out) :: mar, aspect, jx, jy

        real(kind=private_plflt) :: mar_out, aspect_out, jx_out, jy_out

        interface
            subroutine interface_plgdidev( mar, aspect, jx, jy ) bind(c,name='c_plgdidev')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: mar, aspect, jx, jy
            end subroutine interface_plgdidev
        end interface

        call interface_plgdidev( mar_out, aspect_out, jx_out, jy_out )
        mar    = real(mar_out, kind=wp)
        aspect = real(aspect_out, kind=wp)
        jx     = real(jx_out, kind=wp)
        jy     = real(jy_out, kind=wp)
    end subroutine plgdidev_impl

    subroutine plgdiori_impl( rot )
        real(kind=wp), intent(out) :: rot

        real(kind=private_plflt) :: rot_out

        interface
            subroutine interface_plgdiori( rot ) bind(c,name='c_plgdiori')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: rot
            end subroutine interface_plgdiori
        end interface

        call interface_plgdiori( rot_out )
        rot = real(rot_out, kind=wp)
    end subroutine plgdiori_impl

    subroutine plgdiplt_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(out) :: xmin, xmax, ymin, ymax

        real(kind=private_plflt) :: xmin_out, xmax_out, ymin_out, ymax_out

        interface
            subroutine interface_plgdiplt( xmin, xmax, ymin, ymax ) bind(c,name='c_plgdiplt')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: xmin, xmax, ymin, ymax
            end subroutine interface_plgdiplt
        end interface

        call interface_plgdiplt( xmin_out, xmax_out, ymin_out, ymax_out )
        xmin = real(xmin_out, kind=wp)
        xmax = real(xmax_out, kind=wp)
        ymin = real(ymin_out, kind=wp)
        ymax = real(ymax_out, kind=wp)
    end subroutine plgdiplt_impl

    subroutine plgpage_impl( xpmm, ypmm, xwid, ywid, xoff, yoff )
        integer, intent(out) :: xwid, ywid, xoff, yoff
        real(kind=wp), intent(out) :: xpmm, ypmm

        integer(kind=private_plint) :: xwid_out, ywid_out, xoff_out, yoff_out
        real(kind=private_plflt) :: xpmm_out, ypmm_out

        interface
            subroutine interface_plgpage( xpmm, ypmm, xwid, ywid, xoff, yoff ) bind(c,name='c_plgpage')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), intent(out) :: xwid, ywid, xoff, yoff
                real(kind=private_plflt), intent(out) :: xpmm, ypmm
            end subroutine interface_plgpage
        end interface

        call interface_plgpage( xpmm_out, ypmm_out, xwid_out, ywid_out, xoff_out, yoff_out )
        xwid = int(xwid_out)
        ywid = int(ywid_out)
        xoff = int(xoff_out)
        yoff = int(yoff_out)
        xpmm = real(xpmm_out, kind=wp)
        ypmm = real(ypmm_out, kind=wp)
    end subroutine plgpage_impl

    subroutine plgradient_impl( x, y, angle )
        real(kind=wp), dimension(:), intent(in) :: x, y
        real(kind=wp), intent(in) :: angle

        integer(kind=private_plint) :: sz_local

        interface
            subroutine interface_plgradient( sz, x, y, angle ) bind(c,name='c_plgradient')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: sz
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
                real(kind=private_plflt), value, intent(in) :: angle
            end subroutine interface_plgradient
        end interface

        sz_local = size(x,kind=private_plint)
        if( sz_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plgradient: inconsistent sizes for x and y"
        end if

        call interface_plgradient( sz_local, &
               real(x,kind=private_plflt), real(y,kind=private_plflt), &
               real(angle,kind=private_plflt) )
    end subroutine plgradient_impl

    subroutine plgriddata_impl( x, y, z, xg, yg, zg, type, data )
        integer, intent(in) :: type
        real(kind=wp), intent(in) :: data
        real(kind=wp), dimension(:), intent(in) :: x, y, z, xg, yg
        real(kind=wp), dimension(:, :), intent(out) :: zg

        real(kind=private_plflt), dimension(:,:), allocatable, target :: transpose_local
        type(c_ptr), dimension(:), allocatable :: transpose_address_local
        integer(kind=private_plint) :: npts_local, nptsx_local, nptsy_local
        integer :: i_local

        interface
            subroutine interface_plgriddata( x, y, z, npts, &
                   xg, nptsx, yg, nptsy, zg, type, data ) bind(c,name='c_plgriddata')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: npts, nptsx, nptsy, type
                real(kind=private_plflt), value, intent(in) :: data
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z, xg, yg
                type(c_ptr), dimension(*), intent(out) :: zg
            end subroutine interface_plgriddata
        end interface

        npts_local = size(x, kind=private_plint)

        if( &
               npts_local /= size(y, kind=private_plint) .or. &
               npts_local /= size(z, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plgriddata: inconsistent sizes for x, y, and/or z"
        end if

        nptsx_local = size(xg, kind=private_plint)
        nptsy_local = size(yg, kind=private_plint)

        if( &
               nptsx_local /= size(zg, 1, kind=private_plint) .or. &
               nptsy_local /= size(zg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") &
                   "Plplot Fortran Warning: plgriddata: inconsistent sizes for "// &
                   "xg and first dimension of zg or yg and second dimension of zg"
        end if

        ! Prepare array areas to be written to by C version of plgriddata
        ! following relevant parts of code in matrix_to_c.
        allocate( transpose_local(nptsy_local, nptsx_local) )
        allocate( transpose_address_local(nptsx_local) )
        do i_local = 1, nptsx_local
            transpose_address_local(i_local) = c_loc(transpose_local(1,i_local))
        enddo

        call interface_plgriddata( &
               real(x,kind=private_plflt), real(y,kind=private_plflt), real(z,kind=private_plflt), npts_local, &
               real(xg,kind=private_plflt), nptsx_local, real(yg,kind=private_plflt), nptsy_local, &
               transpose_address_local, int(type, kind=private_plint), real(data, kind=private_plflt) )

        zg = real(transpose(transpose_local), kind=wp)
        deallocate(transpose_local, transpose_address_local)
    end subroutine plgriddata_impl

    subroutine plgspa_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(out) :: xmin, xmax, ymin, ymax

        real(kind=private_plflt) :: xmin_out, xmax_out, ymin_out, ymax_out

        interface
            subroutine interface_plgspa( xmin, xmax, ymin, ymax ) bind(c,name='c_plgspa')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: xmin, xmax, ymin, ymax
            end subroutine interface_plgspa
        end interface

        call interface_plgspa( xmin_out, xmax_out, ymin_out, ymax_out )
        xmin = real(xmin_out, kind=private_plflt)
        xmax = real(xmax_out, kind=private_plflt)
        ymin = real(ymin_out, kind=private_plflt)
        ymax = real(ymax_out, kind=private_plflt)
    end subroutine plgspa_impl

    subroutine plgvpd_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(out) :: xmin, xmax, ymin, ymax

        real(kind=private_plflt) :: xmin_out, xmax_out, ymin_out, ymax_out

        interface
            subroutine interface_plgvpd( xmin, xmax, ymin, ymax ) bind(c,name='c_plgvpd')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: xmin, xmax, ymin, ymax
            end subroutine interface_plgvpd
        end interface

        call interface_plgvpd( xmin_out, xmax_out, ymin_out, ymax_out )
        xmin = real(xmin_out, kind=private_plflt)
        xmax = real(xmax_out, kind=private_plflt)
        ymin = real(ymin_out, kind=private_plflt)
        ymax = real(ymax_out, kind=private_plflt)
    end subroutine plgvpd_impl

    subroutine plgvpw_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(out) :: xmin, xmax, ymin, ymax

        real(kind=private_plflt) :: xmin_out, xmax_out, ymin_out, ymax_out
        interface
            subroutine interface_plgvpw( xmin, xmax, ymin, ymax ) bind(c,name='c_plgvpw')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), intent(out) :: xmin, xmax, ymin, ymax
            end subroutine interface_plgvpw
        end interface

        call interface_plgvpw( xmin_out, xmax_out, ymin_out, ymax_out )
        xmin = real(xmin_out, kind=private_plflt)
        xmax = real(xmax_out, kind=private_plflt)
        ymin = real(ymin_out, kind=private_plflt)
        ymax = real(ymax_out, kind=private_plflt)
    end subroutine plgvpw_impl

    subroutine plhist_impl( data, datmin, datmax, nbin, oldwin )
        real(kind=wp), dimension(:), intent(in) :: data
        real(kind=wp), intent(in) :: datmin, datmax
        integer, intent(in) :: nbin, oldwin

        interface
            subroutine interface_plhist( n, data, datmin, datmax, nbin, oldwin ) bind(c,name='c_plhist')
                import :: private_plint, private_plflt
                implicit none
                real(kind=private_plflt), dimension(*), intent(in) :: data
                real(kind=private_plflt), value, intent(in) :: datmin, datmax
                integer(kind=private_plint), value, intent(in) :: n, nbin, oldwin
            end subroutine interface_plhist
        end interface

        call interface_plhist( size(data,kind=private_plint), real(data,kind=private_plflt),     &
               real(datmin,kind=private_plflt), real(datmax,kind=private_plflt), &
               int(nbin,kind=private_plint), int(oldwin,kind=private_plint) )
    end subroutine plhist_impl

    subroutine plhlsrgb_impl( h, l, s, r, g, b )
        real(kind=wp), intent(in) :: h, l, s
        real(kind=wp), intent(out) :: r, g, b

        real(kind=private_plflt) :: r_out, g_out, b_out

        interface
            subroutine interface_plhlsrgb( h, l, s, r, g, b ) bind(c,name='c_plhlsrgb')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: h, l, s
                real(kind=private_plflt), intent(out) :: r, g, b
            end subroutine interface_plhlsrgb
        end interface

        call interface_plhlsrgb( real(h,kind=private_plflt), real(l,kind=private_plflt), real(s,kind=private_plflt), &
               r_out, g_out, b_out )
        r = real(r_out, kind=wp)
        g = real(g_out, kind=wp)
        b = real(b_out, kind=wp)
    end subroutine plhlsrgb_impl

    subroutine plimage_impl( idata, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax
        real(kind=wp), dimension(:, :), intent(in) :: idata

        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        interface
            subroutine interface_plimage( idata, nx, ny, &
                   xmin, xmax, ymin, ymax, &
                   zmin, zmax, Dxmin, Dxmax, Dymin, Dymax ) bind(c,name='c_plimage')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax
                type(c_ptr), dimension(*), intent(in) :: idata
            end subroutine interface_plimage
        end interface

        call matrix_to_c( idata, idata_local, idata_address_local )

        call interface_plimage( &
               idata_address_local, size(idata, 1, kind=private_plint), size(idata, 2, kind=private_plint), &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(Dxmin, kind=private_plflt), real(Dxmax, kind=private_plflt), &
               real(Dymin, kind=private_plflt), real(Dymax, kind=private_plflt) &
               )
    end subroutine plimage_impl

    subroutine plimagefr_impl_1( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata
        real(kind=wp), dimension(:), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:), allocatable, target :: xg_in, yg_in
        type(PLcGrid), target :: cgrid_local
        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        nx_in = size(idata,1, kind=private_plint)
        ny_in = size(idata,2, kind=private_plint)
        if(nx_in + 1 /= size(xg, kind=private_plint) .or. ny_in + 1 /= size(yg, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plimagefr: inconsistent sizes for idata, xg, and/or yg"
        end if

        allocate( xg_in(nx_in+1), yg_in(ny_in+1) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in + 1
        cgrid_local%ny = ny_in + 1
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call matrix_to_c( idata, idata_local, idata_address_local )

        call interface_plimagefr( &
               idata_address_local, nx_in, ny_in, &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt), &
               interface_pltr1, c_loc(cgrid_local) )
    end subroutine plimagefr_impl_1

    subroutine plimagefr_impl_2( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata
        real(kind=wp), dimension(:, :), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:, :), allocatable, target :: xg_in, yg_in
        type(PLcGrid), target :: cgrid_local
        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        nx_in = size(idata,1, kind=private_plint)
        ny_in = size(idata,2, kind=private_plint)
        if( &
               nx_in + 1 /= size(xg, 1, kind=private_plint) .or. ny_in + 1 /= size(xg, 2, kind=private_plint) .or. &
               nx_in + 1 /= size(yg, 1, kind=private_plint) .or. ny_in + 1 /= size(xg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plimagefr: inconsistent sizes for idata, xg and/or yg"
        end if

        allocate( xg_in(nx_in+1,ny_in+1), yg_in(nx_in+1,ny_in+1) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in + 1
        cgrid_local%ny = ny_in + 1
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call matrix_to_c( idata, idata_local, idata_address_local )

        call interface_plimagefr( &
               idata_address_local, nx_in, ny_in, &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt), &
               interface_pltr2f, c_loc(cgrid_local) )
    end subroutine plimagefr_impl_2

    ! Uses NULL C callback and NULL associated data (which has a special meaning at
    ! the C level).
    subroutine plimagefr_impl_null( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata

        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        call matrix_to_c( idata, idata_local, idata_address_local )

        call interface_plimagefr_null( &
               idata_address_local, &
               size(idata, 1, kind=private_plint), size(idata, 2, kind=private_plint), &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt) )
    end subroutine plimagefr_impl_null

    subroutine plimagefr_impl_tr( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, tr )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata
        real(kind=wp), dimension(:), intent(in) :: tr

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local
        real(kind=private_plflt), dimension(6), target :: tr_in

        nx_in = size(idata,1, kind=private_plint)
        ny_in = size(idata,2, kind=private_plint)

        call matrix_to_c( idata, idata_local, idata_address_local )
        tr_in = tr(1:6)

        call interface_plimagefr( &
               idata_address_local, nx_in, ny_in, &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt), &
               plplot_private_pltr, c_loc(tr_in) )
    end subroutine plimagefr_impl_tr

    subroutine plimagefr_impl( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, proc )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata
        procedure(pltransform_proc) :: proc

        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        call matrix_to_c( idata, idata_local, idata_address_local )
        pltransform => proc

        call interface_plimagefr( &
               idata_address_local, &
               size(idata, 1, kind=private_plint), size(idata, 2, kind=private_plint), &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt), &
               pltransformf2c, c_null_ptr )
    end subroutine plimagefr_impl

    subroutine plimagefr_impl_data( idata, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, proc, data )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax
        real(kind=wp), dimension(:, :), intent(in) :: idata
        procedure(pltransform_proc_data) :: proc
        type(c_ptr), intent(in) :: data

        real(kind=private_plflt), dimension(:,:), allocatable :: idata_local
        type(c_ptr), dimension(:), allocatable :: idata_address_local

        call matrix_to_c( idata, idata_local, idata_address_local )
        pltransform_data => proc

        call interface_plimagefr( &
               idata_address_local, &
               size(idata, 1, kind=private_plint), size(idata, 2, kind=private_plint), &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(zmin, kind=private_plflt), real(zmax, kind=private_plflt), &
               real(valuemin, kind=private_plflt), real(valuemax, kind=private_plflt), &
               pltransformf2c_data, data )
    end subroutine plimagefr_impl_data

    subroutine pljoin_impl( x1, y1, x2, y2 )
        real(kind=wp), intent(in) :: x1, y1, x2, y2

        interface
            subroutine interface_pljoin( x1, y1, x2, y2 ) bind(c,name='c_pljoin')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: x1, y1, x2, y2
            end subroutine interface_pljoin
        end interface

        call interface_pljoin( real(x1,kind=private_plflt), real(y1,kind=private_plflt), &
               real(x2,kind=private_plflt), real(y2,kind=private_plflt) )
    end subroutine pljoin_impl

    subroutine pllegend_impl( &
           legend_width, legend_height, &
           opt, position, x, y, &
           plot_width, bg_color, bb_color, bb_style, &
           nrow, ncolumn, opt_array, &
           text_offset, text_scale, text_spacing, &
           text_justification, text_colors, text, &
           box_colors, box_patterns, box_scales, &
           box_line_widths, &
           line_colors, line_styles, line_widths, &
           symbol_colors, symbol_scales, &
           symbol_numbers, symbols )

        real(kind=wp), intent(in) :: plot_width, x, y
        real(kind=wp), intent(in) :: text_offset, text_scale, text_spacing, text_justification
        integer, intent(in) :: position, opt, bg_color, bb_color, bb_style
        integer, intent(in) :: nrow, ncolumn
        real(kind=wp), intent(out) :: legend_width, legend_height

        character(len=*), dimension(:), intent(in) :: text, symbols

        integer, dimension(:), intent(in) :: opt_array, text_colors, box_colors
        integer, dimension(:), intent(in) :: box_patterns
        real(kind=wp), dimension(:), intent(in) :: box_line_widths
        integer, dimension(:), intent(in) :: line_colors, line_styles
        real(kind=wp), dimension(:), intent(in) :: line_widths
        integer, dimension(:), intent(in) :: symbol_colors, symbol_numbers
        real(kind=wp), dimension(:), intent(in) :: box_scales, symbol_scales

        integer(kind=private_plint) :: nlegend_local
        real(kind=private_plflt) :: legend_width_out, legend_height_out
        character(len=1), dimension(:,:), allocatable :: cstring_text_local, cstring_symbols_local
        type(c_ptr), dimension(:), allocatable :: cstring_address_text_local, cstring_address_symbols_local

        interface
            subroutine interface_pllegend( &
                   legend_width, legend_height, &
                   opt, position, x, y, &
                   plot_width, bg_color, bb_color, bb_style, &
                   nrow, ncolumn, nlegend, opt_array, &
                   text_offset, text_scale, text_spacing, &
                   text_justification, text_colors, text, &
                   box_colors, box_patterns, box_scales, &
                   box_line_widths, &
                   line_colors, line_styles, line_widths, &
                   symbol_colors, symbol_scales, &
                   symbol_numbers, symbols ) &
                   bind(c,name='c_pllegend')

                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none

                real(kind=private_plflt), value, intent(in) :: plot_width, x, y
                real(kind=private_plflt), value, intent(in) :: text_offset, text_scale, text_spacing, text_justification
                integer(kind=private_plint), value, intent(in) :: position, opt, bg_color, bb_color, bb_style
                integer(kind=private_plint), value, intent(in) :: nrow, ncolumn, nlegend

                type(c_ptr), dimension(*), intent(in) :: text, symbols

                integer(kind=private_plint), dimension(*), intent(in) :: opt_array, text_colors, box_colors
                integer(kind=private_plint), dimension(*), intent(in) :: box_patterns
                real(kind=private_plflt), dimension(*), intent(in) :: box_line_widths
                integer(kind=private_plint), dimension(*), intent(in) :: line_colors, line_styles
                real(kind=private_plflt), dimension(*), intent(in) :: line_widths
                integer(kind=private_plint), dimension(*), intent(in) :: symbol_colors, symbol_numbers
                real(kind=private_plflt), dimension(*), intent(in) :: box_scales, symbol_scales
                real(kind=private_plflt), intent(out) :: legend_width, legend_height
            end subroutine interface_pllegend
        end interface


        ! Determine number of legend entries and demand consistent
        ! array sizes.

        nlegend_local = size(opt_array)
        if( &
               nlegend_local /= size(text_colors) .or. &
               nlegend_local /= size(text) .or. &
               nlegend_local /= size(box_colors) .or. &
               nlegend_local /= size(box_patterns) .or. &
               nlegend_local /= size(box_scales) .or. &
               nlegend_local /= size(box_line_widths) .or. &
               nlegend_local /= size(line_colors) .or. &
               nlegend_local /= size(line_styles) .or. &
               nlegend_local /= size(line_widths) .or. &
               nlegend_local /= size(symbol_colors) .or. &
               nlegend_local /= size(symbol_scales) .or. &
               nlegend_local /= size(symbol_numbers) .or. &
               nlegend_local /= size(symbols) &
               ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: pllegend: inconsistent sizes for the following arrays:"
            write(error_unit, "(a)") "opt_array"
            write(error_unit, "(a)") "text_colors"
            write(error_unit, "(a)") "text"
            write(error_unit, "(a)") "box_colors"
            write(error_unit, "(a)") "box_patterns"
            write(error_unit, "(a)") "box_scales"
            write(error_unit, "(a)") "box_line_widths"
            write(error_unit, "(a)") "line_colors"
            write(error_unit, "(a)") "line_styles"
            write(error_unit, "(a)") "line_widths"
            write(error_unit, "(a)") "symbol_colors"
            write(error_unit, "(a)") "symbol_scales"
            write(error_unit, "(a)") "symbol_numbers"
            write(error_unit, "(a)") "symbols"
        end if

        call character_array_to_c( cstring_text_local, cstring_address_text_local, text )
        call character_array_to_c( cstring_symbols_local, cstring_address_symbols_local, symbols )

        call interface_pllegend( &
               legend_width_out, legend_height_out, &
               int(opt,kind=private_plint), int(position,kind=private_plint), &
               real(x,kind=private_plflt), real(y,kind=private_plflt), &
               real(plot_width,kind=private_plflt), int(bg_color,kind=private_plint), &
               int(bb_color,kind=private_plint), int(bb_style,kind=private_plint), &
               int(nrow,kind=private_plint), int(ncolumn,kind=private_plint), &
               int(nlegend_local,kind=private_plint), int(opt_array,kind=private_plint), &
               real(text_offset,kind=private_plflt), real(text_scale,kind=private_plflt), &
               real(text_spacing,kind=private_plflt), &
               real(text_justification,kind=private_plflt), int(text_colors,kind=private_plint), &
               cstring_address_text_local, &
               int(box_colors,kind=private_plint), int(box_patterns,kind=private_plint), &
               real(box_scales,kind=private_plflt), &
               real(box_line_widths,kind=private_plflt), &
               int(line_colors,kind=private_plint), int(line_styles,kind=private_plint), &
               real(line_widths,kind=private_plflt), &
               int(symbol_colors,kind=private_plint), real(symbol_scales,kind=private_plflt), &
               int(symbol_numbers,kind=private_plint), cstring_address_symbols_local )

        legend_width = real(legend_width_out, kind=wp)
        legend_height = real(legend_height_out, kind=wp)

    end subroutine pllegend_impl

    subroutine pllightsource_impl( x, y, z )
        real(kind=wp), intent(in) :: x, y, z

        interface
            subroutine interface_pllightsource( x, y, z ) bind(c,name='c_pllightsource')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: x, y, z
            end subroutine interface_pllightsource
        end interface

        call interface_pllightsource( real(x,kind=private_plflt), real(y,kind=private_plflt), real(z,kind=private_plflt) )
    end subroutine pllightsource_impl

    subroutine plline3_impl( x, y, z )
        real(kind=wp), dimension(:), intent(in) :: x, y, z

        integer(kind=private_plint) :: sz_local

        interface
            subroutine interface_plline3( sz, x, y, z ) bind(c,name='c_plline3')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: sz
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z
            end subroutine interface_plline3
        end interface

        sz_local = size(x,kind=private_plint)
        if( sz_local /= size(y, kind=private_plint) .or. sz_local /= size(z, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plline3: inconsistent sizes for x, y, and/or z"
        end if

        call interface_plline3( sz_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               real(z,kind=private_plflt) )
    end subroutine plline3_impl

    subroutine plline_impl( x, y )
        real(kind=wp), dimension(:), intent(in) :: x, y

        integer(kind=private_plint) :: sz_local

        interface
            subroutine interface_plline( sz, x, y ) bind(c,name='c_plline')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: sz
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
            end subroutine interface_plline
        end interface

        sz_local = size(x,kind=private_plint)
        if( sz_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plline: inconsistent sizes for x and y"
        end if

        call interface_plline( sz_local, real(x,kind=private_plflt), real(y,kind=private_plflt) )
    end subroutine plline_impl

    subroutine plmap_impl( proc, name, minx, maxx, miny, maxy )
        procedure(plmapform_proc) :: proc
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy

        type(c_funptr) :: c_funloc_local

         plmapform => proc
        c_funloc_local = c_funloc(plmapformf2c)

        call interface_plmap( c_funloc_local, trim(name)//c_null_char, &
               real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
               real(miny, kind=private_plflt), real(maxy, kind=private_plflt) )
    end subroutine plmap_impl

    subroutine plmap_impl_null( name, minx, maxx, miny, maxy )
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy

        call interface_plmap( c_null_funptr, trim(name)//c_null_char, &
               real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
               real(miny, kind=private_plflt), real(maxy, kind=private_plflt) )
    end subroutine plmap_impl_null

    subroutine plmapfill_impl( proc, name, minx, maxx, miny, maxy, plotentries )
        procedure(plmapform_proc) :: proc
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        plmapform => proc

        if ( present(plotentries) ) then
            call interface_plmapfill( c_funloc(plmapformf2c), trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapfill( c_funloc(plmapformf2c), trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapfill_impl

    subroutine plmapfill_impl_null( name, minx, maxx, miny, maxy, plotentries )
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        if ( present(plotentries) ) then
            call interface_plmapfill( c_null_funptr, trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapfill( c_null_funptr, trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapfill_impl_null

    subroutine plmapline_impl( proc, name, minx, maxx, miny, maxy, plotentries )
        procedure(plmapform_proc) :: proc
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        plmapform => proc

        if ( present(plotentries) ) then
            call interface_plmapline( c_funloc(plmapformf2c), trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapline( c_funloc(plmapformf2c), trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapline_impl

    subroutine plmapline_impl_null( name, minx, maxx, miny, maxy, plotentries )
        character*(*), intent(in) :: name
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        if ( present(plotentries) ) then
            call interface_plmapline( c_null_funptr, trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapline( c_null_funptr, trim(name)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapline_impl_null

    subroutine plmapstring_impl( proc, name, string, minx, maxx, miny, maxy, plotentries )
        procedure(plmapform_proc) :: proc
        character*(*), intent(in) :: name, string
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        plmapform => proc

        if ( present(plotentries) ) then
            call interface_plmapstring( c_funloc(plmapformf2c), &
                   trim(name)//c_null_char, trim(string)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapstring( c_funloc(plmapformf2c), &
                   trim(name)//c_null_char, trim(string)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapstring_impl

    subroutine plmapstring_impl_null( name, string, minx, maxx, miny, maxy, plotentries )
        character*(*), intent(in) :: name, string
        real(kind=wp), intent(in) :: minx, maxx, miny, maxy
        integer, dimension(:), optional, target, intent(in) :: plotentries

        if ( present(plotentries) ) then
            call interface_plmapstring( c_null_funptr, &
                   trim(name)//c_null_char, trim(string)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_loc(plotentries), size(plotentries, kind=private_plint) )
        else
            call interface_plmapstring( c_null_funptr, &
                   trim(name)//c_null_char, trim(string)//c_null_char, &
                   real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
                   real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
                   c_null_ptr, 0_private_plint )
        endif
    end subroutine plmapstring_impl_null

    subroutine plmaptex_impl( proc, name, dx, dy, just, text, minx, maxx, miny, maxy, plotentry )
        procedure(plmapform_proc) :: proc
        character*(*), intent(in) :: name, text
        real(kind=wp), intent(in) :: dx, dy, just, minx, maxx, miny, maxy
        integer, intent(in) :: plotentry

        plmapform => proc

        call interface_plmaptex( c_funloc(plmapformf2c), &
               trim(name)//c_null_char, &
               real(dx, kind=private_plflt), real(dy, kind=private_plflt), &
               real(just, kind=private_plflt), trim(text)//c_null_char, &
               real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
               real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
               int(plotentry, kind=private_plint) )
    end subroutine plmaptex_impl

    subroutine plmaptex_impl_null( name, dx, dy, just, text, minx, maxx, miny, maxy, plotentry )
        character*(*), intent(in) :: name, text
        real(kind=wp), intent(in) :: dx, dy, just, minx, maxx, miny, maxy
        integer, intent(in) :: plotentry

        call interface_plmaptex( c_null_funptr, &
               trim(name)//c_null_char, &
               real(dx, kind=private_plflt), real(dy, kind=private_plflt), &
               real(just, kind=private_plflt), trim(text)//c_null_char, &
               real(minx, kind=private_plflt), real(maxx, kind=private_plflt), &
               real(miny, kind=private_plflt), real(maxy, kind=private_plflt), &
               int(plotentry, kind=private_plint) )
    end subroutine plmaptex_impl_null

    subroutine plmeridians_impl( proc, dlong, dlat, minlong, maxlong, minlat, maxlat )
        procedure(plmapform_proc) :: proc
        real(kind=wp), intent(in) :: dlong, dlat, minlong, maxlong, minlat, maxlat

        plmapform => proc

        call interface_plmeridians( c_funloc(plmapformf2c), &
               real(dlong, kind=private_plflt), real(dlat, kind=private_plflt), &
               real(minlong, kind=private_plflt), real(maxlong, kind=private_plflt), &
               real(minlat, kind=private_plflt), real(maxlat, kind=private_plflt) )
    end subroutine plmeridians_impl

    subroutine plmeridians_impl_null( dlong, dlat, minlong, maxlong, minlat, maxlat )
        real(kind=wp), intent(in) :: dlong, dlat, minlong, maxlong, minlat, maxlat

        call interface_plmeridians( c_null_funptr, &
               real(dlong, kind=private_plflt), real(dlat, kind=private_plflt), &
               real(minlong, kind=private_plflt), real(maxlong, kind=private_plflt), &
               real(minlat, kind=private_plflt), real(maxlat, kind=private_plflt) )
    end subroutine plmeridians_impl_null

    subroutine plmesh_impl( x, y, z, opt )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y
        real(kind=wp), dimension(:,:), intent(in) :: z

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local

        interface
            subroutine interface_plmesh( x, y, zaddress, nx, ny, opt ) bind(c,name='c_plmesh')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plmesh
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plmesh: inconsistent sizes for x, y, and/or z"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plmesh( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local, &
               nx_local, ny_local, int(opt,kind=private_plint))

    end subroutine plmesh_impl

    subroutine plmeshc_impl( x, y, z, opt, clevel )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y, clevel
        real(kind=wp), dimension(:,:), intent(in) :: z

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local

        interface
            subroutine interface_plmeshc( x, y, zaddress, nx, ny, opt, clevel, nlevel ) bind(c,name='c_plmeshc')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt, nlevel
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, clevel
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plmeshc
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plmeshc: inconsistent sizes for x, y, and/or z"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plmeshc( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local, &
               nx_local, ny_local, int(opt,kind=private_plint), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint) )

    end subroutine plmeshc_impl

    subroutine plmtex3_impl( side, disp, pos, just, text )
        real(kind=wp), intent(in) :: disp, pos, just
        character*(*), intent(in) :: side, text

        interface
            subroutine interface_plmtex3( side, disp, pos, just, text ) bind(c,name='c_plmtex3')
                import :: private_plflt
                implicit none
                character(len=1), dimension(*), intent(in) :: side, text
                real(kind=private_plflt), value, intent(in) :: disp, pos, just
            end subroutine interface_plmtex3
        end interface

        call interface_plmtex3( trim(side)//c_null_char, real(disp,kind=private_plflt), real(pos,kind=private_plflt), &
               real(just,kind=private_plflt), trim(text)//c_null_char )
    end subroutine plmtex3_impl

    subroutine plmtex_impl( side, disp, pos, just, text )
        real(kind=wp), intent(in) :: disp, pos, just
        character*(*), intent(in) :: side, text

        interface
            subroutine interface_plmtex( side, disp, pos, just, text ) bind(c,name='c_plmtex')
                import :: private_plflt
                implicit none
                character(len=1), dimension(*), intent(in) :: side, text
                real(kind=private_plflt), value, intent(in) :: disp, pos, just
            end subroutine interface_plmtex
        end interface

        call interface_plmtex( trim(side)//c_null_char, real(disp,kind=private_plflt), real(pos,kind=private_plflt), &
               real(just,kind=private_plflt), trim(text)//c_null_char )
    end subroutine plmtex_impl

    subroutine plot3d_impl( x, y, z, opt, side)
        logical, intent(in) :: side
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y
        real(kind=wp), dimension(:,:), intent(in) :: z

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local

        interface
            subroutine interface_plot3d( x, y, zaddress, nx, ny, opt, side ) bind(c,name='c_plot3d')
                import :: c_ptr
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt
                integer(kind=private_plbool), value, intent(in) :: side
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plot3d
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plot3d: inconsistent sizes for x, y, and/or z"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plot3d( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local,  &
               nx_local, ny_local, int(opt,kind=private_plint), &
               int(merge(1,0,side),kind=private_plbool) )

    end subroutine plot3d_impl

    subroutine plot3dc_impl( x, y, z, opt, clevel )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y, clevel
        real(kind=wp), dimension(:,:), intent(in) :: z

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local

        interface
            subroutine interface_plot3dc( x, y, zaddress, nx, ny, opt, clevel, nlevel ) bind(c,name='c_plot3dc')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt, nlevel
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, clevel
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plot3dc
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plot3dc: inconsistent sizes for x, y, and/or z"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plot3dc( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local,  &
               nx_local, ny_local, int(opt,kind=private_plint), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint) )

    end subroutine plot3dc_impl

    subroutine plot3dcl_impl( x, y, z, opt, clevel, indexxmin, indexymin, indexymax )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y, clevel
        real(kind=wp), dimension(:,:), intent(in) :: z
        integer, intent(in) :: indexxmin
        integer, dimension(:), intent(in) :: indexymin, indexymax

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local, indexxmax_local

        interface
            subroutine interface_plot3dcl( x, y, zaddress, nx, ny, opt, clevel, nlevel, &
                   indexxmin, indexxmax, indexymin, indexymax ) bind(c,name='c_plot3dcl')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt, nlevel, indexxmin, indexxmax
                integer(kind=private_plint), dimension(*), intent(in) :: indexymin, indexymax
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, clevel
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plot3dcl
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plot3dcl: inconsistent sizes for x, y, and/or z"
        end if

        indexxmax_local = size(indexymin)
        if( indexxmax_local /= size(indexymax, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plot3dcl: inconsistent sizes for indexymin and indeyxmax"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plot3dcl( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local, &
               nx_local, ny_local, int(opt,kind=private_plint), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               int(indexxmin,kind=private_plint), indexxmax_local, &
               int(indexymin,kind=private_plint), int(indexymax,kind=private_plint) )

    end subroutine plot3dcl_impl

    subroutine plpath_impl( n, x1, y1, x2, y2 )
        integer, intent(in) :: n
        real(kind=wp), intent(in) :: x1, y1, x2, y2

        interface
            subroutine interface_plpath( n, x1, y1, x2, y2 ) bind(c,name='c_plpath')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), value, intent(in) :: x1, y1, x2, y2
            end subroutine interface_plpath
        end interface

        call interface_plpath( int(n,kind=private_plint), real(x1,kind=private_plflt), &
               real(y1,kind=private_plflt), real(x2,kind=private_plflt), real(y2,kind=private_plflt) )
    end subroutine plpath_impl

    subroutine plpoin3_impl( x, y, z, code )
        integer, intent(in) :: code
        real(kind=wp), dimension(:), intent(in) :: x, y, z

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plpoin3( n, x, y, z, code ) bind(c,name='c_plpoin3')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n, code
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z
            end subroutine interface_plpoin3
        end interface

        n_local = size(x,kind=private_plint)
        if( n_local /= size(y, kind=private_plint) .or. n_local /= size(z, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plpoin3: inconsistent sizes for x, y, and/or z"
        end if

        call interface_plpoin3( n_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               real(z,kind=private_plflt), int(code,kind=private_plint) )
    end subroutine plpoin3_impl

    subroutine plpoin_impl( x, y, code )
        integer, intent(in) :: code
        real(kind=wp), dimension(:), intent(in) :: x, y

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plpoin( n, x, y, code ) bind(c,name='c_plpoin')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n, code
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
            end subroutine interface_plpoin
        end interface

        n_local = size(x,kind=private_plint)
        if( n_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plpoin: inconsistent sizes for x and y"
        end if

        call interface_plpoin( n_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               int(code,kind=private_plint) )
    end subroutine plpoin_impl

    subroutine plpoly3_impl( x, y, z, draw, ifcc )
        logical, intent(in) :: ifcc
        logical, dimension(:), intent(in) :: draw
        real(kind=wp), dimension(:), intent(in) :: x, y, z

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plpoly3( n, x, y, z, draw, ifcc ) bind(c,name='c_plpoly3')
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                integer(kind=private_plbool), value, intent(in) :: ifcc
                integer(kind=private_plbool), dimension(*), intent(in) :: draw
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z
            end subroutine interface_plpoly3
        end interface

        n_local = size(x,kind=private_plint)
        if( n_local /= size(y, kind=private_plint) .or. n_local /= size(z, kind=private_plint) .or. &
               n_local /= size(draw, kind=private_plint) + 1 ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plpoly3: inconsistent sizes for x, y, z, and/or draw"
        end if

        call interface_plpoly3( n_local, &
               real(x,kind=private_plflt), real(y,kind=private_plflt), real(z,kind=private_plflt), &
               int(merge(1,0,draw),kind=private_plbool), int(merge(1,0,ifcc),kind=private_plbool) )
    end subroutine plpoly3_impl

    subroutine plptex3_impl( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text )

        real(kind=wp), intent(in) :: wx, wy, wz, dx, dy, dz, sx, sy, sz, just
        character*(*), intent(in) :: text

        interface
            subroutine interface_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text ) bind(c,name='c_plptex3')
                import :: private_plflt
                implicit none
                character(len=1), dimension(*), intent(in) :: text
                real(kind=private_plflt), value, intent(in) :: wx, wy, wz, dx, dy, dz, sx, sy, sz, just
            end subroutine interface_plptex3
        end interface

        call interface_plptex3( real(wx,kind=private_plflt), real(wy,kind=private_plflt), real(wz,kind=private_plflt), &
               real(dx,kind=private_plflt), real(dy,kind=private_plflt), real(dz,kind=private_plflt), &
               real(sx,kind=private_plflt), real(sy,kind=private_plflt), real(sz,kind=private_plflt), &
               real(just,kind=private_plflt), trim(text)//c_null_char )

    end subroutine plptex3_impl

    subroutine plptex_impl( x, y, dx, dy, just, text )

        real(kind=wp), intent(in) :: x, y, dx, dy, just
        character*(*), intent(in) :: text

        interface
            subroutine interface_plptex( x, y, dx, dy, just, text ) bind(c,name='c_plptex')
                import :: private_plflt
                implicit none
                character(len=1), dimension(*), intent(in) :: text
                real(kind=private_plflt), value, intent(in) :: x, y, dx, dy, just
            end subroutine interface_plptex
        end interface

        call interface_plptex( real(x,kind=private_plflt), real(y,kind=private_plflt), real(dx,kind=private_plflt), &
               real(dy,kind=private_plflt), real(just,kind=private_plflt), trim(text)//c_null_char )

    end subroutine plptex_impl

    subroutine plrgbhls_impl( r, g, b, h, l, s )
        real(kind=wp), intent(in) :: r, g, b
        real(kind=wp), intent(out) :: h, l, s

        real(kind=private_plflt) :: h_out, l_out, s_out

        interface
            subroutine interface_plrgbhls( r, g, b, h, l, s ) bind(c,name='c_plrgbhls')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: r, g, b
                real(kind=private_plflt), intent(out) :: h, l, s
            end subroutine interface_plrgbhls
        end interface

        call interface_plrgbhls( real(r,kind=private_plflt), real(g,kind=private_plflt), real(b,kind=private_plflt), &
               h_out, l_out, s_out )
        h = real(h_out, kind=wp)
        l = real(l_out, kind=wp)
        s = real(s_out, kind=wp)
    end subroutine plrgbhls_impl

    subroutine plschr_impl( chrdef, chrht )
        real(kind=wp), intent(in) :: chrdef, chrht

        interface
            subroutine interface_plschr( chrdef, chrht ) bind(c,name='c_plschr')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: chrdef, chrht
            end subroutine interface_plschr
        end interface

        call interface_plschr( real(chrdef,kind=private_plflt), real(chrht,kind=private_plflt) )
    end subroutine plschr_impl

    subroutine plscmap0a_impl( r, g, b, a )
        integer, dimension(:), intent(in) :: r, g, b
        real(kind=wp), dimension(:), intent(in) :: a

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plscmap0a( r, g, b, a, n ) bind(c,name='c_plscmap0a')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), dimension(*), intent(in) :: r, g, b
                real(kind=private_plflt), dimension(*), intent(in) :: a
                integer(kind=private_plint), value, intent(in) :: n
            end subroutine interface_plscmap0a
        end interface

        n_local = size(r,kind=private_plint)
        if( n_local /= size(g, kind=private_plint) .or. n_local /= size(b, kind=private_plint) .or. &
               n_local /= size(a, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plscmap0a: inconsistent sizes for r, g, b, and/or a"
        end if

        call interface_plscmap0a( int(r,kind=private_plint), int(g,kind=private_plint), int(b,kind=private_plint), &
               real(a,kind=private_plflt), n_local )
    end subroutine plscmap0a_impl

    subroutine plscmap1_range_impl( chrdef, chrht )
        real(kind=wp), intent(in) :: chrdef, chrht

        interface
            subroutine interface_plscmap1_range( chrdef, chrht ) bind(c,name='c_plscmap1_range')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: chrdef, chrht
            end subroutine interface_plscmap1_range
        end interface

        call interface_plscmap1_range( real(chrdef,kind=private_plflt), real(chrht,kind=private_plflt) )
    end subroutine plscmap1_range_impl

    subroutine plscmap1a_impl( r, g, b, a )
        integer, dimension(:), intent(in) :: r, g, b
        real(kind=wp), dimension(:), intent(in) :: a

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plscmap1a( r, g, b, a, n ) bind(c,name='c_plscmap1a')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), dimension(*), intent(in) :: r, g, b
                real(kind=private_plflt), dimension(*), intent(in) :: a
                integer(kind=private_plint), value, intent(in) :: n
            end subroutine interface_plscmap1a
        end interface

        n_local = size(r,kind=private_plint)
        if( n_local /= size(g, kind=private_plint) .or. n_local /= size(b, kind=private_plint) .or. &
               n_local /= size(a, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plscmap1a: inconsistent sizes for r, g, b, and/or a"
        end if

        call interface_plscmap1a( int(r,kind=private_plint), int(g,kind=private_plint), int(b,kind=private_plint), &
               real(a,kind=private_plflt), n_local )
    end subroutine plscmap1a_impl

    subroutine plscmap1l_impl( rgbtype, intensity, coord1, coord2, coord3, alt_hue_path)
        logical, intent(in) :: rgbtype
        real(kind=wp), dimension(:), intent(in) :: intensity, coord1, coord2, coord3
        logical, dimension(:), optional, intent(in) :: alt_hue_path

        integer(kind=private_plint) :: npts_local
        integer(kind=private_plbool), dimension(:), allocatable, target :: ialt_hue_path_local

        interface
            subroutine interface_plscmap1l( rgbtype, npts, intensity, coord1, coord2, coord3, alt_hue_path ) &
                   bind(c,name='c_plscmap1l')
                import :: c_ptr
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: npts
                integer(kind=private_plbool), value, intent(in) :: rgbtype
                real(kind=private_plflt), dimension(*), intent(in) :: intensity, coord1, coord2, coord3
                !integer(kind=private_plbool), dimension(*), intent(in) :: alt_hue_path
                type(c_ptr), value, intent(in) :: alt_hue_path
            end subroutine interface_plscmap1l
        end interface

        npts_local = size(intensity,kind=private_plint)
        if ( present(alt_hue_path) ) then
            if( npts_local /= size(coord1, kind=private_plint) .or. &
                   npts_local /= size(coord2, kind=private_plint) .or. &
                   npts_local /= size(coord3, kind=private_plint) .or. &
                   npts_local /= size(alt_hue_path, kind=private_plint) + 1 ) then
                write(error_unit, "(a)") "Plplot Fortran Warning: plscmap1l: inconsistent sizes for &
                       &intensity, coord1, coord2, coord3, and/or alt_hue_path"
            end if
            allocate( ialt_hue_path_local(size(alt_hue_path)) )
            ialt_hue_path_local = int(merge(1,0,alt_hue_path),kind=private_plbool)

            call interface_plscmap1l( int(merge(1,0,rgbtype),kind=private_plbool), npts_local, &
                   real(intensity,kind=private_plflt), real(coord1,kind=private_plflt), &
                   real(coord2,kind=private_plflt), real(coord3,kind=private_plflt), &
                   c_loc(ialt_hue_path_local) )
            deallocate( ialt_hue_path_local )
        else
            if( npts_local /= size(coord1, kind=private_plint) .or. &
                   npts_local /= size(coord2, kind=private_plint) .or. &
                   npts_local /= size(coord3, kind=private_plint) ) then
                write(error_unit, "(a)") "Plplot Fortran Warning: plscmap1l: inconsistent sizes for &
                       &intensity, coord1, coord2, and/or coord3"
            end if
            call interface_plscmap1l( int(merge(1,0,rgbtype),kind=private_plbool), npts_local, &
                   real(intensity,kind=private_plflt), real(coord1,kind=private_plflt), &
                   real(coord2,kind=private_plflt), real(coord3,kind=private_plflt), &
                   c_null_ptr )
        endif
    end subroutine plscmap1l_impl

    subroutine plscmap1la_impl( rgbtype, intensity, coord1, coord2, coord3, alpha, alt_hue_path)
        logical, intent(in) :: rgbtype
        real(kind=wp), dimension(:), intent(in) :: intensity, coord1, coord2, coord3, alpha
        logical, dimension(:), optional, intent(in) :: alt_hue_path

        integer(kind=private_plint) :: npts_local
        integer(kind=private_plbool), dimension(:), allocatable, target :: ialt_hue_path_local

        interface
            subroutine interface_plscmap1la( rgbtype, n, intensity, coord1, coord2, coord3, alpha, alt_hue_path ) &
                   bind(c,name='c_plscmap1la')
                import :: c_ptr
                import :: private_plint,private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                integer(kind=private_plbool), value, intent(in) :: rgbtype
                real(kind=private_plflt), dimension(*), intent(in) :: intensity, coord1, coord2, coord3, alpha
                !integer(kind=private_plbool), dimension(*), intent(in) :: alt_hue_path
                type(c_ptr), value, intent(in) :: alt_hue_path
            end subroutine interface_plscmap1la
        end interface

        npts_local = size(intensity, kind=private_plint)
        if ( present(alt_hue_path) ) then
            if( npts_local /= size(coord1, kind=private_plint) .or. &
                   npts_local /= size(coord2, kind=private_plint) .or. &
                   npts_local /= size(coord3, kind=private_plint) .or. &
                   npts_local /= size(alpha, kind=private_plint) .or. &
                   npts_local /= size(alt_hue_path, kind=private_plint) + 1 ) then
                write(error_unit, "(a)") "Plplot Fortran Warning: plscmap1la: inconsistent sizes for &
                       &intensity, coord1, coord2, coord3, alpha, and/or alt_hue_path"
            end if
            allocate( ialt_hue_path_local(size(alt_hue_path)) )
            ialt_hue_path_local = int(merge(1,0,alt_hue_path),kind=private_plbool)

            call interface_plscmap1la( int(merge(1,0,rgbtype),kind=private_plbool), npts_local, &
                   real(intensity,kind=private_plflt), real(coord1,kind=private_plflt), &
                   real(coord2,kind=private_plflt), real(coord3,kind=private_plflt), &
                   real(alpha,kind=private_plflt), c_loc(ialt_hue_path_local) )
            deallocate(ialt_hue_path_local)
        else
            if( npts_local /= size(coord1, kind=private_plint) .or. &
                   npts_local /= size(coord2, kind=private_plint) .or. &
                   npts_local /= size(coord3, kind=private_plint) .or. &
                   npts_local /= size(alpha, kind=private_plint) ) then
                write(error_unit, "(a)") "Plplot Fortran Warning: plscmap1la: inconsistent sizes for &
                       &intensity, coord1, coord2, coord3, and/or alpha"
            end if
            call interface_plscmap1la( int(merge(1,0,rgbtype),kind=private_plbool), npts_local, &
                   real(intensity,kind=private_plflt), real(coord1,kind=private_plflt), &
                   real(coord2,kind=private_plflt), real(coord3,kind=private_plflt), &
                   real(alpha,kind=private_plflt), c_null_ptr )
        endif
    end subroutine plscmap1la_impl

    subroutine plscol0a_impl( icol, r, g, b, a )
        integer, intent(in) :: icol, r, g, b
        real(kind=wp), intent(in) :: a

        interface
            subroutine interface_plscol0a( icol, r, g, b, a ) bind(c,name='c_plscol0a')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: icol, r, g, b
                real(kind=private_plflt), value, intent(in) :: a
            end subroutine interface_plscol0a
        end interface

        call interface_plscol0a( int(icol,kind=private_plint), int(r,kind=private_plint), int(g,kind=private_plint), &
               int(b,kind=private_plint), real(a,kind=private_plflt) )
    end subroutine plscol0a_impl

    subroutine plscolbga_impl( r, g, b, a )
        integer, intent(in) :: r, g, b
        real(kind=wp), intent(in) :: a

        interface
            subroutine interface_plscolbga( r, g, b, a ) bind(c,name='c_plscolbga')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: r, g, b
                real(kind=private_plflt), value, intent(in) :: a
            end subroutine interface_plscolbga
        end interface

        call interface_plscolbga( int(r,kind=private_plint), int(g,kind=private_plint), &
               int(b,kind=private_plint), real(a,kind=private_plflt) )
    end subroutine plscolbga_impl

    subroutine plsdidev_impl( mar, aspect, jx, jy )
        real(kind=wp), intent(in) :: mar, aspect, jx, jy

        interface
            subroutine interface_plsdidev( mar, aspect, jx, jy ) bind(c,name='c_plsdidev')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: mar, aspect, jx, jy
            end subroutine interface_plsdidev
        end interface

        call interface_plsdidev( real(mar,kind=private_plflt), real(aspect,kind=private_plflt), &
               real(jx,kind=private_plflt), real(jy,kind=private_plflt) )
    end subroutine plsdidev_impl

    subroutine plsdimap_impl( dimxmi, dimxmax, diymin, dimymax, dimxpmm, diypmm )
        real(kind=wp), intent(in) :: dimxmi, dimxmax, diymin, dimymax, dimxpmm, diypmm

        interface
            subroutine interface_plsdimap( dimxmi, dimxmax, diymin, dimymax, dimxpmm, diypmm ) bind(c,name='c_plsdimap')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: dimxmi, dimxmax, diymin, dimymax, dimxpmm, diypmm
            end subroutine interface_plsdimap
        end interface

        call interface_plsdimap( real(dimxmi,kind=private_plflt), real(dimxmax,kind=private_plflt), &
               real(diymin,kind=private_plflt), real(dimymax,kind=private_plflt), &
               real(dimxpmm,kind=private_plflt), real(diypmm,kind=private_plflt) )
    end subroutine plsdimap_impl

    subroutine plsdiori_impl( rot )
        real(kind=wp), intent(in) :: rot

        interface
            subroutine interface_plsdiori( rot) bind(c,name='c_plsdiori')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: rot
            end subroutine interface_plsdiori
        end interface

        call interface_plsdiori( real(rot,kind=private_plflt) )
    end subroutine plsdiori_impl

    subroutine plsdiplt_impl( xmin, ymin, xmax, ymax )
        real(kind=wp), intent(in) :: xmin, ymin, xmax, ymax

        interface
            subroutine interface_plsdiplt( xmin, ymin, xmax, ymax ) bind(c,name='c_plsdiplt')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, ymin, xmax, ymax
            end subroutine interface_plsdiplt
        end interface

        call interface_plsdiplt( &
               real(xmin,kind=private_plflt), real(ymin,kind=private_plflt), &
               real(xmax,kind=private_plflt), real(ymax,kind=private_plflt) )
    end subroutine plsdiplt_impl

    subroutine plsdiplz_impl( xmin, ymin, xmax, ymax )
        real(kind=wp), intent(in) :: xmin, ymin, xmax, ymax

        interface
            subroutine interface_plsdiplz( xmin, ymin, xmax, ymax ) bind(c,name='c_plsdiplz')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, ymin, xmax, ymax
            end subroutine interface_plsdiplz
        end interface

        call interface_plsdiplz( &
               real(xmin,kind=private_plflt), real(ymin,kind=private_plflt), &
               real(xmax,kind=private_plflt), real(ymax,kind=private_plflt) )
    end subroutine plsdiplz_impl

    subroutine plshade_impl_0( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        integer, intent(in) :: sh_cmap, min_color, max_color
        logical, intent(in) :: rectangular

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )

        call interface_plshade_null( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool) )
    end subroutine plshade_impl_0

    subroutine plshade_impl_1( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        real(kind=wp), dimension(:), intent(in) :: xg, yg
        integer, intent(in) :: sh_cmap, min_color, max_color
        logical, intent(in) :: rectangular

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:), allocatable, target :: xg_in, yg_in
        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        type(PLcGrid), target :: cgrid_local

        call matrix_to_c( z, z_c_local, z_address_local )

        nx_in = size(z,1,kind=private_plint)
        ny_in = size(z,2,kind=private_plint)
        if(nx_in /= size(xg, kind=private_plint) .or. ny_in /= size(yg, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plshade: inconsistent sizes for z, xg, and/or yg"
        end if
        allocate( xg_in(nx_in), yg_in(ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plshade( z_address_local, nx_in, ny_in, c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), &
               interface_pltr1, c_loc(cgrid_local) )
    end subroutine plshade_impl_1

    subroutine plshade_impl_2( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        real(kind=wp), dimension(:,:), intent(in) :: xg, yg
        integer, intent(in) :: sh_cmap, min_color, max_color
        logical, intent(in) :: rectangular

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: xg_in, yg_in
        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        type(PLcGrid), target :: cgrid_local

        call matrix_to_c( z, z_c_local, z_address_local )

        nx_in = size(z,1, kind=private_plint)
        ny_in = size(z,2, kind=private_plint)
        if( &
               nx_in /= size(xg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) .or. &
               nx_in /= size(yg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plshade: inconsistent sizes for z, xg and/or yg"
        end if
        allocate( xg_in(nx_in, ny_in), yg_in(nx_in, ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plshade( z_address_local, nx_in, ny_in, c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), &
               interface_pltr2f, c_loc(cgrid_local) )
    end subroutine plshade_impl_2

    subroutine plshade_impl_tr( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular, tr )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        logical, intent(in) :: rectangular
        real(kind=wp), dimension(:), intent(in) :: tr
        integer, intent(in) :: sh_cmap, min_color, max_color

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        real(kind=private_plflt), dimension(6), target :: tr_in

        call matrix_to_c( z, z_c_local, z_address_local )
        tr_in = tr(1:6)

        call interface_plshade( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), plplot_private_pltr, c_loc(tr_in) )
    end subroutine plshade_impl_tr

    subroutine plshade_impl( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular, proc )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        integer, intent(in) :: sh_cmap, min_color, max_color
        logical, intent(in) :: rectangular
        procedure(pltransform_proc) :: proc

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform => proc

        call interface_plshade( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), pltransformf2c, c_null_ptr )
    end subroutine plshade_impl

    subroutine plshade_impl_data( z, xmin, xmax, ymin, ymax, shade_min, shade_max, sh_cmap, sh_color, sh_width, &
           min_color, min_width, max_color, max_width, rectangular, proc, data )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: sh_width, min_width, max_width
        real(kind=wp), intent(in) :: shade_min, shade_max, sh_color
        integer, intent(in) :: sh_cmap, min_color, max_color
        logical, intent(in) :: rectangular
        procedure(pltransform_proc_data) :: proc
        type(c_ptr), intent(in) :: data

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform_data => proc

        call interface_plshade( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(shade_min,kind=private_plflt), real(shade_max,kind=private_plflt), &
               int(sh_cmap,kind=private_plint), real(sh_color,kind=private_plflt), &
               real(sh_width,kind=private_plflt), &
               int(min_color,kind=private_plint), real(min_width,kind=private_plflt), &
               int(max_color,kind=private_plint), real(max_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), pltransformf2c_data, data )
    end subroutine plshade_impl_data

    subroutine plshades_impl_0( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )

        call interface_plshades_null( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool) )
    end subroutine plshades_impl_0

    subroutine plshades_impl_1( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular
        real(kind=wp), dimension(:), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:), allocatable, target :: xg_in, yg_in
        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        type(PLcGrid), target :: cgrid_local

        call matrix_to_c( z, z_c_local, z_address_local )

        nx_in = size(z,1, kind=private_plint)
        ny_in = size(z,2, kind=private_plint)
        if( &
               nx_in /= size(xg, kind=private_plint) .or. ny_in /= size(yg, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plshades: inconsistent sizes for z, xg and/or yg"
        end if
        allocate( xg_in(nx_in), yg_in(ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plshades( z_address_local, nx_in, ny_in, c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), &
               interface_pltr1, c_loc(cgrid_local) )
    end subroutine plshades_impl_1

    subroutine plshades_impl_2( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular
        real(kind=wp), dimension(:,:), intent(in) :: xg, yg

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: xg_in, yg_in
        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        type(PLcGrid), target :: cgrid_local

        call matrix_to_c( z, z_c_local, z_address_local )

        nx_in = size(z,1, kind=private_plint)
        ny_in = size(z,2, kind=private_plint)
        if( &
               nx_in /= size(xg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) .or. &
               nx_in /= size(yg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plshades: inconsistent sizes for z, xg and/or yg"
        end if

        allocate( xg_in(nx_in,ny_in), yg_in(nx_in,ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plshades( z_address_local, nx_in, ny_in, c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), &
               interface_pltr2f, c_loc(cgrid_local) )
    end subroutine plshades_impl_2

    subroutine plshades_impl_tr( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular, tr )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular
        real(kind=wp), dimension(:), intent(in) :: tr

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local
        real(kind=private_plflt), dimension(6), target :: tr_in

        call matrix_to_c( z, z_c_local, z_address_local )
        tr_in = tr(1:6)

        call interface_plshades( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), plplot_private_pltr, c_loc(tr_in) )
    end subroutine plshades_impl_tr

    subroutine plshades_impl( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular, proc )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular
        procedure(pltransform_proc) :: proc

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform => proc

        call interface_plshades( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), pltransformf2c, c_null_ptr )
    end subroutine plshades_impl

    subroutine plshades_impl_data( z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, &
           rectangular, proc, data )
        real(kind=wp), dimension(:,:), intent(in) :: z
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax
        real(kind=wp), intent(in) :: fill_width, cont_width
        real(kind=wp), dimension(:), intent(in) :: clevel
        integer, intent(in) :: cont_color
        logical, intent(in) :: rectangular
        procedure(pltransform_proc_data) :: proc
        type(c_ptr), intent(in) :: data

        real(kind=private_plflt), dimension(:,:), allocatable :: z_c_local
        type(c_ptr), dimension(:), allocatable :: z_address_local

        call matrix_to_c( z, z_c_local, z_address_local )
        pltransform_data => proc

        call interface_plshades( z_address_local, size(z,1,kind=private_plint), size(z,2,kind=private_plint), c_null_ptr, &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               real(fill_width,kind=private_plflt), &
               int(cont_color,kind=private_plint), real(cont_width,kind=private_plflt), &
               interface_plfill, int(merge(1,0,rectangular),kind=private_plbool), pltransformf2c_data, data )
    end subroutine plshades_impl_data

    subroutine plsmaj_impl( def, scale )
        real(kind=wp), intent(in) :: def, scale

        interface
            subroutine interface_plsmaj( def, scale ) bind(c,name='c_plsmaj')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: def, scale
            end subroutine interface_plsmaj
        end interface

        call interface_plsmaj( real(def,kind=private_plflt), real(scale,kind=private_plflt) )

    end subroutine plsmaj_impl

    subroutine plsmin_impl( def, scale )
        real(kind=wp), intent(in) :: def, scale

        interface
            subroutine interface_plsmin( def, scale ) bind(c,name='c_plsmin')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: def, scale
            end subroutine interface_plsmin
        end interface

        call interface_plsmin( real(def,kind=private_plflt), real(scale,kind=private_plflt) )

    end subroutine plsmin_impl

    subroutine plspage_impl( xp, yp, xleng, yleng, xoff, yoff )
        integer, intent(in) :: xleng, yleng, xoff, yoff
        real(kind=wp), intent(in) :: xp, yp

        interface
            subroutine interface_plspage( xp, yp, xleng, yleng, xoff, yoff ) bind(c,name='c_plspage')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: xleng, yleng, xoff, yoff
                real(kind=private_plflt), value, intent(in) :: xp, yp
            end subroutine interface_plspage
        end interface

        call interface_plspage( real(xp,kind=private_plflt), real(yp,kind=private_plflt), &
               int(xleng,kind=private_plint), int(yleng,kind=private_plint), &
               int(xoff,kind=private_plint), int(yoff,kind=private_plint) )

    end subroutine plspage_impl

    subroutine plssym_impl( def, scale )

        real(kind=wp), intent(in) :: def, scale

        interface
            subroutine interface_plssym( def, scale ) bind(c,name='c_plssym')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: def, scale
            end subroutine interface_plssym
        end interface

        call interface_plssym( real(def,kind=private_plflt), real(scale,kind=private_plflt) )
    end subroutine plssym_impl

    subroutine plstring3_impl( x, y, z, string )

        real(kind=wp), dimension (:), intent(in) :: x, y, z
        character(len=*), intent(in) :: string

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plstring3( n, x, y, z, string ) bind(c,name='c_plstring3')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, z
                character(len=1), dimension(*), intent(in) :: string
            end subroutine interface_plstring3
        end interface

        n_local = size(x, kind=private_plint)
        if(n_local /= size(y, kind=private_plint) .or. n_local /= size(z, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plstring3: inconsistent sizes for x, y, and/or z"
        end if

        call interface_plstring3( n_local, real(x,kind=private_plflt), real(y,kind=private_plflt), real(z,kind=private_plflt), &
               trim(string)//c_null_char )
    end subroutine plstring3_impl

    subroutine plstring_impl( x, y, string )

        real(kind=wp), dimension (:), intent(in) :: x, y
        character(len=*), intent(in) :: string

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plstring( n, x, y, string ) bind(c,name='c_plstring')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
                character(len=1), dimension(*), intent(in) :: string
            end subroutine interface_plstring
        end interface

        n_local = size(x, kind=private_plint)
        if(n_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plstring: inconsistent sizes for x and y"
        end if

        call interface_plstring( n_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               trim(string)//c_null_char )
    end subroutine plstring_impl

    subroutine plstripa_impl( id, pen, x, y )

        integer, intent(in) :: id, pen
        real(kind=wp), intent(in) :: x, y

        interface
            subroutine interface_plstripa( id, pen, x, y ) bind(c,name='c_plstripa')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: id, pen
                real(kind=private_plflt), value, intent(in) :: x, y
            end subroutine interface_plstripa
        end interface

        call interface_plstripa( int(id, kind=private_plint), int(pen, kind=private_plint), &
               real(x,kind=private_plflt), real(y,kind=private_plflt) )
    end subroutine plstripa_impl

    subroutine plstripc_impl( &
           id, xspec, yspec, &
           xmin, xmax, xjump, ymin, ymax, &
           xlpos, ylpos, &
           y_ascl, acc, &
           colbox, collab, &
           colline, styline, legline, &
           labx, laby, labtop )

        logical, intent(in) :: y_ascl, acc
        integer, intent(in) :: colbox, collab
        integer, dimension(:), intent(in) :: colline, styline
        real(kind=wp), intent(in) :: xmin, xmax, xjump, ymin, ymax, xlpos, ylpos
        character(len=*), intent(in) :: xspec, yspec, labx, laby, labtop
        character(len=*), dimension(:), intent(in) :: legline
        integer, intent(out) :: id

        integer(kind=private_plint) :: id_out, n_pens_local
        character(len=1), dimension(:,:), allocatable :: cstring_legline_local
        type(c_ptr), dimension(:), allocatable :: cstring_address_legline_local

        interface
            subroutine interface_plstripc( &
                   id, xspec, yspec, &
                   xmin, xmax, xjump, ymin, ymax, &
                   xlpos, ylpos, &
                   y_ascl, acc, &
                   colbox, collab, &
                   colline, styline, legline, &
                   labx, laby, labtop ) bind(c,name='c_plstripc')
                import :: c_ptr
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: colbox, collab
                integer(kind=private_plint), dimension(*), intent(in) :: colline, styline
                integer(kind=private_plbool), value, intent(in) :: y_ascl, acc
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, xjump, ymin, ymax, xlpos, ylpos
                character(len=1), dimension(*), intent(in) :: xspec, yspec, labx, laby, labtop
                type(c_ptr), dimension(*), intent(in) :: legline
                integer(kind=private_plint), intent(out) :: id

            end subroutine interface_plstripc
        end interface

        n_pens_local = size(colline, kind=private_plint)
        if( &
               n_pens_local /= 4 .or. &
               n_pens_local /= size(styline, kind=private_plint) .or. &
               n_pens_local /= size(legline, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Severe Warning: plstripc: sizes of colline, styline, and/or legline are not 4"
            return
        endif

        call character_array_to_c( cstring_legline_local, cstring_address_legline_local, legline )

        call interface_plstripc( &
               id_out, trim(xspec)//c_null_char, trim(yspec)//c_null_char, &
               real(xmin, kind=private_plflt), real(xmax, kind=private_plflt), real(xjump, kind=private_plflt), &
               real(ymin, kind=private_plflt), real(ymax, kind=private_plflt), &
               real(xlpos, kind=private_plflt), real(ylpos, kind=private_plflt), &
               int(merge(1,0,y_ascl),kind=private_plbool), int(merge(1,0,acc),kind=private_plbool),&
               int(colbox, kind=private_plint), int(collab, kind=private_plint), &
               int(colline, kind=private_plint), int(styline, kind=private_plint), &
               cstring_address_legline_local, &
               trim(labx)//c_null_char, trim(laby)//c_null_char, trim(labtop)//c_null_char )
        id = int(id_out, kind=private_plint)
    end subroutine plstripc_impl

    subroutine plsurf3d_impl( x, y, z, opt, clevel )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y, clevel
        real(kind=wp), dimension(:,:), intent(in) :: z

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local

        interface
            subroutine interface_plsurf3d( x, y, zaddress, nx, ny, opt, clevel, nlevel ) bind(c,name='c_plsurf3d')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt, nlevel
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, clevel
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plsurf3d
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)

        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plsurf3d: inconsistent sizes for x, y, and/or z"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plsurf3d( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local,  &
               nx_local, ny_local, int(opt,kind=private_plint), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint) )

    end subroutine plsurf3d_impl

    subroutine plsurf3dl_impl( x, y, z, opt, clevel, indexxmin, indexymin, indexymax )
        integer, intent(in) :: opt
        real(kind=wp), dimension(:), intent(in) :: x, y, clevel
        real(kind=wp), dimension(:,:), intent(in) :: z
        integer, intent(in) :: indexxmin
        integer, dimension(:), intent(in) :: indexymin, indexymax

        real(kind=private_plflt), dimension(:,:), allocatable :: zz_local
        type(c_ptr), dimension(:), allocatable :: zaddress_local

        integer(kind=private_plint) :: nx_local, ny_local, indexxmax_local

        interface
            subroutine interface_plsurf3dl( x, y, zaddress, nx, ny, opt, clevel, nlevel, &
                   indexxmin, indexxmax, indexymin, indexymax ) bind(c,name='c_plsurf3dl')
                import :: c_ptr
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: nx, ny, opt, nlevel, indexxmin, indexxmax
                integer(kind=private_plint), dimension(*), intent(in) :: indexymin, indexymax
                real(kind=private_plflt), dimension(*), intent(in) :: x, y, clevel
                type(c_ptr), dimension(*), intent(in) :: zaddress
            end subroutine interface_plsurf3dl
        end interface

        nx_local = size(x,kind=private_plint)
        ny_local = size(y,kind=private_plint)
        if( nx_local /= size(z, 1, kind=private_plint) .or. ny_local /= size(z, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plsurf3dl: inconsistent sizes for x, y, and/or z"
        end if

        indexxmax_local = size(indexymin)
        if( indexxmax_local /= size(indexymax, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plsurf3dl: inconsistent sizes for indexymin and indeyxmax"
        end if

        call matrix_to_c( z, zz_local, zaddress_local )

        call interface_plsurf3dl( real(x,kind=private_plflt), real(y,kind=private_plflt), zaddress_local, &
               nx_local, ny_local, int(opt,kind=private_plint), &
               real(clevel,kind=private_plflt), size(clevel,kind=private_plint), &
               int(indexxmin,kind=private_plint), indexxmax_local, &
               int(indexymin,kind=private_plint), int(indexymax,kind=private_plint) )

    end subroutine plsurf3dl_impl

    subroutine plsvpa_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax

        interface
            subroutine interface_plsvpa( xmin, xmax, ymin, ymax ) bind(c,name='c_plsvpa')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
            end subroutine interface_plsvpa
        end interface

        call interface_plsvpa( real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt) )
    end subroutine plsvpa_impl

    ! Another variant defined in the plplot module.
    subroutine plsvect_impl( arrowx, arrowy, fill )
        logical, intent(in) :: fill
        real(kind=wp), dimension(:), intent(in) :: arrowx, arrowy

        integer(kind=private_plint) :: npts_local

        interface
            subroutine interface_plsvect( arrowx, arrowy, npts,  fill ) bind(c,name='c_plsvect')
                import :: private_plint, private_plbool, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: npts
                integer(kind=private_plbool), value, intent(in) :: fill
                real(kind=private_plflt), dimension(*), intent(in) :: arrowx, arrowy
            end subroutine interface_plsvect
        end interface

        npts_local = size(arrowx, kind=private_plint)
        if(npts_local /= size(arrowy, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plsvect: sizes of arrowx and arrowy are not consistent"
        end if

        call interface_plsvect( real(arrowx, kind=private_plflt), real(arrowy, kind=private_plflt),  &
               npts_local, int(merge(1,0,fill), kind=private_plbool) )
    end subroutine plsvect_impl

    subroutine plsym_impl( x, y, code )
        integer, intent(in) :: code
        real(kind=wp), dimension(:), intent(in) :: x, y

        integer(kind=private_plint) :: n_local

        interface
            subroutine interface_plsym( n, x, y, code ) bind(c,name='c_plsym')
                import :: private_plint, private_plflt
                implicit none
                integer(kind=private_plint), value, intent(in) :: n, code
                real(kind=private_plflt), dimension(*), intent(in) :: x, y
            end subroutine interface_plsym
        end interface

        n_local = size(x, kind=private_plint)
        if(n_local /= size(y, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plsym: inconsistent sizes for x and y"
        end if

        call interface_plsym( n_local, real(x,kind=private_plflt), real(y,kind=private_plflt), &
               int(code,kind=private_plint) )
    end subroutine plsym_impl

    subroutine plvasp_impl( aspect)
        real(kind=wp), intent(in) :: aspect

        interface
            subroutine interface_plvasp( aspect ) bind(c,name='c_plvasp')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: aspect
            end subroutine interface_plvasp
        end interface

        call interface_plvasp( real(aspect,kind=private_plflt) )
    end subroutine plvasp_impl

    subroutine plvect_impl_0( u, v, scale )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), intent(in) :: scale

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: u_in, v_in
        type(PLfGrid), target :: fgrid1, fgrid2

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if( nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        allocate( u_in(nx_in,ny_in) )
        allocate( v_in(nx_in,ny_in) )
        u_in = u
        v_in = v
        fgrid1%f  = c_loc(u_in)
        fgrid1%nx = nx_in
        fgrid1%ny = ny_in
        fgrid2%f  = c_loc(v_in)
        fgrid2%nx = nx_in
        fgrid2%ny = ny_in

        call interface_plfvect( interface_plf2evalr, fgrid1, fgrid2, nx_in, ny_in, &
               real(scale,kind=private_plflt), interface_pltr0, c_null_ptr )
    end subroutine plvect_impl_0

    subroutine plvect_impl_1( u, v, scale, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), dimension(:), intent(in) :: xg, yg
        real(kind=wp), intent(in) :: scale

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:), allocatable, target :: xg_in, yg_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: u_in, v_in
        type(PLfGrid), target :: fgrid1, fgrid2
        type(PLcGrid), target :: cgrid_local

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if(nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        if(nx_in /= size(xg, kind=private_plint) .or. ny_in /= size(yg, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u, xg, and/or yg"
        end if

        allocate( u_in(nx_in, ny_in) )
        allocate( v_in(nx_in, ny_in) )
        u_in = u
        v_in = v
        fgrid1%f  = c_loc(u_in)
        fgrid1%nx = nx_in
        fgrid1%ny = ny_in

        fgrid2%f  = c_loc(v_in)
        fgrid2%nx = nx_in
        fgrid2%ny = ny_in

        allocate( xg_in(nx_in), yg_in(ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plfvect( interface_plf2evalr, fgrid1, fgrid2, nx_in, ny_in, &
               real(scale,kind=private_plflt), interface_pltr1, c_loc(cgrid_local) )
    end subroutine plvect_impl_1

    subroutine plvect_impl_2( u, v, scale, xg, yg )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), dimension(:,:), intent(in) :: xg, yg
        real(kind=wp), intent(in) :: scale

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: u_in, v_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: xg_in, yg_in
        type(PLfGrid), target :: fgrid1, fgrid2
        type(PLcGrid), target :: cgrid_local

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if(nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        if( &
               nx_in /= size(xg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) .or. &
               nx_in /= size(yg, 1, kind=private_plint) .or. ny_in /= size(xg, 2, kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u, xg, and/or yg"
        end if

        allocate( u_in(nx_in, ny_in) )
        allocate( v_in(nx_in, ny_in) )
        u_in = u
        v_in = v
        fgrid1%f  = c_loc(u_in)
        fgrid1%nx = nx_in
        fgrid1%ny = ny_in

        fgrid2%f  = c_loc(v_in)
        fgrid2%nx = nx_in
        fgrid2%ny = ny_in

        allocate( xg_in(nx_in, ny_in), yg_in(nx_in, ny_in) )
        xg_in = xg
        yg_in = yg
        cgrid_local%nx = nx_in
        cgrid_local%ny = ny_in
        cgrid_local%xg = c_loc(xg_in)
        cgrid_local%yg = c_loc(yg_in)

        call interface_plfvect( interface_plf2evalr, fgrid1, fgrid2, nx_in, ny_in, &
               real(scale,kind=private_plflt), interface_pltr2f, c_loc(cgrid_local) )
    end subroutine plvect_impl_2

    subroutine plvect_impl_tr( u, v, scale, tr )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), intent(in) :: scale
        real(kind=wp), dimension(:), intent(in) :: tr

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable, target :: u_in, v_in
        real(kind=private_plflt), dimension(6), target :: tr_in
        type(PLfGrid), target :: fgrid1, fgrid2

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if(nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        allocate( u_in(nx_in,ny_in) )
        allocate( v_in(nx_in,ny_in) )
        u_in = u
        v_in = v
        fgrid1%f  = c_loc(u_in)
        fgrid1%nx = nx_in
        fgrid1%ny = ny_in
        fgrid2%f  = c_loc(v_in)
        fgrid2%nx = nx_in
        fgrid2%ny = ny_in

        tr_in = tr(1:6)

        call interface_plfvect( interface_plf2evalr, fgrid1, fgrid2, nx_in, ny_in, &
               real(scale,kind=private_plflt), plplot_private_pltr, c_loc(tr_in) )
    end subroutine plvect_impl_tr

    subroutine plvect_impl( u, v, scale, proc )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), intent(in) :: scale
        procedure(pltransform_proc) :: proc

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable :: u_local, v_local
        type(c_ptr), dimension(:), allocatable :: u_address_local, v_address_local

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if( nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        call matrix_to_c( u, u_local, u_address_local )
        call matrix_to_c( v, v_local, v_address_local )
        pltransform => proc

        call interface_plvect( u_address_local, v_address_local, nx_in, ny_in, &
               real(scale,kind=private_plflt), pltransformf2c, c_null_ptr )
    end subroutine plvect_impl

    subroutine plvect_impl_data( u, v, scale, proc, data )
        real(kind=wp), dimension(:,:), intent(in) :: u, v
        real(kind=wp), intent(in) :: scale
        procedure(pltransform_proc_data) :: proc
        type(c_ptr), intent(in) :: data

        integer(kind=private_plint) :: nx_in, ny_in
        real(kind=private_plflt), dimension(:,:), allocatable :: u_local, v_local
        type(c_ptr), dimension(:), allocatable :: u_address_local, v_address_local

        nx_in = size(u,1,kind=private_plint)
        ny_in = size(u,2,kind=private_plint)
        if( nx_in /= size(v,1,kind=private_plint) .or. ny_in /= size(v,2,kind=private_plint) ) then
            write(error_unit, "(a)") "Plplot Fortran Warning: plvect: inconsistent sizes for u and v"
        end if

        call matrix_to_c( u, u_local, u_address_local )
        call matrix_to_c( v, v_local, v_address_local )
        pltransform_data => proc

        call interface_plvect( u_address_local, v_address_local, nx_in, ny_in, &
               real(scale,kind=private_plflt), pltransformf2c_data, data )
    end subroutine plvect_impl_data

    subroutine plvpas_impl( xmin, xmax, ymin, ymax, aspect )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax, aspect

        interface
            subroutine interface_plvpas( xmin, xmax, ymin, ymax, aspect ) bind(c,name='c_plvpas')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax, aspect
            end subroutine interface_plvpas
        end interface

        call interface_plvpas( real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt), real(aspect,kind=private_plflt) )
    end subroutine plvpas_impl

    subroutine plvpor_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(in) :: xmin, xmax, ymin, ymax

        interface
            subroutine interface_plvpor( xmin, xmax, ymin, ymax ) bind(c,name='c_plvpor')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
            end subroutine interface_plvpor
        end interface

        call interface_plvpor( real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt)  )
    end subroutine plvpor_impl

    subroutine plw3d_impl( basex, basey, height, xmin, xmax, ymin, ymax, zmin, zmax, alt, az )
        real(kind=wp), intent(in) :: basex, basey, height, xmin, xmax, ymin, ymax, zmin, zmax, alt, az

        interface
            subroutine interface_plw3d( basex, basey, height, xmin, xmax, ymin, ymax, zmin, zmax, alt, az ) bind(c,name='c_plw3d')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: basex, basey, height, xmin, xmax, ymin, ymax, zmin, zmax, alt, az
            end subroutine interface_plw3d
        end interface

        call interface_plw3d( real(basex,kind=private_plflt), real(basey,kind=private_plflt), real(height,kind=private_plflt), &
               real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), real(ymin,kind=private_plflt),     &
               real(ymax,kind=private_plflt), real(zmin,kind=private_plflt), real(zmax,kind=private_plflt),     &
               real(alt,kind=private_plflt), real(az,kind=private_plflt) )
    end subroutine plw3d_impl

    subroutine plwidth_impl( width )
        real(kind=wp), intent(in) :: width

        interface
            subroutine interface_plwidth( width ) bind(c,name='c_plwidth')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: width
            end subroutine interface_plwidth
        end interface

        call interface_plwidth( real(width,kind=private_plflt) )
    end subroutine plwidth_impl

    subroutine plwind_impl( xmin, xmax, ymin, ymax )
        real(kind=wp), intent(in):: xmin, xmax, ymin, ymax

        interface
            subroutine interface_plwind( xmin, xmax, ymin, ymax ) bind(c,name='c_plwind')
                import :: private_plflt
                implicit none
                real(kind=private_plflt), value, intent(in) :: xmin, xmax, ymin, ymax
            end subroutine interface_plwind
        end interface

        call interface_plwind( real(xmin,kind=private_plflt), real(xmax,kind=private_plflt), &
               real(ymin,kind=private_plflt), real(ymax,kind=private_plflt) )
    end subroutine plwind_impl